Skip to content

Commit fb1c4bf

Browse files
authored
[fir] Prefix attrName() getter with get
1 parent 10552f2 commit fb1c4bf

File tree

2 files changed

+94
-82
lines changed

2 files changed

+94
-82
lines changed

flang/include/flang/Optimizer/Dialect/FIROps.td

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,8 +1746,8 @@ def fir_FieldIndexOp : fir_OneResultOp<"field_index", [NoSideEffect]> {
17461746
"mlir::Type":$recTy, CArg<"mlir::ValueRange","{}">:$operands)>];
17471747

17481748
let extraClassDeclaration = [{
1749-
static constexpr llvm::StringRef fieldAttrName() { return "field_id"; }
1750-
static constexpr llvm::StringRef typeAttrName() { return "on_type"; }
1749+
static constexpr llvm::StringRef getFieldAttrName() { return "field_id"; }
1750+
static constexpr llvm::StringRef getTypeAttrName() { return "on_type"; }
17511751
llvm::StringRef getFieldName() { return field_id(); }
17521752
}];
17531753
}
@@ -2012,16 +2012,17 @@ def fir_LenParamIndexOp : fir_OneResultOp<"len_param_index", [NoSideEffect]> {
20122012
let builders = [OpBuilder<(ins "llvm::StringRef":$fieldName,
20132013
"mlir::Type":$recTy),
20142014
[{
2015-
$_state.addAttribute(fieldAttrName(), $_builder.getStringAttr(fieldName));
2016-
$_state.addAttribute(typeAttrName(), TypeAttr::get(recTy));
2015+
$_state.addAttribute(getFieldAttrName(),
2016+
$_builder.getStringAttr(fieldName));
2017+
$_state.addAttribute(getTypeAttrName(), TypeAttr::get(recTy));
20172018
}]
20182019
>];
20192020

20202021
let extraClassDeclaration = [{
2021-
static constexpr llvm::StringRef fieldAttrName() { return "field_id"; }
2022-
static constexpr llvm::StringRef typeAttrName() { return "on_type"; }
2022+
static constexpr llvm::StringRef getFieldAttrName() { return "field_id"; }
2023+
static constexpr llvm::StringRef getTypeAttrName() { return "on_type"; }
20232024
mlir::Type getOnType() {
2024-
return (*this)->getAttrOfType<TypeAttr>(typeAttrName()).getValue();
2025+
return (*this)->getAttrOfType<TypeAttr>(getTypeAttrName()).getValue();
20252026
}
20262027
}];
20272028
}
@@ -2104,8 +2105,10 @@ def fir_DoLoopOp : region_Op<"do_loop",
21042105
];
21052106

