Examples of JimpleExpr


Examples of org.renjin.gcc.jimple.JimpleExpr

    private ArrayElement(ImExpr index) {
      this.index = index;
    }
    @Override
    public void writeAssignment(FunctionContext context, ImExpr rhs) {
      JimpleExpr indexExpr = index.translateToPrimitive(context, ImPrimitiveType.INT);
      JimpleExpr primitiveRhs = rhs.translateToPrimitive(context, type.componentType());
      context.getBuilder().addAssignment(name + "[" + indexExpr + "]", primitiveRhs);
    }
View Full Code Here

Examples of org.renjin.gcc.jimple.JimpleExpr

      context.getBuilder().addAssignment(name + "[" + indexExpr + "]", primitiveRhs);
    }

    @Override
    public JimpleExpr translateToPrimitive(FunctionContext context, ImPrimitiveType type) {
      JimpleExpr indexExpr = index.translateToPrimitive(context, ImPrimitiveType.INT);
      JimpleExpr arrayRef = new JimpleExpr(name + "[" + indexExpr + "]");
      return type.castIfNeeded(arrayRef, type());
    }
View Full Code Here

Examples of org.renjin.gcc.jimple.JimpleExpr

      this.index = index;
    }

    @Override
    public ArrayRef translateToArrayRef(FunctionContext context) {
      JimpleExpr indexExpr = index.translateToPrimitive(context, ImPrimitiveType.INT);
      return new ArrayRef(name, indexExpr);
    }
View Full Code Here

Examples of org.renjin.gcc.jimple.JimpleExpr

    }

    @Override
    public JimpleExpr translateToObjectReference(FunctionContext context, JimpleType className) {
      if(PrimitiveArrayVar.this.type().asJimple().equals(className)) {
        return new JimpleExpr(PrimitiveArrayVar.this.name);
      } else {
        throw new UnsupportedOperationException(className.toString());
      }
    }
View Full Code Here

Examples of org.renjin.gcc.jimple.JimpleExpr

        cmp,
        ap.translateToPrimitive(context, type),
        operator,
        bp.translateToPrimitive(context, type)));

    return new JimpleExpr(cmp + " " + condition + " " + operand);
  }
View Full Code Here

Examples of org.renjin.gcc.jimple.JimpleExpr

  public JimpleExpr translateToPrimitive(FunctionContext context, ImPrimitiveType type) {
    return type.castIfNeeded(jimple(), this.type);
  }

  public JimpleExpr jimple() {
    return new JimpleExpr(jimpleName + "[0]");
  }
View Full Code Here

Examples of org.renjin.gcc.jimple.JimpleExpr

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

Examples of org.renjin.gcc.jimple.JimpleExpr

  private void writeNewPrimitiveArray(FunctionContext context, ImExpr lhs, ImExpr sizeArg) {

    ImPrimitivePtrType type = (ImPrimitivePtrType) lhs.type();

    JimpleExpr elementCount = getNumElementsExpr(context, sizeArg, type.getBaseType());

    // assign to our lhs
    ((ImLValue)lhs).writeAssignment(context, new NewArrayExpr(type, elementCount));
  }
View Full Code Here

Examples of org.renjin.gcc.jimple.JimpleExpr

  private void writeNewPrimitiveArrayPtr(FunctionContext context, ImExpr lhs, ImExpr sizeArg) {

    ImPrimitiveArrayPtrType type = (ImPrimitiveArrayPtrType) lhs.type();

    JimpleExpr elementCount = getNumElementsExpr(context, sizeArg, type.baseType().componentType());

    // assign to our lhs
    ((ImLValue)lhs).writeAssignment(context, new NewArrayExpr(type.baseType().componentType().pointerType(),
        elementCount));
  }
View Full Code Here

Examples of org.renjin.gcc.jimple.JimpleExpr

  private JimpleExpr getNumElementsExpr(FunctionContext context, ImExpr sizeArg, ImPrimitiveType type) {
    // malloc is given a size in bytes, we need to divide by the underlying storage
    // size to get the number of elements to allocate

    // get the argument as a primitive expression that evaluates to number of bytes
    JimpleExpr byteSizeExpr = sizeArg.translateToPrimitive(context, ImPrimitiveType.INT);

    // calculate number of elements
    JimpleExpr elementCount = new JimpleExpr(context.declareTemp(JimpleType.INT));
    context.getBuilder().addAssignment(elementCount, JimpleExpr.binaryInfix("/", byteSizeExpr,
      JimpleExpr.integerConstant(type.getStorageSizeInBytes())));
    return elementCount;
  }
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.