mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-13 22:26:11 +00:00
Simplify debug info intrisinc lowering.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74733 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2f510aed9c
commit
7e1e31f467
@ -581,13 +581,11 @@ namespace llvm {
|
|||||||
/// ExtractDebugLocation - Extract debug location information
|
/// ExtractDebugLocation - Extract debug location information
|
||||||
/// from llvm.dbg.stoppoint intrinsic.
|
/// from llvm.dbg.stoppoint intrinsic.
|
||||||
DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI,
|
DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI,
|
||||||
CodeGenOpt::Level OptLev,
|
|
||||||
DebugLocTracker &DebugLocInfo);
|
DebugLocTracker &DebugLocInfo);
|
||||||
|
|
||||||
/// ExtractDebugLocation - Extract debug location information
|
/// ExtractDebugLocation - Extract debug location information
|
||||||
/// from llvm.dbg.func_start intrinsic.
|
/// from llvm.dbg.func_start intrinsic.
|
||||||
DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
|
DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
|
||||||
CodeGenOpt::Level OptLev,
|
|
||||||
DebugLocTracker &DebugLocInfo);
|
DebugLocTracker &DebugLocInfo);
|
||||||
|
|
||||||
/// isInlinedFnStart - Return true if FSI is starting an inlined function.
|
/// isInlinedFnStart - Return true if FSI is starting an inlined function.
|
||||||
|
@ -356,6 +356,9 @@ 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; }
|
||||||
|
|
||||||
|
/// getDebugLocInfo - Get the debug info location tracker.
|
||||||
|
DebugLocTracker &getDebugLocInfo() { return DebugLocInfo; }
|
||||||
};
|
};
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
|
@ -1091,12 +1091,9 @@ namespace llvm {
|
|||||||
/// ExtractDebugLocation - Extract debug location information
|
/// ExtractDebugLocation - Extract debug location information
|
||||||
/// from llvm.dbg.stoppoint intrinsic.
|
/// from llvm.dbg.stoppoint intrinsic.
|
||||||
DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI,
|
DebugLoc ExtractDebugLocation(DbgStopPointInst &SPI,
|
||||||
CodeGenOpt::Level OptLev,
|
|
||||||
DebugLocTracker &DebugLocInfo) {
|
DebugLocTracker &DebugLocInfo) {
|
||||||
DebugLoc DL;
|
DebugLoc DL;
|
||||||
Value *Context = SPI.getContext();
|
Value *Context = SPI.getContext();
|
||||||
if (DIDescriptor::ValidDebugInfo(Context, OptLev) == false)
|
|
||||||
return DL;
|
|
||||||
|
|
||||||
// If this location is already tracked then use it.
|
// If this location is already tracked then use it.
|
||||||
DebugLocTuple Tuple(cast<GlobalVariable>(Context), SPI.getLine(),
|
DebugLocTuple Tuple(cast<GlobalVariable>(Context), SPI.getLine(),
|
||||||
@ -1117,12 +1114,9 @@ namespace llvm {
|
|||||||
/// ExtractDebugLocation - Extract debug location information
|
/// ExtractDebugLocation - Extract debug location information
|
||||||
/// from llvm.dbg.func_start intrinsic.
|
/// from llvm.dbg.func_start intrinsic.
|
||||||
DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
|
DebugLoc ExtractDebugLocation(DbgFuncStartInst &FSI,
|
||||||
CodeGenOpt::Level OptLev,
|
|
||||||
DebugLocTracker &DebugLocInfo) {
|
DebugLocTracker &DebugLocInfo) {
|
||||||
DebugLoc DL;
|
DebugLoc DL;
|
||||||
Value *SP = FSI.getSubprogram();
|
Value *SP = FSI.getSubprogram();
|
||||||
if (DIDescriptor::ValidDebugInfo(SP, OptLev) == false)
|
|
||||||
return DL;
|
|
||||||
|
|
||||||
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
||||||
unsigned Line = Subprogram.getLineNumber();
|
unsigned Line = Subprogram.getLineNumber();
|
||||||
|
@ -326,19 +326,14 @@ bool FastISel::SelectCall(User *I) {
|
|||||||
default: break;
|
default: break;
|
||||||
case Intrinsic::dbg_stoppoint: {
|
case Intrinsic::dbg_stoppoint: {
|
||||||
DbgStopPointInst *SPI = cast<DbgStopPointInst>(I);
|
DbgStopPointInst *SPI = cast<DbgStopPointInst>(I);
|
||||||
if (DIDescriptor::ValidDebugInfo(SPI->getContext(), CodeGenOpt::None)) {
|
if (isValidDebugInfoIntrinsic(*SPI, CodeGenOpt::None))
|
||||||
DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
|
setCurDebugLoc(ExtractDebugLocation(*SPI, MF.getDebugLocInfo()));
|
||||||
unsigned Line = SPI->getLine();
|
|
||||||
unsigned Col = SPI->getColumn();
|
|
||||||
unsigned Idx = MF.getOrCreateDebugLocID(CU.getGV(), Line, Col);
|
|
||||||
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 (isValidDebugInfoIntrinsic(*RSI, CodeGenOpt::None) && DW
|
||||||
DW && DW->ShouldEmitDwarfDebug()) {
|
&& DW->ShouldEmitDwarfDebug()) {
|
||||||
unsigned ID =
|
unsigned ID =
|
||||||
DW->RecordRegionStart(cast<GlobalVariable>(RSI->getContext()));
|
DW->RecordRegionStart(cast<GlobalVariable>(RSI->getContext()));
|
||||||
const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
|
const TargetInstrDesc &II = TII.get(TargetInstrInfo::DBG_LABEL);
|
||||||
@ -348,11 +343,11 @@ 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 (isValidDebugInfoIntrinsic(*REI, CodeGenOpt::None) && DW
|
||||||
DW && DW->ShouldEmitDwarfDebug()) {
|
&& DW->ShouldEmitDwarfDebug()) {
|
||||||
unsigned ID = 0;
|
unsigned ID = 0;
|
||||||
DISubprogram Subprogram(cast<GlobalVariable>(REI->getContext()));
|
DISubprogram Subprogram(cast<GlobalVariable>(REI->getContext()));
|
||||||
if (!Subprogram.isNull() && !Subprogram.describes(MF.getFunction())) {
|
if (isInlinedFnEnd(*REI, 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);
|
||||||
ID = DW->RecordInlinedFnEnd(Subprogram);
|
ID = DW->RecordInlinedFnEnd(Subprogram);
|
||||||
@ -372,17 +367,11 @@ bool FastISel::SelectCall(User *I) {
|
|||||||
}
|
}
|
||||||
case Intrinsic::dbg_func_start: {
|
case Intrinsic::dbg_func_start: {
|
||||||
DbgFuncStartInst *FSI = cast<DbgFuncStartInst>(I);
|
DbgFuncStartInst *FSI = cast<DbgFuncStartInst>(I);
|
||||||
Value *SP = FSI->getSubprogram();
|
if (!isValidDebugInfoIntrinsic(*FSI, CodeGenOpt::None) || !DW
|
||||||
if (!DIDescriptor::ValidDebugInfo(SP, CodeGenOpt::None))
|
|| !DW->ShouldEmitDwarfDebug())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
if (isInlinedFnStart(*FSI, MF.getFunction())) {
|
||||||
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
|
|
||||||
unsigned Line = Subprogram.getLineNumber();
|
|
||||||
|
|
||||||
// If this subprogram does not describe current function then this is
|
|
||||||
// beginning of a inlined function.
|
|
||||||
if (!Subprogram.describes(MF.getFunction())) {
|
|
||||||
// This is a beginning of an inlined function.
|
// This is a beginning of an inlined function.
|
||||||
|
|
||||||
// If llvm.dbg.func.start is seen in a new block before any
|
// If llvm.dbg.func.start is seen in a new block before any
|
||||||
@ -392,38 +381,33 @@ bool FastISel::SelectCall(User *I) {
|
|||||||
if (PrevLoc.isUnknown())
|
if (PrevLoc.isUnknown())
|
||||||
return true;
|
return true;
|
||||||
// Record the source line.
|
// Record the source line.
|
||||||
unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0);
|
setCurDebugLoc(ExtractDebugLocation(*FSI, MF.getDebugLocInfo()));
|
||||||
setCurDebugLoc(DebugLoc::get(LocID));
|
|
||||||
|
|
||||||
if (DW && DW->ShouldEmitDwarfDebug()) {
|
|
||||||
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
|
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
|
||||||
unsigned LabelID = DW->RecordInlinedFnStart(Subprogram,
|
DISubprogram SP(cast<GlobalVariable>(FSI->getSubprogram()));
|
||||||
|
unsigned LabelID = DW->RecordInlinedFnStart(SP,
|
||||||
DICompileUnit(PrevLocTpl.CompileUnit),
|
DICompileUnit(PrevLocTpl.CompileUnit),
|
||||||
PrevLocTpl.Line,
|
PrevLocTpl.Line,
|
||||||
PrevLocTpl.Col);
|
PrevLocTpl.Col);
|
||||||
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);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a beginning of a new function.
|
// This is a beginning of a new function.
|
||||||
// Record the source line.
|
MF.setDefaultDebugLoc(ExtractDebugLocation(*FSI, MF.getDebugLocInfo()));
|
||||||
unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0);
|
|
||||||
MF.setDefaultDebugLoc(DebugLoc::get(LocID));
|
|
||||||
|
|
||||||
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()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case Intrinsic::dbg_declare: {
|
case Intrinsic::dbg_declare: {
|
||||||
DbgDeclareInst *DI = cast<DbgDeclareInst>(I);
|
DbgDeclareInst *DI = cast<DbgDeclareInst>(I);
|
||||||
|
if (!isValidDebugInfoIntrinsic(*DI, CodeGenOpt::None) || !DW
|
||||||
|
|| !DW->ShouldEmitDwarfDebug())
|
||||||
|
return true;
|
||||||
|
|
||||||
Value *Variable = DI->getVariable();
|
Value *Variable = DI->getVariable();
|
||||||
if (DIDescriptor::ValidDebugInfo(Variable, CodeGenOpt::None) &&
|
|
||||||
DW && DW->ShouldEmitDwarfDebug()) {
|
|
||||||
// Determine the address of the declared object.
|
|
||||||
Value *Address = DI->getAddress();
|
Value *Address = DI->getAddress();
|
||||||
if (BitCastInst *BCI = dyn_cast<BitCastInst>(Address))
|
if (BitCastInst *BCI = dyn_cast<BitCastInst>(Address))
|
||||||
Address = BCI->getOperand(0);
|
Address = BCI->getOperand(0);
|
||||||
@ -444,7 +428,6 @@ bool FastISel::SelectCall(User *I) {
|
|||||||
= BuildMI(MBB, DL, II).addFrameIndex(FI).addGlobalAddress(GV);
|
= BuildMI(MBB, DL, II).addFrameIndex(FI).addGlobalAddress(GV);
|
||||||
DIVariable DV(cast<GlobalVariable>(GV));
|
DIVariable DV(cast<GlobalVariable>(GV));
|
||||||
DW->RecordVariableScope(DV, DeclareMI);
|
DW->RecordVariableScope(DV, DeclareMI);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case Intrinsic::eh_exception: {
|
case Intrinsic::eh_exception: {
|
||||||
|
@ -332,30 +332,14 @@ void FunctionLoweringInfo::set(Function &fn, MachineFunction &mf,
|
|||||||
default: break;
|
default: break;
|
||||||
case Intrinsic::dbg_stoppoint: {
|
case Intrinsic::dbg_stoppoint: {
|
||||||
DbgStopPointInst *SPI = cast<DbgStopPointInst>(I);
|
DbgStopPointInst *SPI = cast<DbgStopPointInst>(I);
|
||||||
|
if (isValidDebugInfoIntrinsic(*SPI, CodeGenOpt::Default))
|
||||||
if (DIDescriptor::ValidDebugInfo(SPI->getContext(),
|
DL = ExtractDebugLocation(*SPI, MF->getDebugLocInfo());
|
||||||
CodeGenOpt::Default)) {
|
|
||||||
DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
|
|
||||||
unsigned idx = MF->getOrCreateDebugLocID(CU.getGV(),
|
|
||||||
SPI->getLine(),
|
|
||||||
SPI->getColumn());
|
|
||||||
DL = DebugLoc::get(idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Intrinsic::dbg_func_start: {
|
case Intrinsic::dbg_func_start: {
|
||||||
DbgFuncStartInst *FSI = cast<DbgFuncStartInst>(I);
|
DbgFuncStartInst *FSI = cast<DbgFuncStartInst>(I);
|
||||||
Value *SP = FSI->getSubprogram();
|
if (isValidDebugInfoIntrinsic(*FSI, CodeGenOpt::Default))
|
||||||
|
DL = ExtractDebugLocation(*FSI, MF->getDebugLocInfo());
|
||||||
if (DIDescriptor::ValidDebugInfo(SP, CodeGenOpt::Default)) {
|
|
||||||
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
|
||||||
DICompileUnit CU(Subprogram.getCompileUnit());
|
|
||||||
unsigned Line = Subprogram.getLineNumber();
|
|
||||||
DL = DebugLoc::get(MF->getOrCreateDebugLocID(CU.getGV(),
|
|
||||||
Line, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3887,11 +3871,9 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
}
|
}
|
||||||
case Intrinsic::dbg_stoppoint: {
|
case Intrinsic::dbg_stoppoint: {
|
||||||
DbgStopPointInst &SPI = cast<DbgStopPointInst>(I);
|
DbgStopPointInst &SPI = cast<DbgStopPointInst>(I);
|
||||||
if (DIDescriptor::ValidDebugInfo(SPI.getContext(), OptLevel)) {
|
if (isValidDebugInfoIntrinsic(SPI, CodeGenOpt::Default)) {
|
||||||
MachineFunction &MF = DAG.getMachineFunction();
|
MachineFunction &MF = DAG.getMachineFunction();
|
||||||
DICompileUnit CU(cast<GlobalVariable>(SPI.getContext()));
|
DebugLoc Loc = ExtractDebugLocation(SPI, MF.getDebugLocInfo());
|
||||||
DebugLoc Loc = DebugLoc::get(MF.getOrCreateDebugLocID(CU.getGV(),
|
|
||||||
SPI.getLine(), SPI.getColumn()));
|
|
||||||
setCurDebugLoc(Loc);
|
setCurDebugLoc(Loc);
|
||||||
|
|
||||||
if (OptLevel == CodeGenOpt::None)
|
if (OptLevel == CodeGenOpt::None)
|
||||||
@ -3905,32 +3887,27 @@ 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 (isValidDebugInfoIntrinsic(RSI, OptLevel) && DW
|
||||||
if (DIDescriptor::ValidDebugInfo(RSI.getContext(), OptLevel) &&
|
&& DW->ShouldEmitDwarfDebug()) {
|
||||||
DW && DW->ShouldEmitDwarfDebug()) {
|
|
||||||
unsigned LabelID =
|
unsigned LabelID =
|
||||||
DW->RecordRegionStart(cast<GlobalVariable>(RSI.getContext()));
|
DW->RecordRegionStart(cast<GlobalVariable>(RSI.getContext()));
|
||||||
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
||||||
getRoot(), LabelID));
|
getRoot(), LabelID));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
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) &&
|
if (!isValidDebugInfoIntrinsic(REI, OptLevel) || !DW
|
||||||
DW && DW->ShouldEmitDwarfDebug()) {
|
|| !DW->ShouldEmitDwarfDebug())
|
||||||
|
return 0;
|
||||||
|
|
||||||
MachineFunction &MF = DAG.getMachineFunction();
|
MachineFunction &MF = DAG.getMachineFunction();
|
||||||
DISubprogram Subprogram(cast<GlobalVariable>(REI.getContext()));
|
DISubprogram Subprogram(cast<GlobalVariable>(REI.getContext()));
|
||||||
|
|
||||||
if (Subprogram.isNull() || Subprogram.describes(MF.getFunction())) {
|
if (isInlinedFnEnd(REI, MF.getFunction())) {
|
||||||
unsigned LabelID =
|
|
||||||
DW->RecordRegionEnd(cast<GlobalVariable>(REI.getContext()));
|
|
||||||
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
|
||||||
getRoot(), LabelID));
|
|
||||||
} else {
|
|
||||||
// This is end of inlined function. Debugging information for inlined
|
// This is end of inlined function. Debugging information for inlined
|
||||||
// function is not handled yet (only supported by FastISel).
|
// function is not handled yet (only supported by FastISel).
|
||||||
if (OptLevel == CodeGenOpt::None) {
|
if (OptLevel == CodeGenOpt::None) {
|
||||||
@ -3943,33 +3920,30 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
||||||
getRoot(), ID));
|
getRoot(), ID));
|
||||||
}
|
}
|
||||||
}
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned LabelID =
|
||||||
|
DW->RecordRegionEnd(cast<GlobalVariable>(REI.getContext()));
|
||||||
|
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
||||||
|
getRoot(), LabelID));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case Intrinsic::dbg_func_start: {
|
case Intrinsic::dbg_func_start: {
|
||||||
DwarfWriter *DW = DAG.getDwarfWriter();
|
DwarfWriter *DW = DAG.getDwarfWriter();
|
||||||
DbgFuncStartInst &FSI = cast<DbgFuncStartInst>(I);
|
DbgFuncStartInst &FSI = cast<DbgFuncStartInst>(I);
|
||||||
Value *SP = FSI.getSubprogram();
|
if (!isValidDebugInfoIntrinsic(FSI, CodeGenOpt::None) || !DW
|
||||||
if (!DIDescriptor::ValidDebugInfo(SP, OptLevel))
|
|| !DW->ShouldEmitDwarfDebug())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
|
||||||
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
|
|
||||||
unsigned Line = Subprogram.getLineNumber();
|
|
||||||
|
|
||||||
MachineFunction &MF = DAG.getMachineFunction();
|
MachineFunction &MF = DAG.getMachineFunction();
|
||||||
// If this subprogram does not describe current function then this is
|
// This is a beginning of an inlined function.
|
||||||
// beginning of a inlined function.
|
if (isInlinedFnStart(FSI, MF.getFunction())) {
|
||||||
bool isInlinedFnStart = !Subprogram.describes(MF.getFunction());
|
if (OptLevel != CodeGenOpt::None)
|
||||||
if (isInlinedFnStart && OptLevel != CodeGenOpt::None)
|
|
||||||
// FIXME: Debugging informaation for inlined function is only
|
// FIXME: Debugging informaation for inlined function is only
|
||||||
// supported at CodeGenOpt::Node.
|
// supported at CodeGenOpt::Node.
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (isInlinedFnStart && OptLevel == CodeGenOpt::None) {
|
|
||||||
// This is a beginning of an inlined function.
|
|
||||||
DebugLoc PrevLoc = CurDebugLoc;
|
DebugLoc PrevLoc = CurDebugLoc;
|
||||||
// If llvm.dbg.func.start is seen in a new block before any
|
// If llvm.dbg.func.start is seen in a new block before any
|
||||||
// llvm.dbg.stoppoint intrinsic then the location info is unknown.
|
// llvm.dbg.stoppoint intrinsic then the location info is unknown.
|
||||||
@ -3978,42 +3952,38 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Record the source line.
|
// Record the source line.
|
||||||
unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0);
|
setCurDebugLoc(ExtractDebugLocation(FSI, MF.getDebugLocInfo()));
|
||||||
setCurDebugLoc(DebugLoc::get(LocID));
|
|
||||||
|
|
||||||
if (DW && DW->ShouldEmitDwarfDebug()) {
|
|
||||||
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
|
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
|
||||||
unsigned LabelID = DW->RecordInlinedFnStart(Subprogram,
|
DISubprogram SP(cast<GlobalVariable>(FSI.getSubprogram()));
|
||||||
DICompileUnit(PrevLocTpl.CompileUnit),
|
DICompileUnit CU(PrevLocTpl.CompileUnit);
|
||||||
|
unsigned LabelID = DW->RecordInlinedFnStart(SP, CU,
|
||||||
PrevLocTpl.Line,
|
PrevLocTpl.Line,
|
||||||
PrevLocTpl.Col);
|
PrevLocTpl.Col);
|
||||||
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
||||||
getRoot(), LabelID));
|
getRoot(), LabelID));
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a beginning of a new function.
|
// This is a beginning of a new function.
|
||||||
// Record the source line.
|
MF.setDefaultDebugLoc(ExtractDebugLocation(FSI, MF.getDebugLocInfo()));
|
||||||
unsigned LocID = MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0);
|
|
||||||
MF.setDefaultDebugLoc(DebugLoc::get(LocID));
|
|
||||||
|
|
||||||
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()));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case Intrinsic::dbg_declare: {
|
case Intrinsic::dbg_declare: {
|
||||||
if (OptLevel == CodeGenOpt::None) {
|
if (OptLevel != CodeGenOpt::None)
|
||||||
|
// FIXME: Variable debug info is not supported here.
|
||||||
|
return 0;
|
||||||
|
|
||||||
DbgDeclareInst &DI = cast<DbgDeclareInst>(I);
|
DbgDeclareInst &DI = cast<DbgDeclareInst>(I);
|
||||||
|
if (!isValidDebugInfoIntrinsic(DI, CodeGenOpt::None))
|
||||||
|
return 0;
|
||||||
|
|
||||||
Value *Variable = DI.getVariable();
|
Value *Variable = DI.getVariable();
|
||||||
if (DIDescriptor::ValidDebugInfo(Variable, OptLevel))
|
|
||||||
DAG.setRoot(DAG.getNode(ISD::DECLARE, dl, MVT::Other, getRoot(),
|
DAG.setRoot(DAG.getNode(ISD::DECLARE, dl, MVT::Other, getRoot(),
|
||||||
getValue(DI.getAddress()), getValue(Variable)));
|
getValue(DI.getAddress()), getValue(Variable)));
|
||||||
} else {
|
|
||||||
// FIXME: Do something sensible here when we support debug declare.
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case Intrinsic::eh_exception: {
|
case Intrinsic::eh_exception: {
|
||||||
|
Loading…
Reference in New Issue
Block a user