Skip to main content

Target

Trait Target 

Source
pub trait Target:
    Clone
    + Debug
    + Eq
    + Hash
    + Sized
    + 'static {
    type TypeRef: Clone + Eq + Hash + Debug;
    type MethodRef: Clone + Eq + Hash + Debug;
    type FieldRef: Clone + Eq + Hash + Debug;
    type SigRef: Clone + Eq + Hash + Debug;
    type ExceptionKind: Clone + Eq + Debug;
    type Type: Clone + Eq + Hash + Debug;
    type OriginalInstruction: Clone + Debug;
    type LocalSignature: Clone + Debug;
    type Capability: Copy + Eq + Hash + Debug + 'static;

Show 43 methods // Required methods fn ptr_bytes(&self) -> u32; fn synthetic_instruction() -> Self::OriginalInstruction; fn unknown_type() -> Self::Type; fn is_integer(t: &Self::Type) -> bool; fn is_floating(t: &Self::Type) -> bool; fn is_signed(t: &Self::Type) -> bool; fn is_pointer(t: &Self::Type) -> bool; fn is_reference(t: &Self::Type) -> bool; fn is_unknown(t: &Self::Type) -> bool; fn bit_width(t: &Self::Type) -> Option<u32>; fn instruction_mnemonic(instr: &Self::OriginalInstruction) -> &'static str; fn instruction_rva(instr: &Self::OriginalInstruction) -> u64; fn is_filter_handler(flags: &Self::ExceptionKind) -> bool; // Provided methods fn endianness(&self) -> Endianness { ... } fn is_vector(t: &Self::Type) -> bool { ... } fn vector_shape(_t: &Self::Type) -> Option<VectorShape> { ... } fn scalable_vector_shape(_t: &Self::Type) -> Option<ScalableVectorShape> { ... } fn vector_descriptor(t: &Self::Type) -> Option<VectorDescriptor> { ... } fn vector_type(_shape: VectorShape) -> Option<Self::Type> { ... } fn scalable_vector_type(_shape: ScalableVectorShape) -> Option<Self::Type> { ... } fn vector_lane_type(_shape: VectorShape) -> Option<Self::Type> { ... } fn scalable_vector_lane_type( _shape: ScalableVectorShape, ) -> Option<Self::Type> { ... } fn vector_descriptor_lane_type( shape: VectorDescriptor, ) -> Option<Self::Type> { ... } fn vector_mask_shape(_t: &Self::Type) -> Option<VectorMaskShape> { ... } fn scalable_vector_mask_shape( _t: &Self::Type, ) -> Option<ScalableVectorMaskShape> { ... } fn vector_mask_descriptor(t: &Self::Type) -> Option<VectorMaskDescriptor> { ... } fn vector_mask_type(_shape: VectorMaskShape) -> Option<Self::Type> { ... } fn scalable_vector_mask_type( _shape: ScalableVectorMaskShape, ) -> Option<Self::Type> { ... } fn vector_mask_descriptor_type( shape: VectorMaskDescriptor, ) -> Option<Self::Type> { ... } fn field_member_index(_field: &Self::FieldRef) -> Option<u32> { ... } fn result_type_for_const(_value: &ConstValue<Self>) -> Option<Self::Type> { ... } fn comparison_result_type() -> Option<Self::Type> { ... } fn arithmetic_result_type() -> Option<Self::Type> { ... } fn native_int_result_type() -> Option<Self::Type> { ... } fn ckfinite_result_type() -> Option<Self::Type> { ... } fn function_ptr_result_type() -> Option<Self::Type> { ... } fn object_result_type() -> Option<Self::Type> { ... } fn value_type_from_ref(_r: &Self::TypeRef) -> Option<Self::Type> { ... } fn byref_value_type_from_ref(_r: &Self::TypeRef) -> Option<Self::Type> { ... } fn byref_class_type_from_ref(_r: &Self::TypeRef) -> Option<Self::Type> { ... } fn convert_const( _value: &ConstValue<Self>, _target_type: &Self::Type, _unsigned_source: bool, _ptr_bytes: u32, ) -> Option<ConstValue<Self>> { ... } fn convert_const_checked( _value: &ConstValue<Self>, _target_type: &Self::Type, _unsigned_source: bool, _ptr_bytes: u32, ) -> Option<ConstValue<Self>> { ... } fn evaluate_int_conv( _value: i64, _target_type: &Self::Type, _unsigned: bool, _ptr_bytes: u32, ) -> Option<ConstValue<Self>> { ... }
}
Expand description

The abstraction that makes the SSA IR core generic over an instruction set. See module docs.

