# class LLVM::Builder

- LLVM::Builder
- Reference
- Object

##
Defined in:

llvm/builder.cr

##
Constructors

- .new(unwrap : LibLLVM::BuilderRef)

##
Instance Method Summary

- #add(lhs, rhs, name = "")
- #add_handler(catch_switch_ref, handler)
- #alloca(type, name = "")
- #and(lhs, rhs, name = "")
- #ashr(lhs, rhs, name = "")
- #atomicrmw(op, ptr, val, ordering, singlethread)
- #bit_cast(value, type, name = "")
- #br(block)
- #build_catch_ret(pad, basic_block)
- #build_operand_bundle_def(name, values : Array(LLVM::Value))
- #call(type : LLVM::Type, func : LLVM::Function, args : Array(LLVM::Value), name : String, bundle : LLVM::OperandBundleDef)
- #call(type : LLVM::Type, func : LLVM::Function, args : Array(LLVM::Value), name : String = "")
- #call(type : LLVM::Type, func : LLVM::Function, arg : LLVM::Value, name : String = "")
- #call(func : LLVM::Function, args : Array(LLVM::Value), name : String = "", bundle : LLVM::OperandBundleDef = LLVM::OperandBundleDef.null)

  DEPRECATED Pass the function type of `func` as well (equal to `func.function_type`) in order to support LLVM 15+

- #call(type : LLVM::Type, func : LLVM::Function, args : Array(LLVM::Value), bundle : LLVM::OperandBundleDef)
- #call(func : LLVM::Function, name : String = "")

  DEPRECATED Pass the function type of `func` as well (equal to `func.function_type`) in order to support LLVM 15+

- #call(type : LLVM::Type, func : LLVM::Function, name : String = "")
- #call(func : LLVM::Function, arg : LLVM::Value, name : String = "")

  DEPRECATED Pass the function type of `func` as well (equal to `func.function_type`) in order to support LLVM 15+

- #catch_pad(parent_pad, args : Array(LLVM::Value), name = "")
- #catch_switch(parent_pad, basic_block, num_handlers, name = "")
- #clear_current_debug_location
- #cmpxchg(pointer, cmp, new, success_ordering, failure_ordering, singlethread : Bool = false)
- #cond(cond, then_block, else_block)
- #current_debug_location
- #exact_sdiv(lhs, rhs, name = "")
- #extract_value(value, index, name = "")
- #fadd(lhs, rhs, name = "")
- #fcmp(op, lhs, rhs, name = "")
- #fdiv(lhs, rhs, name = "")
- #fence(ordering, singlethread, name = "")
- #finalize
- #fmul(lhs, rhs, name = "")
- #fneg(value, name = "")
- #fp2si(value, type, name = "")
- #fp2ui(value, type, name = "")
- #fpext(value, type, name = "")
- #fptrunc(value, type, name = "")
- #fsub(lhs, rhs, name = "")
- #gep(type : LLVM::Type, value : LLVM::Value, index1 : LLVM::Value, index2 : LLVM::Value, name = "")
- #gep(value : LLVM::Value, indices : Array(LLVM::ValueRef), name = "")

  DEPRECATED Pass the type of `value` as well (equal to `value.type`) in order to support LLVM 15+

- #gep(type : LLVM::Type, value : LLVM::Value, indices : Array(LLVM::ValueRef), name = "")
- #gep(value : LLVM::Value, index1 : LLVM::Value, index2 : LLVM::Value, name = "")

  DEPRECATED Pass the type of `value` as well (equal to `value.type`) in order to support LLVM 15+

- #gep(value : LLVM::Value, index : LLVM::Value, name = "")

  DEPRECATED Pass the type of `value` as well (equal to `value.type`) in order to support LLVM 15+

- #gep(type : LLVM::Type, value : LLVM::Value, index : LLVM::Value, name = "")
- #global_string_pointer(string, name = "")
- #icmp(op, lhs, rhs, name = "")
- #inbounds_gep(type : LLVM::Type, value : LLVM::Value, index1 : LLVM::Value, index2 : LLVM::Value, name = "")
- #inbounds_gep(value : LLVM::Value, indices : Array(LLVM::ValueRef), name = "")

  DEPRECATED Pass the type of `value` as well (equal to `value.type`) in order to support LLVM 15+

- #inbounds_gep(type : LLVM::Type, value : LLVM::Value, indices : Array(LLVM::ValueRef), name = "")
- #inbounds_gep(value : LLVM::Value, index1 : LLVM::Value, index2 : LLVM::Value, name = "")

  DEPRECATED Pass the type of `value` as well (equal to `value.type`) in order to support LLVM 15+

