[llvm-commits] [llvm] r76615 - in /llvm/trunk: include/llvm/CodeGen/LiveIntervalAnalysis.h lib/CodeGen/LiveIntervalAnalysis.cpp

Chris Lattner clattner at apple.com
Tue Jul 21 13:09:49 PDT 2009


On Jul 21, 2009, at 11:56 AM, David Greene wrote:
> Author: greened
> Date: Tue Jul 21 13:56:32 2009
> New Revision: 76615
>
> URL: http://llvm.org/viewvc/llvm-project?rev=76615&view=rev
> Log:
>
> Prefix IR dumps with LiveInterval indices when possible.  This turns
> this:

This is nice, but:

> +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Tue Jul  
> 21 13:56:32 2009
> @@ -27,7 +27,9 @@
> #include "llvm/ADT/SmallPtrSet.h"
> #include "llvm/ADT/SmallVector.h"
> #include "llvm/Support/Allocator.h"
> +#include "llvm/Support/Dump.h"
> #include <cmath>
> +#include <sstream>

You're adding more std::*stream stuff to header files.

>
> +  // IntervalPrefixPrinter - Print live interval indices before each
> +  // instruction.
> +  class IntervalPrefixPrinter : public PrefixPrinter {

David, please talk about general infrastructure like this before just  
applying it to mainline with no review.

Remember that you have *commit after approval* access, with exceptions  
for "obvious" patches.  This is not obvious and you are not a  
maintainer for these areas.  Please read this for more information:
http://llvm.org/docs/DeveloperPolicy.html#commitaccess

Please revert r76602+ and propose them to llvm-commits.

-Chris

> +  private:
> +    const LiveIntervals &liinfo;
> +
> +  public:
> +    IntervalPrefixPrinter(const LiveIntervals &lii)
> +        : liinfo(lii) {};
> +
> +    std::string operator()(const MachineBasicBlock &) const {
> +      return("");
> +    };
> +
> +    std::string operator()(const MachineInstr &instr) const {
> +      std::stringstream out;
> +      out << liinfo.getInstructionIndex(&instr);
> +      return(out.str());
> +    };
> +  };
> } // End llvm namespace
>
> #endif
>
> Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=76615&r1=76614&r2=76615&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
> +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Jul 21  
> 13:56:32 2009
> @@ -464,7 +464,7 @@
>   i2miMap_.resize(highestSlot + 1);
>   for (Mi2IndexMap::iterator MI = mi2iMap_.begin(), ME =  
> mi2iMap_.end();
>        MI != ME; ++MI) {
> -    i2miMap_[MI->second] = MI->first;
> +    i2miMap_[MI->second] = const_cast<MachineInstr *>(MI->first);
>   }
>
> }
> @@ -501,14 +501,7 @@
>   }
>
>   O << "********** MACHINEINSTRS **********\n";
> -  for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_- 
> >end();
> -       mbbi != mbbe; ++mbbi) {
> -    O << ((Value*)mbbi->getBasicBlock())->getName() << ":\n";
> -    for (MachineBasicBlock::iterator mii = mbbi->begin(),
> -           mie = mbbi->end(); mii != mie; ++mii) {
> -      O << getInstructionIndex(mii) << '\t' << *mii;
> -    }
> -  }
> +  mf_->print(O, IntervalPrefixPrinter(*this));
> }
>
> /// conflictsWithPhysRegDef - Returns true if the specified register
>
>
> _______________________________________________
> 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