summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-12-07 23:25:47 +0000
committerDevang Patel <dpatel@apple.com>2010-12-07 23:25:47 +0000
commitfe58f95f3604b394916bee7bd289e1f0e0488ec5 (patch)
treeff83f0316aab5b705efe9c3d8b561dc3f9cfac40 /include
parent953af2c3c560a13bd5eeb676c128b7e362dca684 (diff)
downloadllvm-fe58f95f3604b394916bee7bd289e1f0e0488ec5.tar.gz
llvm-fe58f95f3604b394916bee7bd289e1f0e0488ec5.tar.bz2
llvm-fe58f95f3604b394916bee7bd289e1f0e0488ec5.tar.xz
Add support to create variables, structs etc.. using DIBuilder.
This is still work in progress. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121205 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/DIBuilder.h151
-rw-r--r--include/llvm/Analysis/DebugInfo.h1
2 files changed, 147 insertions, 5 deletions
diff --git a/include/llvm/Analysis/DIBuilder.h b/include/llvm/Analysis/DIBuilder.h
index fe1c138318..532fe514dd 100644
--- a/include/llvm/Analysis/DIBuilder.h
+++ b/include/llvm/Analysis/DIBuilder.h
@@ -19,7 +19,11 @@
#include "llvm/ADT/StringRef.h"
namespace llvm {
+ class BasicBlock;
+ class Instruction;
+ class Function;
class Module;
+ class Value;
class LLVMContext;
class MDNode;
class StringRef;
@@ -27,6 +31,10 @@ namespace llvm {
class DIFile;
class DIEnumerator;
class DIType;
+ class DIArray;
+ class DIGlobalVariable;
+ class DINameSpace;
+ class DIVariable;
class DIBuilder {
private:
@@ -34,6 +42,9 @@ namespace llvm {
LLVMContext & VMContext;
MDNode *TheCU;
+ Function *DeclareFn; // llvm.dbg.declare
+ Function *ValueFn; // llvm.dbg.value
+
DIBuilder(const DIBuilder &); // DO NOT IMPLEMENT
void operator=(const DIBuilder &); // DO NOT IMPLEMENT
@@ -82,31 +93,161 @@ namespace llvm {
DIType CreateQualifiedType(unsigned Tag, DIType FromTy);
/// CreatePointerType - Create debugging information entry for a pointer.
+ /// @param PointeeTy Type pointed by this pointer.
+ /// @param SizeInBits Size.
+ /// @param AlignInBits Alignment. (optional)
+ /// @param Name Pointer type name. (optional)
DIType CreatePointerType(DIType PointeeTy, uint64_t SizeInBits,
- uint64_t AlignInBits = 0, StringRef Name = StringRef());
+ uint64_t AlignInBits = 0,
+ StringRef Name = StringRef());
- /// CreateReferenceType - Create debugging information entry for a reference.
+ /// CreateReferenceType - Create debugging information entry for a c++
+ /// style reference.
DIType CreateReferenceType(DIType RTy);
/// CreateTypedef - Create debugging information entry for a typedef.
- DIType CreateTypedef(DIType Ty, StringRef Name, DIFile F, unsigned LineNo);
+ /// @param Ty Original type.
+ /// @param Name Typedef name.
+ /// @param File File where this type is defined.
+ /// @param LineNo Line number.
+ DIType CreateTypedef(DIType Ty, StringRef Name, DIFile File,
+ unsigned LineNo);
/// CreateFriend - Create debugging information entry for a 'friend'.
DIType CreateFriend(DIType Ty, DIType FriendTy);
/// CreateInheritance - Create debugging information entry to establish
/// inheritance relationship between two types.
+ /// @param Ty Original type.
+ /// @param BaseTy Base type. Ty is inherits from base.
+ /// @param BaseOffset Base offset.
+ /// @param Flags Flags to describe inheritance attribute,
+ /// e.g. private
DIType CreateInheritance(DIType Ty, DIType BaseTy, uint64_t BaseOffset,
unsigned Flags);
/// CreateMemberType - Create debugging information entry for a member.
- DIType CreateMemberType(DIDescriptor Context, StringRef Name, DIFile F,
- unsigned LineNumber, uint64_t SizeInBits,
+ /// @param Name Member name.
+ /// @param File File where this member is defined.
+ /// @param LineNo Line number.
+ /// @param SizeInBits Member size.
+ /// @param AlignInBits Member alignment.
+ /// @param OffsetInBits Member offset.
+ /// @param Flags Flags to encode member attribute, e.g. private
+ /// @param Ty Parent type.
+ DIType CreateMemberType(StringRef Name, DIFile File,
+ unsigned LineNo, uint64_t SizeInBits,
uint64_t AlignInBits, uint64_t OffsetInBits,
unsigned Flags, DIType Ty);
+ /// CreateStructType - Create debugging information entry for a struct.
+ DIType CreateStructType(DIDescriptor Context, StringRef Name, DIFile F,
+ unsigned LineNumber, uint64_t SizeInBits,
+ uint64_t AlignInBits, unsigned Flags,
+ DIArray Elements, unsigned RunTimeLang = 0);
+
/// CreateArtificialType - Create a new DIType with "artificial" flag set.
DIType CreateArtificialType(DIType Ty);
+
+ /// CreateTemporaryType - Create a temporary forward-declared type.
+ DIType CreateTemporaryType();
+ DIType CreateTemporaryType(DIFile F);
+
+ /// GetOrCreateArray - Get a DIArray, create one if required.
+ DIArray GetOrCreateArray(Value *const *Elements, unsigned NumElements);
+
+ /// CreateGlobalVariable - Create a new descriptor for the specified global.
+ /// @param Name Name of the variable.
+ /// @param LinakgeName Mangled name of the variable.
+ /// @param File File where this variable is defined.
+ /// @param LineNo Line number.
+ /// @param Ty Variable Type.
+ /// @param isLocalToUnit Boolean flag indicate whether this variable is
+ /// externally visible or not.
+ /// @param Val llvm::Value of the variable.
+ DIGlobalVariable
+ CreateGlobalVariable(StringRef Name,
+ StringRef LinkageName, DIFile File, unsigned LineNo,
+ DIType Ty, bool isLocalToUnit, llvm::Value *Val);
+
+
+ /// CreateStaticVariable - Create a new descriptor for the specified
+ /// variable.
+ /// @param Conext Variable scope.
+ /// @param Name Name of the variable.
+ /// @param LinakgeName Mangled name of the variable.
+ /// @param File File where this variable is defined.
+ /// @param LineNo Line number.
+ /// @param Ty Variable Type.
+ /// @param isLocalToUnit Boolean flag indicate whether this variable is
+ /// externally visible or not.
+ /// @param Val llvm::Value of the variable.
+ DIGlobalVariable
+ CreateStaticVariable(DIDescriptor Context, StringRef Name,
+ StringRef LinkageName, DIFile File, unsigned LineNo,
+ DIType Ty, bool isLocalToUnit, llvm::Value *Val);
+
+
+ /// CreateComplexVariable - Create a new descriptor for the specified
+ /// variable which has a complex address expression for its address.
+ /// @param Tag Dwarf TAG. Usually DW_TAG_auto_variable or
+ /// DW_TAG_arg_variable.
+ /// @param Scope Variable scope.
+ /// @param Name Variable name.
+ /// @param File File where this variable is defined.
+ /// @param LineNo Line number.
+ /// @param Ty Variable Type
+ /// @param Addr A pointer to a vector of complex address operations.
+ /// @param NumAddr Num of address operations in the vector.
+ DIVariable CreateComplexVariable(unsigned Tag, DIDescriptor Scope,
+ StringRef Name, DIFile F, unsigned LineNo,
+ DIType Ty, Value *const *Addr,
+ unsigned NumAddr);
+
+
+ /// CreateNameSpace - This creates new descriptor for a namespace
+ /// with the specified parent scope.
+ /// @param Scope Namespace scope
+ /// @param Name Name of this namespace
+ /// @param File Source file
+ /// @param LineNo Line number
+ DINameSpace CreateNameSpace(DIDescriptor Scope, StringRef Name,
+ DIFile File, unsigned LineNo);
+
+
+ /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
+ /// @param Storage llvm::Value of the variable
+ /// @param VarInfo Variable's debug info descriptor.
+ /// @param InsertAtEnd Location for the new intrinsic.
+ Instruction *InsertDeclare(llvm::Value *Storage, DIVariable VarInfo,
+ BasicBlock *InsertAtEnd);
+
+ /// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
+ /// @param Storage llvm::Value of the variable
+ /// @param VarInfo Variable's debug info descriptor.
+ /// @param InsertBefore Location for the new intrinsic.
+ Instruction *InsertDeclare(llvm::Value *Storage, DIVariable VarInfo,
+ Instruction *InsertBefore);
+
+
+ /// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
+ /// @param Val llvm::Value of the variable
+ /// @param Offset Offset
+ /// @param VarInfo Variable's debug info descriptor.
+ /// @param InsertAtEnd Location for the new intrinsic.
+ Instruction *InsertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
+ DIVariable VarInfo,
+ BasicBlock *InsertAtEnd);
+
+ /// InsertDbgValueIntrinsic - Insert a new llvm.dbg.value intrinsic call.
+ /// @param Val llvm::Value of the variable
+ /// @param Offset Offset
+ /// @param VarInfo Variable's debug info descriptor.
+ /// @param InsertBefore Location for the new intrinsic.
+ Instruction *InsertDbgValueIntrinsic(llvm::Value *Val, uint64_t Offset,
+ DIVariable VarInfo,
+ Instruction *InsertBefore);
+
};
} // end namespace llvm
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index af683af0c9..5f4db24cce 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -715,6 +715,7 @@ namespace llvm {
/// CreateTemporaryType - Create a temporary forward-declared type.
DIType CreateTemporaryType();
+ DIType CreateTemporaryType(DIFile F);
/// CreateArtificialType - Create a new DIType with "artificial" flag set.
DIType CreateArtificialType(DIType Ty);