summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp')
-rw-r--r--lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp21
1 files changed, 10 insertions, 11 deletions
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);
}