diff options
author | Dan Gohman <gohman@apple.com> | 2010-04-20 00:37:27 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-04-20 00:37:27 +0000 |
commit | 3df671a81c4b4574d2c2fa2527ce813393426e09 (patch) | |
tree | 974978d0c2724b16fe780ec9a7028f7ba06d5a13 /llvm/lib/CodeGen | |
parent | ca35aa11227dc11fdaef670580b54d1c3ff87264 (diff) | |
download | bcm5719-llvm-3df671a81c4b4574d2c2fa2527ce813393426e09.tar.gz bcm5719-llvm-3df671a81c4b4574d2c2fa2527ce813393426e09.zip |
Remove MachineFunction's DefaultDebugLoc member, and make DwarfDebug.cpp
responsible for figuring out what that's supposed to be on its own.
llvm-svn: 101844
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 17 | ||||
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 5 |
2 files changed, 16 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 23f08f1df5c..684a409c9ff 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2283,6 +2283,21 @@ void DwarfDebug::identifyScopeMarkers() { } } +/// FindFirstDebugLoc - Find the first debug location in the function. This +/// is intended to be an approximation for the source position of the +/// beginning of the function. +static DebugLoc FindFirstDebugLoc(const MachineFunction *MF) { + for (MachineFunction::const_iterator I = MF->begin(), E = MF->end(); + I != E; ++I) + for (MachineBasicBlock::const_iterator MBBI = I->begin(), MBBE = I->end(); + MBBI != MBBE; ++MBBI) { + DebugLoc DL = MBBI->getDebugLoc(); + if (!DL.isUnknown()) + return DL; + } + return DebugLoc(); +} + /// beginFunction - Gather pre-function debug information. Assumes being /// emitted immediately after the function entry point. void DwarfDebug::beginFunction(const MachineFunction *MF) { @@ -2297,7 +2312,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) { // Emit label for the implicitly defined dbg.stoppoint at the start of the // function. - DebugLoc FDL = MF->getDefaultDebugLoc(); + DebugLoc FDL = FindFirstDebugLoc(MF); if (FDL.isUnknown()) return; MDNode *Scope = FDL.getScope(MF->getFunction()->getContext()); diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 13d8c3818c1..d47c76bbbfa 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -235,11 +235,6 @@ static void SetDebugLoc(const Instruction *I, SelectionDAGBuilder *SDB, if (FastIS) FastIS->setCurDebugLoc(DL); - - // If the function doesn't have a default debug location yet, set - // it. This is a total hack. - if (MF->getDefaultDebugLoc().isUnknown()) - MF->setDefaultDebugLoc(DL); } /// ResetDebugLoc - Set MF's and SDB's DebugLocs to Unknown. |