mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-06 14:57:41 +00:00
Rip out live range splitting support from the inline spiller.
The spiller should only spill. The register allocator will drive live range splitting, it has the needed information about register pressure and interferences. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121590 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ab7837c269
commit
3bda29eb4f
@ -15,15 +15,12 @@
|
|||||||
#define DEBUG_TYPE "regalloc"
|
#define DEBUG_TYPE "regalloc"
|
||||||
#include "Spiller.h"
|
#include "Spiller.h"
|
||||||
#include "LiveRangeEdit.h"
|
#include "LiveRangeEdit.h"
|
||||||
#include "SplitKit.h"
|
|
||||||
#include "VirtRegMap.h"
|
#include "VirtRegMap.h"
|
||||||
#include "llvm/Analysis/AliasAnalysis.h"
|
#include "llvm/Analysis/AliasAnalysis.h"
|
||||||
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
|
||||||
#include "llvm/CodeGen/LiveStackAnalysis.h"
|
#include "llvm/CodeGen/LiveStackAnalysis.h"
|
||||||
#include "llvm/CodeGen/MachineDominators.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"
|
||||||
@ -36,18 +33,12 @@ using namespace llvm;
|
|||||||
static cl::opt<bool>
|
static cl::opt<bool>
|
||||||
VerifySpills("verify-spills", cl::desc("Verify after each spill/split"));
|
VerifySpills("verify-spills", cl::desc("Verify after each spill/split"));
|
||||||
|
|
||||||
static cl::opt<bool>
|
|
||||||
ExtraSpillerSplits("extra-spiller-splits",
|
|
||||||
cl::desc("Enable additional splitting during splitting"));
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class InlineSpiller : public Spiller {
|
class InlineSpiller : public Spiller {
|
||||||
MachineFunctionPass &pass_;
|
MachineFunctionPass &pass_;
|
||||||
MachineFunction &mf_;
|
MachineFunction &mf_;
|
||||||
LiveIntervals &lis_;
|
LiveIntervals &lis_;
|
||||||
LiveStacks &lss_;
|
LiveStacks &lss_;
|
||||||
MachineDominatorTree &mdt_;
|
|
||||||
MachineLoopInfo &loops_;
|
|
||||||
AliasAnalysis *aa_;
|
AliasAnalysis *aa_;
|
||||||
VirtRegMap &vrm_;
|
VirtRegMap &vrm_;
|
||||||
MachineFrameInfo &mfi_;
|
MachineFrameInfo &mfi_;
|
||||||
@ -56,8 +47,6 @@ class InlineSpiller : public Spiller {
|
|||||||
const TargetRegisterInfo &tri_;
|
const TargetRegisterInfo &tri_;
|
||||||
const BitVector reserved_;
|
const BitVector reserved_;
|
||||||
|
|
||||||
SplitAnalysis splitAnalysis_;
|
|
||||||
|
|
||||||
// Variables that are valid during spill(), but used by multiple methods.
|
// Variables that are valid during spill(), but used by multiple methods.
|
||||||
LiveRangeEdit *edit_;
|
LiveRangeEdit *edit_;
|
||||||
const TargetRegisterClass *rc_;
|
const TargetRegisterClass *rc_;
|
||||||
@ -76,16 +65,13 @@ public:
|
|||||||
mf_(mf),
|
mf_(mf),
|
||||||
lis_(pass.getAnalysis<LiveIntervals>()),
|
lis_(pass.getAnalysis<LiveIntervals>()),
|
||||||
lss_(pass.getAnalysis<LiveStacks>()),
|
lss_(pass.getAnalysis<LiveStacks>()),
|
||||||
mdt_(pass.getAnalysis<MachineDominatorTree>()),
|
|
||||||
loops_(pass.getAnalysis<MachineLoopInfo>()),
|
|
||||||
aa_(&pass.getAnalysis<AliasAnalysis>()),
|
aa_(&pass.getAnalysis<AliasAnalysis>()),
|
||||||
vrm_(vrm),
|
vrm_(vrm),
|
||||||
mfi_(*mf.getFrameInfo()),
|
mfi_(*mf.getFrameInfo()),
|
||||||
mri_(mf.getRegInfo()),
|
mri_(mf.getRegInfo()),
|
||||||
tii_(*mf.getTarget().getInstrInfo()),
|
tii_(*mf.getTarget().getInstrInfo()),
|
||||||
tri_(*mf.getTarget().getRegisterInfo()),
|
tri_(*mf.getTarget().getRegisterInfo()),
|
||||||
reserved_(tri_.getReservedRegs(mf_)),
|
reserved_(tri_.getReservedRegs(mf_)) {}
|
||||||
splitAnalysis_(mf, lis_, loops_) {}
|
|
||||||
|
|
||||||
void spill(LiveInterval *li,
|
void spill(LiveInterval *li,
|
||||||
SmallVectorImpl<LiveInterval*> &newIntervals,
|
SmallVectorImpl<LiveInterval*> &newIntervals,
|
||||||
@ -94,8 +80,6 @@ public:
|
|||||||
void spill(LiveRangeEdit &);
|
void spill(LiveRangeEdit &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool split();
|
|
||||||
|
|
||||||
bool reMaterializeFor(MachineBasicBlock::iterator MI);
|
bool reMaterializeFor(MachineBasicBlock::iterator MI);
|
||||||
void reMaterializeAll();
|
void reMaterializeAll();
|
||||||
|
|
||||||
@ -117,42 +101,6 @@ Spiller *createInlineSpiller(MachineFunctionPass &pass,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// split - try splitting the current interval into pieces that may allocate
|
|
||||||
/// separately. Return true if successful.
|
|
||||||
bool InlineSpiller::split() {
|
|
||||||
splitAnalysis_.analyze(&edit_->getParent());
|
|
||||||
|
|
||||||
// Try splitting around loops.
|
|
||||||
if (ExtraSpillerSplits) {
|
|
||||||
const MachineLoop *loop = splitAnalysis_.getBestSplitLoop();
|
|
||||||
if (loop) {
|
|
||||||
SplitEditor(splitAnalysis_, lis_, vrm_, mdt_, *edit_)
|
|
||||||
.splitAroundLoop(loop);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try splitting into single block intervals.
|
|
||||||
SplitAnalysis::BlockPtrSet blocks;
|
|
||||||
if (splitAnalysis_.getMultiUseBlocks(blocks)) {
|
|
||||||
SplitEditor(splitAnalysis_, lis_, vrm_, mdt_, *edit_)
|
|
||||||
.splitSingleBlocks(blocks);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try splitting inside a basic block.
|
|
||||||
if (ExtraSpillerSplits) {
|
|
||||||
const MachineBasicBlock *MBB = splitAnalysis_.getBlockForInsideSplit();
|
|
||||||
if (MBB){
|
|
||||||
SplitEditor(splitAnalysis_, lis_, vrm_, mdt_, *edit_)
|
|
||||||
.splitInsideBlock(MBB);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// reMaterializeFor - Attempt to rematerialize edit_->getReg() before MI instead of
|
/// reMaterializeFor - Attempt to rematerialize edit_->getReg() before MI instead of
|
||||||
/// reloading it.
|
/// reloading it.
|
||||||
bool InlineSpiller::reMaterializeFor(MachineBasicBlock::iterator MI) {
|
bool InlineSpiller::reMaterializeFor(MachineBasicBlock::iterator MI) {
|
||||||
@ -377,9 +325,6 @@ void InlineSpiller::spill(LiveRangeEdit &edit) {
|
|||||||
assert(edit.getParent().isSpillable() &&
|
assert(edit.getParent().isSpillable() &&
|
||||||
"Attempting to spill already spilled value.");
|
"Attempting to spill already spilled value.");
|
||||||
|
|
||||||
if (split())
|
|
||||||
return;
|
|
||||||
|
|
||||||
reMaterializeAll();
|
reMaterializeAll();
|
||||||
|
|
||||||
// Remat may handle everything.
|
// Remat may handle everything.
|
||||||
|
Loading…
Reference in New Issue
Block a user