diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-05-20 22:57:17 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2009-05-20 22:57:17 +0000 |
commit | 2b59a5fc6c82e5968a46e5412f495d6de48d2852 (patch) | |
tree | d75d67b79392a14e94acc3175eac48c671410368 /llvm/lib/CodeGen/MachineFunction.cpp | |
parent | 920e3af495df707e2cda94536d6bd63898baabc5 (diff) | |
download | bcm5719-llvm-2b59a5fc6c82e5968a46e5412f495d6de48d2852.tar.gz bcm5719-llvm-2b59a5fc6c82e5968a46e5412f495d6de48d2852.zip |
Introduce DebugScope which gets embedded into the machine instructions' DebugLoc.
DebugScope refers to a debug region, function or block.
llvm-svn: 72191
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineFunction.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp index cacfed1d9f7..d1d782c8256 100644 --- a/llvm/lib/CodeGen/MachineFunction.cpp +++ b/llvm/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 //===----------------------------------------------------------------------===// |