Struct Func

Source
pub struct Func<'a>(pub Value<'a>);
Expand description

Functions

Tuple Fields§

§0: Value<'a>

Implementations§

Source§

impl<'a> Func<'a>

Source

pub fn name(self) -> Result<&'a str, Error>

Get the name of a value

Source

pub fn param_count(self) -> usize

Get the number of params

Source

pub fn func_type(self) -> Result<FuncType<'a>, Error>

Get the FuncType

Source

pub fn param(self, i: usize) -> Result<Value<'a>, Error>

Get a single param by index

Source

pub fn params(self) -> Vec<Value<'a>>

Get all params

Source

pub fn verify(self) -> Result<(), Error>

Verify the function, returning an error on failure

Source

pub fn next_function(self) -> Result<Func<'a>, Error>

Get the next function

Source

pub fn prev_function(self) -> Result<Func<'a>, Error>

Get the previous function

Source

pub fn delete(self)

Delete a function

Source

pub fn has_personality_fn(self) -> bool

Returns true when the value has a personality_fn

Source

pub fn personality_fn(self) -> Result<Value<'a>, Error>

Returns the personality_fn

Source

pub fn set_personality_fn(&mut self, f: impl AsRef<Value<'a>>)

Set the personality_fn

Source

pub fn gc(self) -> Option<&'a str>

Get garbage collection scheme name

Source

pub fn set_gc(&mut self, name: impl AsRef<str>)

Set garbage collection scheme name

Source

pub fn call_conv(self) -> CallConv

Get calling convention

Source

pub fn set_call_conv(&mut self, conv: CallConv)

Set calling convention

Source

pub fn add_attribute(&mut self, index: AttributeIndex, attr: &Attribute<'a>)

Set attribute

Source

pub fn remove_enum_atribute(&mut self, index: AttributeIndex, kind_id: u32)

Remove an enum attribute

Source

pub fn remove_string_atribute( &mut self, index: AttributeIndex, k: impl AsRef<str>, )

Remove a string attribute

Source

pub fn attributes(self, index: usize) -> Vec<Attribute<'a>>

Get all attributes

Source

pub fn inline_asm_intel( t: impl AsRef<Type<'a>>, s: impl AsRef<str>, constraints: impl AsRef<str>, has_side_effects: bool, is_align_stack: bool, can_throw: bool, ) -> Result<Value<'a>, Error>

Create specified uniqued inline asm string (intel syntax)

Source

pub fn inline_asm_att( t: impl AsRef<Type<'a>>, s: impl AsRef<str>, constraints: impl AsRef<str>, has_side_effects: bool, is_align_stack: bool, can_throw: bool, ) -> Result<Value<'a>, Error>

Create specified uniqued inline asm string (att syntax)

Source

pub fn alignment(self) -> usize

Get value alignment

Source

pub fn set_alignment(&mut self, align: usize)

Set value alignment

Source

pub fn global_linkage(self) -> Linkage

Get global linkage

Source

pub fn set_global_linkage(&mut self, l: Linkage)

Set global linkage

Source

pub fn global_visibility(self) -> Visibility

Get global visibility

Source

pub fn set_global_visibility(&mut self, l: Visibility)

Set global visibility

Source

pub fn count_basic_blocks(self) -> usize

Count the number of basic blocks

Source

pub fn basic_blocks(self) -> Vec<BasicBlock<'a>>

Get a list of all basic blocks

Source

pub fn first_basic_block(self) -> Result<BasicBlock<'a>, Error>

Get first basic block

Source

pub fn last_basic_block(self) -> Result<BasicBlock<'a>, Error>

Get last basic block

Source

pub fn entry_basic_block(self) -> Result<BasicBlock<'a>, Error>

Get entry block

Source

pub fn append_basic_block(self, bb: BasicBlock<'a>)

Append a new block

Trait Implementations§

Source§

impl<'a> AsRef<Value<'a>> for Func<'a>

Source§

fn as_ref(&self) -> &Value<'a>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a> Clone for Func<'a>

Source§

fn clone(&self) -> Func<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> From<Func<'a>> for Value<'a>

Source§

fn from(x: Func<'a>) -> Value<'a>

Converts to this type from the input type.
Source§

impl<'a> Copy for Func<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Func<'a>

§

impl<'a> RefUnwindSafe for Func<'a>

§

impl<'a> !Send for Func<'a>

§

impl<'a> !Sync for Func<'a>

§

impl<'a> Unpin for Func<'a>

§

impl<'a> UnwindSafe for Func<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

Source§

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>,

Source§

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.