From 71a15b131658da5478468f8ab4da437366b461ca Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 18 Sep 2009 20:17:03 +0000 Subject: [PATCH] add a new hook to allow targets to splat stuff at the end of the file. Overriding doFinalization is pretty lame. llvm-svn: 82268 --- llvm/include/llvm/CodeGen/AsmPrinter.h | 4 ++++ llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h index a1765c4c2523..84d0a438e54e 100644 --- a/llvm/include/llvm/CodeGen/AsmPrinter.h +++ b/llvm/include/llvm/CodeGen/AsmPrinter.h @@ -169,6 +169,10 @@ namespace llvm { /// call this implementation. bool doInitialization(Module &M); + /// EmitEndOfAsmFile - This virtual method can be overridden by targets that + /// want to emit something at the end of their file. + virtual void EmitEndOfAsmFile(Module &M) {} + /// doFinalization - Shut down the asmprinter. If you override this in your /// pass, you must make sure to call it explicitly. bool doFinalization(Module &M); diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index e29bff5f66ae..dec78a398fa6 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -208,6 +208,11 @@ bool AsmPrinter::doFinalization(Module &M) { if (MAI->getNonexecutableStackDirective()) O << MAI->getNonexecutableStackDirective() << '\n'; + + // Allow the target to emit any magic that it wants at the end of the file, + // after everything else has gone out. + EmitEndOfAsmFile(M); + delete Mang; Mang = 0; DW = 0; MMI = 0;