Module cranelift_codegen::isa [−][src]
Instruction Set Architectures.
The isa
module provides a TargetIsa
trait which provides the behavior specialization needed
by the ISA-independent code generator. The sub-modules of this module provide definitions for
the instruction sets that Cranelift can target. Each sub-module has it's own implementation of
TargetIsa
.
Constructing a TargetIsa
instance
The target ISA is built from the following information:
- The name of the target ISA as a string. Cranelift is a cross-compiler, so the ISA to target can be selected dynamically. Individual ISAs can be left out when Cranelift is compiled, so a string is used to identify the proper sub-module.
- Values for settings that apply to all ISAs. This is represented by a
settings::Flags
instance. - Values for ISA-specific settings.
The isa::lookup()
function is the main entry point which returns an isa::Builder
appropriate for the requested ISA:
use cranelift_codegen::settings::{self, Configurable}; use cranelift_codegen::isa; use std::str::FromStr; use target_lexicon::Triple; let shared_builder = settings::builder(); let shared_flags = settings::Flags::new(shared_builder); match isa::lookup(triple!("riscv32")) { Err(_) => { // The RISC-V target ISA is not available. } Ok(mut isa_builder) => { isa_builder.set("supports_m", "on"); let isa = isa_builder.finish(shared_flags); } }
The configured target ISA trait object is a Box<TargetIsa>
which can be used for multiple
concurrent function compilations.
Re-exports
pub use isa::registers::regs_overlap; |
pub use isa::registers::RegClass; |
pub use isa::registers::RegClassIndex; |
pub use isa::registers::RegInfo; |
pub use isa::registers::RegUnit; |
Modules
registers |
Data structures describing the registers in an ISA. |
Structs
BranchRange |
Constraints on the range of a branch instruction. |
Builder |
Builder for a |
EncInfo |
Information about all the encodings in this ISA. |
Encoding |
Bits needed to encode an instruction as binary machine code. |
OperandConstraint |
Register constraint for a single value operand or instruction result. |
RecipeConstraints |
Value operand constraints for an encoding recipe. |
StackBaseMask |
Bit mask of supported stack bases. |
StackRef |
A method for referencing a stack slot in the current stack frame. |
Enums
ConstraintKind |
The different kinds of operand constraints. |
LookupError |
Describes reason for target lookup failure |
StackBase |
Generic base register for referencing stack slots. |
Traits
TargetIsa |
Methods that are specialized to a target ISA. Implies a Display trait that shows the shared flags, as well as any isa-specific flags. |
Functions
lookup |
Look for a supported ISA with the given |
Type Definitions
Legalize |
After determining that an instruction doesn't have an encoding, how should we proceed to legalize it? |