[llvm] r317017 - [globalisel][tablegen] Allow any comment in DebugCommentAction. NFC

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 31 11:07:03 PDT 2017


Author: dsanders
Date: Tue Oct 31 11:07:03 2017
New Revision: 317017

URL: http://llvm.org/viewvc/llvm-project?rev=317017&view=rev
Log:
[globalisel][tablegen] Allow any comment in DebugCommentAction. NFC


Modified:
    llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp

Modified: llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp?rev=317017&r1=317016&r2=317017&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp Tue Oct 31 11:07:03 2017
@@ -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::importImplicitD
 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);




More information about the llvm-commits mailing list