Move Ordinal from MCSectionData to MCSection. NFC.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 25 May 2015 14:00:56 +0000 (14:00 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 25 May 2015 14:00:56 +0000 (14:00 +0000)
Part of the work to merge MCSectionData and MCSection.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238137 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCAssembler.h
include/llvm/MC/MCSection.h
lib/MC/MCAssembler.cpp

index 564691e3e1866bdc194cc295cf24186d8019280a..8f0105f6c2efe17b6ae19973c2b7195c0317c8f0 100644 (file)
@@ -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; }
index 38e7e210950405f9bd39d75e6671f92b9d6a32ef..7d5128a2d208fd7541987bed23062b97d32e0090 100644 (file)
@@ -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;
 
index 2c041e26ac99ae4d5de92262b4639f0a7e5f4638..879f894ab1d93593edef6104c6d90c5860d17406 100644 (file)
@@ -293,13 +293,16 @@ MCEncodedFragmentWithFixups::~MCEncodedFragmentWithFixups() {
 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())