diff options
| author | Alex Lorenz <arphaman@gmail.com> | 2015-05-19 18:17:39 +0000 |
|---|---|---|
| committer | Alex Lorenz <arphaman@gmail.com> | 2015-05-19 18:17:39 +0000 |
| commit | c5e0d4d146bed47b4e306b8f9fa0a2766d14a641 (patch) | |
| tree | ad7b2580b67bd1764285c10a094acd7794b129fd /llvm/test/CodeGen/MIR | |
| parent | 17a75d61b95fdc99edc7058aa87fa87d35cdeca4 (diff) | |
| download | bcm5719-llvm-c5e0d4d146bed47b4e306b8f9fa0a2766d14a641.tar.gz bcm5719-llvm-c5e0d4d146bed47b4e306b8f9fa0a2766d14a641.zip | |
MIR Serialization: print and parse LLVM IR using MIR format.
This commit is the initial commit for the MIR serialization project.
It creates a new library under CodeGen called 'MIR'. This new
library adds a new machine function pass that prints out the LLVM IR
using the MIR format. This pass is then added as a last pass when a
'stop-after' option is used in llc. The new library adds the initial
functionality for parsing of MIR files as well. This commit also
extends the llc tool so that it can recognize and parse MIR input files.
Reviewers: Duncan P. N. Exon Smith, Matthias Braun, Philip Reames
Differential Revision: http://reviews.llvm.org/D9616
llvm-svn: 237708
Diffstat (limited to 'llvm/test/CodeGen/MIR')
| -rw-r--r-- | llvm/test/CodeGen/MIR/lit.local.cfg | 2 | ||||
| -rw-r--r-- | llvm/test/CodeGen/MIR/llvmIR.mir | 35 | ||||
| -rw-r--r-- | llvm/test/CodeGen/MIR/llvmIRMissing.mir | 5 |
3 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/MIR/lit.local.cfg b/llvm/test/CodeGen/MIR/lit.local.cfg new file mode 100644 index 00000000000..e69aa576535 --- /dev/null +++ b/llvm/test/CodeGen/MIR/lit.local.cfg @@ -0,0 +1,2 @@ +config.suffixes = ['.mir'] + diff --git a/llvm/test/CodeGen/MIR/llvmIR.mir b/llvm/test/CodeGen/MIR/llvmIR.mir new file mode 100644 index 00000000000..b448f8aa9db --- /dev/null +++ b/llvm/test/CodeGen/MIR/llvmIR.mir @@ -0,0 +1,35 @@ +# RUN: ~/build/llvm/bin/llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s +# This test ensures that the LLVM IR that's embedded with MIR is parsed +# correctly. + +--- | + target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" + target triple = "x86_64-apple-darwin14.3.0" + + ; CHECK: define i32 @foo(i32 %x, i32 %y) + ; CHECK: %z = alloca i32, align 4 + ; CHECK: store i32 %x, i32* %z, align 4 + ; CHECK: br label %Test + ; CHECK: Test: + ; CHECK: %m = load i32, i32* %z, align 4 + ; CHECK: %cond = icmp eq i32 %y, %m + ; CHECK: br i1 %cond, label %IfEqual, label %IfUnequal + ; CHECK: IfEqual: + ; CHECK: ret i32 1 + ; CHECK: IfUnequal: + ; CHECK: ret i32 0 + define i32 @foo(i32 %x, i32 %y) { + %z = alloca i32, align 4 + store i32 %x, i32* %z, align 4 + br label %Test + Test: + %m = load i32, i32* %z, align 4 + %cond = icmp eq i32 %y, %m + br i1 %cond, label %IfEqual, label %IfUnequal + IfEqual: + ret i32 1 + IfUnequal: + ret i32 0 + } + +... diff --git a/llvm/test/CodeGen/MIR/llvmIRMissing.mir b/llvm/test/CodeGen/MIR/llvmIRMissing.mir new file mode 100644 index 00000000000..3b3522a0c57 --- /dev/null +++ b/llvm/test/CodeGen/MIR/llvmIRMissing.mir @@ -0,0 +1,5 @@ +# RUN: ~/build/llvm/bin/llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s +# This test ensures that the MIR parser accepts files without the LLVM IR. + +--- +... |

