Package org.renjin.compiler.cfg

Examples of org.renjin.compiler.cfg.DominanceTree


        CfgPredicates.containsAssignmentTo(new EnvironmentVariable("K")));
   
    assertThat(Iterables.size(assignmentsToK), equalTo(3));
   
   
    DominanceTree dtree = new DominanceTree(cfg);
    System.out.println(dtree);
   
    SsaTransformer transformer = new SsaTransformer(cfg, dtree);
    transformer.transform();
   
View Full Code Here


   
   
    ControlFlowGraph cfg = new ControlFlowGraph(block);
   
  
    DominanceTree dtree = new DominanceTree(cfg);
   
    System.out.println("CFG:");
    System.out.println(cfg.getGraph());
   
    System.out.println("Dominance Tree:")
View Full Code Here

    BasicBlock bb0 = cfg.getBasicBlocks().get(0); // y <- 1; if q goto BB1 else BB2
    BasicBlock bb1 = cfg.getBasicBlocks().get(1); // y <- y + 1
    BasicBlock bb2 = cfg.getBasicBlocks().get(2); // y <- 4
    BasicBlock bb3 = cfg.getBasicBlocks().get(3); // return y;
   
    DominanceTree domTree = new DominanceTree(cfg);
    assertThat(domTree.getImmediateDominator(bb1), equalTo(bb0));
    assertThat(domTree.getImmediateDominator(bb2), equalTo(bb0));
    assertThat(domTree.getImmediateDominator(bb3), equalTo(bb0));
    assertThat(domTree.getImmediateDominator(cfg.getExit()), equalTo(cfg.getEntry()));
  }
View Full Code Here

  @Test
  public void dominanceFrontier() throws IOException {
    IRBody block = parseCytron();
    ControlFlowGraph cfg = new ControlFlowGraph(block);
    List<BasicBlock> bb = cfg.getLiveBasicBlocks();
    DominanceTree dtree = new DominanceTree(cfg);

    // See Figure 9 in
    // http://www.cs.utexas.edu/~pingali/CS380C/2010/papers/ssaCytron.pdf
   
    assertThat(dtree.getFrontier(bb.get(1)), itemsEqualTo(bb.get(1), cfg.getExit()));
    assertThat(dtree.getFrontier(bb.get(2)), itemsEqualTo(bb.get(7)));
    assertThat(dtree.getFrontier(bb.get(3)), itemsEqualTo(bb.get(5)));
    assertThat(dtree.getFrontier(bb.get(4)), itemsEqualTo(bb.get(5)));
    assertThat(dtree.getFrontier(bb.get(5)), itemsEqualTo(bb.get(7)));
    assertThat(dtree.getFrontier(bb.get(6)), itemsEqualTo(bb.get(7)));
    assertThat(dtree.getFrontier(bb.get(7)), itemsEqualTo(bb.get(1), cfg.getExit()));
    assertThat(dtree.getFrontier(bb.get(8)), itemsEqualTo(bb.get(1), bb.get(8), cfg.getExit()));
    assertThat(dtree.getFrontier(bb.get(9)), itemsEqualTo(bb.get(10)));
    assertThat(dtree.getFrontier(bb.get(10)), itemsEqualTo(bb.get(1), bb.get(8), cfg.getExit()));
    assertThat(dtree.getFrontier(bb.get(11)), itemsEqualTo(bb.get(1), cfg.getExit()));
  }
View Full Code Here

    }
  }

  private void doIntraScopeOptimization(IRBody main) {
    ControlFlowGraph cfg = new ControlFlowGraph(main);
    DominanceTree dtree = new DominanceTree(cfg);
    SsaTransformer ssaTransformer = new SsaTransformer(cfg, dtree);
    ssaTransformer.transform();
   
    System.out.println(cfg);
   
View Full Code Here

TOP

Related Classes of org.renjin.compiler.cfg.DominanceTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.