summaryrefslogtreecommitdiffstats
path: root/llvm/test/MC/AsmParser/assembler-expressions-inlineasm.ll
diff options
context:
space:
mode:
authorNirav Dave <niravd@google.com>2018-04-30 19:22:40 +0000
committerNirav Dave <niravd@google.com>2018-04-30 19:22:40 +0000
commit6c0665e22174d474050e85ca367424f6e02476be (patch)
tree0fc4c2920b2bd5768aedf8c28b1a7098542eb33b /llvm/test/MC/AsmParser/assembler-expressions-inlineasm.ll
parent8fe04ad3f7acf9eac603602cfc2980b7ad85d7a1 (diff)
downloadbcm5719-llvm-6c0665e22174d474050e85ca367424f6e02476be.tar.gz
bcm5719-llvm-6c0665e22174d474050e85ca367424f6e02476be.zip
[MC] Change AsmParser to leverage Assembler during evaluation
Teach AsmParser to check with Assembler for when evaluating constant expressions. This improves the handing of preprocessor expressions that must be resolved at parse time. This idiom can be found as assembling-time assertion checks in source-level assemblers. Note that this relies on the MCStreamer to keep sufficient tabs on Section / Fragment information which the MCAsmStreamer does not. As a result the textual output may fail where the equivalent object generation would pass. This can most easily be resolved by folding the MCAsmStreamer and MCObjectStreamer together which is planned for in a separate patch. Currently, this feature is only enabled for assembly input, keeping IR compilation consistent between assembly and object generation. Reviewers: echristo, rnk, probinson, espindola, peter.smith Reviewed By: peter.smith Subscribers: eraman, peter.smith, arichardson, jyknight, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D45164 llvm-svn: 331218
Diffstat (limited to 'llvm/test/MC/AsmParser/assembler-expressions-inlineasm.ll')
-rw-r--r--llvm/test/MC/AsmParser/assembler-expressions-inlineasm.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/MC/AsmParser/assembler-expressions-inlineasm.ll b/llvm/test/MC/AsmParser/assembler-expressions-inlineasm.ll
new file mode 100644
index 00000000000..35f110f37e2
--- /dev/null
+++ b/llvm/test/MC/AsmParser/assembler-expressions-inlineasm.ll
@@ -0,0 +1,14 @@
+; RUN: not llc -mtriple x86_64-unknown-linux-gnu -o %t.s -filetype=asm %s 2>&1 | FileCheck %s
+; RUN: not llc -mtriple x86_64-unknown-linux-gnu -o %t.o -filetype=obj %s 2>&1 | FileCheck %s
+
+; Assembler-aware expression evaluation should be disabled in inline
+; assembly to prevent differences in behavior between object and
+; assembly output.
+
+
+; CHECK: <inline asm>:1:17: error: expected absolute expression
+
+define i32 @main() local_unnamed_addr {
+ tail call void asm sideeffect "foo: nop; .if . - foo==1; nop;.endif", "~{dirflag},~{fpsr},~{flags}"()
+ ret i32 0
+}
OpenPOWER on IntegriCloud