Struct spirt::FuncDefBody
source · pub struct FuncDefBody {
pub control_regions: EntityDefs<ControlRegion>,
pub control_nodes: EntityDefs<ControlNode>,
pub data_insts: EntityDefs<DataInst>,
pub body: ControlRegion,
pub unstructured_cfg: Option<ControlFlowGraph>,
}
Expand description
The body of a Func
definition.
Fields§
§control_regions: EntityDefs<ControlRegion>
§control_nodes: EntityDefs<ControlNode>
§data_insts: EntityDefs<DataInst>
§body: ControlRegion
The ControlRegion
representing the whole body of the function.
Function parameters are provided via body.inputs
, i.e. they can be
only accessed with Value::ControlRegionInputs { region: body, idx }
.
When unstructured_cfg
is None
, this includes the structured return
of the function, with body.outputs
as the returned values.
unstructured_cfg: Option<ControlFlowGraph>
The unstructured (part of the) control-flow graph of the function.
Only present if structurization wasn’t attempted, or if was only partial (leaving behind a mix of structured and unstructured control-flow).
When present, it starts at body
(more specifically, its exit),
effectively replacing the structured return body
otherwise implies,
with body
(or rather, its children
) always being fully structured.
Implementations§
source§impl FuncDefBody
impl FuncDefBody
sourcepub fn at<P: Copy>(&self, position: P) -> FuncAt<'_, P>
pub fn at<P: Copy>(&self, position: P) -> FuncAt<'_, P>
Start immutably traversing the function at position
.
sourcepub fn at_mut<P: Copy>(&mut self, position: P) -> FuncAtMut<'_, P>
pub fn at_mut<P: Copy>(&mut self, position: P) -> FuncAtMut<'_, P>
Start mutably traversing the function at position
.
sourcepub fn at_body(&self) -> FuncAt<'_, ControlRegion>
pub fn at_body(&self) -> FuncAt<'_, ControlRegion>
Shorthand for func_def_body.at(func_def_body.body)
.
sourcepub fn at_mut_body(&mut self) -> FuncAtMut<'_, ControlRegion>
pub fn at_mut_body(&mut self) -> FuncAtMut<'_, ControlRegion>
Shorthand for func_def_body.at_mut(func_def_body.body)
.
Trait Implementations§
source§impl Clone for FuncDefBody
impl Clone for FuncDefBody
source§fn clone(&self) -> FuncDefBody
fn clone(&self) -> FuncDefBody
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more