Class: Kumi::Core::Analyzer::Passes::IRLowerPass

Inherits:
PassBase
  • Object
show all
Defined in:
lib/kumi/core/analyzer/passes/ir_lower_pass.rb

Direct Known Subclasses

Loop::LowerPass, Vec::LowerPass

Constant Summary

Constants inherited from PassBase

PassBase::HALT

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from PassBase

contract_declared?, #debug, #debug_enabled?, declared_optional_reads, declared_reads, declared_writes, #initialize, optional_reads, reads, writes

Methods included from ErrorReporting

#inferred_location, #raise_localized_error, #raise_syntax_error, #raise_type_error, #report_enhanced_error, #report_error, #report_semantic_error, #report_syntax_error, #report_type_error

Constructor Details

This class inherits a constructor from Kumi::Core::Analyzer::Passes::PassBase

Class Attribute Details

.from_keyObject (readonly)

Returns the value of attribute from_key.



9
10
11
# File 'lib/kumi/core/analyzer/passes/ir_lower_pass.rb', line 9

def from_key
  @from_key
end

.to_keyObject (readonly)

Returns the value of attribute to_key.



9
10
11
# File 'lib/kumi/core/analyzer/passes/ir_lower_pass.rb', line 9

def to_key
  @to_key
end

Class Method Details

.lowers(from:, to:) ⇒ Object



11
12
13
14
15
16
# File 'lib/kumi/core/analyzer/passes/ir_lower_pass.rb', line 11

def lowers(from:, to:)
  @from_key = from
  @to_key = to
  optional_reads from
  writes to
end

Instance Method Details

#run(_errors) ⇒ Object



19
20
21
22
23
24
# File 'lib/kumi/core/analyzer/passes/ir_lower_pass.rb', line 19

def run(_errors)
  source = state[self.class.from_key]
  return state unless source

  state.with(self.class.to_key, lower(source).freeze)
end