Skip to main content

FunctionRef

Struct FunctionRef 

Source
pub struct FunctionRef<'str, 'ctx, R = ModuleView<'ctx, 'str>> {
    pub id: FunctionId,
    /* private fields */
}

Fields§

§id: FunctionId

Implementations§

Source§

impl<'s, 'ctx: 's, 'str: 'ctx, R> FunctionRef<'str, 'ctx, R>
where R: QCodeView<'ctx, 'str>,

Source

pub fn address(&'s self) -> Option<u64>

The function interface’s entry address.

Source

pub fn is_external(&'s self) -> bool

Whether the function interface marks this function external.

Source

pub fn import_ordinal(&'s self) -> Option<u16>

The ordinal this import was brought in at, for a PE import resolved from an ordinal-only entry. None for named imports and local functions.

Source

pub fn signature(&'s self) -> Option<&'ctx FunctionSignature>

A reference to the function interface’s signature, if any.

Source

pub fn users_of(&'s self, value: ValueId) -> Vec<InstructionId>

This function’s instructions that use value as an operand. See FunctionBody::users_of; this is the function-scoped read every pass wants for an SSA value (all its users are intra-function).

Source

pub fn local_users_of(&'s self, value: ValueId) -> &'ctx [LocalInsnId]

This function’s users of value in their stored, body-local form.

Borrowed rather than built: a pass that reads the list once per instruction should not allocate one per instruction to do it. Qualify with this function’s id when a whole InstructionId is needed.

Source

pub fn has_users(&'s self, value: ValueId) -> bool

Whether this function uses value at all, without building the user list to ask. See FunctionBody::has_users.

Source

pub fn user_map_entries( &'s self, ) -> impl Iterator<Item = (ValueId, Vec<InstructionId>)> + 's

Iterate this function’s recorded (value, users) reverse-use entries (see FunctionBody::user_map_entries).

Source

pub fn local_named(&'s self, name: &str) -> Option<ValueId>

Resolve a block/instruction/param/Temp name within this function’s local name table (see FunctionBody::names). None if this function has no such name.

Source

pub fn param_attr(&'s self, index: usize) -> Option<ParamAttrs>

The inferred pointer attributes for positional argument index, or None when this function has no analyzed attributes (treat conservatively: the argument escapes and may be written through). See FunctionSignature::param_attrs.

Source

pub fn param_attrs(&'s self) -> Option<&'ctx [ParamAttrs]>

The full per-parameter attribute vector, if analyzed.

Source

pub fn written_spaces(&'s self) -> Option<&'ctx [SpaceId]>

The non-register memory spaces this function may (transitively) write, as set by analysis. Some(spaces) is exact (a space not listed is never written); None conflates “unstamped” and “stamped unbounded” — both are treated conservatively (may write any space) by consumers. For the tri-state distinction use written_spaces_state. See FunctionSignature::written_spaces.

Source

pub fn written_spaces_state(&'s self) -> WrittenSpaces<'ctx>

The tri-state written_spaces verdict, distinguishing a never-stamped fresh mint (WrittenSpaces::Unstamped) from a deliberately recorded ⊤ (WrittenSpaces::Unbounded). See FunctionSignature::written_spaces.

Source

pub fn is_reg_materialized(&'s self) -> bool

Whether this function’s register interface has been materialized (argpromote v2) — i.e. its effects are RegisterChannelState::Materialized. Legacy name for the register-channel “functionalized” predicate.

Source

pub fn effects(&'s self) -> &'ctx FunctionEffects

This function’s call-graph-closed register FunctionEffects summary. RegisterChannelState::Unsolved until the effect-analysis pass runs (and after a snapshot load). See FunctionInterface::effects.

Source

pub fn is_pure(&'s self) -> bool

Whether argpromote has functionalized every side-effect channel of this function — it is a deterministic pure function of its by-value params, touching no caller-visible memory or registers. Strictly stronger than is_reg_materialized. See FunctionSignature::is_pure.

Source

pub fn is_lambda(&'s self) -> bool

Whether this is a pure value-level lambda rather than a machine function.

Source

pub fn kind(&'s self) -> FunctionKind

Source

pub fn extern_interface(&'s self) -> Option<&'ctx ExternInterface>

The C-prototype-derived external call interface, if external_sigs planned one. Read by argpromote_external to rewrite call sites. See FunctionSignature::extern_interface.

Source

pub fn argmem(&'s self) -> Option<&'ctx ExternArgmem>

The C-prototype-derived argmem summary for a prototyped external, or None when this function is not a prototyped external. See FunctionSignature::argmem.

Source

pub fn input_arg_name(&'s self, index: usize) -> Option<String>

The display name for the call-site argument bound to input index: the name of the callee’s root block param at index, or — for a bodyless external with no root block — the C-prototype argument name recorded in its extern_interface. None when there is no input at index or it is unnamed.

Source

pub fn reads_unbounded_stack(&'s self) -> bool

Whether this function performs an unresolved/dynamic stack read (or forwards a stack pointer into one). See FunctionSignature::reads_unbounded_stack.

Source

pub fn frame_escapes_to_unbounded(&'s self) -> bool

Whether this function hands a pointer into its own frame to a callee that may read it unboundedly. See FunctionSignature::frame_escapes_to_unbounded.

Source

pub fn name(&'s self) -> &'ctx str

The function interface’s name.

Source

pub fn instruction_addrs(&'s self) -> impl Iterator<Item = u64> + 'ctx

The addresses of every machine instruction lifted into this function, in ascending order. Unlike blocks, this is stable across optimization, so it drives the raw disassembly view.

Source

pub fn has_map(&'s self) -> bool

Whether this function contains at least one Map instruction — a lane-wise array map operation. Surfaced as an advanced filter in the function list.

Source

pub fn has_scan(&'s self) -> bool

Whether this function contains at least one Scan instruction — a lane-wise prefix-fold array operation. Surfaced as an advanced filter in the function list, alongside has_map.

Source

pub fn root(&'s self) -> Option<BlockRef<'str, 'ctx, R>>

The root block of this function, if it exists.

Source

pub fn blocks(&'s self) -> impl Iterator<Item = BlockRef<'str, 'ctx, R>> + 's

An iterator over the (live) blocks belonging to this function.

Source

pub fn block_ids(&'s self) -> Vec<BlockId>

The composite ids of this function’s live blocks, in roster order.

Source

pub fn instruction_ids(&'s self) -> Vec<InstructionId>

The composite IDs of this function’s live instructions, in dense physical order — including any currently detached (parent == None).

Source

pub fn edge_ids(&'s self) -> Vec<EdgeId>

The IDs of every live CFG edge in this function’s edge arena, in dense physical order.

Source

pub fn iter(&'s self) -> BlockIter<'str, 'ctx, R>

Iterates over the (live) blocks in this function in arena order (i.e. not sorted by address, unlike blocks).

Source§

impl<'str, 'ctx, R> FunctionRef<'str, 'ctx, R>

Source

pub fn new(view: R, id: FunctionId) -> Self

Source

pub fn id(&self) -> ValueId

Source§

impl<'str, 'ctx> FunctionRef<'str, 'ctx>

Source

pub fn from_id(ctx: &'ctx Context<'str>, id: FunctionId) -> Self

Trait Implementations§

Source§

impl<'str: 'ctx, 'ctx, R> Cfg for FunctionRef<'str, 'ctx, R>
where R: QCodeView<'ctx, 'str>,

Source§

type NodeId = BlockId

Source§

type Hasher = FxBuildHasher

Hasher backing the analyses’ node-keyed maps. Picking a fixed-seed hasher (e.g. FxBuildHasher) keeps successors iteration — and thus the derived dominator structures — deterministic across runs, whereas the std default (RandomState) reseeds per process.
Source§

fn successors(&self, b: BlockId) -> impl Iterator<Item = BlockId> + '_

The successors of n (the targets of its outgoing edges).
Source§

impl<'str, 'ctx, R: Clone> Clone for FunctionRef<'str, 'ctx, R>

Source§

fn clone(&self) -> FunctionRef<'str, 'ctx, R>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'str, 'ctx, R: Copy> Copy for FunctionRef<'str, 'ctx, R>

Source§

impl<'str: 'ctx, 'ctx, R> Display for FunctionRef<'str, 'ctx, R>
where R: QCodeView<'ctx, 'str>,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'str, 'ctx, R> From<FunctionRef<'str, 'ctx, R>> for ValueRef<'str, 'ctx, R>

Source§

fn from(fn_ref: FunctionRef<'str, 'ctx, R>) -> Self

Converts to this type from the input type.
Source§

impl<'str: 'ctx, 'ctx, R> IntoIterator for &FunctionRef<'str, 'ctx, R>
where R: QCodeView<'ctx, 'str>,

Source§

type Item = BlockRef<'str, 'ctx, R>

The type of the elements being iterated over.
Source§

type IntoIter = BlockIter<'str, 'ctx, R>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'str: 'ctx, 'ctx, R> Named for FunctionRef<'str, 'ctx, R>
where R: QCodeView<'ctx, 'str>,

Source§

fn name(&self) -> Option<&str>

Source§

impl<'str: 'ctx, 'ctx, R> Value<'str, 'ctx> for FunctionRef<'str, 'ctx, R>
where R: QCodeView<'ctx, 'str>,

Source§

fn id(&self) -> ValueId

The context-unique identifier for this value.
Source§

fn size(&self) -> usize

The size of this value’s output in bytes, or 0 for non-data values (terminators, blocks, functions).
Source§

impl<'s, 'ctx: 's, 'str: 'ctx> WithCtx<'s, 'ctx, 'str> for FunctionRef<'str, 'ctx>

Source§

fn ctx(&'s self) -> &'ctx Context<'str>

Auto Trait Implementations§

§

impl<'str, 'ctx, R> Freeze for FunctionRef<'str, 'ctx, R>
where R: Freeze,

§

impl<'str, 'ctx, R> RefUnwindSafe for FunctionRef<'str, 'ctx, R>
where R: RefUnwindSafe,

§

impl<'str, 'ctx, R> Send for FunctionRef<'str, 'ctx, R>
where R: Send,

§

impl<'str, 'ctx, R> Sync for FunctionRef<'str, 'ctx, R>
where R: Sync,

§

impl<'str, 'ctx, R> Unpin for FunctionRef<'str, 'ctx, R>
where R: Unpin,

§

impl<'str, 'ctx, R> UnsafeUnpin for FunctionRef<'str, 'ctx, R>
where R: UnsafeUnpin,

§

impl<'str, 'ctx, R> UnwindSafe for FunctionRef<'str, 'ctx, R>
where R: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.