Class: Kumi::Core::Analyzer::Passes::LIR::LoopInvariantCodeMotionPass
- Inherits:
-
PassBase
- Object
- PassBase
- Kumi::Core::Analyzer::Passes::LIR::LoopInvariantCodeMotionPass
- Defined in:
- lib/kumi/core/analyzer/passes/lir/loop_invariant_code_motion_pass.rb
Constant Summary collapse
- LIR =
Kumi::Core::LIR
- MAX_PASSES =
10
Instance Method Summary collapse
Methods inherited from PassBase
#debug, #debug_enabled?, #initialize
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 |
# File 'lib/kumi/core/analyzer/passes/lir/loop_invariant_code_motion_pass.rb', line 14 def run(_errors) current_ops = get_state(:lir_module) MAX_PASSES.times do new_ops, changed = run_one_pass(current_ops) return state.with(:lir_module, new_ops.freeze).with(:lir_04_loop_invcm, new_ops) unless changed current_ops = new_ops end raise "LICM did not converge after #{MAX_PASSES} passes." end |