diff options
author | Tim Northover <Tim.Northover@arm.com> | 2013-02-27 16:43:09 +0000 |
---|---|---|
committer | Tim Northover <Tim.Northover@arm.com> | 2013-02-27 16:43:09 +0000 |
commit | d65dfd83421f4d26e6dc20476718d7d9b6ba3f3b (patch) | |
tree | ce3f890710ef9c52a5343e82f2b5cfed0123ded6 /lib | |
parent | 2fe71f8f7e678174ba217d3d16525092805ad45b (diff) | |
download | external_llvm-d65dfd83421f4d26e6dc20476718d7d9b6ba3f3b.zip external_llvm-d65dfd83421f4d26e6dc20476718d7d9b6ba3f3b.tar.gz external_llvm-d65dfd83421f4d26e6dc20476718d7d9b6ba3f3b.tar.bz2 |
ARM: permit full range of valid ADR immediates.
This fixes an issue where trying to assemlbe valid ADR instructions would cause
LLVM to hit a failed assertion.
Patch by Keith Walker.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176189 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp b/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp index 09e15af..7a59a7d 100644 --- a/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp +++ b/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp @@ -655,15 +655,28 @@ getAdrLabelOpValue(const MCInst &MI, unsigned OpIdx, int32_t offset = MO.getImm(); uint32_t Val = 0x2000; + int SoImmVal; if (offset == INT32_MIN) { Val = 0x1000; - offset = 0; + SoImmVal = 0; } else if (offset < 0) { Val = 0x1000; offset *= -1; + SoImmVal = ARM_AM::getSOImmVal(offset); + if(SoImmVal == -1) { + Val = 0x2000; + offset *= -1; + SoImmVal = ARM_AM::getSOImmVal(offset); + } + } else { + SoImmVal = ARM_AM::getSOImmVal(offset); + if(SoImmVal == -1) { + Val = 0x1000; + offset *= -1; + SoImmVal = ARM_AM::getSOImmVal(offset); + } } - int SoImmVal = ARM_AM::getSOImmVal(offset); assert(SoImmVal != -1 && "Not a valid so_imm value!"); Val |= SoImmVal; |