Struct llvm::Builder [] [src]

pub struct Builder;

This provides a uniform API for creating instructions and inserting them into a basic block.

Methods

impl Builder
[src]

fn new(context: &Context) -> CSemiBox<Builder>

Create a new builder in the context given.

fn position_at_end(&self, block: &BasicBlock)

Position the builder at the end of block.

fn build_ret_void(&self) -> &Value

Build an instruction that returns from the function with void.

fn build_ret(&self, value: &Value) -> &Value

Build an instruction that returns from the function with value.

fn build_array_alloca(&self, elem: &Type, size: &Value) -> &Value

Build an instruction that allocates an array with the element type elem and the size size.

The size of this array will be the size of elem times size.

fn build_alloca(&self, ty: &Type) -> &Value

Build an instruction that allocates a pointer to fit the size of ty then returns this pointer.

fn build_free(&self, val: &Value) -> &Value

Build an instruction that frees the val, which MUST be a pointer that was returned from build_alloca.

fn build_store(&self, val: &Value, ptr: &Value) -> &Value

Build an instruction that store the value val in the pointer ptr.

fn build_br(&self, dest: &BasicBlock) -> &Value

Build an instruction that branches to the block dest.

fn build_cond_br(&self, cond: &Value, if_block: &BasicBlock, else_block: Option<&BasicBlock>) -> &Value

Build an instruction that branches to if_block if cond evaluates to true, and else_block otherwise.

fn build_call(&self, func: &Function, args: &[&Value]) -> &Value

Build an instruction that calls the function func with the arguments args.

This will return the return value of the function.

fn build_tail_call(&self, func: &Function, args: &[&Value]) -> &Value

Build an instruction that calls the function func with the arguments args.

This will return the return value of the function.

fn build_select(&self, cond: &Value, true_val: &Value, false_val: &Value) -> &Value

Build an instruction that yields to true_val if cond is equal to 1, and false_val otherwise.

fn build_bit_cast(&self, value: &Value, dest: &Type) -> &Value

Build an instruction that casts a value into a certain type.

fn build_int_to_ptr(&self, value: &Value, dest: &Type) -> &Value

fn build_zext(&self, value: &Value, dest: &Type) -> &Value

fn build_trunc(&self, value: &Value, dest: &Type) -> &Value

Build an instruction that truncates the high-order bits of value to fit into a certain type.

fn build_insert_value(&self, agg: &Value, elem: &Value, index: usize) -> &Value

Build an instruction that inserts a value into an aggregate data value.

fn build_extract_value(&self, agg: &Value, index: usize) -> &Value

Build an instruction that extracts a value from an aggregate data value.

fn build_gep(&self, pointer: &Value, indices: &[&Value]) -> &Value

Build an instruction that computes the address of a subelement of an aggregate data structure.

Basically type-safe pointer arithmetic.

fn build_switch(&self, value: &Value, default: &BasicBlock, cases: &[(&Value, &BasicBlock)]) -> &Value

Build an instruction that runs whichever block matches the value, or default if none of them matched it.

fn build_load(&self, value: &Value) -> &Value

fn build_neg(&self, value: &Value) -> &Value

fn build_not(&self, value: &Value) -> &Value

fn build_add(&self, left: &Value, right: &Value) -> &Value

fn build_sub(&self, left: &Value, right: &Value) -> &Value

fn build_mul(&self, left: &Value, right: &Value) -> &Value

fn build_div(&self, left: &Value, right: &Value) -> &Value

fn build_shl(&self, left: &Value, right: &Value) -> &Value

fn build_ashr(&self, left: &Value, right: &Value) -> &Value

fn build_and(&self, left: &Value, right: &Value) -> &Value

fn build_or(&self, left: &Value, right: &Value) -> &Value

fn build_cmp(&self, a: &Value, b: &Value, pred: Predicate) -> &Value

Build an instruction to compare two values with the predicate given.

Trait Implementations

impl Eq for Builder
[src]

impl PartialEq<Builder> for Builder
[src]

fn eq(&self, other: &Builder) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Rhs) -> bool
1.0.0

This method tests for !=.

impl<'a> PartialEq<Builder> for &'a Builder
[src]

fn eq(&self, other: &Builder) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Rhs) -> bool
1.0.0

This method tests for !=.

impl<'a> From<LLVMBuilderRef> for &'a Builder
[src]

fn from(ty: LLVMBuilderRef) -> &'a Builder

Performs the conversion.

impl<'a> From<LLVMBuilderRef> for &'a mut Builder
[src]

fn from(ty: LLVMBuilderRef) -> &'a mut Builder

Performs the conversion.

impl DisposeRef for Builder
[src]

type RefTo = LLVMBuilder

What a reference to this type represents as a C pointer.

unsafe fn dispose(ptr: LLVMBuilderRef)

Destroy the contents at the pointer's location. Read more