[llvm] r199263 - Enable use of ranges for translation units in the presence of

Eric Christopher echristo at gmail.com
Tue Jan 14 14:44:18 PST 2014


Author: echristo
Date: Tue Jan 14 16:44:17 2014
New Revision: 199263

URL: http://llvm.org/viewvc/llvm-project?rev=199263&view=rev
Log:
Enable use of ranges for translation units in the presence of
-ffunction-sections and update comments and TODOs about other
places that we should enable this.

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=199263&r1=199262&r2=199263&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Jan 14 16:44:17 2014
@@ -1050,13 +1050,15 @@ void DwarfDebug::finalizeModuleInfo() {
                       dwarf::DW_FORM_data8, ID);
       }
 
-      // If we've requested ranges and have them emit a DW_AT_ranges attribute
-      // on the unit that will remain in the .o file, otherwise add a
-      // DW_AT_low_pc.
+      // If we have code split among multiple sections or we've requested
+      // it then emit a DW_AT_ranges attribute on the unit that will remain
+      // in the .o file, otherwise add a DW_AT_low_pc.
       // FIXME: Also add a high pc if we can.
-      // FIXME: We should use ranges if we have multiple compile units.
+      // FIXME: We should use ranges if we have multiple compile units or
+      // allow reordering of code ala .subsections_via_symbols in mach-o.
       DwarfCompileUnit *U = SkCU ? SkCU : static_cast<DwarfCompileUnit *>(TheU);
-      if (DwarfCURanges && TheU->getRanges().size())
+      if ((DwarfCURanges || TargetMachine::getFunctionSections()) &&
+          TheU->getRanges().size())
         addSectionLabel(Asm, U, U->getUnitDie(), dwarf::DW_AT_ranges,
                         Asm->GetTempSymbol("cu_ranges", U->getUniqueID()),
                         DwarfDebugRangeSectionSym);





More information about the llvm-commits mailing list