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

source

pub fn at<P: Copy>(&self, position: P) -> FuncAt<'_, P>

Start immutably traversing the function at position.

source

pub fn at_mut<P: Copy>(&mut self, position: P) -> FuncAtMut<'_, P>

Start mutably traversing the function at position.

source

pub fn at_body(&self) -> FuncAt<'_, ControlRegion>

Shorthand for func_def_body.at(func_def_body.body).

source

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

source§

fn clone(&self) -> FuncDefBody

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl InnerInPlaceTransform for FuncDefBody

source§

fn inner_in_place_transform_with(&mut self, transformer: &mut impl Transformer)

source§

impl InnerVisit for FuncDefBody

source§

fn inner_visit_with<'a>(&'a self, visitor: &mut impl Visitor<'a>)

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<'a, T, V> DynInnerVisit<'a, V> for Twhere T: InnerVisit, V: Visitor<'a>,

source§

fn dyn_inner_visit_with(&'a self, visitor: &mut V)

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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 Twhere T: Clone,

§

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, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.