aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2008-06-19 01:16:17 +0000
committerEvan Cheng <evan.cheng@apple.com>2008-06-19 01:16:17 +0000
commitbdf34bc12bfc39de02c19fa250e83edb5924a6cf (patch)
tree10d48852ed330f25e5da4bbb836b8a955e02c417 /include
parent6c5e5616687e99329ffa790d2b40ab0f9c2e09f7 (diff)
Minor spiller tweak to unfavor reload into load/store instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52477 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h8
-rw-r--r--include/llvm/CodeGen/MachineRegisterInfo.h7
2 files changed, 13 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index 473cc8e099..84c6d67919 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -121,8 +121,12 @@ namespace llvm {
return getBaseIndex(index) + InstrSlots::STORE;
}
- static float getSpillWeight(bool isDef, bool isUse, unsigned loopDepth) {
- return (isDef + isUse) * powf(10.0F, (float)loopDepth);
+ static float getSpillWeight(bool isDef, bool isUse, bool isMem,
+ unsigned loopDepth) {
+ float Weight = isDef;
+ if (isUse)
+ Weight += isMem ? 1.2f : 1.0f;
+ return Weight * powf(10.0F, (float)loopDepth);
}
typedef Reg2IntervalMap::iterator iterator;
diff --git a/include/llvm/CodeGen/MachineRegisterInfo.h b/include/llvm/CodeGen/MachineRegisterInfo.h
index b93794c1be..bfa6d1ccd0 100644
--- a/include/llvm/CodeGen/MachineRegisterInfo.h
+++ b/include/llvm/CodeGen/MachineRegisterInfo.h
@@ -135,6 +135,13 @@ public:
assert(Reg < VRegInfo.size() && "Invalid vreg!");
return VRegInfo[Reg].first;
}
+
+ /// setRegClass - Set the register class of the specified virtual register.
+ void setRegClass(unsigned Reg, const TargetRegisterClass *RC) {
+ Reg -= TargetRegisterInfo::FirstVirtualRegister;
+ assert(Reg < VRegInfo.size() && "Invalid vreg!");
+ VRegInfo[Reg].first = RC;
+ }
/// createVirtualRegister - Create and return a new virtual register in the
/// function with the specified register class.