@SuppressWarnings("unused")
private static final Logger logger = Logger.getLogger(PessimisticBasicBlockFactory.class);
@Override
public Set<CFAEdge> getTransformers(final AbstractState a) {
Program program = Program.getProgram();
// First statement
RTLStatement firstStmt = program.getStatement(a.getLocation());
Set<RTLStatement> blockHeads = new FastSet<RTLStatement>();
if (firstStmt instanceof RTLGoto) {
// Multiple blocks
blockHeads = gotoToAssumes(a, (RTLGoto)firstStmt);
} else if (firstStmt instanceof RTLHalt) {
// Nothing
blockHeads = Collections.emptySet();
} else {
// Single Block
blockHeads = new FastSet<RTLStatement>(firstStmt);
}
Set<CFAEdge> transformers = new FastSet<CFAEdge>();
for (RTLStatement head : blockHeads) {
BasicBlock block = new BasicBlock();
RTLStatement stmt = head;
while (true) {
if (stmt instanceof RTLGoto || stmt instanceof RTLHalt) {
break;
} else {
block.add(stmt);
stmt = program.getStatement(stmt.getNextLabel());
}
}
transformers.add(new CFAEdge(head.getLabel(), stmt.getLabel(), block));
}