[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reverse control flow graph for control dependence
Hi again,
I came back to try out what you recommended (iterating through blocks
obtained from a CompleteBlockGraph and reversing the predecessors with
the successors). It is easy to modify the list that I obtain from the
CBG, but these changes are not reflected in subsequent calls to the
graph. The code I use to reverse preds and succs is as follows:
private CompleteBlockGraph generateRCFG(CompleteBlockGraph cbg){
List l = cbg.getBlocks();
for(int i = 0;i<l.size();i++){
Block b = (Block)l.get(i);
List preds = b.getPreds();
List succs = b.getSuccs();
b.setPreds(succs);
b.setSuccs(preds);
l.set(i, b);
}
CompleteBlockGraph rcbg = reverseHeadsAndTails(cbg);
return rcbg;
}
I am thinking that the only other option would be to produce a mutable
alternative to the current BlockGraph implementation with setter
methods. Have you got any hints?
Cheers,
Neil