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