Search in sources :

Example 26 with Type

use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.

the class Function method createInsertValue.

private void createInsertValue(long[] args) {
    int i = 0;
    int aggregate = getIndex(args[i++]);
    Type type;
    if (scope.isValueForwardRef(aggregate)) {
        type = types.get(args[i++]);
    } else {
        type = scope.getValueType(aggregate);
    }
    int value = getIndex(args[i++]);
    if (scope.isValueForwardRef(value)) {
        i++;
    }
    int index = (int) args[i++];
    if (args.length != i) {
        throw new UnsupportedOperationException("Multiple indices are not yet supported!");
    }
    emit(InsertValueInstruction.fromSymbols(scope.getSymbols(), type, aggregate, index, value));
}
Also used : PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType) StructureType(com.oracle.truffle.llvm.runtime.types.StructureType) ArrayType(com.oracle.truffle.llvm.runtime.types.ArrayType) AggregateType(com.oracle.truffle.llvm.runtime.types.AggregateType) Type(com.oracle.truffle.llvm.runtime.types.Type) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) FunctionType(com.oracle.truffle.llvm.runtime.types.FunctionType) VoidType(com.oracle.truffle.llvm.runtime.types.VoidType)

Example 27 with Type

use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.

the class Function method createSelect.

private void createSelect(long[] args) {
    int i = 0;
    Type type;
    int trueValue = getIndex(args[i++]);
    if (scope.isValueForwardRef(trueValue)) {
        type = types.get(args[i++]);
    } else {
        type = scope.getValueType(trueValue);
    }
    int falseValue = getIndex(args[i++]);
    int condition = getIndex(args[i]);
    emit(SelectInstruction.fromSymbols(scope.getSymbols(), type, condition, trueValue, falseValue));
}
Also used : PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType) StructureType(com.oracle.truffle.llvm.runtime.types.StructureType) ArrayType(com.oracle.truffle.llvm.runtime.types.ArrayType) AggregateType(com.oracle.truffle.llvm.runtime.types.AggregateType) Type(com.oracle.truffle.llvm.runtime.types.Type) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) FunctionType(com.oracle.truffle.llvm.runtime.types.FunctionType) VoidType(com.oracle.truffle.llvm.runtime.types.VoidType)

Example 28 with Type

use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.

the class Function method createAlloca.

private void createAlloca(long[] args) {
    int i = 0;
    final long typeRecord = args[i++];
    // type of count
    i++;
    final int count = getIndexAbsolute(args[i++]);
    final long alignRecord = args[i];
    final int align = getAlign(alignRecord & ~ALLOCA_FLAGSMASK);
    Type type = types.get(typeRecord);
    if ((alignRecord & ALLOCA_EXPLICITTYPEMASK) != 0L) {
        type = new PointerType(type);
    } else if (!(type instanceof PointerType)) {
        throw new AssertionError("Alloca must have PointerType!");
    }
    emit(AllocateInstruction.fromSymbols(scope.getSymbols(), type, count, align));
}
Also used : PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType) StructureType(com.oracle.truffle.llvm.runtime.types.StructureType) ArrayType(com.oracle.truffle.llvm.runtime.types.ArrayType) AggregateType(com.oracle.truffle.llvm.runtime.types.AggregateType) Type(com.oracle.truffle.llvm.runtime.types.Type) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) FunctionType(com.oracle.truffle.llvm.runtime.types.FunctionType) VoidType(com.oracle.truffle.llvm.runtime.types.VoidType) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType)

Example 29 with Type

use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.

the class Function method createGetElementPointer.

private void createGetElementPointer(long[] args) {
    int i = 0;
    boolean isInbounds = args[i++] != 0;
    // we do not use this parameter
    i++;
    int pointer = getIndex(args[i++]);
    Type base;
    if (scope.isValueForwardRef(pointer)) {
        base = types.get(args[i++]);
    } else {
        base = scope.getValueType(pointer);
    }
    List<Integer> indices = getIndices(args, i);
    Type type = new PointerType(getElementPointerType(base, indices));
    emit(GetElementPointerInstruction.fromSymbols(scope.getSymbols(), type, pointer, indices, isInbounds));
}
Also used : PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType) StructureType(com.oracle.truffle.llvm.runtime.types.StructureType) ArrayType(com.oracle.truffle.llvm.runtime.types.ArrayType) AggregateType(com.oracle.truffle.llvm.runtime.types.AggregateType) Type(com.oracle.truffle.llvm.runtime.types.Type) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) FunctionType(com.oracle.truffle.llvm.runtime.types.FunctionType) VoidType(com.oracle.truffle.llvm.runtime.types.VoidType) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType)

Example 30 with Type

use of com.oracle.truffle.llvm.runtime.types.Type in project sulong by graalvm.

the class Function method setupScope.

public void setupScope() {
    scope.startLocalScope(function);
    final FunctionType functionType = function.getType();
    for (Type argType : functionType.getArgumentTypes()) {
        scope.addSymbol(function.createParameter(argType), argType);
    }
}
Also used : PrimitiveType(com.oracle.truffle.llvm.runtime.types.PrimitiveType) VectorType(com.oracle.truffle.llvm.runtime.types.VectorType) StructureType(com.oracle.truffle.llvm.runtime.types.StructureType) ArrayType(com.oracle.truffle.llvm.runtime.types.ArrayType) AggregateType(com.oracle.truffle.llvm.runtime.types.AggregateType) Type(com.oracle.truffle.llvm.runtime.types.Type) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) FunctionType(com.oracle.truffle.llvm.runtime.types.FunctionType) VoidType(com.oracle.truffle.llvm.runtime.types.VoidType) FunctionType(com.oracle.truffle.llvm.runtime.types.FunctionType)

Aggregations

Type (com.oracle.truffle.llvm.runtime.types.Type)76 PointerType (com.oracle.truffle.llvm.runtime.types.PointerType)68 PrimitiveType (com.oracle.truffle.llvm.runtime.types.PrimitiveType)64 StructureType (com.oracle.truffle.llvm.runtime.types.StructureType)63 FunctionType (com.oracle.truffle.llvm.runtime.types.FunctionType)57 ArrayType (com.oracle.truffle.llvm.runtime.types.ArrayType)54 AggregateType (com.oracle.truffle.llvm.runtime.types.AggregateType)50 VoidType (com.oracle.truffle.llvm.runtime.types.VoidType)43 LLVMExpressionNode (com.oracle.truffle.llvm.runtime.nodes.api.LLVMExpressionNode)33 VectorType (com.oracle.truffle.llvm.runtime.types.VectorType)32 LLVMArithmeticInstructionType (com.oracle.truffle.llvm.parser.instructions.LLVMArithmeticInstructionType)28 LLVMConversionType (com.oracle.truffle.llvm.parser.instructions.LLVMConversionType)28 MetaType (com.oracle.truffle.llvm.runtime.types.MetaType)13 SymbolImpl (com.oracle.truffle.llvm.parser.model.SymbolImpl)9 LLVMInteropType (com.oracle.truffle.llvm.runtime.interop.access.LLVMInteropType)8 VariableBitWidthType (com.oracle.truffle.llvm.runtime.types.VariableBitWidthType)8 LLVMSourcePointerType (com.oracle.truffle.llvm.runtime.debug.LLVMSourcePointerType)6 LLVMSourceType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceType)6 FrameSlot (com.oracle.truffle.api.frame.FrameSlot)5 LLVMUnsupportedInlineAssemblerNode (com.oracle.truffle.llvm.nodes.others.LLVMUnsupportedInlineAssemblerNode)5