[llvm] r238139 - Stop forwarding getOrdinal and setOrdinal.

Rafael Espindola rafael.espindola at gmail.com
Mon May 25 07:12:48 PDT 2015


Author: rafael
Date: Mon May 25 09:12:48 2015
New Revision: 238139

URL: http://llvm.org/viewvc/llvm-project?rev=238139&view=rev
Log:
Stop forwarding getOrdinal and setOrdinal.

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

Modified: llvm/trunk/include/llvm/MC/MCAssembler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAssembler.h?rev=238139&r1=238138&r2=238139&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAssembler.h (original)
+++ llvm/trunk/include/llvm/MC/MCAssembler.h Mon May 25 09:12:48 2015
@@ -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; }
 

Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=238139&r1=238138&r2=238139&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Mon May 25 09:12:48 2015
@@ -300,9 +300,6 @@ MCSectionData::MCSectionData(MCSection &
     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.

Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp?rev=238139&r1=238138&r2=238139&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp Mon May 25 09:12:48 2015
@@ -349,8 +349,8 @@ void AArch64MachObjectWriter::RecordRelo
                 "'. 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)

Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp?rev=238139&r1=238138&r2=238139&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp Mon May 25 09:12:48 2015
@@ -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::RecordRelocati
         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)

Modified: llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp?rev=238139&r1=238138&r2=238139&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp Mon May 25 09:12:48 2015
@@ -363,8 +363,9 @@ void PPCMachObjectWriter::RecordPPCReloc
         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)

Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp?rev=238139&r1=238138&r2=238139&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp Mon May 25 09:12:48 2015
@@ -190,7 +190,7 @@ void X86MachObjectWriter::RecordX86_64Re
              (!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_64Re
     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_64Re
                  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::RecordX86Reloc
         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)





More information about the llvm-commits mailing list