summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineBasicBlock.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-01-20 00:19:24 +0000
committerDale Johannesen <dalej@apple.com>2010-01-20 00:19:24 +0000
commit91970b4ea2fc6747de5f37b25ce0f5f044b1d224 (patch)
treebe7d7798d5811bcab93eb01b0f3275bfd183918f /llvm/lib/CodeGen/MachineBasicBlock.cpp
parentc0943d089fcbda18b40c532701ec7bd02961e6dd (diff)
downloadbcm5719-llvm-91970b4ea2fc6747de5f37b25ce0f5f044b1d224.tar.gz
bcm5719-llvm-91970b4ea2fc6747de5f37b25ce0f5f044b1d224.zip
Move findDebugLoc somewhere more central. Fix
more cases where debug declarations affect debug line info. llvm-svn: 93953
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBasicBlock.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 124f793962c..030438fceb5 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -528,3 +528,20 @@ void llvm::WriteAsOperand(raw_ostream &OS, const MachineBasicBlock *MBB,
bool t) {
OS << "BB#" << MBB->getNumber();
}
+
+/// findDebugLoc - find the next valid DebugLoc starting at MBBI, skipping
+/// any DEBUG_VALUE instructions. Return UnknownLoc if there is none.
+DebugLoc
+llvm::findDebugLoc(MachineBasicBlock::iterator &MBBI, MachineBasicBlock &MBB) {
+ DebugLoc DL;
+ if (MBBI != MBB.end()) {
+ // Skip debug declarations, we don't want a DebugLoc from them.
+ MachineBasicBlock::iterator MBBI2 = MBBI;
+ while (MBBI2 != MBB.end() &&
+ MBBI2->getOpcode()==TargetInstrInfo::DEBUG_VALUE)
+ MBBI2++;
+ if (MBBI2 != MBB.end())
+ DL = MBBI2->getDebugLoc();
+ }
+ return DL;
+}
OpenPOWER on IntegriCloud