diff options
author | Douglas Katzman <dougk@google.com> | 2015-04-29 20:30:57 +0000 |
---|---|---|
committer | Douglas Katzman <dougk@google.com> | 2015-04-29 20:30:57 +0000 |
commit | 9160e78ac80763929519a6a5718b30694f23a2d3 (patch) | |
tree | be0a36306f8e7e3555e940ecb471e42d752b5962 /llvm/lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp | |
parent | 88d1f632cf41fede7e0ea0cb5cf662bffa800ce9 (diff) | |
download | bcm5719-llvm-9160e78ac80763929519a6a5718b30694f23a2d3.tar.gz bcm5719-llvm-9160e78ac80763929519a6a5718b30694f23a2d3.zip |
[Sparc] Really add sparcel architecture support.
Mostly copy-and-paste from Sparc v8 architecture.
Differential Revision: http://reviews.llvm.org/D8741
llvm-svn: 236146
Diffstat (limited to 'llvm/lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp')
-rw-r--r-- | llvm/lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp index b447ab3a75f..ff5a3cb32b3 100644 --- a/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp +++ b/llvm/lib/Target/Sparc/MCTargetDesc/SparcMCCodeEmitter.cpp @@ -21,6 +21,7 @@ #include "llvm/MC/MCInst.h" #include "llvm/MC/MCRegisterInfo.h" #include "llvm/MC/MCSymbol.h" +#include "llvm/MC/MCAsmInfo.h" #include "llvm/Support/raw_ostream.h" using namespace llvm; @@ -78,16 +79,23 @@ MCCodeEmitter *llvm::createSparcMCCodeEmitter(const MCInstrInfo &MCII, return new SparcMCCodeEmitter(Ctx); } -void SparcMCCodeEmitter:: -EncodeInstruction(const MCInst &MI, raw_ostream &OS, - SmallVectorImpl<MCFixup> &Fixups, - const MCSubtargetInfo &STI) const { +void SparcMCCodeEmitter::EncodeInstruction(const MCInst &MI, raw_ostream &OS, + SmallVectorImpl<MCFixup> &Fixups, + const MCSubtargetInfo &STI) const { unsigned Bits = getBinaryCodeForInstr(MI, Fixups, STI); - // Output the constant in big endian byte order. - for (unsigned i = 0; i != 4; ++i) { - OS << (char)(Bits >> 24); - Bits <<= 8; + if (Ctx.getAsmInfo()->isLittleEndian()) { + // Output the bits in little-endian byte order. + for (unsigned i = 0; i != 4; ++i) { + OS << (char)Bits; + Bits >>= 8; + } + } else { + // Output the bits in big-endian byte order. + for (unsigned i = 0; i != 4; ++i) { + OS << (char)(Bits >> 24); + Bits <<= 8; + } } unsigned tlsOpNo = 0; switch (MI.getOpcode()) { |