Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
//===--- DIBuilder.cpp - Debug Information Builder ------------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file implements the DIBuilder.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-06-29 08:32:07 +00:00
|
|
|
#include "llvm/DIBuilder.h"
|
2012-12-03 16:50:05 +00:00
|
|
|
#include "llvm/ADT/STLExtras.h"
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
#include "llvm/Constants.h"
|
2012-06-28 00:05:13 +00:00
|
|
|
#include "llvm/DebugInfo.h"
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
#include "llvm/IntrinsicInst.h"
|
|
|
|
#include "llvm/Module.h"
|
2012-04-03 00:43:49 +00:00
|
|
|
#include "llvm/Support/Debug.h"
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
#include "llvm/Support/Dwarf.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
using namespace llvm::dwarf;
|
|
|
|
|
|
|
|
static Constant *GetTagConstant(LLVMContext &VMContext, unsigned Tag) {
|
|
|
|
assert((Tag & LLVMDebugVersionMask) == 0 &&
|
|
|
|
"Tag too large for debug encoding!");
|
|
|
|
return ConstantInt::get(Type::getInt32Ty(VMContext), Tag | LLVMDebugVersion);
|
|
|
|
}
|
2010-12-07 23:58:00 +00:00
|
|
|
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
DIBuilder::DIBuilder(Module &m)
|
2011-08-26 21:02:40 +00:00
|
|
|
: M(m), VMContext(M.getContext()), TheCU(0), TempEnumTypes(0),
|
|
|
|
TempRetainTypes(0), TempSubprograms(0), TempGVs(0), DeclareFn(0),
|
|
|
|
ValueFn(0)
|
2011-08-16 22:09:43 +00:00
|
|
|
{}
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
|
2011-08-15 23:00:00 +00:00
|
|
|
/// finalize - Construct any deferred debug info descriptors.
|
|
|
|
void DIBuilder::finalize() {
|
2011-08-16 22:09:43 +00:00
|
|
|
DIArray Enums = getOrCreateArray(AllEnumTypes);
|
|
|
|
DIType(TempEnumTypes).replaceAllUsesWith(Enums);
|
|
|
|
|
|
|
|
DIArray RetainTypes = getOrCreateArray(AllRetainTypes);
|
|
|
|
DIType(TempRetainTypes).replaceAllUsesWith(RetainTypes);
|
|
|
|
|
|
|
|
DIArray SPs = getOrCreateArray(AllSubprograms);
|
|
|
|
DIType(TempSubprograms).replaceAllUsesWith(SPs);
|
2011-08-19 23:28:12 +00:00
|
|
|
for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) {
|
|
|
|
DISubprogram SP(SPs.getElement(i));
|
2012-04-23 19:00:11 +00:00
|
|
|
SmallVector<Value *, 4> Variables;
|
2011-08-19 23:28:12 +00:00
|
|
|
if (NamedMDNode *NMD = getFnSpecificMDNode(M, SP)) {
|
|
|
|
for (unsigned ii = 0, ee = NMD->getNumOperands(); ii != ee; ++ii)
|
|
|
|
Variables.push_back(NMD->getOperand(ii));
|
|
|
|
NMD->eraseFromParent();
|
|
|
|
}
|
2012-04-23 19:00:11 +00:00
|
|
|
if (MDNode *Temp = SP.getVariablesNodes()) {
|
|
|
|
DIArray AV = getOrCreateArray(Variables);
|
|
|
|
DIType(Temp).replaceAllUsesWith(AV);
|
|
|
|
}
|
2011-08-19 23:28:12 +00:00
|
|
|
}
|
2011-08-16 22:09:43 +00:00
|
|
|
|
|
|
|
DIArray GVs = getOrCreateArray(AllGVs);
|
|
|
|
DIType(TempGVs).replaceAllUsesWith(GVs);
|
|
|
|
}
|
|
|
|
|
2011-08-26 21:02:40 +00:00
|
|
|
/// getNonCompileUnitScope - If N is compile unit return NULL otherwise return
|
|
|
|
/// N.
|
2011-08-16 22:09:43 +00:00
|
|
|
static MDNode *getNonCompileUnitScope(MDNode *N) {
|
|
|
|
if (DIDescriptor(N).isCompileUnit())
|
|
|
|
return NULL;
|
|
|
|
return N;
|
2011-08-15 23:00:00 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createCompileUnit - A CompileUnit provides an anchor for all debugging
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
/// information generated during this instance of compilation.
|
2011-08-26 21:02:40 +00:00
|
|
|
void DIBuilder::createCompileUnit(unsigned Lang, StringRef Filename,
|
|
|
|
StringRef Directory, StringRef Producer,
|
|
|
|
bool isOptimized, StringRef Flags,
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
unsigned RunTimeVer) {
|
2012-01-10 18:18:52 +00:00
|
|
|
assert(((Lang <= dwarf::DW_LANG_Python && Lang >= dwarf::DW_LANG_C89) ||
|
|
|
|
(Lang <= dwarf::DW_LANG_hi_user && Lang >= dwarf::DW_LANG_lo_user)) &&
|
|
|
|
"Invalid Language tag");
|
|
|
|
assert(!Filename.empty() &&
|
|
|
|
"Unable to create compile unit without filename");
|
2011-08-16 22:09:43 +00:00
|
|
|
Value *TElts[] = { GetTagConstant(VMContext, DW_TAG_base_type) };
|
|
|
|
TempEnumTypes = MDNode::getTemporary(VMContext, TElts);
|
|
|
|
Value *THElts[] = { TempEnumTypes };
|
|
|
|
MDNode *EnumHolder = MDNode::get(VMContext, THElts);
|
|
|
|
|
|
|
|
TempRetainTypes = MDNode::getTemporary(VMContext, TElts);
|
|
|
|
Value *TRElts[] = { TempRetainTypes };
|
|
|
|
MDNode *RetainHolder = MDNode::get(VMContext, TRElts);
|
|
|
|
|
|
|
|
TempSubprograms = MDNode::getTemporary(VMContext, TElts);
|
|
|
|
Value *TSElts[] = { TempSubprograms };
|
|
|
|
MDNode *SPHolder = MDNode::get(VMContext, TSElts);
|
|
|
|
|
|
|
|
TempGVs = MDNode::getTemporary(VMContext, TElts);
|
|
|
|
Value *TVElts[] = { TempGVs };
|
|
|
|
MDNode *GVHolder = MDNode::get(VMContext, TVElts);
|
|
|
|
|
2010-11-04 18:45:27 +00:00
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_compile_unit),
|
2012-07-06 17:47:36 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext)),
|
2010-11-04 18:45:27 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Lang),
|
|
|
|
MDString::get(VMContext, Filename),
|
|
|
|
MDString::get(VMContext, Directory),
|
|
|
|
MDString::get(VMContext, Producer),
|
|
|
|
// Deprecate isMain field.
|
|
|
|
ConstantInt::get(Type::getInt1Ty(VMContext), true), // isMain
|
|
|
|
ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized),
|
|
|
|
MDString::get(VMContext, Flags),
|
2011-08-16 22:09:43 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), RunTimeVer),
|
|
|
|
EnumHolder,
|
|
|
|
RetainHolder,
|
|
|
|
SPHolder,
|
|
|
|
GVHolder
|
2010-11-04 18:45:27 +00:00
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
TheCU = DICompileUnit(MDNode::get(VMContext, Elts));
|
2011-05-03 16:18:28 +00:00
|
|
|
|
|
|
|
// Create a named metadata so that it is easier to find cu in a module.
|
|
|
|
NamedMDNode *NMD = M.getOrInsertNamedMetadata("llvm.dbg.cu");
|
|
|
|
NMD->addOperand(TheCU);
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createFile - Create a file descriptor to hold debugging information
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
/// for a file.
|
2011-02-22 18:56:12 +00:00
|
|
|
DIFile DIBuilder::createFile(StringRef Filename, StringRef Directory) {
|
2010-11-04 18:45:27 +00:00
|
|
|
assert(TheCU && "Unable to create DW_TAG_file_type without CompileUnit");
|
2011-09-12 18:26:08 +00:00
|
|
|
assert(!Filename.empty() && "Unable to create file without name");
|
2010-11-04 18:45:27 +00:00
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_file_type),
|
|
|
|
MDString::get(VMContext, Filename),
|
|
|
|
MDString::get(VMContext, Directory),
|
2011-08-16 22:09:43 +00:00
|
|
|
NULL // TheCU
|
2010-11-04 18:45:27 +00:00
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIFile(MDNode::get(VMContext, Elts));
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createEnumerator - Create a single enumerator value.
|
|
|
|
DIEnumerator DIBuilder::createEnumerator(StringRef Name, uint64_t Val) {
|
2011-09-12 18:26:08 +00:00
|
|
|
assert(!Name.empty() && "Unable to create enumerator without name");
|
2010-11-04 18:45:27 +00:00
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_enumerator),
|
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), Val)
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIEnumerator(MDNode::get(VMContext, Elts));
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2011-09-14 23:13:28 +00:00
|
|
|
/// createNullPtrType - Create C++0x nullptr type.
|
|
|
|
DIType DIBuilder::createNullPtrType(StringRef Name) {
|
|
|
|
assert(!Name.empty() && "Unable to create type without name");
|
|
|
|
// nullptr is encoded in DIBasicType format. Line number, filename,
|
|
|
|
// ,size, alignment, offset and flags are always empty here.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_unspecified_type),
|
|
|
|
NULL, //TheCU,
|
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
NULL, // Filename
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags;
|
2012-07-06 17:49:19 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0) // Encoding
|
2011-09-14 23:13:28 +00:00
|
|
|
};
|
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
|
|
|
}
|
|
|
|
|
2011-08-26 21:02:40 +00:00
|
|
|
/// createBasicType - Create debugging information entry for a basic
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
/// type, e.g 'char'.
|
2011-08-26 21:02:40 +00:00
|
|
|
DIType DIBuilder::createBasicType(StringRef Name, uint64_t SizeInBits,
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
uint64_t AlignInBits,
|
|
|
|
unsigned Encoding) {
|
2011-09-12 18:26:08 +00:00
|
|
|
assert(!Name.empty() && "Unable to create type without name");
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
// Basic types are encoded in DIBasicType format. Line number, filename,
|
|
|
|
// offset and flags are always empty here.
|
2010-11-04 18:45:27 +00:00
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_base_type),
|
2011-08-16 22:09:43 +00:00
|
|
|
NULL, //TheCU,
|
2010-11-04 18:45:27 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
NULL, // Filename
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags;
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Encoding)
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2011-11-09 22:45:04 +00:00
|
|
|
/// createQualifiedType - Create debugging information entry for a qualified
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
/// type, e.g. 'const int'.
|
2011-02-22 18:56:12 +00:00
|
|
|
DIType DIBuilder::createQualifiedType(unsigned Tag, DIType FromTy) {
|
2010-11-04 18:45:27 +00:00
|
|
|
// Qualified types are encoded in DIDerivedType format.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, Tag),
|
2011-08-16 22:09:43 +00:00
|
|
|
NULL, //TheCU,
|
2010-11-04 18:45:27 +00:00
|
|
|
MDString::get(VMContext, StringRef()), // Empty name.
|
|
|
|
NULL, // Filename
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
|
|
|
|
FromTy
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createPointerType - Create debugging information entry for a pointer.
|
|
|
|
DIType DIBuilder::createPointerType(DIType PointeeTy, uint64_t SizeInBits,
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
uint64_t AlignInBits, StringRef Name) {
|
2010-11-04 18:45:27 +00:00
|
|
|
// Pointer types are encoded in DIDerivedType format.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_pointer_type),
|
2011-08-16 22:09:43 +00:00
|
|
|
NULL, //TheCU,
|
2010-11-04 18:45:27 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
NULL, // Filename
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
|
|
|
|
PointeeTy
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2012-05-19 01:36:37 +00:00
|
|
|
/// createReferenceType - Create debugging information entry for a reference
|
|
|
|
/// type.
|
|
|
|
DIType DIBuilder::createReferenceType(unsigned Tag, DIType RTy) {
|
2011-09-12 18:26:08 +00:00
|
|
|
assert(RTy.Verify() && "Unable to create reference type");
|
2010-11-04 18:45:27 +00:00
|
|
|
// References are encoded in DIDerivedType format.
|
|
|
|
Value *Elts[] = {
|
2012-05-19 01:36:37 +00:00
|
|
|
GetTagConstant(VMContext, Tag),
|
2011-08-26 21:02:40 +00:00
|
|
|
NULL, // TheCU,
|
2010-11-04 18:45:27 +00:00
|
|
|
NULL, // Name
|
|
|
|
NULL, // Filename
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
|
|
|
|
RTy
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createTypedef - Create debugging information entry for a typedef.
|
|
|
|
DIType DIBuilder::createTypedef(DIType Ty, StringRef Name, DIFile File,
|
2011-06-03 17:04:51 +00:00
|
|
|
unsigned LineNo, DIDescriptor Context) {
|
2010-11-04 18:45:27 +00:00
|
|
|
// typedefs are encoded in DIDerivedType format.
|
|
|
|
assert(Ty.Verify() && "Invalid typedef type!");
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_typedef),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(Context),
|
2010-11-04 18:45:27 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
File,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
|
|
|
|
Ty
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createFriend - Create debugging information entry for a 'friend'.
|
|
|
|
DIType DIBuilder::createFriend(DIType Ty, DIType FriendTy) {
|
2010-11-04 18:45:27 +00:00
|
|
|
// typedefs are encoded in DIDerivedType format.
|
|
|
|
assert(Ty.Verify() && "Invalid type!");
|
|
|
|
assert(FriendTy.Verify() && "Invalid friend type!");
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_friend),
|
|
|
|
Ty,
|
|
|
|
NULL, // Name
|
|
|
|
Ty.getFile(),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Offset
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Flags
|
|
|
|
FriendTy
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createInheritance - Create debugging information entry to establish
|
2011-09-12 19:58:22 +00:00
|
|
|
/// inheritance relationship between two types.
|
2011-08-26 21:02:40 +00:00
|
|
|
DIType DIBuilder::createInheritance(DIType Ty, DIType BaseTy,
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
uint64_t BaseOffset, unsigned Flags) {
|
2011-09-12 18:26:08 +00:00
|
|
|
assert(Ty.Verify() && "Unable to create inheritance");
|
2010-11-04 18:45:27 +00:00
|
|
|
// TAG_inheritance is encoded in DIDerivedType format.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_inheritance),
|
|
|
|
Ty,
|
|
|
|
NULL, // Name
|
2010-12-08 21:46:37 +00:00
|
|
|
Ty.getFile(),
|
2010-11-04 18:45:27 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0), // Line
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Size
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0), // Align
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), BaseOffset),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
|
|
|
|
BaseTy
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createMemberType - Create debugging information entry for a member.
|
2011-08-26 21:02:40 +00:00
|
|
|
DIType DIBuilder::createMemberType(DIDescriptor Scope, StringRef Name,
|
|
|
|
DIFile File, unsigned LineNumber,
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
2011-08-26 21:02:40 +00:00
|
|
|
uint64_t OffsetInBits, unsigned Flags,
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
DIType Ty) {
|
2010-11-04 18:45:27 +00:00
|
|
|
// TAG_member is encoded in DIDerivedType format.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_member),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(Scope),
|
2010-11-04 18:45:27 +00:00
|
|
|
MDString::get(VMContext, Name),
|
2010-12-07 23:25:47 +00:00
|
|
|
File,
|
2010-11-04 18:45:27 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), OffsetInBits),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
|
|
|
|
Ty
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
}
|
|
|
|
|
2011-04-16 00:11:51 +00:00
|
|
|
/// createObjCIVar - Create debugging information entry for Objective-C
|
|
|
|
/// instance variable.
|
2011-08-26 21:02:40 +00:00
|
|
|
DIType DIBuilder::createObjCIVar(StringRef Name,
|
|
|
|
DIFile File, unsigned LineNumber,
|
2011-04-16 00:11:51 +00:00
|
|
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
2011-08-26 21:02:40 +00:00
|
|
|
uint64_t OffsetInBits, unsigned Flags,
|
2011-04-16 00:11:51 +00:00
|
|
|
DIType Ty, StringRef PropertyName,
|
|
|
|
StringRef GetterName, StringRef SetterName,
|
|
|
|
unsigned PropertyAttributes) {
|
|
|
|
// TAG_member is encoded in DIDerivedType format.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_member),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(File),
|
2011-04-16 00:11:51 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
File,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), OffsetInBits),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
|
|
|
|
Ty,
|
|
|
|
MDString::get(VMContext, PropertyName),
|
|
|
|
MDString::get(VMContext, GetterName),
|
|
|
|
MDString::get(VMContext, SetterName),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), PropertyAttributes)
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
2012-02-06 17:49:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// createObjCIVar - Create debugging information entry for Objective-C
|
|
|
|
/// instance variable.
|
|
|
|
DIType DIBuilder::createObjCIVar(StringRef Name,
|
|
|
|
DIFile File, unsigned LineNumber,
|
|
|
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
|
|
|
uint64_t OffsetInBits, unsigned Flags,
|
|
|
|
DIType Ty, MDNode *PropertyNode) {
|
|
|
|
// TAG_member is encoded in DIDerivedType format.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_member),
|
|
|
|
getNonCompileUnitScope(File),
|
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
File,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), OffsetInBits),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
|
|
|
|
Ty,
|
|
|
|
PropertyNode
|
|
|
|
};
|
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
2011-04-16 00:11:51 +00:00
|
|
|
}
|
|
|
|
|
2012-02-04 00:59:25 +00:00
|
|
|
/// createObjCProperty - Create debugging information entry for Objective-C
|
|
|
|
/// property.
|
2012-03-29 08:42:56 +00:00
|
|
|
DIObjCProperty DIBuilder::createObjCProperty(StringRef Name,
|
2012-07-06 02:35:57 +00:00
|
|
|
DIFile File, unsigned LineNumber,
|
2012-02-04 00:59:25 +00:00
|
|
|
StringRef GetterName,
|
|
|
|
StringRef SetterName,
|
2012-03-29 08:42:56 +00:00
|
|
|
unsigned PropertyAttributes,
|
2012-07-06 02:35:57 +00:00
|
|
|
DIType Ty) {
|
2012-02-04 00:59:25 +00:00
|
|
|
Value *Elts[] = {
|
2012-03-29 21:35:05 +00:00
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_APPLE_property),
|
2012-02-04 00:59:25 +00:00
|
|
|
MDString::get(VMContext, Name),
|
2012-03-29 08:42:56 +00:00
|
|
|
File,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
|
2012-02-04 00:59:25 +00:00
|
|
|
MDString::get(VMContext, GetterName),
|
|
|
|
MDString::get(VMContext, SetterName),
|
2012-03-29 08:42:56 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), PropertyAttributes),
|
|
|
|
Ty
|
2012-02-04 00:59:25 +00:00
|
|
|
};
|
|
|
|
return DIObjCProperty(MDNode::get(VMContext, Elts));
|
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createTemplateTypeParameter - Create debugging information for template
|
2011-02-02 21:38:25 +00:00
|
|
|
/// type parameter.
|
2011-08-26 21:02:40 +00:00
|
|
|
DITemplateTypeParameter
|
2011-02-22 18:56:12 +00:00
|
|
|
DIBuilder::createTemplateTypeParameter(DIDescriptor Context, StringRef Name,
|
2011-02-02 21:38:25 +00:00
|
|
|
DIType Ty, MDNode *File, unsigned LineNo,
|
|
|
|
unsigned ColumnNo) {
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_template_type_parameter),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(Context),
|
2011-02-02 21:38:25 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
Ty,
|
|
|
|
File,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo)
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DITemplateTypeParameter(MDNode::get(VMContext, Elts));
|
2011-02-02 21:38:25 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createTemplateValueParameter - Create debugging information for template
|
2011-02-02 22:35:53 +00:00
|
|
|
/// value parameter.
|
2011-08-26 21:02:40 +00:00
|
|
|
DITemplateValueParameter
|
2011-02-22 18:56:12 +00:00
|
|
|
DIBuilder::createTemplateValueParameter(DIDescriptor Context, StringRef Name,
|
2011-02-02 22:35:53 +00:00
|
|
|
DIType Ty, uint64_t Val,
|
|
|
|
MDNode *File, unsigned LineNo,
|
|
|
|
unsigned ColumnNo) {
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_template_value_parameter),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(Context),
|
2011-02-02 22:35:53 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
Ty,
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), Val),
|
|
|
|
File,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), ColumnNo)
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DITemplateValueParameter(MDNode::get(VMContext, Elts));
|
2011-02-02 22:35:53 +00:00
|
|
|
}
|
|
|
|
|
2012-07-06 02:35:57 +00:00
|
|
|
/// createClassType - Create debugging information entry for a class.
|
|
|
|
DIType DIBuilder::createClassType(DIDescriptor Context, StringRef Name,
|
|
|
|
DIFile File, unsigned LineNumber,
|
|
|
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
|
|
|
uint64_t OffsetInBits, unsigned Flags,
|
|
|
|
DIType DerivedFrom, DIArray Elements,
|
|
|
|
MDNode *VTableHolder,
|
|
|
|
MDNode *TemplateParams) {
|
|
|
|
// TAG_class_type is encoded in DICompositeType format.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_class_type),
|
|
|
|
getNonCompileUnitScope(Context),
|
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
File,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), OffsetInBits),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
|
|
|
|
DerivedFrom,
|
|
|
|
Elements,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
|
|
|
VTableHolder,
|
|
|
|
TemplateParams
|
|
|
|
};
|
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createStructType - Create debugging information entry for a struct.
|
2011-08-26 21:02:40 +00:00
|
|
|
DIType DIBuilder::createStructType(DIDescriptor Context, StringRef Name,
|
|
|
|
DIFile File, unsigned LineNumber,
|
2010-12-08 01:50:15 +00:00
|
|
|
uint64_t SizeInBits, uint64_t AlignInBits,
|
2011-08-26 21:02:40 +00:00
|
|
|
unsigned Flags, DIArray Elements,
|
2010-12-08 01:50:15 +00:00
|
|
|
unsigned RunTimeLang) {
|
2010-12-07 23:25:47 +00:00
|
|
|
// TAG_structure_type is encoded in DICompositeType format.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_structure_type),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(Context),
|
2010-12-07 23:25:47 +00:00
|
|
|
MDString::get(VMContext, Name),
|
2010-12-08 01:50:15 +00:00
|
|
|
File,
|
2010-12-07 23:25:47 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
|
2010-12-08 01:50:15 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
2010-12-07 23:25:47 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
|
2011-12-16 17:51:31 +00:00
|
|
|
NULL,
|
2010-12-07 23:25:47 +00:00
|
|
|
Elements,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), RunTimeLang),
|
2012-11-02 23:33:23 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
2010-12-07 23:25:47 +00:00
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
2010-12-07 23:25:47 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createUnionType - Create debugging information entry for an union.
|
2011-08-26 21:02:40 +00:00
|
|
|
DIType DIBuilder::createUnionType(DIDescriptor Scope, StringRef Name,
|
2010-12-08 01:50:15 +00:00
|
|
|
DIFile File,
|
|
|
|
unsigned LineNumber, uint64_t SizeInBits,
|
|
|
|
uint64_t AlignInBits, unsigned Flags,
|
|
|
|
DIArray Elements, unsigned RunTimeLang) {
|
|
|
|
// TAG_union_type is encoded in DICompositeType format.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_union_type),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(Scope),
|
2010-12-08 01:50:15 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
File,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
|
2011-12-16 17:51:31 +00:00
|
|
|
NULL,
|
2010-12-08 01:50:15 +00:00
|
|
|
Elements,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), RunTimeLang),
|
2012-07-06 17:49:19 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext))
|
2010-12-08 01:50:15 +00:00
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
2010-12-08 01:50:15 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createSubroutineType - Create subroutine type.
|
|
|
|
DIType DIBuilder::createSubroutineType(DIFile File, DIArray ParameterTypes) {
|
2010-12-08 01:50:15 +00:00
|
|
|
// TAG_subroutine_type is encoded in DICompositeType format.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_subroutine_type),
|
2012-07-06 17:47:36 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext)),
|
2010-12-08 01:50:15 +00:00
|
|
|
MDString::get(VMContext, ""),
|
2012-07-06 17:47:36 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext)),
|
2010-12-08 01:50:15 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0),
|
2011-12-16 17:51:31 +00:00
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), 0),
|
2010-12-08 01:50:15 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
2011-12-16 17:51:31 +00:00
|
|
|
NULL,
|
2010-12-08 01:50:15 +00:00
|
|
|
ParameterTypes,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
2012-07-06 17:49:19 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext))
|
2010-12-08 01:50:15 +00:00
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
2010-12-08 01:50:15 +00:00
|
|
|
}
|
|
|
|
|
2011-08-26 21:02:40 +00:00
|
|
|
/// createEnumerationType - Create debugging information entry for an
|
2010-12-08 01:50:15 +00:00
|
|
|
/// enumeration.
|
2011-08-26 21:02:40 +00:00
|
|
|
DIType DIBuilder::createEnumerationType(DIDescriptor Scope, StringRef Name,
|
|
|
|
DIFile File, unsigned LineNumber,
|
|
|
|
uint64_t SizeInBits,
|
|
|
|
uint64_t AlignInBits,
|
2012-05-23 00:09:20 +00:00
|
|
|
DIArray Elements,
|
2012-10-05 01:49:14 +00:00
|
|
|
DIType ClassType) {
|
2010-12-08 01:50:15 +00:00
|
|
|
// TAG_enumeration_type is encoded in DICompositeType format.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_enumeration_type),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(Scope),
|
2010-12-08 01:50:15 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
File,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
2012-10-05 01:49:14 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
2012-05-23 00:09:20 +00:00
|
|
|
ClassType,
|
2010-12-08 01:50:15 +00:00
|
|
|
Elements,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
2012-07-06 17:49:19 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext))
|
2010-12-08 01:50:15 +00:00
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
MDNode *Node = MDNode::get(VMContext, Elts);
|
2011-08-16 22:09:43 +00:00
|
|
|
AllEnumTypes.push_back(Node);
|
2010-12-08 01:50:15 +00:00
|
|
|
return DIType(Node);
|
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createArrayType - Create debugging information entry for an array.
|
2011-08-26 21:02:40 +00:00
|
|
|
DIType DIBuilder::createArrayType(uint64_t Size, uint64_t AlignInBits,
|
2010-12-08 01:50:15 +00:00
|
|
|
DIType Ty, DIArray Subscripts) {
|
|
|
|
// TAG_array_type is encoded in DICompositeType format.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_array_type),
|
2011-08-16 22:09:43 +00:00
|
|
|
NULL, //TheCU,
|
2010-12-08 01:50:15 +00:00
|
|
|
MDString::get(VMContext, ""),
|
2011-08-16 22:09:43 +00:00
|
|
|
NULL, //TheCU,
|
2010-12-08 01:50:15 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), Size),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
|
|
|
Ty,
|
|
|
|
Subscripts,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
2012-07-06 17:49:19 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext))
|
2010-12-08 01:50:15 +00:00
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
2010-12-08 01:50:15 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createVectorType - Create debugging information entry for a vector.
|
2011-08-26 21:02:40 +00:00
|
|
|
DIType DIBuilder::createVectorType(uint64_t Size, uint64_t AlignInBits,
|
2010-12-08 01:50:15 +00:00
|
|
|
DIType Ty, DIArray Subscripts) {
|
|
|
|
// TAG_vector_type is encoded in DICompositeType format.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_vector_type),
|
2011-08-16 22:09:43 +00:00
|
|
|
NULL, //TheCU,
|
2010-12-08 01:50:15 +00:00
|
|
|
MDString::get(VMContext, ""),
|
2011-08-16 22:09:43 +00:00
|
|
|
NULL, //TheCU,
|
2010-12-08 01:50:15 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), Size),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
|
|
|
Ty,
|
|
|
|
Subscripts,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
2012-07-06 17:49:19 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext))
|
2010-12-08 01:50:15 +00:00
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
2010-12-08 01:50:15 +00:00
|
|
|
}
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createArtificialType - Create a new DIType with "artificial" flag set.
|
|
|
|
DIType DIBuilder::createArtificialType(DIType Ty) {
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
if (Ty.isArtificial())
|
|
|
|
return Ty;
|
|
|
|
|
|
|
|
SmallVector<Value *, 9> Elts;
|
|
|
|
MDNode *N = Ty;
|
|
|
|
assert (N && "Unexpected input DIType!");
|
|
|
|
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
|
|
|
|
if (Value *V = N->getOperand(i))
|
|
|
|
Elts.push_back(V);
|
|
|
|
else
|
|
|
|
Elts.push_back(Constant::getNullValue(Type::getInt32Ty(VMContext)));
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned CurFlags = Ty.getFlags();
|
|
|
|
CurFlags = CurFlags | DIType::FlagArtificial;
|
|
|
|
|
|
|
|
// Flags are stored at this slot.
|
|
|
|
Elts[8] = ConstantInt::get(Type::getInt32Ty(VMContext), CurFlags);
|
|
|
|
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
Introduce DIBuilder. It is intended to be a front-end friendly interface to emit debuggging information entries in LLVM IR.
To create debugging information for a pointer, using DIBUilder front-end just needs
DBuilder.CreatePointerType(Ty, Size);
instead of
DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_pointer_type,
TheCU, "", getOrCreateMainFile(),
0, Size, 0, 0, 0, OCTy);
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118248 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-04 15:01:38 +00:00
|
|
|
}
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2012-09-12 23:36:19 +00:00
|
|
|
/// createArtificialType - Create a new DIType with "artificial" flag set.
|
|
|
|
DIType DIBuilder::createObjectPointerType(DIType Ty) {
|
|
|
|
if (Ty.isObjectPointer())
|
|
|
|
return Ty;
|
|
|
|
|
|
|
|
SmallVector<Value *, 9> Elts;
|
|
|
|
MDNode *N = Ty;
|
|
|
|
assert (N && "Unexpected input DIType!");
|
|
|
|
for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) {
|
|
|
|
if (Value *V = N->getOperand(i))
|
|
|
|
Elts.push_back(V);
|
|
|
|
else
|
|
|
|
Elts.push_back(Constant::getNullValue(Type::getInt32Ty(VMContext)));
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned CurFlags = Ty.getFlags();
|
|
|
|
CurFlags = CurFlags | (DIType::FlagObjectPointer | DIType::FlagArtificial);
|
|
|
|
|
|
|
|
// Flags are stored at this slot.
|
|
|
|
Elts[8] = ConstantInt::get(Type::getInt32Ty(VMContext), CurFlags);
|
|
|
|
|
|
|
|
return DIType(MDNode::get(VMContext, Elts));
|
|
|
|
}
|
|
|
|
|
2011-08-26 21:02:40 +00:00
|
|
|
/// retainType - Retain DIType in a module even if it is not referenced
|
2010-12-08 01:50:15 +00:00
|
|
|
/// through debug info anchors.
|
2011-02-22 18:56:12 +00:00
|
|
|
void DIBuilder::retainType(DIType T) {
|
2011-08-16 22:09:43 +00:00
|
|
|
AllRetainTypes.push_back(T);
|
2010-12-08 01:50:15 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createUnspecifiedParameter - Create unspeicified type descriptor
|
2010-12-08 01:50:15 +00:00
|
|
|
/// for the subroutine type.
|
2011-02-22 18:56:12 +00:00
|
|
|
DIDescriptor DIBuilder::createUnspecifiedParameter() {
|
2011-08-26 21:02:40 +00:00
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_unspecified_parameters)
|
2010-12-08 01:50:15 +00:00
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIDescriptor(MDNode::get(VMContext, Elts));
|
2010-12-08 01:50:15 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createTemporaryType - Create a temporary forward-declared type.
|
|
|
|
DIType DIBuilder::createTemporaryType() {
|
2010-12-07 23:25:47 +00:00
|
|
|
// Give the temporary MDNode a tag. It doesn't matter what tag we
|
|
|
|
// use here as long as DIType accepts it.
|
|
|
|
Value *Elts[] = { GetTagConstant(VMContext, DW_TAG_base_type) };
|
2011-04-21 19:59:31 +00:00
|
|
|
MDNode *Node = MDNode::getTemporary(VMContext, Elts);
|
2010-12-07 23:25:47 +00:00
|
|
|
return DIType(Node);
|
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createTemporaryType - Create a temporary forward-declared type.
|
|
|
|
DIType DIBuilder::createTemporaryType(DIFile F) {
|
2010-12-07 23:25:47 +00:00
|
|
|
// Give the temporary MDNode a tag. It doesn't matter what tag we
|
|
|
|
// use here as long as DIType accepts it.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, DW_TAG_base_type),
|
2011-08-16 22:09:43 +00:00
|
|
|
TheCU,
|
2010-12-07 23:25:47 +00:00
|
|
|
NULL,
|
|
|
|
F
|
|
|
|
};
|
2011-04-21 19:59:31 +00:00
|
|
|
MDNode *Node = MDNode::getTemporary(VMContext, Elts);
|
2010-12-07 23:25:47 +00:00
|
|
|
return DIType(Node);
|
|
|
|
}
|
|
|
|
|
2012-02-08 00:22:26 +00:00
|
|
|
/// createForwardDecl - Create a temporary forward-declared type that
|
|
|
|
/// can be RAUW'd if the full type is seen.
|
2012-04-23 19:00:11 +00:00
|
|
|
DIType DIBuilder::createForwardDecl(unsigned Tag, StringRef Name,
|
|
|
|
DIDescriptor Scope, DIFile F,
|
2012-10-05 01:49:14 +00:00
|
|
|
unsigned Line, unsigned RuntimeLang,
|
|
|
|
uint64_t SizeInBits,
|
|
|
|
uint64_t AlignInBits) {
|
2012-02-08 00:22:26 +00:00
|
|
|
// Create a temporary MDNode.
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, Tag),
|
2012-04-23 19:00:11 +00:00
|
|
|
getNonCompileUnitScope(Scope),
|
2012-02-08 00:22:26 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
F,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Line),
|
2012-10-05 01:49:14 +00:00
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), SizeInBits),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), AlignInBits),
|
2012-02-08 00:22:26 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext),
|
2012-02-20 18:04:14 +00:00
|
|
|
DIDescriptor::FlagFwdDecl),
|
|
|
|
NULL,
|
|
|
|
DIArray(),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang)
|
2012-02-08 00:22:26 +00:00
|
|
|
};
|
|
|
|
MDNode *Node = MDNode::getTemporary(VMContext, Elts);
|
|
|
|
return DIType(Node);
|
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// getOrCreateArray - Get a DIArray, create one if required.
|
2011-04-24 10:11:03 +00:00
|
|
|
DIArray DIBuilder::getOrCreateArray(ArrayRef<Value *> Elements) {
|
|
|
|
if (Elements.empty()) {
|
2012-07-06 17:47:36 +00:00
|
|
|
Value *Null = Constant::getNullValue(Type::getInt32Ty(VMContext));
|
2011-04-21 19:59:31 +00:00
|
|
|
return DIArray(MDNode::get(VMContext, Null));
|
2010-12-07 23:25:47 +00:00
|
|
|
}
|
2011-04-24 10:11:03 +00:00
|
|
|
return DIArray(MDNode::get(VMContext, Elements));
|
2010-12-07 23:25:47 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// getOrCreateSubrange - Create a descriptor for a value range. This
|
2010-12-08 01:50:15 +00:00
|
|
|
/// implicitly uniques the values returned.
|
2012-12-04 21:34:03 +00:00
|
|
|
DISubrange DIBuilder::getOrCreateSubrange(int64_t Lo, int64_t Count) {
|
2010-12-08 01:50:15 +00:00
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_subrange_type),
|
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), Lo),
|
2012-12-04 06:20:49 +00:00
|
|
|
ConstantInt::get(Type::getInt64Ty(VMContext), Count)
|
2010-12-08 01:50:15 +00:00
|
|
|
};
|
|
|
|
|
2011-04-18 23:51:03 +00:00
|
|
|
return DISubrange(MDNode::get(VMContext, Elts));
|
2010-12-08 01:50:15 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createGlobalVariable - Create a new descriptor for the specified global.
|
2010-12-07 23:25:47 +00:00
|
|
|
DIGlobalVariable DIBuilder::
|
2011-08-26 21:02:40 +00:00
|
|
|
createGlobalVariable(StringRef Name, DIFile F, unsigned LineNumber,
|
2012-07-06 17:47:36 +00:00
|
|
|
DIType Ty, bool isLocalToUnit, Value *Val) {
|
2010-12-07 23:25:47 +00:00
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_variable),
|
2012-07-06 17:47:36 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext)),
|
2011-08-16 22:09:43 +00:00
|
|
|
NULL, // TheCU,
|
2010-12-07 23:25:47 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
MDString::get(VMContext, Name),
|
2010-12-08 00:06:22 +00:00
|
|
|
MDString::get(VMContext, Name),
|
2010-12-07 23:25:47 +00:00
|
|
|
F,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
|
|
|
|
Ty,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), isLocalToUnit),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 1), /* isDefinition*/
|
|
|
|
Val
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
MDNode *Node = MDNode::get(VMContext, Elts);
|
2011-08-16 22:09:43 +00:00
|
|
|
AllGVs.push_back(Node);
|
2010-12-07 23:25:47 +00:00
|
|
|
return DIGlobalVariable(Node);
|
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createStaticVariable - Create a new descriptor for the specified static
|
2010-12-07 23:25:47 +00:00
|
|
|
/// variable.
|
|
|
|
DIGlobalVariable DIBuilder::
|
2011-08-26 21:02:40 +00:00
|
|
|
createStaticVariable(DIDescriptor Context, StringRef Name,
|
|
|
|
StringRef LinkageName, DIFile F, unsigned LineNumber,
|
2012-07-06 17:47:36 +00:00
|
|
|
DIType Ty, bool isLocalToUnit, Value *Val) {
|
2010-12-07 23:25:47 +00:00
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_variable),
|
2012-07-06 17:47:36 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext)),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(Context),
|
2010-12-07 23:25:47 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
MDString::get(VMContext, LinkageName),
|
|
|
|
F,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
|
|
|
|
Ty,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), isLocalToUnit),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 1), /* isDefinition*/
|
|
|
|
Val
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
MDNode *Node = MDNode::get(VMContext, Elts);
|
2011-08-16 22:09:43 +00:00
|
|
|
AllGVs.push_back(Node);
|
2010-12-07 23:25:47 +00:00
|
|
|
return DIGlobalVariable(Node);
|
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createVariable - Create a new descriptor for the specified variable.
|
|
|
|
DIVariable DIBuilder::createLocalVariable(unsigned Tag, DIDescriptor Scope,
|
2010-12-07 23:58:00 +00:00
|
|
|
StringRef Name, DIFile File,
|
2011-08-26 21:02:40 +00:00
|
|
|
unsigned LineNo, DIType Ty,
|
2011-03-01 22:58:13 +00:00
|
|
|
bool AlwaysPreserve, unsigned Flags,
|
|
|
|
unsigned ArgNo) {
|
2010-12-07 23:58:00 +00:00
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, Tag),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(Scope),
|
2010-12-07 23:58:00 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
File,
|
2011-03-01 22:58:13 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), (LineNo | (ArgNo << 24))),
|
2010-12-07 23:58:00 +00:00
|
|
|
Ty,
|
2011-07-19 19:41:54 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
|
2012-07-06 17:49:19 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext))
|
2010-12-07 23:58:00 +00:00
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
MDNode *Node = MDNode::get(VMContext, Elts);
|
2010-12-07 23:58:00 +00:00
|
|
|
if (AlwaysPreserve) {
|
|
|
|
// The optimizer may remove local variable. If there is an interest
|
|
|
|
// to preserve variable info in such situation then stash it in a
|
|
|
|
// named mdnode.
|
|
|
|
DISubprogram Fn(getDISubprogram(Scope));
|
2011-08-19 23:28:12 +00:00
|
|
|
NamedMDNode *FnLocals = getOrInsertFnSpecificMDNode(M, Fn);
|
2010-12-07 23:58:00 +00:00
|
|
|
FnLocals->addOperand(Node);
|
|
|
|
}
|
|
|
|
return DIVariable(Node);
|
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createComplexVariable - Create a new descriptor for the specified variable
|
2010-12-07 23:25:47 +00:00
|
|
|
/// which has a complex address expression for its address.
|
2011-02-22 18:56:12 +00:00
|
|
|
DIVariable DIBuilder::createComplexVariable(unsigned Tag, DIDescriptor Scope,
|
2010-12-07 23:25:47 +00:00
|
|
|
StringRef Name, DIFile F,
|
|
|
|
unsigned LineNo,
|
2011-04-24 10:11:03 +00:00
|
|
|
DIType Ty, ArrayRef<Value *> Addr,
|
|
|
|
unsigned ArgNo) {
|
2010-12-07 23:25:47 +00:00
|
|
|
SmallVector<Value *, 15> Elts;
|
|
|
|
Elts.push_back(GetTagConstant(VMContext, Tag));
|
2011-08-16 22:09:43 +00:00
|
|
|
Elts.push_back(getNonCompileUnitScope(Scope)),
|
2010-12-07 23:25:47 +00:00
|
|
|
Elts.push_back(MDString::get(VMContext, Name));
|
|
|
|
Elts.push_back(F);
|
2011-08-26 21:02:40 +00:00
|
|
|
Elts.push_back(ConstantInt::get(Type::getInt32Ty(VMContext),
|
2012-02-08 00:17:07 +00:00
|
|
|
(LineNo | (ArgNo << 24))));
|
2010-12-07 23:25:47 +00:00
|
|
|
Elts.push_back(Ty);
|
2012-07-06 17:47:36 +00:00
|
|
|
Elts.push_back(Constant::getNullValue(Type::getInt32Ty(VMContext)));
|
|
|
|
Elts.push_back(Constant::getNullValue(Type::getInt32Ty(VMContext)));
|
2011-04-24 10:11:03 +00:00
|
|
|
Elts.append(Addr.begin(), Addr.end());
|
2010-12-07 23:25:47 +00:00
|
|
|
|
2011-04-18 23:51:03 +00:00
|
|
|
return DIVariable(MDNode::get(VMContext, Elts));
|
2010-12-07 23:25:47 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createFunction - Create a new descriptor for the specified function.
|
|
|
|
DISubprogram DIBuilder::createFunction(DIDescriptor Context,
|
2010-12-08 20:42:44 +00:00
|
|
|
StringRef Name,
|
|
|
|
StringRef LinkageName,
|
|
|
|
DIFile File, unsigned LineNo,
|
|
|
|
DIType Ty,
|
|
|
|
bool isLocalToUnit, bool isDefinition,
|
2012-04-03 00:43:49 +00:00
|
|
|
unsigned ScopeLine,
|
2010-12-08 20:42:44 +00:00
|
|
|
unsigned Flags, bool isOptimized,
|
2011-04-05 22:52:06 +00:00
|
|
|
Function *Fn,
|
2011-04-22 23:10:17 +00:00
|
|
|
MDNode *TParams,
|
|
|
|
MDNode *Decl) {
|
2011-08-19 23:28:12 +00:00
|
|
|
Value *TElts[] = { GetTagConstant(VMContext, DW_TAG_base_type) };
|
|
|
|
MDNode *Temp = MDNode::getTemporary(VMContext, TElts);
|
|
|
|
Value *TVElts[] = { Temp };
|
|
|
|
MDNode *THolder = MDNode::get(VMContext, TVElts);
|
|
|
|
|
2010-12-08 20:42:44 +00:00
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_subprogram),
|
2012-07-06 17:47:36 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext)),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(Context),
|
2010-12-08 20:42:44 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
MDString::get(VMContext, LinkageName),
|
|
|
|
File,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
|
|
|
|
Ty,
|
|
|
|
ConstantInt::get(Type::getInt1Ty(VMContext), isLocalToUnit),
|
|
|
|
ConstantInt::get(Type::getInt1Ty(VMContext), isDefinition),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), 0),
|
2011-12-15 17:55:56 +00:00
|
|
|
NULL,
|
2010-12-08 20:42:44 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
|
|
|
|
ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized),
|
2011-04-05 22:52:06 +00:00
|
|
|
Fn,
|
2011-04-22 23:10:17 +00:00
|
|
|
TParams,
|
2011-08-19 23:28:12 +00:00
|
|
|
Decl,
|
2012-04-03 00:43:49 +00:00
|
|
|
THolder,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), ScopeLine)
|
2010-12-08 20:42:44 +00:00
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
MDNode *Node = MDNode::get(VMContext, Elts);
|
2010-12-08 20:42:44 +00:00
|
|
|
|
|
|
|
// Create a named metadata so that we do not lose this mdnode.
|
2011-08-16 22:09:43 +00:00
|
|
|
AllSubprograms.push_back(Node);
|
2010-12-08 20:42:44 +00:00
|
|
|
return DISubprogram(Node);
|
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createMethod - Create a new descriptor for the specified C++ method.
|
|
|
|
DISubprogram DIBuilder::createMethod(DIDescriptor Context,
|
2010-12-08 20:42:44 +00:00
|
|
|
StringRef Name,
|
|
|
|
StringRef LinkageName,
|
|
|
|
DIFile F,
|
|
|
|
unsigned LineNo, DIType Ty,
|
|
|
|
bool isLocalToUnit,
|
|
|
|
bool isDefinition,
|
|
|
|
unsigned VK, unsigned VIndex,
|
|
|
|
MDNode *VTableHolder,
|
|
|
|
unsigned Flags,
|
|
|
|
bool isOptimized,
|
2011-04-05 22:52:06 +00:00
|
|
|
Function *Fn,
|
|
|
|
MDNode *TParam) {
|
2011-08-19 23:28:12 +00:00
|
|
|
Value *TElts[] = { GetTagConstant(VMContext, DW_TAG_base_type) };
|
|
|
|
MDNode *Temp = MDNode::getTemporary(VMContext, TElts);
|
|
|
|
Value *TVElts[] = { Temp };
|
|
|
|
MDNode *THolder = MDNode::get(VMContext, TVElts);
|
|
|
|
|
2010-12-08 20:42:44 +00:00
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_subprogram),
|
2012-07-06 17:47:36 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext)),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(Context),
|
2010-12-08 20:42:44 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
MDString::get(VMContext, LinkageName),
|
|
|
|
F,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo),
|
|
|
|
Ty,
|
|
|
|
ConstantInt::get(Type::getInt1Ty(VMContext), isLocalToUnit),
|
|
|
|
ConstantInt::get(Type::getInt1Ty(VMContext), isDefinition),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), (unsigned)VK),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), VIndex),
|
|
|
|
VTableHolder,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
|
|
|
|
ConstantInt::get(Type::getInt1Ty(VMContext), isOptimized),
|
2011-04-05 22:52:06 +00:00
|
|
|
Fn,
|
|
|
|
TParam,
|
2012-07-06 17:47:36 +00:00
|
|
|
Constant::getNullValue(Type::getInt32Ty(VMContext)),
|
2012-04-03 00:43:49 +00:00
|
|
|
THolder,
|
2012-05-18 00:16:22 +00:00
|
|
|
// FIXME: Do we want to use different scope/lines?
|
2012-04-03 00:43:49 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo)
|
2010-12-08 20:42:44 +00:00
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
MDNode *Node = MDNode::get(VMContext, Elts);
|
2010-12-08 20:42:44 +00:00
|
|
|
return DISubprogram(Node);
|
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// createNameSpace - This creates new descriptor for a namespace
|
2010-12-07 23:25:47 +00:00
|
|
|
/// with the specified parent scope.
|
2011-02-22 18:56:12 +00:00
|
|
|
DINameSpace DIBuilder::createNameSpace(DIDescriptor Scope, StringRef Name,
|
2010-12-07 23:25:47 +00:00
|
|
|
DIFile File, unsigned LineNo) {
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_namespace),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(Scope),
|
2010-12-07 23:25:47 +00:00
|
|
|
MDString::get(VMContext, Name),
|
|
|
|
File,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), LineNo)
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DINameSpace(MDNode::get(VMContext, Elts));
|
2010-12-07 23:25:47 +00:00
|
|
|
}
|
|
|
|
|
2011-10-11 22:59:11 +00:00
|
|
|
/// createLexicalBlockFile - This creates a new MDNode that encapsulates
|
|
|
|
/// an existing scope with a new filename.
|
|
|
|
DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope,
|
2012-02-08 00:17:07 +00:00
|
|
|
DIFile File) {
|
2011-10-11 22:59:11 +00:00
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_lexical_block),
|
|
|
|
Scope,
|
|
|
|
File
|
|
|
|
};
|
|
|
|
return DILexicalBlockFile(MDNode::get(VMContext, Elts));
|
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File,
|
2010-12-08 01:50:15 +00:00
|
|
|
unsigned Line, unsigned Col) {
|
|
|
|
// Defeat MDNode uniqing for lexical blocks by using unique id.
|
|
|
|
static unsigned int unique_id = 0;
|
|
|
|
Value *Elts[] = {
|
|
|
|
GetTagConstant(VMContext, dwarf::DW_TAG_lexical_block),
|
2011-08-16 22:09:43 +00:00
|
|
|
getNonCompileUnitScope(Scope),
|
2010-12-08 01:50:15 +00:00
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Line),
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), Col),
|
|
|
|
File,
|
|
|
|
ConstantInt::get(Type::getInt32Ty(VMContext), unique_id++)
|
|
|
|
};
|
2011-04-18 23:51:03 +00:00
|
|
|
return DILexicalBlock(MDNode::get(VMContext, Elts));
|
2010-12-08 01:50:15 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
|
|
|
|
Instruction *DIBuilder::insertDeclare(Value *Storage, DIVariable VarInfo,
|
2010-12-07 23:25:47 +00:00
|
|
|
Instruction *InsertBefore) {
|
|
|
|
assert(Storage && "no storage passed to dbg.declare");
|
|
|
|
assert(VarInfo.Verify() && "empty DIVariable passed to dbg.declare");
|
|
|
|
if (!DeclareFn)
|
|
|
|
DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
|
|
|
|
|
2011-04-21 19:59:31 +00:00
|
|
|
Value *Args[] = { MDNode::get(Storage->getContext(), Storage), VarInfo };
|
2011-07-15 08:37:34 +00:00
|
|
|
return CallInst::Create(DeclareFn, Args, "", InsertBefore);
|
2010-12-07 23:25:47 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// insertDeclare - Insert a new llvm.dbg.declare intrinsic call.
|
|
|
|
Instruction *DIBuilder::insertDeclare(Value *Storage, DIVariable VarInfo,
|
2010-12-07 23:25:47 +00:00
|
|
|
BasicBlock *InsertAtEnd) {
|
|
|
|
assert(Storage && "no storage passed to dbg.declare");
|
|
|
|
assert(VarInfo.Verify() && "invalid DIVariable passed to dbg.declare");
|
|
|
|
if (!DeclareFn)
|
|
|
|
DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
|
|
|
|
|
2011-04-21 19:59:31 +00:00
|
|
|
Value *Args[] = { MDNode::get(Storage->getContext(), Storage), VarInfo };
|
2010-12-07 23:25:47 +00:00
|
|
|
|
|
|
|
// If this block already has a terminator then insert this intrinsic
|
|
|
|
// before the terminator.
|
|
|
|
if (TerminatorInst *T = InsertAtEnd->getTerminator())
|
2011-07-15 08:37:34 +00:00
|
|
|
return CallInst::Create(DeclareFn, Args, "", T);
|
2010-12-07 23:25:47 +00:00
|
|
|
else
|
2011-07-15 08:37:34 +00:00
|
|
|
return CallInst::Create(DeclareFn, Args, "", InsertAtEnd);
|
2010-12-07 23:25:47 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
|
|
|
|
Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
|
2010-12-07 23:25:47 +00:00
|
|
|
DIVariable VarInfo,
|
|
|
|
Instruction *InsertBefore) {
|
|
|
|
assert(V && "no value passed to dbg.value");
|
|
|
|
assert(VarInfo.Verify() && "invalid DIVariable passed to dbg.value");
|
|
|
|
if (!ValueFn)
|
|
|
|
ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
|
|
|
|
|
2011-04-21 19:59:31 +00:00
|
|
|
Value *Args[] = { MDNode::get(V->getContext(), V),
|
2010-12-07 23:25:47 +00:00
|
|
|
ConstantInt::get(Type::getInt64Ty(V->getContext()), Offset),
|
|
|
|
VarInfo };
|
2011-07-15 08:37:34 +00:00
|
|
|
return CallInst::Create(ValueFn, Args, "", InsertBefore);
|
2010-12-07 23:25:47 +00:00
|
|
|
}
|
|
|
|
|
2011-02-22 18:56:12 +00:00
|
|
|
/// insertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
|
|
|
|
Instruction *DIBuilder::insertDbgValueIntrinsic(Value *V, uint64_t Offset,
|
2010-12-07 23:25:47 +00:00
|
|
|
DIVariable VarInfo,
|
|
|
|
BasicBlock *InsertAtEnd) {
|
|
|
|
assert(V && "no value passed to dbg.value");
|
|
|
|
assert(VarInfo.Verify() && "invalid DIVariable passed to dbg.value");
|
|
|
|
if (!ValueFn)
|
|
|
|
ValueFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_value);
|
|
|
|
|
2011-04-21 19:59:31 +00:00
|
|
|
Value *Args[] = { MDNode::get(V->getContext(), V),
|
2010-12-07 23:25:47 +00:00
|
|
|
ConstantInt::get(Type::getInt64Ty(V->getContext()), Offset),
|
|
|
|
VarInfo };
|
2011-07-15 08:37:34 +00:00
|
|
|
return CallInst::Create(ValueFn, Args, "", InsertAtEnd);
|
2010-12-07 23:25:47 +00:00
|
|
|
}
|