diff options
author | Argiris Kirtzidis <akyrtzi@gmail.com> | 2009-05-20 22:57:17 +0000 |
---|---|---|
committer | Argiris Kirtzidis <akyrtzi@gmail.com> | 2009-05-20 22:57:17 +0000 |
commit | 0c41264d8ca7e8bd4bab0413891e7fb1aa22d864 (patch) | |
tree | b11e9216b210aa292c44b188250195ef8292d4b3 /lib/CodeGen/MachineFunction.cpp | |
parent | 6787a7c255d2a7c99406f26833e329a1ce1fe3f8 (diff) | |
download | external_llvm-0c41264d8ca7e8bd4bab0413891e7fb1aa22d864.zip external_llvm-0c41264d8ca7e8bd4bab0413891e7fb1aa22d864.tar.gz external_llvm-0c41264d8ca7e8bd4bab0413891e7fb1aa22d864.tar.bz2 |
Introduce DebugScope which gets embedded into the machine instructions' DebugLoc.
DebugScope refers to a debug region, function or block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72191 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineFunction.cpp')
-rw-r--r-- | lib/CodeGen/MachineFunction.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp index cacfed1..d1d782c 100644 --- a/lib/CodeGen/MachineFunction.cpp +++ b/lib/CodeGen/MachineFunction.cpp @@ -403,8 +403,9 @@ unsigned MachineFunction::addLiveIn(unsigned PReg, /// source file, line, and column. If none currently exists, create a new /// DebugLocTuple, and insert it into the DebugIdMap. unsigned MachineFunction::getOrCreateDebugLocID(GlobalVariable *CompileUnit, + DebugScope Scope, unsigned Line, unsigned Col) { - DebugLocTuple Tuple(CompileUnit, Line, Col); + DebugLocTuple Tuple(CompileUnit, Scope, Line, Col); DenseMap<DebugLocTuple, unsigned>::iterator II = DebugLocInfo.DebugIdMap.find(Tuple); if (II != DebugLocInfo.DebugIdMap.end()) @@ -424,6 +425,21 @@ DebugLocTuple MachineFunction::getDebugLocTuple(DebugLoc DL) const { return DebugLocInfo.DebugLocations[Idx]; } +/// CreateDebugScope - Create a new debug scope. +DebugScope MachineFunction::CreateDebugScope(GlobalVariable *ScopeGV, + DebugScope Parent) { + DbgScopeInfos.push_back(DebugScopeInfo(ScopeGV, Parent)); + return DebugScope::get(DbgScopeInfos.size() - 1); +} + +/// getDebugScopeInfo - Get the DebugScopeInfo for a given DebugScope object. +const DebugScopeInfo &MachineFunction::getDebugScopeInfo(DebugScope DS) const { + unsigned Idx = DS.getIndex(); + assert(Idx < DbgScopeInfos.size() && "Invalid index into debug scopes!"); + return DbgScopeInfos[Idx]; +} + + //===----------------------------------------------------------------------===// // MachineFrameInfo implementation //===----------------------------------------------------------------------===// |