summaryrefslogtreecommitdiff
path: root/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-01-11 04:04:14 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-01-11 04:04:14 +0000
commit29a17145ad4985df032785cc1b4716fd7875d47b (patch)
treea6bf3ba76d742cfc7059fd0acce9020dce491bd0 /lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp
parentfddf80459747198d2ee33974c90f6137ea29cbd8 (diff)
downloadllvm-29a17145ad4985df032785cc1b4716fd7875d47b.tar.gz
llvm-29a17145ad4985df032785cc1b4716fd7875d47b.tar.bz2
llvm-29a17145ad4985df032785cc1b4716fd7875d47b.tar.xz
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
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);
}