pub struct IRBuilder<'llvm> { /* private fields */ }
Expand description

Wrapper for a LLVM IR Builder.

Implementations§

source§

impl<'llvm> IRBuilder<'llvm>

source

pub fn with_ctx(module: &'llvm Module) -> IRBuilder<'llvm>

Create a new LLVM IR Builder with the modules context.

Panics

Panics if creating the IR Builder fails.

source

pub fn pos_at_end(&self, bb: BasicBlock<'llvm>)

Position the IR Builder at the end of the given Basic Block.

source

pub fn get_insert_block(&self) -> BasicBlock<'llvm>

Get the BasicBlock the IRBuilder currently inputs into.

Panics

Panics if LLVM API returns a null pointer.

source

pub fn fadd(&self, lhs: Value<'llvm>, rhs: Value<'llvm>) -> Value<'llvm>

Emit a fadd instruction.

Panics

Panics if LLVM API returns a null pointer.

source

pub fn fsub(&self, lhs: Value<'llvm>, rhs: Value<'llvm>) -> Value<'llvm>

Emit a fsub instruction.

Panics

Panics if LLVM API returns a null pointer.

source

pub fn fmul(&self, lhs: Value<'llvm>, rhs: Value<'llvm>) -> Value<'llvm>

Emit a fmul instruction.

Panics

Panics if LLVM API returns a null pointer.

source

pub fn fcmpult(&self, lhs: Value<'llvm>, rhs: Value<'llvm>) -> Value<'llvm>

Emit a fcmpult instruction.

Panics

Panics if LLVM API returns a null pointer.

source

pub fn fcmpone(&self, lhs: Value<'llvm>, rhs: Value<'llvm>) -> Value<'llvm>

Emit a fcmpone instruction.

Panics

Panics if LLVM API returns a null pointer.

source

pub fn uitofp(&self, val: Value<'llvm>, dest_type: Type<'llvm>) -> Value<'llvm>

Emit a uitofp instruction.

Panics

Panics if LLVM API returns a null pointer.

source

pub fn call( &self, fn_value: FnValue<'llvm>, args: &mut [Value<'llvm>] ) -> Value<'llvm>

Emit a call instruction.

Panics

Panics if LLVM API returns a null pointer.

source

pub fn ret(&self, ret: Value<'llvm>)

Emit a ret instruction.

Panics

Panics if LLVM API returns a null pointer.

source

pub fn br(&self, dest: BasicBlock<'llvm>)

Emit an unconditional br instruction.

Panics

Panics if LLVM API returns a null pointer.

source

pub fn cond_br( &self, cond: Value<'llvm>, then: BasicBlock<'llvm>, else_: BasicBlock<'llvm> )

Emit a conditional br instruction.

Panics

Panics if LLVM API returns a null pointer.

source

pub fn phi( &self, phi_type: Type<'llvm>, incoming: &[(Value<'llvm>, BasicBlock<'llvm>)] ) -> PhiValue<'llvm>

Emit a phi instruction.

Panics

Panics if LLVM API returns a null pointer.

Trait Implementations§

source§

impl Drop for IRBuilder<'_>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'llvm> RefUnwindSafe for IRBuilder<'llvm>

§

impl<'llvm> !Send for IRBuilder<'llvm>

§

impl<'llvm> !Sync for IRBuilder<'llvm>

§

impl<'llvm> Unpin for IRBuilder<'llvm>

§

impl<'llvm> UnwindSafe for IRBuilder<'llvm>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere 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 Twhere 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.