From 1a99a5f501f26efa059a8c716217feaed11d9a43 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Tue, 21 Apr 2009 22:46:52 +0000 Subject: It has finally happened. Spiller is now using live interval info. This fixes a very subtle bug. vr defined by an implicit_def is allowed overlap with any register since it doesn't actually modify anything. However, if it's used as a two-address use, its live range can be extended and it can be spilled. The spiller must take care not to emit a reload for the vn number that's defined by the implicit_def. This is both a correctness and performance issue. llvm-svn: 69743 --- llvm/lib/CodeGen/Spiller.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'llvm/lib/CodeGen/Spiller.h') diff --git a/llvm/lib/CodeGen/Spiller.h b/llvm/lib/CodeGen/Spiller.h index c0d08379604..f00831f7e84 100644 --- a/llvm/lib/CodeGen/Spiller.h +++ b/llvm/lib/CodeGen/Spiller.h @@ -17,6 +17,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Support/Streams.h" #include "llvm/Function.h" +#include "llvm/CodeGen/LiveIntervalAnalysis.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstrBuilder.h" @@ -37,8 +38,8 @@ namespace llvm { /// virtual registers to stack slots, rewriting the code. struct Spiller { virtual ~Spiller(); - virtual bool runOnMachineFunction(MachineFunction &MF, - VirtRegMap &VRM) = 0; + virtual bool runOnMachineFunction(MachineFunction &MF, VirtRegMap &VRM, + LiveIntervals* LIs) = 0; }; /// createSpiller - Create an return a spiller object, as specified on the @@ -49,7 +50,8 @@ namespace llvm { // Simple Spiller Implementation struct VISIBILITY_HIDDEN SimpleSpiller : public Spiller { - bool runOnMachineFunction(MachineFunction& mf, VirtRegMap &VRM); + bool runOnMachineFunction(MachineFunction& mf, VirtRegMap &VRM, + LiveIntervals* LIs); }; // ************************************************************************ // @@ -287,7 +289,8 @@ namespace llvm { BitVector AllocatableRegs; DenseMap DistanceMap; public: - bool runOnMachineFunction(MachineFunction &MF, VirtRegMap &VRM); + bool runOnMachineFunction(MachineFunction &MF, VirtRegMap &VRM, + LiveIntervals* LI); private: void TransferDeadness(MachineBasicBlock *MBB, unsigned CurDist, unsigned Reg, BitVector &RegKills, @@ -329,7 +332,7 @@ namespace llvm { VirtRegMap &VRM); void RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM, - AvailableSpills &Spills, + LiveIntervals *LIs, AvailableSpills &Spills, BitVector &RegKills, std::vector &KillOps); }; } -- cgit v1.2.3