#[derive(Debug, Clone, PartialEq, Eq)]
pub struct CanonicalizeConfig {
round_limit: u8,
recurse_control_flow: bool,
fold_gphase: bool,
canonicalize_instruction_form: bool,
drop_noops: bool,
canonicalize_barriers: bool,
}
impl Default for CanonicalizeConfig {
fn default() -> Self {
Self::production()
}
}
impl CanonicalizeConfig {
pub const fn production() -> Self {
Self {
round_limit: 8,
recurse_control_flow: true,
fold_gphase: true,
canonicalize_instruction_form: true,
drop_noops: true,
canonicalize_barriers: true,
}
}
pub const fn new() -> Self {
Self::production()
}
pub const fn with_round_limit(mut self, round_limit: u8) -> Self {
self.round_limit = round_limit;
self
}
pub const fn recurse_control_flow(mut self, enabled: bool) -> Self {
self.recurse_control_flow = enabled;
self
}
pub const fn fold_gphase(mut self, enabled: bool) -> Self {
self.fold_gphase = enabled;
self
}
pub const fn canonicalize_instruction_form(mut self, enabled: bool) -> Self {
self.canonicalize_instruction_form = enabled;
self
}
pub const fn drop_noops(mut self, enabled: bool) -> Self {
self.drop_noops = enabled;
self
}
pub const fn canonicalize_barriers(mut self, enabled: bool) -> Self {
self.canonicalize_barriers = enabled;
self
}
pub const fn round_limit(&self) -> u8 {
self.round_limit
}
pub const fn recurses_control_flow(&self) -> bool {
self.recurse_control_flow
}
pub const fn folds_gphase(&self) -> bool {
self.fold_gphase
}
pub const fn canonicalizes_instruction_form(&self) -> bool {
self.canonicalize_instruction_form
}
pub const fn drops_noops(&self) -> bool {
self.drop_noops
}
pub const fn canonicalizes_barriers(&self) -> bool {
self.canonicalize_barriers
}
}