| 1 | use crate::cdsl::settings::{SettingGroup, SettingGroupBuilder}; |
| 2 | |
| 3 | pub(crate) fn define() -> SettingGroup { |
| 4 | let mut settings = SettingGroupBuilder::new("shared"); |
| 5 | |
| 6 | settings.add_bool( |
| 7 | "regalloc_checker", |
| 8 | "Enable the symbolic checker for register allocation.", |
| 9 | r#" |
| 10 | This performs a verification that the register allocator preserves |
| 11 | equivalent dataflow with respect to the original (pre-regalloc) |
| 12 | program. This analysis is somewhat expensive. However, if it succeeds, |
| 13 | it provides independent evidence (by a carefully-reviewed, from-first-principles |
| 14 | analysis) that no regalloc bugs were triggered for the particular compilations |
| 15 | performed. This is a valuable assurance to have as regalloc bugs can be |
| 16 | very dangerous and difficult to debug. |
| 17 | "#, |
| 18 | false, |
| 19 | ); |
| 20 | |
| 21 | settings.add_bool( |
| 22 | "regalloc_verbose_logs", |
| 23 | "Enable verbose debug logs for regalloc2.", |
| 24 | r#" |
| 25 | This adds extra logging for regalloc2 output, that is quite valuable to understand |
| 26 | decisions taken by the register allocator as well as debugging it. It is disabled by |
| 27 | default, as it can cause many log calls which can slow down compilation by a large |
| 28 | amount. |
| 29 | "#, |
| 30 | false, |
| 31 | ); |
| 32 | |
| 33 | settings.add_enum( |
| 34 | "regalloc_algorithm", |
| 35 | "Algorithm to use in register allocator.", |
| 36 | r#" |
| 37 | Supported options: |
| 38 | |
| 39 | - `backtracking`: A backtracking allocator with range splitting; more expensive |
| 40 | but generates better code. |
| 41 | - `single_pass`: A single-pass algorithm that yields quick compilation but |
| 42 | results in code with more register spills and moves. |
| 43 | "#, |
| 44 | vec!["backtracking", "single_pass"], |
| 45 | ); |
| 46 | |
| 47 | settings.add_enum( |
| 48 | "opt_level", |
| 49 | "Optimization level for generated code.", |
| 50 | r#" |
| 51 | Supported levels: |
| 52 | |
| 53 | - `none`: Minimise compile time by disabling most optimizations. |
| 54 | - `speed`: Generate the fastest possible code |
| 55 | - `speed_and_size`: like "speed", but also perform transformations aimed at reducing code size. |
| 56 | "#, |
| 57 | vec!["none", "speed", "speed_and_size"], |
| 58 | ); |
| 59 | |
| 60 | settings.add_bool( |