From 29a17145ad4985df032785cc1b4716fd7875d47b Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 11 Jan 2012 04:04:14 +0000 Subject: Add big endian mips support. Based on a patch by Jack Carter. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147924 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp') diff --git a/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp b/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp index bd9b6412a5..f4227f794b 100644 --- a/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp +++ b/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp @@ -71,7 +71,9 @@ static unsigned adjustFixupValue(unsigned Kind, uint64_t Value) { namespace { class MipsAsmBackend : public MCAsmBackend { public: - MipsAsmBackend(const Target &T) : MCAsmBackend() {} + uint8_t OSABI; + MipsAsmBackend(const Target &T, uint8_t OSABI_) : + MCAsmBackend(), OSABI(OSABI_) {} /// 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,10 +193,8 @@ public: class MipsEB_AsmBackend : public MipsAsmBackend { public: - uint8_t OSABI; - MipsEB_AsmBackend(const Target &T, uint8_t _OSABI) - : MipsAsmBackend(T), OSABI(_OSABI) {} + : MipsAsmBackend(T, _OSABI) {} MCObjectWriter *createObjectWriter(raw_ostream &OS) const { return createMipsELFObjectWriter(OS, /*IsLittleEndian*/ false, OSABI); @@ -203,10 +203,8 @@ public: class MipsEL_AsmBackend : public MipsAsmBackend { public: - uint8_t OSABI; - MipsEL_AsmBackend(const Target &T, uint8_t _OSABI) - : MipsAsmBackend(T), OSABI(_OSABI) {} + : MipsAsmBackend(T, _OSABI) {} MCObjectWriter *createObjectWriter(raw_ostream &OS) const { return createMipsELFObjectWriter(OS, /*IsLittleEndian*/ true, OSABI); @@ -214,11 +212,12 @@ public: }; } // namespace -MCAsmBackend *llvm::createMipsAsmBackend(const Target &T, StringRef TT) { - Triple TheTriple(TT); +MCAsmBackend *llvm::createMipsBEAsmBackend(const Target &T, StringRef TT) { + uint8_t OSABI = MCELFObjectTargetWriter::getOSABI(Triple(TT).getOS()); + return new MipsEB_AsmBackend(T, OSABI); +} - // just return little endian for now - // +MCAsmBackend *llvm::createMipsLEAsmBackend(const Target &T, StringRef TT) { uint8_t OSABI = MCELFObjectTargetWriter::getOSABI(Triple(TT).getOS()); return new MipsEL_AsmBackend(T, OSABI); } -- cgit v1.2.3