Search in sources :

Example 1 with LLVMSourceType

use of com.oracle.truffle.llvm.runtime.debug.LLVMSourceType in project sulong by graalvm.

the class LLVMGlobal method getInteropType.

public LLVMInteropType getInteropType() {
    if (!interopTypeCached) {
        CompilerDirectives.transferToInterpreterAndInvalidate();
        LLVMSourceType sourceType = getSourceType();
        if (sourceType == null) {
            interopType = LLVMInteropType.UNKNOWN;
        } else {
            interopType = LLVMInteropType.fromSourceType(sourceType);
        }
        interopTypeCached = true;
    }
    return interopType;
}
Also used : LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.LLVMSourceType)

Example 2 with LLVMSourceType

use of com.oracle.truffle.llvm.runtime.debug.LLVMSourceType in project sulong by graalvm.

the class DITypeExtractor method visit.

@Override
public void visit(MDLocalVariable mdLocal) {
    LLVMSourceType type = resolve(mdLocal.getType());
    if (Flags.OBJECT_POINTER.isSetIn(mdLocal.getFlags()) && type instanceof LLVMSourcePointerType) {
        // llvm does not set the objectpointer flag on this pointer type even though it sets
        // it on the pointer type that is used in the function type descriptor
        final LLVMSourcePointerType oldPointer = (LLVMSourcePointerType) type;
        final LLVMSourcePointerType newPointer = new LLVMSourcePointerType(oldPointer.getSize(), oldPointer.getAlign(), oldPointer.getOffset(), true, oldPointer.isReference(), type.getLocation());
        newPointer.setBaseType(oldPointer.getBaseType());
        newPointer.setName(oldPointer::getName);
        type = newPointer;
    }
    parsedTypes.put(mdLocal, type);
}
Also used : LLVMSourcePointerType(com.oracle.truffle.llvm.runtime.debug.LLVMSourcePointerType) LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.LLVMSourceType)

Example 3 with LLVMSourceType

use of com.oracle.truffle.llvm.runtime.debug.LLVMSourceType in project sulong by graalvm.

the class DITypeExtractor method resolve.

private LLVMSourceType resolve(MDBaseNode node) {
    LLVMSourceType parsedType = parsedTypes.get(node);
    if (parsedType != null) {
        return parsedType;
    }
    node.accept(this);
    parsedType = parsedTypes.get(node);
    return parsedType != null ? parsedType : UNKNOWN;
}
Also used : LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.LLVMSourceType)

Example 4 with LLVMSourceType

use of com.oracle.truffle.llvm.runtime.debug.LLVMSourceType in project sulong by graalvm.

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.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.LLVMSourceType)

Example 5 with LLVMSourceType

use of com.oracle.truffle.llvm.runtime.debug.LLVMSourceType in project sulong by graalvm.

the class DITypeExtractor method visit.

@Override
public void visit(MDSubroutine mdSubroutine) {
    final List<LLVMSourceType> members = new ArrayList<>();
    final LLVMSourceFunctionType type = new LLVMSourceFunctionType(members);
    parsedTypes.put(mdSubroutine, type);
    getElements(mdSubroutine.getTypes(), members, true);
}
Also used : ArrayList(java.util.ArrayList) LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.LLVMSourceType) LLVMSourceFunctionType(com.oracle.truffle.llvm.runtime.debug.LLVMSourceFunctionType)

Aggregations

LLVMSourceType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceType)13 LLVMSourceLocation (com.oracle.truffle.llvm.runtime.debug.scope.LLVMSourceLocation)5 MDString (com.oracle.truffle.llvm.parser.metadata.MDString)3 LLVMSourceFunctionType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceFunctionType)3 LLVMSourcePointerType (com.oracle.truffle.llvm.runtime.debug.LLVMSourcePointerType)3 LLVMSourceStaticMemberType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceStaticMemberType)3 ArrayList (java.util.ArrayList)3 MDBaseNode (com.oracle.truffle.llvm.parser.metadata.MDBaseNode)2 MDCompositeType (com.oracle.truffle.llvm.parser.metadata.MDCompositeType)2 MDValue (com.oracle.truffle.llvm.parser.metadata.MDValue)2 MetadataValueList (com.oracle.truffle.llvm.parser.metadata.MetadataValueList)2 SymbolImpl (com.oracle.truffle.llvm.parser.model.SymbolImpl)2 LLVMSourceArrayLikeType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceArrayLikeType)2 LLVMSourceBasicType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceBasicType)2 LLVMSourceEnumLikeType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceEnumLikeType)2 LLVMSourceMemberType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceMemberType)2 LLVMSourceStructLikeType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceStructLikeType)2 List (java.util.List)2 TruffleBoundary (com.oracle.truffle.api.CompilerDirectives.TruffleBoundary)1 Source (com.oracle.truffle.api.source.Source)1