Search in sources :

Example 36 with Variable

use of org.robovm.compiler.llvm.Variable in project robovm by robovm.

the class BroMethodCompiler method marshalMachineSizedSIntToLong.

protected Value marshalMachineSizedSIntToLong(Function fn, Value value) {
    if (config.getArch().is32Bit()) {
        Variable result = fn.newVariable(I64);
        fn.add(new Sext(result, value, I64));
        return result.ref();
    } else {
        return value;
    }
}
Also used : Variable(org.robovm.compiler.llvm.Variable) Sext(org.robovm.compiler.llvm.Sext)

Example 37 with Variable

use of org.robovm.compiler.llvm.Variable in project robovm by robovm.

the class BroMethodCompiler method marshalNativeToObject.

protected Value marshalNativeToObject(Function fn, MarshalerMethod marshalerMethod, MarshaledArg marshaledArg, Value env, String valueClassName, Value nativeValue, long flags) {
    if (nativeValue.getType() instanceof StructureType) {
        nativeValue = createStackCopy(fn, nativeValue);
    }
    Invokestatic invokestatic = marshalerMethod.getInvokeStatic(sootMethod.getDeclaringClass());
    trampolines.add(invokestatic);
    Value valueClass = ldcClass(fn, valueClassName, env);
    Variable handle = fn.newVariable(I64);
    fn.add(new Ptrtoint(handle, nativeValue, I64));
    Value object = call(fn, invokestatic.getFunctionRef(), env, valueClass, handle.ref(), new IntegerConstant(flags));
    if (marshaledArg != null) {
        marshaledArg.handle = handle.ref();
        marshaledArg.object = object;
    }
    return object;
}
Also used : Invokestatic(org.robovm.compiler.trampoline.Invokestatic) Variable(org.robovm.compiler.llvm.Variable) Ptrtoint(org.robovm.compiler.llvm.Ptrtoint) StructureType(org.robovm.compiler.llvm.StructureType) Value(org.robovm.compiler.llvm.Value) IntegerConstant(org.robovm.compiler.llvm.IntegerConstant)

Example 38 with Variable

use of org.robovm.compiler.llvm.Variable in project robovm by robovm.

the class BroMethodCompiler method marshalMachineSizedFloatToDouble.

protected Value marshalMachineSizedFloatToDouble(Function fn, Value value) {
    if (config.getArch().is32Bit()) {
        Variable result = fn.newVariable(DOUBLE);
        fn.add(new Fpext(result, value, DOUBLE));
        return result.ref();
    } else {
        return value;
    }
}
Also used : Variable(org.robovm.compiler.llvm.Variable) Fpext(org.robovm.compiler.llvm.Fpext)

Aggregations

Variable (org.robovm.compiler.llvm.Variable)38 PointerType (org.robovm.compiler.llvm.PointerType)18 Value (org.robovm.compiler.llvm.Value)18 IntegerConstant (org.robovm.compiler.llvm.IntegerConstant)14 Load (org.robovm.compiler.llvm.Load)12 Type (org.robovm.compiler.llvm.Type)11 FunctionType (org.robovm.compiler.llvm.FunctionType)10 Bitcast (org.robovm.compiler.llvm.Bitcast)9 ConstantBitcast (org.robovm.compiler.llvm.ConstantBitcast)8 Ret (org.robovm.compiler.llvm.Ret)8 VariableRef (org.robovm.compiler.llvm.VariableRef)8 Getelementptr (org.robovm.compiler.llvm.Getelementptr)7 ArrayType (org.robovm.compiler.llvm.ArrayType)6 Br (org.robovm.compiler.llvm.Br)6 Function (org.robovm.compiler.llvm.Function)6 Icmp (org.robovm.compiler.llvm.Icmp)6 IntegerType (org.robovm.compiler.llvm.IntegerType)6 Label (org.robovm.compiler.llvm.Label)6 StructureType (org.robovm.compiler.llvm.StructureType)6 ArrayList (java.util.ArrayList)5