- Emit subsections_via_symbols for Darwin.

- Conditionalize Dwarf debugging output (Darwin only for now).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26582 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2006-03-07 02:23:26 +00:00
parent 3c992d291b
commit d594881a28
4 changed files with 41 additions and 20 deletions

View File

@ -27,15 +27,19 @@ using namespace x86;
/// method to print assembly for each instruction.
///
bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
// if (forDarwin) {
// Let PassManager know we need debug information and relay
// the MachineDebugInfo address on to DwarfWriter.
DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>());
// }
SetupMachineFunction(MF);
O << "\n\n";
if (forDarwin) {
// Emit pre-function debug information.
DW.BeginFunction(MF);
}
// Print out constants referenced by the function
EmitConstantPool(MF.getConstantPool());
@ -88,8 +92,10 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
if (HasDotTypeDotSizeDirective)
O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
if (forDarwin) {
// Emit post-function debug information.
DW.EndFunction(MF);
}
// We didn't modify anything.
return false;

View File

@ -75,8 +75,10 @@ bool X86SharedAsmPrinter::doInitialization(Module &M) {
default: break;
}
if (forDarwin) {
// Emit initial debug information.
DW.BeginModule(M);
}
return AsmPrinter::doInitialization(M);
}
@ -188,11 +190,18 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
O << "\t.indirect_symbol " << *i << "\n";
O << "\t.long\t0\n";
}
}
// Emit initial debug information.
DW.EndModule(M);
// 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
// implementation of multiple entry points). If this doesn't occur, the
// linker can safely perform dead code stripping. Since LLVM never generates
// code that does this, it is always safe to set.
O << "\t.subsections_via_symbols\n";
}
AsmPrinter::doFinalization(M);
return false; // success
}

View File

@ -26,15 +26,19 @@ using namespace x86;
/// method to print assembly for each instruction.
///
bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
if (forDarwin) {
// Let PassManager know we need debug information and relay
// the MachineDebugInfo address on to DwarfWriter.
DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>());
}
SetupMachineFunction(MF);
O << "\n\n";
if (forDarwin) {
// Emit pre-function debug information.
DW.BeginFunction(MF);
}
// Print out constants referenced by the function
EmitConstantPool(MF.getConstantPool());
@ -63,8 +67,10 @@ bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
}
}
if (forDarwin) {
// Emit post-function debug information.
DW.EndFunction(MF);
}
// We didn't modify anything.
return false;