Trait TargetIsa
pub trait TargetIsa:
Display
+ Send
+ Sync {
Show 22 methods
// Required methods
fn name(&self) -> &'static str;
fn triple(&self) -> &Triple;
fn flags(&self) -> &Flags;
fn isa_flags(&self) -> Vec<Value>;
fn dynamic_vector_bytes(&self, dynamic_ty: Type) -> u32;
fn compile_function(
&self,
func: &Function,
domtree: &DominatorTree,
want_disasm: bool,
ctrl_plane: &mut ControlPlane,
) -> Result<CompiledCodeBase<Stencil>, CodegenError>;
fn emit_unwind_info(
&self,
result: &CompiledCodeBase<Final>,
kind: UnwindInfoKind,
) -> Result<Option<UnwindInfo>, CodegenError>;
fn text_section_builder(
&self,
num_labeled_funcs: usize,
) -> Box<dyn TextSectionBuilder>;
fn function_alignment(&self) -> FunctionAlignment;
fn page_size_align_log2(&self) -> u8;
fn pretty_print_reg(&self, reg: Reg, size: u8) -> String;
fn has_native_fma(&self) -> bool;
fn has_x86_blendv_lowering(&self, ty: Type) -> bool;
fn has_x86_pshufb_lowering(&self) -> bool;
fn has_x86_pmulhrsw_lowering(&self) -> bool;
fn has_x86_pmaddubsw_lowering(&self) -> bool;
fn default_argument_extension(&self) -> ArgumentExtension;
// Provided methods
fn is_branch_protection_enabled(&self) -> bool { ... }
fn map_regalloc_reg_to_dwarf(
&self,
_: Reg,
) -> Result<u16, RegisterMappingError> { ... }
fn create_systemv_cie(&self) -> Option<CommonInformationEntry> { ... }
fn wrapped(self) -> Arc<dyn TargetIsa>
where Self: Sized + 'static { ... }
fn to_capstone(&self) -> Result<Capstone, Error> { ... }
}
Expand description
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§
fn triple(&self) -> &Triple
fn triple(&self) -> &Triple
Get the target triple that was used to make this trait object.
fn isa_flags(&self) -> Vec<Value>
fn isa_flags(&self) -> Vec<Value>
Get the ISA-dependent flag values that were used to make this trait object.
fn dynamic_vector_bytes(&self, dynamic_ty: Type) -> u32
fn dynamic_vector_bytes(&self, dynamic_ty: Type) -> u32
Get the ISA-dependent maximum vector register size, in bytes.
fn compile_function(
&self,
func: &Function,
domtree: &DominatorTree,
want_disasm: bool,
ctrl_plane: &mut ControlPlane,
) -> Result<CompiledCodeBase<Stencil>, CodegenError>
fn compile_function( &self, func: &Function, domtree: &DominatorTree, want_disasm: bool, ctrl_plane: &mut ControlPlane, ) -> Result<CompiledCodeBase<Stencil>, CodegenError>
Compile the given function.
fn emit_unwind_info(
&self,
result: &CompiledCodeBase<Final>,
kind: UnwindInfoKind,
) -> Result<Option<UnwindInfo>, CodegenError>
fn emit_unwind_info( &self, result: &CompiledCodeBase<Final>, kind: UnwindInfoKind, ) -> Result<Option<UnwindInfo>, CodegenError>
Creates unwind information for the function.
Returns None
if there is no unwind information for the function.
fn text_section_builder(
&self,
num_labeled_funcs: usize,
) -> Box<dyn TextSectionBuilder>
fn text_section_builder( &self, num_labeled_funcs: usize, ) -> Box<dyn TextSectionBuilder>
Returns an object that can be used to build the text section of an executable.
This object will internally attempt to handle as many relocations as possible using relative calls/jumps/etc between functions.
The num_labeled_funcs
argument here is the number of functions which
will be “labeled” or might have calls between them, typically the number
of defined functions in the object file.
fn function_alignment(&self) -> FunctionAlignment
fn function_alignment(&self) -> FunctionAlignment
Returns the minimum function alignment and the preferred function alignment, for performance, required by this ISA.
fn page_size_align_log2(&self) -> u8
fn page_size_align_log2(&self) -> u8
The log2 of the target’s page size and alignment.
Note that this may be an upper-bound that is larger than necessary for some platforms since it may depend on runtime configuration.
fn pretty_print_reg(&self, reg: Reg, size: u8) -> String
fn pretty_print_reg(&self, reg: Reg, size: u8) -> String
Return the string representation of “reg” accessed as “size” bytes. The returned string will match the usual disassemly view of “reg”.
fn has_native_fma(&self) -> bool
fn has_native_fma(&self) -> bool
Returns whether this ISA has a native fused-multiply-and-add instruction for floats.
Currently this only returns false on x86 when some native features are not detected.
fn has_x86_blendv_lowering(&self, ty: Type) -> bool
fn has_x86_blendv_lowering(&self, ty: Type) -> bool
Returns whether the CLIF x86_blendv
instruction is implemented for
this ISA for the specified type.
fn has_x86_pshufb_lowering(&self) -> bool
fn has_x86_pshufb_lowering(&self) -> bool
Returns whether the CLIF x86_pshufb
instruction is implemented for
this ISA.
fn has_x86_pmulhrsw_lowering(&self) -> bool
fn has_x86_pmulhrsw_lowering(&self) -> bool
Returns whether the CLIF x86_pmulhrsw
instruction is implemented for
this ISA.
fn has_x86_pmaddubsw_lowering(&self) -> bool
fn has_x86_pmaddubsw_lowering(&self) -> bool
Returns whether the CLIF x86_pmaddubsw
instruction is implemented for
this ISA.
fn default_argument_extension(&self) -> ArgumentExtension
fn default_argument_extension(&self) -> ArgumentExtension
Returns the mode of extension used for integer arguments smaller than the pointer width in function signatures.
Some platform ABIs require that smaller-than-pointer-width values are
either zero or sign-extended to the full register width. This value is
propagated to the AbiParam
value created for signatures. Note that not
all ABIs for all platforms require extension of any form, so this is
generally only necessary for the default_call_conv
.
Provided Methods§
fn is_branch_protection_enabled(&self) -> bool
fn is_branch_protection_enabled(&self) -> bool
Get a flag indicating whether branch protection is enabled.
fn map_regalloc_reg_to_dwarf(&self, _: Reg) -> Result<u16, RegisterMappingError>
fn map_regalloc_reg_to_dwarf(&self, _: Reg) -> Result<u16, RegisterMappingError>
Map a regalloc::Reg to its corresponding DWARF register.
fn create_systemv_cie(&self) -> Option<CommonInformationEntry>
fn create_systemv_cie(&self) -> Option<CommonInformationEntry>
Creates a new System V Common Information Entry for the ISA.
Returns None
if the ISA does not support System V unwind information.
fn wrapped(self) -> Arc<dyn TargetIsa>where
Self: Sized + 'static,
fn wrapped(self) -> Arc<dyn TargetIsa>where
Self: Sized + 'static,
Create a polymorphic TargetIsa from this specific implementation.
fn to_capstone(&self) -> Result<Capstone, Error>
fn to_capstone(&self) -> Result<Capstone, Error>
Generate a Capstone
context for disassembling bytecode for this architecture.
Implementations§
§impl<'a> dyn TargetIsa + 'a
Methods implemented for free for target ISA!
impl<'a> dyn TargetIsa + 'a
Methods implemented for free for target ISA!
pub fn default_call_conv(&self) -> CallConv
pub fn default_call_conv(&self) -> CallConv
Get the default calling convention of this target.
pub fn endianness(&self) -> Endianness
pub fn endianness(&self) -> Endianness
Get the endianness of this ISA.
pub fn symbol_alignment(&self) -> u64
pub fn symbol_alignment(&self) -> u64
Returns the minimum symbol alignment for this ISA.
pub fn pointer_type(&self) -> Type
pub fn pointer_type(&self) -> Type
Get the pointer type of this ISA.
pub fn pointer_bits(&self) -> u8
pub fn pointer_bits(&self) -> u8
Get the width of pointers on this ISA, in units of bits.
pub fn pointer_bytes(&self) -> u8
pub fn pointer_bytes(&self) -> u8
Get the width of pointers on this ISA, in units of bytes.
pub fn frontend_config(&self) -> TargetFrontendConfig
pub fn frontend_config(&self) -> TargetFrontendConfig
Get the information needed by frontends producing Cranelift IR.