Stop forwarding getOrdinal and setOrdinal.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 25 May 2015 14:12:48 +0000 (14:12 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 25 May 2015 14:12:48 +0000 (14:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238139 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/MC/MCAssembler.h
lib/MC/MCAssembler.cpp
lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp
lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp

index 8f0105f6c2efe17b6ae19973c2b7195c0317c8f0..c060c24697548833755928c1e6499869ebb2a5dc 100644 (file)
@@ -597,9 +597,6 @@ public:
   bool hasInstructions() const { return HasInstructions; }
   void setHasInstructions(bool Value) { HasInstructions = Value; }
 
-  unsigned getOrdinal() const;
-  void setOrdinal(unsigned Value);
-
   unsigned getLayoutOrder() const { return LayoutOrder; }
   void setLayoutOrder(unsigned Value) { LayoutOrder = Value; }
 
index 879f894ab1d93593edef6104c6d90c5860d17406..2e15af69f4cb513ed3c9cd95218792cd6df8c56e 100644 (file)
@@ -300,9 +300,6 @@ MCSectionData::MCSectionData(MCSection &Section, MCAssembler *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())
@@ -892,7 +889,7 @@ void MCAssembler::Finish() {
     if (it->getFragmentList().empty())
       new MCDataFragment(it);
 
-    it->setOrdinal(SectionIndex++);
+    it->getSection().setOrdinal(SectionIndex++);
   }
 
   // Assign layout order indices to sections and fragments.
index cd175ad37eefc0b279234f0fa9c2fbc63fc0c49e..cd74b4800aae8dbca1f16af2a0ec6b289fc0ae4f 100644 (file)
@@ -349,8 +349,8 @@ void AArch64MachObjectWriter::RecordRelocation(
                 "'. Must have non-local symbol earlier in section.");
       // Adjust the relocation to be section-relative.
       // The index is the section ordinal (1-based).
-      const MCSectionData &SymSD = Asm.getSectionData(Symbol->getSection());
-      Index = SymSD.getOrdinal() + 1;
+      const MCSection &Sec = Symbol->getSection();
+      Index = Sec.getOrdinal() + 1;
       Value += Writer->getSymbolAddress(*Symbol, Layout);
 
       if (IsPCRel)
index d5f5f9a005f729c05fd6a9b8066c89136ea6a6fa..84585b913906b7ae330189627dab13485dde316a 100644 (file)
@@ -19,6 +19,7 @@
 #include "llvm/MC/MCFixupKindInfo.h"
 #include "llvm/MC/MCMachOSymbolFlags.h"
 #include "llvm/MC/MCMachObjectWriter.h"
+#include "llvm/MC/MCSection.h"
 #include "llvm/MC/MCValue.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MachO.h"
@@ -423,8 +424,9 @@ void ARMMachObjectWriter::RecordRelocation(MachObjectWriter *Writer,
         FixedValue -= Layout.getSymbolOffset(*A);
     } else {
       // The index is the section ordinal (1-based).
-      const MCSectionData &SymSD = Asm.getSectionData(A->getSection());
-      Index = SymSD.getOrdinal() + 1;
+      const MCSection &Sec = A->getSection();
+      const MCSectionData &SymSD = Asm.getSectionData(Sec);
+      Index = Sec.getOrdinal() + 1;
       FixedValue += Writer->getSectionAddress(&SymSD);
     }
     if (IsPCRel)
index 99bc56aeb48d7b4471697c250e71334d3d6a519d..1bdf031b81bc9f9fa91b13f4da5b335f37da193d 100644 (file)
@@ -363,8 +363,9 @@ void PPCMachObjectWriter::RecordPPCRelocation(
         FixedValue -= Layout.getSymbolOffset(*A);
     } else {
       // The index is the section ordinal (1-based).
-      const MCSectionData &SymSD = Asm.getSectionData(A->getSection());
-      Index = SymSD.getOrdinal() + 1;
+      const MCSection &Sec = A->getSection();
+      const MCSectionData &SymSD = Asm.getSectionData(Sec);
+      Index = Sec.getOrdinal() + 1;
       FixedValue += Writer->getSectionAddress(&SymSD);
     }
     if (IsPCRel)
index b33852b4e257c5a75fb8dd0f0df264979aa8acea..e2d5ef20d4dc037e7d14c66a9b41cba1f8936594 100644 (file)
@@ -190,7 +190,7 @@ void X86MachObjectWriter::RecordX86_64Relocation(
              (!B_Base ? 0 : Writer->getSymbolAddress(*B_Base, Layout));
 
     if (!A_Base)
-      Index = A_SD.getFragment()->getParent()->getOrdinal() + 1;
+      Index = A_SD.getFragment()->getParent()->getSection().getOrdinal() + 1;
     Type = MachO::X86_64_RELOC_UNSIGNED;
 
     MachO::any_relocation_info MRE;
@@ -202,7 +202,7 @@ void X86MachObjectWriter::RecordX86_64Relocation(
     if (B_Base)
       RelSymbol = B_Base;
     else
-      Index = B_SD.getFragment()->getParent()->getOrdinal() + 1;
+      Index = B_SD.getFragment()->getParent()->getSection().getOrdinal() + 1;
     Type = MachO::X86_64_RELOC_SUBTRACTOR;
   } else {
     const MCSymbol *Symbol = &Target.getSymA()->getSymbol();
@@ -235,7 +235,7 @@ void X86MachObjectWriter::RecordX86_64Relocation(
                  Layout.getSymbolOffset(*RelSymbol);
     } else if (Symbol->isInSection() && !Symbol->isVariable()) {
       // The index is the section ordinal (1-based).
-      Index = SD.getFragment()->getParent()->getOrdinal() + 1;
+      Index = SD.getFragment()->getParent()->getSection().getOrdinal() + 1;
       Value += Writer->getSymbolAddress(*Symbol, Layout);
 
       if (IsPCRel)
@@ -554,8 +554,9 @@ void X86MachObjectWriter::RecordX86Relocation(MachObjectWriter *Writer,
         FixedValue -= Layout.getSymbolOffset(*A);
     } else {
       // The index is the section ordinal (1-based).
-      const MCSectionData &SymSD = Asm.getSectionData(A->getSection());
-      Index = SymSD.getOrdinal() + 1;
+      const MCSection &Sec = A->getSection();
+      const MCSectionData &SymSD = Asm.getSectionData(Sec);
+      Index = Sec.getOrdinal() + 1;
       FixedValue += Writer->getSectionAddress(&SymSD);
     }
     if (IsPCRel)