Skip to main content

bootstrap/core/config/toml/
pgo.rs

1//! This module defines the `Pgo` struct, which represents the `[pgo]` table
2//! in the `bootstrap.toml` configuration file.
3//!
4//! The `[pgo]` table contains options related PGO (Profile-Guided Optimization) of various
5//! components built by bootstrap.
6
7use std::path::PathBuf;
8
9use crate::core::config::macros::define_config;
10
11#[derive(Clone, Default, Debug, serde_derive::Deserialize)]
12#[serde(deny_unknown_fields)]
13pub struct PgoConfig {
14    /// Use the given PGO profile to optimize a component.
15    #[serde(default, rename = "use")]
16    pub use_profile: Option<PathBuf>,
17    /// Build a component with PGO instrumentation. Once executed, the profiles will be stored
18    /// into this path.
19    #[serde(default, rename = "generate")]
20    pub generate_profile: Option<PathBuf>,
21}
22
23define_config! {
24    #[derive(Default)]
25    struct Pgo {
26        rustc: Option<PgoConfig> = "rustc",
27        rustdoc: Option<PgoConfig> = "rustdoc",
28        cargo: Option<PgoConfig> = "cargo",
29        llvm: Option<PgoConfig> = "llvm",
30    }
31}