[llvm] r200426 - Move range handling for a function to endFunction rather than

Eric Christopher echristo at gmail.com
Wed Jan 29 15:05:43 PST 2014


Author: echristo
Date: Wed Jan 29 17:05:43 2014
New Revision: 200426

URL: http://llvm.org/viewvc/llvm-project?rev=200426&view=rev
Log:
Move range handling for a function to endFunction rather than
when we create the subprogram DIE.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=200426&r1=200425&r2=200426&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed Jan 29 17:05:43 2014
@@ -422,10 +422,6 @@ DIE *DwarfDebug::updateSubprogramScopeDI
   SPCU->addLabelAddress(SPDie, dwarf::DW_AT_low_pc, FunctionBeginSym);
   SPCU->addLabelAddress(SPDie, dwarf::DW_AT_high_pc, FunctionEndSym);
 
-  // Add this range to the list of ranges for the CU.
-  RangeSpan Span(FunctionBeginSym, FunctionEndSym);
-  SPCU->addRange(llvm_move(Span));
-
   const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();
   MachineLocation Location(RI->getFrameRegister(*Asm->MF));
   SPCU->addAddress(SPDie, dwarf::DW_AT_frame_base, Location);
@@ -1810,6 +1806,7 @@ void DwarfDebug::endFunction(const Machi
   FunctionEndSym = Asm->GetTempSymbol("func_end", Asm->getFunctionNumber());
   // Assumes in correct section after the entry point.
   Asm->OutStreamer.EmitLabel(FunctionEndSym);
+
   // Set DwarfDwarfCompileUnitID in MCContext to default value.
   Asm->OutStreamer.getContext().setDwarfCompileUnitID(0);
 
@@ -1847,10 +1844,13 @@ void DwarfDebug::endFunction(const Machi
   }
 
   DIE *CurFnDIE = constructScopeDIE(TheCU, FnScope);
-
   if (!CurFn->getTarget().Options.DisableFramePointerElim(*CurFn))
     TheCU->addFlag(CurFnDIE, dwarf::DW_AT_APPLE_omit_frame_ptr);
 
+  // Add the range of this function to the list of ranges for the CU.
+  RangeSpan Span(FunctionBeginSym, FunctionEndSym);
+  TheCU->addRange(llvm_move(Span));
+
   // Clear debug info
   for (ScopeVariablesMap::iterator I = ScopeVariables.begin(),
                                    E = ScopeVariables.end();





More information about the llvm-commits mailing list