pub struct Air { /* private fields */ }Expand description
The complete AIR for a function.
Implementations§
Source§impl Air
impl Air
Sourcepub fn record_spawn_target(
&mut self,
air_ref: AirRef,
worker_fn: Spur,
arg_type: Type,
return_type: Type,
)
pub fn record_spawn_target( &mut self, air_ref: AirRef, worker_fn: Spur, arg_type: Type, return_type: Type, )
ADR-0084: record codegen bookkeeping for a @spawn site.
Sourcepub fn spawn_target(&self, air_ref: AirRef) -> Option<&SpawnTarget>
pub fn spawn_target(&self, air_ref: AirRef) -> Option<&SpawnTarget>
Look up the bookkeeping recorded for a @spawn site, if any.
Sourcepub fn set_comptime_value_args(
&mut self,
inst_index: u32,
value_args: Vec<ConstValue>,
)
pub fn set_comptime_value_args( &mut self, inst_index: u32, value_args: Vec<ConstValue>, )
Record the comptime value arguments captured at a CallGeneric site.
Indexed by the CallGeneric instruction’s index in instructions.
Sourcepub fn comptime_value_args(&self, inst_index: u32) -> &[ConstValue]
pub fn comptime_value_args(&self, inst_index: u32) -> &[ConstValue]
Retrieve the comptime value arguments captured at the given
CallGeneric site, or an empty slice if none were recorded.
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 remap_bytes_ids<F>(&mut self, map_fn: F)
pub fn remap_bytes_ids<F>(&mut self, map_fn: F)
Remap byte-blob IDs after merging per-function bytes pools into a
single global pool (mirrors remap_string_ids).
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§
Source§impl<'de> Deserialize<'de> for Air
impl<'de> Deserialize<'de> for Air
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Air
impl RefUnwindSafe for Air
impl Send for Air
impl Sync for Air
impl Unpin for Air
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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>
§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
MaybeRef].