/** * Finds the corresponding instruction for a given move result * * @param moveInsn {@code non-null;} a move result instruction * @return {@code non-null;} the instruction that produces the result for * the move */ private SsaInsn getInsnForMove(SsaInsn moveInsn) { int pred = moveInsn.getBlock().getPredecessors().nextSetBit(0); ArrayList<SsaInsn> predInsns = ssaMeth.getBlocks().get(pred).getInsns(); return predInsns.get(predInsns.size()-1); }
/** * Finds the corresponding instruction for a given move result * * @param moveInsn {@code non-null;} a move result instruction * @return {@code non-null;} the instruction that produces the result for * the move */ private SsaInsn getInsnForMove(SsaInsn moveInsn) { int pred = moveInsn.getBlock().getPredecessors().nextSetBit(0); ArrayList<SsaInsn> predInsns = ssaMeth.getBlocks().get(pred).getInsns(); return predInsns.get(predInsns.size()-1); }
/** * Finds the corresponding instruction for a given move result * * @param moveInsn {@code non-null;} a move result instruction * @return {@code non-null;} the instruction that produces the result for * the move */ private SsaInsn getInsnForMove(SsaInsn moveInsn) { int pred = moveInsn.getBlock().getPredecessors().nextSetBit(0); ArrayList<SsaInsn> predInsns = ssaMeth.getBlocks().get(pred).getInsns(); return predInsns.get(predInsns.size()-1); }
/** * Finds the corresponding instruction for a given move result * * @param moveInsn {@code non-null;} a move result instruction * @return {@code non-null;} the instruction that produces the result for * the move */ private SsaInsn getInsnForMove(SsaInsn moveInsn) { int pred = moveInsn.getBlock().getPredecessors().nextSetBit(0); ArrayList<SsaInsn> predInsns = ssaMeth.getBlocks().get(pred).getInsns(); return predInsns.get(predInsns.size()-1); }
/** * Finds the corresponding instruction for a given move result * * @param moveInsn {@code non-null;} a move result instruction * @return {@code non-null;} the instruction that produces the result for * the move */ private SsaInsn getInsnForMove(SsaInsn moveInsn) { int pred = moveInsn.getBlock().getPredecessors().nextSetBit(0); ArrayList<SsaInsn> predInsns = ssaMeth.getBlocks().get(pred).getInsns(); return predInsns.get(predInsns.size()-1); }
/** * Finds the corresponding move result for a given instruction * * @param insn {@code non-null;} an instruction that must always be * followed by a move result * @return {@code non-null;} the move result for the given instruction */ private SsaInsn getMoveForInsn(SsaInsn insn) { int succ = insn.getBlock().getSuccessors().nextSetBit(0); ArrayList<SsaInsn> succInsns = ssaMeth.getBlocks().get(succ).getInsns(); return succInsns.get(0); }
/** * Finds the corresponding move result for a given instruction * * @param insn {@code non-null;} an instruction that must always be * followed by a move result * @return {@code non-null;} the move result for the given instruction */ private SsaInsn getMoveForInsn(SsaInsn insn) { int succ = insn.getBlock().getSuccessors().nextSetBit(0); ArrayList<SsaInsn> succInsns = ssaMeth.getBlocks().get(succ).getInsns(); return succInsns.get(0); }
/** * Finds the corresponding instruction for a given move result * * @param moveInsn {@code non-null;} a move result instruction * @return {@code non-null;} the instruction that produces the result for * the move */ private SsaInsn getInsnForMove(SsaInsn moveInsn) { int pred = moveInsn.getBlock().getPredecessors().nextSetBit(0); ArrayList<SsaInsn> predInsns = ssaMeth.getBlocks().get(pred).getInsns(); return predInsns.get(predInsns.size()-1); }
/** * Finds the corresponding instruction for a given move result * * @param moveInsn {@code non-null;} a move result instruction * @return {@code non-null;} the instruction that produces the result for * the move */ private SsaInsn getInsnForMove(SsaInsn moveInsn) { int pred = moveInsn.getBlock().getPredecessors().nextSetBit(0); ArrayList<SsaInsn> predInsns = ssaMeth.getBlocks().get(pred).getInsns(); return predInsns.get(predInsns.size()-1); }
/** * Finds the corresponding move result for a given instruction * * @param insn {@code non-null;} an instruction that must always be * followed by a move result * @return {@code non-null;} the move result for the given instruction */ private SsaInsn getMoveForInsn(SsaInsn insn) { int succ = insn.getBlock().getSuccessors().nextSetBit(0); ArrayList<SsaInsn> succInsns = ssaMeth.getBlocks().get(succ).getInsns(); return succInsns.get(0); }
/** * Finds the corresponding move result for a given instruction * * @param insn {@code non-null;} an instruction that must always be * followed by a move result * @return {@code non-null;} the move result for the given instruction */ private SsaInsn getMoveForInsn(SsaInsn insn) { int succ = insn.getBlock().getSuccessors().nextSetBit(0); ArrayList<SsaInsn> succInsns = ssaMeth.getBlocks().get(succ).getInsns(); return succInsns.get(0); }
/** * Finds the corresponding move result for a given instruction * * @param insn {@code non-null;} an instruction that must always be * followed by a move result * @return {@code non-null;} the move result for the given instruction */ private SsaInsn getMoveForInsn(SsaInsn insn) { int succ = insn.getBlock().getSuccessors().nextSetBit(0); ArrayList<SsaInsn> succInsns = ssaMeth.getBlocks().get(succ).getInsns(); return succInsns.get(0); }
/** * Finds the corresponding move result for a given instruction * * @param insn {@code non-null;} an instruction that must always be * followed by a move result * @return {@code non-null;} the move result for the given instruction */ private SsaInsn getMoveForInsn(SsaInsn insn) { int succ = insn.getBlock().getSuccessors().nextSetBit(0); ArrayList<SsaInsn> succInsns = ssaMeth.getBlocks().get(succ).getInsns(); return succInsns.get(0); }
/** * Finds the corresponding move result for a given instruction * * @param insn {@code non-null;} an instruction that must always be * followed by a move result * @return {@code non-null;} the move result for the given instruction */ private SsaInsn getMoveForInsn(SsaInsn insn) { int succ = insn.getBlock().getSuccessors().nextSetBit(0); ArrayList<SsaInsn> succInsns = ssaMeth.getBlocks().get(succ).getInsns(); return succInsns.get(0); }
/** * Replaces branches that have constant conditions with gotos */ private void replaceBranches() { for (SsaInsn insn : branchWorklist) { // Find if a successor block is never executed int oldSuccessor = -1; SsaBasicBlock block = insn.getBlock(); int successorSize = block.getSuccessorList().size(); for (int i = 0; i < successorSize; i++) { int successorBlock = block.getSuccessorList().get(i); if (!executableBlocks.get(successorBlock)) { oldSuccessor = successorBlock; } } /* * Prune branches that have already been handled and ones that no * longer have constant conditions (no nonexecutable successors) */ if (successorSize != 2 || oldSuccessor == -1) continue; // Replace branch with goto Insn originalRopInsn = insn.getOriginalRopInsn(); block.replaceLastInsn(new PlainInsn(Rops.GOTO, originalRopInsn.getPosition(), null, RegisterSpecList.EMPTY)); block.removeSuccessor(oldSuccessor); } } }
/** * Replaces branches that have constant conditions with gotos */ private void replaceBranches() { for (SsaInsn insn : branchWorklist) { // Find if a successor block is never executed int oldSuccessor = -1; SsaBasicBlock block = insn.getBlock(); int successorSize = block.getSuccessorList().size(); for (int i = 0; i < successorSize; i++) { int successorBlock = block.getSuccessorList().get(i); if (!executableBlocks.get(successorBlock)) { oldSuccessor = successorBlock; } } /* * Prune branches that have already been handled and ones that no * longer have constant conditions (no nonexecutable successors) */ if (successorSize != 2 || oldSuccessor == -1) continue; // Replace branch with goto Insn originalRopInsn = insn.getOriginalRopInsn(); block.replaceLastInsn(new PlainInsn(Rops.GOTO, originalRopInsn.getPosition(), null, RegisterSpecList.EMPTY)); block.removeSuccessor(oldSuccessor); } } }
/** * Replaces branches that have constant conditions with gotos */ private void replaceBranches() { for (SsaInsn insn : branchWorklist) { // Find if a successor block is never executed int oldSuccessor = -1; SsaBasicBlock block = insn.getBlock(); int successorSize = block.getSuccessorList().size(); for (int i = 0; i < successorSize; i++) { int successorBlock = block.getSuccessorList().get(i); if (!executableBlocks.get(successorBlock)) { oldSuccessor = successorBlock; } } /* * Prune branches that have already been handled and ones that no * longer have constant conditions (no nonexecutable successors) */ if (successorSize != 2 || oldSuccessor == -1) continue; // Replace branch with goto Insn originalRopInsn = insn.getOriginalRopInsn(); block.replaceLastInsn(new PlainInsn(Rops.GOTO, originalRopInsn.getPosition(), null, RegisterSpecList.EMPTY)); block.removeSuccessor(oldSuccessor); } } }