void LTOCodeGenerator::applyScopeRestrictions() {
if (ScopeRestrictionsDone || !ShouldInternalize)
return;
- Module *mergedModule = IRLinker.getModule();
+ Module *MergedModule = IRLinker.getModule();
// Start off with a verification pass.
legacy::PassManager passes;
TargetLibraryInfoImpl TLII(Triple(TargetMach->getTargetTriple()));
TargetLibraryInfo TLI(TLII);
- accumulateAndSortLibcalls(Libcalls, TLI, *mergedModule, *TargetMach);
+ accumulateAndSortLibcalls(Libcalls, TLI, *MergedModule, *TargetMach);
- for (Module::iterator f = mergedModule->begin(),
- e = mergedModule->end(); f != e; ++f)
- applyRestriction(*f, Libcalls, MustPreserveList, AsmUsed, Mangler);
- for (Module::global_iterator v = mergedModule->global_begin(),
- e = mergedModule->global_end(); v != e; ++v)
- applyRestriction(*v, Libcalls, MustPreserveList, AsmUsed, Mangler);
- for (Module::alias_iterator a = mergedModule->alias_begin(),
- e = mergedModule->alias_end(); a != e; ++a)
- applyRestriction(*a, Libcalls, MustPreserveList, AsmUsed, Mangler);
+ for (Function &f : *MergedModule)
+ applyRestriction(f, Libcalls, MustPreserveList, AsmUsed, Mangler);
+ for (GlobalVariable &v : MergedModule->globals())
+ applyRestriction(v, Libcalls, MustPreserveList, AsmUsed, Mangler);
+ for (GlobalAlias &a : MergedModule->aliases())
+ applyRestriction(a, Libcalls, MustPreserveList, AsmUsed, Mangler);
GlobalVariable *LLVMCompilerUsed =
- mergedModule->getGlobalVariable("llvm.compiler.used");
+ MergedModule->getGlobalVariable("llvm.compiler.used");
findUsedValues(LLVMCompilerUsed, AsmUsed);
if (LLVMCompilerUsed)
LLVMCompilerUsed->eraseFromParent();
llvm::ArrayType *ATy = llvm::ArrayType::get(i8PTy, asmUsed2.size());
LLVMCompilerUsed =
- new llvm::GlobalVariable(*mergedModule, ATy, false,
+ new llvm::GlobalVariable(*MergedModule, ATy, false,
llvm::GlobalValue::AppendingLinkage,
llvm::ConstantArray::get(ATy, asmUsed2),
"llvm.compiler.used");
passes.add(createInternalizePass(MustPreserveList));
// apply scope restrictions
- passes.run(*mergedModule);
+ passes.run(*MergedModule);
ScopeRestrictionsDone = true;
}
if (!this->determineTarget(errMsg))
return false;
- Module *mergedModule = IRLinker.getModule();
+ Module *MergedModule = IRLinker.getModule();
// Mark which symbols can not be internalized
this->applyScopeRestrictions();
legacy::PassManager passes;
// Add an appropriate DataLayout instance for this module...
- mergedModule->setDataLayout(TargetMach->createDataLayout());
+ MergedModule->setDataLayout(TargetMach->createDataLayout());
passes.add(
createTargetTransformInfoWrapperPass(TargetMach->getTargetIRAnalysis()));
PMB.populateLTOPassManager(passes);
// Run our queue of passes all at once now, efficiently.
- passes.run(*mergedModule);
+ passes.run(*MergedModule);
return true;
}
if (!this->determineTarget(errMsg))
return false;
- Module *mergedModule = IRLinker.getModule();
+ Module *MergedModule = IRLinker.getModule();
legacy::PassManager codeGenPasses;
return false;
}
- // Run the code generator, and write assembly file
- codeGenPasses.run(*mergedModule);
+ // Run the code generator, and write object file
+ codeGenPasses.run(*MergedModule);
return true;
}