[llvm-commits] [llvm] r51934 - in /llvm/trunk: include/llvm/CodeGen/LiveInterval.h include/llvm/CodeGen/LiveStackAnalysis.h include/llvm/CodeGen/MachineFrameInfo.h include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/LiveInterval.cpp lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/LiveStackAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp lib/CodeGen/StackSlotColoring.cpp

Chris Lattner clattner at apple.com
Sun Jun 22 22:56:42 PDT 2008


On Jun 4, 2008, at 2:18 AM, Evan Cheng wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=51934&view=rev
> Log:
> Add a stack slot coloring pass. Not yet enabled.

Very nice Evan,

> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/include/llvm/CodeGen/LiveInterval.h (original)
> +++ llvm/trunk/include/llvm/CodeGen/LiveInterval.h Wed Jun  4  
> 04:18:41 2008
> @@ -35,6 +35,7 @@
>   /// merge point), it contains ~0u,x. If the value number is not in  
> use, it
>   /// contains ~1u,x to indicate that the value # is not used.
>   ///   def   - Instruction # of the definition.
> +  ///         - or reg # of the definition if it's a stack slot  
> liveinterval.
>   ///   copy  - Copy iff val# is defined by a copy; zero otherwise.
>   ///   hasPHIKill - One or more of the kills are PHI nodes.
>   ///   kills - Instruction # of the kills.
> @@ -100,15 +101,16 @@
>     typedef SmallVector<LiveRange,4> Ranges;
>     typedef SmallVector<VNInfo*,4> VNInfoList;
>
> -    unsigned reg;        // the register of this interval
> +    bool isSS;           // True if this represents a stack slot
> +    unsigned reg;        // the register or stack slot of this  
> interval

isSS?  Why do you need this?  You're bloating all LiveInterval's for  
this flag.

> +++ llvm/trunk/lib/CodeGen/StackSlotColoring.cpp Wed Jun  4 04:18:41  
> 2008
> @@ -0,0 +1,271 @@
> +//===-- StackSlotColoring.cpp - Sinking for machine instructions  
> ----------===//

Plz update comment.

> +#define DEBUG_TYPE "stackcoloring"
> +#include "llvm/CodeGen/LiveStackAnalysis.h"
> +#include "llvm/CodeGen/MachineFrameInfo.h"
> +#include "llvm/CodeGen/Passes.h"

Passes.h is the primary header for this file, please include it first.

> +static cl::opt<bool>
> +DisableSharing("no-stack-slot-sharing",
> +             cl::init(false), cl::Hidden,
> +             cl::desc("Surpress slot sharing during stack  
> coloring"));
> +
> +static cl::opt<int>
> +DeleteLimit("slot-delete-limit", cl::init(-1), cl::Hidden,
> +             cl::desc("Stack coloring slot deletion limit"));

What is DeleteLimit?  Does DisableSharing disable the whole pass?

> +/// Colorslots - Color all spill stack slots and rewrite all  
> frameindex machine
> +/// operands in the function.
> +bool StackSlotColoring::ColorSlots(MachineFunction &MF) {
> +  unsigned NumObjs = MFI->getObjectIndexEnd();
> +  std::vector<int> SlotMapping(NumObjs, -1);
> +  SlotMapping.resize(NumObjs, -1);

Is the resize dead/redundant with the ctor?

Overall, very nice.

-Chris



More information about the llvm-commits mailing list