Struct llvm_ir::types::Types

source ·
pub struct Types { /* private fields */ }
Expand description

Holds a reference to all of the Types used in the Module, and facilitates lookups so you can get a TypeRef to the Type you want.

Implementations§

source§

impl Types

source

pub fn type_of<T: Typed + ?Sized>(&self, t: &T) -> TypeRef

Get the type of anything that is Typed

source

pub fn void(&self) -> TypeRef

Get the void type

source

pub fn int(&self, bits: u32) -> TypeRef

Get the integer type of the specified size (in bits)

source

pub fn bool(&self) -> TypeRef

Get the boolean type (i1)

source

pub fn i8(&self) -> TypeRef

Get the 8-bit integer type

source

pub fn i16(&self) -> TypeRef

Get the 16-bit integer type

source

pub fn i32(&self) -> TypeRef

Get the 32-bit integer type

source

pub fn i64(&self) -> TypeRef

Get the 64-bit integer type

source

pub fn pointer_to(&self, pointee_type: TypeRef) -> TypeRef

Get a pointer type in the default address space (0)

source

pub fn pointer_in_addr_space( &self, pointee_type: TypeRef, addr_space: AddrSpace ) -> TypeRef

Get a pointer type in the specified address space

source

pub fn fp(&self, fpt: FPType) -> TypeRef

Get a floating-point type

source

pub fn single(&self) -> TypeRef

Get the single-precision floating-point type

source

pub fn double(&self) -> TypeRef

Get the double-precision floating-point type

source

pub fn func_type( &self, result_type: TypeRef, param_types: Vec<TypeRef>, is_var_arg: bool ) -> TypeRef

Get a function type

source

pub fn vector_of(&self, element_type: TypeRef, num_elements: usize) -> TypeRef

source

pub fn array_of(&self, element_type: TypeRef, num_elements: usize) -> TypeRef

Get an array type

source

pub fn struct_of(&self, element_types: Vec<TypeRef>, is_packed: bool) -> TypeRef

Get a struct type

source

pub fn named_struct(&self, name: &str) -> TypeRef

Get the TypeRef for the struct with the given name.

Note that this gives a NamedStructType. To get the actual definition of a named struct (the NamedStructDef), use named_struct_def().

source

pub fn named_struct_def(&self, name: &str) -> Option<&NamedStructDef>

Get the NamedStructDef for the struct with the given name, or None if there is no struct by that name.

Note that this gives a NamedStructDef. To get the NamedStructType for a name, use named_struct().

source

pub fn all_struct_names(&self) -> impl Iterator<Item = &String>

Get the names of all the named structs

source

pub fn add_named_struct_def(&mut self, name: String, def: NamedStructDef)

Add the given NamedStructDef as the definition of the struct with the given name.

Panics if that name already had a definition.

source

pub fn remove_named_struct_def(&mut self, name: &str) -> bool

Remove the definition of the struct with the given name.

Returns true if the definition was removed, or false if no definition existed.

source

pub fn x86_mmx(&self) -> TypeRef

Get the X86_MMX type

source

pub fn metadata_type(&self) -> TypeRef

Get the metadata type

source

pub fn label_type(&self) -> TypeRef

Get the label type

source

pub fn token_type(&self) -> TypeRef

Get the token type

source

pub fn get_for_type(&self, ty: &Type) -> TypeRef

Get a TypeRef for the given Type

source§

impl Types

source

pub fn blank_for_testing() -> Self

Get a blank Types containing essentially no types. This function is intended only for use in testing; it’s probably not useful otherwise.

Trait Implementations§

source§

impl Clone for Types

source§

fn clone(&self) -> Types

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

Auto Trait Implementations§

§

impl RefUnwindSafe for Types

§

impl Send for Types

§

impl Sync for Types

§

impl Unpin for Types

§

impl UnwindSafe for Types

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where 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 T
where 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 T
where 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 T
where 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.