This reverts commit r203762, "ARM: support emission of complex SO expressions".
authorJiangning Liu <jiangning.liu@arm.com>
Fri, 21 Mar 2014 02:51:01 +0000 (02:51 +0000)
committerJiangning Liu <jiangning.liu@arm.com>
Fri, 21 Mar 2014 02:51:01 +0000 (02:51 +0000)
The commit r203762 introduced silent failure for complext SO expression, and it's even worse than compiler crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204427 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
test/MC/ARM/shift-offset-addressing-emission.s [deleted file]

index a12b8d4b771fecc2797354e5c95908d624c4d0ba..3b2ca73aecd1d7677a9c8d68eaf46d524edf7329 100644 (file)
@@ -271,20 +271,8 @@ public:
   unsigned getSOImmOpValue(const MCInst &MI, unsigned Op,
                            SmallVectorImpl<MCFixup> &Fixups,
                            const MCSubtargetInfo &STI) const {
-    int SoImmVal = -1;
-
-    const MCOperand &MO = MI.getOperand(Op);
-    if (MO.isImm()) {
-      SoImmVal = ARM_AM::getSOImmVal(MO.getImm());
-    } else if (MO.isExpr()) {
-      int64_t Value;
-      bool Invalid = MO.getExpr()->EvaluateAsAbsolute(Value);
-      (void) Invalid;
-      assert(!Invalid && "non-constant expression is not a valid SOImm operand");
-      assert((Value >= INT32_MIN && Value <= INT32_MAX) &&
-             "expression must be representable in 32 bits");
-      SoImmVal = Value;
-    }
+    unsigned SoImm = MI.getOperand(Op).getImm();
+    int SoImmVal = ARM_AM::getSOImmVal(SoImm);
     assert(SoImmVal != -1 && "Not a valid so_imm value!");
 
     // Encode rotate_imm.
diff --git a/test/MC/ARM/shift-offset-addressing-emission.s b/test/MC/ARM/shift-offset-addressing-emission.s
deleted file mode 100644 (file)
index 1dbd80e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-@ RUN: llvm-mc -triple armv7-elf -filetype obj -o - %s \
-@ RUN:   | llvm-objdump -disassemble -no-show-raw-insn - | FileCheck %s
-
-       cmp r0, #(.L2 - .L1)
-.L1:
-.L2:
-
-@ CHECK: 0:    cmp     r0, #0
-