Exemplo n.º 1
0
 /**
  * Calculate the "approximate" dominators for an IR i.e., the dominators in the factored CFG
  * rather than the normal CFG.
  *
  * <p>(No exception is thrown if the input IR has handler blocks.)
  *
  * <p>After this pass, each basic block's scratch field points to an OPT_DominatorInfo object,
  * which holds the dominators of the basic block.
  *
  * @param ir the IR in question
  */
 public static void computeApproxDominators(OPT_IR ir) {
   OPT_DominatorSystem system = new OPT_DominatorSystem(ir);
   if (DEBUG) {
     System.out.print("Solving...");
   }
   if (DEBUG) {
     System.out.println(system);
   }
   system.solve();
   if (DEBUG) {
     System.out.println("done");
   }
   OPT_DF_Solution solution = system.getSolution();
   if (DEBUG) {
     System.out.println("Dominator Solution :" + solution);
   }
   if (DEBUG) {
     System.out.print("Updating blocks ...");
   }
   updateBlocks(solution);
   if (DEBUG) {
     System.out.println("done.");
   }
   if (ir.options.PRINT_DOMINATORS) {
     printDominators(ir);
   }
 }
Exemplo n.º 2
0
 /**
  * Calculate the dominators for an IR.
  *
  * <p>After this pass, each basic block's scrach field points to an <code> OPT_DominatorInfo
  * </code> object, which holds the dominators of the basic block.
  *
  * @param ir the IR in question
  */
 public static void perform(OPT_IR ir) {
   if (ir.hasReachableExceptionHandlers()) {
     throw new OPT_OperationNotImplementedException("IR with exception handlers");
   }
   OPT_DominatorSystem system = new OPT_DominatorSystem(ir);
   if (DEBUG) {
     System.out.print("Solving...");
   }
   if (DEBUG) {
     System.out.println(system);
   }
   system.solve();
   if (DEBUG) {
     System.out.println("done");
   }
   OPT_DF_Solution solution = system.getSolution();
   if (DEBUG) {
     System.out.println("Dominator Solution :" + solution);
   }
   if (DEBUG) {
     System.out.print("Updating blocks ...");
   }
   updateBlocks(solution);
   if (DEBUG) {
     System.out.println("done.");
   }
   if (ir.options.PRINT_DOMINATORS) {
     printDominators(ir);
   }
 }