pub struct Context {
pub constants: Vec<ConstantData>,
pub void_ty: TypeId,
pub i1_ty: TypeId,
pub i8_ty: TypeId,
pub i16_ty: TypeId,
pub i32_ty: TypeId,
pub i64_ty: TypeId,
pub f32_ty: TypeId,
pub f64_ty: TypeId,
pub ptr_ty: TypeId,
pub label_ty: TypeId,
/* private fields */
}Expand description
Public API for Context.
Fields§
§constants: Vec<ConstantData>Constant pool.
void_ty: TypeIdPublic API for void_ty.
i1_ty: TypeIdPublic API for i1_ty.
i8_ty: TypeIdPublic API for i8_ty.
i16_ty: TypeIdPublic API for i16_ty.
i32_ty: TypeIdPublic API for i32_ty.
i64_ty: TypeIdPublic API for i64_ty.
f32_ty: TypeIdPublic API for f32_ty.
f64_ty: TypeIdPublic API for f64_ty.
ptr_ty: TypeIdPublic API for ptr_ty.
label_ty: TypeIdPublic API for label_ty.
Implementations§
Source§impl Context
impl Context
Sourcepub fn mk_metadata(&mut self) -> TypeId
pub fn mk_metadata(&mut self) -> TypeId
Public API for mk_metadata.
Sourcepub fn mk_vector(&mut self, element: TypeId, len: u32, scalable: bool) -> TypeId
pub fn mk_vector(&mut self, element: TypeId, len: u32, scalable: bool) -> TypeId
Public API for mk_vector.
Sourcepub fn mk_fn_type(
&mut self,
ret: TypeId,
params: Vec<TypeId>,
variadic: bool,
) -> TypeId
pub fn mk_fn_type( &mut self, ret: TypeId, params: Vec<TypeId>, variadic: bool, ) -> TypeId
Public API for mk_fn_type.
Sourcepub fn mk_struct_anon(&mut self, fields: Vec<TypeId>, packed: bool) -> TypeId
pub fn mk_struct_anon(&mut self, fields: Vec<TypeId>, packed: bool) -> TypeId
Public API for mk_struct_anon.
Sourcepub fn mk_struct_named(&mut self, name: String) -> TypeId
pub fn mk_struct_named(&mut self, name: String) -> TypeId
Create or look up a named struct. If the name is new, an opaque (empty-body)
struct is allocated. Call define_struct_body to fill in fields later.
Sourcepub fn define_struct_body(
&mut self,
id: TypeId,
fields: Vec<TypeId>,
packed: bool,
)
pub fn define_struct_body( &mut self, id: TypeId, fields: Vec<TypeId>, packed: bool, )
Fill in the body of a previously-created named struct.
Sourcepub fn get_named_struct(&self, name: &str) -> Option<TypeId>
pub fn get_named_struct(&self, name: &str) -> Option<TypeId>
Look up a named struct by name.
Sourcepub fn get_type_mut(&mut self, id: TypeId) -> &mut TypeData
pub fn get_type_mut(&mut self, id: TypeId) -> &mut TypeData
Public API for get_type_mut.
Sourcepub fn types(&self) -> impl Iterator<Item = (TypeId, &TypeData)>
pub fn types(&self) -> impl Iterator<Item = (TypeId, &TypeData)>
Iterate over all (TypeId, TypeData) pairs.
Sourcepub fn const_float(&mut self, ty: TypeId, bits: u64) -> ConstId
pub fn const_float(&mut self, ty: TypeId, bits: u64) -> ConstId
Store a float constant as raw bits (f32 bits in low 32 for Single, full u64 bits for Double / other).
Sourcepub fn const_null(&mut self, ty: TypeId) -> ConstId
pub fn const_null(&mut self, ty: TypeId) -> ConstId
Public API for const_null.
Sourcepub fn const_undef(&mut self, ty: TypeId) -> ConstId
pub fn const_undef(&mut self, ty: TypeId) -> ConstId
Public API for const_undef.
Sourcepub fn const_poison(&mut self, ty: TypeId) -> ConstId
pub fn const_poison(&mut self, ty: TypeId) -> ConstId
Public API for const_poison.
Sourcepub fn const_zero(&mut self, ty: TypeId) -> ConstId
pub fn const_zero(&mut self, ty: TypeId) -> ConstId
Public API for const_zero.
Sourcepub fn push_const(&mut self, c: ConstantData) -> ConstId
pub fn push_const(&mut self, c: ConstantData) -> ConstId
Push a complex (non-scalar) constant without deduplication.
Sourcepub fn get_const(&self, id: ConstId) -> &ConstantData
pub fn get_const(&self, id: ConstId) -> &ConstantData
Public API for get_const.
Sourcepub fn type_of_const(&self, id: ConstId) -> TypeId
pub fn type_of_const(&self, id: ConstId) -> TypeId
Public API for type_of_const.