Clean up dwarf writer, part 1. This eliminated the horrible recursive getGlobalVariablesUsing and replaced it something readable. It eliminated use of slow UniqueVector and replaced it with StringMap, SmallVector, and DenseMap, etc. It also fixed some non-deterministic behavior.
This is a very minor compile time win.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65438 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index 4791465..91fecc3 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
@@ -335,8 +335,8 @@
if (DW && DW->ValidDebugInfo(SPI->getContext())) {
DICompileUnit CU(cast<GlobalVariable>(SPI->getContext()));
- unsigned SrcFile = DW->RecordSource(CU.getDirectory(),
- CU.getFilename());
+ unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(),
+ CU.getFilename());
unsigned idx = MF->getOrCreateDebugLocID(SrcFile,
SPI->getLine(),
SPI->getColumn());
@@ -354,8 +354,8 @@
if (DW->ValidDebugInfo(SP)) {
DISubprogram Subprogram(cast<GlobalVariable>(SP));
DICompileUnit CU(Subprogram.getCompileUnit());
- unsigned SrcFile = DW->RecordSource(CU.getDirectory(),
- CU.getFilename());
+ unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(),
+ CU.getFilename());
unsigned Line = Subprogram.getLineNumber();
DL = DebugLoc::get(MF->getOrCreateDebugLocID(SrcFile, Line, 0));
}
@@ -3892,16 +3892,16 @@
DwarfWriter *DW = DAG.getDwarfWriter();
DbgStopPointInst &SPI = cast<DbgStopPointInst>(I);
if (DW && DW->ValidDebugInfo(SPI.getContext())) {
+ MachineFunction &MF = DAG.getMachineFunction();
DAG.setRoot(DAG.getDbgStopPoint(getRoot(),
SPI.getLine(),
SPI.getColumn(),
SPI.getContext()));
DICompileUnit CU(cast<GlobalVariable>(SPI.getContext()));
- unsigned SrcFile = DW->RecordSource(CU.getDirectory(), CU.getFilename());
- unsigned idx = DAG.getMachineFunction().
- getOrCreateDebugLocID(SrcFile,
- SPI.getLine(),
- SPI.getColumn());
+ unsigned SrcFile = DW->getOrCreateSourceID(CU.getDirectory(),
+ CU.getFilename());
+ unsigned idx = MF.getOrCreateDebugLocID(SrcFile,
+ SPI.getLine(), SPI.getColumn());
setCurDebugLoc(DebugLoc::get(idx));
}
return 0;
@@ -3940,10 +3940,11 @@
if (SP && DW->ValidDebugInfo(SP)) {
// llvm.dbg.func.start implicitly defines a dbg_stoppoint which is
// what (most?) gdb expects.
+ MachineFunction &MF = DAG.getMachineFunction();
DISubprogram Subprogram(cast<GlobalVariable>(SP));
DICompileUnit CompileUnit = Subprogram.getCompileUnit();
- unsigned SrcFile = DW->RecordSource(CompileUnit.getDirectory(),
- CompileUnit.getFilename());
+ unsigned SrcFile = DW->getOrCreateSourceID(CompileUnit.getDirectory(),
+ CompileUnit.getFilename());
// Record the source line but does not create a label for the normal
// function start. It will be emitted at asm emission time. However,
@@ -3957,8 +3958,7 @@
getRoot(), LabelID));
}
- setCurDebugLoc(DebugLoc::get(DAG.getMachineFunction().
- getOrCreateDebugLocID(SrcFile, Line, 0)));
+ setCurDebugLoc(DebugLoc::get(MF.getOrCreateDebugLocID(SrcFile, Line, 0)));
}
return 0;