aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-01-08 23:40:34 +0000
committerDevang Patel <dpatel@apple.com>2009-01-08 23:40:34 +0000
commitaa1e84356d47c78a270b0ebceb434a401e59a5b5 (patch)
treeba35a1e9f588e7ef801a8f2432cd92f1a63a1435 /lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
parentd2826ae8c01b25967a1d9ef0c6486720c45f7bc7 (diff)
downloadexternal_llvm-aa1e84356d47c78a270b0ebceb434a401e59a5b5.zip
external_llvm-aa1e84356d47c78a270b0ebceb434a401e59a5b5.tar.gz
external_llvm-aa1e84356d47c78a270b0ebceb434a401e59a5b5.tar.bz2
Convert DwarfWriter into a pass.
Now Users request DwarfWriter through getAnalysisUsage() instead of creating an instance of DwarfWriter object directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61955 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp')
-rw-r--r--lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
index 97b4a1b..27d28a6 100644
--- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
+++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
@@ -44,12 +44,12 @@ STATISTIC(EmittedInsts, "Number of machine instrs printed");
namespace {
struct VISIBILITY_HIDDEN ARMAsmPrinter : public AsmPrinter {
ARMAsmPrinter(raw_ostream &O, TargetMachine &TM, const TargetAsmInfo *T)
- : AsmPrinter(O, TM, T), DW(O, this, T), MMI(NULL), AFI(NULL), MCP(NULL),
+ : AsmPrinter(O, TM, T), DW(0), MMI(NULL), AFI(NULL), MCP(NULL),
InCPMode(false) {
Subtarget = &TM.getSubtarget<ARMSubtarget>();
}
- DwarfWriter DW;
+ DwarfWriter *DW;
MachineModuleInfo *MMI;
/// Subtarget - Keep a pointer to the ARMSubtarget around so that we can
@@ -172,6 +172,7 @@ namespace {
AsmPrinter::getAnalysisUsage(AU);
AU.setPreservesAll();
AU.addRequired<MachineModuleInfo>();
+ AU.addRequired<DwarfWriter>();
}
};
} // end of anonymous namespace
@@ -231,7 +232,7 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
O << CurrentFnName << ":\n";
// Emit pre-function debug information.
- DW.BeginFunction(&MF);
+ DW->BeginFunction(&MF);
if (Subtarget->isTargetDarwin()) {
// If the function is empty, then we need to emit *something*. Otherwise,
@@ -262,7 +263,7 @@ bool ARMAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
// Emit post-function debug information.
- DW.EndFunction(&MF);
+ DW->EndFunction(&MF);
O.flush();
@@ -776,15 +777,15 @@ void ARMAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
}
bool ARMAsmPrinter::doInitialization(Module &M) {
- // Emit initial debug information.
- DW.BeginModule(&M);
bool Result = AsmPrinter::doInitialization(M);
- // AsmPrinter::doInitialization should have done this analysis.
+ // Emit initial debug information.
MMI = getAnalysisToUpdate<MachineModuleInfo>();
assert(MMI);
- DW.SetModuleInfo(MMI);
+ DW = getAnalysisToUpdate<DwarfWriter>();
+ assert(DW && "Dwarf Writer is not available");
+ DW->BeginModule(&M, MMI, O, this, TAI);
// Darwin wants symbols to be quoted if they have complex names.
if (Subtarget->isTargetDarwin())
@@ -1012,7 +1013,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
// Emit initial debug information.
- DW.EndModule();
+ DW->EndModule();
// Funny Darwin hack: This flag tells the linker that no global symbols
// contain code that falls through to other global symbols (e.g. the obvious
@@ -1022,7 +1023,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
O << "\t.subsections_via_symbols\n";
} else {
// Emit final debug information for ELF.
- DW.EndModule();
+ DW->EndModule();
}
return AsmPrinter::doFinalization(M);