Move LayoutOrder to MCSection.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 25 May 2015 14:25:28 +0000 (14:25 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 25 May 2015 14:25:28 +0000 (14:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238141 91177308-0d34-0410-b5e6-96231b3b80d8

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

index c060c24697548833755928c1e6499869ebb2a5dc..ac6864a9e58dd68149c78a0f8abb39632332085c 100644 (file)
@@ -559,9 +559,6 @@ private:
   FragmentListType Fragments;
   MCSection *Section;
 
-  /// LayoutOrder - The index of this section in the layout order.
-  unsigned LayoutOrder;
-
   /// \brief Keeping track of bundle-locked state.
   BundleLockStateType BundleLockState;
 
@@ -597,9 +594,6 @@ public:
   bool hasInstructions() const { return HasInstructions; }
   void setHasInstructions(bool Value) { HasInstructions = Value; }
 
-  unsigned getLayoutOrder() const { return LayoutOrder; }
-  void setLayoutOrder(unsigned Value) { LayoutOrder = Value; }
-
   /// \name Fragment Access
   /// @{
 
index dfe3dc90923bee8ebe2c01c3887b9ba806468f2c..5a60a87242940078c350451eba56564dfc06a2d3 100644 (file)
@@ -41,6 +41,8 @@ private:
   unsigned Alignment = 1;
   /// The section index in the assemblers section list.
   unsigned Ordinal = 0;
+  /// The index of this section in the layout order.
+  unsigned LayoutOrder;
 
 protected:
   MCSection(SectionVariant V, SectionKind K, MCSymbol *Begin)
@@ -72,6 +74,9 @@ public:
   unsigned getOrdinal() const { return Ordinal; }
   void setOrdinal(unsigned Value) { Ordinal = Value; }
 
+  unsigned getLayoutOrder() const { return LayoutOrder; }
+  void setLayoutOrder(unsigned Value) { LayoutOrder = Value; }
+
   virtual void PrintSwitchToSection(const MCAsmInfo &MAI, raw_ostream &OS,
                                     const MCExpr *Subsection) const = 0;
 
index 2e15af69f4cb513ed3c9cd95218792cd6df8c56e..cb11555ab510795cc44ecf50c50de71cda4c1e56 100644 (file)
@@ -895,7 +895,7 @@ void MCAssembler::Finish() {
   // Assign layout order indices to sections and fragments.
   for (unsigned i = 0, e = Layout.getSectionOrder().size(); i != e; ++i) {
     MCSectionData *SD = Layout.getSectionOrder()[i];
-    SD->setLayoutOrder(i);
+    SD->getSection().setLayoutOrder(i);
 
     unsigned FragmentIndex = 0;
     for (MCSectionData::iterator iFrag = SD->begin(), iFragEnd = SD->end();
index 1eaf2a951cfce1738a3949b112f629d153078d3f..45096d428b76062ffbe00ff4ee87d6db081855c7 100644 (file)
@@ -108,7 +108,7 @@ uint64_t MachObjectWriter::getSymbolAddress(const MCSymbol &S,
 uint64_t MachObjectWriter::getPaddingSize(const MCSectionData *SD,
                                           const MCAsmLayout &Layout) const {
   uint64_t EndAddr = getSectionAddress(SD) + Layout.getSectionAddressSize(SD);
-  unsigned Next = SD->getLayoutOrder() + 1;
+  unsigned Next = SD->getSection().getLayoutOrder() + 1;
   if (Next >= Layout.getSectionOrder().size())
     return 0;