Make sure that debug labels are defined within the same section and after the
authorJim Laskey <jlaskey@mac.com>
Fri, 7 Apr 2006 20:44:42 +0000 (20:44 +0000)
committerJim Laskey <jlaskey@mac.com>
Fri, 7 Apr 2006 20:44:42 +0000 (20:44 +0000)
entry point of a function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27494 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/DwarfWriter.h
lib/CodeGen/DwarfWriter.cpp
lib/Target/PowerPC/PPCAsmPrinter.cpp
lib/Target/X86/X86ATTAsmPrinter.cpp
lib/Target/X86/X86IntelAsmPrinter.cpp

index 34c69b907de8483660caac0a2f910cf6b9d6d321..e5882777db491098effdda03f397822b24105ae5 100644 (file)
@@ -472,8 +472,8 @@ public:
   ///
   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.
index 19b1d8409c6190c9e3f0b97e54fcaafdb1d1cb1f..ab00a998530a91aab77a5e31588962e3c54c6164 100644 (file)
@@ -1626,15 +1626,13 @@ void DwarfWriter::ConstructRootScope(DebugScope *RootScope) {
   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));
@@ -2408,8 +2406,8 @@ void DwarfWriter::EndModule() {
   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;
   
@@ -2419,8 +2417,7 @@ void DwarfWriter::BeginFunction(MachineFunction *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);
 }
 
index 7645a875109da350301ec45781b1d99a3f6fc77b..b34bf9a8a217813c7962856a2e971d494b1eac28 100644 (file)
@@ -511,9 +511,6 @@ bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   SetupMachineFunction(MF);
   O << "\n\n";
   
-  // Emit pre-function debug information.
-  DW.BeginFunction(&MF);
-
   // Print out constants referenced by the function
   EmitConstantPool(MF.getConstantPool());
 
@@ -539,6 +536,9 @@ bool DarwinAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   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) {
index 5b576b79c91d7ed78b2fe3f5dbbf56817a8679b2..5a3490a703457b423f8b599785ec95407244f87f 100755 (executable)
@@ -35,11 +35,6 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   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());
 
@@ -73,6 +68,11 @@ bool X86ATTAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   }
   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) {
index c49f892a5aa23d060aa0866d74786258799de6aa..718a95b9ab996ebf09bbf38701550ce2a8752453 100755 (executable)
@@ -34,11 +34,6 @@ bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   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());
 
@@ -49,6 +44,11 @@ bool X86IntelAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
   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();