Ejemplo n.º 1
0
 @NotNull
 @Override
 public List<Instruction> getReversedInstructions() {
   LinkedHashSet<Instruction> traversedInstructions = Sets.newLinkedHashSet();
   PseudocodeTraverserKt.traverseFollowingInstructions(
       sinkInstruction, traversedInstructions, BACKWARD, null);
   if (traversedInstructions.size() < instructions.size()) {
     List<Instruction> simplyReversedInstructions = Lists.newArrayList(instructions);
     Collections.reverse(simplyReversedInstructions);
     for (Instruction instruction : simplyReversedInstructions) {
       if (!traversedInstructions.contains(instruction)) {
         PseudocodeTraverserKt.traverseFollowingInstructions(
             instruction, traversedInstructions, BACKWARD, null);
       }
     }
   }
   return Lists.newArrayList(traversedInstructions);
 }
Ejemplo n.º 2
0
 private Set<Instruction> collectReachableInstructions() {
   Set<Instruction> visited = Sets.newHashSet();
   PseudocodeTraverserKt.traverseFollowingInstructions(
       getEnterInstruction(), visited, FORWARD, null);
   if (!visited.contains(getExitInstruction())) {
     visited.add(getExitInstruction());
   }
   if (!visited.contains(errorInstruction)) {
     visited.add(errorInstruction);
   }
   if (!visited.contains(getSinkInstruction())) {
     visited.add(getSinkInstruction());
   }
   return visited;
 }