[llvm-commits] [llvm] r143920 - in /llvm/trunk/lib/CodeGen/AsmPrinter: DwarfDebug.cpp DwarfDebug.h

Eric Christopher echristo at apple.com
Mon Nov 7 01:18:38 PST 2011


Author: echristo
Date: Mon Nov  7 03:18:38 2011
New Revision: 143920

URL: http://llvm.org/viewvc/llvm-project?rev=143920&view=rev
Log:
Expose a way to get the beginning of the dwarf string section.

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

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=143920&r1=143919&r2=143920&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Nov  7 03:18:38 2011
@@ -136,6 +136,18 @@
 DwarfDebug::~DwarfDebug() {
 }
 
+/// EmitSectionSym - Switch to the specified MCSection and emit an assembler
+/// temporary label to it if SymbolStem is specified.
+static MCSymbol *EmitSectionSym(AsmPrinter *Asm, const MCSection *Section,
+                                const char *SymbolStem = 0) {
+  Asm->OutStreamer.SwitchSection(Section);
+  if (!SymbolStem) return 0;
+
+  MCSymbol *TmpSym = Asm->GetTempSymbol(SymbolStem);
+  Asm->OutStreamer.EmitLabel(TmpSym);
+  return TmpSym;
+}
+
 MCSymbol *DwarfDebug::getStringPool() {
   return Asm->GetTempSymbol("section_str");
 }
@@ -148,6 +160,13 @@
   return Entry.first = Asm->GetTempSymbol("string", Entry.second);
 }
 
+MCSymbol *DwarfDebug::getDwarfStrSectionSym(void) {
+  if (DwarfStrSectionSym) return DwarfStrSectionSym;
+  DwarfStrSectionSym =
+    EmitSectionSym(Asm, Asm->getObjFileLowering().getDwarfStrSection(),
+                   "section_str");
+  return DwarfStrSectionSym;
+}
 
 /// assignAbbrevNumber - Define a unique number for the abbreviation.
 ///
@@ -1465,18 +1484,6 @@
   }
 }
 
-/// EmitSectionSym - Switch to the specified MCSection and emit an assembler
-/// temporary label to it if SymbolStem is specified.
-static MCSymbol *EmitSectionSym(AsmPrinter *Asm, const MCSection *Section,
-                                const char *SymbolStem = 0) {
-  Asm->OutStreamer.SwitchSection(Section);
-  if (!SymbolStem) return 0;
-
-  MCSymbol *TmpSym = Asm->GetTempSymbol(SymbolStem);
-  Asm->OutStreamer.EmitLabel(TmpSym);
-  return TmpSym;
-}
-
 /// EmitSectionLabels - Emit initial Dwarf sections with a label at
 /// the start of each one.
 void DwarfDebug::EmitSectionLabels() {

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h?rev=143920&r1=143919&r2=143920&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.h Mon Nov  7 03:18:38 2011
@@ -513,6 +513,10 @@
   /// getStringPoolEntry - returns an entry into the string pool with the given
   /// string text.
   MCSymbol *getStringPoolEntry(StringRef Str);
+
+  /// getDwarfStrSectionSym - returns the symbol that starts the dwarf string
+  /// section.
+  MCSymbol *getDwarfStrSectionSym();
 };
 } // End of namespace llvm
 





More information about the llvm-commits mailing list