diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-06-07 23:27:59 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-06-07 23:27:59 +0000 |
commit | 4cbbd94d0abeec2d7e7438d098527aa340d82389 (patch) | |
tree | 4f1d5230c0e7fb4930d785897e79bb30bd0b5ea3 /test/Frontend | |
parent | faddc3e53a95c68f2c3a966e0f1e6eba110dafd6 (diff) | |
download | clang-4cbbd94d0abeec2d7e7438d098527aa340d82389.tar.gz |
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).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105583 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Frontend')
-rw-r--r-- | test/Frontend/ir-support-codegen.ll | 8 | ||||
-rw-r--r-- | test/Frontend/ir-support-errors.ll | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/test/Frontend/ir-support-codegen.ll b/test/Frontend/ir-support-codegen.ll new file mode 100644 index 0000000000..046b3af1c3 --- /dev/null +++ b/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/test/Frontend/ir-support-errors.ll b/test/Frontend/ir-support-errors.ll new file mode 100644 index 0000000000..98227d46f7 --- /dev/null +++ b/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 +} |