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.
232 233 234 |
# File 'lib/llvm/core/value.rb', line 232 def initialize(block) @block = block end |
Instance Method Details
#each ⇒ Object
Iterates through each Instruction in the collection.
237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/llvm/core/value.rb', line 237 def each return to_enum :each unless block_given? inst = first final = last while inst yield inst break if inst == final inst = inst.next end self end |
#first ⇒ Object
Returns the first Instruction in the collection.
252 253 254 255 |
# File 'lib/llvm/core/value.rb', line 252 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.
258 259 260 261 |
# File 'lib/llvm/core/value.rb', line 258 def last ptr = C.get_last_instruction(@block) LLVM::Instruction.from_ptr(ptr) unless ptr.null? end |