summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2015-06-15 20:30:22 +0000
committerAlex Lorenz <arphaman@gmail.com>2015-06-15 20:30:22 +0000
commit735c47ec3e9a5d64343e764b72c4e35f171b06bb (patch)
tree9f5819d9580cf59726a54c04159ad1b1a35319bd /llvm/tools
parent49e9010ca339099d23c56e768d0b0fcf40929719 (diff)
downloadbcm5719-llvm-735c47ec3e9a5d64343e764b72c4e35f171b06bb.tar.gz
bcm5719-llvm-735c47ec3e9a5d64343e764b72c4e35f171b06bb.zip
MIR Serialization: Connect the machine function analysis pass to the MIR parser.
This commit connects the machine function analysis pass (which creates machine functions) to the MIR parser, which will initialize the machine functions with the state from the MIR file and reconstruct the machine IR. This commit introduces a new interface called 'MachineFunctionInitializer', which can be used to provide custom initialization for the machine functions. This commit also introduces a new diagnostic class called 'DiagnosticInfoMIRParser' which is used for MIR parsing errors. This commit modifies the default diagnostic handling in LLVMContext - now the the diagnostics are printed directly into llvm::errs() so that the MIR parsing errors can be printed with colours. Reviewers: Justin Bogner Differential Revision: http://reviews.llvm.org/D9928 llvm-svn: 239753
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llc/llc.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index fadcfa90235..88e73716099 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -210,6 +210,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
// Load the module to be compiled...
SMDiagnostic Err;
std::unique_ptr<Module> M;
+ std::unique_ptr<MIRParser> MIR;
Triple TheTriple;
bool SkipModule = MCPU == "help" ||
@@ -217,9 +218,13 @@ static int compileModule(char **argv, LLVMContext &Context) {
// If user just wants to list available options, skip module loading
if (!SkipModule) {
- if (StringRef(InputFilename).endswith_lower(".mir"))
- M = parseMIRFile(InputFilename, Err, Context);
- else
+ if (StringRef(InputFilename).endswith_lower(".mir")) {
+ MIR = createMIRParserFromFile(InputFilename, Err, Context);
+ if (MIR) {
+ M = MIR->parseLLVMModule();
+ assert(M && "parseLLVMModule should exit on failure");
+ }
+ } else
M = parseIRFile(InputFilename, Err, Context);
if (!M) {
Err.print(argv[0], errs());
@@ -350,7 +355,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
// Ask the target to add backend passes as necessary.
if (Target->addPassesToEmitFile(PM, *OS, FileType, NoVerify, StartAfterID,
- StopAfterID)) {
+ StopAfterID, MIR.get())) {
errs() << argv[0] << ": target does not support generation of this"
<< " file type!\n";
return 1;
OpenPOWER on IntegriCloud