[llvm-commits] [llvm] r93953 - in /llvm/trunk: include/llvm/CodeGen/MachineBasicBlock.h lib/CodeGen/MachineBasicBlock.cpp lib/Target/X86/X86InstrInfo.cpp lib/Target/X86/X86RegisterInfo.cpp
Chris Lattner
clattner at apple.com
Tue Jan 19 19:35:45 PST 2010
On Jan 19, 2010, at 4:19 PM, Dale Johannesen wrote:
> Author: johannes
> Date: Tue Jan 19 18:19:24 2010
> New Revision: 93953
>
> URL: http://llvm.org/viewvc/llvm-project?rev=93953&view=rev
> Log:
> Move findDebugLoc somewhere more central. Fix
> more cases where debug declarations affect
> debug line info.
Hi Dale,
How about making this a method on MachineBasicBlock, which allows you to drop the MBB argument and gives it a more logical home?
-Chris
>
>
> Modified:
> llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
> llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
> llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
> llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
>
> Modified: llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h?rev=93953&r1=93952&r2=93953&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/MachineBasicBlock.h Tue Jan 19 18:19:24 2010
> @@ -367,6 +367,9 @@
> 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);
>
> Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=93953&r1=93952&r2=93953&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
> +++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Tue Jan 19 18:19:24 2010
> @@ -528,3 +528,20 @@
> 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;
> +}
>
> Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=93953&r1=93952&r2=93953&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Tue Jan 19 18:19:24 2010
> @@ -2200,8 +2200,7 @@
> 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 @@
> 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);
>
> Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=93953&r1=93952&r2=93953&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original)
> +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Tue Jan 19 18:19:24 2010
> @@ -666,23 +666,6 @@
> }
> }
>
> -/// 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
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list