aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorArgiris Kirtzidis <akyrtzi@gmail.com>2009-04-30 23:22:31 +0000
committerArgiris Kirtzidis <akyrtzi@gmail.com>2009-04-30 23:22:31 +0000
commit5b02f4c65921e7f0f0cc997aa6f0b614259e4aea (patch)
treec120bcc5dae1ed6c28cdf9b86b0dac5b9c71a65e /include/llvm/CodeGen
parentb9e97bc4237a7e307f87f3937ec1166c2134fe2a (diff)
downloadexternal_llvm-5b02f4c65921e7f0f0cc997aa6f0b614259e4aea.tar.gz
external_llvm-5b02f4c65921e7f0f0cc997aa6f0b614259e4aea.tar.bz2
external_llvm-5b02f4c65921e7f0f0cc997aa6f0b614259e4aea.zip
Make DebugLoc independent of DwarfWriter.
-Replace DebugLocTuple's Source ID with CompileUnit's GlobalVariable* -Remove DwarfWriter::getOrCreateSourceID -Make necessary changes for the above (fix callsites, etc.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70520 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/DebugLoc.h23
-rw-r--r--include/llvm/CodeGen/DwarfWriter.h12
-rw-r--r--include/llvm/CodeGen/MachineFunction.h3
3 files changed, 18 insertions, 20 deletions
diff --git a/include/llvm/CodeGen/DebugLoc.h b/include/llvm/CodeGen/DebugLoc.h
index d5ad9dcafd..77e6733f69 100644
--- a/include/llvm/CodeGen/DebugLoc.h
+++ b/include/llvm/CodeGen/DebugLoc.h
@@ -19,17 +19,20 @@
#include <vector>
namespace llvm {
+ class GlobalVariable;
/// DebugLocTuple - Debug location tuple of filename id, line and column.
///
struct DebugLocTuple {
- unsigned Src, Line, Col;
+ GlobalVariable *CompileUnit;
+ unsigned Line, Col;
- DebugLocTuple(unsigned s, unsigned l, unsigned c)
- : Src(s), Line(l), Col(c) {};
+ DebugLocTuple(GlobalVariable *v, unsigned l, unsigned c)
+ : CompileUnit(v), Line(l), Col(c) {};
bool operator==(const DebugLocTuple &DLT) const {
- return Src == DLT.Src && Line == DLT.Line && Col == DLT.Col;
+ return CompileUnit == DLT.CompileUnit &&
+ Line == DLT.Line && Col == DLT.Col;
}
bool operator!=(const DebugLocTuple &DLT) const {
return !(*this == DLT);
@@ -60,20 +63,20 @@ namespace llvm {
// Partially specialize DenseMapInfo for DebugLocTyple.
template<> struct DenseMapInfo<DebugLocTuple> {
static inline DebugLocTuple getEmptyKey() {
- return DebugLocTuple(~0U, ~0U, ~0U);
+ return DebugLocTuple(0, ~0U, ~0U);
}
static inline DebugLocTuple getTombstoneKey() {
- return DebugLocTuple(~1U, ~1U, ~1U);
+ return DebugLocTuple((GlobalVariable*)~1U, ~1U, ~1U);
}
static unsigned getHashValue(const DebugLocTuple &Val) {
- return DenseMapInfo<unsigned>::getHashValue(Val.Src) ^
+ return DenseMapInfo<GlobalVariable*>::getHashValue(Val.CompileUnit) ^
DenseMapInfo<unsigned>::getHashValue(Val.Line) ^
DenseMapInfo<unsigned>::getHashValue(Val.Col);
}
static bool isEqual(const DebugLocTuple &LHS, const DebugLocTuple &RHS) {
- return LHS.Src == RHS.Src &&
- LHS.Line == RHS.Line &&
- LHS.Col == RHS.Col;
+ return LHS.CompileUnit == RHS.CompileUnit &&
+ LHS.Line == RHS.Line &&
+ LHS.Col == RHS.Col;
}
static bool isPod() { return true; }
diff --git a/include/llvm/CodeGen/DwarfWriter.h b/include/llvm/CodeGen/DwarfWriter.h
index e4e485039e..9ca7d7e4f2 100644
--- a/include/llvm/CodeGen/DwarfWriter.h
+++ b/include/llvm/CodeGen/DwarfWriter.h
@@ -37,6 +37,7 @@ class GlobalVariable;
class TargetAsmInfo;
class raw_ostream;
class Instruction;
+class DICompileUnit;
class DISubprogram;
class DIVariable;
@@ -87,14 +88,7 @@ public:
/// RecordSourceLine - Register a source line with debug info. Returns a
/// unique label ID used to generate a label and provide correspondence to
/// the source line list.
- unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src);
-
- /// getOrCreateSourceID - Look up the source id with the given directory and
- /// source file names. If none currently exists, create a new id and insert it
- /// in the SourceIds map. This can update DirectoryIds and SourceFileIds maps
- /// as well.
- unsigned getOrCreateSourceID(const std::string &DirName,
- const std::string &FileName);
+ unsigned RecordSourceLine(unsigned Line, unsigned Col, DICompileUnit CU);
/// RecordRegionStart - Indicate the start of a region.
unsigned RecordRegionStart(GlobalVariable *V);
@@ -116,7 +110,7 @@ public:
//// RecordInlinedFnStart - Indicate the start of a inlined function.
void RecordInlinedFnStart(Instruction *I, DISubprogram &SP, unsigned LabelID,
- unsigned Src, unsigned Line, unsigned Col);
+ DICompileUnit CU, unsigned Line, unsigned Col);
/// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
unsigned RecordInlinedFnEnd(DISubprogram &SP);
diff --git a/include/llvm/CodeGen/MachineFunction.h b/include/llvm/CodeGen/MachineFunction.h
index f427c72e33..1c9bc61521 100644
--- a/include/llvm/CodeGen/MachineFunction.h
+++ b/include/llvm/CodeGen/MachineFunction.h
@@ -332,7 +332,8 @@ public:
/// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given
/// source file, line, and column. If none currently exists, create a new
/// DebugLocTuple, and insert it into the DebugIdMap.
- unsigned getOrCreateDebugLocID(unsigned Src, unsigned Line, unsigned Col);
+ unsigned getOrCreateDebugLocID(GlobalVariable *CompileUnit,
+ unsigned Line, unsigned Col);
/// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object.
DebugLocTuple getDebugLocTuple(DebugLoc DL) const;