Package org.renjin.gcc.jimple

Examples of org.renjin.gcc.jimple.JimpleExpr


  public String toString() {
    return jimpleArrayName;
  }

  private JimpleExpr computeIndex(ImExpr index) {
    JimpleExpr indexExpr = index.translateToPrimitive(context, ImPrimitiveType.INT);
    JimpleExpr finalIndex = context.declareTemp(JimpleType.INT,
        JimpleExpr.binaryInfix("+", new JimpleExpr(jimpleStartIndexName), indexExpr));

    if(lowerBound != 0) {
      finalIndex = context.declareTemp(JimpleType.INT,
          JimpleExpr.binaryInfix("-", finalIndex, JimpleExpr.integerConstant(lowerBound)));
    }
View Full Code Here


          rhs.translateToPrimitive(context, type.baseType().componentType()));
    }

    @Override
    public JimpleExpr translateToPrimitive(FunctionContext context, ImPrimitiveType type) {
      return new JimpleExpr(jimpleArrayName + "[" + computeIndex(index) + "]");
    }
View Full Code Here

    }

    for (GimpleParameter param : gimpleFunction.getParameters()) {
      ImType type = translationContext.resolveType(param.getType());
      builder.addParameter(type.paramType(), "p_" + param.getName());
      ImExpr paramExpr = JvmExprs.toExpr(this, new JimpleExpr("p_" + param.getName()), type.paramType(), true);

      Variable variable = type.createLocalVariable(this, param.getName(), varUsage.getUsage(param.getId()));
      variable.writeAssignment(this, paramExpr);

View Full Code Here

  }

  public JimpleExpr declareTemp(JimpleType type, JimpleExpr value) {
    String tempVar = declareTemp(type);
    getBuilder().addAssignment(tempVar, value);
    return new JimpleExpr(tempVar);
  }
View Full Code Here

  }

  @Override
  public JimpleExpr translateToObjectReference(FunctionContext context, JimpleType className) {
    if(className.equals(recordType.getJimpleType())) {
      return new JimpleExpr(jimpleName);
    } else if(className.is(Object.class)) {
      return new JimpleExpr(jimpleName);
    }
    return super.translateToObjectReference(context, className);
  }
View Full Code Here

  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

      throw new UnsupportedOperationException(assign.getOperator().toString());
    }
  }

  private void assignFixTruncExpr(ImExpr lhs, ImExpr rhs) {
    JimpleExpr jimpleRhs = rhs.translateToPrimitive(context, (ImPrimitiveType) lhs.type());
    assignPrimitive(lhs, jimpleRhs);
  }
View Full Code Here


  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

  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

  private void assignPrimitive(ImExpr lhs, JimpleExpr jimpleExpr) {
    ((PrimitiveLValue)lhs).writePrimitiveAssignment(jimpleExpr);
  }

  private void assignTruthNot(ImExpr lhs, ImExpr op) {
    JimpleExpr expr = op.translateToPrimitive(context, ImPrimitiveType.BOOLEAN);
    JimpleExpr condition = new JimpleExpr(expr + " == 0");
    assignBoolean(lhs, condition);
  }
View Full Code Here

TOP

Related Classes of org.renjin.gcc.jimple.JimpleExpr

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.