diff options
| author | Devang Patel <dpatel@apple.com> | 2011-07-19 01:03:32 +0000 |
|---|---|---|
| committer | Devang Patel <dpatel@apple.com> | 2011-07-19 01:03:32 +0000 |
| commit | ac532dedf1fe89b8ded9920f202829f4dc20fade (patch) | |
| tree | c04880925e61b0994ebf6fcaed20417b7dc9676a /llvm/lib/Analysis/DebugInfo.cpp | |
| parent | 206f5093e30d7287bcc421f4138b59bc992365ac (diff) | |
| download | llvm-ac532dedf1fe89b8ded9920f202829f4dc20fade.zip llvm-ac532dedf1fe89b8ded9920f202829f4dc20fade.tar.gz llvm-ac532dedf1fe89b8ded9920f202829f4dc20fade.tar.bz2 | |
Make a provision to encode inline location in a variable. This will enable dwarf writer to easily distinguish between two instances of a inlined variable in one basic block.
llvm-svn: 135457
Diffstat (limited to 'llvm/lib/Analysis/DebugInfo.cpp')
| -rw-r--r-- | llvm/lib/Analysis/DebugInfo.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/DebugInfo.cpp b/llvm/lib/Analysis/DebugInfo.cpp index b42e946..8fac3fb 100644 --- a/llvm/lib/Analysis/DebugInfo.cpp +++ b/llvm/lib/Analysis/DebugInfo.cpp @@ -111,7 +111,9 @@ Function *DIDescriptor::getFunctionField(unsigned Elt) const { unsigned DIVariable::getNumAddrElements() const { if (getVersion() <= llvm::LLVMDebugVersion8) return DbgNode->getNumOperands()-6; - return DbgNode->getNumOperands()-7; + if (getVersion() == llvm::LLVMDebugVersion9) + return DbgNode->getNumOperands()-7; + return DbgNode->getNumOperands()-8; } @@ -760,6 +762,19 @@ NamedMDNode *llvm::getOrInsertFnSpecificMDNode(Module &M, StringRef FuncName) { return M.getOrInsertNamedMetadata(Name.str()); } +/// createInlinedVariable - Create a new inlined variable based on current +/// variable. +/// @param DV Current Variable. +/// @param InlinedScope Location at current variable is inlined. +DIVariable llvm::createInlinedVariable(MDNode *DV, MDNode *InlinedScope, + LLVMContext &VMContext) { + SmallVector<Value *, 16> Elts; + // Insert inlined scope as 7th element. + for (unsigned i = 0, e = DV->getNumOperands(); i != e; ++i) + i == 7 ? Elts.push_back(InlinedScope) : + Elts.push_back(DV->getOperand(i)); + return DIVariable(MDNode::get(VMContext, Elts)); +} //===----------------------------------------------------------------------===// // DebugInfoFinder implementations. |
