@@ -48,6 +48,12 @@ pub struct BackendConfig {
48
48
/// Can be set using `-Cllvm-args=display_cg_time=...`.
49
49
pub display_cg_time : bool ,
50
50
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
+
51
57
/// Enable the Cranelift ir verifier for all compilation passes. If not set it will only run
52
58
/// once before passing the clif ir to Cranelift for compilation.
53
59
///
@@ -74,6 +80,8 @@ impl Default for BackendConfig {
74
80
args. split ( ' ' ) . map ( |arg| arg. to_string ( ) ) . collect ( )
75
81
} ,
76
82
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 ( ) ) ,
77
85
enable_verifier : cfg ! ( debug_assertions) || bool_env_var ( "CG_CLIF_ENABLE_VERIFIER" ) ,
78
86
disable_incr_cache : bool_env_var ( "CG_CLIF_DISABLE_INCR_CACHE" ) ,
79
87
}
@@ -93,6 +101,7 @@ impl BackendConfig {
93
101
match name {
94
102
"mode" => config. codegen_mode = value. parse ( ) ?,
95
103
"display_cg_time" => config. display_cg_time = parse_bool ( name, value) ?,
104
+ "regalloc" => config. regalloc = value. to_string ( ) ,
96
105
"enable_verifier" => config. enable_verifier = parse_bool ( name, value) ?,
97
106
"disable_incr_cache" => config. disable_incr_cache = parse_bool ( name, value) ?,
98
107
_ => return Err ( format ! ( "Unknown option `{}`" , name) ) ,
0 commit comments