summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-03-01 22:58:13 +0000
committerDevang Patel <dpatel@apple.com>2011-03-01 22:58:13 +0000
commite9e16c5f52c4a093f4de234d448cdebedab8938e (patch)
tree30919eba1124cefad5813d264bfb9d0fb9e82131 /include
parentd9f574b724a208ec38761e250d83fcc2480e685c (diff)
downloadllvm-e9e16c5f52c4a093f4de234d448cdebedab8938e.tar.gz
llvm-e9e16c5f52c4a093f4de234d448cdebedab8938e.tar.bz2
llvm-e9e16c5f52c4a093f4de234d448cdebedab8938e.tar.xz
Today, the language front ends produces llvm.dbg.* intrinsics, used to encode arguments' debug info, in order any way, most of the times. However, if a front end mix-n-matches llvm.dbg.declare and llvm.dbg.value intrinsics to encode debug info for arguments then code generator needs a way to find argument order.
Use 8 bits from line number field to keep track of argument ordering while encoding debug info for an argument. That leaves 24 bit for line no, DebugLoc also allocates 24 bit for line numbers. If a function has more than 255 arguments then rest of the arguments will be ordered by llvm.dbg.* intrinsics' ordering in IR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126793 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/DIBuilder.h9
-rw-r--r--include/llvm/Analysis/DebugInfo.h8
2 files changed, 14 insertions, 3 deletions
diff --git a/include/llvm/Analysis/DIBuilder.h b/include/llvm/Analysis/DIBuilder.h
index 417dbc4e80..32a17e4f09 100644
--- a/include/llvm/Analysis/DIBuilder.h
+++ b/include/llvm/Analysis/DIBuilder.h
@@ -326,11 +326,14 @@ namespace llvm {
/// @param AlwaysPreserve Boolean. Set to true if debug info for this
/// variable should be preserved in optimized build.
/// @param Flags Flags, e.g. artificial variable.
+ /// @param ArgNo If this variable is an arugment then this argument's
+ /// number. 1 indicates 1st argument.
DIVariable createLocalVariable(unsigned Tag, DIDescriptor Scope,
StringRef Name,
DIFile File, unsigned LineNo,
DIType Ty, bool AlwaysPreserve = false,
- unsigned Flags = 0);
+ unsigned Flags = 0,
+ unsigned ArgNo = 0);
/// createComplexVariable - Create a new descriptor for the specified
@@ -344,10 +347,12 @@ namespace llvm {
/// @param Ty Variable Type
/// @param Addr A pointer to a vector of complex address operations.
/// @param NumAddr Num of address operations in the vector.
+ /// @param ArgNo If this variable is an arugment then this argument's
+ /// number. 1 indicates 1st argument.
DIVariable createComplexVariable(unsigned Tag, DIDescriptor Scope,
StringRef Name, DIFile F, unsigned LineNo,
DIType Ty, Value *const *Addr,
- unsigned NumAddr);
+ unsigned NumAddr, unsigned ArgNo = 0);
/// createFunction - Create a new descriptor for the specified subprogram.
/// See comments in DISubprogram for descriptions of these fields.
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index aa69088b42..e75b74ffed 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -564,7 +564,13 @@ namespace llvm {
DIFile F = getFieldAs<DIFile>(3);
return F.getCompileUnit();
}
- unsigned getLineNumber() const { return getUnsignedField(4); }
+ unsigned getLineNumber() const {
+ return (getUnsignedField(4) << 8) >> 8;
+ }
+ unsigned getArgNumber() const {
+ unsigned L = getUnsignedField(4);
+ return L >> 24;
+ }
DIType getType() const { return getFieldAs<DIType>(5); }
/// isArtificial - Return true if this variable is marked as "artificial".