[llvm-commits] [llvm] r138834 - in /llvm/trunk: lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp test/MC/ARM/basic-thumb-instructions.s
Owen Anderson
resistor at mac.com
Tue Aug 30 15:03:20 PDT 2011
Author: resistor
Date: Tue Aug 30 17:03:20 2011
New Revision: 138834
URL: http://llvm.org/viewvc/llvm-project?rev=138834&view=rev
Log:
Fix encoding of Thumb1 B instructions with immediate offsets, which is necessary for round-tripping.
Modified:
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
llvm/trunk/test/MC/ARM/basic-thumb-instructions.s
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp?rev=138834&r1=138833&r2=138834&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp Tue Aug 30 17:03:20 2011
@@ -484,7 +484,10 @@
uint32_t ARMMCCodeEmitter::
getThumbBRTargetOpValue(const MCInst &MI, unsigned OpIdx,
SmallVectorImpl<MCFixup> &Fixups) const {
- return ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_arm_thumb_br, Fixups);
+ const MCOperand MO = MI.getOperand(OpIdx);
+ if (MO.isExpr())
+ return ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_arm_thumb_br, Fixups);
+ return (MO.getImm() >> 1);
}
/// getThumbBCCTargetOpValue - Return encoding info for Thumb branch target.
Modified: llvm/trunk/test/MC/ARM/basic-thumb-instructions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/basic-thumb-instructions.s?rev=138834&r1=138833&r2=138834&view=diff
==============================================================================
--- llvm/trunk/test/MC/ARM/basic-thumb-instructions.s (original)
+++ llvm/trunk/test/MC/ARM/basic-thumb-instructions.s Tue Aug 30 17:03:20 2011
@@ -105,12 +105,15 @@
@------------------------------------------------------------------------------
b _baz
beq _bar
+ b #1838
+ b #-420
@ CHECK: b _baz @ encoding: [A,0xe0'A']
@ fixup A - offset: 0, value: _baz, kind: fixup_arm_thumb_br
@ CHECK: beq _bar @ encoding: [A,0xd0]
@ fixup A - offset: 0, value: _bar, kind: fixup_arm_thumb_bcc
-
+@ CHECK: b #1838 @ encoding: [0x97,0xe3]
+@ CHECK: b #-420 @ encoding: [0x2e,0xe7]
@------------------------------------------------------------------------------
@ BICS
More information about the llvm-commits
mailing list