/** * Compute a mapping from instruction to basic block. Also, compute the blocks that end with a * 'normal' return. */ private void computeI2BMapping() { instruction2Block = new int[getInstructions().length]; for (Iterator it = iterator(); it.hasNext(); ) { final BasicBlock b = (BasicBlock) it.next(); for (int j = b.getFirstInstructionIndex(); j <= b.getLastInstructionIndex(); j++) { instruction2Block[j] = getNumber(b); } } }
@Override public String toString() { StringBuffer s = new StringBuffer(""); for (Iterator it = iterator(); it.hasNext(); ) { BasicBlock bb = (BasicBlock) it.next(); s.append("BB").append(getNumber(bb)).append("\n"); for (int j = bb.getFirstInstructionIndex(); j <= bb.getLastInstructionIndex(); j++) { s.append(" ").append(j).append(" ").append(getInstructions()[j]).append("\n"); } Iterator<BasicBlock> succNodes = getSuccNodes(bb); while (succNodes.hasNext()) { s.append(" -> BB").append(getNumber(succNodes.next())).append("\n"); } } return s.toString(); }