Class: LLVM::BasicBlock::InstructionCollection
- Inherits:
-
Object
- Object
- LLVM::BasicBlock::InstructionCollection
- Includes:
- Enumerable
- Defined in:
- lib/llvm/core/value.rb
Instance Method Summary collapse
-
#each ⇒ Object
Iterates through each Instruction in the collection.
-
#first ⇒ Object
Returns the first Instruction in the collection.
-
#initialize(block) ⇒ InstructionCollection
constructor
A new instance of InstructionCollection.
-
#last ⇒ Object
Returns the last Instruction in the collection.
Constructor Details
#initialize(block) ⇒ InstructionCollection
Returns a new instance of InstructionCollection.
130 131 132 |
# File 'lib/llvm/core/value.rb', line 130 def initialize(block) @block = block end |
Instance Method Details
#each ⇒ Object
Iterates through each Instruction in the collection.
135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/llvm/core/value.rb', line 135 def each return to_enum :each unless block_given? inst, last = first, last while inst yield inst break if inst == last inst = inst.next end self end |
#first ⇒ Object
Returns the first Instruction in the collection.
149 150 151 152 |
# File 'lib/llvm/core/value.rb', line 149 def first ptr = C.get_first_instruction(@block) LLVM::Instruction.from_ptr(ptr) unless ptr.null? end |
#last ⇒ Object
Returns the last Instruction in the collection.
155 156 157 158 |
# File 'lib/llvm/core/value.rb', line 155 def last ptr = C.get_last_instruction(@block) LLVM::Instruction.from_ptr(ptr) unless ptr.null? end |