Ejemplo n.º 1
0
  public ImExpr resolveExpr(GimpleExpr gimpleExpr) {
    if (gimpleExpr instanceof GimpleMemRef) {
      return resolveExpr(((GimpleMemRef) gimpleExpr).getPointer()).memref();
    } else if (gimpleExpr instanceof SymbolRef) {
      return lookupVar(gimpleExpr);

    } else if (gimpleExpr instanceof GimpleStringConstant) {
      return new ImStringConstant((GimpleStringConstant) gimpleExpr);

    } else if (gimpleExpr instanceof GimpleConstant) {
      return new ImPrimitiveConstant(this, (GimpleConstant) gimpleExpr);

    } else if (gimpleExpr instanceof GimpleAddressOf) {
      return resolveExpr(((GimpleAddressOf) gimpleExpr).getValue()).addressOf();

    } else if (gimpleExpr instanceof GimpleFunctionRef) {
      return new ImFunctionExpr(
          translationContext.resolveMethod(((GimpleFunctionRef) gimpleExpr).getName()));

    } else if (gimpleExpr instanceof GimpleArrayRef) {
      GimpleArrayRef arrayRef = (GimpleArrayRef) gimpleExpr;
      return resolveExpr(arrayRef.getArray()).elementAt(resolveExpr(arrayRef.getIndex()));

    } else if (gimpleExpr instanceof GimpleComponentRef) {
      GimpleComponentRef componentRef = (GimpleComponentRef) gimpleExpr;
      return resolveExpr(componentRef.getValue()).member(componentRef.getMember());

    } else if (gimpleExpr instanceof GimpleConstantRef) {
      return resolveExpr(((GimpleConstantRef) gimpleExpr).getValue());
    }
    throw new UnsupportedOperationException(gimpleExpr.toString());
  }
Ejemplo n.º 2
0
 public MethodRef resolveMethod(GimpleCall call) {
   return translationContext.resolveMethod(call, getCallingConvention());
 }