diff options
author | Devang Patel <dpatel@apple.com> | 2010-09-28 18:08:20 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-09-28 18:08:20 +0000 |
commit | 7a55481fa4605d27f4096a4d9f678bfb20df9f7e (patch) | |
tree | dad3bdf5fd9e4bdfb51838210cd4b35b3f66b275 /llvm/lib | |
parent | 1ba435f0f95de7b60566248402924225e479c684 (diff) | |
download | bcm5719-llvm-7a55481fa4605d27f4096a4d9f678bfb20df9f7e.tar.gz bcm5719-llvm-7a55481fa4605d27f4096a4d9f678bfb20df9f7e.zip |
Provide an interface to let FEs anchor debug info for types.
llvm-svn: 114969
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/DebugInfo.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 4 |
2 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp index fec269e2205..dba7b8f2422 100644 --- a/llvm/lib/Analysis/DebugInfo.cpp +++ b/llvm/lib/Analysis/DebugInfo.cpp @@ -1306,6 +1306,14 @@ Instruction *DIFactory::InsertDbgValueIntrinsic(Value *V, uint64_t Offset, return CallInst::Create(ValueFn, Args, Args+3, "", InsertAtEnd); } +// RecordType - Record DIType in a module such that it is not lost even if +// it is not referenced through debug info anchors. +void DIFactory::RecordType(DIType T) { + NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.ty"); + NMD->addOperand(T); +} + + //===----------------------------------------------------------------------===// // DebugInfoFinder implementations. //===----------------------------------------------------------------------===// diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 6fb9b163a03..f26047aee43 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2056,6 +2056,10 @@ void DwarfDebug::beginModule(Module *M) { for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) getOrCreateTypeDIE(DIType(NMD->getOperand(i))); + if (NamedMDNode *NMD = M->getNamedMetadata("llvm.dbg.ty")) + for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) + getOrCreateTypeDIE(DIType(NMD->getOperand(i))); + // Prime section data. SectionMap.insert(Asm->getObjFileLowering().getTextSection()); |