pub struct Air { /* private fields */ }Expand description
The complete AIR for a function.
Implementations§
Source§impl Air
impl Air
Sourcepub fn add_inst(&mut self, inst: AirInst) -> AirRef
pub fn add_inst(&mut self, inst: AirInst) -> AirRef
Add an instruction and return its reference.
Sourcepub fn return_type(&self) -> Type
pub fn return_type(&self) -> Type
The return type of this function.
Sourcepub fn iter(&self) -> impl Iterator<Item = (AirRef, &AirInst)>
pub fn iter(&self) -> impl Iterator<Item = (AirRef, &AirInst)>
Iterate over all instructions with their references.
Sourcepub fn get_extra(&self, start: u32, len: u32) -> &[u32]
pub fn get_extra(&self, start: u32, len: u32) -> &[u32]
Get extra data slice by start index and length.
Sourcepub fn get_air_refs(&self, start: u32, len: u32) -> impl Iterator<Item = AirRef>
pub fn get_air_refs(&self, start: u32, len: u32) -> impl Iterator<Item = AirRef>
Get AirRefs from extra array (for blocks, array elements, intrinsic args, etc.).
Sourcepub fn get_call_args(
&self,
start: u32,
len: u32,
) -> impl Iterator<Item = AirCallArg>
pub fn get_call_args( &self, start: u32, len: u32, ) -> impl Iterator<Item = AirCallArg>
Get call arguments from extra array. Each call arg is encoded as 2 u32s: (air_ref, mode).
Sourcepub fn get_match_arms(
&self,
start: u32,
len: u32,
) -> impl Iterator<Item = (AirPattern, AirRef)>
pub fn get_match_arms( &self, start: u32, len: u32, ) -> impl Iterator<Item = (AirPattern, AirRef)>
Get match arms from extra array. Each match arm is encoded based on pattern type plus the body AirRef.
Sourcepub fn get_struct_init(
&self,
fields_start: u32,
fields_len: u32,
source_order_start: u32,
) -> (impl Iterator<Item = AirRef>, impl Iterator<Item = usize>)
pub fn get_struct_init( &self, fields_start: u32, fields_len: u32, source_order_start: u32, ) -> (impl Iterator<Item = AirRef>, impl Iterator<Item = usize>)
Get struct init data from extra array. Returns (field_refs_iterator, source_order_iterator).
Sourcepub fn remap_string_ids<F>(&mut self, map_fn: F)
pub fn remap_string_ids<F>(&mut self, map_fn: F)
Remap string constant IDs using the provided mapping function.
This is used after parallel function analysis to convert local string IDs (per-function) to global string IDs (across all functions). The mapping function takes a local string ID and returns the global string ID.
Sourcepub fn instructions(&self) -> &[AirInst]
pub fn instructions(&self) -> &[AirInst]
Get a reference to all instructions.
Sourcepub fn rewrite_inst_data(&mut self, index: usize, new_data: AirInstData)
pub fn rewrite_inst_data(&mut self, index: usize, new_data: AirInstData)
Rewrite the data of an instruction at a given index.
This is used by the specialization pass to rewrite CallGeneric to Call.
The type and span are preserved.
Sourcepub fn push_projections(
&mut self,
projs: impl IntoIterator<Item = AirProjection>,
) -> (u32, u32)
pub fn push_projections( &mut self, projs: impl IntoIterator<Item = AirProjection>, ) -> (u32, u32)
Add projections to the projections array and return (start, len).
Used for PlaceRead and PlaceWrite instructions.
Sourcepub fn get_projections(&self, start: u32, len: u32) -> &[AirProjection]
pub fn get_projections(&self, start: u32, len: u32) -> &[AirProjection]
Get a slice from the projections array.
Sourcepub fn get_place_projections(&self, place: &AirPlace) -> &[AirProjection]
pub fn get_place_projections(&self, place: &AirPlace) -> &[AirProjection]
Get projections for a place.
Sourcepub fn make_place(
&mut self,
base: AirPlaceBase,
projs: impl IntoIterator<Item = AirProjection>,
) -> AirPlaceRef
pub fn make_place( &mut self, base: AirPlaceBase, projs: impl IntoIterator<Item = AirProjection>, ) -> AirPlaceRef
Create a place with the given base and projections.
This adds the projections to the projections array and returns a PlaceRef that references the place.
Sourcepub fn get_place(&self, place_ref: AirPlaceRef) -> &AirPlace
pub fn get_place(&self, place_ref: AirPlaceRef) -> &AirPlace
Get a place by reference.
Sourcepub fn projections(&self) -> &[AirProjection]
pub fn projections(&self) -> &[AirProjection]
Get all projections.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Air
impl RefUnwindSafe for Air
impl Send for Air
impl Sync for Air
impl Unpin for Air
impl UnwindSafe for Air
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more