- #inbounds_gep(value : LLVM::Value, index : LLVM::Value, name = "")

  DEPRECATED Pass the type of `value` as well (equal to `value.type`) in order to support LLVM 15+

- #inbounds_gep(type : LLVM::Type, value : LLVM::Value, index : LLVM::Value, name = "")
- #insert_block
- #int2ptr(value, type, name = "")
- #invoke(fn : LLVM::Function, args : Array(LLVM::Value), a_then, a_catch, bundle : LLVM::OperandBundleDef = LLVM::OperandBundleDef.null, name = "")

  DEPRECATED Pass the function type of `fn` as well (equal to `fn.function_type`) in order to support LLVM 15+

- #invoke(type : LLVM::Type, fn : LLVM::Function, args : Array(LLVM::Value), a_then, a_catch, bundle : LLVM::OperandBundleDef, name = "")
- #invoke(type : LLVM::Type, fn : LLVM::Function, args : Array(LLVM::Value), a_then, a_catch, *, name = "")
- #landing_pad(type, personality, clauses, name = "")
- #load(ptr : LLVM::Value, name = "")

  DEPRECATED Pass the pointee of `ptr` as well (equal to `ptr.type.element_type`) in order to support LLVM 15+

- #load(type : LLVM::Type, ptr : LLVM::Value, name = "")
- #load_volatile(ptr : LLVM::Value, name = "")
- #load_volatile(type : LLVM::Type, ptr : LLVM::Value, name = "")
- #lshr(lhs, rhs, name = "")
- #mul(lhs, rhs, name = "")
- #neg(value, name = "")
- #not(value, name = "")
- #or(lhs, rhs, name = "")
- #phi(type, incoming_blocks : Array(LLVM::BasicBlock), incoming_values : Array(LLVM::Value), name = "")
- #phi(type, table : LLVM::PhiTable, name = "")
- #position_at_end(block)
- #ptr2int(value, type, name = "")
- #ret(value)
- #ret
- #sdiv(lhs, rhs, name = "")
- #select(cond, a_then, a_else, name = "")
- #set_current_debug_location(line, column, scope, inlined_at = nil)

  DEPRECATED Call `#set_current_debug_location(metadata, context)` or `#clear_current_debug_location` instead

- #set_current_debug_location(metadata, context : LLVM::Context)
- #set_metadata(value, kind, node)
- #sext(value, type, name = "")
- #shl(lhs, rhs, name = "")
- #si2fp(value, type, name = "")
- #srem(lhs, rhs, name = "")
- #store(value, ptr)
- #store_volatile(value, ptr)
- #sub(lhs, rhs, name = "")
- #switch(value, otherwise, cases)
- #to_unsafe : LibLLVM::BuilderRef
- #trunc(value, type, name = "")
- #udiv(lhs, rhs, name = "")
- #ui2fp(value, type, name = "")
- #unreachable
- #urem(lhs, rhs, name = "")
- #va_arg(list, type, name = "")
- #xor(lhs, rhs, name = "")
- #zext(value, type, name = "")

### Instance methods inherited from class `Reference`

==(other : self)
==(other : JSON::Any)
==(other : YAML::Any)
==(other) ==, dup dup, hash(hasher) hash, initialize initialize, inspect(io : IO) : Nil inspect, object_id : UInt64 object_id, pretty_print(pp) : Nil pretty_print, same?(other : Reference) : Bool
same?(other : Nil) same?, to_s(io : IO) : Nil to_s

### Constructor methods inherited from class `Reference`

new new, unsafe_construct(address : Pointer, *args, **opts) : self unsafe_construct

### Class methods inherited from class `Reference`

pre_initialize(address : Pointer) pre_initialize

### Instance methods inherited from class `Object`

! : Bool !, !=(other) !=, !~(other) !~, ==(other) ==, ===(other : JSON::Any)
===(other : YAML::Any)
===(other) ===, =~(other) =~, as(type : Class) as, as?(type : Class) as?, class class, dup dup, hash(hasher)
hash hash, in?(collection : Object) : Bool
in?(*values : Object) : Bool in?, inspect(io : IO) : Nil
inspect : String inspect, is_a?(type : Class) : Bool is_a?, itself itself, nil? : Bool nil?, not_nil!(message)
not_nil! not_nil!, pretty_inspect(width = 79, newline = "\n", indent = 0) : String pretty_inspect, pretty_print(pp : PrettyPrint) : Nil pretty_print, responds_to?(name : Symbol) : Bool responds_to?, tap(&) tap, to_json(io : IO) : Nil
to_json : String to_json, to_pretty_json(indent : String = " ") : String
to_pretty_json(io : IO, indent : String = " ") : Nil to_pretty_json, to_s(io : IO) : Nil
to_s : String to_s, to_yaml(io : IO) : Nil
to_yaml : String to_yaml, try(&) try, unsafe_as(type : T.class) forall T unsafe_as

