summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2014-03-27 23:10:04 +0000
committerManman Ren <manman.ren@gmail.com>2014-03-27 23:10:04 +0000
commited0de1368dcb1174bcc8f3b1b1719be4d185267f (patch)
tree283176c9a3240b78d6b983ce3d5875087ce17096 /llvm/lib
parent377066a5f51ea6c7fe0abfaafc07bdc062d2570d (diff)
downloadbcm5719-llvm-ed0de1368dcb1174bcc8f3b1b1719be4d185267f.tar.gz
bcm5719-llvm-ed0de1368dcb1174bcc8f3b1b1719be4d185267f.zip
Provide a target override for the cost of using a callee-saved register
for the first time. Thanks Andy for the discussion. rdar://16162005 llvm-svn: 204979
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/RegAllocGreedy.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/RegAllocGreedy.cpp b/llvm/lib/CodeGen/RegAllocGreedy.cpp
index 0eb91ab2927..6a623b82002 100644
--- a/llvm/lib/CodeGen/RegAllocGreedy.cpp
+++ b/llvm/lib/CodeGen/RegAllocGreedy.cpp
@@ -2123,7 +2123,10 @@ unsigned RAGreedy::tryAssignCSRFirstTime(LiveInterval &VirtReg,
unsigned PhysReg,
unsigned &CostPerUseLimit,
SmallVectorImpl<unsigned> &NewVRegs) {
- BlockFrequency CSRCost(CSRFirstTimeCost);
+ // We use the larger one out of the command-line option and the value report
+ // by TRI.
+ BlockFrequency CSRCost(std::max((unsigned)CSRFirstTimeCost,
+ TRI->getCSRFirstUseCost()));
if (getStage(VirtReg) == RS_Spill && VirtReg.isSpillable()) {
// We choose spill over using the CSR for the first time if the spill cost
// is lower than CSRCost.
@@ -2172,7 +2175,8 @@ unsigned RAGreedy::selectOrSplitImpl(LiveInterval &VirtReg,
// When NewVRegs is not empty, we may have made decisions such as evicting
// a virtual register, go with the earlier decisions and use the physical
// register.
- if (CSRFirstTimeCost > 0 && CSRFirstUse && NewVRegs.empty()) {
+ if ((CSRFirstTimeCost || TRI->getCSRFirstUseCost()) &&
+ CSRFirstUse && NewVRegs.empty()) {
unsigned CSRReg = tryAssignCSRFirstTime(VirtReg, Order, PhysReg,
CostPerUseLimit, NewVRegs);
if (CSRReg || !NewVRegs.empty())
OpenPOWER on IntegriCloud