aboutsummaryrefslogtreecommitdiff
path: root/llvm/include/llvm/CodeGen/RegisterClassInfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/include/llvm/CodeGen/RegisterClassInfo.h')
-rw-r--r--llvm/include/llvm/CodeGen/RegisterClassInfo.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/llvm/include/llvm/CodeGen/RegisterClassInfo.h b/llvm/include/llvm/CodeGen/RegisterClassInfo.h
index 25b310c47621..d82f1db60d8b 100644
--- a/llvm/include/llvm/CodeGen/RegisterClassInfo.h
+++ b/llvm/include/llvm/CodeGen/RegisterClassInfo.h
@@ -66,6 +66,9 @@ class RegisterClassInfo {
std::unique_ptr<unsigned[]> PSetLimits;
+ // The register cost values.
+ ArrayRef<uint8_t> RegCosts;
+
// Compute all information about RC.
void compute(const TargetRegisterClass *RC) const;
@@ -108,26 +111,26 @@ public:
}
/// getLastCalleeSavedAlias - Returns the last callee saved register that
- /// overlaps PhysReg, or 0 if Reg doesn't overlap a CalleeSavedAliases.
- unsigned getLastCalleeSavedAlias(unsigned PhysReg) const {
- assert(Register::isPhysicalRegister(PhysReg));
- if (PhysReg < CalleeSavedAliases.size())
+ /// overlaps PhysReg, or NoRegister if Reg doesn't overlap a
+ /// CalleeSavedAliases.
+ MCRegister getLastCalleeSavedAlias(MCRegister PhysReg) const {
+ if (PhysReg.id() < CalleeSavedAliases.size())
return CalleeSavedAliases[PhysReg];
- return 0;
+ return MCRegister::NoRegister;
}
/// Get the minimum register cost in RC's allocation order.
- /// This is the smallest value returned by TRI->getCostPerUse(Reg) for all
+ /// This is the smallest value in RegCosts[Reg] for all
/// the registers in getOrder(RC).
- unsigned getMinCost(const TargetRegisterClass *RC) {
+ uint8_t getMinCost(const TargetRegisterClass *RC) const {
return get(RC).MinCost;
}
/// Get the position of the last cost change in getOrder(RC).
///
/// All registers in getOrder(RC).slice(getLastCostChange(RC)) will have the
- /// same cost according to TRI->getCostPerUse().
- unsigned getLastCostChange(const TargetRegisterClass *RC) {
+ /// same cost according to RegCosts[Reg].
+ unsigned getLastCostChange(const TargetRegisterClass *RC) const {
return get(RC).LastCostChange;
}