/// method to print assembly for each instruction.
///
bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
- // Let PassManager know we need debug information and relay
- // the MachineDebugInfo address on to DwarfWriter.
- DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>());
+ // 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";
- // Emit pre-function debug information.
- DW.BeginFunction(MF);
+ if (forDarwin) {
+ // Emit pre-function debug information.
+ DW.BeginFunction(MF);
+ }
// Print out constants referenced by the function
EmitConstantPool(MF.getConstantPool());
if (HasDotTypeDotSizeDirective)
O << "\t.size " << CurrentFnName << ", .-" << CurrentFnName << "\n";
- // Emit post-function debug information.
- DW.EndFunction(MF);
+ if (forDarwin) {
+ // Emit post-function debug information.
+ DW.EndFunction(MF);
+ }
// We didn't modify anything.
return false;
default: break;
}
- // Emit initial debug information.
- DW.BeginModule(M);
+ if (forDarwin) {
+ // Emit initial debug information.
+ DW.BeginModule(M);
+ }
return AsmPrinter::doInitialization(M);
}
O << "\t.indirect_symbol " << *i << "\n";
O << "\t.long\t0\n";
}
- }
- // Emit initial debug information.
- DW.EndModule(M);
+ // 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
MachineFunctionPass::getAnalysisUsage(AU);
}
- bool forDarwin; // FIXME: eliminate.
+ bool forDarwin; // FIXME: eliminate.
// Necessary for Darwin to print out the apprioriate types of linker stubs
std::set<std::string> FnStubs, GVStubs, LinkOnceStubs;
/// method to print assembly for each instruction.
///
bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
- // Let PassManager know we need debug information and relay
- // the MachineDebugInfo address on to DwarfWriter.
- DW.SetDebugInfo(&getAnalysis<MachineDebugInfo>());
+ 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";
- // Emit pre-function debug information.
- DW.BeginFunction(MF);
+ if (forDarwin) {
+ // Emit pre-function debug information.
+ DW.BeginFunction(MF);
+ }
// Print out constants referenced by the function
EmitConstantPool(MF.getConstantPool());
}
}
- // Emit post-function debug information.
- DW.EndFunction(MF);
+ if (forDarwin) {
+ // Emit post-function debug information.
+ DW.EndFunction(MF);
+ }
// We didn't modify anything.
return false;