Search in sources :

Example 31 with Variable

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

the class BroMethodCompiler method marshalFloatToMachineSizedFloat.

protected Value marshalFloatToMachineSizedFloat(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)

Example 32 with Variable

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

the class ClassCompiler method getClassFieldPtr.

static Value getClassFieldPtr(Function f, SootField field, List<SootField> classFields, StructureType classType) {
    Value info = getInfoStruct(f, field.getDeclaringClass());
    Variable base = f.newVariable(I8_PTR);
    f.add(new Load(base, info));
    return getFieldPtr(f, new VariableRef(base), offsetof(classType, 1, classFields.indexOf(field), 1), getType(field.getType()));
}
Also used : Load(org.robovm.compiler.llvm.Load) VariableRef(org.robovm.compiler.llvm.VariableRef) Variable(org.robovm.compiler.llvm.Variable) Value(org.robovm.compiler.llvm.Value)

Example 33 with Variable

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

the class BroMethodCompiler method marshalMachineSizedUIntToLong.

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

Example 34 with Variable

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

the class BroMethodCompiler method marshalLongToMachineSizedInt.

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

Example 35 with Variable

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

the class BroMethodCompiler method marshalArrayToNative.

protected void marshalArrayToNative(Function fn, MarshalerMethod marshalerMethod, Value env, Value object, Value destPtr, long flags, int[] dimensions) {
    Invokestatic invokestatic = marshalerMethod.getInvokeStatic(sootMethod.getDeclaringClass());
    trampolines.add(invokestatic);
    Variable handle = fn.newVariable(I64);
    fn.add(new Ptrtoint(handle, destPtr, I64));
    List<Value> args = new ArrayList<>();
    args.add(env);
    args.add(object);
    args.add(handle.ref());
    args.add(new IntegerConstant(flags));
    args.addAll(arrayDimensionsValues(dimensions));
    call(fn, invokestatic.getFunctionRef(), args);
}
Also used : Invokestatic(org.robovm.compiler.trampoline.Invokestatic) Variable(org.robovm.compiler.llvm.Variable) Ptrtoint(org.robovm.compiler.llvm.Ptrtoint) ArrayList(java.util.ArrayList) Value(org.robovm.compiler.llvm.Value) IntegerConstant(org.robovm.compiler.llvm.IntegerConstant)

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