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 | 91970b4ea2fc6747de5f37b25ce0f5f044b1d224 (patch) | |
| tree | be7d7798d5811bcab93eb01b0f3275bfd183918f /llvm | |
| parent | c0943d089fcbda18b40c532701ec7bd02961e6dd (diff) | |
| download | bcm5719-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')
| -rw-r--r-- | llvm/include/llvm/CodeGen/MachineBasicBlock.h | 3 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 17 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/X86InstrInfo.cpp | 6 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/X86RegisterInfo.cpp | 17 |
4 files changed, 22 insertions, 21 deletions
diff --git a/llvm/include/llvm/CodeGen/MachineBasicBlock.h b/llvm/include/llvm/CodeGen/MachineBasicBlock.h index 6b4c64055bf..ad4bc1f79d5 100644 --- a/llvm/include/llvm/CodeGen/MachineBasicBlock.h +++ b/llvm/include/llvm/CodeGen/MachineBasicBlock.h @@ -367,6 +367,9 @@ private: // Methods used to maintain doubly linked list of blocks... void removePredecessor(MachineBasicBlock *pred); }; +DebugLoc +findDebugLoc(MachineBasicBlock::iterator &MBBI, MachineBasicBlock &MBB); + raw_ostream& operator<<(raw_ostream &OS, const MachineBasicBlock &MBB); void WriteAsOperand(raw_ostream &, const MachineBasicBlock*, bool t); 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; +} diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp index 8b9d0b80bab..9501ace8d37 100644 --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -2200,8 +2200,7 @@ bool X86InstrInfo::spillCalleeSavedRegisters(MachineBasicBlock &MBB, if (CSI.empty()) return false; - DebugLoc DL = DebugLoc::getUnknownLoc(); - if (MI != MBB.end()) DL = MI->getDebugLoc(); + DebugLoc DL = findDebugLoc(MI, MBB); bool is64Bit = TM.getSubtarget<X86Subtarget>().is64Bit(); bool isWin64 = TM.getSubtarget<X86Subtarget>().isTargetWin64(); @@ -2239,8 +2238,7 @@ bool X86InstrInfo::restoreCalleeSavedRegisters(MachineBasicBlock &MBB, if (CSI.empty()) return false; - DebugLoc DL = DebugLoc::getUnknownLoc(); - if (MI != MBB.end()) DL = MI->getDebugLoc(); + DebugLoc DL = findDebugLoc(MI, MBB); MachineFunction &MF = *MBB.getParent(); unsigned FPReg = RI.getFrameRegister(MF); diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp index 60e69e8d514..6962b8cef95 100644 --- a/llvm/lib/Target/X86/X86RegisterInfo.cpp +++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp @@ -666,23 +666,6 @@ X86RegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF, } } -/// findDebugLoc - find the next valid DebugLoc starting at MBBI, skipping -/// any DEBUG_VALUE instructions. Return UnknownLoc if there is none. -static -DebugLoc 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; -} - /// emitSPUpdate - Emit a series of instructions to increment / decrement the /// stack pointer by a constant value. static |

