diff options
author | Reid Kleckner <rnk@google.com> | 2016-05-23 20:23:46 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-05-23 20:23:46 +0000 |
commit | 2280f9325e6993df3d858300b9ab6901a6b78ba4 (patch) | |
tree | 83a2709f00c14302aac6112dfc5c351e909a46ec /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h | |
parent | 91f6f07bb88fd39be8b5e0fd2fdf12903316c662 (diff) | |
download | bcm5719-llvm-2280f9325e6993df3d858300b9ab6901a6b78ba4.tar.gz bcm5719-llvm-2280f9325e6993df3d858300b9ab6901a6b78ba4.zip |
Modify emitTypeInformation to use MemoryTypeTableBuilder, take 2
This effectively revers commit r270389 and re-lands r270106, but it's
almost a rewrite.
The behavior change in r270106 was that we could no longer assume that
each LF_FUNC_ID record got its own type index. This patch adds a map
from DINode* to TypeIndex, so we can stop making that assumption.
This change also emits padding bytes between type records similar to the
way MSVC does. The size of the type record includes the padding bytes.
llvm-svn: 270485
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h index 3cc11728504..53e1aa0b422 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h @@ -20,6 +20,7 @@ #include "llvm/CodeGen/AsmPrinter.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/DebugInfo/CodeView/MemoryTypeTableBuilder.h" #include "llvm/DebugInfo/CodeView/TypeIndex.h" #include "llvm/IR/DebugInfo.h" #include "llvm/IR/DebugLoc.h" @@ -34,6 +35,7 @@ class LexicalScope; /// \brief Collects and handles line tables information in a CodeView format. class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { MCStreamer &OS; + codeview::MemoryTypeTableBuilder TypeTable; /// Represents the most general definition range. struct LocalVarDefRange { @@ -103,20 +105,16 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { /// to be confused with type indices for LF_FUNC_ID records. unsigned NextFuncId = 0; - /// The next available type index. - unsigned NextTypeIndex = llvm::codeview::TypeIndex::FirstNonSimpleIndex; + codeview::TypeIndex VoidFnTyIdx; - /// Get the next type index and reserve it. Can be used to reserve more than - /// one type index. - unsigned getNextTypeIndex(unsigned NumRecords = 1) { - unsigned Result = NextTypeIndex; - NextTypeIndex += NumRecords; - return Result; - } + /// Get a type index for a generic void function type. + codeview::TypeIndex getGenericFunctionTypeIndex(); InlineSite &getInlineSite(const DILocation *InlinedAt, const DISubprogram *Inlinee); + void recordFuncIdForSubprogram(const DISubprogram *SP); + static void collectInlineSiteChildren(SmallVectorImpl<unsigned> &Children, const FunctionInfo &FI, const InlineSite &Site); @@ -128,18 +126,12 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase { /// Map from DIFile to .cv_file id. DenseMap<const DIFile *, unsigned> FileIdMap; - /// Map from subprogram to index in InlinedSubprograms. - DenseMap<const DISubprogram *, size_t> SubprogramIndices; - /// All inlined subprograms in the order they should be emitted. - SmallVector<const DISubprogram *, 4> InlinedSubprograms; - - /// The first type index that refers to an LF_FUNC_ID record. We have one - /// record per inlined subprogram. - /// FIXME: Keep in sync with emitTypeInformation until we buffer type records - /// on the side as we go. Once we buffer type records, we can allocate type - /// indices on demand without interleaving our assembly output. - unsigned FuncIdTypeIndexStart = NextTypeIndex + 2; + 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; typedef std::map<const DIFile *, std::string> FileToFilepathMapTy; FileToFilepathMapTy FileToFilepathMap; |