summaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/FastISel.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-07-18 20:55:23 +0000
committerDevang Patel <dpatel@apple.com>2011-07-18 20:55:23 +0000
commit1360bc8eb029d51d426c77c4b1410849ff308893 (patch)
treee8b242d66d1dfc3f259884f4cee3f98944897e23 /lib/CodeGen/SelectionDAG/FastISel.cpp
parentfc933c073e9357a791c0f6b307355ed735e3557f (diff)
downloadllvm-1360bc8eb029d51d426c77c4b1410849ff308893.tar.gz
llvm-1360bc8eb029d51d426c77c4b1410849ff308893.tar.bz2
llvm-1360bc8eb029d51d426c77c4b1410849ff308893.tar.xz
During bottom up fast-isel, instructions emitted to materalize registers are at top of basic block and do not have debug location. This may misguide debugger while entering the basic block and sometimes debugger provides semi useful view of current location to developer by picking up previous known location as current location. Assign a sensible location to the first instruction in a basic block, if it does not have one location derived from source file, so that debugger can provide meaningful user experience to developers in edge cases.
[take 2] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135423 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/FastISel.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp
index b8d7e82fe3..53809c62f8 100644
--- a/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -292,6 +292,28 @@ void FastISel::recomputeInsertPt() {
++FuncInfo.InsertPt;
}
+/// recomputeDebugLocForMaterializedRegs - Recompute debug location for
+/// very first instruction in a basic block. All instructions emitted
+/// to materialize registers do not have location information, see
+/// enterLocalValueArea(), becase they may not be emited at the right
+/// location.
+void FastISel::recomputeDebugLocForMaterializedRegs() {
+ if (!getLastLocalValue())
+ return;
+ MachineInstr *First = FuncInfo.MBB->getFirstNonPHI();
+ if (!First->getDebugLoc().isUnknown())
+ return;
+
+ for (MachineBasicBlock::iterator I = FuncInfo.MBB->begin(),
+ E = FuncInfo.MBB->end(); I != E; ++I) {
+ DebugLoc DL = I->getDebugLoc();
+ if (!DL.isUnknown()) {
+ First->setDebugLoc(DL);
+ return;
+ }
+ }
+}
+
FastISel::SavePoint FastISel::enterLocalValueArea() {
MachineBasicBlock::iterator OldInsertPt = FuncInfo.InsertPt;
DebugLoc OldDL = DL;