Class: Kumi::Core::Analyzer::Passes::LIR::HoistScalarReferencesPass
- Inherits:
-
PassBase
- Object
- PassBase
- Kumi::Core::Analyzer::Passes::LIR::HoistScalarReferencesPass
- Defined in:
- lib/kumi/core/analyzer/passes/lir/hoist_scalar_references_pass.rb
Constant Summary collapse
- LIR =
Kumi::Core::LIR
- MAX_PASSES =
10
Instance Method Summary collapse
Methods inherited from PassBase
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
Instance Method Details
#run(_errors) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/kumi/core/analyzer/passes/lir/hoist_scalar_references_pass.rb', line 14 def run(_errors) current_ops = get_state(:lir_module) MAX_PASSES.times do |pass_num| debug "\n[HOIST] Starting Pass ##{pass_num + 1}" new_ops, changed = run_one_pass(current_ops) return state.with(:lir_module, new_ops.freeze).with(:lir_01_hoist_scalar_references, new_ops) unless changed current_ops = new_ops end raise "HoistScalarReferencesPass did not converge after #{MAX_PASSES} passes." end |