Class: Optimize::IR::BasicBlock
- Inherits:
-
Object
- Object
- Optimize::IR::BasicBlock
- Defined in:
- lib/optimize/ir/basic_block.rb
Overview
One basic block in a function’s CFG: a maximal straight-line sequence of instructions with one entry (first instruction) and one exit (last instruction is a branch, leave, or falls through).
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#instructions ⇒ Object
Returns the value of attribute instructions.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(id:, instructions: []) ⇒ BasicBlock
constructor
A new instance of BasicBlock.
- #terminator ⇒ Object
Constructor Details
#initialize(id:, instructions: []) ⇒ BasicBlock
Returns a new instance of BasicBlock.
12 13 14 15 |
# File 'lib/optimize/ir/basic_block.rb', line 12 def initialize(id:, instructions: []) @id = id @instructions = instructions end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
9 10 11 |
# File 'lib/optimize/ir/basic_block.rb', line 9 def id @id end |
#instructions ⇒ Object
Returns the value of attribute instructions.
10 11 12 |
# File 'lib/optimize/ir/basic_block.rb', line 10 def instructions @instructions end |
Instance Method Details
#empty? ⇒ Boolean
21 22 23 |
# File 'lib/optimize/ir/basic_block.rb', line 21 def empty? @instructions.empty? end |
#terminator ⇒ Object
17 18 19 |
# File 'lib/optimize/ir/basic_block.rb', line 17 def terminator @instructions.last end |