Class: LLVM::Phi
- Inherits:
-
Instruction
- Object
- Value
- User
- Instruction
- LLVM::Phi
- Defined in:
- lib/llvm/core/value.rb
Instance Method Summary collapse
-
#add_incoming(incoming) ⇒ Object
Add incoming branches to a phi node by passing an alternating list of resulting values and BasicBlocks.
Methods inherited from Instruction
Methods inherited from User
Methods inherited from Value
#==, #add_attribute, #constant?, #dump, #eql?, from_ptr, #hash, #name, #name=, #null?, to_ptr, #to_ptr, type, #type, #undefined?
Instance Method Details
#add_incoming(incoming) ⇒ Object
Add incoming branches to a phi node by passing an alternating list of resulting values and BasicBlocks. e.g.
phi.add_incoming(val1, block1, val2, block2, ...)
757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 |
# File 'lib/llvm/core/value.rb', line 757 def add_incoming(incoming) blks = incoming.keys vals = incoming.values_at(*blks) size = incoming.size FFI::MemoryPointer.new(FFI.type_size(:pointer) * size) do |vals_ptr| vals_ptr.write_array_of_pointer(vals) FFI::MemoryPointer.new(FFI.type_size(:pointer) * size) do |blks_ptr| blks_ptr.write_array_of_pointer(blks) C.LLVMAddIncoming(self, vals_ptr, blks_ptr, vals.size) end end nil end |