From e2b201bac382464496758d789cddefa50690fbe3 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Mon, 18 May 2009 19:03:16 +0000 Subject: New Spiller interface and trivial implementation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72030 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/RegAllocLinearScan.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/RegAllocLinearScan.cpp') diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp index c5ce455..ac6ab32 100644 --- a/lib/CodeGen/RegAllocLinearScan.cpp +++ b/lib/CodeGen/RegAllocLinearScan.cpp @@ -14,6 +14,7 @@ #define DEBUG_TYPE "regalloc" #include "VirtRegMap.h" #include "VirtRegRewriter.h" +#include "Spiller.h" #include "llvm/Function.h" #include "llvm/CodeGen/LiveIntervalAnalysis.h" #include "llvm/CodeGen/LiveStackAnalysis.h" @@ -56,6 +57,11 @@ PreSplitIntervals("pre-alloc-split", cl::desc("Pre-register allocation live interval splitting"), cl::init(false), cl::Hidden); +static cl::opt +NewSpillFramework("new-spill-framework", + cl::desc("New spilling framework"), + cl::init(false), cl::Hidden); + static RegisterRegAlloc linearscanRegAlloc("linearscan", "linear scan register allocator", createLinearScanRegisterAllocator); @@ -127,6 +133,8 @@ namespace { std::auto_ptr rewriter_; + std::auto_ptr spiller_; + public: virtual const char* getPassName() const { return "Linear Scan Register Allocator"; @@ -420,6 +428,13 @@ bool RALinScan::runOnMachineFunction(MachineFunction &fn) { vrm_ = &getAnalysis(); if (!rewriter_.get()) rewriter_.reset(createVirtRegRewriter()); + + if (NewSpillFramework) { + spiller_.reset(createSpiller(mf_, li_, vrm_)); + } + else { + spiller_.reset(0); + } initIntervalSets(); @@ -1108,8 +1123,15 @@ void RALinScan::assignRegOrStackSlotAtInterval(LiveInterval* cur) if (cur->weight != HUGE_VALF && cur->weight <= minWeight) { DOUT << "\t\t\tspilling(c): " << *cur << '\n'; SmallVector spillIs; - std::vector added = - li_->addIntervalsForSpills(*cur, spillIs, loopInfo, *vrm_); + std::vector added; + + if (!NewSpillFramework) { + added = li_->addIntervalsForSpills(*cur, spillIs, loopInfo, *vrm_); + } + else { + added = spiller_->spill(cur); + } + std::sort(added.begin(), added.end(), LISorter()); addStackInterval(cur, ls_, li_, mri_, *vrm_); if (added.empty()) -- cgit v1.1