@@ -60,44 +60,43 @@ using namespace llvm::gi;
6060
6161#define DEBUG_TYPE " gicombiner-emitter"
6262
63- namespace {
64- cl::OptionCategory
63+ static cl::OptionCategory
6564 GICombinerEmitterCat (" Options for -gen-global-isel-combiner" );
66- cl::opt<bool > StopAfterParse (
65+ static cl::opt<bool > StopAfterParse (
6766 " gicombiner-stop-after-parse" ,
6867 cl::desc (" Stop processing after parsing rules and dump state" ),
6968 cl::cat(GICombinerEmitterCat));
70- cl::list<std::string>
69+ static cl::list<std::string>
7170 SelectedCombiners (" combiners" , cl::desc(" Emit the specified combiners" ),
7271 cl::cat(GICombinerEmitterCat), cl::CommaSeparated);
73- cl::opt<bool > DebugCXXPreds (
72+ static cl::opt<bool > DebugCXXPreds (
7473 " gicombiner-debug-cxxpreds" ,
7574 cl::desc (" Add Contextual/Debug comments to all C++ predicates" ),
7675 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));
8079
8180constexpr StringLiteral CXXCustomActionPrefix = " GICXXCustomAction_" ;
8281constexpr StringLiteral CXXPredPrefix = " GICXXPred_MI_Predicate_" ;
8382constexpr StringLiteral MatchDataClassName = " GIDefMatchData" ;
8483
8584// ===- CodeExpansions Helpers --------------------------------------------===//
8685
87- void declareInstExpansion (CodeExpansions &CE, const InstructionMatcher &IM ,
88- StringRef Name) {
86+ static void declareInstExpansion (CodeExpansions &CE,
87+ const InstructionMatcher &IM, StringRef Name) {
8988 CE.declare (Name, " State.MIs[" + to_string (IM.getInsnVarID ()) + " ]" );
9089}
9190
92- void declareInstExpansion (CodeExpansions &CE, const BuildMIAction &A,
93- StringRef Name) {
91+ static void declareInstExpansion (CodeExpansions &CE, const BuildMIAction &A,
92+ StringRef Name) {
9493 // Note: we use redeclare here because this may overwrite a matcher inst
9594 // expansion.
9695 CE.redeclare (Name, " OutMIs[" + to_string (A.getInsnID ()) + " ]" );
9796}
9897
99- void declareOperandExpansion (CodeExpansions &CE, const OperandMatcher &OM ,
100- StringRef Name) {
98+ static void declareOperandExpansion (CodeExpansions &CE,
99+ const OperandMatcher &OM, StringRef Name) {
101100 if (OM.isVariadic ()) {
102101 CE.declare (Name, " getRemainingOperands(*State.MIs[" +
103102 to_string (OM.getInsnVarID ()) + " ], " +
@@ -108,33 +107,34 @@ void declareOperandExpansion(CodeExpansions &CE, const OperandMatcher &OM,
108107 }
109108}
110109
111- void declareTempRegExpansion (CodeExpansions &CE, unsigned TempRegID,
112- StringRef Name) {
110+ static void declareTempRegExpansion (CodeExpansions &CE, unsigned TempRegID,
111+ StringRef Name) {
113112 CE.declare (Name, " State.TempRegisters[" + to_string (TempRegID) + " ]" );
114113}
115114
116115// ===- Misc. Helpers -----------------------------------------------------===//
117116
118- template <typename Container> auto keys (Container &&C) {
117+ template <typename Container> static auto keys (Container &&C) {
119118 return map_range (C, [](auto &Entry) -> auto & { return Entry.first ; });
120119}
121120
122- template <typename Container> auto values (Container &&C) {
121+ template <typename Container> static auto values (Container &&C) {
123122 return map_range (C, [](auto &Entry) -> auto & { return Entry.second ; });
124123}
125124
126- std::string getIsEnabledPredicateEnumName (unsigned CombinerRuleID) {
125+ static std::string getIsEnabledPredicateEnumName (unsigned CombinerRuleID) {
127126 return " GICXXPred_Simple_IsRule" + to_string (CombinerRuleID) + " Enabled" ;
128127}
129128
130129// ===- MatchTable Helpers ------------------------------------------------===//
131130
132- LLTCodeGen getLLTCodeGen (const PatternType &PT) {
131+ static LLTCodeGen getLLTCodeGen (const PatternType &PT) {
133132 return *MVTToLLT (getValueType (PT.getLLTRecord ()));
134133}
135134
136135// ===- PrettyStackTrace Helpers ------------------------------------------===//
137136
137+ namespace {
138138class PrettyStackTraceParse : public PrettyStackTraceEntry {
139139 const Record &Def;
140140
@@ -277,6 +277,7 @@ class CombineRuleOperandTypeChecker : private OperandTypeChecker {
277277
278278 const OperandTable &MatchOpTable;
279279};
280+ } // namespace
280281
281282bool CombineRuleOperandTypeChecker::processMatchPattern (InstructionPattern &P) {
282283 MatchPats.push_back (&P);
@@ -2822,8 +2823,6 @@ void GICombinerEmitter::run(raw_ostream &OS) {
28222823 emitTemporariesInit (OS, MaxTemporaries, " GET_GICOMBINER_CONSTRUCTOR_INITS" );
28232824}
28242825
2825- } // end anonymous namespace
2826-
28272826// ===----------------------------------------------------------------------===//
28282827
28292828static void EmitGICombiner (const RecordKeeper &RK, raw_ostream &OS) {
0 commit comments