@@ -48,6 +48,12 @@ pub struct BackendConfig {
4848 /// Can be set using `-Cllvm-args=display_cg_time=...`.
4949 pub display_cg_time : bool ,
5050
51+ /// The register allocator to use.
52+ ///
53+ /// Defaults to the value of `CG_CLIF_REGALLOC` or `backtracking` otherwise. Can be set using
54+ /// `-Cllvm-args=regalloc=...`.
55+ pub regalloc : String ,
56+
5157 /// Enable the Cranelift ir verifier for all compilation passes. If not set it will only run
5258 /// once before passing the clif ir to Cranelift for compilation.
5359 ///
@@ -74,6 +80,8 @@ impl Default for BackendConfig {
7480 args. split ( ' ' ) . map ( |arg| arg. to_string ( ) ) . collect ( )
7581 } ,
7682 display_cg_time : bool_env_var ( "CG_CLIF_DISPLAY_CG_TIME" ) ,
83+ regalloc : std:: env:: var ( "CG_CLIF_REGALLOC" )
84+ . unwrap_or_else ( |_| "backtracking" . to_string ( ) ) ,
7785 enable_verifier : cfg ! ( debug_assertions) || bool_env_var ( "CG_CLIF_ENABLE_VERIFIER" ) ,
7886 disable_incr_cache : bool_env_var ( "CG_CLIF_DISABLE_INCR_CACHE" ) ,
7987 }
@@ -93,6 +101,7 @@ impl BackendConfig {
93101 match name {
94102 "mode" => config. codegen_mode = value. parse ( ) ?,
95103 "display_cg_time" => config. display_cg_time = parse_bool ( name, value) ?,
104+ "regalloc" => config. regalloc = value. to_string ( ) ,
96105 "enable_verifier" => config. enable_verifier = parse_bool ( name, value) ?,
97106 "disable_incr_cache" => config. disable_incr_cache = parse_bool ( name, value) ?,
98107 _ => return Err ( format ! ( "Unknown option `{}`" , name) ) ,
0 commit comments