@@ -34,6 +34,13 @@ enum wasmtime_strategy_enum { // Strategy
3434 /// Indicates that Wasmtime will unconditionally use Cranelift to compile
3535 /// WebAssembly code.
3636 WASMTIME_STRATEGY_CRANELIFT ,
37+
38+ /// Indicates that Wasmtime will unconditionally use Winch to compile
39+ /// WebAssembly code.
40+ //
41+ /// For more details regarding ISA support and Wasm proposals support
42+ /// see <https://docs.wasmtime.dev/stability-tiers.html#current-tier-status>
43+ WASMTIME_STRATEGY_WINCH ,
3744};
3845
3946/**
@@ -87,6 +94,39 @@ enum wasmtime_profiling_strategy_enum { // ProfilingStrategy
8794 WASMTIME_PROFILING_STRATEGY_PERFMAP ,
8895};
8996
97+ /**
98+ * \brief Different ways Cranelift can allocate registers
99+ *
100+ * See #wasmtime_regalloc_algorithm_enum for possible values.
101+ */
102+ typedef uint8_t wasmtime_regalloc_algorithm_t ;
103+
104+ /**
105+ * \brief Different ways to allocate registers.
106+ *
107+ * The default is #WASMTIME_REGALLOC_BACKTRACKING.
108+ */
109+ enum wasmtime_regalloc_algorithm_enum { // RegallocAlgorithm
110+ /// Generates the fastest possible code, but may take longer.
111+ ///
112+ /// This algorithm performs “backtracking”, which means that it may undo
113+ /// its earlier work and retry as it discovers conflicts. This results
114+ /// in better register utilization, producing fewer spills and moves,
115+ /// but can cause super-linear compile runtime.
116+ WASMTIME_REGALLOC_BACKTRACKING ,
117+ /// Generates acceptable code very quickly.
118+ ///
119+ /// This algorithm performs a single pass through the code, guaranteed to work
120+ /// in linear time.
121+ /// (Note that the rest of Cranelift is not necessarily guaranteed to run in
122+ /// linear time, however.)
123+ /// It cannot undo earlier decisions, however, and it cannot foresee
124+ /// constraints or issues that may
125+ /// occur further ahead in the code, so the code may have more spills and
126+ /// moves as a result.
127+ WASMTIME_REGALLOC_SINGLE_PASS ,
128+ };
129+
90130#define WASMTIME_CONFIG_PROP (ret , name , ty ) \
91131 WASM_API_EXTERN ret wasmtime_config_##name##_set(wasm_config_t *, ty);
92132
@@ -342,6 +382,15 @@ WASMTIME_CONFIG_PROP(void, cranelift_nan_canonicalization, bool)
342382 */
343383WASMTIME_CONFIG_PROP (void , cranelift_opt_level , wasmtime_opt_level_t )
344384
385+ /**
386+ * \brief Configures the regalloc algorithm used by the Cranelift code
387+ * generator.
388+ *
389+ * This setting in #WASMTIME_REGALLOC_BACKTRACKING by default.
390+ */
391+ WASMTIME_CONFIG_PROP (void , cranelift_regalloc_algorithm ,
392+ wasmtime_regalloc_algorithm_t )
393+
345394#endif // WASMTIME_FEATURE_COMPILER
346395
347396/**
0 commit comments