diff options
author | Dale Johannesen <dalej@apple.com> | 2010-01-20 00:19:24 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2010-01-20 00:19:24 +0000 |
commit | 918f0f0beab7401172b0b17aeb04e8d757e97a10 (patch) | |
tree | 14a0ca432f5a6920f393499865a2eeb9c6e007a1 /lib/CodeGen/MachineBasicBlock.cpp | |
parent | cd9e155755dab1913238ffc0374111a39d500adf (diff) |
Move findDebugLoc somewhere more central. Fix
more cases where debug declarations affect
debug line info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93953 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | lib/CodeGen/MachineBasicBlock.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp index 124f793962..030438fceb 100644 --- a/lib/CodeGen/MachineBasicBlock.cpp +++ b/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; +} |