[llvm-commits] [llvm] r94240 - in /llvm/trunk/lib/CodeGen: LiveIntervalAnalysis.cpp SlotIndexes.cpp

Chris Lattner clattner at apple.com
Sun Jan 24 12:45:15 PST 2010


On Jan 22, 2010, at 2:38 PM, Dale Johannesen wrote:

> Author: johannes
> Date: Fri Jan 22 16:38:21 2010
> New Revision: 94240
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=94240&view=rev
> Log:
> Ignore DEBUG_VALUE when building live intervals;
> this makes the code work transparently the same
> whether they're there or not.

Ok, but how about adding a predicate to MachineInstr that does this check.  It would be much nicer to do something like:

if (mii->isDebugInstruction())

or something like that.  That way if we add new opcodes for debug stuff, we can just change one place.

-Chris

> 
> 
> Modified:
>    llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
>    llvm/trunk/lib/CodeGen/SlotIndexes.cpp
> 
> Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=94240&r1=94239&r2=94240&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
> +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Jan 22 16:38:21 2010
> @@ -140,7 +140,10 @@
>        << ":\t\t# derived from " << mbbi->getName() << "\n";
>     for (MachineBasicBlock::iterator mii = mbbi->begin(),
>            mie = mbbi->end(); mii != mie; ++mii) {
> -      OS << getInstructionIndex(mii) << '\t' << *mii;
> +      if (mii->getOpcode()==TargetInstrInfo::DEBUG_VALUE)
> +        OS << SlotIndex::getEmptyKey() << '\t' << *mii;
> +      else
> +        OS << getInstructionIndex(mii) << '\t' << *mii;
>     }
>   }
> }
> @@ -672,8 +675,6 @@
>     SlotIndex MIIndex = getMBBStartIdx(MBB);
>     DEBUG(dbgs() << MBB->getName() << ":\n");
> 
> -    MachineBasicBlock::iterator MI = MBB->begin(), miEnd = MBB->end();
> -
>     // Create intervals for live-ins to this BB first.
>     for (MachineBasicBlock::const_livein_iterator LI = MBB->livein_begin(),
>            LE = MBB->livein_end(); LI != LE; ++LI) {
> @@ -689,8 +690,11 @@
>     if (getInstructionFromIndex(MIIndex) == 0)
>       MIIndex = indexes_->getNextNonNullIndex(MIIndex);
> 
> -    for (; MI != miEnd; ++MI) {
> +    for (MachineBasicBlock::iterator MI = MBB->begin(), miEnd = MBB->end();
> +         MI != miEnd; ++MI) {
>       DEBUG(dbgs() << MIIndex << "\t" << *MI);
> +      if (MI->getOpcode()==TargetInstrInfo::DEBUG_VALUE)
> +        continue;
> 
>       // Handle defs.
>       for (int i = MI->getNumOperands() - 1; i >= 0; --i) {
> 
> Modified: llvm/trunk/lib/CodeGen/SlotIndexes.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SlotIndexes.cpp?rev=94240&r1=94239&r2=94240&view=diff
> 
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/SlotIndexes.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SlotIndexes.cpp Fri Jan 22 16:38:21 2010
> @@ -14,6 +14,7 @@
> #include "llvm/Support/Debug.h"
> #include "llvm/Support/raw_ostream.h"
> #include "llvm/Support/ManagedStatic.h"
> +#include "llvm/Target/TargetInstrInfo.h"
> 
> using namespace llvm;
> 
> @@ -107,6 +108,8 @@
>     for (MachineBasicBlock::iterator miItr = mbb->begin(), miEnd = mbb->end();
>          miItr != miEnd; ++miItr) {
>       MachineInstr *mi = &*miItr;
> +      if (mi->getOpcode()==TargetInstrInfo::DEBUG_VALUE)
> +        continue;
> 
>       if (miItr == mbb->getFirstTerminator()) {
>         push_back(createEntry(0, index));
> 
> 
> _______________________________________________
> 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