@@ -60,44 +60,43 @@ using namespace llvm::gi;
60
60
61
61
#define DEBUG_TYPE " gicombiner-emitter"
62
62
63
- namespace {
64
- cl::OptionCategory
63
+ static cl::OptionCategory
65
64
GICombinerEmitterCat (" Options for -gen-global-isel-combiner" );
66
- cl::opt<bool > StopAfterParse (
65
+ static cl::opt<bool > StopAfterParse (
67
66
" gicombiner-stop-after-parse" ,
68
67
cl::desc (" Stop processing after parsing rules and dump state" ),
69
68
cl::cat(GICombinerEmitterCat));
70
- cl::list<std::string>
69
+ static cl::list<std::string>
71
70
SelectedCombiners (" combiners" , cl::desc(" Emit the specified combiners" ),
72
71
cl::cat(GICombinerEmitterCat), cl::CommaSeparated);
73
- cl::opt<bool > DebugCXXPreds (
72
+ static cl::opt<bool > DebugCXXPreds (
74
73
" gicombiner-debug-cxxpreds" ,
75
74
cl::desc (" Add Contextual/Debug comments to all C++ predicates" ),
76
75
cl::cat(GICombinerEmitterCat));
77
- cl::opt<bool > DebugTypeInfer (" gicombiner-debug-typeinfer" ,
78
- cl::desc (" Print type inference debug logs" ),
79
- cl::cat(GICombinerEmitterCat));
76
+ static cl::opt<bool > DebugTypeInfer (" gicombiner-debug-typeinfer" ,
77
+ cl::desc (" Print type inference debug logs" ),
78
+ cl::cat(GICombinerEmitterCat));
80
79
81
80
constexpr StringLiteral CXXCustomActionPrefix = " GICXXCustomAction_" ;
82
81
constexpr StringLiteral CXXPredPrefix = " GICXXPred_MI_Predicate_" ;
83
82
constexpr StringLiteral MatchDataClassName = " GIDefMatchData" ;
84
83
85
84
// ===- CodeExpansions Helpers --------------------------------------------===//
86
85
87
- void declareInstExpansion (CodeExpansions &CE, const InstructionMatcher &IM ,
88
- StringRef Name) {
86
+ static void declareInstExpansion (CodeExpansions &CE,
87
+ const InstructionMatcher &IM, StringRef Name) {
89
88
CE.declare (Name, " State.MIs[" + to_string (IM.getInsnVarID ()) + " ]" );
90
89
}
91
90
92
- void declareInstExpansion (CodeExpansions &CE, const BuildMIAction &A,
93
- StringRef Name) {
91
+ static void declareInstExpansion (CodeExpansions &CE, const BuildMIAction &A,
92
+ StringRef Name) {
94
93
// Note: we use redeclare here because this may overwrite a matcher inst
95
94
// expansion.
96
95
CE.redeclare (Name, " OutMIs[" + to_string (A.getInsnID ()) + " ]" );
97
96
}
98
97
99
- void declareOperandExpansion (CodeExpansions &CE, const OperandMatcher &OM ,
100
- StringRef Name) {
98
+ static void declareOperandExpansion (CodeExpansions &CE,
99
+ const OperandMatcher &OM, StringRef Name) {
101
100
if (OM.isVariadic ()) {
102
101
CE.declare (Name, " getRemainingOperands(*State.MIs[" +
103
102
to_string (OM.getInsnVarID ()) + " ], " +
@@ -108,33 +107,34 @@ void declareOperandExpansion(CodeExpansions &CE, const OperandMatcher &OM,
108
107
}
109
108
}
110
109
111
- void declareTempRegExpansion (CodeExpansions &CE, unsigned TempRegID,
112
- StringRef Name) {
110
+ static void declareTempRegExpansion (CodeExpansions &CE, unsigned TempRegID,
111
+ StringRef Name) {
113
112
CE.declare (Name, " State.TempRegisters[" + to_string (TempRegID) + " ]" );
114
113
}
115
114
116
115
// ===- Misc. Helpers -----------------------------------------------------===//
117
116
118
- template <typename Container> auto keys (Container &&C) {
117
+ template <typename Container> static auto keys (Container &&C) {
119
118
return map_range (C, [](auto &Entry) -> auto & { return Entry.first ; });
120
119
}
121
120
122
- template <typename Container> auto values (Container &&C) {
121
+ template <typename Container> static auto values (Container &&C) {
123
122
return map_range (C, [](auto &Entry) -> auto & { return Entry.second ; });
124
123
}
125
124
126
- std::string getIsEnabledPredicateEnumName (unsigned CombinerRuleID) {
125
+ static std::string getIsEnabledPredicateEnumName (unsigned CombinerRuleID) {
127
126
return " GICXXPred_Simple_IsRule" + to_string (CombinerRuleID) + " Enabled" ;
128
127
}
129
128
130
129
// ===- MatchTable Helpers ------------------------------------------------===//
131
130
132
- LLTCodeGen getLLTCodeGen (const PatternType &PT) {
131
+ static LLTCodeGen getLLTCodeGen (const PatternType &PT) {
133
132
return *MVTToLLT (getValueType (PT.getLLTRecord ()));
134
133
}
135
134
136
135
// ===- PrettyStackTrace Helpers ------------------------------------------===//
137
136
137
+ namespace {
138
138
class PrettyStackTraceParse : public PrettyStackTraceEntry {
139
139
const Record &Def;
140
140
@@ -277,6 +277,7 @@ class CombineRuleOperandTypeChecker : private OperandTypeChecker {
277
277
278
278
const OperandTable &MatchOpTable;
279
279
};
280
+ } // namespace
280
281
281
282
bool CombineRuleOperandTypeChecker::processMatchPattern (InstructionPattern &P) {
282
283
MatchPats.push_back (&P);
@@ -2822,8 +2823,6 @@ void GICombinerEmitter::run(raw_ostream &OS) {
2822
2823
emitTemporariesInit (OS, MaxTemporaries, " GET_GICOMBINER_CONSTRUCTOR_INITS" );
2823
2824
}
2824
2825
2825
- } // end anonymous namespace
2826
-
2827
2826
// ===----------------------------------------------------------------------===//
2828
2827
2829
2828
static void EmitGICombiner (const RecordKeeper &RK, raw_ostream &OS) {
0 commit comments