[llvm] a00f7dc - [NFC] MCRegister fixes in RegisterClassInfo, and const-ed APIs
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 26 08:58:31 PST 2021
Author: Mircea Trofin
Date: 2021-02-26T08:53:57-08:00
New Revision: a00f7dc2d539bae2702e871e0767e4effb87ceb6
URL: https://github.com/llvm/llvm-project/commit/a00f7dc2d539bae2702e871e0767e4effb87ceb6
DIFF: https://github.com/llvm/llvm-project/commit/a00f7dc2d539bae2702e871e0767e4effb87ceb6.diff
LOG: [NFC] MCRegister fixes in RegisterClassInfo, and const-ed APIs
Added:
Modified:
llvm/include/llvm/CodeGen/RegisterClassInfo.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/RegisterClassInfo.h b/llvm/include/llvm/CodeGen/RegisterClassInfo.h
index 00b853561859..d82f1db60d8b 100644
--- a/llvm/include/llvm/CodeGen/RegisterClassInfo.h
+++ b/llvm/include/llvm/CodeGen/RegisterClassInfo.h
@@ -111,24 +111,26 @@ class RegisterClassInfo {
}
/// 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 in RegCosts[Reg] for all
/// the registers in getOrder(RC).
- uint8_t getMinCost(const TargetRegisterClass *RC) { return get(RC).MinCost; }
+ 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 RegCosts[Reg].
- unsigned getLastCostChange(const TargetRegisterClass *RC) {
+ unsigned getLastCostChange(const TargetRegisterClass *RC) const {
return get(RC).LastCostChange;
}
More information about the llvm-commits
mailing list