summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
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
commit4dc76f243864fe34028a08f261c4d97f6256c583 (patch)
tree2573ff5e9d371cd85a8d7dd8662d3058ef1c98cc /llvm/lib/CodeGen
parent4c14ed75eeb17df92757cab1c4bb0ad2d0988694 (diff)
downloadbcm5719-llvm-4dc76f243864fe34028a08f261c4d97f6256c583.tar.gz
bcm5719-llvm-4dc76f243864fe34028a08f261c4d97f6256c583.zip
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] llvm-svn: 135423
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FastISel.cpp22
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp2
2 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index b8d7e82fe3b..53809c62f8e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/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;
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 87bb296b8c7..d3cb0fedef0 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -964,6 +964,8 @@ void SelectionDAGISel::SelectAllBasicBlocks(const Function &Fn) {
else
++NumFastIselBlocks;
+ if (FastIS && LLVMBB != &Fn.getEntryBlock())
+ FastIS->recomputeDebugLocForMaterializedRegs();
if (Begin != BI) {
// Run SelectionDAG instruction selection on the remainder of the block
// not handled by FastISel. If FastISel is not run, this is the entire
OpenPOWER on IntegriCloud