[llvm-commits] [llvm] r85126 - in /llvm/trunk: include/llvm/Analysis/DebugInfo.h lib/Analysis/DebugInfo.cpp
Devang Patel
dpatel at apple.com
Mon Oct 26 09:54:36 PDT 2009
Author: dpatel
Date: Mon Oct 26 11:54:35 2009
New Revision: 85126
URL: http://llvm.org/viewvc/llvm-project?rev=85126&view=rev
Log:
Add support to encode type info using llvm::Constant.
Patch by Talin!
Modified:
llvm/trunk/include/llvm/Analysis/DebugInfo.h
llvm/trunk/lib/Analysis/DebugInfo.cpp
Modified: llvm/trunk/include/llvm/Analysis/DebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/DebugInfo.h?rev=85126&r1=85125&r2=85126&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/DebugInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/DebugInfo.h Mon Oct 26 11:54:35 2009
@@ -514,6 +514,13 @@
uint64_t OffsetInBits, unsigned Flags,
unsigned Encoding);
+ /// CreateBasicType - Create a basic type like int, float, etc.
+ DIBasicType CreateBasicTypeEx(DIDescriptor Context, StringRef Name,
+ DICompileUnit CompileUnit, unsigned LineNumber,
+ Constant *SizeInBits, Constant *AlignInBits,
+ Constant *OffsetInBits, unsigned Flags,
+ unsigned Encoding);
+
/// CreateDerivedType - Create a derived type like const qualified type,
/// pointer, typedef, etc.
DIDerivedType CreateDerivedType(unsigned Tag, DIDescriptor Context,
@@ -524,6 +531,16 @@
uint64_t OffsetInBits, unsigned Flags,
DIType DerivedFrom);
+ /// CreateDerivedType - Create a derived type like const qualified type,
+ /// pointer, typedef, etc.
+ DIDerivedType CreateDerivedTypeEx(unsigned Tag, DIDescriptor Context,
+ StringRef Name,
+ DICompileUnit CompileUnit,
+ unsigned LineNumber,
+ Constant *SizeInBits, Constant *AlignInBits,
+ Constant *OffsetInBits, unsigned Flags,
+ DIType DerivedFrom);
+
/// CreateCompositeType - Create a composite type like array, struct, etc.
DICompositeType CreateCompositeType(unsigned Tag, DIDescriptor Context,
StringRef Name,
@@ -536,6 +553,18 @@
DIArray Elements,
unsigned RunTimeLang = 0);
+ /// CreateCompositeType - Create a composite type like array, struct, etc.
+ DICompositeType CreateCompositeTypeEx(unsigned Tag, DIDescriptor Context,
+ StringRef Name,
+ DICompileUnit CompileUnit,
+ unsigned LineNumber,
+ Constant *SizeInBits,
+ Constant *AlignInBits,
+ Constant *OffsetInBits, unsigned Flags,
+ DIType DerivedFrom,
+ DIArray Elements,
+ unsigned RunTimeLang = 0);
+
/// CreateSubprogram - Create a new descriptor for the specified subprogram.
/// See comments in DISubprogram for descriptions of these fields.
DISubprogram CreateSubprogram(DIDescriptor Context, StringRef Name,
Modified: llvm/trunk/lib/Analysis/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/DebugInfo.cpp?rev=85126&r1=85125&r2=85126&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/DebugInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/DebugInfo.cpp Mon Oct 26 11:54:35 2009
@@ -695,6 +695,32 @@
return DIBasicType(MDNode::get(VMContext, &Elts[0], 10));
}
+
+/// CreateBasicType - Create a basic type like int, float, etc.
+DIBasicType DIFactory::CreateBasicTypeEx(DIDescriptor Context,
+ StringRef Name,
+ DICompileUnit CompileUnit,
+ unsigned LineNumber,
+ Constant *SizeInBits,
+ Constant *AlignInBits,
+ Constant *OffsetInBits, unsigned Flags,
+ unsigned Encoding) {
+ Value *Elts[] = {
+ GetTagConstant(dwarf::DW_TAG_base_type),
+ Context.getNode(),
+ MDString::get(VMContext, Name),
+ CompileUnit.getNode(),
+ ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
+ SizeInBits,
+ AlignInBits,
+ OffsetInBits,
+ ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
+ ConstantInt::get(Type::getInt32Ty(VMContext), Encoding)
+ };
+ return DIBasicType(MDNode::get(VMContext, &Elts[0], 10));
+}
+
+
/// CreateDerivedType - Create a derived type like const qualified type,
/// pointer, typedef, etc.
DIDerivedType DIFactory::CreateDerivedType(unsigned Tag,
@@ -722,6 +748,35 @@
return DIDerivedType(MDNode::get(VMContext, &Elts[0], 10));
}
+
+/// CreateDerivedType - Create a derived type like const qualified type,
+/// pointer, typedef, etc.
+DIDerivedType DIFactory::CreateDerivedTypeEx(unsigned Tag,
+ DIDescriptor Context,
+ StringRef Name,
+ DICompileUnit CompileUnit,
+ unsigned LineNumber,
+ Constant *SizeInBits,
+ Constant *AlignInBits,
+ Constant *OffsetInBits,
+ unsigned Flags,
+ DIType DerivedFrom) {
+ Value *Elts[] = {
+ GetTagConstant(Tag),
+ Context.getNode(),
+ MDString::get(VMContext, Name),
+ CompileUnit.getNode(),
+ ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
+ SizeInBits,
+ AlignInBits,
+ OffsetInBits,
+ ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
+ DerivedFrom.getNode(),
+ };
+ return DIDerivedType(MDNode::get(VMContext, &Elts[0], 10));
+}
+
+
/// CreateCompositeType - Create a composite type like array, struct, etc.
DICompositeType DIFactory::CreateCompositeType(unsigned Tag,
DIDescriptor Context,
@@ -754,6 +809,38 @@
}
+/// CreateCompositeType - Create a composite type like array, struct, etc.
+DICompositeType DIFactory::CreateCompositeTypeEx(unsigned Tag,
+ DIDescriptor Context,
+ StringRef Name,
+ DICompileUnit CompileUnit,
+ unsigned LineNumber,
+ Constant *SizeInBits,
+ Constant *AlignInBits,
+ Constant *OffsetInBits,
+ unsigned Flags,
+ DIType DerivedFrom,
+ DIArray Elements,
+ unsigned RuntimeLang) {
+
+ Value *Elts[] = {
+ GetTagConstant(Tag),
+ Context.getNode(),
+ MDString::get(VMContext, Name),
+ CompileUnit.getNode(),
+ ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
+ SizeInBits,
+ AlignInBits,
+ OffsetInBits,
+ ConstantInt::get(Type::getInt32Ty(VMContext), Flags),
+ DerivedFrom.getNode(),
+ Elements.getNode(),
+ ConstantInt::get(Type::getInt32Ty(VMContext), RuntimeLang)
+ };
+ return DICompositeType(MDNode::get(VMContext, &Elts[0], 12));
+}
+
+
/// CreateSubprogram - Create a new descriptor for the specified subprogram.
/// See comments in DISubprogram for descriptions of these fields. This
/// method does not unique the generated descriptors.
More information about the llvm-commits
mailing list