Trait wasmtime_environ::isa::TargetIsa[][src]

pub trait TargetIsa: Send + Sync + Display {
    pub fn name(&self) -> &'static str;
pub fn triple(&self) -> &Triple;
pub fn flags(&self) -> &Flags;
pub fn hash_all_flags(&self, hasher: &mut dyn Hasher);
pub fn register_info(&self) -> RegInfo;
pub fn legal_encodings(
        &'a self,
        func: &'a Function,
        inst: &'a InstructionData,
        ctrl_typevar: Type
    ) -> Encodings<'a>;
pub fn encoding_info(&self) -> EncInfo;
pub fn legalize_signature(
        &self,
        sig: &mut Cow<'_, Signature>,
        current: bool
    );
pub fn regclass_for_abi_type(&self, ty: Type) -> &'static RegClassData;
pub fn allocatable_registers(&self, func: &Function) -> RegisterSet;
pub fn emit_function_to_memory(
        &self,
        func: &Function,
        sink: &mut MemoryCodeSink<'_>
    );
pub fn unsigned_add_overflow_condition(&self) -> IntCC;
pub fn unsigned_sub_overflow_condition(&self) -> IntCC;
pub fn as_any(&self) -> &(dyn Any + 'static); pub fn default_call_conv(&self) -> CallConv { ... }
pub fn endianness(&self) -> Endianness { ... }
pub fn pointer_type(&self) -> Type { ... }
pub fn pointer_width(&self) -> PointerWidth { ... }
pub fn pointer_bits(&self) -> u8 { ... }
pub fn pointer_bytes(&self) -> u8 { ... }
pub fn frontend_config(&self) -> TargetFrontendConfig { ... }
pub fn uses_cpu_flags(&self) -> bool { ... }
pub fn uses_complex_addresses(&self) -> bool { ... }
pub fn map_dwarf_register(&self, u16) -> Result<u16, RegisterMappingError> { ... }
pub fn map_regalloc_reg_to_dwarf(
        &self,
        Reg
    ) -> Result<u16, RegisterMappingError> { ... }
pub fn encode(
        &self,
        func: &Function,
        inst: &InstructionData,
        ctrl_typevar: Type
    ) -> Result<Encoding, fn(Inst, &mut Function, &mut ControlFlowGraph, &dyn TargetIsa) -> bool> { ... }
pub fn prologue_epilogue(
        &self,
        func: &mut Function
    ) -> Result<(), CodegenError> { ... }
pub fn create_unwind_info(
        &self,
        _func: &Function
    ) -> Result<Option<UnwindInfo>, CodegenError> { ... }
pub fn create_systemv_cie(&self) -> Option<CommonInformationEntry> { ... }
pub fn get_mach_backend(&self) -> Option<&dyn MachBackend> { ... } }

Methods that are specialized to a target ISA. Implies a Display trait that shows the shared flags, as well as any isa-specific flags.

Required methods

pub fn name(&self) -> &'static str[src]

Get the name of this ISA.

pub fn triple(&self) -> &Triple[src]

Get the target triple that was used to make this trait object.

pub fn flags(&self) -> &Flags[src]

Get the ISA-independent flags that were used to make this trait object.

pub fn hash_all_flags(&self, hasher: &mut dyn Hasher)[src]

Hashes all flags, both ISA-independent and ISA-specific, into the specified hasher.

pub fn register_info(&self) -> RegInfo[src]

Get a data structure describing the registers in this ISA.

pub fn legal_encodings(
    &'a self,
    func: &'a Function,
    inst: &'a InstructionData,
    ctrl_typevar: Type
) -> Encodings<'a>
[src]

Returns an iterator over legal encodings for the instruction.

pub fn encoding_info(&self) -> EncInfo[src]

Get a data structure describing the instruction encodings in this ISA.

pub fn legalize_signature(&self, sig: &mut Cow<'_, Signature>, current: bool)[src]

Legalize a function signature.

This is used to legalize both the signature of the function being compiled and any called functions. The signature should be modified by adding ArgumentLoc annotations to all arguments and return values.

Arguments with types that are not supported by the ABI can be expanded into multiple arguments:

  • Integer types that are too large to fit in a register can be broken into multiple arguments of a smaller integer type.
  • Floating point types can be bit-cast to an integer type of the same size, and possible broken into smaller integer types.
  • Vector types can be bit-cast and broken down into smaller vectors or scalars.

The legalizer will adapt argument and return values as necessary at all ABI boundaries.

When this function is called to legalize the signature of the function currently being compiled, current is true. The legalized signature can then also contain special purpose arguments and return values such as:

  • A link argument representing the link registers on RISC architectures that don't push the return address on the stack.
  • A link return value which will receive the value that was passed to the link argument.
  • An sret argument can be added if one wasn't present already. This is necessary if the signature returns more values than registers are available for returning values.
  • An sret return value can be added if the ABI requires a function to return its sret argument in a register.

Arguments and return values for the caller's frame pointer and other callee-saved registers should not be added by this function. These arguments are not added until after register allocation.

pub fn regclass_for_abi_type(&self, ty: Type) -> &'static RegClassData[src]

Get the register class that should be used to represent an ABI argument or return value of type ty. This should be the top-level register class that contains the argument registers.

This function can assume that it will only be asked to provide register classes for types that legalize_signature() produces in ArgumentLoc::Reg entries.

pub fn allocatable_registers(&self, func: &Function) -> RegisterSet[src]

Get the set of allocatable registers that can be used when compiling func.

This set excludes reserved registers like the stack pointer and other special-purpose registers.

pub fn emit_function_to_memory(
    &self,
    func: &Function,
    sink: &mut MemoryCodeSink<'_>
)
[src]

Emit a whole function into memory.

pub fn unsigned_add_overflow_condition(&self) -> IntCC[src]

IntCC condition for Unsigned Addition Overflow (Carry).

pub fn unsigned_sub_overflow_condition(&self) -> IntCC[src]

IntCC condition for Unsigned Subtraction Overflow (Borrow/Carry).

pub fn as_any(&self) -> &(dyn Any + 'static)[src]

Return an Any reference for downcasting to the ISA-specific implementation of this trait with isa.as_any().downcast_ref::<isa::foo::Isa>().

Loading content...

Provided methods

pub fn default_call_conv(&self) -> CallConv[src]

Get the default calling convention of this target.

pub fn endianness(&self) -> Endianness[src]

Get the endianness of this ISA.

pub fn pointer_type(&self) -> Type[src]

Get the pointer type of this ISA.

pub fn pointer_width(&self) -> PointerWidth[src]

Get the width of pointers on this ISA.

pub fn pointer_bits(&self) -> u8[src]

Get the width of pointers on this ISA, in units of bits.

pub fn pointer_bytes(&self) -> u8[src]

Get the width of pointers on this ISA, in units of bytes.

pub fn frontend_config(&self) -> TargetFrontendConfig[src]

Get the information needed by frontends producing Cranelift IR.

pub fn uses_cpu_flags(&self) -> bool[src]

Does the CPU implement scalar comparisons using a CPU flags register?

pub fn uses_complex_addresses(&self) -> bool[src]

Does the CPU implement multi-register addressing?

pub fn map_dwarf_register(&self, u16) -> Result<u16, RegisterMappingError>[src]

Map a Cranelift register to its corresponding DWARF register.

pub fn map_regalloc_reg_to_dwarf(
    &self,
    Reg
) -> Result<u16, RegisterMappingError>
[src]

Map a regalloc::Reg to its corresponding DWARF register.

pub fn encode(
    &self,
    func: &Function,
    inst: &InstructionData,
    ctrl_typevar: Type
) -> Result<Encoding, fn(Inst, &mut Function, &mut ControlFlowGraph, &dyn TargetIsa) -> bool>
[src]

Encode an instruction after determining it is legal.

If inst can legally be encoded in this ISA, produce the corresponding Encoding object. Otherwise, return Legalize action.

This is also the main entry point for determining if an instruction is legal.

pub fn prologue_epilogue(&self, func: &mut Function) -> Result<(), CodegenError>[src]

Compute the stack layout and insert prologue and epilogue code into func.

Return an error if the stack frame is too large.

pub fn create_unwind_info(
    &self,
    _func: &Function
) -> Result<Option<UnwindInfo>, CodegenError>
[src]

Creates unwind information for the function.

Returns None if there is no unwind information for the function.

pub fn create_systemv_cie(&self) -> Option<CommonInformationEntry>[src]

Creates a new System V Common Information Entry for the ISA.

Returns None if the ISA does not support System V unwind information.

pub fn get_mach_backend(&self) -> Option<&dyn MachBackend>[src]

Get the new-style MachBackend, if this is an adapter around one.

Loading content...

Trait Implementations

impl<'_> Debug for &'_ (dyn TargetIsa + '_)[src]

Implementations on Foreign Types

impl TargetIsa for TargetIsaAdapter[src]

pub fn emit_function_to_memory(
    &self,
    _func: &Function,
    _sink: &mut MemoryCodeSink<'_>
)
[src]

Emit a whole function into memory.

Loading content...

Implementors

Loading content...