[llvm] r199967 - Inline trivial functions called only once or twice.

Rafael Espindola rafael.espindola at gmail.com
Thu Jan 23 18:28:12 PST 2014


Author: rafael
Date: Thu Jan 23 20:28:11 2014
New Revision: 199967

URL: http://llvm.org/viewvc/llvm-project?rev=199967&view=rev
Log:
Inline trivial functions called only once or twice.

Modified:
    llvm/trunk/lib/MC/WinCOFFStreamer.cpp

Modified: llvm/trunk/lib/MC/WinCOFFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=199967&r1=199966&r2=199967&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFStreamer.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFStreamer.cpp Thu Jan 23 20:28:11 2014
@@ -94,33 +94,6 @@ private:
     }
     DF->getContents().append(Code.begin(), Code.end());
   }
-
-  const MCSection *getSectionText() {
-    return getContext().getObjectFileInfo()->getTextSection();
-  }
-
-  const MCSection *getSectionData() {
-    return getContext().getObjectFileInfo()->getDataSection();
-  }
-
-  const MCSection *getSectionBSS() {
-    return getContext().getObjectFileInfo()->getBSSSection();
-  }
-
-  void SetSectionText() {
-    SwitchSection(getSectionText());
-    EmitCodeAlignment(4, 0);
-  }
-
-  void SetSectionData() {
-    SwitchSection(getSectionData());
-    EmitCodeAlignment(4, 0);
-  }
-
-  void SetSectionBSS() {
-    SwitchSection(getSectionBSS());
-    EmitCodeAlignment(4, 0);
-  }
 };
 } // end anonymous namespace.
 
@@ -132,7 +105,7 @@ void WinCOFFStreamer::AddCommonSymbol(MC
                                       unsigned ByteAlignment, bool External) {
   assert(!Symbol->isInSection() && "Symbol must not already have a section!");
 
-  const MCSection *Section = getSectionBSS();
+  const MCSection *Section = getContext().getObjectFileInfo()->getBSSSection();
   MCSectionData &SectionData = getAssembler().getOrCreateSectionData(*Section);
   if (SectionData.getAlignment() < ByteAlignment)
     SectionData.setAlignment(ByteAlignment);
@@ -151,10 +124,19 @@ void WinCOFFStreamer::AddCommonSymbol(MC
 // MCStreamer interface
 
 void WinCOFFStreamer::InitSections() {
-  SetSectionText();
-  SetSectionData();
-  SetSectionBSS();
-  SetSectionText();
+  // FIXME: this is identical to the ELF one.
+  // This emulates the same behavior of GNU as. This makes it easier
+  // to compare the output as the major sections are in the same order.
+  SwitchSection(getContext().getObjectFileInfo()->getTextSection());
+  EmitCodeAlignment(4, 0);
+
+  SwitchSection(getContext().getObjectFileInfo()->getDataSection());
+  EmitCodeAlignment(4, 0);
+
+  SwitchSection(getContext().getObjectFileInfo()->getBSSSection());
+  EmitCodeAlignment(4, 0);
+
+  SwitchSection(getContext().getObjectFileInfo()->getTextSection());
 }
 
 void WinCOFFStreamer::EmitLabel(MCSymbol *Symbol) {





More information about the llvm-commits mailing list