all instructions should be traversed
while reversed order is needed not only reachable from sink instruction
This commit is contained in:
@@ -151,6 +151,15 @@ public class PseudocodeImpl implements Pseudocode {
|
|||||||
if (reversedInstructions == null) {
|
if (reversedInstructions == null) {
|
||||||
LinkedHashSet<Instruction> traversedInstructions = Sets.newLinkedHashSet();
|
LinkedHashSet<Instruction> traversedInstructions = Sets.newLinkedHashSet();
|
||||||
traverseInstructionsInReverseOrder(sinkInstruction, traversedInstructions);
|
traverseInstructionsInReverseOrder(sinkInstruction, traversedInstructions);
|
||||||
|
if (traversedInstructions.size() < instructions.size()) {
|
||||||
|
List<Instruction> simplyReversedInstructions = Lists.newArrayList(instructions);
|
||||||
|
Collections.reverse(simplyReversedInstructions);
|
||||||
|
for (Instruction instruction : simplyReversedInstructions) {
|
||||||
|
if (!traversedInstructions.contains(instruction)) {
|
||||||
|
traverseInstructionsInReverseOrder(instruction, traversedInstructions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
reversedInstructions = Lists.newArrayList(traversedInstructions);
|
reversedInstructions = Lists.newArrayList(traversedInstructions);
|
||||||
}
|
}
|
||||||
return reversedInstructions;
|
return reversedInstructions;
|
||||||
|
|||||||
Reference in New Issue
Block a user