Search in sources :

Example 1 with MDCompositeType

use of com.oracle.truffle.llvm.parser.metadata.MDCompositeType in project sulong by graalvm.

the class Metadata method createOldNode.

private void createOldNode(long[] args) {
    if (ParseUtil.isInteger(args, ARGINDEX_IDENT, this) && DwTagRecord.isDwarfDescriptor(ParseUtil.asLong(args, ARGINDEX_IDENT, this))) {
        // this is a debug information descriptor as described in
        // http://releases.llvm.org/3.2/docs/SourceLevelDebugging.html#debug_info_descriptors
        final int ident = ParseUtil.asInt(args, ARGINDEX_IDENT, this);
        final DwTagRecord record = DwTagRecord.decode(ident);
        switch(record) {
            case DW_TAG_COMPILE_UNIT:
                metadata.add(MDCompileUnit.create32(args, this));
                break;
            case DW_TAG_FILE_TYPE:
                metadata.add(MDFile.create32(args, this));
                break;
            case DW_TAG_CONSTANT:
            case DW_TAG_VARIABLE:
                // descriptor for a global variable or constant
                metadata.add(MDGlobalVariable.create32(args, this));
                break;
            case DW_TAG_SUBPROGRAM:
                metadata.add(MDSubprogram.create32(args, this));
                break;
            case DW_TAG_LEXICAL_BLOCK:
                metadata.add(createLexicalBlock(args));
                break;
            case DW_TAG_BASE_TYPE:
                metadata.add(MDBasicType.create32(args, this));
                break;
            case DW_TAG_FORMAL_PARAMETER:
            case DW_TAG_MEMBER:
            case DW_TAG_POINTER_TYPE:
            case DW_TAG_REFERENCE_TYPE:
            case DW_TAG_TYPEDEF:
            case DW_TAG_CONST_TYPE:
            case DW_TAG_VOLATILE_TYPE:
            case DW_TAG_RESTRICT_TYPE:
            case DW_TAG_FRIEND:
                metadata.add(MDDerivedType.create32(args, this));
                break;
            case DW_TAG_CLASS_TYPE:
            case DW_TAG_ARRAY_TYPE:
            case DW_TAG_ENUMERATION_TYPE:
            case DW_TAG_STRUCTURE_TYPE:
            case DW_TAG_UNION_TYPE:
            case DW_TAG_VECTOR_TYPE:
            case DW_TAG_INHERITANCE:
            case DW_TAG_SUBROUTINE_TYPE:
                {
                    final MDCompositeType type = MDCompositeType.create32(args, this);
                    metadata.add(type);
                    compositeTypes.add(type);
                    break;
                }
            case DW_TAG_SUBRANGE_TYPE:
                metadata.add(MDSubrange.create32(args, this));
                break;
            case DW_TAG_ENUMERATOR:
                metadata.add(MDEnumerator.create32(args, this));
                break;
            case DW_TAG_AUTO_VARIABLE:
            case DW_TAG_ARG_VARIABLE:
            case DW_TAG_RETURN_VARIABLE:
                {
                    final MDLocalVariable md = MDLocalVariable.create32(args, this);
                    metadata.registerLocal(md);
                    metadata.add(md);
                    break;
                }
            case DW_TAG_UNKNOWN:
                metadata.add(MDNode.create32(args, this));
                break;
            case DW_TAG_TEMPLATE_TYPE_PARAMETER:
                metadata.add(MDTemplateTypeParameter.create32(args, this));
                break;
            case DW_TAG_TEMPLATE_VALUE_PARAMETER:
                metadata.add(MDTemplateValue.create32(args, this));
                break;
            case DW_TAG_NAMESPACE:
                metadata.add(MDNamespace.create32(args, this));
                break;
            default:
                metadata.add(MDNode.create32(args, this));
        }
    } else {
        metadata.add(MDNode.create32(args, this));
    }
}
Also used : MDLocalVariable(com.oracle.truffle.llvm.parser.metadata.MDLocalVariable) MDCompositeType(com.oracle.truffle.llvm.parser.metadata.MDCompositeType) DwTagRecord(com.oracle.truffle.llvm.parser.records.DwTagRecord)

Example 2 with MDCompositeType

use of com.oracle.truffle.llvm.parser.metadata.MDCompositeType in project sulong by graalvm.

the class Metadata method exit.

@Override
public void exit() {
    for (MDCompositeType type : compositeTypes) {
        final String identifier = MDString.getIfInstance(type.getIdentifier());
        metadata.registerType(identifier, type);
    }
}
Also used : MDString(com.oracle.truffle.llvm.parser.metadata.MDString) MDCompositeType(com.oracle.truffle.llvm.parser.metadata.MDCompositeType)

Example 3 with MDCompositeType

use of com.oracle.truffle.llvm.parser.metadata.MDCompositeType in project sulong by graalvm.

the class DITypeExtractor method visit.

@Override
public void visit(MDString mdString) {
    final MDCompositeType referencedType = metadata.identifyType(mdString.getString());
    if (referencedType != null) {
        final LLVMSourceType type = resolve(referencedType);
        parsedTypes.put(mdString, type);
    }
}
Also used : LLVMSourceType(com.oracle.truffle.llvm.runtime.debug.LLVMSourceType) MDCompositeType(com.oracle.truffle.llvm.parser.metadata.MDCompositeType)

Aggregations

MDCompositeType (com.oracle.truffle.llvm.parser.metadata.MDCompositeType)3 MDLocalVariable (com.oracle.truffle.llvm.parser.metadata.MDLocalVariable)1 MDString (com.oracle.truffle.llvm.parser.metadata.MDString)1 DwTagRecord (com.oracle.truffle.llvm.parser.records.DwTagRecord)1 LLVMSourceType (com.oracle.truffle.llvm.runtime.debug.LLVMSourceType)1