pub struct Context {
    pub func: Function,
    pub cfg: ControlFlowGraph,
    pub domtree: DominatorTree,
    pub loop_analysis: LoopAnalysis,
    pub want_disasm: bool,
    /* private fields */
}
Expand description

Persistent data structures and compilation pipeline.

Fields

func: Function

The function we’re compiling.

cfg: ControlFlowGraph

The control flow graph of func.

domtree: DominatorTree

Dominator tree for func.

loop_analysis: LoopAnalysis

Loop analysis of func.

want_disasm: bool

Flag: do we want a disassembly with the CompiledCode?

Implementations

Allocate a new compilation context.

The returned instance should be reused for compiling multiple functions in order to avoid needless allocator thrashing.

Allocate a new compilation context with an existing Function.

The returned instance should be reused for compiling multiple functions in order to avoid needless allocator thrashing.

Clear all data structures in this context.

Returns the compilation result for this function, available after any compile function has been called.

Set the flag to request a disassembly when compiling with a MachBackend backend.

Compile the function, and emit machine code into a Vec<u8>.

Run the function through all the passes necessary to generate code for the target ISA represented by isa, as well as the final step of emitting machine code into a Vec<u8>. The machine code is not relocated. Instead, any relocations can be obtained from compiled_code().

This function calls compile, taking care to resize mem as needed, so it provides a safe interface.

Returns information about the function’s code and read-only data.

Internally compiles the function into a stencil.

Public only for testing and fuzzing purposes.

Compile the function.

Run the function through all the passes necessary to generate code for the target ISA represented by isa. This does not include the final step of emitting machine code into a code sink.

Returns information about the function’s code and read-only data.

If available, return information about the code layout in the final machine code: the offsets (in bytes) of each basic-block start, and all basic-block edges.

Creates unwind information for the function.

Returns None if the function has no unwind information.

Run the verifier on the function.

Also check that the dominator tree and control flow graph are consistent with the function.

Run the verifier only if the enable_verifier setting is true.

Perform dead-code elimination on the function.

Perform constant-phi removal on the function.

Perform pre-legalization rewrites on the function.

Perform NaN canonicalizing rewrites on the function.

Run the legalizer for isa on the function.

Compute the control flow graph.

Compute dominator tree.

Compute the loop analysis.

Compute the control flow graph and dominator tree.

Perform simple GVN on the function.

Perform LICM on the function.

Perform unreachable code elimination.

Replace all redundant loads with the known values in memory. These are loads whose values were already loaded by other loads earlier, as well as loads whose values were stored by a store instruction to the same instruction (so-called “store-to-load forwarding”).

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.