I'm trying to make libLTO (https://llvm.org/docs/LinkTimeOptimization.html#liblto) generate an assembly file instead of object format.
Right now, the --filetype=asm option has no effect in libLTO. This option is used by tools such as llvm-lto and llc.
libLTO directly interacts with LTOCodeGenerator, which does not use the option but has a method to override the default file type (CGFT_ObjectFile) .
My current solution is to add a new function to lto.h that sets the filetype to asm.
Another solution is to have one of the libLTO functions that create LTOCodeGenerator, and after the ParseCommandLineOptions has run, to query the --filetype option and call LTOCodeGenerator::setFileType if the option was specified (I haven't tried that, but shud work in theory).