summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-06-07 23:27:59 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-06-07 23:27:59 +0000
commit6f8362c6bf854b809e270a7d1bf727e0e21f7d2e (patch)
tree7c425bb0045ff30f87b36cce1ae09f5afb98a5b2 /clang/test
parent9507f9cc054da3b8148ac294ea5ced79625a897f (diff)
downloadbcm5719-llvm-6f8362c6bf854b809e270a7d1bf727e0e21f7d2e.tar.gz
bcm5719-llvm-6f8362c6bf854b809e270a7d1bf727e0e21f7d2e.zip
Frontend: Add CodeGenAction support for handling LLVM IR.
- This magically enables using 'clang -cc1' as a replacement for most of 'llvm-as', 'llvm-dis', 'llc' and 'opt' functionality. For example, 'llvm-as' is: $ clang -cc1 -emit-llvm-bc FOO.ll -o FOO.bc and 'llvm-dis' is: $ clang -cc1 -emit-llvm FOO.bc -o - and 'opt' is, e.g.: $ clang -cc1 -emit-llvm -O3 -o FOO.opt.ll FOO.ll and 'llc' is, e.g.: $ clang -cc1 -S -o - FOO.ll The nice thing about using the backend tools this way is that they are guaranteed to exactly match how the compiler generates code (for example, setting the same backend options). llvm-svn: 105583
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Frontend/ir-support-codegen.ll8
-rw-r--r--clang/test/Frontend/ir-support-errors.ll8
2 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/Frontend/ir-support-codegen.ll b/clang/test/Frontend/ir-support-codegen.ll
new file mode 100644
index 00000000000..046b3af1c3e
--- /dev/null
+++ b/clang/test/Frontend/ir-support-codegen.ll
@@ -0,0 +1,8 @@
+; RUN: %clang_cc1 -S -o - %s | FileCheck %s
+
+target triple = "x86_64-apple-darwin10"
+
+; CHECK: .globl _f0
+define i32 @f0() nounwind ssp {
+ ret i32 0
+}
diff --git a/clang/test/Frontend/ir-support-errors.ll b/clang/test/Frontend/ir-support-errors.ll
new file mode 100644
index 00000000000..98227d46f7a
--- /dev/null
+++ b/clang/test/Frontend/ir-support-errors.ll
@@ -0,0 +1,8 @@
+; RUN: %clang_cc1 -S -o - %s 2>&1 | FileCheck %s
+
+target triple = "x86_64-apple-darwin10"
+
+define i32 @f0() nounwind ssp {
+; CHECK: {{.*}}ir-support-errors.ll:7:16: error: expected value token
+ ret i32 x
+}
OpenPOWER on IntegriCloud