diff options
| author | Craig Topper <craig.topper@gmail.com> | 2014-12-11 07:04:52 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2014-12-11 07:04:52 +0000 |
| commit | 82a4a35d916506600e2381e926f5ee961cd241c6 (patch) | |
| tree | 9029d7fa48163564094ee20c8ba974816d848a57 | |
| parent | ff55ffacab59ef45c4b88eea1bcdaea0a4780a7a (diff) | |
| download | bcm5719-llvm-82a4a35d916506600e2381e926f5ee961cd241c6.tar.gz bcm5719-llvm-82a4a35d916506600e2381e926f5ee961cd241c6.zip | |
Just use the Module unique_ptr object directly in many places instead of separate pointer that's kept in sync with it.
llvm-svn: 224004
| -rw-r--r-- | llvm/tools/llc/llc.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp index b9de56c105d..4157d3fe5ad 100644 --- a/llvm/tools/llc/llc.cpp +++ b/llvm/tools/llc/llc.cpp @@ -205,7 +205,6 @@ static int compileModule(char **argv, LLVMContext &Context) { // Load the module to be compiled... SMDiagnostic Err; std::unique_ptr<Module> M; - Module *mod = nullptr; Triple TheTriple; bool SkipModule = MCPU == "help" || @@ -220,16 +219,15 @@ 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); - mod = M.get(); - if (mod == nullptr) { + if (!M) { Err.print(argv[0], errs()); return 1; } // If we are supposed to override the target triple, do so now. if (!TargetTriple.empty()) - mod->setTargetTriple(Triple::normalize(TargetTriple)); - TheTriple = Triple(mod->getTargetTriple()); + M->setTargetTriple(Triple::normalize(TargetTriple)); + TheTriple = Triple(M->getTargetTriple()); } else { TheTriple = Triple(Triple::normalize(TargetTriple)); } @@ -284,7 +282,7 @@ static int compileModule(char **argv, LLVMContext &Context) { if (SkipModule) return 0; - assert(mod && "Should have exited if we didn't have a module!"); + assert(M && "Should have exited if we didn't have a module!"); TargetMachine &Target = *target.get(); if (GenerateSoftFloatCalls) @@ -306,7 +304,7 @@ static int compileModule(char **argv, LLVMContext &Context) { // Add the target data from the target machine, if it exists, or the module. if (const DataLayout *DL = Target.getSubtargetImpl()->getDataLayout()) - mod->setDataLayout(DL); + M->setDataLayout(DL); PM.add(new DataLayoutPass()); if (RelaxAll.getNumOccurrences() > 0 && @@ -348,7 +346,7 @@ static int compileModule(char **argv, LLVMContext &Context) { // Before executing passes, print the final values of the LLVM options. cl::PrintOptionValues(); - PM.run(*mod); + PM.run(*M); } // Declare success. |

