diff options
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); } |