Class: Kumi::IR::Loop::Passes::Support::Nest

Inherits:
Object
  • Object
show all
Defined in:
lib/kumi/ir/loop/passes/support/structure.rb

Overview

Structured view of a LoopIR instruction stream: loop_start/loop_end pairs become Nest items so passes can reason about loops as units, then serialize back to the flat form.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start:, body:, end_node:) ⇒ Nest

Returns a new instance of Nest.



14
15
16
17
18
# File 'lib/kumi/ir/loop/passes/support/structure.rb', line 14

def initialize(start:, body:, end_node:)
  @start = start
  @body = body
  @end_node = end_node
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



12
13
14
# File 'lib/kumi/ir/loop/passes/support/structure.rb', line 12

def body
  @body
end

#end_nodeObject (readonly)

Returns the value of attribute end_node.



12
13
14
# File 'lib/kumi/ir/loop/passes/support/structure.rb', line 12

def end_node
  @end_node
end

#startObject (readonly)

Returns the value of attribute start.



12
13
14
# File 'lib/kumi/ir/loop/passes/support/structure.rb', line 12

def start
  @start
end

Instance Method Details

#axisObject



20
# File 'lib/kumi/ir/loop/passes/support/structure.rb', line 20

def axis = @start.attributes[:axis]

#elem_regObject



22
# File 'lib/kumi/ir/loop/passes/support/structure.rb', line 22

def elem_reg = @start.result

#index_regObject



23
# File 'lib/kumi/ir/loop/passes/support/structure.rb', line 23

def index_reg = @start.attributes[:index]

#source_regObject



21
# File 'lib/kumi/ir/loop/passes/support/structure.rb', line 21

def source_reg = @start.inputs.first

#with_body(body) ⇒ Object



25
26
27
# File 'lib/kumi/ir/loop/passes/support/structure.rb', line 25

def with_body(body)
  Nest.new(start: @start, body: body, end_node: @end_node)
end