pub struct BlockParam<'str> {
pub index: usize,
pub type_id: TypeId,
pub name: Option<Cow<'str, str>>,
pub origin: Option<LocalValueId>,
/* private fields */
}Expand description
A typed parameter declared at the entry of a basic block.
Block parameters are the receiving side of block arguments: when a
Branch or
CBranch passes arguments to a target
block, the i-th argument binds to the i-th BlockParam of that block.
Unlike Instruction results, block params are
not produced by any operation — they are value sources at block entry,
analogous to function arguments in MLIR block-argument style.
Fields§
§index: usizePosition of this param in the owning block’s param list.
type_id: TypeIdThe type of this parameter’s value.
name: Option<Cow<'str, str>>Optional debug name (displayed as %name).
origin: Option<LocalValueId>Optional source value this param was created to promote (the varnode or
stack-slot literal). Not displayed; it is a stable cross-run identity that
lets passes like mem2reg reuse an existing param instead of duplicating it,
even for varnodes that have no name.
Implementations§
Source§impl<'str> BlockParam<'str>
impl<'str> BlockParam<'str>
Sourcepub fn make<'ctx>(
ctx: &'ctx mut Context<'str>,
block_id: BlockId,
size: usize,
) -> BlockParamMutRef<'str, 'ctx>
pub fn make<'ctx>( ctx: &'ctx mut Context<'str>, block_id: BlockId, size: usize, ) -> BlockParamMutRef<'str, 'ctx>
Allocates a new block parameter in ctx, attaches it to block_id, and
returns a mutable reference. The caller is responsible for appending the
returned BlockParamId to the block’s params list.
Sourcepub fn new(index: usize, type_id: TypeId, parent: LocalBlockId) -> Self
pub fn new(index: usize, type_id: TypeId, parent: LocalBlockId) -> Self
A detached, unnamed parameter of type type_id at position index,
attached to body-local parent. Public constructor so foreign crates need
not name the private parent field (stage 6a §11); the caller pushes the returned
value through Context::push_block_param.
pub fn from_id<'ctx>( ctx: &'ctx Context<'str>, id: BlockParamId, ) -> BlockParamRef<'str, 'ctx>
pub fn from_id_mut<'ctx>( ctx: &'ctx mut Context<'str>, id: BlockParamId, ) -> BlockParamMutRef<'str, 'ctx>
Sourcepub fn parent_id(&self) -> Option<LocalBlockId>
pub fn parent_id(&self) -> Option<LocalBlockId>
The block this parameter belongs to, if any (raw &BlockParam accessor).
Returns the body-local storage form; qualify it with the parameter’s
function id at module/ref boundaries.
Sourcepub fn set_parent(&mut self, block: LocalBlockId)
pub fn set_parent(&mut self, block: LocalBlockId)
Attach this parameter to block (raw &mut BlockParam accessor).
Sourcepub fn origin_id(&self) -> Option<LocalValueId>
pub fn origin_id(&self) -> Option<LocalValueId>
The source value this parameter was created to promote, if recorded (raw
&BlockParam accessor). Returns the body-local storage form; qualify it
with the parameter’s function id at module/ref boundaries.
Sourcepub fn set_origin_id(&mut self, origin: LocalValueId)
pub fn set_origin_id(&mut self, origin: LocalValueId)
Record the source value this parameter promotes (raw &mut BlockParam
accessor; see BlockParam::origin).
Trait Implementations§
Source§impl<'str> Clone for BlockParam<'str>
impl<'str> Clone for BlockParam<'str>
Source§fn clone(&self) -> BlockParam<'str>
fn clone(&self) -> BlockParam<'str>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more