Temporarily revert r72191. It was causing an assert during llvm-gcc

bootstrapping.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72200 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2009-05-21 00:04:55 +00:00
parent 39dd696282
commit df7d5d3170
9 changed files with 34 additions and 201 deletions

View File

@ -20,77 +20,18 @@
namespace llvm { namespace llvm {
class GlobalVariable; class GlobalVariable;
class MachineFunction;
/// DebugScope - Debug scope id. This is carried into DebugLocTuple to index /// DebugLocTuple - Debug location tuple of filename id, line and column.
/// into a vector of DebugScopeInfos. Provides the ability to associate a
/// SDNode/MachineInstr with the debug scope that it belongs to.
///
class DebugScope {
unsigned Idx;
public:
DebugScope() : Idx(~0U) {} // Defaults to null.
static DebugScope getInvalid() { DebugScope S; S.Idx = ~0U; return S; }
static DebugScope get(unsigned idx) { DebugScope S; S.Idx = idx; return S; }
unsigned getIndex() const { return Idx; }
/// isInvalid - Return true if it doesn't refer to any scope.
bool isInvalid() const { return Idx == ~0U; }
bool operator==(const DebugScope &DS) const { return Idx == DS.Idx; }
bool operator!=(const DebugScope &DS) const { return !(*this == DS); }
};
/// DebugScopeInfo - Contains info about the scope global variable and the
/// parent debug scope. DebugScope is only a "cookie" that can point to a
/// specific DebugScopeInfo.
///
struct DebugScopeInfo {
GlobalVariable *GV;
DebugScope Parent;
DebugScopeInfo(GlobalVariable *gv, DebugScope parent)
: GV(gv), Parent(parent) {}
DebugScopeInfo()
: GV(0), Parent(DebugScope::getInvalid()) {}
};
/// DebugScopeTracker - Create and keep track of the debug scope while
/// entering/exiting subprograms and blocks. Used by the instruction
/// selectors.
///
class DebugScopeTracker {
DebugScope CurScope;
public:
/// getCurScope - The current debug scope that we "entered" through
/// EnterDebugScope.
DebugScope getCurScope() const { return CurScope; }
/// EnterDebugScope - Start a new debug scope. ScopeGV can be a DISubprogram
/// or a DIBlock.
void EnterDebugScope(GlobalVariable *ScopeGV, MachineFunction &MF);
/// ExitDebugScope - "Pop" a DISubprogram or a DIBlock.
void ExitDebugScope(GlobalVariable *ScopeGV, MachineFunction &MF);
};
/// DebugLocTuple - Debug location tuple of a DICompileUnit global variable,
/// debug scope, line and column.
/// ///
struct DebugLocTuple { struct DebugLocTuple {
GlobalVariable *CompileUnit; GlobalVariable *CompileUnit;
DebugScope Scope;
unsigned Line, Col; unsigned Line, Col;
DebugLocTuple(GlobalVariable *v, DebugScope s, unsigned l, unsigned c) DebugLocTuple(GlobalVariable *v, unsigned l, unsigned c)
: CompileUnit(v), Scope(s), Line(l), Col(c) {}; : CompileUnit(v), Line(l), Col(c) {};
bool operator==(const DebugLocTuple &DLT) const { bool operator==(const DebugLocTuple &DLT) const {
return CompileUnit == DLT.CompileUnit && Scope == DLT.Scope && return CompileUnit == DLT.CompileUnit &&
Line == DLT.Line && Col == DLT.Col; Line == DLT.Line && Col == DLT.Col;
} }
bool operator!=(const DebugLocTuple &DLT) const { bool operator!=(const DebugLocTuple &DLT) const {
@ -122,20 +63,18 @@ namespace llvm {
// Partially specialize DenseMapInfo for DebugLocTyple. // Partially specialize DenseMapInfo for DebugLocTyple.
template<> struct DenseMapInfo<DebugLocTuple> { template<> struct DenseMapInfo<DebugLocTuple> {
static inline DebugLocTuple getEmptyKey() { static inline DebugLocTuple getEmptyKey() {
return DebugLocTuple(0, DebugScope::getInvalid(), ~0U, ~0U); return DebugLocTuple(0, ~0U, ~0U);
} }
static inline DebugLocTuple getTombstoneKey() { static inline DebugLocTuple getTombstoneKey() {
return DebugLocTuple((GlobalVariable*)~1U,DebugScope::get(~1U), ~1U, ~1U); return DebugLocTuple((GlobalVariable*)~1U, ~1U, ~1U);
} }
static unsigned getHashValue(const DebugLocTuple &Val) { static unsigned getHashValue(const DebugLocTuple &Val) {
return DenseMapInfo<GlobalVariable*>::getHashValue(Val.CompileUnit) ^ return DenseMapInfo<GlobalVariable*>::getHashValue(Val.CompileUnit) ^
DenseMapInfo<unsigned>::getHashValue(Val.Scope.getIndex()) ^
DenseMapInfo<unsigned>::getHashValue(Val.Line) ^ DenseMapInfo<unsigned>::getHashValue(Val.Line) ^
DenseMapInfo<unsigned>::getHashValue(Val.Col); DenseMapInfo<unsigned>::getHashValue(Val.Col);
} }
static bool isEqual(const DebugLocTuple &LHS, const DebugLocTuple &RHS) { static bool isEqual(const DebugLocTuple &LHS, const DebugLocTuple &RHS) {
return LHS.CompileUnit == RHS.CompileUnit && return LHS.CompileUnit == RHS.CompileUnit &&
LHS.Scope == RHS.Scope &&
LHS.Line == RHS.Line && LHS.Line == RHS.Line &&
LHS.Col == RHS.Col; LHS.Col == RHS.Col;
} }

View File

@ -57,7 +57,6 @@ protected:
MachineFrameInfo &MFI; MachineFrameInfo &MFI;
MachineConstantPool &MCP; MachineConstantPool &MCP;
DebugLoc DL; DebugLoc DL;
DebugScopeTracker DbgScopeTrack;
const TargetMachine &TM; const TargetMachine &TM;
const TargetData &TD; const TargetData &TD;
const TargetInstrInfo &TII; const TargetInstrInfo &TII;

View File

@ -111,8 +111,6 @@ class MachineFunction : private Annotation {
// Tracks debug locations. // Tracks debug locations.
DebugLocTracker DebugLocInfo; DebugLocTracker DebugLocInfo;
std::vector<DebugScopeInfo> DbgScopeInfos;
public: public:
MachineFunction(const Function *Fn, const TargetMachine &TM); MachineFunction(const Function *Fn, const TargetMachine &TM);
~MachineFunction(); ~MachineFunction();
@ -334,7 +332,7 @@ public:
/// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given /// getOrCreateDebugLocID - Look up the DebugLocTuple index with the given
/// source file, line, and column. If none currently exists, create a new /// source file, line, and column. If none currently exists, create a new
/// DebugLocTuple, and insert it into the DebugIdMap. /// DebugLocTuple, and insert it into the DebugIdMap.
unsigned getOrCreateDebugLocID(GlobalVariable *CompileUnit, DebugScope Scope, unsigned getOrCreateDebugLocID(GlobalVariable *CompileUnit,
unsigned Line, unsigned Col); unsigned Line, unsigned Col);
/// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object. /// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object.
@ -347,12 +345,6 @@ public:
/// setDefaultDebugLoc - Get the default debug location for the machine /// setDefaultDebugLoc - Get the default debug location for the machine
/// function. /// function.
void setDefaultDebugLoc(DebugLoc DL) { DefaultDebugLoc = DL; } void setDefaultDebugLoc(DebugLoc DL) { DefaultDebugLoc = DL; }
/// CreateDebugScope - Create a new debug scope.
DebugScope CreateDebugScope(GlobalVariable *ScopeGV, DebugScope Parent);
/// getDebugScopeInfo - Get the DebugScopeInfo for a given DebugScope object.
const DebugScopeInfo &getDebugScopeInfo(DebugScope DS) const;
}; };
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//

View File

@ -1311,7 +1311,7 @@ void AsmPrinter::PrintSpecial(const MachineInstr *MI, const char *Code) const {
void AsmPrinter::processDebugLoc(DebugLoc DL) { void AsmPrinter::processDebugLoc(DebugLoc DL) {
if (TAI->doesSupportDebugInformation() && DW->ShouldEmitDwarfDebug()) { if (TAI->doesSupportDebugInformation() && DW->ShouldEmitDwarfDebug()) {
if (!DL.isUnknown()) { if (!DL.isUnknown()) {
static DebugLocTuple PrevDLT(0, DebugScope::getInvalid(), ~0U, ~0U); static DebugLocTuple PrevDLT(0, ~0U, ~0U);
DebugLocTuple CurDLT = MF->getDebugLocTuple(DL); DebugLocTuple CurDLT = MF->getDebugLocTuple(DL);
if (CurDLT.CompileUnit != 0 && PrevDLT != CurDLT) if (CurDLT.CompileUnit != 0 && PrevDLT != CurDLT)

View File

@ -1,38 +0,0 @@
//===-- DebugLoc.cpp ------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Implementation for DebugScopeTracker.
//
//===----------------------------------------------------------------------===//
#include "llvm/CodeGen/DebugLoc.h"
#include "llvm/CodeGen/MachineFunction.h"
using namespace llvm;
/// EnterDebugScope - Start a new debug scope. ScopeGV can be a DISubprogram
/// or a DIBlock.
void DebugScopeTracker::EnterDebugScope(GlobalVariable *ScopeGV,
MachineFunction &MF) {
assert(ScopeGV && "GlobalVariable for scope is null!");
CurScope = MF.CreateDebugScope(ScopeGV, CurScope);
}
/// ExitDebugScope - "Pop" a DISubprogram or a DIBlock.
void DebugScopeTracker::ExitDebugScope(GlobalVariable *ScopeGV,
MachineFunction &MF) {
assert(ScopeGV && "GlobalVariable for scope is null!");
assert(!CurScope.isInvalid() && "Mismatched region.end ?");
// We may have skipped a region.end because it was in an unreachable block.
// Go up the scope chain until we reach the scope that ScopeGV points to.
DebugScopeInfo DSI;
do {
DSI = MF.getDebugScopeInfo(CurScope);
CurScope = DSI.Parent;
} while (!DSI.Parent.isInvalid() && DSI.GV != ScopeGV);
}

View File

@ -403,9 +403,8 @@ unsigned MachineFunction::addLiveIn(unsigned PReg,
/// source file, line, and column. If none currently exists, create a new /// source file, line, and column. If none currently exists, create a new
/// DebugLocTuple, and insert it into the DebugIdMap. /// DebugLocTuple, and insert it into the DebugIdMap.
unsigned MachineFunction::getOrCreateDebugLocID(GlobalVariable *CompileUnit, unsigned MachineFunction::getOrCreateDebugLocID(GlobalVariable *CompileUnit,
DebugScope Scope,
unsigned Line, unsigned Col) { unsigned Line, unsigned Col) {
DebugLocTuple Tuple(CompileUnit, Scope, Line, Col); DebugLocTuple Tuple(CompileUnit, Line, Col);
DenseMap<DebugLocTuple, unsigned>::iterator II DenseMap<DebugLocTuple, unsigned>::iterator II
= DebugLocInfo.DebugIdMap.find(Tuple); = DebugLocInfo.DebugIdMap.find(Tuple);
if (II != DebugLocInfo.DebugIdMap.end()) if (II != DebugLocInfo.DebugIdMap.end())
@ -425,21 +424,6 @@ DebugLocTuple MachineFunction::getDebugLocTuple(DebugLoc DL) const {
return DebugLocInfo.DebugLocations[Idx]; 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 // MachineFrameInfo implementation
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//

View File

@ -331,22 +331,17 @@ bool FastISel::SelectCall(User *I) {
DICompileUnit CU(cast<GlobalVariable>(SPI->getContext())); DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
unsigned Line = SPI->getLine(); unsigned Line = SPI->getLine();
unsigned Col = SPI->getColumn(); unsigned Col = SPI->getColumn();
unsigned Idx = MF.getOrCreateDebugLocID(CU.getGV(), unsigned Idx = MF.getOrCreateDebugLocID(CU.getGV(), Line, Col);
DbgScopeTrack.getCurScope(),
Line, Col);
setCurDebugLoc(DebugLoc::get(Idx)); setCurDebugLoc(DebugLoc::get(Idx));
} }
return true; return true;
} }
case Intrinsic::dbg_region_start: { case Intrinsic::dbg_region_start: {
DbgRegionStartInst *RSI = cast<DbgRegionStartInst>(I); DbgRegionStartInst *RSI = cast<DbgRegionStartInst>(I);
if (!DIDescriptor::ValidDebugInfo(RSI->getContext(), CodeGenOpt::None)) if (DIDescriptor::ValidDebugInfo(RSI->getContext(), CodeGenOpt::None) &&
return true; DW && DW->ShouldEmitDwarfDebug()) {
unsigned ID =
GlobalVariable *Rgn = cast<GlobalVariable>(RSI->getContext()); DW->RecordRegionStart(cast<GlobalVariable>(RSI->getContext()));
DbgScopeTrack.EnterDebugScope(Rgn, MF);
if (DW && DW->ShouldEmitDwarfDebug()) {
unsigned ID = DW->RecordRegionStart(Rgn);
const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
BuildMI(MBB, DL, II).addImm(ID); BuildMI(MBB, DL, II).addImm(ID);
} }
@ -354,14 +349,10 @@ bool FastISel::SelectCall(User *I) {
} }
case Intrinsic::dbg_region_end: { case Intrinsic::dbg_region_end: {
DbgRegionEndInst *REI = cast<DbgRegionEndInst>(I); DbgRegionEndInst *REI = cast<DbgRegionEndInst>(I);
if (!DIDescriptor::ValidDebugInfo(REI->getContext(), CodeGenOpt::None)) if (DIDescriptor::ValidDebugInfo(REI->getContext(), CodeGenOpt::None) &&
return true; DW && DW->ShouldEmitDwarfDebug()) {
GlobalVariable *Rgn = cast<GlobalVariable>(REI->getContext());
DbgScopeTrack.ExitDebugScope(Rgn, MF);
if (DW && DW->ShouldEmitDwarfDebug()) {
unsigned ID = 0; unsigned ID = 0;
DISubprogram Subprogram(Rgn); DISubprogram Subprogram(cast<GlobalVariable>(REI->getContext()));
if (!Subprogram.isNull() && !Subprogram.describes(MF.getFunction())) { if (!Subprogram.isNull() && !Subprogram.describes(MF.getFunction())) {
// This is end of an inlined function. // This is end of an inlined function.
const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL); const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
@ -391,7 +382,6 @@ bool FastISel::SelectCall(User *I) {
DebugLoc PrevLoc = DL; DebugLoc PrevLoc = DL;
DISubprogram Subprogram(cast<GlobalVariable>(SP)); DISubprogram Subprogram(cast<GlobalVariable>(SP));
DICompileUnit CompileUnit = Subprogram.getCompileUnit(); DICompileUnit CompileUnit = Subprogram.getCompileUnit();
DbgScopeTrack.EnterDebugScope(Subprogram.getGV(), MF);
if (!Subprogram.describes(MF.getFunction())) { if (!Subprogram.describes(MF.getFunction())) {
// This is a beginning of an inlined function. // This is a beginning of an inlined function.
@ -403,10 +393,8 @@ bool FastISel::SelectCall(User *I) {
return true; return true;
// Record the source line. // Record the source line.
unsigned Line = Subprogram.getLineNumber(); unsigned Line = Subprogram.getLineNumber();
setCurDebugLoc( setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(
DebugLoc::get(MF.getOrCreateDebugLocID(CompileUnit.getGV(), CompileUnit.getGV(), Line, 0)));
DbgScopeTrack.getCurScope(),
Line, 0)));
if (DW && DW->ShouldEmitDwarfDebug()) { if (DW && DW->ShouldEmitDwarfDebug()) {
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
@ -420,10 +408,8 @@ bool FastISel::SelectCall(User *I) {
} else { } else {
// Record the source line. // Record the source line.
unsigned Line = Subprogram.getLineNumber(); unsigned Line = Subprogram.getLineNumber();
MF.setDefaultDebugLoc( MF.setDefaultDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(
DebugLoc::get(MF.getOrCreateDebugLocID(CompileUnit.getGV(), CompileUnit.getGV(), Line, 0)));
DbgScopeTrack.getCurScope(),
Line, 0)));
if (DW && DW->ShouldEmitDwarfDebug()) { if (DW && DW->ShouldEmitDwarfDebug()) {
// llvm.dbg.func_start also defines beginning of function scope. // llvm.dbg.func_start also defines beginning of function scope.
DW->RecordRegionStart(cast<GlobalVariable>(FSI->getSubprogram())); DW->RecordRegionStart(cast<GlobalVariable>(FSI->getSubprogram()));

View File

@ -312,17 +312,6 @@ void FunctionLoweringInfo::set(Function &fn, MachineFunction &mf,
!StaticAllocaMap.count(cast<AllocaInst>(I))) !StaticAllocaMap.count(cast<AllocaInst>(I)))
InitializeRegForValue(I); InitializeRegForValue(I);
// FIXME: PHI instructions currently get an invalid scope. This is because
// tracking of debug scopes is done through a simple mechanism where
// "entering" a scope implies that the scope is entered for the first time.
// If we keep track of debug scopes for the following loop, the PHI
// instructions would get scopes that will not be used again later by the
// instruction selectors.
// Either provide a mechanism to re-enter a previously created scope or wait
// for when the DebugLoc is retrieved from Instruction, in which case the
// current debug scope tracking mechanism will be obsolete.
DebugScope DbgScope;
// Create an initial MachineBasicBlock for each LLVM BasicBlock in F. This // Create an initial MachineBasicBlock for each LLVM BasicBlock in F. This
// also creates the initial PHI MachineInstrs, though none of the input // also creates the initial PHI MachineInstrs, though none of the input
// operands are populated. // operands are populated.
@ -348,7 +337,6 @@ void FunctionLoweringInfo::set(Function &fn, MachineFunction &mf,
CodeGenOpt::Default)) { CodeGenOpt::Default)) {
DICompileUnit CU(cast<GlobalVariable>(SPI->getContext())); DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
unsigned idx = MF->getOrCreateDebugLocID(CU.getGV(), unsigned idx = MF->getOrCreateDebugLocID(CU.getGV(),
DbgScope,
SPI->getLine(), SPI->getLine(),
SPI->getColumn()); SPI->getColumn());
DL = DebugLoc::get(idx); DL = DebugLoc::get(idx);
@ -364,7 +352,7 @@ void FunctionLoweringInfo::set(Function &fn, MachineFunction &mf,
DISubprogram Subprogram(cast<GlobalVariable>(SP)); DISubprogram Subprogram(cast<GlobalVariable>(SP));
DICompileUnit CU(Subprogram.getCompileUnit()); DICompileUnit CU(Subprogram.getCompileUnit());
unsigned Line = Subprogram.getLineNumber(); unsigned Line = Subprogram.getLineNumber();
DL = DebugLoc::get(MF->getOrCreateDebugLocID(CU.getGV(), DbgScope, DL = DebugLoc::get(MF->getOrCreateDebugLocID(CU.getGV(),
Line, 0)); Line, 0));
} }
@ -3921,9 +3909,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
MachineFunction &MF = DAG.getMachineFunction(); MachineFunction &MF = DAG.getMachineFunction();
DICompileUnit CU(cast<GlobalVariable>(SPI.getContext())); DICompileUnit CU(cast<GlobalVariable>(SPI.getContext()));
DebugLoc Loc = DebugLoc::get(MF.getOrCreateDebugLocID(CU.getGV(), DebugLoc Loc = DebugLoc::get(MF.getOrCreateDebugLocID(CU.getGV(),
DbgScopeTrack.getCurScope(), SPI.getLine(), SPI.getColumn()));
SPI.getLine(),
SPI.getColumn()));
setCurDebugLoc(Loc); setCurDebugLoc(Loc);
if (OptLevel == CodeGenOpt::None) if (OptLevel == CodeGenOpt::None)
@ -3937,14 +3923,11 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
case Intrinsic::dbg_region_start: { case Intrinsic::dbg_region_start: {
DwarfWriter *DW = DAG.getDwarfWriter(); DwarfWriter *DW = DAG.getDwarfWriter();
DbgRegionStartInst &RSI = cast<DbgRegionStartInst>(I); DbgRegionStartInst &RSI = cast<DbgRegionStartInst>(I);
if (!DIDescriptor::ValidDebugInfo(RSI.getContext(), OptLevel))
return 0;
MachineFunction &MF = DAG.getMachineFunction(); if (DIDescriptor::ValidDebugInfo(RSI.getContext(), OptLevel) &&
GlobalVariable *Rgn = cast<GlobalVariable>(RSI.getContext()); DW && DW->ShouldEmitDwarfDebug()) {
DbgScopeTrack.EnterDebugScope(Rgn, MF); unsigned LabelID =
if (DW && DW->ShouldEmitDwarfDebug()) { DW->RecordRegionStart(cast<GlobalVariable>(RSI.getContext()));
unsigned LabelID = DW->RecordRegionStart(Rgn);
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(), DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
getRoot(), LabelID)); getRoot(), LabelID));
} }
@ -3954,14 +3937,11 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
case Intrinsic::dbg_region_end: { case Intrinsic::dbg_region_end: {
DwarfWriter *DW = DAG.getDwarfWriter(); DwarfWriter *DW = DAG.getDwarfWriter();
DbgRegionEndInst &REI = cast<DbgRegionEndInst>(I); DbgRegionEndInst &REI = cast<DbgRegionEndInst>(I);
if (!DIDescriptor::ValidDebugInfo(REI.getContext(), OptLevel))
return 0;
MachineFunction &MF = DAG.getMachineFunction(); if (DIDescriptor::ValidDebugInfo(REI.getContext(), OptLevel) &&
GlobalVariable *Rgn = cast<GlobalVariable>(REI.getContext()); DW && DW->ShouldEmitDwarfDebug()) {
DbgScopeTrack.ExitDebugScope(Rgn, MF); MachineFunction &MF = DAG.getMachineFunction();
if (DW && DW->ShouldEmitDwarfDebug()) { DISubprogram Subprogram(cast<GlobalVariable>(REI.getContext()));
DISubprogram Subprogram(Rgn);
if (Subprogram.isNull() || Subprogram.describes(MF.getFunction())) { if (Subprogram.isNull() || Subprogram.describes(MF.getFunction())) {
unsigned LabelID = unsigned LabelID =
@ -3994,7 +3974,6 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
return 0; return 0;
MachineFunction &MF = DAG.getMachineFunction(); MachineFunction &MF = DAG.getMachineFunction();
DbgScopeTrack.EnterDebugScope(cast<GlobalVariable>(SP), MF);
if (OptLevel == CodeGenOpt::None) { if (OptLevel == CodeGenOpt::None) {
// llvm.dbg.func.start implicitly defines a dbg_stoppoint which is what // llvm.dbg.func.start implicitly defines a dbg_stoppoint which is what
// (most?) gdb expects. // (most?) gdb expects.
@ -4014,9 +3993,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
// Record the source line. // Record the source line.
unsigned Line = Subprogram.getLineNumber(); unsigned Line = Subprogram.getLineNumber();
setCurDebugLoc(DebugLoc::get( setCurDebugLoc(DebugLoc::get(
MF.getOrCreateDebugLocID(CompileUnit.getGV(), MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0)));
DbgScopeTrack.getCurScope(),
Line, 0)));
if (DW && DW->ShouldEmitDwarfDebug()) { if (DW && DW->ShouldEmitDwarfDebug()) {
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc); DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
@ -4031,9 +4008,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
// Record the source line. // Record the source line.
unsigned Line = Subprogram.getLineNumber(); unsigned Line = Subprogram.getLineNumber();
MF.setDefaultDebugLoc(DebugLoc::get( MF.setDefaultDebugLoc(DebugLoc::get(
MF.getOrCreateDebugLocID(CompileUnit.getGV(), MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0)));
DbgScopeTrack.getCurScope(),
Line, 0)));
if (DW && DW->ShouldEmitDwarfDebug()) { if (DW && DW->ShouldEmitDwarfDebug()) {
// llvm.dbg.func_start also defines beginning of function scope. // llvm.dbg.func_start also defines beginning of function scope.
DW->RecordRegionStart(cast<GlobalVariable>(FSI.getSubprogram())); DW->RecordRegionStart(cast<GlobalVariable>(FSI.getSubprogram()));
@ -4060,9 +4035,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
// create a label if this is a beginning of inlined function. // create a label if this is a beginning of inlined function.
unsigned Line = Subprogram.getLineNumber(); unsigned Line = Subprogram.getLineNumber();
setCurDebugLoc(DebugLoc::get( setCurDebugLoc(DebugLoc::get(
MF.getOrCreateDebugLocID(CompileUnit.getGV(), MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0)));
DbgScopeTrack.getCurScope(),
Line, 0)));
// FIXME - Start new region because llvm.dbg.func_start also defines // FIXME - Start new region because llvm.dbg.func_start also defines
// beginning of function scope. // beginning of function scope.
} }

View File

@ -169,8 +169,6 @@ class SelectionDAGLowering {
/// CurDebugLoc - current file + line number. Changes as we build the DAG. /// CurDebugLoc - current file + line number. Changes as we build the DAG.
DebugLoc CurDebugLoc; DebugLoc CurDebugLoc;
DebugScopeTracker DbgScopeTrack;
DenseMap<const Value*, SDValue> NodeMap; DenseMap<const Value*, SDValue> NodeMap;
/// PendingLoads - Loads are not emitted to the program immediately. We bunch /// PendingLoads - Loads are not emitted to the program immediately. We bunch