LLVM: llvm::lto::Config Struct Reference (original) (raw)
#include "[llvm/LTO/Config.h](Config%5F8h%5Fsource.html)"
| Public Types | |
|---|---|
| enum | VisScheme { FromPrevailing, ELF } |
| using | ModuleHookFn = std::function<bool(unsigned Task, const Module &)> |
| 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. | |
| using | CombinedIndexHookFn |
| A combined index hook is called after all per-module indexes have been combined (ThinLTO-specific). |
| Public Member Functions | |
|---|---|
| LLVM_ABI Error | addSaveTemps (std::string OutputFileName, bool UseInputModulePath=false, const DenseSet< StringRef > &SaveTempsArgs={}) |
| 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. |
| Public Attributes | |
|---|---|
| std::string | CPU |
| TargetOptions | Options |
| std::vector< std::string > | MAttrs |
| std::vector< std::string > | MllvmArgs |
| std::vector< std::string > | PassPlugins |
| std::function< void(legacy::PassManager &)> | PreCodeGenPassesHook |
| For adding passes that run right before codegen. | |
| std::optional< Reloc::Model > | RelocModel = Reloc::PIC_ |
| std::optional< CodeModel::Model > | CodeModel |
| CodeGenOptLevel | CGOptLevel = CodeGenOptLevel::Default |
| CodeGenFileType | CGFileType = CodeGenFileType::ObjectFile |
| unsigned | OptLevel = 2 |
| bool | VerifyEach = false |
| bool | DisableVerify = false |
| bool | Freestanding = false |
| Flag to indicate that the optimizer should not assume builtins are present on the target. | |
| bool | CodeGenOnly = false |
| Disable entirely the optimizer, including importing for ThinLTO. | |
| bool | RunCSIRInstr = false |
| Run PGO context sensitive IR instrumentation. | |
| bool | PGOWarnMismatch = true |
| Turn on/off the warning about a hash mismatch in the PGO profile data. | |
| bool | HasWholeProgramVisibility = false |
| Asserts whether we can assume whole program visibility during the LTO link. | |
| bool | ValidateAllVtablesHaveTypeInfos = false |
| We're validating that all native vtables have corresponding type infos. | |
| bool | AllVtablesHaveTypeInfos = false |
| If all native vtables have corresponding type infos, allow usage of RTTI to block devirtualization on types used in native files. | |
| bool | AlwaysEmitRegularLTOObj = false |
| Always emit a Regular LTO object even when it is empty because no Regular LTO modules were linked. | |
| bool | KeepSymbolNameCopies = true |
| If true, the LTO instance creates copies of the symbol names for LTO::run. | |
| bool | Dtlto = 0 |
| This flag is used as one of parameters to calculate cache entries and to ensure that in-process cache and out-of-process (DTLTO) cache are distinguished. | |
| VisScheme | VisibilityScheme = FromPrevailing |
| Allows non-imported definitions to get the potentially more constraining visibility from the prevailing definition. | |
| 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. | |
| std::string | AAPipeline |
| std::string | OverrideTriple |
| Setting this field will replace target triples in input files with this triple. | |
| std::string | DefaultTriple |
| Setting this field will replace unspecified target triples in input files with this triple. | |
| std::string | CSIRProfile |
| Context Sensitive PGO profile path. | |
| std::string | SampleProfile |
| Sample PGO profile path. | |
| std::string | ProfileRemapping |
| Name remapping file for profile data. | |
| std::string | DwoDir |
| The directory to store .dwo files. | |
| std::string | SplitDwarfFile |
| The name for the split debug info file used for the DW_AT_[GNU_]dwo_name attribute in the skeleton CU. | |
| std::string | SplitDwarfOutput |
| The path to write a .dwo file to. | |
| std::string | RemarksFilename |
| Optimization remarks file path. | |
| std::string | RemarksPasses |
| Optimization remarks pass filter. | |
| bool | RemarksWithHotness = false |
| Whether to emit optimization remarks with hotness informations. | |
| std::optional< uint64_t > | RemarksHotnessThreshold = 0 |
| The minimum hotness value a diagnostic needs in order to be included in optimization diagnostics. | |
| std::string | RemarksFormat |
| The format used for serializing remarks (default: YAML). | |
| bool | DebugPassManager = false |
| Whether to emit the pass manager debuggging informations. | |
| std::string | StatsFile |
| Statistics output file path. | |
| std::vector< std::string > | ThinLTOModulesToCompile |
| Specific thinLTO modules to compile. | |
| bool | TimeTraceEnabled = false |
| Time trace enabled. | |
| unsigned | TimeTraceGranularity = 500 |
| Time trace granularity. | |
| bool | ShouldDiscardValueNames = true |
| DiagnosticHandlerFunction | DiagHandler |
| bool | AddFSDiscriminator = false |
| Add FSAFDO discriminators. | |
| 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. | |
| PipelineTuningOptions | PTO |
| Tunable parameters for passes in the default pipelines. | |
| ModuleHookFn | PreOptModuleHook |
| This module hook is called after linking (regular LTO) or loading (ThinLTO) the module, before modifying it. | |
| ModuleHookFn | PostPromoteModuleHook |
| This hook is called after promoting any internal functions (ThinLTO-specific). | |
| ModuleHookFn | PostInternalizeModuleHook |
| This hook is called after internalizing the module. | |
| ModuleHookFn | PostImportModuleHook |
| This hook is called after importing from other modules (ThinLTO-specific). | |
| ModuleHookFn | PostOptModuleHook |
| This module hook is called after optimization is complete. | |
| ModuleHookFn | PreCodeGenModuleHook |
| This module hook is called before code generation. | |
| CombinedIndexHookFn | CombinedIndexHook |
LTO configuration.
A linker can configure LTO by setting fields in this data structure and passing it to the lto::LTO constructor.
Definition at line 42 of file Config.h.
◆ CombinedIndexHookFn
Initial value:
std::function<bool(
Implements a dense probed hash-table based set.
Class to hold module path string table and global value map, and encapsulate methods for operating on...
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.
Definition at line 263 of file Config.h.
◆ 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.
Definition at line 230 of file Config.h.
◆ VisScheme
| Enumerator |
|---|
| FromPrevailing |
| ELF |
Definition at line 43 of file Config.h.
◆ addSaveTemps()
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.
SaveTempsArgs can be specified to select which temps to save. If SaveTempsArgs is not provided, all temps are saved.
Definition at line 87 of file LTOBackend.cpp.
References CombinedIndexHook, llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::contains(), llvm::detail::DenseSetImpl< ValueT, MapTy, ValueInfoT >::empty(), llvm::errorCodeToError(), llvm::sys::fs::OF_None, llvm::sys::fs::OF_Text, llvm::sys::fs::OF_TextWithCRLF, PostImportModuleHook, PostInternalizeModuleHook, PostOptModuleHook, PostPromoteModuleHook, PreCodeGenModuleHook, PreOptModuleHook, reportOpenError(), ResolutionFile, ShouldDiscardValueNames, llvm::Error::success(), llvm::utostr(), llvm::WriteBitcodeToFile(), and llvm::writeIndexToFile().
◆ AAPipeline
std::string llvm::lto::Config::AAPipeline
◆ AddFSDiscriminator
bool llvm::lto::Config::AddFSDiscriminator = false
◆ AllVtablesHaveTypeInfos
bool llvm::lto::Config::AllVtablesHaveTypeInfos = false
If all native vtables have corresponding type infos, allow usage of RTTI to block devirtualization on types used in native files.
Definition at line 85 of file Config.h.
◆ AlwaysEmitRegularLTOObj
bool llvm::lto::Config::AlwaysEmitRegularLTOObj = false
Always emit a Regular LTO object even when it is empty because no Regular LTO modules were linked.
This option is useful for some build system which want to know a priori all possible output files.
Definition at line 90 of file Config.h.
◆ CGFileType
◆ CGOptLevel
◆ CodeGenOnly
bool llvm::lto::Config::CodeGenOnly = false
Disable entirely the optimizer, including importing for ThinLTO.
Definition at line 69 of file Config.h.
◆ CodeModel
◆ CombinedIndexHook
CombinedIndexHookFn llvm::lto::Config::CombinedIndexHook
◆ CPU
std::string llvm::lto::Config::CPU
◆ CSIRProfile
std::string llvm::lto::Config::CSIRProfile
◆ DebugPassManager
bool llvm::lto::Config::DebugPassManager = false
◆ DefaultTriple
std::string llvm::lto::Config::DefaultTriple
◆ DiagHandler
◆ DisableVerify
bool llvm::lto::Config::DisableVerify = false
◆ Dtlto
| bool llvm::lto::Config::Dtlto = 0 | mutable |
|---|
This flag is used as one of parameters to calculate cache entries and to ensure that in-process cache and out-of-process (DTLTO) cache are distinguished.
Definition at line 100 of file Config.h.
Referenced by llvm::computeLTOCacheKey().
◆ DwoDir
std::string llvm::lto::Config::DwoDir
◆ Freestanding
bool llvm::lto::Config::Freestanding = false
◆ HasWholeProgramVisibility
bool llvm::lto::Config::HasWholeProgramVisibility = false
Asserts whether we can assume whole program visibility during the LTO link.
Definition at line 79 of file Config.h.
◆ KeepSymbolNameCopies
bool llvm::lto::Config::KeepSymbolNameCopies = true
If true, the LTO instance creates copies of the symbol names for LTO::run.
The lld linker uses string saver to keep symbol names alive and doesn't need to create copies, so it can set this field to false.
Definition at line 95 of file Config.h.
◆ MAttrs
std::vectorstd::string llvm::lto::Config::MAttrs
◆ MllvmArgs
std::vectorstd::string llvm::lto::Config::MllvmArgs
◆ Options
◆ OptLevel
unsigned llvm::lto::Config::OptLevel = 2
◆ OptPipeline
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 111 of file Config.h.
Referenced by llvm::computeLTOCacheKey(), and runNewPMPasses().
◆ OverrideTriple
std::string llvm::lto::Config::OverrideTriple
◆ PassPlugins
std::vectorstd::string llvm::lto::Config::PassPlugins
◆ PGOWarnMismatch
bool llvm::lto::Config::PGOWarnMismatch = true
Turn on/off the warning about a hash mismatch in the PGO profile data.
Definition at line 75 of file Config.h.
Referenced by runNewPMPasses().
◆ PostImportModuleHook
ModuleHookFn llvm::lto::Config::PostImportModuleHook
◆ PostInternalizeModuleHook
ModuleHookFn llvm::lto::Config::PostInternalizeModuleHook
◆ PostOptModuleHook
ModuleHookFn llvm::lto::Config::PostOptModuleHook
◆ PostPromoteModuleHook
ModuleHookFn llvm::lto::Config::PostPromoteModuleHook
◆ PreCodeGenModuleHook
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 252 of file Config.h.
Referenced by addSaveTemps(), and codegen().
◆ PreCodeGenPassesHook
For adding passes that run right before codegen.
Definition at line 55 of file Config.h.
Referenced by codegen().
◆ PreOptModuleHook
ModuleHookFn llvm::lto::Config::PreOptModuleHook
◆ ProfileRemapping
std::string llvm::lto::Config::ProfileRemapping
◆ PTO
◆ RelocModel
◆ RemarksFilename
std::string llvm::lto::Config::RemarksFilename
◆ RemarksFormat
std::string llvm::lto::Config::RemarksFormat
◆ RemarksHotnessThreshold
std::optional<uint64_t> llvm::lto::Config::RemarksHotnessThreshold = 0
The minimum hotness value a diagnostic needs in order to be included in optimization diagnostics.
The threshold is an Optional value, which maps to one of the 3 states:
- 0 => threshold disabled. All emarks will be printed.
- positive int => manual threshold by user. Remarks with hotness exceed threshold will be printed.
- None => 'auto' threshold by user. The actual value is not available at command line, but will be synced with hotness threhold from profile summary during compilation.
If threshold option is not specified, it is disabled by default.
Definition at line 171 of file Config.h.
Referenced by llvm::lto::thinBackend().
◆ RemarksPasses
std::string llvm::lto::Config::RemarksPasses
◆ RemarksWithHotness
bool llvm::lto::Config::RemarksWithHotness = false
◆ ResolutionFile
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 201 of file Config.h.
Referenced by addSaveTemps().
◆ RunCSIRInstr
bool llvm::lto::Config::RunCSIRInstr = false
◆ SampleProfile
std::string llvm::lto::Config::SampleProfile
◆ ShouldDiscardValueNames
bool llvm::lto::Config::ShouldDiscardValueNames = true
◆ SplitDwarfFile
std::string llvm::lto::Config::SplitDwarfFile
The name for the split debug info file used for the DW_AT_[GNU_]dwo_name attribute in the skeleton CU.
This should generally only be used when running an individual backend directly via thinBackend(), as otherwise all objects would use the same .dwo file. Not used as output path.
Definition at line 142 of file Config.h.
Referenced by codegen().
◆ SplitDwarfOutput
std::string llvm::lto::Config::SplitDwarfOutput
The path to write a .dwo file to.
This should generally only be used when running an individual backend directly via thinBackend(), as otherwise all .dwo files will be written to the same path. Not used in skeleton CU.
Definition at line 147 of file Config.h.
Referenced by codegen().
◆ StatsFile
std::string llvm::lto::Config::StatsFile
Statistics output file path.
Definition at line 180 of file Config.h.
◆ ThinLTOModulesToCompile
std::vectorstd::string llvm::lto::Config::ThinLTOModulesToCompile
Specific thinLTO modules to compile.
Definition at line 183 of file Config.h.
◆ TimeTraceEnabled
bool llvm::lto::Config::TimeTraceEnabled = false
Time trace enabled.
Definition at line 186 of file Config.h.
◆ TimeTraceGranularity
unsigned llvm::lto::Config::TimeTraceGranularity = 500
Time trace granularity.
Definition at line 189 of file Config.h.
◆ ValidateAllVtablesHaveTypeInfos
bool llvm::lto::Config::ValidateAllVtablesHaveTypeInfos = false
We're validating that all native vtables have corresponding type infos.
Definition at line 82 of file Config.h.
◆ VerifyEach
bool llvm::lto::Config::VerifyEach = false
◆ VisibilityScheme
VisScheme llvm::lto::Config::VisibilityScheme = FromPrevailing
Allows non-imported definitions to get the potentially more constraining visibility from the prevailing definition.
FromPrevailing is the default because it works for many binary formats. ELF can use the more optimized 'ELF' scheme.
Definition at line 106 of file Config.h.
The documentation for this struct was generated from the following files:
- include/llvm/LTO/Config.h
- lib/LTO/LTOBackend.cpp