Example #1
0
 private void printAllRegions() {
   for (BasicBlock bb1 : cfg.getBasicBlocks()) {
     for (BasicBlock bb2 : cfg.getBasicBlocks()) {
       if (!bb1.equals(bb2) && getDomInfo().dominates(bb1, bb2)) {
         if (isRegion(bb1, bb2)) {
           LOGGER.debug("REGION {},{}", bb1, bb2);
         }
       }
     }
   }
 }
Example #2
0
 Statement generateJumpStatement(BasicBlock target) {
   if (nextBlock == target && blockMap[target.getIndex()] == null) {
     return null;
   }
   Decompiler.Block block = blockMap[target.getIndex()];
   if (block == null) {
     throw new IllegalStateException("Could not find block for basic block $" + target.getIndex());
   }
   if (target.getIndex() == indexer.nodeAt(block.end)) {
     BreakStatement breakStmt = new BreakStatement();
     breakStmt.setLocation(currentLocation);
     breakStmt.setTarget(block.statement);
     return breakStmt;
   } else {
     ContinueStatement contStmt = new ContinueStatement();
     contStmt.setLocation(currentLocation);
     contStmt.setTarget(block.statement);
     return contStmt;
   }
 }
 private void transformBasicBlock(BasicBlock block) {
   List<Instruction> instructions = block.getInstructions();
   for (int i = 0; i < instructions.size(); ++i) {
     Instruction insn = instructions.get(i);
     if (insn instanceof InvokeInstruction) {
       InvokeInstruction invoke = (InvokeInstruction) insn;
       List<Instruction> replacement = transformInvoke(invoke);
       if (replacement != null) {
         instructions.set(i, new EmptyInstruction());
         instructions.addAll(i, replacement);
         i += replacement.size();
       }
     }
   }
 }
Example #4
0
 private void buildRegionTree(BasicBlock bb, RPSTRegion region) {
   while (bb.equals(region.exit)) {
     region = region.parent;
   }
   RPSTRegion newRegion = bb2region.get(bb);
   if (newRegion != null) {
     RPSTRegion topMostParent = getTopMostParent(newRegion);
     LOGGER.trace("Parent of region {} is {}", topMostParent, region);
     topMostParent.parent = region;
     region = newRegion;
   } else {
     LOGGER.trace("Parent of BB {} is {}", bb, region);
     bb2region.put(bb, region);
   }
   for (BasicBlock c : getDomInfo().getDominatorsTree().getChildren(bb)) {
     buildRegionTree(c, region);
   }
 }