tenferro_runtime/compiler/
options.rs1use std::collections::hash_map::DefaultHasher;
2use std::hash::{Hash, Hasher};
3
4#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
5pub struct CompilerOptions {
6 pub optimizer: OptimizerConfig,
7}
8
9#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
10pub struct OptimizerConfig {
11 pub algebraic_layout_simplifier: bool,
12 pub dot_decomposer: bool,
13}
14
15impl OptimizerConfig {
16 pub const VERSION: u64 = 2;
17
18 pub fn fingerprint(self) -> u64 {
19 let mut hasher = DefaultHasher::new();
20 Self::VERSION.hash(&mut hasher);
21 self.hash(&mut hasher);
22 hasher.finish()
23 }
24}
25
26impl Default for OptimizerConfig {
27 fn default() -> Self {
28 Self {
29 algebraic_layout_simplifier: true,
30 dot_decomposer: false,
31 }
32 }
33}