Class: LLVM::BasicBlock
Defined Under Namespace
Classes: InstructionCollection
Instance Attribute Summary
Attributes included from PointerIdentity
Class Method Summary collapse
-
.create(fun = nil, name = "") ⇒ Object
Creates a basic block for the given function with the given name.
Instance Method Summary collapse
-
#build(builder = nil) ⇒ Object
Build the basic block with the given builder.
-
#first_instruction ⇒ Object
deprecated.
-
#instructions ⇒ Object
Returns an Enumerable of the Instructions in the current block.
-
#last_instruction ⇒ Object
deprecated.
-
#next ⇒ Object
Returns the next basic block in the sequence.
-
#parent ⇒ Object
Returns the parent of this basic block (a Function).
-
#previous ⇒ Object
Returns the previous basic block in the sequence.
Methods inherited from Value
#add_attribute, #allocated_type, #allocated_type?, #constant?, #dump, from_ptr, from_ptr_kind, #gep_source_element_type, #gep_source_element_type?, #global_parent, #kind, #name, #name=, #null?, #poison?, #remove_attribute, to_ptr, #to_s, type, #type, #undef?
Methods included from PointerIdentity
Class Method Details
.create(fun = nil, name = "") ⇒ Object
Creates a basic block for the given function with the given name.
192 193 194 |
# File 'lib/llvm/core/value.rb', line 192 def self.create(fun = nil, name = "") from_ptr(C.append_basic_block(fun, name)) end |
Instance Method Details
#build(builder = nil) ⇒ Object
Build the basic block with the given builder. Creates a new one if nil. Yields the builder.
197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/llvm/core/value.rb', line 197 def build(builder = nil) if builder.nil? builder = Builder.new builder.position_at_end(self) yield builder builder.dispose else builder.position_at_end(self) yield builder end end |
#first_instruction ⇒ Object
deprecated
228 229 230 |
# File 'lib/llvm/core/value.rb', line 228 def first_instruction instructions.first end |
#instructions ⇒ Object
Returns an Enumerable of the Instructions in the current block.
238 239 240 |
# File 'lib/llvm/core/value.rb', line 238 def instructions @instructions ||= InstructionCollection.new(self) end |
#last_instruction ⇒ Object
deprecated
233 234 235 |
# File 'lib/llvm/core/value.rb', line 233 def last_instruction instructions.last end |
#next ⇒ Object
Returns the next basic block in the sequence.
216 217 218 219 |
# File 'lib/llvm/core/value.rb', line 216 def next ptr = C.get_next_basic_block(self) BasicBlock.from_ptr(ptr) unless ptr.null? end |
#parent ⇒ Object
Returns the parent of this basic block (a Function).
210 211 212 213 |
# File 'lib/llvm/core/value.rb', line 210 def parent fp = C.get_basic_block_parent(self) LLVM::Function.from_ptr(fp) unless fp.null? end |
#previous ⇒ Object
Returns the previous basic block in the sequence.
222 223 224 225 |
# File 'lib/llvm/core/value.rb', line 222 def previous ptr = C.get_previous_basic_block(self) BasicBlock.from_ptr(ptr) unless ptr.null? end |