mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-30 07:00:45 +00:00
Move up dwarf writer initialization in common AsmPrinter class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73784 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
73a76736fb
commit
14a55d952c
@ -177,9 +177,17 @@ bool AsmPrinter::doInitialization(Module &M) {
|
||||
|
||||
SwitchToDataSection(""); // Reset back to no section.
|
||||
|
||||
MachineModuleInfo *MMI = getAnalysisIfAvailable<MachineModuleInfo>();
|
||||
if (MMI) MMI->AnalyzeModule(M);
|
||||
DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||
if (TAI->doesSupportDebugInformation()
|
||||
|| TAI->doesSupportExceptionHandling()) {
|
||||
MachineModuleInfo *MMI = getAnalysisIfAvailable<MachineModuleInfo>();
|
||||
if (MMI) {
|
||||
MMI->AnalyzeModule(M);
|
||||
DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||
if (DW)
|
||||
DW->BeginModule(&M, MMI, O, this, TAI);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,7 @@ ARMDarwinTargetAsmInfo::ARMDarwinTargetAsmInfo(const ARMTargetMachine &TM):
|
||||
SetDirective = "\t.set\t";
|
||||
ProtectedDirective = NULL;
|
||||
HasDotTypeDotSizeDirective = false;
|
||||
SupportsDebugInformation = true;
|
||||
}
|
||||
|
||||
ARMELFTargetAsmInfo::ARMELFTargetAsmInfo(const ARMTargetMachine &TM):
|
||||
@ -85,6 +86,7 @@ ARMELFTargetAsmInfo::ARMELFTargetAsmInfo(const ARMTargetMachine &TM):
|
||||
StaticCtorsSection = "\t.section .ctors,\"aw\",%progbits";
|
||||
StaticDtorsSection = "\t.section .dtors,\"aw\",%progbits";
|
||||
}
|
||||
SupportsDebugInformation = true;
|
||||
}
|
||||
|
||||
/// Count the number of comma-separated arguments.
|
||||
|
@ -828,13 +828,7 @@ void ARMAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
|
||||
bool ARMAsmPrinter::doInitialization(Module &M) {
|
||||
|
||||
bool Result = AsmPrinter::doInitialization(M);
|
||||
|
||||
// Emit initial debug information.
|
||||
MMI = getAnalysisIfAvailable<MachineModuleInfo>();
|
||||
assert(MMI);
|
||||
DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||
assert(DW && "Dwarf Writer is not available");
|
||||
DW->BeginModule(&M, MMI, O, this, TAI);
|
||||
|
||||
// Thumb-2 instructions are supported only in unified assembler syntax mode.
|
||||
if (Subtarget->hasThumb2())
|
||||
|
@ -490,12 +490,8 @@ LinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF)
|
||||
|
||||
bool LinuxAsmPrinter::doInitialization(Module &M) {
|
||||
bool Result = AsmPrinter::doInitialization(M);
|
||||
SwitchToTextSection("\t.text");
|
||||
// Emit initial debug information.
|
||||
DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||
assert(DW && "Dwarf Writer is not available");
|
||||
MMI = getAnalysisIfAvailable<MachineModuleInfo>();
|
||||
DW->BeginModule(&M, MMI, O, this, TAI);
|
||||
SwitchToTextSection("\t.text");
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
@ -646,16 +646,8 @@ bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
|
||||
|
||||
bool PPCLinuxAsmPrinter::doInitialization(Module &M) {
|
||||
bool Result = AsmPrinter::doInitialization(M);
|
||||
|
||||
// Emit initial debug information.
|
||||
MMI = getAnalysisIfAvailable<MachineModuleInfo>();
|
||||
assert(MMI);
|
||||
DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||
assert(DW && "DwarfWriter is not available");
|
||||
DW->BeginModule(&M, MMI, O, this, TAI);
|
||||
|
||||
SwitchToSection(TAI->getTextSection());
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
@ -872,15 +864,7 @@ bool PPCDarwinAsmPrinter::doInitialization(Module &M) {
|
||||
O << "\t.machine " << CPUDirectives[Directive] << '\n';
|
||||
|
||||
bool Result = AsmPrinter::doInitialization(M);
|
||||
|
||||
// Emit initial debug information.
|
||||
// We need this for Personality functions.
|
||||
// AsmPrinter::doInitialization should have done this analysis.
|
||||
MMI = getAnalysisIfAvailable<MachineModuleInfo>();
|
||||
assert(MMI);
|
||||
DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||
assert(DW && "DwarfWriter is not available");
|
||||
DW->BeginModule(&M, MMI, O, this, TAI);
|
||||
|
||||
// Prime text sections so they are adjacent. This reduces the likelihood a
|
||||
// large data or debug section causes a branch to exceed 16M limit.
|
||||
|
@ -780,19 +780,7 @@ void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
|
||||
|
||||
/// doInitialization
|
||||
bool X86ATTAsmPrinter::doInitialization(Module &M) {
|
||||
|
||||
bool Result = AsmPrinter::doInitialization(M);
|
||||
|
||||
if (TAI->doesSupportDebugInformation()) {
|
||||
// Let PassManager know we need debug information and relay
|
||||
// the MachineModuleInfo address on to DwarfWriter.
|
||||
// AsmPrinter::doInitialization did this analysis.
|
||||
MMI = getAnalysisIfAvailable<MachineModuleInfo>();
|
||||
DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||
DW->BeginModule(&M, MMI, O, this, TAI);
|
||||
}
|
||||
|
||||
return Result;
|
||||
return AsmPrinter::doInitialization(M);
|
||||
}
|
||||
|
||||
|
||||
@ -1046,8 +1034,8 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
|
||||
}
|
||||
|
||||
// Emit final debug information.
|
||||
DwarfWriter *DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||
DW->EndModule();
|
||||
if (TAI->doesSupportDebugInformation())
|
||||
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
|
||||
@ -1066,12 +1054,12 @@ bool X86ATTAsmPrinter::doFinalization(Module &M) {
|
||||
}
|
||||
|
||||
// Emit final debug information.
|
||||
DwarfWriter *DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||
DW->EndModule();
|
||||
if (TAI->doesSupportDebugInformation())
|
||||
DW->EndModule();
|
||||
} else if (Subtarget->isTargetELF()) {
|
||||
// Emit final debug information.
|
||||
DwarfWriter *DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||
DW->EndModule();
|
||||
if (TAI->doesSupportDebugInformation())
|
||||
DW->EndModule();
|
||||
}
|
||||
|
||||
return AsmPrinter::doFinalization(M);
|
||||
|
@ -30,14 +30,13 @@ class MachineJumpTableInfo;
|
||||
class MCInst;
|
||||
|
||||
class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
|
||||
DwarfWriter *DW;
|
||||
MachineModuleInfo *MMI;
|
||||
const X86Subtarget *Subtarget;
|
||||
public:
|
||||
explicit X86ATTAsmPrinter(raw_ostream &O, X86TargetMachine &TM,
|
||||
const TargetAsmInfo *T, CodeGenOpt::Level OL,
|
||||
bool V)
|
||||
: AsmPrinter(O, TM, T, OL, V), DW(0), MMI(0) {
|
||||
: AsmPrinter(O, TM, T, OL, V), MMI(0) {
|
||||
Subtarget = &TM.getSubtarget<X86Subtarget>();
|
||||
}
|
||||
|
||||
|
@ -428,6 +428,7 @@ void XCoreAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
|
||||
|
||||
bool XCoreAsmPrinter::doInitialization(Module &M) {
|
||||
bool Result = AsmPrinter::doInitialization(M);
|
||||
DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||
|
||||
if (!FileDirective.empty()) {
|
||||
emitFileDirective(FileDirective);
|
||||
@ -449,11 +450,6 @@ bool XCoreAsmPrinter::doInitialization(Module &M) {
|
||||
}
|
||||
}
|
||||
|
||||
// Emit initial debug information.
|
||||
DW = getAnalysisIfAvailable<DwarfWriter>();
|
||||
assert(DW && "Dwarf Writer is not available");
|
||||
DW->BeginModule(&M, getAnalysisIfAvailable<MachineModuleInfo>(),
|
||||
O, this, TAI);
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ using namespace llvm;
|
||||
XCoreTargetAsmInfo::XCoreTargetAsmInfo(const XCoreTargetMachine &TM)
|
||||
: ELFTargetAsmInfo(TM),
|
||||
Subtarget(TM.getSubtargetImpl()) {
|
||||
SupportsDebugInformation = true;
|
||||
TextSection = getUnnamedSection("\t.text", SectionFlags::Code);
|
||||
DataSection = getNamedSection("\t.dp.data", SectionFlags::Writeable |
|
||||
SectionFlags::Small);
|
||||
|
Loading…
Reference in New Issue
Block a user