Clone + Debug + Eq + Hash supertraits exist so derive macros on the generic IR types (ConstValue<T>, SsaOp<T>, SsaInstruction<T>, SsaFunction<T>, MemoryLocation<T>, …) do not need manual impls. The implementation cost is negligible for marker-style impls.

Required Associated Types§

Source

type TypeRef: Clone + Eq + Hash + Debug

Reference to a user-defined or built-in type in the host’s metadata.

Source

type MethodRef: Clone + Eq + Hash + Debug

Reference to a method in the host’s metadata.

Source

type FieldRef: Clone + Eq + Hash + Debug

Reference to a field in the host’s metadata.

Source

type SigRef: Clone + Eq + Hash + Debug

Reference to a standalone signature in the host’s metadata.

Source

type ExceptionKind: Clone + Eq + Debug

Host-defined exception-handler kind (e.g. EXCEPTION/FINALLY/FILTER on CIL).

Source

type Type: Clone + Eq + Hash + Debug

Host’s type representation (e.g. SsaType for CIL).

Source

type OriginalInstruction: Clone + Debug

Original-instruction breadcrumb retained on each SsaInstruction for debugging and source mapping. Hosts that don’t want this can use ().

Source

type LocalSignature: Clone + Debug

Local-variable signature data preserved through SSA construction. Used by codegen to recover types that aren’t structurally reconstructible from the SSA op stream.

Source

type Capability: Copy + Eq + Hash + Debug + 'static

Pass-pipeline capability tag used by the analyssa scheduler for dependency-aware ordering. Hosts that don’t run the pass scheduler can use (). Hosts that do should embed crate::scheduling::DeobfuscationCapability in their concrete enum so generic analyssa passes can declare provides/requires using the shared deobfuscation vocabulary.

Required Methods§

Source

fn ptr_bytes(&self) -> u32

Pointer width in bytes (typically 4 or 8). Runtime so bi-arch hosts can vary it per-instance.

Source

fn synthetic_instruction() -> Self::OriginalInstruction

Returns a placeholder original-instruction value for synthetic IR nodes (e.g., phi-node carriers, transform-inserted instructions).

Source

fn unknown_type() -> Self::Type

The canonical “unknown / not-yet-inferred” type. Used by builders and fixtures that haven’t run inference.

Source

fn is_integer(t: &Self::Type) -> bool

true if t is an integer type (any width, signed or unsigned).

Source

fn is_floating(t: &Self::Type) -> bool

true if t is a floating-point type.

Source

fn is_signed(t: &Self::Type) -> bool

true if t is a signed integer type.

Source

fn is_pointer(t: &Self::Type) -> bool

true if t is a pointer or managed reference (byref) to another type.

Source

fn is_reference(t: &Self::Type) -> bool

true if t is a reference type (object/string/class/array).

Source

fn is_unknown(t: &Self::Type) -> bool

true if t is the unknown / not-yet-inferred type.

Source

fn bit_width(t: &Self::Type) -> Option<u32>

Bit-width for primitive types where it is statically known. None for pointer-sized integers, references, and aggregates.

Source

fn instruction_mnemonic(instr: &Self::OriginalInstruction) -> &'static str

Mnemonic for the original instruction breadcrumb (e.g. "add", "ret"). Hosts that don’t carry a real instruction return a placeholder.

Source

fn instruction_rva(instr: &Self::OriginalInstruction) -> u64

RVA of the original instruction. Hosts without source mapping return 0.

Source

fn is_filter_handler(flags: &Self::ExceptionKind) -> bool

true if flags denotes a filter-style exception handler (i.e. one that runs a user-supplied predicate before catching). Hosts without a filter notion return false.

Provided Methods§

Source

fn endianness(&self) -> Endianness

Byte ordering for multi-byte values in memory.

Returns Endianness::Little by default, which covers x86, RISC-V, and the default mode of most modern ISAs. Hosts that target bi-endian architectures (MIPS, ARM) or big-endian-only architectures (SPARC, z/Arch) should override this.

Source

fn is_vector(t: &Self::Type) -> bool

Returns true if t is a vector type known to this target.

Source

fn vector_shape(_t: &Self::Type) -> Option<VectorShape>

Returns the target-independent vector shape for t, if known.

Source

fn scalable_vector_shape(_t: &Self::Type) -> Option<ScalableVectorShape>

Returns the scalable vector shape for t, if known.

Source

fn vector_descriptor(t: &Self::Type) -> Option<VectorDescriptor>

Returns the fixed or scalable vector descriptor for t, if known.

Source

fn vector_type(_shape: VectorShape) -> Option<Self::Type>

Returns the target type for shape, if the target supports it.

Source

