diff options
author | Jim Grosbach <grosbach@apple.com> | 2010-12-03 22:31:40 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2010-12-03 22:31:40 +0000 |
commit | 567ebd0cb548bead241a363fa17db5508a439eae (patch) | |
tree | 75d270abcb0911032853210383283ede10483a7b /llvm/lib/Target/ARM | |
parent | a6c55a31952d22465e140e1b4e4767866a4f5f86 (diff) | |
download | bcm5719-llvm-567ebd0cb548bead241a363fa17db5508a439eae.tar.gz bcm5719-llvm-567ebd0cb548bead241a363fa17db5508a439eae.zip |
Encode the 32-bit wide Thumb (and Thumb2) instructions with the high order
halfword being emitted to the stream first. rdar://8728174
llvm-svn: 120848
Diffstat (limited to 'llvm/lib/Target/ARM')
-rw-r--r-- | llvm/lib/Target/ARM/ARMMCCodeEmitter.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMMCCodeEmitter.cpp b/llvm/lib/Target/ARM/ARMMCCodeEmitter.cpp index d6926d9450e..bdac5adf4cd 100644 --- a/llvm/lib/Target/ARM/ARMMCCodeEmitter.cpp +++ b/llvm/lib/Target/ARM/ARMMCCodeEmitter.cpp @@ -995,6 +995,7 @@ getAddrMode6OffsetOpValue(const MCInst &MI, unsigned Op, void ARMMCCodeEmitter:: EncodeInstruction(const MCInst &MI, raw_ostream &OS, SmallVectorImpl<MCFixup> &Fixups) const { + const ARMSubtarget &Subtarget = TM.getSubtarget<ARMSubtarget>(); // Pseudo instructions don't get encoded. const TargetInstrDesc &Desc = TII.get(MI.getOpcode()); uint64_t TSFlags = Desc.TSFlags; @@ -1007,7 +1008,14 @@ EncodeInstruction(const MCInst &MI, raw_ostream &OS, case ARMII::Size2Bytes: Size = 2; break; case ARMII::Size4Bytes: Size = 4; break; } - EmitConstant(getBinaryCodeForInstr(MI, Fixups), Size, OS); + uint32_t Binary = getBinaryCodeForInstr(MI, Fixups); + // Thumb 32-bit wide instructions need to be have the high order halfword + // emitted first. + if (Subtarget.isThumb() && Size == 4) { + EmitConstant(Binary >> 16, 2, OS); + EmitConstant(Binary & 0xffff, 2, OS); + } else + EmitConstant(Binary, Size, OS); ++MCNumEmitted; // Keep track of the # of mi's emitted. } |