env::var(key).as_ref().map(|val| &**val) == Ok("1")
}
+/// The mode to use for compilation.
#[derive(Copy, Clone, Debug)]
pub enum CodegenMode {
+ /// AOT compile the crate. This is the default.
Aot,
+ /// JIT compile and execute the crate.
Jit,
+ /// JIT compile and execute the crate, but only compile functions the first time they are used.
JitLazy,
}
}
}
+/// Configuration of cg_clif as passed in through `-Cllvm-args` and various env vars.
#[derive(Clone, Debug)]
pub struct BackendConfig {
/// Should the crate be AOT compiled or JIT executed.
}
impl BackendConfig {
+ /// Parse the configuration passed in using `-Cllvm-args`.
pub fn from_opts(opts: &[String]) -> Result<Self, String> {
fn parse_bool(name: &str, value: &str) -> Result<bool, String> {
value.parse().map_err(|_| format!("failed to parse value `{}` for {}", value, name))