[llvm] 508e734 - [CodeGen] Use DenseMapInfo<Register> to implement DenseMapInfo<TargetInstrInfo::RegSubRegPair>. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 15 10:18:15 PDT 2024
Author: Craig Topper
Date: 2024-09-15T09:59:34-07:00
New Revision: 508e734e33a278ecab2306a5fc7e37920cc51dac
URL: https://github.com/llvm/llvm-project/commit/508e734e33a278ecab2306a5fc7e37920cc51dac
DIFF: https://github.com/llvm/llvm-project/commit/508e734e33a278ecab2306a5fc7e37920cc51dac.diff
LOG: [CodeGen] Use DenseMapInfo<Register> to implement DenseMapInfo<TargetInstrInfo::RegSubRegPair>. NFC
Instead of casting Register to unsigned to use DenseMapInfo<unsigned>.
Added:
Modified:
llvm/include/llvm/CodeGen/TargetInstrInfo.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/TargetInstrInfo.h b/llvm/include/llvm/CodeGen/TargetInstrInfo.h
index 65c5788ac5cc9f..a3bfc63f2a4790 100644
--- a/llvm/include/llvm/CodeGen/TargetInstrInfo.h
+++ b/llvm/include/llvm/CodeGen/TargetInstrInfo.h
@@ -2287,29 +2287,30 @@ class TargetInstrInfo : public MCInstrInfo {
/// Provide DenseMapInfo for TargetInstrInfo::RegSubRegPair.
template <> struct DenseMapInfo<TargetInstrInfo::RegSubRegPair> {
- using RegInfo = DenseMapInfo<unsigned>;
+ using RegInfo = DenseMapInfo<Register>;
+ using SubRegInfo = DenseMapInfo<unsigned>;
static inline TargetInstrInfo::RegSubRegPair getEmptyKey() {
return TargetInstrInfo::RegSubRegPair(RegInfo::getEmptyKey(),
- RegInfo::getEmptyKey());
+ SubRegInfo::getEmptyKey());
}
static inline TargetInstrInfo::RegSubRegPair getTombstoneKey() {
return TargetInstrInfo::RegSubRegPair(RegInfo::getTombstoneKey(),
- RegInfo::getTombstoneKey());
+ SubRegInfo::getTombstoneKey());
}
/// Reuse getHashValue implementation from
/// std::pair<unsigned, unsigned>.
static unsigned getHashValue(const TargetInstrInfo::RegSubRegPair &Val) {
- std::pair<unsigned, unsigned> PairVal = std::make_pair(Val.Reg, Val.SubReg);
- return DenseMapInfo<std::pair<unsigned, unsigned>>::getHashValue(PairVal);
+ return DenseMapInfo<std::pair<Register, unsigned>>::getHashValue(
+ std::make_pair(Val.Reg, Val.SubReg));
}
static bool isEqual(const TargetInstrInfo::RegSubRegPair &LHS,
const TargetInstrInfo::RegSubRegPair &RHS) {
return RegInfo::isEqual(LHS.Reg, RHS.Reg) &&
- RegInfo::isEqual(LHS.SubReg, RHS.SubReg);
+ SubRegInfo::isEqual(LHS.SubReg, RHS.SubReg);
}
};
More information about the llvm-commits
mailing list