forked from OSchip/llvm-project
--- Reverse-merging r71370 into '.':
U lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp Revert r71370. llvm-svn: 71373
This commit is contained in:
parent
d53af35629
commit
d6280534e4
|
@ -3960,46 +3960,70 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
MachineFunction &MF = DAG.getMachineFunction();
|
MachineFunction &MF = DAG.getMachineFunction();
|
||||||
|
if (OptLevel == CodeGenOpt::None) {
|
||||||
|
// llvm.dbg.func.start implicitly defines a dbg_stoppoint which is what
|
||||||
|
// (most?) gdb expects.
|
||||||
|
DebugLoc PrevLoc = CurDebugLoc;
|
||||||
|
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
||||||
|
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
|
||||||
|
|
||||||
// llvm.dbg.func.start implicitly defines a dbg_stoppoint which is what
|
if (!Subprogram.describes(MF.getFunction())) {
|
||||||
// (most?) gdb expects.
|
// This is a beginning of an inlined function.
|
||||||
DebugLoc PrevLoc = CurDebugLoc;
|
|
||||||
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
|
||||||
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
|
|
||||||
|
|
||||||
if (!Subprogram.describes(MF.getFunction())) {
|
// If llvm.dbg.func.start is seen in a new block before any
|
||||||
// This is a beginning of an inlined function.
|
// llvm.dbg.stoppoint intrinsic then the location info is unknown.
|
||||||
|
// FIXME : Why DebugLoc is reset at the beginning of each block ?
|
||||||
|
if (PrevLoc.isUnknown())
|
||||||
|
return 0;
|
||||||
|
|
||||||
// If llvm.dbg.func.start is seen in a new block before any
|
// Record the source line.
|
||||||
// llvm.dbg.stoppoint intrinsic then the location info is unknown.
|
unsigned Line = Subprogram.getLineNumber();
|
||||||
// FIXME : Why DebugLoc is reset at the beginning of each block ?
|
setCurDebugLoc(DebugLoc::get(
|
||||||
if (PrevLoc.isUnknown())
|
MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0)));
|
||||||
|
|
||||||
|
if (DW && DW->ShouldEmitDwarfDebug()) {
|
||||||
|
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
|
||||||
|
unsigned LabelID = DW->RecordInlinedFnStart(Subprogram,
|
||||||
|
DICompileUnit(PrevLocTpl.CompileUnit),
|
||||||
|
PrevLocTpl.Line,
|
||||||
|
PrevLocTpl.Col);
|
||||||
|
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
||||||
|
getRoot(), LabelID));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Record the source line.
|
||||||
|
unsigned Line = Subprogram.getLineNumber();
|
||||||
|
MF.setDefaultDebugLoc(DebugLoc::get(
|
||||||
|
MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0)));
|
||||||
|
if (DW && DW->ShouldEmitDwarfDebug()) {
|
||||||
|
// llvm.dbg.func_start also defines beginning of function scope.
|
||||||
|
DW->RecordRegionStart(cast<GlobalVariable>(FSI.getSubprogram()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DISubprogram Subprogram(cast<GlobalVariable>(SP));
|
||||||
|
|
||||||
|
std::string SPName;
|
||||||
|
Subprogram.getLinkageName(SPName);
|
||||||
|
if (!SPName.empty()
|
||||||
|
&& strcmp(SPName.c_str(), MF.getFunction()->getNameStart())) {
|
||||||
|
// This is beginning of inlined function. Debugging information for
|
||||||
|
// inlined function is not handled yet (only supported by FastISel).
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Record the source line.
|
// llvm.dbg.func.start implicitly defines a dbg_stoppoint which is
|
||||||
|
// what (most?) gdb expects.
|
||||||
|
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
|
||||||
|
|
||||||
|
// Record the source line but does not create a label for the normal
|
||||||
|
// function start. It will be emitted at asm emission time. However,
|
||||||
|
// 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(), Line, 0)));
|
MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0)));
|
||||||
|
// FIXME - Start new region because llvm.dbg.func_start also defines
|
||||||
if (DW && DW->ShouldEmitDwarfDebug()) {
|
// beginning of function scope.
|
||||||
DebugLocTuple PrevLocTpl = MF.getDebugLocTuple(PrevLoc);
|
|
||||||
unsigned LabelID =
|
|
||||||
DW->RecordInlinedFnStart(Subprogram,
|
|
||||||
DICompileUnit(PrevLocTpl.CompileUnit),
|
|
||||||
PrevLocTpl.Line,
|
|
||||||
PrevLocTpl.Col);
|
|
||||||
DAG.setRoot(DAG.getLabel(ISD::DBG_LABEL, getCurDebugLoc(),
|
|
||||||
getRoot(), LabelID));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Record the source line.
|
|
||||||
unsigned Line = Subprogram.getLineNumber();
|
|
||||||
MF.setDefaultDebugLoc(DebugLoc::get(
|
|
||||||
MF.getOrCreateDebugLocID(CompileUnit.getGV(), Line, 0)));
|
|
||||||
if (DW && DW->ShouldEmitDwarfDebug()) {
|
|
||||||
// llvm.dbg.func_start also defines beginning of function scope.
|
|
||||||
DW->RecordRegionStart(cast<GlobalVariable>(FSI.getSubprogram()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue