diff options
author | Amjad Aboud <amjad.aboud@intel.com> | 2016-06-18 10:25:07 +0000 |
---|---|---|
committer | Amjad Aboud <amjad.aboud@intel.com> | 2016-06-18 10:25:07 +0000 |
commit | 76c9eb99a7f1855d8ca88dcc76a5a784bc0dfeaf (patch) | |
tree | c4cfcf1e1ef596992e3a0fdfab2f88933b83ddd1 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h | |
parent | 3feda222c6fb290718ee23f585b6e07afb6559cb (diff) | |
download | bcm5719-llvm-76c9eb99a7f1855d8ca88dcc76a5a784bc0dfeaf.tar.gz bcm5719-llvm-76c9eb99a7f1855d8ca88dcc76a5a784bc0dfeaf.zip |
[codeview] Emit non-virtual method type.
Differential Revision: http://reviews.llvm.org/D21011
llvm-svn: 273084
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h index 2e3e167f66a..b54463dfe1d 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h @@ -31,6 +31,7 @@ namespace llvm { class StringRef; class LexicalScope; +struct ClassInfo; /// \brief Collects and handles line tables information in a CodeView format. class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { @@ -136,14 +137,21 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { /// All inlined subprograms in the order they should be emitted. SmallSetVector<const DISubprogram *, 4> InlinedSubprograms; - /// Map from DI metadata nodes to CodeView type indices. Primarily indexed by - /// DIType* and DISubprogram*. - DenseMap<const DINode *, codeview::TypeIndex> TypeIndices; + /// Map from a pair of DI metadata nodes and its DI type (or scope) that can + /// be nullptr, to CodeView type indices. Primarily indexed by + /// {DIType*, DIType*} and {DISubprogram*, DIType*}. + /// + /// The second entry in the key is needed for methods as DISubroutineType + /// representing static method type are shared with non-method function type. + DenseMap<std::pair<const DINode *, const DIType *>, codeview::TypeIndex> + TypeIndices; /// Map from DICompositeType* to complete type index. Non-record types are /// always looked up in the normal TypeIndices map. DenseMap<const DICompositeType *, codeview::TypeIndex> CompleteTypeIndices; + /// Map from DICompositeType* to class info. + DenseMap<const DICompositeType *, std::unique_ptr<ClassInfo>> ClassInfoMap; const DISubprogram *CurrentSubprogram = nullptr; // The UDTs we have seen while processing types; each entry is a pair of type @@ -159,14 +167,7 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { void maybeRecordLocation(const DebugLoc &DL, const MachineFunction *MF); - void clear() { - assert(CurFn == nullptr); - FileIdMap.clear(); - FnDebugInfo.clear(); - FileToFilepathMap.clear(); - LocalUDTs.clear(); - GlobalUDTs.clear(); - } + void clear(); void setCurrentSubprogram(const DISubprogram *SP) { CurrentSubprogram = SP; @@ -214,9 +215,10 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { /// Translates the DIType to codeview if necessary and returns a type index /// for it. - codeview::TypeIndex getTypeIndex(DITypeRef TypeRef); + codeview::TypeIndex getTypeIndex(DITypeRef TypeRef, + DITypeRef ClassTyRef = DITypeRef()); - codeview::TypeIndex lowerType(const DIType *Ty); + codeview::TypeIndex lowerType(const DIType *Ty, const DIType *ClassTy); codeview::TypeIndex lowerTypeAlias(const DIDerivedType *Ty); codeview::TypeIndex lowerTypeArray(const DICompositeType *Ty); codeview::TypeIndex lowerTypeBasic(const DIBasicType *Ty); @@ -224,6 +226,8 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { codeview::TypeIndex lowerTypeMemberPointer(const DIDerivedType *Ty); codeview::TypeIndex lowerTypeModifier(const DIDerivedType *Ty); codeview::TypeIndex lowerTypeFunction(const DISubroutineType *Ty); + codeview::TypeIndex lowerTypeMemberFunction(const DISubroutineType *Ty, + const DIType *ClassTy); codeview::TypeIndex lowerTypeEnum(const DICompositeType *Ty); codeview::TypeIndex lowerTypeClass(const DICompositeType *Ty); codeview::TypeIndex lowerTypeUnion(const DICompositeType *Ty); @@ -238,14 +242,22 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { codeview::TypeIndex lowerCompleteTypeClass(const DICompositeType *Ty); codeview::TypeIndex lowerCompleteTypeUnion(const DICompositeType *Ty); + codeview::TypeIndex lowerSubprogramType(const DISubprogram *SP); + + void collectMemberInfo(ClassInfo &Info, const DIDerivedType *DDTy); + ClassInfo &collectClassInfo(const DICompositeType *Ty); + /// Common record member lowering functionality for record types, which are /// structs, classes, and unions. Returns the field list index and the member /// count. - std::pair<codeview::TypeIndex, unsigned> + std::tuple<codeview::TypeIndex, codeview::TypeIndex, unsigned> lowerRecordFieldList(const DICompositeType *Ty); - /// Inserts {Node, TI} into TypeIndices and checks for duplicates. - void recordTypeIndexForDINode(const DINode *Node, codeview::TypeIndex TI); + /// Inserts {{Node, ClassTy}, TI} into TypeIndices and checks for duplicates. + void recordTypeIndexForDINode(const DINode *Node, codeview::TypeIndex TI, + const DIType *ClassTy = nullptr); + + unsigned getPointerSizeInBytes(); public: CodeViewDebug(AsmPrinter *Asm); |