Move label creation close to emission. NFC.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 10 Mar 2015 03:11:11 +0000 (03:11 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 10 Mar 2015 03:11:11 +0000 (03:11 +0000)
llvm-svn: 231744

llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h

index 4d87744..64bee0c 100644 (file)
@@ -711,10 +711,13 @@ void DwarfCompileUnit::collectDeadVariables(DISubprogram SP) {
   }
 }
 
-void DwarfCompileUnit::emitHeader(const MCSymbol *ASectionSym) const {
+void DwarfCompileUnit::emitHeader(const MCSymbol *ASectionSym) {
   // Don't bother labeling the .dwo unit, as its offset isn't used.
-  if (!Skeleton)
+  if (!Skeleton) {
+    LabelBegin =
+      Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
     Asm->OutStreamer.EmitLabel(LabelBegin);
+  }
 
   DwarfUnit::emitHeader(ASectionSym);
 }
index c66af65..b847405 100644 (file)
@@ -179,11 +179,6 @@ public:
   void initSection(const MCSection *Section, MCSymbol *SectionSym) {
     DwarfUnit::initSection(Section);
     this->SectionSym = SectionSym;
-
-    // Don't bother labeling the .dwo unit, as its offset isn't used.
-    if (!Skeleton)
-      LabelBegin =
-          Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
   }
 
   unsigned getLength() {
@@ -191,7 +186,7 @@ public:
         getHeaderSize() + UnitDie.getSize();
   }
 
-  void emitHeader(const MCSymbol *ASectionSym) const override;
+  void emitHeader(const MCSymbol *ASectionSym) override;
 
   MCSymbol *getLabelBegin() const {
     assert(Section);
index ce394a8..7940348 100644 (file)
@@ -1604,7 +1604,7 @@ DIE *DwarfUnit::getOrCreateStaticMemberDIE(DIDerivedType DT) {
   return &StaticMemberDIE;
 }
 
-void DwarfUnit::emitHeader(const MCSymbol *ASectionSym) const {
+void DwarfUnit::emitHeader(const MCSymbol *ASectionSym) {
   // Emit size of content not including length itself
   Asm->OutStreamer.AddComment("Length of Unit");
   Asm->EmitInt32(getHeaderSize() + UnitDie.getSize());
@@ -1629,7 +1629,7 @@ void DwarfUnit::initSection(const MCSection *Section) {
   this->Section = Section;
 }
 
-void DwarfTypeUnit::emitHeader(const MCSymbol *ASectionSym) const {
+void DwarfTypeUnit::emitHeader(const MCSymbol *ASectionSym) {
   DwarfUnit::emitHeader(ASectionSym);
   Asm->OutStreamer.AddComment("Type Signature");
   Asm->OutStreamer.EmitIntValue(TypeSignature, sizeof(TypeSignature));
index 7a5e47d..ea15ab0 100644 (file)
@@ -321,7 +321,7 @@ public:
   }
 
   /// Emit the header for this unit, not including the initial length field.
-  virtual void emitHeader(const MCSymbol *ASectionSym) const;
+  virtual void emitHeader(const MCSymbol *ASectionSym);
 
   virtual DwarfCompileUnit &getCU() = 0;
 
@@ -423,7 +423,7 @@ public:
   void setType(const DIE *Ty) { this->Ty = Ty; }
 
   /// Emit the header for this unit, not including the initial length field.
-  void emitHeader(const MCSymbol *ASectionSym) const override;
+  void emitHeader(const MCSymbol *ASectionSym) override;
   unsigned getHeaderSize() const override {
     return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature
            sizeof(uint32_t);                               // Type DIE Offset