diff options
author | Akira Hatanaka <ahatanaka@mips.com> | 2012-03-01 01:53:15 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@mips.com> | 2012-03-01 01:53:15 +0000 |
commit | e9e520f23ec3e5dc26e0801ac0d8b9e6899e2626 (patch) | |
tree | 978c0229c8eb3861906a73a42130920750d4c02d /lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp | |
parent | 66c994c2dbd1a76418fdd0acb138aa029538ffe5 (diff) | |
download | llvm-e9e520f23ec3e5dc26e0801ac0d8b9e6899e2626.tar.gz llvm-e9e520f23ec3e5dc26e0801ac0d8b9e6899e2626.tar.bz2 llvm-e9e520f23ec3e5dc26e0801ac0d8b9e6899e2626.tar.xz |
Pass endian information to constructors. Define separate functions to create
objects for big endian and little endian targets.
Patch by Jack Carter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151788 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp')
-rw-r--r-- | lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp b/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp index ca60225f10..d69570bdf0 100644 --- a/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp +++ b/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp @@ -70,10 +70,16 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) { namespace { class MipsAsmBackend : public MCAsmBackend { + Triple::OSType OSType; + bool IsLittle; // Big or little endian + public: - uint8_t OSABI; - MipsAsmBackend(const Target &T, uint8_t OSABI_) : - MCAsmBackend(), OSABI(OSABI_) {} + MipsAsmBackend(const Target &T, Triple::OSType _OSType, bool _isLittle) : + MCAsmBackend(), OSType(_OSType), IsLittle(_isLittle) {} + + MCObjectWriter *createObjectWriter(raw_ostream &OS) const { + return createMipsELFObjectWriter(OS, OSType, IsLittle); + } /// ApplyFixup - Apply the \arg Value for given \arg Fixup into the provided /// data fragment, at the offset specified by the fixup and following the @@ -191,33 +197,15 @@ public: } }; -class MipsEB_AsmBackend : public MipsAsmBackend { -public: - MipsEB_AsmBackend(const Target &T, uint8_t _OSABI) - : MipsAsmBackend(T, _OSABI) {} - - MCObjectWriter *createObjectWriter(raw_ostream &OS) const { - return createMipsELFObjectWriter(OS, /*IsLittleEndian*/ false, OSABI); - } -}; - -class MipsEL_AsmBackend : public MipsAsmBackend { -public: - MipsEL_AsmBackend(const Target &T, uint8_t _OSABI) - : MipsAsmBackend(T, _OSABI) {} - - MCObjectWriter *createObjectWriter(raw_ostream &OS) const { - return createMipsELFObjectWriter(OS, /*IsLittleEndian*/ true, OSABI); - } -}; } // namespace -MCAsmBackend *llvm::createMipsBEAsmBackend(const Target &T, StringRef TT) { - uint8_t OSABI = MCELFObjectTargetWriter::getOSABI(Triple(TT).getOS()); - return new MipsEB_AsmBackend(T, OSABI); +// MCAsmBackend +MCAsmBackend *llvm::createMipsAsmBackendEL(const Target &T, StringRef TT) { + return new MipsAsmBackend(T, Triple(TT).getOS(), + /*IsLittle*/true); } -MCAsmBackend *llvm::createMipsLEAsmBackend(const Target &T, StringRef TT) { - uint8_t OSABI = MCELFObjectTargetWriter::getOSABI(Triple(TT).getOS()); - return new MipsEL_AsmBackend(T, OSABI); +MCAsmBackend *llvm::createMipsAsmBackendEB(const Target &T, StringRef TT) { + return new MipsAsmBackend(T, Triple(TT).getOS(), + /*IsLittle*/false); } |