Merge 'ConstructFunctionDbgScope' and 'ConstructAbstractDbgScope'.

llvm-svn: 72197
This commit is contained in:
Bill Wendling 2009-05-20 23:28:48 +00:00
parent bcad77a8d5
commit 744668d5af
2 changed files with 14 additions and 41 deletions

View File

@ -1092,7 +1092,8 @@ void DwarfDebug::ConstructDbgScope(DbgScope *ParentScope,
/// ConstructFunctionDbgScope - Construct the scope for the subprogram.
///
void DwarfDebug::ConstructFunctionDbgScope(DbgScope *RootScope) {
void DwarfDebug::ConstructFunctionDbgScope(DbgScope *RootScope,
bool AbstractScope) {
// Exit if there is no root scope.
if (!RootScope) return;
DIDescriptor Desc = RootScope->getDesc();
@ -1111,43 +1112,19 @@ void DwarfDebug::ConstructFunctionDbgScope(DbgScope *RootScope) {
DIE *SPDie = Unit->getDieMapSlotFor(SPD.getGV());
assert(SPDie && "Missing subprogram descriptor");
// Add the function bounds.
AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
DWLabel("func_begin", SubprogramCount));
AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr,
DWLabel("func_end", SubprogramCount));
MachineLocation Location(RI->getFrameRegister(*MF));
AddAddress(SPDie, dwarf::DW_AT_frame_base, Location);
if (!AbstractScope) {
// Add the function bounds.
AddLabel(SPDie, dwarf::DW_AT_low_pc, dwarf::DW_FORM_addr,
DWLabel("func_begin", SubprogramCount));
AddLabel(SPDie, dwarf::DW_AT_high_pc, dwarf::DW_FORM_addr,
DWLabel("func_end", SubprogramCount));
MachineLocation Location(RI->getFrameRegister(*MF));
AddAddress(SPDie, dwarf::DW_AT_frame_base, Location);
}
ConstructDbgScope(RootScope, 0, 0, SPDie, Unit);
}
/// ConstructFunctionDbgScope - Construct the scope for the abstract debug
/// scope.
///
void DwarfDebug::ConstructAbstractDbgScope(DbgScope *AbsScope) {
// Exit if there is no root scope.
if (!AbsScope) return;
DIDescriptor Desc = AbsScope->getDesc();
if (Desc.isNull())
return;
// Get the subprogram debug information entry.
DISubprogram SPD(Desc.getGV());
// Get the compile unit context.
CompileUnit *Unit = MainCU;
if (!Unit)
Unit = &FindCompileUnit(SPD.getCompileUnit());
// Get the subprogram die.
DIE *SPDie = Unit->getDieMapSlotFor(SPD.getGV());
assert(SPDie && "Missing subprogram descriptor");
ConstructDbgScope(AbsScope, 0, 0, SPDie, Unit);
}
/// ConstructDefaultDbgScope - Construct a default scope for the subprogram.
///
void DwarfDebug::ConstructDefaultDbgScope(MachineFunction *MF) {
@ -1587,7 +1564,7 @@ void DwarfDebug::EndFunction(MachineFunction *MF) {
for (SmallVector<DbgScope *, 32>::iterator
I = AbstractInstanceRootList.begin(),
E = AbstractInstanceRootList.end(); I != E; ++I)
ConstructAbstractDbgScope(*I);
ConstructFunctionDbgScope(*I);
// Construct scopes for subprogram.
if (FunctionDbgScope)

View File

@ -355,12 +355,8 @@ class VISIBILITY_HIDDEN DwarfDebug : public Dwarf {
/// ConstructFunctionDbgScope - Construct the scope for the subprogram.
///
void ConstructFunctionDbgScope(DbgScope *RootScope);
/// ConstructFunctionDbgScope - Construct the scope for the abstract debug
/// scope.
///
void ConstructAbstractDbgScope(DbgScope *AbsScope);
void ConstructFunctionDbgScope(DbgScope *RootScope,
bool AbstractScope = false);
/// ConstructDefaultDbgScope - Construct a default scope for the subprogram.
///