File tree 3 files changed +20
-0
lines changed
3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,14 @@ fn bool_env_var(key: &str) -> bool {
5
5
env:: var ( key) . as_ref ( ) . map ( |val| & * * val) == Ok ( "1" )
6
6
}
7
7
8
+ /// The mode to use for compilation.
8
9
#[ derive( Copy , Clone , Debug ) ]
9
10
pub enum CodegenMode {
11
+ /// AOT compile the crate. This is the default.
10
12
Aot ,
13
+ /// JIT compile and execute the crate.
11
14
Jit ,
15
+ /// JIT compile and execute the crate, but only compile functions the first time they are used.
12
16
JitLazy ,
13
17
}
14
18
@@ -25,6 +29,7 @@ impl FromStr for CodegenMode {
25
29
}
26
30
}
27
31
32
+ /// Configuration of cg_clif as passed in through `-Cllvm-args` and various env vars.
28
33
#[ derive( Clone , Debug ) ]
29
34
pub struct BackendConfig {
30
35
/// Should the crate be AOT compiled or JIT executed.
@@ -76,6 +81,7 @@ impl Default for BackendConfig {
76
81
}
77
82
78
83
impl BackendConfig {
84
+ /// Parse the configuration passed in using `-Cllvm-args`.
79
85
pub fn from_opts ( opts : & [ String ] ) -> Result < Self , String > {
80
86
fn parse_bool ( name : & str , value : & str ) -> Result < bool , String > {
81
87
value. parse ( ) . map_err ( |_| format ! ( "failed to parse value `{}` for {}" , value, name) )
Original file line number Diff line number Diff line change @@ -119,6 +119,8 @@ impl<F: Fn() -> String> Drop for PrintOnPanic<F> {
119
119
}
120
120
}
121
121
122
+ /// The codegen context holds any information shared between the codegen of individual functions
123
+ /// inside a single codegen unit with the exception of the Cranelift [`Module`](cranelift_module::Module).
122
124
struct CodegenCx < ' tcx > {
123
125
tcx : TyCtxt < ' tcx > ,
124
126
global_asm : String ,
Original file line number Diff line number Diff line change @@ -14,6 +14,18 @@ use rustc_target::spec::Target;
14
14
15
15
use crate :: backend:: WriteMetadata ;
16
16
17
+ /// The metadata loader used by cg_clif.
18
+ ///
19
+ /// The metadata is stored in the same format as cg_llvm.
20
+ ///
21
+ /// # Metadata location
22
+ ///
23
+ /// <dl>
24
+ /// <dt>rlib</dt>
25
+ /// <dd>The metadata can be found in the `lib.rmeta` file inside of the ar archive.</dd>
26
+ /// <dt>dylib</dt>
27
+ /// <dd>The metadata can be found in the `.rustc` section of the shared library.</dd>
28
+ /// </dl>
17
29
pub ( crate ) struct CraneliftMetadataLoader ;
18
30
19
31
fn load_metadata_with (
You can’t perform that action at this time.
0 commit comments