diff options
| author | Owen Anderson <resistor@mac.com> | 2011-08-30 22:03:20 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2011-08-30 22:03:20 +0000 |
| commit | 391ac65377f2ad5e48a796e75120959e22430605 (patch) | |
| tree | f9b443ddfe80f7625b508ba02864d89a88b0bdf8 /lib | |
| parent | 10096dbdef22a10a6a4444437c935ab428545525 (diff) | |
| download | external_llvm-391ac65377f2ad5e48a796e75120959e22430605.zip external_llvm-391ac65377f2ad5e48a796e75120959e22430605.tar.gz external_llvm-391ac65377f2ad5e48a796e75120959e22430605.tar.bz2 | |
Fix encoding of Thumb1 B instructions with immediate offsets, which is necessary for round-tripping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138834 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp b/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp index a800b36..b798a3c 100644 --- a/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp +++ b/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp @@ -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. |
