Class: LLVM::Builder
- Inherits:
-
Object
- Object
- LLVM::Builder
- Defined in:
- lib/llvm/core/builder.rb
Class Method Summary collapse
-
.create ⇒ Object
Creates a Builder.
Instance Method Summary collapse
- #add(lhs, rhs, name = "") ⇒ Object
-
#aggregate_ret(*vals) ⇒ Object
Builds a ret instruction returning multiple values.
-
#alloca(ty, name = "") ⇒ Object
Stack allocation.
- #and(lhs, rhs, name = "") ⇒ Object
-
#array_alloca(ty, val, name = "") ⇒ Object
Array stack allocation.
-
#array_malloc(ty, val, name = "") ⇒ Object
Builds a malloc Instruction for the given array type.
-
#ashr(lhs, rhs, name = "") ⇒ Object
Arithmatic shift right.
- #bit_cast(val, ty, name = "") ⇒ Object
-
#br(block) ⇒ Object
Unconditional branching (i.e. goto).
-
#call(fun, *args) ⇒ Object
Builds a call Instruction.
-
#cond(cond, iftrue, iffalse) ⇒ Object
Conditional branching (i.e. if).
-
#dispose ⇒ Object
Disposes the builder.
-
#exact_sdiv(lhs, rhs, name = "") ⇒ Object
Signed exact division.
- #extract_element(vector, index, name = "") ⇒ Object
-
#extract_value(aggregate, index, name = "") ⇒ Object
LLVMinst extractvalue.
- #fadd(lhs, rhs, name = "") ⇒ Object
-
#fcmp(pred, lhs, rhs, name = "") ⇒ Object
Builds an fcmp Instruction.
- #fdiv(lhs, rhs, name = "") ⇒ Object
- #fmul(lhs, rhs, name = "") ⇒ Object
- #fp2si(val, ty, name = "") ⇒ Object
- #fp2ui(val, ty, name = "") ⇒ Object
-
#fp_cast(val, ty, name = "") ⇒ Object
Builds a fp cast Instruction with the given name.
- #fp_ext(val, ty, name = "") ⇒ Object
- #fp_trunc(val, ty, name = "") ⇒ Object
-
#free(pointer) ⇒ Object
Builds a free Instruction.
- #frem(lhs, rhs, name = "") ⇒ Object
- #fsub(lhs, rhs, name = "") ⇒ Object
-
#gep(pointer, indices, name = "") ⇒ Object
Builds a getelementptr Instruction with the given name.
-
#global_string(string, name = "") ⇒ Object
Builds a global string Instruction with the given name.
-
#global_string_pointer(string, name = "") ⇒ Object
Builds a global string Instruction with the given name.
-
#icmp(pred, lhs, rhs, name = "") ⇒ Object
Builds an icmp Instruction.
-
#inbounds_gep(pointer, indices, name = "") ⇒ Object
Builds a inbounds getelementptr Instruction with the given name.
-
#initialize(ptr) ⇒ Builder
constructor
A new instance of Builder.
-
#insert_block ⇒ Object
The BasicBlock at which the Builder is currently positioned.
- #insert_element(vector, elem, index, name = "") ⇒ Object
- #insert_value(aggregate, elem, index, name = "") ⇒ Object
- #int2ptr(val, ty, name = "") ⇒ Object
-
#int_cast(val, ty, name = "") ⇒ Object
Builds a int cast Instruction with the given name.
-
#invoke(fun, args, _then, _catch, name = "") ⇒ Object
Invoke a function which may potentially unwind.
-
#is_not_null(val, name = "") ⇒ Object
Check if a value is not null.
-
#is_null(val, name = "") ⇒ Object
Check if a value is null.
-
#load(pointer, name = "") ⇒ Object
Builds a load Instruction with the given name.
-
#lshr(lhs, rhs, name = "") ⇒ Object
Shifts right with zero fill.
-
#malloc(ty, name = "") ⇒ Object
Builds a malloc Instruction for the given type.
- #mul(lhs, rhs, name = "") ⇒ Object
-
#neg(arg, name = "") ⇒ Object
Integer negation (i.e. multiplication by -1).
-
#not(arg, name = "") ⇒ Object
Boolean negation.
-
#nsw_add(lhs, rhs, name = "") ⇒ Object
No signed wrap addition.
- #or(lhs, rhs, name = "") ⇒ Object
-
#phi(ty, *incoming) ⇒ Object
Builds a Phi node of the given Type with the given incoming branches.
-
#pointer_cast(val, ty, name = "") ⇒ Object
Builds a pointer cast Instruction with the given name.
-
#position(block, instruction) ⇒ Object
Positions the builder at the given Instruction in the given BasicBlock.
-
#position_at_end(block) ⇒ Object
Positions the builder at the end of the given BasicBlock.
-
#position_before(instruction) ⇒ Object
Positions the builder before the given Instruction.
-
#ptr2int(val, ty, name = "") ⇒ Object
Cast a pointer to an int.
-
#ptr_diff(lhs, rhs, name = "") ⇒ Object
Retrieves the pointer difference between the given lhs and rhs.
- #ret(val) ⇒ Object
- #ret_void ⇒ Object
-
#sdiv(lhs, rhs, name = "") ⇒ Object
Signed division.
- #select(_if, _then, _else, name = "") ⇒ Object
- #sext(val, ty, name = "") ⇒ Object
- #sext_or_bit_cast(val, ty, name = "") ⇒ Object
- #shl(lhs, rhs, name = "") ⇒ Object
- #shuffle_vector(vec1, vec2, mask, name = "") ⇒ Object
- #si2fp(val, ty, name = "") ⇒ Object
- #srem(lhs, rhs, name = "") ⇒ Object
-
#store(val, pointer) ⇒ Object
Builds a store Instruction.
-
#struct_gep(pointer, idx, name = "") ⇒ Object
Builds a struct getelementptr Instruction with the given name.
- #sub(lhs, rhs, name = "") ⇒ Object
- #switch(val, default, ncases) ⇒ Object
- #to_ptr ⇒ Object
- #trunc(val, ty, name = "") ⇒ Object
- #trunc_or_bit_cast(val, ty, name = "") ⇒ Object
-
#udiv(lhs, rhs, name = "") ⇒ Object
Unsigned integer division.
- #ui2fp(val, ty, name = "") ⇒ Object
- #unreachable ⇒ Object
-
#unwind ⇒ Object
Builds an unwind Instruction.
- #urem(lhs, rhs, name = "") ⇒ Object
- #va_arg(list, ty, name = "") ⇒ Object
- #xor(lhs, rhs, name = "") ⇒ Object
- #zext(val, ty, name = "") ⇒ Object
- #zext_or_bit_cast(val, ty, name = "") ⇒ Object
Constructor Details
#initialize(ptr) ⇒ Builder
Returns a new instance of Builder.
6 7 8 |
# File 'lib/llvm/core/builder.rb', line 6 def initialize(ptr) @ptr = ptr end |
Class Method Details
.create ⇒ Object
Creates a Builder.
16 17 18 |
# File 'lib/llvm/core/builder.rb', line 16 def self.create new(C.LLVMCreateBuilder()) end |
Instance Method Details
#add(lhs, rhs, name = "") ⇒ Object
105 106 107 |
# File 'lib/llvm/core/builder.rb', line 105 def add(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildAdd(self, lhs, rhs, name)) end |
#aggregate_ret(*vals) ⇒ Object
Builds a ret instruction returning multiple values.
59 60 61 62 63 64 |
# File 'lib/llvm/core/builder.rb', line 59 def aggregate_ret(*vals) FFI::MemoryPointer.new(FFI.type_size(:pointer) * vals.size) do |vals_ptr| vals_ptr.write_array_of_pointer(vals) Instruction.from_ptr(C.LLVMBuildAggregateRet(self, vals_ptr, vals.size)) end end |
#alloca(ty, name = "") ⇒ Object
Stack allocation.
232 233 234 |
# File 'lib/llvm/core/builder.rb', line 232 def alloca(ty, name = "") Instruction.from_ptr(C.LLVMBuildAlloca(self, LLVM::Type(ty), name)) end |
#and(lhs, rhs, name = "") ⇒ Object
196 197 198 |
# File 'lib/llvm/core/builder.rb', line 196 def and(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildAnd(self, lhs, rhs, name)) end |
#array_alloca(ty, val, name = "") ⇒ Object
Array stack allocation
239 240 241 |
# File 'lib/llvm/core/builder.rb', line 239 def array_alloca(ty, val, name = "") Instruction.from_ptr(C.LLVMBuildArrayAlloca(self, LLVM::Type(ty), val, name)) end |
#array_malloc(ty, val, name = "") ⇒ Object
Builds a malloc Instruction for the given array type.
226 227 228 |
# File 'lib/llvm/core/builder.rb', line 226 def array_malloc(ty, val, name = "") Instruction.from_ptr(C.LLVMBuildArrayMalloc(self, LLVM::Type(ty), val, name)) end |
#ashr(lhs, rhs, name = "") ⇒ Object
Arithmatic shift right.
191 192 193 |
# File 'lib/llvm/core/builder.rb', line 191 def ashr(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildAShr(self, lhs, rhs, name)) end |
#bit_cast(val, ty, name = "") ⇒ Object
369 370 371 |
# File 'lib/llvm/core/builder.rb', line 369 def bit_cast(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildBitCast(self, val, LLVM::Type(ty), name)) end |
#br(block) ⇒ Object
Unconditional branching (i.e. goto)
68 69 70 71 |
# File 'lib/llvm/core/builder.rb', line 68 def br(block) Instruction.from_ptr( C.LLVMBuildBr(self, block)) end |
#call(fun, *args) ⇒ Object
Builds a call Instruction. Calls the given Function with the given args (Instructions).
463 464 465 466 467 468 469 470 471 472 473 474 |
# File 'lib/llvm/core/builder.rb', line 463 def call(fun, *args) raise "No fun" if fun.nil? if args.last.kind_of? String name = args.pop else name = "" end args_ptr = FFI::MemoryPointer.new(FFI.type_size(:pointer) * args.size) args_ptr.write_array_of_pointer(args) CallInst.from_ptr(C.LLVMBuildCall(self, fun, args_ptr, args.size, name)) end |
#cond(cond, iftrue, iffalse) ⇒ Object
Conditional branching (i.e. if)
75 76 77 78 |
# File 'lib/llvm/core/builder.rb', line 75 def cond(cond, iftrue, iffalse) Instruction.from_ptr( C.LLVMBuildCondBr(self, cond, iftrue, iffalse)) end |
#dispose ⇒ Object
Disposes the builder.
527 528 529 |
# File 'lib/llvm/core/builder.rb', line 527 def dispose C.LLVMDisposeBuilder(@ptr) end |
#exact_sdiv(lhs, rhs, name = "") ⇒ Object
Signed exact division
154 155 156 |
# File 'lib/llvm/core/builder.rb', line 154 def exact_sdiv(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildExactSDiv(self, lhs, rhs, name)) end |
#extract_element(vector, index, name = "") ⇒ Object
487 488 489 |
# File 'lib/llvm/core/builder.rb', line 487 def extract_element(vector, index, name = "") Instruction.from_ptr(C.LLVMBuildExtractElement(self, vector, index, name)) end |
#extract_value(aggregate, index, name = "") ⇒ Object
LLVMinst extractvalue
502 503 504 |
# File 'lib/llvm/core/builder.rb', line 502 def extract_value(aggregate, index, name = "") Instruction.from_ptr(C.LLVMBuildExtractValue(self, aggregate, index, name)) end |
#fadd(lhs, rhs, name = "") ⇒ Object
116 117 118 |
# File 'lib/llvm/core/builder.rb', line 116 def fadd(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildFAdd(self, lhs, rhs, name)) end |
#fcmp(pred, lhs, rhs, name = "") ⇒ Object
Builds an fcmp Instruction. Compares lhs to rhs (Instructions) as Reals using the given symbol predicate (pred):
:ord - ordered
:uno - unordered: isnan(X) | isnan(Y)
:oeq - ordered and equal to
:oeq - unordered and equal to
:one - ordered and not equal to
:one - unordered and not equal to
:ogt - ordered and greater than
:uge - unordered and greater than or equal to
:olt - ordered and less than
:ule - unordered and less than or equal to
:oge - ordered and greater than or equal to
:sge - unordered and greater than or equal to
:ole - ordered and less than or equal to
:sle - unordered and less than or equal to
:true - always true and folded
:false - always false and folded
442 443 444 |
# File 'lib/llvm/core/builder.rb', line 442 def fcmp(pred, lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildFCmp(self, pred, lhs, rhs, name)) end |
#fdiv(lhs, rhs, name = "") ⇒ Object
159 160 161 |
# File 'lib/llvm/core/builder.rb', line 159 def fdiv(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildFDiv(self, lhs, rhs, name)) end |
#fmul(lhs, rhs, name = "") ⇒ Object
136 137 138 |
# File 'lib/llvm/core/builder.rb', line 136 def fmul(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildFMul(self, lhs, rhs, name)) end |
#fp2si(val, ty, name = "") ⇒ Object
333 334 335 |
# File 'lib/llvm/core/builder.rb', line 333 def fp2si(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildFPToSI(self, val, LLVM::Type(ty), name)) end |
#fp2ui(val, ty, name = "") ⇒ Object
328 329 330 |
# File 'lib/llvm/core/builder.rb', line 328 def fp2ui(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildFPToUI(self, val, LLVM::Type(ty), name)) end |
#fp_cast(val, ty, name = "") ⇒ Object
Builds a fp cast Instruction with the given name.
402 403 404 |
# File 'lib/llvm/core/builder.rb', line 402 def fp_cast(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildFPCast(self, val, LLVM::Type(ty), name)) end |
#fp_ext(val, ty, name = "") ⇒ Object
353 354 355 |
# File 'lib/llvm/core/builder.rb', line 353 def fp_ext(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildFPExt(self, val, LLVM::Type(ty), name)) end |
#fp_trunc(val, ty, name = "") ⇒ Object
348 349 350 |
# File 'lib/llvm/core/builder.rb', line 348 def fp_trunc(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildFPTrunc(self, val, LLVM::Type(ty), name)) end |
#free(pointer) ⇒ Object
Builds a free Instruction. Frees the given pointer (an Instruction).
244 245 246 |
# File 'lib/llvm/core/builder.rb', line 244 def free(pointer) Instruction.from_ptr(C.LLVMBuildFree(self, pointer)) end |
#frem(lhs, rhs, name = "") ⇒ Object
174 175 176 |
# File 'lib/llvm/core/builder.rb', line 174 def frem(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildFRem(self, lhs, rhs, name)) end |
#fsub(lhs, rhs, name = "") ⇒ Object
126 127 128 |
# File 'lib/llvm/core/builder.rb', line 126 def fsub(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildFSub(self, lhs, rhs, name)) end |
#gep(pointer, indices, name = "") ⇒ Object
Builds a getelementptr Instruction with the given name. Retrieves the element pointer at the given indices of the pointer (an Instruction).
266 267 268 269 270 271 272 273 |
# File 'lib/llvm/core/builder.rb', line 266 def gep(pointer, indices, name = "") indices = Array(indices) FFI::MemoryPointer.new(FFI.type_size(:pointer) * indices.size) do |indices_ptr| indices_ptr.write_array_of_pointer(indices) return Instruction.from_ptr( C.LLVMBuildGEP(self, pointer, indices_ptr, indices.size, name)) end end |
#global_string(string, name = "") ⇒ Object
Builds a global string Instruction with the given name. Creates a global string.
302 303 304 |
# File 'lib/llvm/core/builder.rb', line 302 def global_string(string, name = "") Instruction.from_ptr(C.LLVMBuildGlobalString(self, string, name)) end |
#global_string_pointer(string, name = "") ⇒ Object
Builds a global string Instruction with the given name. Creates a global string pointer.
308 309 310 |
# File 'lib/llvm/core/builder.rb', line 308 def global_string_pointer(string, name = "") Instruction.from_ptr(C.LLVMBuildGlobalStringPtr(self, string, name)) end |
#icmp(pred, lhs, rhs, name = "") ⇒ Object
Builds an icmp Instruction. Compares lhs to rhs (Instructions) using the given symbol predicate (pred):
:eq - equal to
:ne - not equal to
:ugt - unsigned greater than
:uge - unsigned greater than or equal to
:ult - unsigned less than
:ule - unsigned less than or equal to
:sgt - signed greater than
:sge - signed greater than or equal to
:slt - signed less than
:sle - signed less than or equal to
419 420 421 |
# File 'lib/llvm/core/builder.rb', line 419 def icmp(pred, lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildICmp(self, pred, lhs, rhs, name)) end |
#inbounds_gep(pointer, indices, name = "") ⇒ Object
Builds a inbounds getelementptr Instruction with the given name. Retrieves the element pointer at the given indices of the pointer (an Instruction). If the indices are outside the allocated pointer the retrieved value is undefined.
281 282 283 284 285 286 287 288 |
# File 'lib/llvm/core/builder.rb', line 281 def inbounds_gep(pointer, indices, name = "") indices = Array(indices) FFI::MemoryPointer.new(FFI.type_size(:pointer) * indices.size) do |indices_ptr| indices_ptr.write_array_of_pointer(indices) return Instruction.from_ptr( C.LLVMBuildInBoundsGEP(self, pointer, indices_ptr, indices.size, name)) end end |
#insert_block ⇒ Object
The BasicBlock at which the Builder is currently positioned.
42 43 44 |
# File 'lib/llvm/core/builder.rb', line 42 def insert_block BasicBlock.from_ptr(C.LLVMGetInsertBlock(self)) end |
#insert_element(vector, elem, index, name = "") ⇒ Object
492 493 494 |
# File 'lib/llvm/core/builder.rb', line 492 def insert_element(vector, elem, index, name = "") Instruction.from_ptr(C.LLVMBuildInsertElement(self, vector, elem, index, name)) end |
#insert_value(aggregate, elem, index, name = "") ⇒ Object
507 508 509 |
# File 'lib/llvm/core/builder.rb', line 507 def insert_value(aggregate, elem, index, name = "") Instruction.from_ptr(C.LLVMBuildInsertValue(self, aggregate, elem, index, name)) end |
#int2ptr(val, ty, name = "") ⇒ Object
364 365 366 |
# File 'lib/llvm/core/builder.rb', line 364 def int2ptr(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildIntToPtr(self, val, LLVM::Type(ty), name)) end |
#int_cast(val, ty, name = "") ⇒ Object
Builds a int cast Instruction with the given name.
397 398 399 |
# File 'lib/llvm/core/builder.rb', line 397 def int_cast(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildIntCast(self, val, LLVM::Type(ty), name)) end |
#invoke(fun, args, _then, _catch, name = "") ⇒ Object
Invoke a function which may potentially unwind
87 88 89 90 91 |
# File 'lib/llvm/core/builder.rb', line 87 def invoke(fun, args, _then, _catch, name = "") Instruction.from_ptr( C.LLVMBuildInvoke(self, fun, args, args.size, _then, _catch, name)) end |
#is_not_null(val, name = "") ⇒ Object
Check if a value is not null.
517 518 519 |
# File 'lib/llvm/core/builder.rb', line 517 def is_not_null(val, name = "") Instruction.from_ptr(C.LLVMBuildIsNotNull(self, val, name)) end |
#is_null(val, name = "") ⇒ Object
Check if a value is null.
512 513 514 |
# File 'lib/llvm/core/builder.rb', line 512 def is_null(val, name = "") Instruction.from_ptr(C.LLVMBuildIsNull(self, val, name)) end |
#load(pointer, name = "") ⇒ Object
Builds a load Instruction with the given name. Loads the value of the given pointer (an Instruction).
251 252 253 |
# File 'lib/llvm/core/builder.rb', line 251 def load(pointer, name = "") Instruction.from_ptr(C.LLVMBuildLoad(self, pointer, name)) end |
#lshr(lhs, rhs, name = "") ⇒ Object
Shifts right with zero fill.
185 186 187 |
# File 'lib/llvm/core/builder.rb', line 185 def lshr(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildLShr(self, lhs, rhs, name)) end |
#malloc(ty, name = "") ⇒ Object
Builds a malloc Instruction for the given type.
221 222 223 |
# File 'lib/llvm/core/builder.rb', line 221 def malloc(ty, name = "") Instruction.from_ptr(C.LLVMBuildMalloc(self, LLVM::Type(ty), name)) end |
#mul(lhs, rhs, name = "") ⇒ Object
131 132 133 |
# File 'lib/llvm/core/builder.rb', line 131 def mul(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildMul(self, lhs, rhs, name)) end |
#neg(arg, name = "") ⇒ Object
Integer negation (i.e. multiplication by -1).
211 212 213 |
# File 'lib/llvm/core/builder.rb', line 211 def neg(arg, name = "") Instruction.from_ptr(C.LLVMBuildNeg(self, arg, name)) end |
#not(arg, name = "") ⇒ Object
Boolean negation.
216 217 218 |
# File 'lib/llvm/core/builder.rb', line 216 def not(arg, name = "") Instruction.from_ptr(C.LLVMBuildNot(self, arg, name)) end |
#nsw_add(lhs, rhs, name = "") ⇒ Object
No signed wrap addition.
111 112 113 |
# File 'lib/llvm/core/builder.rb', line 111 def nsw_add(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildNSWAdd(self, lhs, rhs, name)) end |
#or(lhs, rhs, name = "") ⇒ Object
201 202 203 |
# File 'lib/llvm/core/builder.rb', line 201 def or(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildOr(self, lhs, rhs, name)) end |
#phi(ty, *incoming) ⇒ Object
Builds a Phi node of the given Type with the given incoming branches.
448 449 450 451 452 453 454 455 456 457 458 |
# File 'lib/llvm/core/builder.rb', line 448 def phi(ty, *incoming) if incoming.last.kind_of? String name = incoming.pop else name = "" end phi = Phi.from_ptr(C.LLVMBuildPhi(self, LLVM::Type(ty), name)) phi.add_incoming(*incoming) unless incoming.empty? phi end |
#pointer_cast(val, ty, name = "") ⇒ Object
Builds a pointer cast Instruction with the given name.
392 393 394 |
# File 'lib/llvm/core/builder.rb', line 392 def pointer_cast(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildPointerCast(self, val, LLVM::Type(ty), name)) end |
#position(block, instruction) ⇒ Object
Positions the builder at the given Instruction in the given BasicBlock.
21 22 23 24 25 |
# File 'lib/llvm/core/builder.rb', line 21 def position(block, instruction) raise "Block must not be nil" if block.nil? C.LLVMPositionBuilder(self, block, instruction) self end |
#position_at_end(block) ⇒ Object
Positions the builder at the end of the given BasicBlock.
35 36 37 38 39 |
# File 'lib/llvm/core/builder.rb', line 35 def position_at_end(block) raise "Block must not be nil" if block.nil? C.LLVMPositionBuilderAtEnd(self, block) self end |
#position_before(instruction) ⇒ Object
Positions the builder before the given Instruction.
28 29 30 31 32 |
# File 'lib/llvm/core/builder.rb', line 28 def position_before(instruction) raise "Instruction must not be nil" if instruction.nil? C.LLVMPositionBuilderBefore(self, instruction) self end |
#ptr2int(val, ty, name = "") ⇒ Object
Cast a pointer to an int. Useful for pointer arithmetic.
359 360 361 |
# File 'lib/llvm/core/builder.rb', line 359 def ptr2int(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildPtrToInt(self, val, LLVM::Type(ty), name)) end |
#ptr_diff(lhs, rhs, name = "") ⇒ Object
Retrieves the pointer difference between the given lhs and rhs.
522 523 524 |
# File 'lib/llvm/core/builder.rb', line 522 def ptr_diff(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildPtrDiff(lhs, rhs, name)) end |
#ret(val) ⇒ Object
53 54 55 |
# File 'lib/llvm/core/builder.rb', line 53 def ret(val) Instruction.from_ptr(C.LLVMBuildRet(self, val)) end |
#ret_void ⇒ Object
48 49 50 |
# File 'lib/llvm/core/builder.rb', line 48 def ret_void Instruction.from_ptr(C.LLVMBuildRetVoid(self)) end |
#sdiv(lhs, rhs, name = "") ⇒ Object
Signed division
148 149 150 |
# File 'lib/llvm/core/builder.rb', line 148 def sdiv(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildSDiv(self, lhs, rhs, name)) end |
#select(_if, _then, _else, name = "") ⇒ Object
477 478 479 |
# File 'lib/llvm/core/builder.rb', line 477 def select(_if, _then, _else, name = "") Instruction.from_ptr(C.LLVMBuildSelect(self, _if, _then, _else, name)) end |
#sext(val, ty, name = "") ⇒ Object
323 324 325 |
# File 'lib/llvm/core/builder.rb', line 323 def sext(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildSExt(self, val, LLVM::Type(ty), name)) end |
#sext_or_bit_cast(val, ty, name = "") ⇒ Object
381 382 383 |
# File 'lib/llvm/core/builder.rb', line 381 def sext_or_bit_cast(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildSExtOrBitCast(self, val, LLVM::Type(ty), name)) end |
#shl(lhs, rhs, name = "") ⇒ Object
179 180 181 |
# File 'lib/llvm/core/builder.rb', line 179 def shl(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildShl(self, lhs, rhs, name)) end |
#shuffle_vector(vec1, vec2, mask, name = "") ⇒ Object
497 498 499 |
# File 'lib/llvm/core/builder.rb', line 497 def shuffle_vector(vec1, vec2, mask, name = "") Instruction.from_ptr(C.LLVMBuildShuffleVector(self, vec1, vec2, mask, name)) end |
#si2fp(val, ty, name = "") ⇒ Object
343 344 345 |
# File 'lib/llvm/core/builder.rb', line 343 def si2fp(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildSIToFP(self, val, LLVM::Type(ty), name)) end |
#srem(lhs, rhs, name = "") ⇒ Object
169 170 171 |
# File 'lib/llvm/core/builder.rb', line 169 def srem(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildSRem(self, lhs, rhs, name)) end |
#store(val, pointer) ⇒ Object
Builds a store Instruction. Stores the given Value into the given pointer (an Instruction).
258 259 260 |
# File 'lib/llvm/core/builder.rb', line 258 def store(val, pointer) Instruction.from_ptr(C.LLVMBuildStore(self, val, pointer)) end |
#struct_gep(pointer, idx, name = "") ⇒ Object
Builds a struct getelementptr Instruction with the given name. Retrieves the element pointer at the given indices (idx) of the pointer (an Instruction). See llvm.org/docs/GetElementPtr.html for discussion.
296 297 298 |
# File 'lib/llvm/core/builder.rb', line 296 def struct_gep(pointer, idx, name = "") Instruction.from_ptr(C.LLVMBuildStructGEP(self, pointer, idx, name)) end |
#sub(lhs, rhs, name = "") ⇒ Object
121 122 123 |
# File 'lib/llvm/core/builder.rb', line 121 def sub(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildSub(self, lhs, rhs, name)) end |
#switch(val, default, ncases) ⇒ Object
81 82 83 |
# File 'lib/llvm/core/builder.rb', line 81 def switch(val, default, ncases) SwitchInst.from_ptr(C.LLVMBuildSwitch(self, val, default, ncases)) end |
#to_ptr ⇒ Object
11 12 13 |
# File 'lib/llvm/core/builder.rb', line 11 def to_ptr @ptr end |
#trunc(val, ty, name = "") ⇒ Object
313 314 315 |
# File 'lib/llvm/core/builder.rb', line 313 def trunc(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildTrunc(self, val, LLVM::Type(ty), name)) end |
#trunc_or_bit_cast(val, ty, name = "") ⇒ Object
387 388 389 |
# File 'lib/llvm/core/builder.rb', line 387 def trunc_or_bit_cast(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildTruncOrBitCast(self, val, LLVM::Type(ty), name)) end |
#udiv(lhs, rhs, name = "") ⇒ Object
Unsigned integer division
142 143 144 |
# File 'lib/llvm/core/builder.rb', line 142 def udiv(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildUDiv(self, lhs, rhs, name)) end |
#ui2fp(val, ty, name = "") ⇒ Object
338 339 340 |
# File 'lib/llvm/core/builder.rb', line 338 def ui2fp(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildUIToFP(self, val, LLVM::Type(ty), name)) end |
#unreachable ⇒ Object
100 101 102 |
# File 'lib/llvm/core/builder.rb', line 100 def unreachable Instruction.from_ptr(C.LLVMBuildUnreachable(self)) end |
#unwind ⇒ Object
Builds an unwind Instruction.
95 96 97 |
# File 'lib/llvm/core/builder.rb', line 95 def unwind Instruction.from_ptr(C.LLVMBuildUnwind(self)) end |
#urem(lhs, rhs, name = "") ⇒ Object
164 165 166 |
# File 'lib/llvm/core/builder.rb', line 164 def urem(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildURem(self, lhs, rhs, name)) end |
#va_arg(list, ty, name = "") ⇒ Object
482 483 484 |
# File 'lib/llvm/core/builder.rb', line 482 def va_arg(list, ty, name = "") Instruction.from_ptr(C.LLVMBuildVAArg(self, list, LLVM::Type(ty), name)) end |
#xor(lhs, rhs, name = "") ⇒ Object
206 207 208 |
# File 'lib/llvm/core/builder.rb', line 206 def xor(lhs, rhs, name = "") Instruction.from_ptr(C.LLVMBuildXor(self, lhs, rhs, name)) end |
#zext(val, ty, name = "") ⇒ Object
318 319 320 |
# File 'lib/llvm/core/builder.rb', line 318 def zext(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildZExt(self, val, LLVM::Type(ty), name)) end |
#zext_or_bit_cast(val, ty, name = "") ⇒ Object
375 376 377 |
# File 'lib/llvm/core/builder.rb', line 375 def zext_or_bit_cast(val, ty, name = "") Instruction.from_ptr(C.LLVMBuildZExtOrBitCast(self, val, LLVM::Type(ty), name)) end |