// Load the module to be compiled...
SMDiagnostic Err;
std::unique_ptr<Module> M;
- Module *mod = nullptr;
Triple TheTriple;
bool SkipModule = MCPU == "help" ||
// 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));
}
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)
// 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 &&
// Before executing passes, print the final values of the LLVM options.
cl::PrintOptionValues();
- PM.run(*mod);
+ PM.run(*M);
}
// Declare success.