summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2012-03-01 01:53:15 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2012-03-01 01:53:15 +0000
commit1ee768db53dfbaab76f56c11fdc73d3e2e8c3996 (patch)
treee90200fa962150d84286c6e49005012db2778f0b /llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
parentabe8c09b2005185d7a9a10679f4f13e68eeb2841 (diff)
downloadbcm5719-llvm-1ee768db53dfbaab76f56c11fdc73d3e2e8c3996.tar.gz
bcm5719-llvm-1ee768db53dfbaab76f56c11fdc73d3e2e8c3996.zip
Pass endian information to constructors. Define separate functions to create
objects for big endian and little endian targets. Patch by Jack Carter. llvm-svn: 151788
Diffstat (limited to 'llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp')
-rw-r--r--llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp44
1 files changed, 16 insertions, 28 deletions
diff --git a/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp b/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
index ca60225f107..d69570bdf09 100644
--- a/llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
+++ b/llvm/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);
}
OpenPOWER on IntegriCloud