[PATCH] D65605: Use MCRegister in MCRegisterInfo's interfaces
Daniel Sanders via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 1 17:51:01 PDT 2019
dsanders updated this revision to Diff 212943.
dsanders added a comment.
- Implement DenseMapInfo<MCRegister> via DenseMapInfo<unsigned> (and likewise for Register)
- Nit in Hexagon/BitTracker.cpp
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65605/new/
https://reviews.llvm.org/D65605
Files:
llvm/include/llvm/CodeGen/Register.h
llvm/include/llvm/MC/MCRegister.h
llvm/lib/Target/Hexagon/BitTracker.cpp
Index: llvm/lib/Target/Hexagon/BitTracker.cpp
===================================================================
--- llvm/lib/Target/Hexagon/BitTracker.cpp
+++ llvm/lib/Target/Hexagon/BitTracker.cpp
@@ -340,7 +340,7 @@
return TRI.getRegSizeInBits(VC);
}
assert(Register::isPhysicalRegister(RR.Reg));
- unsigned PhysR =
+ Register PhysR =
(RR.Sub == 0) ? Register(RR.Reg) : TRI.getSubReg(RR.Reg, RR.Sub);
return getPhysRegBitWidth(PhysR);
}
Index: llvm/include/llvm/MC/MCRegister.h
===================================================================
--- llvm/include/llvm/MC/MCRegister.h
+++ llvm/include/llvm/MC/MCRegister.h
@@ -67,12 +67,17 @@
// Provide DenseMapInfo for MCRegister
template<> struct DenseMapInfo<MCRegister> {
- static inline unsigned getEmptyKey() { return ~0U; }
- static inline unsigned getTombstoneKey() { return ~0U - 1; }
- static unsigned getHashValue(const unsigned& Val) { return Val * 37U; }
-
- static bool isEqual(const unsigned& LHS, const unsigned& RHS) {
- return LHS == RHS;
+ static inline unsigned getEmptyKey() {
+ return DenseMapInfo<unsigned>::getEmptyKey();
+ }
+ static inline unsigned getTombstoneKey() {
+ return DenseMapInfo<unsigned>::getTombstoneKey();
+ }
+ static unsigned getHashValue(const unsigned &Val) {
+ return DenseMapInfo<unsigned>::getHashValue(Val);
+ }
+ static bool isEqual(const unsigned &LHS, const unsigned &RHS) {
+ return DenseMapInfo<unsigned>::isEqual(LHS, RHS);
}
};
Index: llvm/include/llvm/CodeGen/Register.h
===================================================================
--- llvm/include/llvm/CodeGen/Register.h
+++ llvm/include/llvm/CodeGen/Register.h
@@ -117,12 +117,17 @@
// Provide DenseMapInfo for Register
template<> struct DenseMapInfo<Register> {
- static inline unsigned getEmptyKey() { return ~0U; }
- static inline unsigned getTombstoneKey() { return ~0U - 1; }
- static unsigned getHashValue(const unsigned& Val) { return Val * 37U; }
-
- static bool isEqual(const unsigned& LHS, const unsigned& RHS) {
- return LHS == RHS;
+ static inline unsigned getEmptyKey() {
+ return DenseMapInfo<unsigned>::getEmptyKey();
+ }
+ static inline unsigned getTombstoneKey() {
+ return DenseMapInfo<unsigned>::getTombstoneKey();
+ }
+ static unsigned getHashValue(const unsigned &Val) {
+ return DenseMapInfo<unsigned>::getHashValue(Val);
+ }
+ static bool isEqual(const unsigned &LHS, const unsigned &RHS) {
+ return DenseMapInfo<unsigned>::isEqual(LHS, RHS);
}
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65605.212943.patch
Type: text/x-patch
Size: 2538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190802/39e3214b/attachment-0001.bin>
More information about the llvm-commits
mailing list