]> granicus.if.org Git - llvm/commitdiff
[globalisel][tablegen] Allow any comment in DebugCommentAction. NFC
authorDaniel Sanders <daniel_l_sanders@apple.com>
Tue, 31 Oct 2017 18:07:03 +0000 (18:07 +0000)
committerDaniel Sanders <daniel_l_sanders@apple.com>
Tue, 31 Oct 2017 18:07:03 +0000 (18:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317017 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/GlobalISelEmitter.cpp

index f75456db87059dab3ee0e789f6183f5c64e748f1..85739bbab4ae221284b55d652b3b66cee3185ba7 100644 (file)
@@ -1734,16 +1734,14 @@ public:
 /// Generates a comment describing the matched rule being acted upon.
 class DebugCommentAction : public MatchAction {
 private:
-  const PatternToMatch &P;
+  std::string S;
 
 public:
-  DebugCommentAction(const PatternToMatch &P) : P(P) {}
+  DebugCommentAction(StringRef S) : S(S) {}
 
   void emitActionOpcodes(MatchTable &Table, RuleMatcher &Rule,
                          unsigned RecycleInsnID) const override {
-    Table << MatchTable::Comment(llvm::to_string(*P.getSrcPattern()) + "  =>  " +
-                               llvm::to_string(*P.getDstPattern()))
-          << MatchTable::LineBreak;
+    Table << MatchTable::Comment(S) << MatchTable::LineBreak;
   }
 };
 
@@ -2764,7 +2762,9 @@ Error GlobalISelEmitter::importImplicitDefRenderers(
 Expected<RuleMatcher> GlobalISelEmitter::runOnPattern(const PatternToMatch &P) {
   // Keep track of the matchers and actions to emit.
   RuleMatcher M(P.getSrcRecord()->getLoc());
-  M.addAction<DebugCommentAction>(P);
+  M.addAction<DebugCommentAction>(llvm::to_string(*P.getSrcPattern()) +
+                                  "  =>  " +
+                                  llvm::to_string(*P.getDstPattern()));
 
   if (auto Error = importRulePredicates(M, P.getPredicates()))
     return std::move(Error);