Examples of ImExpr


Examples of org.renjin.gcc.translate.expr.ImExpr

  public static void writeCall(FunctionContext context, GimpleCall call, String callExpr, JimpleType returnType) {
    if(call.getLhs() == null) {
      context.getBuilder().addStatement(callExpr.toString());
    } else {
      ImLValue lvalue = (ImLValue) context.resolveExpr(call.getLhs());
      ImExpr rhs = JvmExprs.toExpr(context, new JimpleExpr(callExpr), returnType, false);
      lvalue.writeAssignment(context, rhs);
    }
  }
View Full Code Here

Examples of org.renjin.gcc.translate.expr.ImExpr

  private static List<JimpleExpr> marshallParams(FunctionContext context,
                                                 GimpleCall call,
                                                 List<CallParam> callParams) {
    List<JimpleExpr> expressions = Lists.newArrayList();
    for (int i = 0; i != call.getParamCount(); ++i) {
      ImExpr sourceExpr = context.resolveExpr(call.getArguments().get(i));
      expressions.add(callParams.get(i).marshall(context, sourceExpr));
    }
    return expressions;
  }
View Full Code Here

Examples of org.renjin.gcc.translate.expr.ImExpr

    if(assign.getOperator() == GimpleOp.CONSTRUCTOR) {
      return;
    }

    ImExpr lhs = context.resolveExpr(assign.getLHS());
    List<ImExpr> operands = resolveOps(assign.getOperands());

    switch(assign.getOperator()) {
    case INTEGER_CST:
    case MEM_REF:
View Full Code Here

Examples of org.renjin.gcc.translate.expr.ImExpr

    JimpleExpr jimpleRhs = rhs.translateToPrimitive(context, (ImPrimitiveType) lhs.type());
    assignPrimitive(lhs, jimpleRhs);
  }

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

    TypeChecker.assertSamePrimitiveType(x, y);

    assignBinaryOp(lhs, "/", operands);
  }
View Full Code Here

Examples of org.renjin.gcc.translate.expr.ImExpr

    context.getBuilder().addLabel(doneLabel);
  }


  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(
              "staticinvoke <org.renjin.gcc.runtime.Builtins: boolean unordered(double, double)>(%s, %s)",
              x.translateToPrimitive(context, ImPrimitiveType.DOUBLE),
              y.translateToPrimitive(context, ImPrimitiveType.DOUBLE))));
    } else {
      throw new UnsupportedOperationException();
    }
  }
View Full Code Here

Examples of org.renjin.gcc.translate.expr.ImExpr

    Marshallers.writeCall(context, call, callExpr.toString(), functionType.getReturnType());
  }


  private FunPtrVar getFunPtrVar(FunctionContext context, GimpleCall call) {
    ImExpr var = context.lookupVar(call.getFunction());
    if (!(var instanceof FunPtrVar)) {
      throw new UnsupportedOperationException("Function value must be a FunPtrVar, got: " + var);
    }
    return (FunPtrVar) var;
  }
View Full Code Here

Examples of org.renjin.gcc.translate.expr.ImExpr

    if(call.getLhs() == null) {
      // no effect
      return;
    }

    ImExpr sizeArg = computeSize(context, call);
    ImExpr lhs = context.resolveExpr(call.getLhs());

    if(lhs.type() instanceof ImPrimitivePtrType) {
      writeNewPrimitiveArray(context, lhs, sizeArg);

    } else if(lhs.type() instanceof ImPrimitiveArrayPtrType) {
      writeNewPrimitiveArrayPtr(context, lhs, sizeArg);

    } else {
      throw new UnsupportedOperationException("type: " + lhs.type());
    }
  }
View Full Code Here

Examples of org.renjin.gcc.translate.expr.ImExpr

    if(call.getLhs() == null) {
      // TODO: evaluate args for side effects
      return;
    }

    ImExpr lhs = context.resolveExpr(call.getLhs());
    if(lhs.type() instanceof ImPrimitivePtrType) {
      writeNewArray(context, (ImLValue) lhs, call.getArguments().get(0), call.getArguments().get(1));
    } else {
      throw new UnsupportedOperationException("lhs: " + lhs);
    }
  }
View Full Code Here

Examples of org.renjin.gcc.translate.expr.ImExpr

  public void visitReturn(GimpleReturn gimpleReturn) {
   
    if(gimpleReturn.getValue() == null) {
      builder.addStatement("return");
    } else {
      ImExpr returnValue = context.resolveExpr(gimpleReturn.getValue());

      builder.addStatement("return " + Marshallers.marshallReturnValue(context, returnValue));
    }
  }
View Full Code Here

Examples of org.renjin.gcc.translate.expr.ImExpr

    builder.addStatement(new JimpleGoto(basicBlockLabel(gotoIns.getTarget())));
  }

  @Override
  public void visitSwitch(GimpleSwitch gimpleSwitch) {
    ImExpr switchExpr = context.resolveExpr(gimpleSwitch.getValue());

    JimpleSwitchStatement jimpleSwitch = new JimpleSwitchStatement(
        switchExpr.translateToPrimitive(context, ImPrimitiveType.INT));

    for (GimpleSwitch.Case branch : gimpleSwitch.getCases()) {
      jimpleSwitch.addBranch(branch.getLow(), basicBlockLabel(branch.getBasicBlockIndex()));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.