1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Provide an interface to let FEs anchor debug info for types.

llvm-svn: 114969
This commit is contained in:
Devang Patel 2010-09-28 18:08:20 +00:00
parent ad51f6522d
commit e1f502ee26
3 changed files with 17 additions and 0 deletions

View File

@ -763,6 +763,11 @@ namespace llvm {
/// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
Instruction *InsertDbgValueIntrinsic(llvm::Value *V, uint64_t Offset,
DIVariable D, Instruction *InsertBefore);
// RecordType - Record DIType in a module such that it is not lost even if
// it is not referenced through debug info anchors.
void RecordType(DIType T);
private:
Constant *GetTagConstant(unsigned TAG);
};

View File

@ -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.
//===----------------------------------------------------------------------===//

View File

@ -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());