411 }
412 }
413
414 private boolean assertExitStatesNonEmpty(Loop<Block> loop, LoopInfo<BlockT> info) {
415 for (int i = 0; i < loop.getLoopExits().size(); i++) {
416 assert info.exitStates.get(i) != null : "no loop exit state at " + loop.getLoopExits().get(i) + " / " + loop.getHeader();
417 }
418 return true;
419 }
420
421 protected abstract void processLoopExit(LoopExitNode exitNode, BlockT initialState, BlockT exitState, GraphEffectList effects);
422
423 protected abstract MergeProcessor createMergeProcessor(Block merge);
424
425 /**
426 * The main workhorse for merging states, both for loops and for normal merges.
427 */
428 protected abstract class MergeProcessor {
429
430 private final Block mergeBlock;
431 private final AbstractMergeNode merge;
432
433 protected final GraphEffectList mergeEffects;
434 protected final GraphEffectList afterMergeEffects;
435
436 /**
437 * The indexes are used to map from an index in the list of active (non-dead) predecessors
438 * to an index in the list of all predecessors (the latter may be larger).
439 */
440 private int[] stateIndexes;
441 protected BlockT newState;
442
443 public MergeProcessor(Block mergeBlock) {
444 this.mergeBlock = mergeBlock;
445 this.merge = (AbstractMergeNode) mergeBlock.getBeginNode();
446 this.mergeEffects = new GraphEffectList(debug);
447 this.afterMergeEffects = new GraphEffectList(debug);
448 }
449
450 /**
451 * @param states the states that should be merged.
|
411 }
412 }
413
414 private boolean assertExitStatesNonEmpty(Loop<Block> loop, LoopInfo<BlockT> info) {
415 for (int i = 0; i < loop.getLoopExits().size(); i++) {
416 assert info.exitStates.get(i) != null : "no loop exit state at " + loop.getLoopExits().get(i) + " / " + loop.getHeader();
417 }
418 return true;
419 }
420
421 protected abstract void processLoopExit(LoopExitNode exitNode, BlockT initialState, BlockT exitState, GraphEffectList effects);
422
423 protected abstract MergeProcessor createMergeProcessor(Block merge);
424
425 /**
426 * The main workhorse for merging states, both for loops and for normal merges.
427 */
428 protected abstract class MergeProcessor {
429
430 private final Block mergeBlock;
431 protected final AbstractMergeNode merge;
432
433 protected final GraphEffectList mergeEffects;
434 protected final GraphEffectList afterMergeEffects;
435
436 /**
437 * The indexes are used to map from an index in the list of active (non-dead) predecessors
438 * to an index in the list of all predecessors (the latter may be larger).
439 */
440 private int[] stateIndexes;
441 protected BlockT newState;
442
443 public MergeProcessor(Block mergeBlock) {
444 this.mergeBlock = mergeBlock;
445 this.merge = (AbstractMergeNode) mergeBlock.getBeginNode();
446 this.mergeEffects = new GraphEffectList(debug);
447 this.afterMergeEffects = new GraphEffectList(debug);
448 }
449
450 /**
451 * @param states the states that should be merged.
|