[llvm] r197706 - Add a finishParse() callback to the targer asm parser

David Peixotto dpeixott at codeaurora.org
Thu Dec 19 10:08:08 PST 2013


Author: dpeixott
Date: Thu Dec 19 12:08:08 2013
New Revision: 197706

URL: http://llvm.org/viewvc/llvm-project?rev=197706&view=rev
Log:
Add a finishParse() callback to the targer asm parser

This callback is invoked when the parse has finished successfuly. It
will be used to write out ARM constant pools to implement the ldr
pseudo.

Modified:
    llvm/trunk/include/llvm/MC/MCTargetAsmParser.h
    llvm/trunk/lib/MC/MCParser/AsmParser.cpp

Modified: llvm/trunk/include/llvm/MC/MCTargetAsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCTargetAsmParser.h?rev=197706&r1=197705&r2=197706&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCTargetAsmParser.h (original)
+++ llvm/trunk/include/llvm/MC/MCTargetAsmParser.h Thu Dec 19 12:08:08 2013
@@ -182,6 +182,11 @@ public:
     return 0;
   }
 
+  /// Allow a target to perform any actions after the parse completes
+  /// successfully.  For example, to write out constant pools for ldr pseudo on
+  /// ARM.
+  virtual void finishParse() {};
+
   virtual void onLabelParsed(MCSymbol *Symbol) { };
 };
 

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=197706&r1=197705&r2=197706&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Thu Dec 19 12:08:08 2013
@@ -677,6 +677,10 @@ bool AsmParser::Run(bool NoInitialTextSe
     }
   }
 
+  // Callback to the target parser in case it needs to do anything.
+  if (!HadError)
+    getTargetParser().finishParse();
+
   // Finalize the output stream if there are no errors and if the client wants
   // us to.
   if (!HadError && !NoFinalize)





More information about the llvm-commits mailing list