21062107
let extraClassDeclaration = [{
2107-
static constexpr llvm::StringRef unorderedAttrName() { return "unordered"; }
2108-
static constexpr llvm::StringRef finalValueAttrName() {
2108+
static constexpr llvm::StringRef getUnorderedAttrName() {
2109+
return "unordered";
2110+
}
2111+
static constexpr llvm::StringRef getFinalValueAttrName() {
21092112
return "finalValue";
21102113
}
21112114

@@ -2143,7 +2146,7 @@ def fir_DoLoopOp : region_Op<"do_loop",
21432146
mlir::Block *getBody() { return &region().front(); }
21442147

21452148
void setUnordered() {
2146-
(*this)->setAttr(unorderedAttrName(),
2149+
(*this)->setAttr(getUnorderedAttrName(),
21472150
mlir::UnitAttr::get(getContext()));
21482151
}
21492152

@@ -2254,7 +2257,7 @@ def fir_IterWhileOp : region_Op<"iterate_while",
22542257
];
22552258

22562259
let extraClassDeclaration = [{
2257-
static constexpr llvm::StringRef finalValueAttrName() {
2260+
static constexpr llvm::StringRef getFinalValueAttrName() {
22582261
return "finalValue";
22592262
}
22602263
mlir::Block *getBody() { return &region().front(); }
@@ -2339,14 +2342,14 @@ def fir_CallOp : fir_Op<"call", [CallOpInterface]> {
23392342
}]>];
23402343

23412344
let extraClassDeclaration = [{
2342-
static constexpr StringRef calleeAttrName() { return "callee"; }
2345+
static constexpr StringRef getCalleeAttrName() { return "callee"; }
23432346

23442347
mlir::FunctionType getFunctionType();
23452348

23462349
/// Get the argument operands to the called function.
23472350
operand_range getArgOperands() {
23482351
if (auto calling =
2349-
(*this)->getAttrOfType<SymbolRefAttr>(calleeAttrName()))
2352+
(*this)->getAttrOfType<SymbolRefAttr>(getCalleeAttrName()))
23502353
return {arg_operand_begin(), arg_operand_end()};
23512354
return {arg_operand_begin() + 1, arg_operand_end()};
23522355
}
@@ -2357,7 +2360,7 @@ def fir_CallOp : fir_Op<"call", [CallOpInterface]> {
23572360
/// Return the callee of this operation.
23582361
CallInterfaceCallable getCallableForCallee() {
23592362
if (auto calling =
2360-
(*this)->getAttrOfType<SymbolRefAttr>(calleeAttrName()))
2363+
(*this)->getAttrOfType<SymbolRefAttr>(getCalleeAttrName()))
23612364
return calling;
23622365
return getOperand(0);
23632366
}
@@ -2397,10 +2400,10 @@ def fir_DispatchOp : fir_Op<"dispatch", []> {
23972400
// operand[0] is the object (of box type)
23982401
operand_iterator arg_operand_begin() { return operand_begin() + 1; }
23992402
operand_iterator arg_operand_end() { return operand_end(); }
2400-
static constexpr llvm::StringRef passArgAttrName() {
2403+
static constexpr llvm::StringRef getPassArgAttrName() {
24012404
return "pass_arg_pos";
24022405
}
2403-
static constexpr llvm::StringRef methodAttrName() { return "method"; }
2406+
static constexpr llvm::StringRef getMethodAttrName() { return "method"; }
24042407
unsigned passArgPos();
24052408
}];
24062409
}
@@ -2498,11 +2501,13 @@ def fir_ConstcOp : fir_Op<"constc", [NoSideEffect]> {
24982501
let verifier = "return ::verify(*this);";
24992502

25002503
let extraClassDeclaration = [{
2501-
static constexpr llvm::StringRef realAttrName() { return "real"; }
2502-
static constexpr llvm::StringRef imagAttrName() { return "imaginary"; }
2504+
static constexpr llvm::StringRef getRealAttrName() { return "real"; }
2505+
static constexpr llvm::StringRef getImagAttrName() { return "imaginary"; }
25032506

2504-
mlir::Attribute getReal() { return (*this)->getAttr(realAttrName()); }
2505-
mlir::Attribute getImaginary() { return (*this)->getAttr(imagAttrName()); }
2507+
mlir::Attribute getReal() { return (*this)->getAttr(getRealAttrName()); }
2508+
mlir::Attribute getImaginary() {
2509+
return (*this)->getAttr(getImagAttrName());
2510+
}
25062511
}];
25072512
}
25082513

@@ -2746,15 +2751,17 @@ def fir_GlobalOp : fir_Op<"global", [IsolatedFromAbove, Symbol]> {
27462751
];
27472752

27482753
let extraClassDeclaration = [{
2749-
static constexpr llvm::StringRef symbolAttrName() { return "symref"; }
2750-
static constexpr llvm::StringRef constantAttrName() { return "constant"; }
2751-
static constexpr llvm::StringRef initValAttrName() { return "initVal"; }
2752-
static constexpr llvm::StringRef linkageAttrName() { return "linkName"; }
2753-
static constexpr llvm::StringRef typeAttrName() { return "type"; }
2754+
static constexpr llvm::StringRef getSymbolAttrName() { return "symref"; }
2755+
static constexpr llvm::StringRef getConstantAttrName() {
2756+
return "constant";
2757+
}
2758+
static constexpr llvm::StringRef getInitValAttrName() { return "initVal"; }
2759+
static constexpr llvm::StringRef getLinkageAttrName() { return "linkName"; }
2760+
static constexpr llvm::StringRef getTypeAttrName() { return "type"; }
27542761

27552762
/// The printable type of the global
27562763
mlir::Type getType() {
2757-
return (*this)->getAttrOfType<TypeAttr>(typeAttrName()).getValue();
2764+
return (*this)->getAttrOfType<TypeAttr>(getTypeAttrName()).getValue();
27582765
}
27592766

27602767
/// The semantic type of the global
@@ -2812,8 +2819,10 @@ def fir_GlobalLenOp : fir_Op<"global_len", []> {
28122819
let printer = "::print(p, *this);";
28132820

28142821
let extraClassDeclaration = [{
2815-
static constexpr llvm::StringRef lenParamAttrName() { return "lenparam"; }
2816-
static constexpr llvm::StringRef intAttrName() { return "intval"; }
2822+
static constexpr llvm::StringRef getLenParamAttrName() {
2823+
return "lenparam";
2824+
}
2825+
static constexpr llvm::StringRef getIntAttrName() { return "intval"; }
28172826
}];
28182827
}
28192828

@@ -2894,8 +2903,8 @@ def fir_DTEntryOp : fir_Op<"dt_entry", []> {
28942903
let printer = "::print(p, *this);";
28952904

28962905
let extraClassDeclaration = [{
2897-
static constexpr llvm::StringRef methodAttrName() { return "method"; }
2898-
static constexpr llvm::StringRef procAttrName() { return "proc"; }
2906+
static constexpr llvm::StringRef getMethodAttrName() { return "method"; }
2907+
static constexpr llvm::StringRef getProcAttrName() { return "proc"; }
28992908
}];
29002909
}
29012910

0 commit comments

Comments
 (0)