summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-06-27 22:32:04 +0000
committerDevang Patel <dpatel@apple.com>2011-06-27 22:32:04 +0000
commit4dc034df1d8304e203c46b0cc112f150ed82e987 (patch)
treea1b87cb827b0e671d48a28a1ea59c47615f50797 /llvm/lib/CodeGen
parent70cc6b8a855d15cd5e5a0278c41a54fa4883d8f1 (diff)
downloadbcm5719-llvm-4dc034df1d8304e203c46b0cc112f150ed82e987.tar.gz
bcm5719-llvm-4dc034df1d8304e203c46b0cc112f150ed82e987.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.
llvm-svn: 133953
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 8ae75f5649c..a7d629e6dce 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 dc8044b7a7f..7a9439f4d57 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)
+ 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