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/tools | |
| 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/tools')
| -rw-r--r-- | llvm/tools/llc/llc.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp index ca86a99524b..4fdcd4bfa69 100644 --- a/llvm/tools/llc/llc.cpp +++ b/llvm/tools/llc/llc.cpp @@ -20,6 +20,7 @@ #include "llvm/CodeGen/CommandFlags.h" #include "llvm/CodeGen/LinkAllAsmWriterComponents.h" #include "llvm/CodeGen/LinkAllCodegenComponents.h" +#include "llvm/CodeGen/MIR/MIRParser.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/IRPrintingPasses.h" #include "llvm/IR/LLVMContext.h" @@ -109,6 +110,8 @@ GetOutputStream(const char *TargetName, Triple::OSType OS, StringRef IFN = InputFilename; if (IFN.endswith(".bc") || IFN.endswith(".ll")) OutputFilename = IFN.drop_back(3); + else if (IFN.endswith(".mir")) + OutputFilename = IFN.drop_back(4); else OutputFilename = IFN; @@ -214,7 +217,10 @@ static int compileModule(char **argv, LLVMContext &Context) { // If user just wants to list available options, skip module loading if (!SkipModule) { - M = parseIRFile(InputFilename, Err, Context); + if (StringRef(InputFilename).endswith_lower(".mir")) + M = parseMIRFile(InputFilename, Err, Context); + else + M = parseIRFile(InputFilename, Err, Context); if (!M) { Err.print(argv[0], errs()); return 1; |

