diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-01-07 01:30:38 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2008-01-07 01:30:38 +0000 |
commit | ce2247755e56f99a2377b64a1a9d393726582b85 (patch) | |
tree | 3958d8dfd03faf752d6a9a5e5da7cbb23e6a29da /lib/CodeGen/AsmPrinter.cpp | |
parent | 7e40ad51065331b04bcb0291c4868ace20289857 (diff) |
Enabling the target-independent garbage collection infrastructure by hooking it
up to the various compiler pipelines.
This doesn't actually add support for any GC algorithms, which means it
temporarily breaks a few tests. To be fixed shortly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45669 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter.cpp')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index b3643129d9..bb66bd2ad5 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -16,6 +16,8 @@ #include "llvm/DerivedTypes.h" #include "llvm/Constants.h" #include "llvm/Module.h" +#include "llvm/CodeGen/Collector.h" +#include "llvm/CodeGen/CollectorMetadata.h" #include "llvm/CodeGen/MachineConstantPool.h" #include "llvm/CodeGen/MachineJumpTableInfo.h" #include "llvm/CodeGen/MachineModuleInfo.h" @@ -94,9 +96,20 @@ void AsmPrinter::SwitchToDataSection(const char *NewSection, } +void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const { + MachineFunctionPass::getAnalysisUsage(AU); + AU.addRequired<CollectorModuleMetadata>(); +} + bool AsmPrinter::doInitialization(Module &M) { Mang = new Mangler(M, TAI->getGlobalPrefix()); + CollectorModuleMetadata *CMM = getAnalysisToUpdate<CollectorModuleMetadata>(); + assert(CMM && "AsmPrinter didn't require CollectorModuleMetadata?"); + for (CollectorModuleMetadata::iterator I = CMM->begin(), + E = CMM->end(); I != E; ++I) + (*I)->beginAssembly(O, *this, *TAI); + if (!M.getModuleInlineAsm().empty()) O << TAI->getCommentString() << " Start of file scope inline assembly\n" << M.getModuleInlineAsm() @@ -158,6 +171,12 @@ bool AsmPrinter::doFinalization(Module &M) { } } + CollectorModuleMetadata *CMM = getAnalysisToUpdate<CollectorModuleMetadata>(); + assert(CMM && "AsmPrinter didn't require CollectorModuleMetadata?"); + for (CollectorModuleMetadata::iterator I = CMM->end(), + E = CMM->begin(); I != E; ) + (*--I)->finishAssembly(O, *this, *TAI); + delete Mang; Mang = 0; return false; } |