mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-18 11:24:01 +00:00
[LTO API] add lto_codegen_set_module to set the destination module.
When debugging LTO issues with ld64, we use -save-temps to save the merged optimized bitcode file, then invoke ld64 again on the single bitcode file to speed up debugging code generation passes and ld64 stuff after code generation. llvm linking a single bitcode file via lto_codegen_add_module will generate a different bitcode file from the single input. With the newly-added lto_codegen_set_module, we can make sure the destination module is the same as the input. lto_codegen_set_module will transfer the ownship of the module to code generator. rdar://19024554 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230290 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -141,6 +141,22 @@ bool LTOCodeGenerator::addModule(LTOModule *mod) {
|
||||
return !ret;
|
||||
}
|
||||
|
||||
void LTOCodeGenerator::setModule(LTOModule *Mod) {
|
||||
assert(&Mod->getModule().getContext() == &Context &&
|
||||
"Expected module in same context");
|
||||
|
||||
// Delete the old merged module.
|
||||
if (IRLinker.getModule())
|
||||
IRLinker.deleteModule();
|
||||
AsmUndefinedRefs.clear();
|
||||
|
||||
IRLinker.setModule(&Mod->getModule());
|
||||
|
||||
const std::vector<const char*> &Undefs = Mod->getAsmUndefinedRefs();
|
||||
for (int I = 0, E = Undefs.size(); I != E; ++I)
|
||||
AsmUndefinedRefs[Undefs[I]] = 1;
|
||||
}
|
||||
|
||||
void LTOCodeGenerator::setTargetOptions(TargetOptions options) {
|
||||
Options = options;
|
||||
}
|
||||
|
Reference in New Issue
Block a user