Example #1
0
 @Override
 public long complexity() {
   IRNode header = getChild(ForPart.HEADER.ordinal());
   IRNode statement1 = getChild(ForPart.STATEMENT1.ordinal());
   IRNode statement2 = getChild(ForPart.STATEMENT2.ordinal());
   IRNode body1 = getChild(ForPart.BODY1.ordinal());
   IRNode body2 = getChild(ForPart.BODY2.ordinal());
   IRNode body3 = getChild(ForPart.BODY3.ordinal());
   return loop.initialization.complexity()
       + header.complexity()
       + statement1.complexity()
       + thisLoopIterLimit
           * (loop.condition.complexity()
               + statement2.complexity()
               + body1.complexity()
               + loop.manipulator.complexity()
               + body2.complexity()
               + body3.complexity());
 }
Example #2
0
 public For(
     int level,
     Loop loop,
     long thisLoopIterLimit,
     IRNode header,
     IRNode statement1,
     IRNode statement2,
     IRNode body1,
     IRNode body2,
     IRNode body3) {
   this.level = level;
   this.loop = loop;
   this.thisLoopIterLimit = thisLoopIterLimit;
   resizeUpChildren(ForPart.values().length);
   getChildren().set(ForPart.HEADER.ordinal(), header);
   getChildren().set(ForPart.STATEMENT1.ordinal(), statement1);
   getChildren().set(ForPart.STATEMENT2.ordinal(), statement2);
   getChildren().set(ForPart.BODY1.ordinal(), body1);
   getChildren().set(ForPart.BODY2.ordinal(), body2);
   getChildren().set(ForPart.BODY3.ordinal(), body3);
 }