Search in sources :

Example 51 with Type

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

the class Function method createInsertElement.

private void createInsertElement(long[] args) {
    int i = 0;
    int vector = getIndex(args[i++]);
    Type type;
    if (scope.isValueForwardRef(vector)) {
        type = types.get(args[i++]);
    } else {
        type = scope.getValueType(vector);
    }
    int value = getIndex(args[i++]);
    int index = getIndex(args[i]);
    emit(InsertElementInstruction.fromSymbols(scope.getSymbols(), type, vector, 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 52 with Type

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

the class Function method createAtomicReadModifyWrite.

private void createAtomicReadModifyWrite(long[] args) {
    int i = 0;
    final int ptr = getIndex(args[i++]);
    final Type ptrType;
    if (scope.isValueForwardRef(ptr)) {
        ptrType = types.get(args[i++]);
    } else {
        ptrType = scope.getValueType(ptr);
    }
    final int value = getIndex(args[i++]);
    final int opcode = (int) args[i++];
    final boolean isVolatile = args[i++] != 0;
    final long atomicOrdering = args[i++];
    final long synchronizationScope = args[i];
    final Type type = ((PointerType) ptrType).getPointeeType();
    emit(ReadModifyWriteInstruction.fromSymbols(scope.getSymbols(), type, ptr, value, opcode, isVolatile, atomicOrdering, synchronizationScope));
}
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 53 with Type

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

the class Function method createExtractValue.

private void createExtractValue(long[] args) {
    int i = 0;
    int aggregate = getIndex(args[i++]);
    Type aggregateType = null;
    if (scope.isValueForwardRef(aggregate)) {
        aggregateType = types.get(args[i++]);
    }
    int index = (int) args[i++];
    if (aggregateType == null) {
        aggregateType = scope.getValueType(aggregate);
    }
    if (i != args.length) {
        throw new UnsupportedOperationException("Multiple indices are not yet supported!");
    }
    final Type elementType = ((AggregateType) aggregateType).getElementType(index);
    emit(ExtractValueInstruction.fromSymbols(scope.getSymbols(), elementType, aggregate, index));
}
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) AggregateType(com.oracle.truffle.llvm.runtime.types.AggregateType)

Example 54 with Type

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

the class Module method createGlobalVariable.

private void createGlobalVariable(long[] args) {
    final int recordOffset = useStrTab() ? STRTAB_RECORD_OFFSET : 0;
    final long typeField = args[GLOBALVAR_TYPE + recordOffset];
    final long flagField = args[GLOBALVAR_FLAGS + recordOffset];
    Type type = types.get(typeField);
    if ((flagField & GLOBALVAR_EXPLICICTTYPE_MASK) != 0) {
        type = new PointerType(type);
    }
    final boolean isConstant = (flagField & GLOBALVAR_ISCONSTANT_MASK) != 0;
    final int initialiser = (int) args[GLOBALVAR_INTITIALIZER + recordOffset];
    final long linkage = args[GLOBALVAR_LINKAGE + recordOffset];
    final int align = (int) args[GLOBALVAR_ALIGN + recordOffset];
    long visibility = Visibility.DEFAULT.getEncodedValue();
    if (GLOBALVAR_VISIBILITY + recordOffset < args.length) {
        visibility = args[GLOBALVAR_VISIBILITY + recordOffset];
    }
    final GlobalValueSymbol global;
    if (isConstant) {
        global = GlobalConstant.create(type, align, linkage, visibility, scope.getSymbols(), initialiser);
    } else {
        global = GlobalVariable.create(type, align, linkage, visibility, scope.getSymbols(), initialiser);
    }
    if (useStrTab()) {
        readNameFromStrTab(args, global);
    }
    module.addGlobalSymbol(global);
    scope.addSymbol(global, global.getType());
}
Also used : PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) Type(com.oracle.truffle.llvm.runtime.types.Type) FunctionType(com.oracle.truffle.llvm.runtime.types.FunctionType) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) GlobalValueSymbol(com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalValueSymbol)

Example 55 with Type

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

the class Module method createGlobalAliasNew.

private void createGlobalAliasNew(long[] args) {
    final int recordOffset = useStrTab() ? STRTAB_RECORD_OFFSET : 0;
    final Type type = new PointerType(types.get(args[GLOBALALIAS_TYPE + recordOffset]));
    // idx = 1 is address space information
    final int value = (int) args[GLOBALALIAS_NEW_VALUE + recordOffset];
    final long linkage = args[GLOBALALIAS_NEW_LINKAGE + recordOffset];
    final GlobalAlias global = GlobalAlias.create(type, linkage, Visibility.DEFAULT.ordinal(), scope.getSymbols(), value);
    if (useStrTab()) {
        readNameFromStrTab(args, global);
    }
    module.addGlobalSymbol(global);
    scope.addSymbol(global, global.getType());
}
Also used : PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) Type(com.oracle.truffle.llvm.runtime.types.Type) FunctionType(com.oracle.truffle.llvm.runtime.types.FunctionType) PointerType(com.oracle.truffle.llvm.runtime.types.PointerType) GlobalAlias(com.oracle.truffle.llvm.parser.model.symbols.globals.GlobalAlias)

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