mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 15:39:06 +00:00
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
This commit is contained in:
parent
19fee415f6
commit
a26eae64dd
@ -19,17 +19,20 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
class GlobalVariable;
|
||||||
|
|
||||||
/// DebugLocTuple - Debug location tuple of filename id, line and column.
|
/// DebugLocTuple - Debug location tuple of filename id, line and column.
|
||||||
///
|
///
|
||||||
struct DebugLocTuple {
|
struct DebugLocTuple {
|
||||||
unsigned Src, Line, Col;
|
GlobalVariable *CompileUnit;
|
||||||
|
unsigned Line, Col;
|
||||||
|
|
||||||
DebugLocTuple(unsigned s, unsigned l, unsigned c)
|
DebugLocTuple(GlobalVariable *v, unsigned l, unsigned c)
|
||||||
: Src(s), Line(l), Col(c) {};
|
: CompileUnit(v), Line(l), Col(c) {};
|
||||||
|
|
||||||
bool operator==(const DebugLocTuple &DLT) const {
|
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 {
|
bool operator!=(const DebugLocTuple &DLT) const {
|
||||||
return !(*this == DLT);
|
return !(*this == DLT);
|
||||||
@ -60,20 +63,20 @@ 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(~0U, ~0U, ~0U);
|
return DebugLocTuple(0, ~0U, ~0U);
|
||||||
}
|
}
|
||||||
static inline DebugLocTuple getTombstoneKey() {
|
static inline DebugLocTuple getTombstoneKey() {
|
||||||
return DebugLocTuple(~1U, ~1U, ~1U);
|
return DebugLocTuple((GlobalVariable*)~1U, ~1U, ~1U);
|
||||||
}
|
}
|
||||||
static unsigned getHashValue(const DebugLocTuple &Val) {
|
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.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.Src == RHS.Src &&
|
return LHS.CompileUnit == RHS.CompileUnit &&
|
||||||
LHS.Line == RHS.Line &&
|
LHS.Line == RHS.Line &&
|
||||||
LHS.Col == RHS.Col;
|
LHS.Col == RHS.Col;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isPod() { return true; }
|
static bool isPod() { return true; }
|
||||||
|
@ -37,6 +37,7 @@ class GlobalVariable;
|
|||||||
class TargetAsmInfo;
|
class TargetAsmInfo;
|
||||||
class raw_ostream;
|
class raw_ostream;
|
||||||
class Instruction;
|
class Instruction;
|
||||||
|
class DICompileUnit;
|
||||||
class DISubprogram;
|
class DISubprogram;
|
||||||
class DIVariable;
|
class DIVariable;
|
||||||
|
|
||||||
@ -87,14 +88,7 @@ public:
|
|||||||
/// RecordSourceLine - Register a source line with debug info. Returns a
|
/// RecordSourceLine - Register a source line with debug info. Returns a
|
||||||
/// unique label ID used to generate a label and provide correspondence to
|
/// unique label ID used to generate a label and provide correspondence to
|
||||||
/// the source line list.
|
/// the source line list.
|
||||||
unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src);
|
unsigned RecordSourceLine(unsigned Line, unsigned Col, DICompileUnit CU);
|
||||||
|
|
||||||
/// 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);
|
|
||||||
|
|
||||||
/// RecordRegionStart - Indicate the start of a region.
|
/// RecordRegionStart - Indicate the start of a region.
|
||||||
unsigned RecordRegionStart(GlobalVariable *V);
|
unsigned RecordRegionStart(GlobalVariable *V);
|
||||||
@ -116,7 +110,7 @@ public:
|
|||||||
|
|
||||||
//// RecordInlinedFnStart - Indicate the start of a inlined function.
|
//// RecordInlinedFnStart - Indicate the start of a inlined function.
|
||||||
void RecordInlinedFnStart(Instruction *I, DISubprogram &SP, unsigned LabelID,
|
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.
|
/// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
|
||||||
unsigned RecordInlinedFnEnd(DISubprogram &SP);
|
unsigned RecordInlinedFnEnd(DISubprogram &SP);
|
||||||
|
@ -332,7 +332,8 @@ 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(unsigned Src, unsigned Line, unsigned Col);
|
unsigned getOrCreateDebugLocID(GlobalVariable *CompileUnit,
|
||||||
|
unsigned Line, unsigned Col);
|
||||||
|
|
||||||
/// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object.
|
/// getDebugLocTuple - Get the DebugLocTuple for a given DebugLoc object.
|
||||||
DebugLocTuple getDebugLocTuple(DebugLoc DL) const;
|
DebugLocTuple getDebugLocTuple(DebugLoc DL) const;
|
||||||
|
@ -1103,7 +1103,7 @@ class SrcLineInfo {
|
|||||||
public:
|
public:
|
||||||
SrcLineInfo(unsigned L, unsigned C, unsigned S, unsigned I)
|
SrcLineInfo(unsigned L, unsigned C, unsigned S, unsigned I)
|
||||||
: Line(L), Column(C), SourceID(S), LabelID(I) {}
|
: Line(L), Column(C), SourceID(S), LabelID(I) {}
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
unsigned getLine() const { return Line; }
|
unsigned getLine() const { return Line; }
|
||||||
unsigned getColumn() const { return Column; }
|
unsigned getColumn() const { return Column; }
|
||||||
@ -3426,10 +3426,13 @@ public:
|
|||||||
/// RecordSourceLine - Records location information and associates it with a
|
/// RecordSourceLine - Records location information and associates it with a
|
||||||
/// label. Returns a unique label ID used to generate a label and provide
|
/// label. Returns a unique label ID used to generate a label and provide
|
||||||
/// correspondence to the source line list.
|
/// correspondence to the source line list.
|
||||||
unsigned RecordSourceLine(unsigned Line, unsigned Col, unsigned Src) {
|
unsigned RecordSourceLine(unsigned Line, unsigned Col, DICompileUnit CU) {
|
||||||
if (TimePassesIsEnabled)
|
if (TimePassesIsEnabled)
|
||||||
DebugTimer->startTimer();
|
DebugTimer->startTimer();
|
||||||
|
|
||||||
|
std::string Dir, Fn;
|
||||||
|
unsigned Src = GetOrCreateSourceID(CU.getDirectory(Dir),
|
||||||
|
CU.getFilename(Fn));
|
||||||
unsigned ID = MMI->NextLabelID();
|
unsigned ID = MMI->NextLabelID();
|
||||||
Lines.push_back(SrcLineInfo(Line, Col, Src, ID));
|
Lines.push_back(SrcLineInfo(Line, Col, Src, ID));
|
||||||
|
|
||||||
@ -3529,10 +3532,13 @@ public:
|
|||||||
|
|
||||||
//// RecordInlinedFnStart - Indicate the start of inlined subroutine.
|
//// RecordInlinedFnStart - Indicate the start of inlined subroutine.
|
||||||
void RecordInlinedFnStart(Instruction *FSI, DISubprogram &SP, unsigned LabelID,
|
void RecordInlinedFnStart(Instruction *FSI, DISubprogram &SP, unsigned LabelID,
|
||||||
unsigned Src, unsigned Line, unsigned Col) {
|
DICompileUnit CU, unsigned Line, unsigned Col) {
|
||||||
if (!TAI->doesDwarfUsesInlineInfoSection())
|
if (!TAI->doesDwarfUsesInlineInfoSection())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
std::string Dir, Fn;
|
||||||
|
unsigned Src = GetOrCreateSourceID(CU.getDirectory(Dir),
|
||||||
|
CU.getFilename(Fn));
|
||||||
DbgScope *Scope = createInlinedSubroutineScope(SP, Src, Line, Col);
|
DbgScope *Scope = createInlinedSubroutineScope(SP, Src, Line, Col);
|
||||||
Scope->setStartLabelID(LabelID);
|
Scope->setStartLabelID(LabelID);
|
||||||
MMI->RecordUsedDbgLabel(LabelID);
|
MMI->RecordUsedDbgLabel(LabelID);
|
||||||
@ -4739,17 +4745,8 @@ bool DwarfWriter::ValidDebugInfo(Value *V, CodeGenOpt::Level OptLevel) {
|
|||||||
/// label. Returns a unique label ID used to generate a label and provide
|
/// label. Returns a unique label ID used to generate a label and provide
|
||||||
/// correspondence to the source line list.
|
/// correspondence to the source line list.
|
||||||
unsigned DwarfWriter::RecordSourceLine(unsigned Line, unsigned Col,
|
unsigned DwarfWriter::RecordSourceLine(unsigned Line, unsigned Col,
|
||||||
unsigned Src) {
|
DICompileUnit CU) {
|
||||||
return DD->RecordSourceLine(Line, Col, Src);
|
return DD->RecordSourceLine(Line, Col, CU);
|
||||||
}
|
|
||||||
|
|
||||||
/// 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 DirectoryNames and SourceFileNames maps
|
|
||||||
/// as well.
|
|
||||||
unsigned DwarfWriter::getOrCreateSourceID(const std::string &DirName,
|
|
||||||
const std::string &FileName) {
|
|
||||||
return DD->getOrCreateSourceID(DirName, FileName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RecordRegionStart - Indicate the start of a region.
|
/// RecordRegionStart - Indicate the start of a region.
|
||||||
@ -4783,9 +4780,9 @@ bool DwarfWriter::ShouldEmitDwarfDebug() const {
|
|||||||
//// RecordInlinedFnStart - Global variable GV is inlined at the location marked
|
//// RecordInlinedFnStart - Global variable GV is inlined at the location marked
|
||||||
//// by LabelID label.
|
//// by LabelID label.
|
||||||
void DwarfWriter::RecordInlinedFnStart(Instruction *I, DISubprogram &SP,
|
void DwarfWriter::RecordInlinedFnStart(Instruction *I, DISubprogram &SP,
|
||||||
unsigned LabelID, unsigned Src,
|
unsigned LabelID, DICompileUnit CU,
|
||||||
unsigned Line, unsigned Col) {
|
unsigned Line, unsigned Col) {
|
||||||
DD->RecordInlinedFnStart(I, SP, LabelID, Src, Line, Col);
|
DD->RecordInlinedFnStart(I, SP, LabelID, CU, Line, Col);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
|
/// RecordInlinedFnEnd - Indicate the end of inlined subroutine.
|
||||||
|
@ -398,9 +398,9 @@ unsigned MachineFunction::addLiveIn(unsigned PReg,
|
|||||||
/// 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 MachineFunction::getOrCreateDebugLocID(unsigned Src, unsigned Line,
|
unsigned MachineFunction::getOrCreateDebugLocID(GlobalVariable *CompileUnit,
|
||||||
unsigned Col) {
|
unsigned Line, unsigned Col) {
|
||||||
DebugLocTuple Tuple(Src, 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())
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "llvm/Target/TargetInstrInfo.h"
|
#include "llvm/Target/TargetInstrInfo.h"
|
||||||
#include "llvm/Target/TargetInstrDesc.h"
|
#include "llvm/Target/TargetInstrDesc.h"
|
||||||
#include "llvm/Target/TargetRegisterInfo.h"
|
#include "llvm/Target/TargetRegisterInfo.h"
|
||||||
|
#include "llvm/Analysis/DebugInfo.h"
|
||||||
#include "llvm/Support/LeakDetector.h"
|
#include "llvm/Support/LeakDetector.h"
|
||||||
#include "llvm/Support/MathExtras.h"
|
#include "llvm/Support/MathExtras.h"
|
||||||
#include "llvm/Support/Streams.h"
|
#include "llvm/Support/Streams.h"
|
||||||
@ -979,8 +980,10 @@ void MachineInstr::print(raw_ostream &OS, const TargetMachine *TM) const {
|
|||||||
if (!debugLoc.isUnknown()) {
|
if (!debugLoc.isUnknown()) {
|
||||||
const MachineFunction *MF = getParent()->getParent();
|
const MachineFunction *MF = getParent()->getParent();
|
||||||
DebugLocTuple DLT = MF->getDebugLocTuple(debugLoc);
|
DebugLocTuple DLT = MF->getDebugLocTuple(debugLoc);
|
||||||
|
DICompileUnit CU(DLT.CompileUnit);
|
||||||
|
std::string Dir, Fn;
|
||||||
OS << " [dbg: "
|
OS << " [dbg: "
|
||||||
<< DLT.Src << ","
|
<< CU.getDirectory(Dir) << '/' << CU.getFilename(Fn) << ","
|
||||||
<< DLT.Line << ","
|
<< DLT.Line << ","
|
||||||
<< DLT.Col << "]";
|
<< DLT.Col << "]";
|
||||||
}
|
}
|
||||||
|
@ -329,13 +329,10 @@ bool FastISel::SelectCall(User *I) {
|
|||||||
DbgStopPointInst *SPI = cast<DbgStopPointInst>(I);
|
DbgStopPointInst *SPI = cast<DbgStopPointInst>(I);
|
||||||
if (DW && DW->ValidDebugInfo(SPI->getContext(), CodeGenOpt::None)) {
|
if (DW && DW->ValidDebugInfo(SPI->getContext(), CodeGenOpt::None)) {
|
||||||
DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
|
DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
|
||||||
std::string Dir, FN;
|
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
|
|
||||||
CU.getFilename(FN));
|
|
||||||
unsigned Line = SPI->getLine();
|
unsigned Line = SPI->getLine();
|
||||||
unsigned Col = SPI->getColumn();
|
unsigned Col = SPI->getColumn();
|
||||||
unsigned ID = DW->RecordSourceLine(Line, Col, SrcFile);
|
unsigned ID = DW->RecordSourceLine(Line, Col, CU);
|
||||||
unsigned Idx = MF.getOrCreateDebugLocID(SrcFile, Line, Col);
|
unsigned Idx = MF.getOrCreateDebugLocID(CU.getGV(), Line, Col);
|
||||||
setCurDebugLoc(DebugLoc::get(Idx));
|
setCurDebugLoc(DebugLoc::get(Idx));
|
||||||
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);
|
||||||
@ -386,9 +383,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();
|
||||||
std::string Dir, FN;
|
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(Dir),
|
|
||||||
CompileUnit.getFilename(FN));
|
|
||||||
|
|
||||||
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.
|
||||||
@ -400,21 +394,23 @@ 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();
|
||||||
unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile);
|
unsigned LabelID = DW->RecordSourceLine(Line, 0, CompileUnit);
|
||||||
setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0)));
|
setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(
|
||||||
|
CompileUnit.getGV(), Line, 0)));
|
||||||
|
|
||||||
const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
|
const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
|
||||||
BuildMI(MBB, DL, II).addImm(LabelID);
|
BuildMI(MBB, DL, II).addImm(LabelID);
|
||||||
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
|
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
|
||||||
DW->RecordInlinedFnStart(FSI, Subprogram, LabelID,
|
DW->RecordInlinedFnStart(FSI, Subprogram, LabelID,
|
||||||
PrevLocTpl.Src,
|
DICompileUnit(PrevLocTpl.CompileUnit),
|
||||||
PrevLocTpl.Line,
|
PrevLocTpl.Line,
|
||||||
PrevLocTpl.Col);
|
PrevLocTpl.Col);
|
||||||
} else {
|
} else {
|
||||||
// Record the source line.
|
// Record the source line.
|
||||||
unsigned Line = Subprogram.getLineNumber();
|
unsigned Line = Subprogram.getLineNumber();
|
||||||
setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0)));
|
setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(
|
||||||
DW->RecordSourceLine(Line, 0, SrcFile);
|
CompileUnit.getGV(), Line, 0)));
|
||||||
|
DW->RecordSourceLine(Line, 0, CompileUnit);
|
||||||
// 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()));
|
||||||
}
|
}
|
||||||
|
@ -1269,9 +1269,6 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
|
|||||||
GlobalVariable *CU_GV = cast<GlobalVariable>(DSP->getCompileUnit());
|
GlobalVariable *CU_GV = cast<GlobalVariable>(DSP->getCompileUnit());
|
||||||
if (DW && (useDEBUG_LOC || useLABEL) && !CU_GV->isDeclaration()) {
|
if (DW && (useDEBUG_LOC || useLABEL) && !CU_GV->isDeclaration()) {
|
||||||
DICompileUnit CU(cast<GlobalVariable>(DSP->getCompileUnit()));
|
DICompileUnit CU(cast<GlobalVariable>(DSP->getCompileUnit()));
|
||||||
std::string Dir, FN;
|
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
|
|
||||||
CU.getFilename(FN));
|
|
||||||
|
|
||||||
unsigned Line = DSP->getLine();
|
unsigned Line = DSP->getLine();
|
||||||
unsigned Col = DSP->getColumn();
|
unsigned Col = DSP->getColumn();
|
||||||
@ -1282,10 +1279,10 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
|
|||||||
if (useDEBUG_LOC) {
|
if (useDEBUG_LOC) {
|
||||||
SDValue Ops[] = { Tmp1, DAG.getConstant(Line, MVT::i32),
|
SDValue Ops[] = { Tmp1, DAG.getConstant(Line, MVT::i32),
|
||||||
DAG.getConstant(Col, MVT::i32),
|
DAG.getConstant(Col, MVT::i32),
|
||||||
DAG.getConstant(SrcFile, MVT::i32) };
|
DAG.getSrcValue(CU.getGV()) };
|
||||||
Result = DAG.getNode(ISD::DEBUG_LOC, dl, MVT::Other, Ops, 4);
|
Result = DAG.getNode(ISD::DEBUG_LOC, dl, MVT::Other, Ops, 4);
|
||||||
} else {
|
} else {
|
||||||
unsigned ID = DW->RecordSourceLine(Line, Col, SrcFile);
|
unsigned ID = DW->RecordSourceLine(Line, Col, CU);
|
||||||
Result = DAG.getLabel(ISD::DBG_LABEL, dl, Tmp1, ID);
|
Result = DAG.getLabel(ISD::DBG_LABEL, dl, Tmp1, ID);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -337,10 +337,7 @@ void FunctionLoweringInfo::set(Function &fn, MachineFunction &mf,
|
|||||||
if (DW && DW->ValidDebugInfo(SPI->getContext(),
|
if (DW && DW->ValidDebugInfo(SPI->getContext(),
|
||||||
CodeGenOpt::Default)) {
|
CodeGenOpt::Default)) {
|
||||||
DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
|
DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
|
||||||
std::string Dir, FN;
|
unsigned idx = MF->getOrCreateDebugLocID(CU.getGV(),
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
|
|
||||||
CU.getFilename(FN));
|
|
||||||
unsigned idx = MF->getOrCreateDebugLocID(SrcFile,
|
|
||||||
SPI->getLine(),
|
SPI->getLine(),
|
||||||
SPI->getColumn());
|
SPI->getColumn());
|
||||||
DL = DebugLoc::get(idx);
|
DL = DebugLoc::get(idx);
|
||||||
@ -357,11 +354,9 @@ void FunctionLoweringInfo::set(Function &fn, MachineFunction &mf,
|
|||||||
if (DW->ValidDebugInfo(SP, CodeGenOpt::Default)) {
|
if (DW->ValidDebugInfo(SP, CodeGenOpt::Default)) {
|
||||||
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
||||||
DICompileUnit CU(Subprogram.getCompileUnit());
|
DICompileUnit CU(Subprogram.getCompileUnit());
|
||||||
std::string Dir, FN;
|
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
|
|
||||||
CU.getFilename(FN));
|
|
||||||
unsigned Line = Subprogram.getLineNumber();
|
unsigned Line = Subprogram.getLineNumber();
|
||||||
DL = DebugLoc::get(MF->getOrCreateDebugLocID(SrcFile, Line, 0));
|
DL = DebugLoc::get(MF->getOrCreateDebugLocID(CU.getGV(),
|
||||||
|
Line, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3905,10 +3900,7 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
SPI.getColumn(),
|
SPI.getColumn(),
|
||||||
SPI.getContext()));
|
SPI.getContext()));
|
||||||
DICompileUnit CU(cast<GlobalVariable>(SPI.getContext()));
|
DICompileUnit CU(cast<GlobalVariable>(SPI.getContext()));
|
||||||
std::string Dir, FN;
|
unsigned idx = MF.getOrCreateDebugLocID(CU.getGV(),
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(Dir),
|
|
||||||
CU.getFilename(FN));
|
|
||||||
unsigned idx = MF.getOrCreateDebugLocID(SrcFile,
|
|
||||||
SPI.getLine(), SPI.getColumn());
|
SPI.getLine(), SPI.getColumn());
|
||||||
setCurDebugLoc(DebugLoc::get(idx));
|
setCurDebugLoc(DebugLoc::get(idx));
|
||||||
}
|
}
|
||||||
@ -3974,9 +3966,6 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
DebugLoc PrevLoc = CurDebugLoc;
|
DebugLoc PrevLoc = CurDebugLoc;
|
||||||
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
||||||
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
|
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
|
||||||
std::string Dir, FN;
|
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(Dir),
|
|
||||||
CompileUnit.getFilename(FN));
|
|
||||||
|
|
||||||
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.
|
||||||
@ -3989,21 +3978,23 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
|
|
||||||
// Record the source line.
|
// Record the source line.
|
||||||
unsigned Line = Subprogram.getLineNumber();
|
unsigned Line = Subprogram.getLineNumber();
|
||||||
unsigned LabelID = DW->RecordSourceLine(Line, 0, SrcFile);
|
unsigned LabelID = DW->RecordSourceLine(Line, 0, CompileUnit);
|
||||||
setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0)));
|
setCurDebugLoc(DebugLoc::get(
|
||||||
|
MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0)));
|
||||||
|
|
||||||
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
||||||
getRoot(), LabelID));
|
getRoot(), LabelID));
|
||||||
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
|
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
|
||||||
DW->RecordInlinedFnStart(&FSI, Subprogram, LabelID,
|
DW->RecordInlinedFnStart(&FSI, Subprogram, LabelID,
|
||||||
PrevLocTpl.Src,
|
DICompileUnit(PrevLocTpl.CompileUnit),
|
||||||
PrevLocTpl.Line,
|
PrevLocTpl.Line,
|
||||||
PrevLocTpl.Col);
|
PrevLocTpl.Col);
|
||||||
} else {
|
} else {
|
||||||
// Record the source line.
|
// Record the source line.
|
||||||
unsigned Line = Subprogram.getLineNumber();
|
unsigned Line = Subprogram.getLineNumber();
|
||||||
setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0)));
|
setCurDebugLoc(DebugLoc::get(
|
||||||
DW->RecordSourceLine(Line, 0, SrcFile);
|
MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0)));
|
||||||
|
DW->RecordSourceLine(Line, 0, CompileUnit);
|
||||||
// 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()));
|
||||||
}
|
}
|
||||||
@ -4022,15 +4013,13 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
// llvm.dbg.func.start implicitly defines a dbg_stoppoint which is
|
// llvm.dbg.func.start implicitly defines a dbg_stoppoint which is
|
||||||
// what (most?) gdb expects.
|
// what (most?) gdb expects.
|
||||||
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
|
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
|
||||||
std::string Dir, FN;
|
|
||||||
unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(Dir),
|
|
||||||
CompileUnit.getFilename(FN));
|
|
||||||
|
|
||||||
// Record the source line but does not create a label for the normal
|
// Record the source line but does not create a label for the normal
|
||||||
// function start. It will be emitted at asm emission time. However,
|
// function start. It will be emitted at asm emission time. However,
|
||||||
// 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(MF.getOrCreateDebugLocID(SrcFile, Line, 0)));
|
setCurDebugLoc(DebugLoc::get(
|
||||||
|
MF.getOrCreateDebugLocID(CompileUnit.getGV(), 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.
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/CodeGen/DwarfWriter.h"
|
#include "llvm/CodeGen/DwarfWriter.h"
|
||||||
#include "llvm/CodeGen/MachineJumpTableInfo.h"
|
#include "llvm/CodeGen/MachineJumpTableInfo.h"
|
||||||
|
#include "llvm/Analysis/DebugInfo.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/Support/raw_ostream.h"
|
#include "llvm/Support/raw_ostream.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/Assembly/Writer.h"
|
#include "llvm/Assembly/Writer.h"
|
||||||
#include "llvm/CodeGen/DwarfWriter.h"
|
#include "llvm/CodeGen/DwarfWriter.h"
|
||||||
|
#include "llvm/Analysis/DebugInfo.h"
|
||||||
#include "llvm/Support/Mangler.h"
|
#include "llvm/Support/Mangler.h"
|
||||||
#include "llvm/Target/TargetAsmInfo.h"
|
#include "llvm/Target/TargetAsmInfo.h"
|
||||||
#include "llvm/Target/TargetOptions.h"
|
#include "llvm/Target/TargetOptions.h"
|
||||||
|
@ -653,11 +653,11 @@ void AsmWriterEmitter::run(std::ostream &O) {
|
|||||||
<< " DW->ShouldEmitDwarfDebug() && OptLevel != CodeGenOpt::None) {\n"
|
<< " DW->ShouldEmitDwarfDebug() && OptLevel != CodeGenOpt::None) {\n"
|
||||||
<< " DebugLoc CurDL = MI->getDebugLoc();\n\n"
|
<< " DebugLoc CurDL = MI->getDebugLoc();\n\n"
|
||||||
<< " if (!CurDL.isUnknown()) {\n"
|
<< " if (!CurDL.isUnknown()) {\n"
|
||||||
<< " static DebugLocTuple PrevDLT(~0U, ~0U, ~0U);\n"
|
<< " static DebugLocTuple PrevDLT(0, ~0U, ~0U);\n"
|
||||||
<< " DebugLocTuple CurDLT = MF->getDebugLocTuple(CurDL);\n\n"
|
<< " DebugLocTuple CurDLT = MF->getDebugLocTuple(CurDL);\n\n"
|
||||||
<< " if (PrevDLT.Src != ~0U && PrevDLT != CurDLT)\n"
|
<< " if (PrevDLT.CompileUnit != 0 && PrevDLT != CurDLT)\n"
|
||||||
<< " printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,\n"
|
<< " printLabel(DW->RecordSourceLine(CurDLT.Line, CurDLT.Col,\n"
|
||||||
<< " CurDLT.Src));\n\n"
|
<< " DICompileUnit(CurDLT.CompileUnit)));\n\n"
|
||||||
<< " PrevDLT = CurDLT;\n"
|
<< " PrevDLT = CurDLT;\n"
|
||||||
<< " }\n"
|
<< " }\n"
|
||||||
<< " }\n\n";
|
<< " }\n\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user