use of org.candle.decompiler.intermediate.graph.edge.IntermediateEdge in project candle-decompiler by bradsdavis.
the class InstructionGraphWriter method process.
@Override
public void process() {
if (directory == null) {
return;
}
File a = new File(directory.getAbsolutePath() + File.separator + name);
LOG.debug("Instruction Graph: " + a.getAbsolutePath());
Writer x;
try {
x = new FileWriter(a);
DOTExporter<InstructionHandle, IntermediateEdge> f = new DOTExporter<InstructionHandle, IntermediateEdge>(new IntegerNameProvider<InstructionHandle>(), new InstructionLabelProvider(), new IntermediateEdgeProvider(), null, new InstructionEdgeAttributeProvider());
f.export(x, igc.getGraph());
} catch (IOException e) {
e.printStackTrace();
}
LOG.debug("End Instruction Graph ======");
}
use of org.candle.decompiler.intermediate.graph.edge.IntermediateEdge in project candle-decompiler by bradsdavis.
the class InstructionToIntermediateEnhancer method process.
@Override
public void process() {
GraphIterator<InstructionHandle, IntermediateEdge> iterator = new DepthFirstIterator<InstructionHandle, IntermediateEdge>(igc.getGraph());
iterator.addTraversalListener(new InstructionTransversalListener(igc, intermediateContext));
while (iterator.hasNext()) {
iterator.next();
}
}
use of org.candle.decompiler.intermediate.graph.edge.IntermediateEdge in project candle-decompiler by bradsdavis.
the class BackEdgeEnhancer method process.
@Override
public void process(InstructionHandle ih) {
List<InstructionHandle> successors = Graphs.successorListOf(igc.getGraph(), ih);
for (InstructionHandle successor : successors) {
IntermediateEdge ie = igc.getGraph().getEdge(ih, successor);
// color back...
int t1 = ih.getPosition();
int t2 = successor.getPosition();
if (t2 < t1) {
ie.setType(EdgeType.BACK);
}
}
}
use of org.candle.decompiler.intermediate.graph.edge.IntermediateEdge in project candle-decompiler by bradsdavis.
the class ContinuousLoop method process.
@Override
public void process(InstructionHandle ih) {
List<InstructionHandle> preds = Graphs.predecessorListOf(igc.getGraph(), ih);
// only more than one predecessor.
if (preds.size() < 2) {
return;
}
for (InstructionHandle pred : preds) {
IntermediateEdge ie = igc.getGraph().getEdge(pred, ih);
if (ie.getType() == EdgeType.BACK) {
if (!igc.hasIntermediate(ih)) {
// this is probably a while(true);
ContinuousWhileIntermediate cwi = new ContinuousWhileIntermediate(ih);
igc.addIntermediate(ih, cwi);
break;
}
}
}
}
use of org.candle.decompiler.intermediate.graph.edge.IntermediateEdge in project candle-decompiler by bradsdavis.
the class LoopHeader method process.
@Override
public void process(InstructionHandle ih) {
// check to see whether a predecessor is a back edge.
List<InstructionHandle> preds = Graphs.predecessorListOf(igc.getGraph(), ih);
// only more than one predecessor.
if (preds.size() < 2) {
return;
}
for (InstructionHandle pred : preds) {
IntermediateEdge ie = igc.getGraph().getEdge(pred, ih);
if (ie.getType() == EdgeType.BACK) {
LOG.debug("Has back edge.");
splitLoopHeader(ih);
break;
}
}
}
Aggregations