Package org.renjin.gcc.translate.expr

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


   * If pointers are being used in the comparison, than we
   * need to interpret them as integers.
   */
  private ImExpr pointerToInteger(FunctionContext context, ImExpr a) {
    if(a instanceof ImIndirectExpr) {
      ArrayRef arrayRef = ((ImIndirectExpr) a).translateToArrayRef(context);
      return new ImLiteralPrimitiveExpr(arrayRef.getIndexExpr(), ImPrimitiveType.INT);
    } else {
      return a;
    }
  }
View Full Code Here


import org.renjin.gcc.translate.type.PrimitiveTypes;

public class PtrWrapperUtils {

  public static JimpleExpr wrapPointer(FunctionContext context, ImIndirectExpr ptr) {
    ArrayRef ref = ptr.translateToArrayRef(context);
    JimpleType wrapperType = ptr.type().getWrapperType();

    String tempWrapper = context.declareTemp(wrapperType);
    context.getBuilder().addStatement(tempWrapper + " = new " + wrapperType);
    context.getBuilder().addStatement(
        "specialinvoke " + tempWrapper + ".<" + wrapperType + ": void <init>("
            + ptr.type().getArrayType() + ", int)>(" + ref.getArrayExpr() + ", " + ref.getIndexExpr() + ")");

    return new JimpleExpr(tempWrapper);
  }
View Full Code Here

    context.getBuilder().addVarDecl(JimpleType.INT, jimpleStartIndexName);
  }

  @Override
  public ArrayRef translateToArrayRef(FunctionContext context) {
    return new ArrayRef(jimpleArrayName, jimpleStartIndexName);
  }
View Full Code Here

  @Override
  public void writeAssignment(FunctionContext context, ImExpr rhs) {
    if(rhs instanceof ImIndirectExpr) {
      ImIndirectExpr ptr = (ImIndirectExpr) rhs;
      ArrayRef ref = ptr.translateToArrayRef(context);
      context.getBuilder().addAssignment(jimpleArrayName, ref.getArrayExpr());
      context.getBuilder().addAssignment(jimpleStartIndexName, ref.getIndexExpr());
    } else {
      throw new UnsupportedOperationException(rhs.toString());
    }
  }
View Full Code Here

TOP

Related Classes of org.renjin.gcc.translate.expr.ArrayRef

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.