|
LLVM
4.0.0
|
#include <Config.h>
Public Types | |
| typedef std::function< bool(unsigned Task, const Module &)> | ModuleHookFn |
| The following callbacks deal with tasks, which normally represent the entire optimization and code generation pipeline for what will become a single native object file. More... | |
| typedef std::function< bool(const ModuleSummaryIndex &Index)> | CombinedIndexHookFn |
| A combined index hook is called after all per-module indexes have been combined (ThinLTO-specific). More... | |
Public Member Functions | |
| Error | addSaveTemps (std::string OutputFileName, bool UseInputModulePath=false) |
| This is a convenience function that configures this Config object to write temporary files named after the given OutputFileName for each of the LTO phases to disk. More... | |
Public Attributes | |
| std::string | CPU |
| TargetOptions | Options |
| std::vector< std::string > | MAttrs |
| Reloc::Model | RelocModel = Reloc::PIC_ |
| CodeModel::Model | CodeModel = CodeModel::Default |
| CodeGenOpt::Level | CGOptLevel = CodeGenOpt::Default |
| unsigned | OptLevel = 2 |
| bool | DisableVerify = false |
| bool | CodeGenOnly = false |
| Disable entirely the optimizer, including importing for ThinLTO. More... | |
| std::string | OptPipeline |
| If this field is set, the set of passes run in the middle-end optimizer will be the one specified by the string. More... | |
| std::string | AAPipeline |
| std::string | OverrideTriple |
| Setting this field will replace target triples in input files with this triple. More... | |
| std::string | DefaultTriple |
| Setting this field will replace unspecified target triples in input files with this triple. More... | |
| std::string | SampleProfile |
| Sample PGO profile path. More... | |
| bool | ShouldDiscardValueNames = true |
| DiagnosticHandlerFunction | DiagHandler |
| std::unique_ptr< raw_ostream > | ResolutionFile |
| If this field is set, LTO will write input file paths and symbol resolutions here in llvm-lto2 command line flag format. More... | |
| ModuleHookFn | PreOptModuleHook |
| This module hook is called after linking (regular LTO) or loading (ThinLTO) the module, before modifying it. More... | |
| ModuleHookFn | PostPromoteModuleHook |
| This hook is called after promoting any internal functions (ThinLTO-specific). More... | |
| ModuleHookFn | PostInternalizeModuleHook |
| This hook is called after internalizing the module. More... | |
| ModuleHookFn | PostImportModuleHook |
| This hook is called after importing from other modules (ThinLTO-specific). More... | |
| ModuleHookFn | PostOptModuleHook |
| This module hook is called after optimization is complete. More... | |
| ModuleHookFn | PreCodeGenModuleHook |
| This module hook is called before code generation. More... | |
| CombinedIndexHookFn | CombinedIndexHook |
LTO configuration.
A linker can configure LTO by setting fields in this data structure and passing it to the lto::LTO constructor.
| typedef std::function<bool(const ModuleSummaryIndex &Index)> llvm::lto::Config::CombinedIndexHookFn |
A combined index hook is called after all per-module indexes have been combined (ThinLTO-specific).
It can be used to implement -save-temps for the combined index.
If this function returns false, any further processing for ThinLTO tasks is aborted.
It is called regardless of whether the backend is in-process, although it is not called from individual backend processes.
| typedef std::function<bool(unsigned Task, const Module &)> llvm::lto::Config::ModuleHookFn |
The following callbacks deal with tasks, which normally represent the entire optimization and code generation pipeline for what will become a single native object file.
Each task has a unique identifier between 0 and getMaxTasks()-1, which is supplied to the callback via the Task parameter. A task represents the entire pipeline for ThinLTO and regular (non-parallel) LTO, but a parallel code generation task will be split into N tasks before code generation, where N is the parallelism level.
LTO may decide to stop processing a task at any time, for example if the module is empty or if a module hook (see below) returns false. For this reason, the client should not expect to receive exactly getMaxTasks() native object files. A module hook may be used by a linker to perform actions during the LTO pipeline. For example, a linker may use this function to implement -save-temps. If this function returns false, any further processing for that task is aborted.
Module hooks must be thread safe with respect to the linker's internal data structures. A module hook will never be called concurrently from multiple threads with the same task ID, or the same module.
Note that in out-of-process backend scenarios, none of the hooks will be called for ThinLTO tasks.
This is a convenience function that configures this Config object to write temporary files named after the given OutputFileName for each of the LTO phases to disk.
A client can use this function to implement -save-temps.
FIXME: Temporary files derived from ThinLTO backends are currently named after the input file name, rather than the output file name, when UseInputModulePath is set to true.
Specifically, it (1) sets each of the above module hooks and the combined index hook to a function that calls the hook function (if any) that was present in the appropriate field when the addSaveTemps function was called, and writes the module to a bitcode file with a name prefixed by the given output file name, and (2) creates a resolution file whose name is prefixed by the given output file name and sets ResolutionFile to its file handle.
Definition at line 51 of file LTOBackend.cpp.
References CombinedIndexHook, llvm::errorCodeToError(), llvm::sys::fs::F_None, llvm::sys::fs::F_Text, PostImportModuleHook, PostInternalizeModuleHook, PostOptModuleHook, PostPromoteModuleHook, PreCodeGenModuleHook, PreOptModuleHook, reportOpenError(), ResolutionFile, ShouldDiscardValueNames, llvm::Error::success(), llvm::utostr(), llvm::WriteBitcodeToFile(), and llvm::WriteIndexToFile().
| std::string llvm::lto::Config::AAPipeline |
Definition at line 58 of file Config.h.
Referenced by computeCacheKey().
| CodeGenOpt::Level llvm::lto::Config::CGOptLevel = CodeGenOpt::Default |
Definition at line 43 of file Config.h.
Referenced by computeCacheKey().
Disable entirely the optimizer, including importing for ThinLTO.
Definition at line 48 of file Config.h.
Referenced by llvm::lto::backend(), and llvm::lto::thinBackend().
| CodeModel::Model llvm::lto::Config::CodeModel = CodeModel::Default |
Definition at line 42 of file Config.h.
Referenced by computeCacheKey().
| CombinedIndexHookFn llvm::lto::Config::CombinedIndexHook |
Definition at line 139 of file Config.h.
Referenced by addSaveTemps().
| std::string llvm::lto::Config::CPU |
Definition at line 38 of file Config.h.
Referenced by computeCacheKey().
| std::string llvm::lto::Config::DefaultTriple |
Setting this field will replace unspecified target triples in input files with this triple.
Definition at line 66 of file Config.h.
Referenced by computeCacheKey().
| DiagnosticHandlerFunction llvm::lto::Config::DiagHandler |
| std::vector<std::string> llvm::lto::Config::MAttrs |
Definition at line 40 of file Config.h.
Referenced by computeCacheKey().
| TargetOptions llvm::lto::Config::Options |
Definition at line 39 of file Config.h.
Referenced by computeCacheKey().
| unsigned llvm::lto::Config::OptLevel = 2 |
Definition at line 44 of file Config.h.
Referenced by computeCacheKey().
| std::string llvm::lto::Config::OptPipeline |
If this field is set, the set of passes run in the middle-end optimizer will be the one specified by the string.
Only works with the new pass manager as the old one doesn't have this ability.
Definition at line 53 of file Config.h.
Referenced by computeCacheKey().
| std::string llvm::lto::Config::OverrideTriple |
Setting this field will replace target triples in input files with this triple.
Definition at line 62 of file Config.h.
Referenced by computeCacheKey().
| ModuleHookFn llvm::lto::Config::PostImportModuleHook |
This hook is called after importing from other modules (ThinLTO-specific).
Definition at line 118 of file Config.h.
Referenced by addSaveTemps(), and llvm::lto::thinBackend().
| ModuleHookFn llvm::lto::Config::PostInternalizeModuleHook |
This hook is called after internalizing the module.
Definition at line 115 of file Config.h.
Referenced by addSaveTemps(), and llvm::lto::thinBackend().
| ModuleHookFn llvm::lto::Config::PostOptModuleHook |
This module hook is called after optimization is complete.
Definition at line 121 of file Config.h.
Referenced by addSaveTemps().
| ModuleHookFn llvm::lto::Config::PostPromoteModuleHook |
This hook is called after promoting any internal functions (ThinLTO-specific).
Definition at line 112 of file Config.h.
Referenced by addSaveTemps(), and llvm::lto::thinBackend().
| ModuleHookFn llvm::lto::Config::PreCodeGenModuleHook |
This module hook is called before code generation.
It is similar to the PostOptModuleHook, but for parallel code generation it is called after splitting the module.
Definition at line 126 of file Config.h.
Referenced by addSaveTemps().
| ModuleHookFn llvm::lto::Config::PreOptModuleHook |
This module hook is called after linking (regular LTO) or loading (ThinLTO) the module, before modifying it.
Definition at line 108 of file Config.h.
Referenced by addSaveTemps(), and llvm::lto::thinBackend().
| Reloc::Model llvm::lto::Config::RelocModel = Reloc::PIC_ |
Definition at line 41 of file Config.h.
Referenced by computeCacheKey().
| std::unique_ptr<raw_ostream> llvm::lto::Config::ResolutionFile |
If this field is set, LTO will write input file paths and symbol resolutions here in llvm-lto2 command line flag format.
This can be used for testing and for running the LTO pipeline outside of the linker with llvm-lto2.
Definition at line 78 of file Config.h.
Referenced by llvm::lto::LTO::add(), and addSaveTemps().
| std::string llvm::lto::Config::SampleProfile |
Definition at line 71 of file Config.h.
Referenced by addSaveTemps(), and llvm::lto::LTOLLVMContext::LTOLLVMContext().
1.8.6