[llvm-commits] [llvm] r101844 - in /llvm/trunk: include/llvm/CodeGen/MachineFunction.h lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Dan Gohman
gohman at apple.com
Mon Apr 19 17:37:27 PDT 2010
Author: djg
Date: Mon Apr 19 19:37:27 2010
New Revision: 101844
URL: http://llvm.org/viewvc/llvm-project?rev=101844&view=rev
Log:
Remove MachineFunction's DefaultDebugLoc member, and make DwarfDebug.cpp
responsible for figuring out what that's supposed to be on its own.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineFunction.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineFunction.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineFunction.h?rev=101844&r1=101843&r2=101844&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineFunction.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineFunction.h Mon Apr 19 19:37:27 2010
@@ -109,10 +109,6 @@
typedef ilist<MachineBasicBlock> BasicBlockListType;
BasicBlockListType BasicBlocks;
- /// Default debug location. Used to print out the debug label at the beginning
- /// of a function.
- DebugLoc DefaultDebugLoc;
-
/// FunctionNumber - This provides a unique ID for each function emitted in
/// this translation unit.
///
@@ -394,19 +390,6 @@
/// normal 'L' label is returned.
MCSymbol *getJTISymbol(unsigned JTI, MCContext &Ctx,
bool isLinkerPrivate = false) const;
-
-
- //===--------------------------------------------------------------------===//
- // Debug location.
- //
-
- /// getDefaultDebugLoc - Get the default debug location for the machine
- /// function.
- DebugLoc getDefaultDebugLoc() const { return DefaultDebugLoc; }
-
- /// setDefaultDebugLoc - Get the default debug location for the machine
- /// function.
- void setDefaultDebugLoc(DebugLoc DL) { DefaultDebugLoc = DL; }
};
//===--------------------------------------------------------------------===//
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=101844&r1=101843&r2=101844&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Apr 19 19:37:27 2010
@@ -2283,6 +2283,21 @@
}
}
+/// 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 @@
// 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());
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=101844&r1=101843&r2=101844&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Apr 19 19:37:27 2010
@@ -235,11 +235,6 @@
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.
More information about the llvm-commits
mailing list