Add a finishParse() callback to the targer asm parser
authorDavid Peixotto <dpeixott@codeaurora.org>
Thu, 19 Dec 2013 18:08:08 +0000 (18:08 +0000)
committerDavid Peixotto <dpeixott@codeaurora.org>
Thu, 19 Dec 2013 18:08:08 +0000 (18:08 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197706 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCTargetAsmParser.h
lib/MC/MCParser/AsmParser.cpp

index d132a732c4163af55720128d2cb926b567ee57ed..bfcf233f70baccdb9928b8ab92f26fc55b43013c 100644 (file)
@@ -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) { };
 };
 
index 35f38a2a87c44412b37507a84690848a2cb1d3f7..5de10a7ba37e890380caff03cb462e3f0e359395 100644 (file)
@@ -677,6 +677,10 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
     }
   }
 
+  // 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)