Package org.renjin.compiler.ir.tac.expressions

Examples of org.renjin.compiler.ir.tac.expressions.SimpleExpression


    return Symbol.get("if");
  }

  @Override
  public Expression translateToExpression(IRBodyBuilder builder, TranslationContext context, FunctionCall call) {
    SimpleExpression condition = builder.translateSimpleExpression(context, call.getArgument(0));
   
    // since "if" is being used in the context of an expression, we need
    // to store its final value somewhere
    Temp ifResult = builder.newTemp();
   
View Full Code Here


  }

  @Override
  public void addStatement(IRBodyBuilder builder, TranslationContext context, FunctionCall call) {

    SimpleExpression condition = builder.translateSimpleExpression(context, call.getArgument(0));
    IRLabel trueLabel = builder.newLabel();
    IRLabel falseLabel = builder.newLabel();
    IRLabel endLabel;

    if(hasElse(call)) {
View Full Code Here

    IRLabel falseLabel = builder.newLabel();
    IRLabel naLabel = builder.newLabel();
    IRLabel finishLabel = builder.newLabel();
   
    // check the first condition
    SimpleExpression condition1 = builder.translateSimpleExpression(context, call.getArgument(0));
    builder.addStatement(new IfStatement(condition1, firstTrue, falseLabel, firstNA));
   
    // first is true.
    // set the result to true and do the next test
    builder.addLabel(firstTrue);
    builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(true))));
    builder.addStatement(new GotoStatement(test2Label));
   
    // first is NA
    // set the result to NA and do the next test
    builder.addLabel(firstNA);
    builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(LogicalVector.NA))));
    builder.addStatement(new GotoStatement(test2Label));
   
    // check second condition
    builder.addLabel(test2Label);
    SimpleExpression condition2 = builder.translateSimpleExpression(context, call.getArgument(1));
    builder.addStatement(new IfStatement(condition2,
        finishLabel,  // if condition 2 is true, then the result is equal to condition2
        falseLabel, // if false, final result is false,
        naLabel));
View Full Code Here

   
    IRLabel test2Label = builder.newLabel();
    IRLabel finishLabel = builder.newLabel();
   
    // check the first condition
    SimpleExpression condition1 = builder.translateSimpleExpression(context, call.getArgument(0));
    builder.addStatement(new IfStatement(condition1, test2Label, finishLabel, test2Label));
   
    // first condition is ok, check the second
    builder.addLabel(test2Label);
    builder.addStatement(new ExprStatement(builder.translateExpression(context, call.getArgument(1))));
View Full Code Here

    IRLabel trueLabel = builder.newLabel();
    IRLabel naLabel = builder.newLabel();
    IRLabel finishLabel = builder.newLabel();
   
    // check the first condition
    SimpleExpression condition1 = builder.translateSimpleExpression(context, call.getArgument(0));
    builder.addStatement(new IfStatement(condition1, trueLabel, firstFalse, firstNA));
   
    // first is true.
    // set the result to true and do the next test
    builder.addLabel(firstFalse);
    builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(false))));
    builder.addStatement(new GotoStatement(test2Label));
   
    // first is NA
    // set the result to NA and do the next test
    builder.addLabel(firstNA);
    builder.addStatement(new Assignment(result, new Constant(new LogicalArrayVector(LogicalVector.NA))));
    builder.addStatement(new GotoStatement(test2Label));
   
    // check second condition
    builder.addLabel(test2Label);
    SimpleExpression condition2 = builder.translateSimpleExpression(context, call.getArgument(1));
    builder.addStatement(new IfStatement(condition2,
        trueLabel,
        finishLabel,  // if condition 2 is false, then the result is equal to condition1
        naLabel));
View Full Code Here

   
    IRLabel test2Label = builder.newLabel();
    IRLabel finishLabel = builder.newLabel();
   
    // check the first condition
    SimpleExpression condition1 = builder.translateSimpleExpression(context, call.getArgument(0));
    builder.addStatement(new IfStatement(condition1, finishLabel, test2Label, test2Label));
   
    // first condition is ok, check the second
    builder.addLabel(test2Label);
    builder.addStatement(new ExprStatement(builder.translateExpression(context, call.getArgument(1))));
View Full Code Here

TOP

Related Classes of org.renjin.compiler.ir.tac.expressions.SimpleExpression

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.