Crate cranelift_codegen

source ·
Expand description

Cranelift code generation library.

Re-exports§

Modules§

  • Binary machine code emission.
  • The CFGPrinter utility.
  • Cursor library.
  • This module gives users to instantiate values that Cranelift understands. These values are used, for example, during interpretation and for wrapping immediates.
  • Debug tracing helpers.
  • A Dominator Tree represented as mappings of Blocks to their immediate dominator.
  • A control flow graph represented as mappings of basic blocks to their predecessors and successors.
  • Representation of Cranelift IR functions.
  • Instruction Set Architectures.
  • A loop analysis represented as mappings of loops to their header Block and parent in the loop tree.
  • Compact representation of Option<T> for types with a reserved value.
  • Utility routines for pretty-printing error messages.
  • Shared settings module.
  • Pass timing.
  • A verifier for ensuring that functions are well formed. It verifies:
  • Converting Cranelift IR to text.

Macros§

  • Even when trace logging is disabled, the trace macro has a significant performance cost so we disable it by default.

Structs§

  • Compilation error, with the accompanying function to help printing it.
  • Persistent data structures and compilation pipeline.
  • Status of a compiled artifact ready to use.
  • A buffer of output to be produced, fixed up, and then emitted to a CodeSink in bulk.
  • A MachBuffer once emission is completed: holds generated code and records, without fixups. This allows the type to be independent of the backend.
  • A call site record resulting from a compilation.
  • A label refers to some offset in a MachBuffer. It may not be resolved at the point at which it is used by emitted code; the buffer records “fixups” for references to the label, and will come back and patch the code appropriately when the label’s location is eventually known.
  • A source-location mapping resulting from a compilation.
  • Record of stack map metadata: stack offsets containing references.
  • Implementation of the TextSectionBuilder trait backed by MachBuffer.
  • A trap record resulting from a compilation.
  • A register named in an instruction. This register can be either a virtual register or a fixed physical register. It does not have any constraints applied to it: those can be added later in MachInst::get_operands() when the Regs are converted to Operands.
  • This structure tracks the large constants used in VCode that will be emitted separately by the MachBuffer.
  • Value location range.
  • A type wrapper that indicates a register type is writable. The underlying register can be extracted, and the type wrapper can be built using an arbitrary register. Hence, this type-level wrapper is not strictly a guarantee. However, “casting” to a writable register is an explicit operation for which we can audit. Ordinarily, internal APIs in the compiler backend should take a Writable<Reg> whenever the register is written, and the usual, frictionless way to get one of these is to allocate a new temporary.

Enums§

Constants§

  • Version number of this crate.

Traits§

  • A machine instruction.
  • A trait describing the ability to encode a MachInst into binary machine code.
  • A trait describing the emission state carried between MachInsts when emitting a function body.
  • An object that can be used to create the text section of an executable.

Type Aliases§

  • A convenient alias for a Result that uses CodegenError as the error type.
  • CompiledCode in its final form (i.e. after FunctionParameters have been applied), ready for consumption.
  • A relocation resulting from a compilation.
  • Resulting map of Value labels and their ranges/locations.