Package org.renjin.gcc.translate.type

Examples of org.renjin.gcc.translate.type.ImPrimitiveType


    assignBinaryOp(lhs, "/", operands);
  }


  private void assignNegated(ImExpr lhs, ImExpr expr) {
    ImPrimitiveType type = TypeChecker.assertSamePrimitiveType(lhs, expr);

    assignPrimitive(lhs, new JimpleExpr("neg " + expr.translateToPrimitive(context, type)));
  }
View Full Code Here


    assignPrimitive(lhs, new JimpleExpr("neg " + expr.translateToPrimitive(context, type)));
  }

  private void assignBinaryOp(ImExpr lhs, String operator, List<ImExpr> operands) {

    ImPrimitiveType type = TypeChecker.assertSamePrimitiveType(lhs, operands.get(0), operands.get(1));
   
    JimpleExpr a = operands.get(0).translateToPrimitive(context, type);
    JimpleExpr b = operands.get(1).translateToPrimitive(context, type);

    assignPrimitive(lhs, JimpleExpr.binaryInfix(operator, a, b));
View Full Code Here

    JimpleExpr condition = new JimpleExpr(expr + " == 0");
    assignBoolean(lhs, condition);
  }

  private void assignTruthOr(ImExpr lhs, List<ImExpr> ops) {
    ImPrimitiveType type = TypeChecker.assertSamePrimitiveType(ops.get(0), ops.get(1));
    if(type != ImPrimitiveType.BOOLEAN) {
      throw new UnsupportedOperationException(type.toString());
    }

    JimpleExpr a = ops.get(0).translateToPrimitive(context, ImPrimitiveType.BOOLEAN);
    JimpleExpr b = ops.get(1).translateToPrimitive(context, ImPrimitiveType.BOOLEAN);
   
View Full Code Here

    context.getBuilder().addLabel(doneLabel);

  }
 
  private void assignTruthAnd(ImExpr lhs, List<ImExpr> ops) {
    ImPrimitiveType type = TypeChecker.assertSamePrimitiveType(ops.get(0), ops.get(1));
    if(type != ImPrimitiveType.BOOLEAN) {
      throw new UnsupportedOperationException(type.toString());
    }

    JimpleExpr a = ops.get(0).translateToPrimitive(context, ImPrimitiveType.BOOLEAN);
    JimpleExpr b = ops.get(1).translateToPrimitive(context, ImPrimitiveType.BOOLEAN);
View Full Code Here

  private void assignUnordered(ImExpr lhs, List<ImExpr> operands) {
    ImExpr x = operands.get(0);
    ImExpr y = operands.get(1);

    ImPrimitiveType type = TypeChecker.assertSamePrimitiveType(x, y);
    Preconditions.checkArgument(type == ImPrimitiveType.DOUBLE);

    if(TypeChecker.isDouble(x.type())) {
      //assignPrimitive(lhs, JimpleExpr.integerConstant(0));
      assignPrimitive(lhs, new JimpleExpr(String.format(
View Full Code Here

  }


  private void assignAbs(ImExpr lhs, ImExpr expr) {
   
    ImPrimitiveType type = TypeChecker.assertSamePrimitiveType(lhs, expr);

    assignPrimitive(lhs, new JimpleExpr(String.format("staticinvoke <java.lang.Math: %s>(%s)",
        absMethodForType(prtype(expr)),
        expr.translateToPrimitive(context, type))));
   
View Full Code Here

    }
    throw new UnsupportedOperationException("abs on type " + type.toString());
  }

  private void assignMax(ImExpr lhs, List<ImExpr> operands) {
    ImPrimitiveType type = TypeChecker.assertSamePrimitiveType(lhs, operands.get(0), operands.get(1));

    String signature = "{t} max({t}, {t})"
            .replace("{t}", prtype(lhs).asJimple().toString());
   
    JimpleExpr a = operands.get(0).translateToPrimitive(context, type);
View Full Code Here

public class PrimitiveAssignment {

  public static void assign(FunctionContext context, ImExpr lhs, ImExpr rhs) {
    if(lhs instanceof PrimitiveLValue && rhs.type() instanceof ImPrimitiveType) {
      ImPrimitiveType lhsType = (ImPrimitiveType) lhs.type();
      JimpleExpr jimpleExpr = rhs.translateToPrimitive(context, lhsType);

      ((PrimitiveLValue) lhs).writePrimitiveAssignment(jimpleExpr);
//    } else if(lhs instanceof ImLValue) {
//      ((ImLValue) lhs).writeAssignment(context, rhs);
View Full Code Here

TOP

Related Classes of org.renjin.gcc.translate.type.ImPrimitiveType

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.