MC: Add section layout order indices to MCSectionData.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 13 May 2010 15:17:26 +0000 (15:17 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 13 May 2010 15:17:26 +0000 (15:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103715 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 33fa2953cb0fd46df1fece2822f96f69b0685fb0..095b1743ecb19f11893e858125f1a8547342912b 100644 (file)
@@ -392,6 +392,9 @@ private:
   /// Ordinal - The section index in the assemblers section list.
   unsigned Ordinal;
 
+  /// LayoutOrder - The index of this section in the layout order.
+  unsigned LayoutOrder;
+
   /// Alignment - The maximum alignment seen in this section.
   unsigned Alignment;
 
@@ -426,6 +429,9 @@ public:
   unsigned getOrdinal() const { return Ordinal; }
   void setOrdinal(unsigned Value) { Ordinal = Value; }
 
+  unsigned getLayoutOrder() const { return LayoutOrder; }
+  void setLayoutOrder(unsigned Value) { LayoutOrder = Value; }
+
   /// @name Fragment Access
   /// @{
 
index ac91bad8ac85d734666383d048c08b3a0275cdf3..f41b25f15d3cd564ce6712950ae13d290971c9d4 100644 (file)
@@ -601,6 +601,10 @@ void MCAssembler::Finish() {
   // Create the layout object.
   MCAsmLayout Layout(*this);
 
+  // Assign layout order indices.
+  for (unsigned i = 0, e = Layout.getSectionOrder().size(); i != e; ++i)
+    Layout.getSectionOrder()[i]->setLayoutOrder(i);
+
   // Insert additional align fragments for concrete sections to explicitly pad
   // the previous section to match their alignment requirements. This is for
   // 'gas' compatibility, it shouldn't strictly be necessary.