diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-27 21:28:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-27 21:28:04 +0000 |
commit | 2b2954f00ba02ca1a902f47080cd9f06aebc0378 (patch) | |
tree | 5b030058053740588b319b8e8fe4b84abd8c1f90 /lib/CodeGen/AsmPrinter | |
parent | b5261ebabb215330d6549048b825d236fb3c9b6b (diff) |
hoist MCContext/MCStreamer up to AsmPrinter since we're going to start creating
MCSections soon instead of Section for all targets, and we need something to
own them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77252 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 792db22b2d..0303f26d8e 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -22,6 +22,8 @@ #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/DwarfWriter.h" #include "llvm/Analysis/DebugInfo.h" +#include "llvm/MC/MCContext.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCInst.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" @@ -47,6 +49,10 @@ AsmPrinter::AsmPrinter(formatted_raw_ostream &o, TargetMachine &tm, const TargetAsmInfo *T, bool VDef) : MachineFunctionPass(&ID), FunctionNumber(0), O(o), TM(tm), TAI(T), TRI(tm.getRegisterInfo()), + + OutContext(*new MCContext()), + OutStreamer(*createAsmStreamer(OutContext, O)), + IsInTextSection(false), LastMI(0), LastFn(0), Counter(~0U), PrevDLT(0, ~0U, ~0U) { DW = 0; MMI = 0; @@ -61,6 +67,9 @@ AsmPrinter::~AsmPrinter() { for (gcp_iterator I = GCMetadataPrinters.begin(), E = GCMetadataPrinters.end(); I != E; ++I) delete I->second; + + delete &OutStreamer; + delete &OutContext; } /// SwitchToTextSection - Switch to the specified text section of the executable @@ -270,6 +279,8 @@ bool AsmPrinter::doFinalization(Module &M) { delete Mang; Mang = 0; DW = 0; MMI = 0; + + OutStreamer.Finish(); return false; } |