Spillers may alter MachineLoopInfo when breaking critical edges, so make it

non-const.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108734 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakob Stoklund Olesen 2010-07-19 18:41:20 +00:00
parent 6ee32707f1
commit 9529a1c3dd
4 changed files with 15 additions and 12 deletions

View File

@ -18,6 +18,7 @@
#include "llvm/CodeGen/LiveIntervalAnalysis.h" #include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h" #include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetInstrInfo.h"
@ -30,6 +31,7 @@ namespace {
class InlineSpiller : public Spiller { class InlineSpiller : public Spiller {
MachineFunction &mf_; MachineFunction &mf_;
LiveIntervals &lis_; LiveIntervals &lis_;
MachineLoopInfo &loops_;
VirtRegMap &vrm_; VirtRegMap &vrm_;
MachineFrameInfo &mfi_; MachineFrameInfo &mfi_;
MachineRegisterInfo &mri_; MachineRegisterInfo &mri_;
@ -53,8 +55,9 @@ class InlineSpiller : public Spiller {
~InlineSpiller() {} ~InlineSpiller() {}
public: public:
InlineSpiller(MachineFunction *mf, LiveIntervals *lis, VirtRegMap *vrm) InlineSpiller(MachineFunction *mf, LiveIntervals *lis, MachineLoopInfo *mli,
: mf_(*mf), lis_(*lis), vrm_(*vrm), VirtRegMap *vrm)
: mf_(*mf), lis_(*lis), loops_(*mli), vrm_(*vrm),
mfi_(*mf->getFrameInfo()), mfi_(*mf->getFrameInfo()),
mri_(mf->getRegInfo()), mri_(mf->getRegInfo()),
tii_(*mf->getTarget().getInstrInfo()), tii_(*mf->getTarget().getInstrInfo()),
@ -82,9 +85,9 @@ private:
namespace llvm { namespace llvm {
Spiller *createInlineSpiller(MachineFunction *mf, Spiller *createInlineSpiller(MachineFunction *mf,
LiveIntervals *lis, LiveIntervals *lis,
const MachineLoopInfo *mli, MachineLoopInfo *mli,
VirtRegMap *vrm) { VirtRegMap *vrm) {
return new InlineSpiller(mf, lis, vrm); return new InlineSpiller(mf, lis, mli, vrm);
} }
} }

View File

@ -127,7 +127,7 @@ namespace {
BitVector allocatableRegs_; BitVector allocatableRegs_;
LiveIntervals* li_; LiveIntervals* li_;
LiveStacks* ls_; LiveStacks* ls_;
const MachineLoopInfo *loopInfo; MachineLoopInfo *loopInfo;
/// handled_ - Intervals are added to the handled_ set in the order of their /// handled_ - Intervals are added to the handled_ set in the order of their
/// start value. This is uses for backtracking. /// start value. This is uses for backtracking.
@ -799,7 +799,7 @@ static void addStackInterval(LiveInterval *cur, LiveStacks *ls_,
static static
float getConflictWeight(LiveInterval *cur, unsigned Reg, LiveIntervals *li_, float getConflictWeight(LiveInterval *cur, unsigned Reg, LiveIntervals *li_,
MachineRegisterInfo *mri_, MachineRegisterInfo *mri_,
const MachineLoopInfo *loopInfo) { MachineLoopInfo *loopInfo) {
float Conflicts = 0; float Conflicts = 0;
for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(Reg), for (MachineRegisterInfo::reg_iterator I = mri_->reg_begin(Reg),
E = mri_->reg_end(); I != E; ++I) { E = mri_->reg_end(); I != E; ++I) {

View File

@ -193,10 +193,10 @@ namespace {
class StandardSpiller : public Spiller { class StandardSpiller : public Spiller {
protected: protected:
LiveIntervals *lis; LiveIntervals *lis;
const MachineLoopInfo *loopInfo; MachineLoopInfo *loopInfo;
VirtRegMap *vrm; VirtRegMap *vrm;
public: public:
StandardSpiller(LiveIntervals *lis, const MachineLoopInfo *loopInfo, StandardSpiller(LiveIntervals *lis, MachineLoopInfo *loopInfo,
VirtRegMap *vrm) VirtRegMap *vrm)
: lis(lis), loopInfo(loopInfo), vrm(vrm) {} : lis(lis), loopInfo(loopInfo), vrm(vrm) {}
@ -222,7 +222,7 @@ namespace {
class SplittingSpiller : public StandardSpiller { class SplittingSpiller : public StandardSpiller {
public: public:
SplittingSpiller(MachineFunction *mf, LiveIntervals *lis, SplittingSpiller(MachineFunction *mf, LiveIntervals *lis,
const MachineLoopInfo *loopInfo, VirtRegMap *vrm) MachineLoopInfo *loopInfo, VirtRegMap *vrm)
: StandardSpiller(lis, loopInfo, vrm) { : StandardSpiller(lis, loopInfo, vrm) {
mri = &mf->getRegInfo(); mri = &mf->getRegInfo();
@ -508,12 +508,12 @@ private:
namespace llvm { namespace llvm {
Spiller *createInlineSpiller(MachineFunction*, Spiller *createInlineSpiller(MachineFunction*,
LiveIntervals*, LiveIntervals*,
const MachineLoopInfo*, MachineLoopInfo*,
VirtRegMap*); VirtRegMap*);
} }
llvm::Spiller* llvm::createSpiller(MachineFunction *mf, LiveIntervals *lis, llvm::Spiller* llvm::createSpiller(MachineFunction *mf, LiveIntervals *lis,
const MachineLoopInfo *loopInfo, MachineLoopInfo *loopInfo,
VirtRegMap *vrm) { VirtRegMap *vrm) {
switch (spillerOpt) { switch (spillerOpt) {
default: assert(0 && "unknown spiller"); default: assert(0 && "unknown spiller");

View File

@ -51,7 +51,7 @@ namespace llvm {
/// Create and return a spiller object, as specified on the command line. /// Create and return a spiller object, as specified on the command line.
Spiller* createSpiller(MachineFunction *mf, LiveIntervals *li, Spiller* createSpiller(MachineFunction *mf, LiveIntervals *li,
const MachineLoopInfo *loopInfo, VirtRegMap *vrm); MachineLoopInfo *loopInfo, VirtRegMap *vrm);
} }
#endif #endif