fn scalable_vector_type(_shape: ScalableVectorShape) -> Option<Self::Type>

Returns the target type for scalable shape, if the target supports it.

Source

fn vector_lane_type(_shape: VectorShape) -> Option<Self::Type>

Returns the scalar lane type for shape, if the target supports it.

Source

fn scalable_vector_lane_type(_shape: ScalableVectorShape) -> Option<Self::Type>

Returns the scalar lane type for scalable shape, if the target supports it.

Source

fn vector_descriptor_lane_type(shape: VectorDescriptor) -> Option<Self::Type>

Returns the scalar lane type for fixed or scalable shape, if supported.

Source

fn vector_mask_shape(_t: &Self::Type) -> Option<VectorMaskShape>

Returns the fixed vector mask shape for t, if known.

Source

fn scalable_vector_mask_shape( _t: &Self::Type, ) -> Option<ScalableVectorMaskShape>

Returns the scalable vector mask shape for t, if known.

Source

fn vector_mask_descriptor(t: &Self::Type) -> Option<VectorMaskDescriptor>

Returns the fixed or scalable vector mask descriptor for t, if known.

Source

fn vector_mask_type(_shape: VectorMaskShape) -> Option<Self::Type>

Returns the target mask type for shape, if the target supports it.

Source

fn scalable_vector_mask_type( _shape: ScalableVectorMaskShape, ) -> Option<Self::Type>

Returns the target scalable mask type for shape, if the target supports it.

Source

fn vector_mask_descriptor_type( shape: VectorMaskDescriptor, ) -> Option<Self::Type>

Returns the target mask type for fixed or scalable shape, if supported.

Source

fn field_member_index(_field: &Self::FieldRef) -> Option<u32>

Declaration-order member index of field within its parent composite, when the host has resolved one.

Field-sensitive analyses (points-to, alias partitioning) use this to keep distinct members of the same object disjoint; None means the field is unresolved and must fall back to the sound whole-object approximation. Defaults to None, which is exactly that conservative fallback.

Source

fn result_type_for_const(_value: &ConstValue<Self>) -> Option<Self::Type>

Result type for a Const op; mapped from the ConstValue variant.

Source

fn comparison_result_type() -> Option<Self::Type>

Result type of a comparison op (Ceq, Clt, Cgt).

Source

fn arithmetic_result_type() -> Option<Self::Type>

Result type of plain integer arithmetic ops (Add, Sub, …, SizeOf).

Source

fn native_int_result_type() -> Option<Self::Type>

Result type of LocalAlloc and ArrayLength ops (CIL: native int).

Source

fn ckfinite_result_type() -> Option<Self::Type>

Result type of Ckfinite (CIL: F64).

Source

fn function_ptr_result_type() -> Option<Self::Type>

Result type of LoadFunctionPtr / LoadVirtFunctionPtr (CIL: native int).

Source

fn object_result_type() -> Option<Self::Type>

Result type of object-producing ops (Box, NewObj, NewArr, CastClass, IsInst).

Source

fn value_type_from_ref(_r: &Self::TypeRef) -> Option<Self::Type>

Result type of UnboxAny / LoadObj: a value-typed view of r.

Source

fn byref_value_type_from_ref(_r: &Self::TypeRef) -> Option<Self::Type>

Result type of Unbox: a managed reference (byref) to the value-typed view of r.

Source

fn byref_class_type_from_ref(_r: &Self::TypeRef) -> Option<Self::Type>

Result type of LoadElementAddr: a managed reference (byref) to a class-typed element of r.

Source

fn convert_const( _value: &ConstValue<Self>, _target_type: &Self::Type, _unsigned_source: bool, _ptr_bytes: u32, ) -> Option<ConstValue<Self>>

Convert a constant value to target_type. Used by ConstValue::convert_to (CIL conv.* semantics). ptr_bytes is the host’s pointer width (typically 4 or 8). Default None means “unsupported”.

Source

fn convert_const_checked( _value: &ConstValue<Self>, _target_type: &Self::Type, _unsigned_source: bool, _ptr_bytes: u32, ) -> Option<ConstValue<Self>>

Convert a constant value to target_type with overflow checking. Used by ConstValue::convert_to_checked (CIL conv.ovf.* semantics). Returns None if the conversion would overflow or is unsupported.

Source

fn evaluate_int_conv( _value: i64, _target_type: &Self::Type, _unsigned: bool, _ptr_bytes: u32, ) -> Option<ConstValue<Self>>

Evaluator-side integer conversion: produce a typed ConstValue from a raw i64 value and a target type. Used by SsaEvaluator to apply CIL conv.* truncation/extension semantics. Default None means the caller falls back to wrapping the raw i64.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§