///
void EndModule();
- /// BeginFunction - Gather pre-function debug information.
- ///
+ /// BeginFunction - Gather pre-function debug information. Assumes being
+ /// emitted immediately after the function entry point.
void BeginFunction(MachineFunction *MF);
/// EndFunction - Gather and emit post-function debug information.
CompileUnitDesc *UnitDesc = static_cast<CompileUnitDesc *>(SPD->getContext());
CompileUnit *Unit = FindCompileUnit(UnitDesc);
- // Generate the mangled name.
- std::string MangledName = Asm->Mang->getValueName(MF->getFunction());
-
// Get the subprogram die.
DIE *SPDie = Unit->getDieMapSlotFor(SPD);
assert(SPDie && "Missing subprogram descriptor");
// Add the function bounds.
- SPDie->AddObjectLabel(DW_AT_low_pc, DW_FORM_addr, MangledName);
+ SPDie->AddLabel(DW_AT_low_pc, DW_FORM_addr,
+ DWLabel("func_begin", SubprogramCount));
SPDie->AddLabel(DW_AT_high_pc, DW_FORM_addr,
DWLabel("func_end", SubprogramCount));
MachineLocation Location(RI->getFrameRegister(*MF));
EmitDebugMacInfo();
}
-/// BeginFunction - Gather pre-function debug information.
-///
+/// BeginFunction - Gather pre-function debug information. Assumes being
+/// emitted immediately after the function entry point.
void DwarfWriter::BeginFunction(MachineFunction *MF) {
this->MF = MF;
if (!ShouldEmitDwarf()) return;
EOL("Dwarf Begin Function");
- // Define begin label for subprogram.
- Asm->SwitchSection(TextSection, 0);
+ // Assumes in correct section after the entry point.
EmitLabel("func_begin", ++SubprogramCount);
}
SetupMachineFunction(MF);
O << "\n\n";
- // Emit pre-function debug information.
- DW.BeginFunction(&MF);
-
// Print out constants referenced by the function
EmitConstantPool(MF.getConstantPool());
EmitAlignment(4, F);
O << CurrentFnName << ":\n";
+ // Emit pre-function debug information.
+ DW.BeginFunction(&MF);
+
// Print out code for the function.
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
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());
}
O << CurrentFnName << ":\n";
+ if (forDarwin) {
+ // Emit pre-function debug information.
+ DW.BeginFunction(&MF);
+ }
+
// Print out code for the function.
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();
I != E; ++I) {
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());
if (HasDotTypeDotSizeDirective)
O << "\t.type\t" << CurrentFnName << ", @function\n";
O << CurrentFnName << ":\n";
+
+ if (forDarwin) {
+ // Emit pre-function debug information.
+ DW.BeginFunction(&MF);
+ }
// Print out code for the function.
for (MachineFunction::const_iterator I = MF.begin(), E = MF.end();