### Class methods inherited from class `Object`

from_json(string_or_io, root : String)
from_json(string_or_io) from_json, from_yaml(string_or_io : String | IO) from_yaml

### Macros inherited from class `Object`

class_getter(*names, &block) class_getter, class_getter!(*names) class_getter!, class_getter?(*names, &block) class_getter?, class_property(*names, &block) class_property, class_property!(*names) class_property!, class_property?(*names, &block) class_property?, class_setter(*names) class_setter, def_clone def_clone, def_equals(*fields) def_equals, def_equals_and_hash(*fields) def_equals_and_hash, def_hash(*fields) def_hash, delegate(*methods, to object) delegate, forward_missing_to(delegate) forward_missing_to, getter(*names, &block) getter, getter!(*names) getter!, getter?(*names, &block) getter?, property(*names, &block) property, property!(*names) property!, property?(*names, &block) property?, setter(*names) setter

##
Constructor Detail

def self.new(unwrap : LibLLVM::BuilderRef) #

##
Instance Method Detail

def add(lhs, rhs, name = "") #
def add_handler(catch_switch_ref, handler) #
def alloca(type, name = "") #
def and(lhs, rhs, name = "") #
def ashr(lhs, rhs, name = "") #
def atomicrmw(op, ptr, val, ordering, singlethread) #
def bit_cast(value, type, name = "") #
def br(block) #
def build_catch_ret(pad, basic_block) #
def build_operand_bundle_def(name, values : Array(LLVM::Value)) #
def call(type : LLVM::Type, func : LLVM::Function, args : Array(LLVM::Value), name : String, bundle : LLVM::OperandBundleDef) #
def call(type : LLVM::Type, func : LLVM::Function, args : Array(LLVM::Value), name : String = "") #
def call(type : LLVM::Type, func : LLVM::Function, arg : LLVM::Value, name : String = "") #
def call(func : LLVM::Function, args : Array(LLVM::Value), name : String = "", bundle : LLVM::OperandBundleDef = LLVM::OperandBundleDef.null) #

DEPRECATED Pass the function type of `func` as well (equal to `func.function_type`) in order to support LLVM 15+

def call(type : LLVM::Type, func : LLVM::Function, args : Array(LLVM::Value), bundle : LLVM::OperandBundleDef) #
def call(func : LLVM::Function, name : String = "") #

DEPRECATED Pass the function type of `func` as well (equal to `func.function_type`) in order to support LLVM 15+

def call(type : LLVM::Type, func : LLVM::Function, name : String = "") #
def call(func : LLVM::Function, arg : LLVM::Value, name : String = "") #

DEPRECATED Pass the function type of `func` as well (equal to `func.function_type`) in order to support LLVM 15+

def catch_pad(parent_pad, args : Array(LLVM::Value), name = "") #
def catch_switch(parent_pad, basic_block, num_handlers, name = "") #
def clear_current_debug_location #
def cmpxchg(pointer, cmp, new, success_ordering, failure_ordering, singlethread : Bool = false) #
def cond(cond, then_block, else_block) #
def current_debug_location #
def exact_sdiv(lhs, rhs, name = "") #
def extract_value(value, index, name = "") #
def fadd(lhs, rhs, name = "") #
def fcmp(op, lhs, rhs, name = "") #
def fdiv(lhs, rhs, name = "") #
def fence(ordering, singlethread, name = "") #
def finalize #
def fmul(lhs, rhs, name = "") #
def fneg(value, name = "") #
def fp2si(value, type, name = "") #
def fp2ui(value, type, name = "") #
def fpext(value, type, name = "") #
def fptrunc(value, type, name = "") #
def fsub(lhs, rhs, name = "") #
def gep(type : LLVM::Type, value : LLVM::Value, index1 : LLVM::Value, index2 : LLVM::Value, name = "") #
def gep(value : LLVM::Value, indices : Array(LLVM::ValueRef), name = "") #

