diff options
author | David Peixotto <dpeixott@codeaurora.org> | 2013-12-19 18:08:08 +0000 |
---|---|---|
committer | David Peixotto <dpeixott@codeaurora.org> | 2013-12-19 18:08:08 +0000 |
commit | 6075fa1e0eba255e217095bd2573339e64de8c8d (patch) | |
tree | b1ceb03a8d9fc0bddf46ddae3cdafad5600d3d1b | |
parent | 79b37835f931be609e6c5530934135e7726ee40a (diff) | |
download | llvm-6075fa1e0eba255e217095bd2573339e64de8c8d.tar.gz llvm-6075fa1e0eba255e217095bd2573339e64de8c8d.tar.bz2 llvm-6075fa1e0eba255e217095bd2573339e64de8c8d.tar.xz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197706 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/MC/MCTargetAsmParser.h | 5 | ||||
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/llvm/MC/MCTargetAsmParser.h b/include/llvm/MC/MCTargetAsmParser.h index d132a732c4..bfcf233f70 100644 --- a/include/llvm/MC/MCTargetAsmParser.h +++ b/include/llvm/MC/MCTargetAsmParser.h @@ -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) { }; }; diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index 35f38a2a87..5de10a7ba3 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -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) |