Package org.renjin.compiler.cfg

Examples of org.renjin.compiler.cfg.BasicBlock


   
   
    // just before branching in basic block #2,
    // we need phi functions for all 4 variables
   
    BasicBlock bb2 = cfg.getBasicBlocks().get(1);
    assertThat(bb2.getStatements().size(), equalTo(5));
  
    System.out.println(cfg);
  }
View Full Code Here


//    τ₆ ← primitive<*>(τ₅, xbar₃)
//    τ₇ ← primitive<[>(x₀, n₃)
//    τ₈ ← primitive<+>(τ₆, τ₇)
//    xbar₄ ← primitive</>(τ₈, n₃)
   
    BasicBlock bb = new BasicBlock(null);
    LocalVariable lv1 = new LocalVariable("lambda", 1);
    bb.addStatement(
        new Assignment(
            var("n", 3),
            new ElementAccess(temp(4), lv1)));
    bb.addStatement(
        new Assignment(
            temp(5),
            primitiveCall("-")));
    bb.addStatement(
        new Assignment(
            temp(6),
            primitiveCall("*", temp(5), var("xbar", 3))));
    bb.addStatement(
        new Assignment(
            temp(7),
            primitiveCall("[", var("x", 0), var("n", 3))));
    bb.addStatement(
        new Assignment(
            temp(8),
            primitiveCall("+", temp(6), temp(7))));
    bb.addStatement(
        new Assignment(
            var("xbar", 4),
           primitiveCall("/", temp(8), var("n", 3))));

  
View Full Code Here

    IRBody block = buildScope("y<-1; if(q) y<-y+1 else y<-4; y");
    ControlFlowGraph cfg = new ControlFlowGraph(block);
   
    System.out.println(cfg);
   
    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));
View Full Code Here

      for(BasicBlock X : Iterables.filter(cfg.getLiveBasicBlocks(), CfgPredicates.containsAssignmentTo(V))) {
        work.put(X, iterCount);
        W.add(X);
      }
      while(!W.isEmpty()) {
        BasicBlock X = W.poll();
        for(BasicBlock Y : dtree.getFrontier(X)) {
          if(X != cfg.getExit()) {
            if(hasAlready.get(Y) < iterCount) {
              Y.insertPhiFunction(V, cfg.getPredecessors(Y).size());
              // place (V <- phi(V,..., V)) at Y
View Full Code Here

TOP

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

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.