1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Fix encoding of Thumb1 B instructions with immediate offsets, which is necessary for round-tripping.

llvm-svn: 138834
This commit is contained in:
Owen Anderson 2011-08-30 22:03:20 +00:00
parent d9dbde4a50
commit 309c4b7ef6
2 changed files with 8 additions and 2 deletions

View File

@ -484,7 +484,10 @@ getThumbBLXTargetOpValue(const MCInst &MI, unsigned OpIdx,
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.

View File

@ -105,12 +105,15 @@ _func:
@------------------------------------------------------------------------------
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