ARM: raise error message when complex SO expressions can't really be
authorJiangning Liu <jiangning.liu@arm.com>
Thu, 27 Mar 2014 07:42:58 +0000 (07:42 +0000)
committerJiangning Liu <jiangning.liu@arm.com>
Thu, 27 Mar 2014 07:42:58 +0000 (07:42 +0000)
solved as a constant at compilation time.

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

lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/label_offset.s [new file with mode: 0644]

index e3215491fdf00ff17c1e18df193768eff150792a..83fedb70ebd724bf69fe56c8babb7324aab67d53 100644 (file)
@@ -9357,7 +9357,7 @@ unsigned ARMAsmParser::validateTargetOperandClass(MCParsedAsmOperand *AsmOp,
       const MCExpr *SOExpr = Op->getImm();
       int64_t Value;
       if (!SOExpr->EvaluateAsAbsolute(Value))
-        return Match_Success;
+        return Match_InvalidOperand;
       assert((Value >= INT32_MIN && Value <= INT32_MAX) &&
              "expression value must be representiable in 32 bits");
     }
diff --git a/test/MC/ARM/label_offset.s b/test/MC/ARM/label_offset.s
new file mode 100644 (file)
index 0000000..0aeb3b6
--- /dev/null
@@ -0,0 +1,8 @@
+@ RUN: not llvm-mc -triple=armv7-linux-gnuabi -filetype=obj < %s 2>&1 | FileCheck %s
+
+.text
+    cmp r2, #(l2 - l1) >> 6
+@ CHECK: error: invalid operand for instruction
+
+l1:
+l2: