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.