Set<CFG_Edge> succs = _cfg.outgoingEdgesOf(curr);
if (succs.size() == 1) {
BasicBlock tgt = succs.iterator().next()._dst;
if ((tgt != next) && ((li == null) || !li.operation.xfersControl())) {
// System.out.println("BB " + curr.getID() + " doesn't fall through to " + next.getID() + ". Adding a jump to " + tgt._label);
curr.addInstr(new JumpInstr(tgt._label));
}
}
}
if (curr == _exitBB) {
// Add a dummy ret
// System.out.println("Exit bb is not the last bb in the layout! Adding a dummy return!");
curr.addInstr(new ReturnInstr(Nil.NIL));
}
}
else if (curr != _exitBB) {
Set<CFG_Edge> succs = _cfg.outgoingEdgesOf(curr);
assert succs.size() == 1;
BasicBlock tgt = succs.iterator().next()._dst;
if ((li == null) || !li.operation.xfersControl()) {
// System.out.println("BB " + curr.getID() + " is the last bb in the layout! Adding a jump to " + tgt._label);
curr.addInstr(new JumpInstr(tgt._label));
}
}
}
return _linearizedBBList;