enable -> disable

This commit is contained in:
damirka 2021-03-30 20:32:52 +03:00
parent c56c179037
commit ef8f11bc64

View File

@ -37,27 +37,27 @@ use tracing::span::Span;
/// require Build command output as their input. /// require Build command output as their input.
#[derive(StructOpt, Clone, Debug)] #[derive(StructOpt, Clone, Debug)]
pub struct BuildOptions { pub struct BuildOptions {
#[structopt(long, help = "Enable constant folding compiler optimization")] #[structopt(long, help = "Disable constant folding compiler optimization")]
pub constant_folding_enabled: bool, pub disable_constant_folding: bool,
#[structopt(long, help = "Enable dead code elimination compiler optimization")] #[structopt(long, help = "Disable dead code elimination compiler optimization")]
pub dead_code_elimination_enabled: bool, pub disable_code_elimination: bool,
#[structopt(long, help = "Enable all compiler optimizations")] #[structopt(long, help = "Disable all compiler optimizations")]
pub enable_all_optimizations: bool, pub disable_all_optimizations: bool,
} }
impl Default for BuildOptions { impl Default for BuildOptions {
fn default() -> Self { fn default() -> Self {
Self { Self {
constant_folding_enabled: true, disable_constant_folding: true,
dead_code_elimination_enabled: true, disable_code_elimination: true,
enable_all_optimizations: true, disable_all_optimizations: true,
} }
} }
} }
impl Into<CompilerOptions> for BuildOptions { impl Into<CompilerOptions> for BuildOptions {
fn into(self) -> CompilerOptions { fn into(self) -> CompilerOptions {
if self.enable_all_optimizations { if self.disable_all_optimizations {
CompilerOptions { CompilerOptions {
canonicalization_enabled: true, canonicalization_enabled: true,
constant_folding_enabled: true, constant_folding_enabled: true,
@ -66,8 +66,8 @@ impl Into<CompilerOptions> for BuildOptions {
} else { } else {
CompilerOptions { CompilerOptions {
canonicalization_enabled: true, canonicalization_enabled: true,
constant_folding_enabled: self.constant_folding_enabled, constant_folding_enabled: !self.disable_constant_folding,
dead_code_elimination_enabled: self.dead_code_elimination_enabled, dead_code_elimination_enabled: !self.disable_code_elimination,
} }
} }
} }