Hi,
How could I emit commands used to generate LTO temp files including preopt.bc, internalize.bc, opt.bc, precodegen.bc and lto.o?
Thanks,
Anshil
Hi,
How could I emit commands used to generate LTO temp files including preopt.bc, internalize.bc, opt.bc, precodegen.bc and lto.o?
Thanks,
Anshil
What linker are you using? For lld this would be --save-temps (-Wl,–save-temps via the clang driver). For gold/bfd it would be -Wl,–plugin-opt=save-temps.
I am using lld. How could I collect the commands used to generate these temps though?
| gandhi56
October 13 |
- | - |
I am using lld. How could I collect the commands used to generate these temps though?
Not sure what you mean by “collect the commands” - collect from where?
@teresajohnson I would like to know how the temps are created. What passes run to create preopt.bc, internalize.bc, opt.bc and so on.
They are dumped via hooks.
See the following for the function that sets up the hooks (invoked by the linkers): https://github.com/llvm/llvm-project/blob/4b8f23e93de56b7bfeffbf789ec5a75525dc5d88/llvm/lib/LTO/LTOBackend.cpp#L87
The hooks set up there are invoked at several points during the LTO process. See lib/LTO/LTO.cpp and lib/LTO/LTOBackend.cpp for the calls to the *ModuleHook callbacks:
https://github.com/search?q=repo%3Allvm%2Fllvm-project%20"ModuleHook(%22&type=code
Ahh, I see. That’s helpful, thank you!