diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-12-18 05:37:28 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-12-18 05:37:28 +0000 |
commit | 1ec5bd31fe491e610839ea448bd99fd171785837 (patch) | |
tree | 7d7198b7dd08a147c37708b965589230ad88fd72 /lib | |
parent | 54f08852f6c45a1165295d66bd072e2d1da7a6d1 (diff) | |
download | external_llvm-1ec5bd31fe491e610839ea448bd99fd171785837.zip external_llvm-1ec5bd31fe491e610839ea448bd99fd171785837.tar.gz external_llvm-1ec5bd31fe491e610839ea448bd99fd171785837.tar.bz2 |
Remove the MCObjectFormat class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122147 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib/MC/ELFObjectWriter.cpp | 6 | ||||
-rw-r--r-- | lib/MC/MCExpr.cpp | 5 | ||||
-rw-r--r-- | lib/MC/MCObjectFormat.cpp | 34 | ||||
-rw-r--r-- | lib/MC/MachObjectWriter.cpp | 6 | ||||
-rw-r--r-- | lib/MC/WinCOFFObjectWriter.cpp | 6 | ||||
-rw-r--r-- | lib/Target/ARM/ARMAsmBackend.cpp | 12 | ||||
-rw-r--r-- | lib/Target/MBlaze/MBlazeAsmBackend.cpp | 8 | ||||
-rw-r--r-- | lib/Target/PowerPC/PPCAsmBackend.cpp | 6 | ||||
-rw-r--r-- | lib/Target/X86/X86AsmBackend.cpp | 18 |
10 files changed, 20 insertions, 82 deletions
diff --git a/lib/MC/CMakeLists.txt b/lib/MC/CMakeLists.txt index ccec2dc..c17e150 100644 --- a/lib/MC/CMakeLists.txt +++ b/lib/MC/CMakeLists.txt @@ -20,7 +20,6 @@ add_llvm_library(LLVMMC MCMachObjectTargetWriter.cpp MCNullStreamer.cpp MCObjectStreamer.cpp - MCObjectFormat.cpp MCObjectWriter.cpp MCPureStreamer.cpp MCSection.cpp diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp index 10e67d2..a6503b7 100644 --- a/lib/MC/ELFObjectWriter.cpp +++ b/lib/MC/ELFObjectWriter.cpp @@ -352,6 +352,12 @@ namespace { return false; } + virtual bool isAbsolute(bool IsSet, const MCSymbol &A, + const MCSymbol &B) const { + // On ELF A - B is absolute if A and B are in the same section. + return &A.getSection() == &B.getSection(); + } + virtual bool IsFixupFullyResolved(const MCAssembler &Asm, const MCValue Target, bool IsPCRel, diff --git a/lib/MC/MCExpr.cpp b/lib/MC/MCExpr.cpp index 3533da2..22d8740 100644 --- a/lib/MC/MCExpr.cpp +++ b/lib/MC/MCExpr.cpp @@ -14,7 +14,6 @@ #include "llvm/MC/MCAsmLayout.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCContext.h" -#include "llvm/MC/MCObjectFormat.h" #include "llvm/MC/MCSymbol.h" #include "llvm/MC/MCValue.h" #include "llvm/Support/Debug.h" @@ -388,8 +387,8 @@ static bool EvaluateSymbolicAdd(const MCAssembler *Asm, if (Asm && A && B) { const MCSymbol &SA = A->getSymbol(); const MCSymbol &SB = B->getSymbol(); - const MCObjectFormat &F = Asm->getBackend().getObjectFormat(); - if (SA.isDefined() && SB.isDefined() && F.isAbsolute(InSet, SA, SB)) { + if (SA.isDefined() && SB.isDefined() && + Asm->getWriter().isAbsolute(InSet, SA, SB)) { MCSymbolData &AD = Asm->getSymbolData(A->getSymbol()); MCSymbolData &BD = Asm->getSymbolData(B->getSymbol()); diff --git a/lib/MC/MCObjectFormat.cpp b/lib/MC/MCObjectFormat.cpp deleted file mode 100644 index aeff334..0000000 --- a/lib/MC/MCObjectFormat.cpp +++ /dev/null @@ -1,34 +0,0 @@ -//===- lib/MC/MCObjectFormat.cpp - MCObjectFormat implementation ----------===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include "llvm/MC/MCObjectFormat.h" -#include "llvm/MC/MCSymbol.h" - -using namespace llvm; - -MCObjectFormat::~MCObjectFormat() { -} - -bool MCELFObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A, - const MCSymbol &B) const { - // On ELF A - B is absolute if A and B are in the same section. - return &A.getSection() == &B.getSection(); -} - -bool MCMachOObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A, - const MCSymbol &B) const { - // On MachO A - B is absolute only if in a set. - return IsSet; -} - -bool MCCOFFObjectFormat::isAbsolute(bool IsSet, const MCSymbol &A, - const MCSymbol &B) const { - // On COFF A - B is absolute if A and B are in the same section. - return &A.getSection() == &B.getSection(); -} diff --git a/lib/MC/MachObjectWriter.cpp b/lib/MC/MachObjectWriter.cpp index 6ebc782..42cf43f 100644 --- a/lib/MC/MachObjectWriter.cpp +++ b/lib/MC/MachObjectWriter.cpp @@ -1123,6 +1123,12 @@ public: UndefinedSymbolData); } + bool isAbsolute(bool IsSet, const MCSymbol &A, + const MCSymbol &B) const { + // On MachO A - B is absolute only if in a set. + return IsSet; + } + bool IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm, const MCSymbolRefExpr *A, const MCSymbolRefExpr *B) const { diff --git a/lib/MC/WinCOFFObjectWriter.cpp b/lib/MC/WinCOFFObjectWriter.cpp index 0ad086c..7f75662 100644 --- a/lib/MC/WinCOFFObjectWriter.cpp +++ b/lib/MC/WinCOFFObjectWriter.cpp @@ -187,6 +187,12 @@ public: return false; } + virtual bool isAbsolute(bool IsSet, const MCSymbol &A, + const MCSymbol &B) const { + // On COFF A - B is absolute if A and B are in the same section. + return &A.getSection() == &B.getSection(); + } + virtual bool IsFixupFullyResolved(const MCAssembler &Asm, const MCValue Target, bool IsPCRel, diff --git a/lib/Target/ARM/ARMAsmBackend.cpp b/lib/Target/ARM/ARMAsmBackend.cpp index b7274ca..c72e790 100644 --- a/lib/Target/ARM/ARMAsmBackend.cpp +++ b/lib/Target/ARM/ARMAsmBackend.cpp @@ -16,7 +16,6 @@ #include "llvm/MC/MCELFObjectWriter.h" #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCMachObjectWriter.h" -#include "llvm/MC/MCObjectFormat.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionMachO.h" @@ -350,17 +349,11 @@ namespace { // FIXME: This should be in a separate file. // ELF is an ELF of course... class ELFARMAsmBackend : public ARMAsmBackend { - MCELFObjectFormat Format; - public: Triple::OSType OSType; ELFARMAsmBackend(const Target &T, Triple::OSType _OSType) : ARMAsmBackend(T), OSType(_OSType) { } - virtual const MCObjectFormat &getObjectFormat() const { - return Format; - } - void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize, uint64_t Value) const; @@ -389,14 +382,9 @@ void ELFARMAsmBackend::ApplyFixup(const MCFixup &Fixup, char *Data, // FIXME: This should be in a separate file. class DarwinARMAsmBackend : public ARMAsmBackend { - MCMachOObjectFormat Format; public: DarwinARMAsmBackend(const Target &T) : ARMAsmBackend(T) { } - virtual const MCObjectFormat &getObjectFormat() const { - return Format; - } - void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize, uint64_t Value) const; diff --git a/lib/Target/MBlaze/MBlazeAsmBackend.cpp b/lib/Target/MBlaze/MBlazeAsmBackend.cpp index 8a799f2..a4b21af 100644 --- a/lib/Target/MBlaze/MBlazeAsmBackend.cpp +++ b/lib/Target/MBlaze/MBlazeAsmBackend.cpp @@ -16,7 +16,6 @@ #include "llvm/MC/MCELFObjectWriter.h" #include "llvm/MC/MCELFSymbolFlags.h" #include "llvm/MC/MCExpr.h" -#include "llvm/MC/MCObjectFormat.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSectionELF.h" #include "llvm/MC/MCSectionMachO.h" @@ -108,18 +107,11 @@ bool MBlazeAsmBackend::WriteNopData(uint64_t Count, MCObjectWriter *OW) const { namespace { class ELFMBlazeAsmBackend : public MBlazeAsmBackend { - MCELFObjectFormat Format; - public: Triple::OSType OSType; ELFMBlazeAsmBackend(const Target &T, Triple::OSType _OSType) : MBlazeAsmBackend(T), OSType(_OSType) { } - virtual const MCObjectFormat &getObjectFormat() const { - return Format; - } - - void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize, uint64_t Value) const; diff --git a/lib/Target/PowerPC/PPCAsmBackend.cpp b/lib/Target/PowerPC/PPCAsmBackend.cpp index 9dfc6fc..c4d4ac9 100644 --- a/lib/Target/PowerPC/PPCAsmBackend.cpp +++ b/lib/Target/PowerPC/PPCAsmBackend.cpp @@ -12,7 +12,6 @@ #include "PPCFixupKinds.h" #include "llvm/MC/MCMachObjectWriter.h" #include "llvm/MC/MCSectionMachO.h" -#include "llvm/MC/MCObjectFormat.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/Object/MachOFormat.h" #include "llvm/Target/TargetRegistry.h" @@ -82,14 +81,9 @@ public: // FIXME: This should be in a separate file. namespace { class DarwinPPCAsmBackend : public PPCAsmBackend { - MCMachOObjectFormat Format; public: DarwinPPCAsmBackend(const Target &T) : PPCAsmBackend(T) { } - virtual const MCObjectFormat &getObjectFormat() const { - return Format; - } - void ApplyFixup(const MCFixup &Fixup, char *Data, unsigned DataSize, uint64_t Value) const { assert(0 && "UNIMP"); diff --git a/lib/Target/X86/X86AsmBackend.cpp b/lib/Target/X86/X86AsmBackend.cpp index 5e7ce0b..c39d07b 100644 --- a/lib/Target/X86/X86AsmBackend.cpp +++ b/lib/Target/X86/X86AsmBackend.cpp @@ -16,7 +16,6 @@ #include "llvm/MC/MCExpr.h" #include "llvm/MC/MCFixupKindInfo.h" #include "llvm/MC/MCMachObjectWriter.h" -#include "llvm/MC/MCObjectFormat.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSectionCOFF.h" #include "llvm/MC/MCSectionELF.h" @@ -295,8 +294,6 @@ bool X86AsmBackend::WriteNopData(uint64_t Count, MCObjectWriter *OW) const { namespace { class ELFX86AsmBackend : public X86AsmBackend { - MCELFObjectFormat Format; - public: Triple::OSType OSType; ELFX86AsmBackend(const Target &T, Triple::OSType _OSType) @@ -304,10 +301,6 @@ public: HasReliableSymbolDifference = true; } - virtual const MCObjectFormat &getObjectFormat() const { - return Format; - } - virtual bool doesSectionRequireSymbols(const MCSection &Section) const { const MCSectionELF &ES = static_cast<const MCSectionELF&>(Section); return ES.getFlags() & MCSectionELF::SHF_MERGE; @@ -340,7 +333,6 @@ public: class WindowsX86AsmBackend : public X86AsmBackend { bool Is64Bit; - MCCOFFObjectFormat Format; public: WindowsX86AsmBackend(const Target &T, bool is64Bit) @@ -348,25 +340,15 @@ public: , Is64Bit(is64Bit) { } - virtual const MCObjectFormat &getObjectFormat() const { - return Format; - } - MCObjectWriter *createObjectWriter(raw_ostream &OS) const { return createWinCOFFObjectWriter(OS, Is64Bit); } }; class DarwinX86AsmBackend : public X86AsmBackend { - MCMachOObjectFormat Format; - public: DarwinX86AsmBackend(const Target &T) : X86AsmBackend(T) { } - - virtual const MCObjectFormat &getObjectFormat() const { - return Format; - } }; class DarwinX86_32AsmBackend : public DarwinX86AsmBackend { |