Search in sources :

Example 1 with LLVMSourceBasicType

use of com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceBasicType in project graal by oracle.

the class DebugExprType method getTypeFromSymbolTableMetaObject.

@TruffleBoundary
public static DebugExprType getTypeFromSymbolTableMetaObject(Object metaObj) {
    if (metaObj instanceof LLVMSourceBasicType) {
        LLVMSourceBasicType basicType = (LLVMSourceBasicType) metaObj;
        LLVMSourceBasicType.Kind typeKind = basicType.getKind();
        long typeSize = basicType.getSize();
        switch(typeKind) {
            case BOOLEAN:
                return DebugExprType.getIntType(1, false);
            case SIGNED:
                return DebugExprType.getIntType(typeSize, true);
            case UNSIGNED:
                return DebugExprType.getIntType(typeSize, false);
            case SIGNED_CHAR:
                return DebugExprType.getIntType(8, true);
            case UNSIGNED_CHAR:
                return DebugExprType.getIntType(8, false);
            case FLOATING:
                return DebugExprType.getFloatType(typeSize);
            default:
                return DebugExprType.getVoidType();
        }
    } else if (metaObj instanceof LLVMSourceArrayLikeType) {
        LLVMSourceArrayLikeType arrayType = (LLVMSourceArrayLikeType) metaObj;
        DebugExprType innerType = getTypeFromSymbolTableMetaObject(arrayType.getElementType(0));
        return new DebugExprType(Kind.ARRAY, innerType, arrayType.getElementCount());
    } else if (metaObj instanceof LLVMSourceDecoratorType) {
        return getTypeFromSymbolTableMetaObject(((LLVMSourceDecoratorType) metaObj).getActualType());
    } else if (metaObj instanceof LLVMSourceStructLikeType) {
        return new DebugExprType(Kind.STRUCT, null);
    } else if (metaObj instanceof LLVMSourcePointerType) {
        LLVMSourcePointerType pointerType = (LLVMSourcePointerType) metaObj;
        DebugExprType baseType = getTypeFromSymbolTableMetaObject(pointerType.getBaseType());
        return new DebugExprType(Kind.POINTER, baseType);
    } else {
        return DebugExprType.getVoidType();
    }
}
Also used : LLVMSourceStructLikeType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceStructLikeType) LLVMSourceDecoratorType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceDecoratorType) LLVMSourceBasicType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceBasicType) LLVMSourcePointerType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourcePointerType) LLVMSourceArrayLikeType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceArrayLikeType) TruffleBoundary(com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)

Example 2 with LLVMSourceBasicType

use of com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceBasicType in project graal by oracle.

the class DITypeExtractor method visit.

@Override
public void visit(MDBasicType mdType) {
    final String name = MDNameExtractor.getName(mdType.getName());
    final long size = mdType.getSize();
    final long align = mdType.getAlign();
    final long offset = mdType.getOffset();
    LLVMSourceBasicType.Kind kind;
    switch(mdType.getEncoding()) {
        case DW_ATE_ADDRESS:
            kind = LLVMSourceBasicType.Kind.ADDRESS;
            break;
        case DW_ATE_BOOLEAN:
            kind = LLVMSourceBasicType.Kind.BOOLEAN;
            break;
        case DW_ATE_FLOAT:
            kind = LLVMSourceBasicType.Kind.FLOATING;
            break;
        case DW_ATE_SIGNED:
            kind = LLVMSourceBasicType.Kind.SIGNED;
            break;
        case DW_ATE_SIGNED_CHAR:
            kind = LLVMSourceBasicType.Kind.SIGNED_CHAR;
            break;
        case DW_ATE_UNSIGNED:
            kind = LLVMSourceBasicType.Kind.UNSIGNED;
            break;
        case DW_ATE_UNSIGNED_CHAR:
            kind = LLVMSourceBasicType.Kind.UNSIGNED_CHAR;
            break;
        default:
            kind = LLVMSourceBasicType.Kind.UNKNOWN;
            break;
    }
    final LLVMSourceLocation location = scopeBuilder.buildLocation(mdType);
    final LLVMSourceType type = new LLVMSourceBasicType(name, size, align, offset, kind, location);
    parsedTypes.put(mdType, type);
}
Also used : LLVMSourceBasicType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceBasicType) LLVMSourceLocation(com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation) MDString(com.oracle.truffle.llvm.parser.metadata.MDString) LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType)

Aggregations

LLVMSourceBasicType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceBasicType)2 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)1 MDString (com.oracle.truffle.llvm.parser.metadata.MDString)1 LLVMSourceLocation (com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation)1 LLVMSourceArrayLikeType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceArrayLikeType)1 LLVMSourceDecoratorType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceDecoratorType)1 LLVMSourcePointerType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourcePointerType)1 LLVMSourceStructLikeType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceStructLikeType)1 LLVMSourceType (com.oracle.truffle.llvm.runtime.debug.type.LLVMSourceType)1