Add some documentation
This commit is contained in:
parent
ff38b37769
commit
69102dbcf7
3 changed files with 20 additions and 0 deletions
|
|
@ -5,10 +5,14 @@ fn bool_env_var(key: &str) -> bool {
|
|||
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,
|
||||
}
|
||||
|
||||
|
|
@ -25,6 +29,7 @@ impl FromStr for CodegenMode {
|
|||
}
|
||||
}
|
||||
|
||||
/// 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.
|
||||
|
|
@ -76,6 +81,7 @@ impl Default for BackendConfig {
|
|||
}
|
||||
|
||||
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))
|
||||
|
|
|
|||
|
|
@ -119,6 +119,8 @@ impl<F: Fn() -> String> Drop for PrintOnPanic<F> {
|
|||
}
|
||||
}
|
||||
|
||||
/// The codegen context holds any information shared between the codegen of individual functions
|
||||
/// inside a single codegen unit with the exception of the Cranelift [`Module`](cranelift_module::Module).
|
||||
struct CodegenCx<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
global_asm: String,
|
||||
|
|
|
|||
|
|
@ -14,6 +14,18 @@ use rustc_target::spec::Target;
|
|||
|
||||
use crate::backend::WriteMetadata;
|
||||
|
||||
/// The metadata loader used by cg_clif.
|
||||
///
|
||||
/// The metadata is stored in the same format as cg_llvm.
|
||||
///
|
||||
/// # Metadata location
|
||||
///
|
||||
/// <dl>
|
||||
/// <dt>rlib</dt>
|
||||
/// <dd>The metadata can be found in the `lib.rmeta` file inside of the ar archive.</dd>
|
||||
/// <dt>dylib</dt>
|
||||
/// <dd>The metadata can be found in the `.rustc` section of the shared library.</dd>
|
||||
/// </dl>
|
||||
pub(crate) struct CraneliftMetadataLoader;
|
||||
|
||||
fn load_metadata_with(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue