pub struct PgoPass {
pub config: PgoConfig,
pub profile: ProfileData,
}Expand description
The profile-guided optimisation pass.
Consumes a ProfileData snapshot and a PgoConfig, then answers
per-site queries such as “should I inline this callee?” and produces a
bulk OptAction recommendation list via PgoPass::optimize_call_sites.
Fields§
§config: PgoConfig§profile: ProfileDataImplementations§
Source§impl PgoPass
impl PgoPass
Sourcepub fn new(config: PgoConfig) -> Self
pub fn new(config: PgoConfig) -> Self
Create a new PgoPass with the given configuration and an empty
profile.
Sourcepub fn load_profile(&mut self, data: ProfileData)
pub fn load_profile(&mut self, data: ProfileData)
Replace the current profile with data.
Sourcepub fn should_inline(&self, func_name: &str, size_estimate: usize) -> bool
pub fn should_inline(&self, func_name: &str, size_estimate: usize) -> bool
Return true when func_name should be inlined at a call site whose
callee has an estimated IR size of size_estimate nodes.
Inlining is enabled when:
config.inline_hotis set, ANDfunc_nameis hot (exceeds the threshold), ANDsize_estimate <= config.max_inline_size.
Sourcepub fn should_specialize(&self, func_name: &str) -> bool
pub fn should_specialize(&self, func_name: &str) -> bool
Return true when a specialised clone of func_name should be
generated.
Specialisation is enabled when:
config.specialize_hotis set, ANDfunc_nameis hot.
Sourcepub fn optimize_call_sites(
&self,
functions: &[(String, usize)],
) -> Vec<OptAction>
pub fn optimize_call_sites( &self, functions: &[(String, usize)], ) -> Vec<OptAction>
Produce a list of OptAction recommendations for a collection of
(function_name, size_estimate) pairs representing call sites.
The index of each entry in functions is used as the call_site
discriminant for Specialize actions.