[llvm] r238137 - Move Ordinal from MCSectionData to MCSection. NFC.

Rafael Espindola rafael.espindola at gmail.com
Mon May 25 07:00:56 PDT 2015


Author: rafael
Date: Mon May 25 09:00:56 2015
New Revision: 238137

URL: http://llvm.org/viewvc/llvm-project?rev=238137&view=rev
Log:
Move Ordinal from MCSectionData to MCSection. NFC.

Part of the work to merge MCSectionData and MCSection.

Modified:
    llvm/trunk/include/llvm/MC/MCAssembler.h
    llvm/trunk/include/llvm/MC/MCSection.h
    llvm/trunk/lib/MC/MCAssembler.cpp

Modified: llvm/trunk/include/llvm/MC/MCAssembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=238137&r1=238136&r2=238137&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAssembler.h (original)
+++ llvm/trunk/include/llvm/MC/MCAssembler.h Mon May 25 09:00:56 2015
@@ -559,9 +559,6 @@ private:
   FragmentListType Fragments;
   MCSection *Section;
 
-  /// Ordinal - The section index in the assemblers section list.
-  unsigned Ordinal;
-
   /// LayoutOrder - The index of this section in the layout order.
   unsigned LayoutOrder;
 
@@ -600,8 +597,8 @@ public:
   bool hasInstructions() const { return HasInstructions; }
   void setHasInstructions(bool Value) { HasInstructions = Value; }
 
-  unsigned getOrdinal() const { return Ordinal; }
-  void setOrdinal(unsigned Value) { Ordinal = Value; }
+  unsigned getOrdinal() const;
+  void setOrdinal(unsigned Value);
 
   unsigned getLayoutOrder() const { return LayoutOrder; }
   void setLayoutOrder(unsigned Value) { LayoutOrder = Value; }

Modified: llvm/trunk/include/llvm/MC/MCSection.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSection.h?rev=238137&r1=238136&r2=238137&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSection.h (original)
+++ llvm/trunk/include/llvm/MC/MCSection.h Mon May 25 09:00:56 2015
@@ -39,10 +39,13 @@ private:
   MCSymbol *End;
   /// The alignment requirement of this section.
   unsigned Alignment;
+  /// The section index in the assemblers section list.
+  unsigned Ordinal;
 
 protected:
   MCSection(SectionVariant V, SectionKind K, MCSymbol *Begin)
-      : Begin(Begin), End(nullptr), Alignment(1), Variant(V), Kind(K) {}
+      : Begin(Begin), End(nullptr), Alignment(1), Ordinal(~UINT32_C(0)),
+        Variant(V), Kind(K) {}
   SectionVariant Variant;
   SectionKind Kind;
 
@@ -67,6 +70,9 @@ public:
   unsigned getAlignment() const { return Alignment; }
   void setAlignment(unsigned Value) { Alignment = Value; }
 
+  unsigned getOrdinal() const { return Ordinal; }
+  void setOrdinal(unsigned Value) { Ordinal = Value; }
+
   virtual void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS,
                                     const MCExpr *Subsection) const = 0;
 

Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=238137&r1=238136&r2=238137&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Mon May 25 09:00:56 2015
@@ -293,13 +293,16 @@ MCEncodedFragmentWithFixups::~MCEncodedF
 MCSectionData::MCSectionData() : Section(nullptr) {}
 
 MCSectionData::MCSectionData(MCSection &Section, MCAssembler *A)
-    : Section(&Section), Ordinal(~UINT32_C(0)),
-      BundleLockState(NotBundleLocked), BundleLockNestingDepth(0),
-      BundleGroupBeforeFirstInst(false), HasInstructions(false) {
+    : Section(&Section), BundleLockState(NotBundleLocked),
+      BundleLockNestingDepth(0), BundleGroupBeforeFirstInst(false),
+      HasInstructions(false) {
   if (A)
     A->getSectionList().push_back(this);
 }
 
+unsigned MCSectionData::getOrdinal() const { return Section->getOrdinal(); }
+void MCSectionData::setOrdinal(unsigned Value) { Section->setOrdinal(Value); }
+
 MCSectionData::iterator
 MCSectionData::getSubsectionInsertionPoint(unsigned Subsection) {
   if (Subsection == 0 && SubsectionFragmentMap.empty())





More information about the llvm-commits mailing list