DEPRECATED Pass the type of `value` as well (equal to `value.type`) in order to support LLVM 15+

def gep(type : LLVM::Type, value : LLVM::Value, indices : Array(LLVM::ValueRef), name = "") #
def gep(value : LLVM::Value, index1 : LLVM::Value, index2 : LLVM::Value, name = "") #

DEPRECATED Pass the type of `value` as well (equal to `value.type`) in order to support LLVM 15+

def gep(value : LLVM::Value, index : LLVM::Value, name = "") #

DEPRECATED Pass the type of `value` as well (equal to `value.type`) in order to support LLVM 15+

def gep(type : LLVM::Type, value : LLVM::Value, index : LLVM::Value, name = "") #
def global_string_pointer(string, name = "") #
def icmp(op, lhs, rhs, name = "") #
def inbounds_gep(type : LLVM::Type, value : LLVM::Value, index1 : LLVM::Value, index2 : LLVM::Value, name = "") #
def inbounds_gep(value : LLVM::Value, indices : Array(LLVM::ValueRef), name = "") #

DEPRECATED Pass the type of `value` as well (equal to `value.type`) in order to support LLVM 15+

def inbounds_gep(type : LLVM::Type, value : LLVM::Value, indices : Array(LLVM::ValueRef), name = "") #
def inbounds_gep(value : LLVM::Value, index1 : LLVM::Value, index2 : LLVM::Value, name = "") #

DEPRECATED Pass the type of `value` as well (equal to `value.type`) in order to support LLVM 15+

def inbounds_gep(value : LLVM::Value, index : LLVM::Value, name = "") #

DEPRECATED Pass the type of `value` as well (equal to `value.type`) in order to support LLVM 15+

def inbounds_gep(type : LLVM::Type, value : LLVM::Value, index : LLVM::Value, name = "") #
def insert_block #
def int2ptr(value, type, name = "") #
def invoke(fn : LLVM::Function, args : Array(LLVM::Value), a_then, a_catch, bundle : LLVM::OperandBundleDef = LLVM::OperandBundleDef.null, name = "") #

DEPRECATED Pass the function type of `fn` as well (equal to `fn.function_type`) in order to support LLVM 15+

def invoke(type : LLVM::Type, fn : LLVM::Function, args : Array(LLVM::Value), a_then, a_catch, bundle : LLVM::OperandBundleDef, name = "") #
def invoke(type : LLVM::Type, fn : LLVM::Function, args : Array(LLVM::Value), a_then, a_catch, *, name = "") #
def landing_pad(type, personality, clauses, name = "") #
def load(ptr : LLVM::Value, name = "") #

DEPRECATED Pass the pointee of `ptr` as well (equal to `ptr.type.element_type`) in order to support LLVM 15+

def load(type : LLVM::Type, ptr : LLVM::Value, name = "") #
def load_volatile(ptr : LLVM::Value, name = "") #
def load_volatile(type : LLVM::Type, ptr : LLVM::Value, name = "") #
def lshr(lhs, rhs, name = "") #
def mul(lhs, rhs, name = "") #
def neg(value, name = "") #
def not(value, name = "") #
def or(lhs, rhs, name = "") #
def phi(type, incoming_blocks : Array(LLVM::BasicBlock), incoming_values : Array(LLVM::Value), name = "") #
def phi(type, table : LLVM::PhiTable, name = "") #
def position_at_end(block) #
def ptr2int(value, type, name = "") #
def ret(value) #
def ret #
def sdiv(lhs, rhs, name = "") #
def select(cond, a_then, a_else, name = "") #
def set_current_debug_location(line, column, scope, inlined_at = nil) #

DEPRECATED Call `#set_current_debug_location(metadata, context)` or `#clear_current_debug_location` instead

def set_current_debug_location(metadata, context : LLVM::Context) #
def set_metadata(value, kind, node) #
def sext(value, type, name = "") #
def shl(lhs, rhs, name = "") #
def si2fp(value, type, name = "") #
def srem(lhs, rhs, name = "") #
def store(value, ptr) #
def store_volatile(value, ptr) #
def sub(lhs, rhs, name = "") #
def switch(value, otherwise, cases) #
def to_unsafe : LibLLVM::BuilderRef #
def trunc(value, type, name = "") #
def udiv(lhs, rhs, name = "") #
def ui2fp(value, type, name = "") #
def unreachable #
def urem(lhs, rhs, name = "") #
def va_arg(list, type, name = "") #
def xor(lhs, rhs, name = "") #
def zext(value, type, name = "") #