/** * Looks forward to the current block's primary successor, returning * the RegisterSpec of the result of the move-result-pseudo at the * top of that block or null if none. * * @return {@code null-ok;} result of move-result-pseudo at the beginning of * primary successor */ private RegisterSpec getNextMoveResultPseudo() { int label = block.getPrimarySuccessor(); if (label < 0) { return null; } Insn insn = method.getBlocks().labelToBlock(label).getInsns().get(0); if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) { return null; } else { return insn.getResult(); } }
/** * Looks forward to the current block's primary successor, returning * the RegisterSpec of the result of the move-result-pseudo at the * top of that block or null if none. * * @return {@code null-ok;} result of move-result-pseudo at the beginning of * primary successor */ private RegisterSpec getNextMoveResultPseudo() { int label = block.getPrimarySuccessor(); if (label < 0) { return null; } Insn insn = method.getBlocks().labelToBlock(label).getInsns().get(0); if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) { return null; } else { return insn.getResult(); } }
/** * Looks forward to the current block's primary successor, returning * the RegisterSpec of the result of the move-result-pseudo at the * top of that block or null if none. * * @return {@code null-ok;} result of move-result-pseudo at the beginning of * primary successor */ private RegisterSpec getNextMoveResultPseudo() { int label = block.getPrimarySuccessor(); if (label < 0) { return null; } Insn insn = method.getBlocks().labelToBlock(label).getInsns().get(0); if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) { return null; } else { return insn.getResult(); } }
/** * Looks forward to the current block's primary successor, returning * the RegisterSpec of the result of the move-result-pseudo at the * top of that block or null if none. * * @return {@code null-ok;} result of move-result-pseudo at the beginning of * primary successor */ private RegisterSpec getNextMoveResultPseudo() { int label = block.getPrimarySuccessor(); if (label < 0) { return null; } Insn insn = method.getBlocks().labelToBlock(label).getInsns().get(0); if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) { return null; } else { return insn.getResult(); } }
/** * Looks forward to the current block's primary successor, returning * the RegisterSpec of the result of the move-result-pseudo at the * top of that block or null if none. * * @return {@code null-ok;} result of move-result-pseudo at the beginning of * primary successor */ private RegisterSpec getNextMoveResultPseudo() { int label = block.getPrimarySuccessor(); if (label < 0) { return null; } Insn insn = method.getBlocks().labelToBlock(label).getInsns().get(0); if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) { return null; } else { return insn.getResult(); } }
/** * Looks forward to the current block's primary successor, returning * the RegisterSpec of the result of the move-result-pseudo at the * top of that block or null if none. * * @return {@code null-ok;} result of move-result-pseudo at the beginning of * primary successor */ private RegisterSpec getNextMoveResultPseudo() { int label = block.getPrimarySuccessor(); if (label < 0) { return null; } Insn insn = method.getBlocks().labelToBlock(label).getInsns().get(0); if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) { return null; } else { return insn.getResult(); } }
/** * Looks forward to the current block's primary successor, returning * the RegisterSpec of the result of the move-result-pseudo at the * top of that block or null if none. * * @return {@code null-ok;} result of move-result-pseudo at the beginning of * primary successor */ private RegisterSpec getNextMoveResultPseudo() { int label = block.getPrimarySuccessor(); if (label < 0) { return null; } Insn insn = method.getBlocks().labelToBlock(label).getInsns().get(0); if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) { return null; } else { return insn.getResult(); } }
/** * Looks forward to the current block's primary successor, returning * the RegisterSpec of the result of the move-result-pseudo at the * top of that block or null if none. * * @return {@code null-ok;} result of move-result-pseudo at the beginning of * primary successor */ private RegisterSpec getNextMoveResultPseudo() { int label = block.getPrimarySuccessor(); if (label < 0) { return null; } Insn insn = method.getBlocks().labelToBlock(label).getInsns().get(0); if (insn.getOpcode().getOpcode() != RegOps.MOVE_RESULT_PSEUDO) { return null; } else { return insn.getResult(); } }
/** * Gets the preferred successor for the given block. If the block * only has one successor, then that is the preferred successor. * Otherwise, if the block has a primay successor, then that is * the preferred successor. If the block has no successors, then * this returns {@code null}. * * @param block {@code non-null;} the block in question * @return {@code null-ok;} the preferred successor, if any */ public BasicBlock preferredSuccessorOf(BasicBlock block) { int primarySuccessor = block.getPrimarySuccessor(); IntList successors = block.getSuccessors(); int succSize = successors.size(); switch (succSize) { case 0: { return null; } case 1: { return labelToBlock(successors.get(0)); } } if (primarySuccessor != -1) { return labelToBlock(primarySuccessor); } else { return labelToBlock(successors.get(0)); } }
/** * Gets the preferred successor for the given block. If the block * only has one successor, then that is the preferred successor. * Otherwise, if the block has a primay successor, then that is * the preferred successor. If the block has no successors, then * this returns {@code null}. * * @param block {@code non-null;} the block in question * @return {@code null-ok;} the preferred successor, if any */ public BasicBlock preferredSuccessorOf(BasicBlock block) { int primarySuccessor = block.getPrimarySuccessor(); IntList successors = block.getSuccessors(); int succSize = successors.size(); switch (succSize) { case 0: { return null; } case 1: { return labelToBlock(successors.get(0)); } } if (primarySuccessor != -1) { return labelToBlock(primarySuccessor); } else { return labelToBlock(successors.get(0)); } }
/** * Gets the preferred successor for the given block. If the block * only has one successor, then that is the preferred successor. * Otherwise, if the block has a primay successor, then that is * the preferred successor. If the block has no successors, then * this returns {@code null}. * * @param block {@code non-null;} the block in question * @return {@code null-ok;} the preferred successor, if any */ public BasicBlock preferredSuccessorOf(BasicBlock block) { int primarySuccessor = block.getPrimarySuccessor(); IntList successors = block.getSuccessors(); int succSize = successors.size(); switch (succSize) { case 0: { return null; } case 1: { return labelToBlock(successors.get(0)); } } if (primarySuccessor != -1) { return labelToBlock(primarySuccessor); } else { return labelToBlock(successors.get(0)); } }
/** * Gets the preferred successor for the given block. If the block * only has one successor, then that is the preferred successor. * Otherwise, if the block has a primay successor, then that is * the preferred successor. If the block has no successors, then * this returns {@code null}. * * @param block {@code non-null;} the block in question * @return {@code null-ok;} the preferred successor, if any */ public BasicBlock preferredSuccessorOf(BasicBlock block) { int primarySuccessor = block.getPrimarySuccessor(); IntList successors = block.getSuccessors(); int succSize = successors.size(); switch (succSize) { case 0: { return null; } case 1: { return labelToBlock(successors.get(0)); } } if (primarySuccessor != -1) { return labelToBlock(primarySuccessor); } else { return labelToBlock(successors.get(0)); } }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }
/** * Replaces one of a block's successors with a different label. Constructs * an updated BasicBlock instance and places it in {@code newBlocks}. * * @param block block to replace * @param oldLabel label of successor to replace * @param newLabel label of new successor */ private void replaceSucc(BasicBlock block, int oldLabel, int newLabel) { IntList newSuccessors = block.getSuccessors().mutableCopy(); int newPrimarySuccessor; newSuccessors.set(newSuccessors.indexOf(oldLabel), newLabel); newPrimarySuccessor = block.getPrimarySuccessor(); if (newPrimarySuccessor == oldLabel) { newPrimarySuccessor = newLabel; } newSuccessors.setImmutable(); BasicBlock newBB = new BasicBlock(block.getLabel(), block.getInsns(), newSuccessors, newPrimarySuccessor); newBlocks.set(newBlocks.indexOfLabel(block.getLabel()), newBB); } }