Class: RLTK::CG::BasicBlock::InstructionCollection
- Includes:
- Enumerable
- Defined in:
- lib/rltk/cg/basic_block.rb
Overview
This class is used to access all of the Instructions that have been added to a RLTK::CG::BasicBlock.
Instance Method Summary collapse
-
#each {|inst| ... } ⇒ Enumerator
Iterate over each Instruction in this collection.
-
#first ⇒ Instruction
First instruction in this collection.
-
#initialize(bb) ⇒ InstructionCollection
constructor
A new instance of InstructionCollection.
-
#last ⇒ Instruction
Last instruction in this collection.
Constructor Details
#initialize(bb) ⇒ InstructionCollection
Returns a new instance of InstructionCollection.
134 135 136 |
# File 'lib/rltk/cg/basic_block.rb', line 134 def initialize(bb) @bb = bb end |
Instance Method Details
#each {|inst| ... } ⇒ Enumerator
Iterate over each Instruction in this collection.
143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/rltk/cg/basic_block.rb', line 143 def each return to_enum(:each) unless block_given? inst = self.first while inst yield inst inst = inst.next end self end |
#first ⇒ Instruction
Returns First instruction in this collection.
157 158 159 |
# File 'lib/rltk/cg/basic_block.rb', line 157 def first if (ptr = Bindings.get_first_instruction(@bb)).null? then nil else Instruction.from_ptr(ptr) end end |
#last ⇒ Instruction
Returns Last instruction in this collection.
162 163 164 |
# File 'lib/rltk/cg/basic_block.rb', line 162 def last if (ptr = Bindings.get_last_instruction(@bb)).null? then nil else Instruction.from_ptr(ptr) end end |