[llvm] [TRI][RISCV] Add methods to get common register class of two registers (PR #118435)
Paul Kirth via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 4 18:13:18 PST 2024
================
@@ -222,6 +222,25 @@ TargetRegisterInfo::getMinimalPhysRegClass(MCRegister reg, MVT VT) const {
return BestRC;
}
+const TargetRegisterClass *TargetRegisterInfo::getCommonMinimalPhysRegClass(
----------------
ilovepi wrote:
The two functions are almost identical, can we maybe use a template to contain all the inner logic? The only difference I see that's hard to factor out is `Ty.isValid()` vs `VT == MVT::Other`. Since they're both `bool`s, maybe that could be passed in as a param, and the templating could take care of the rest?
Its very little code, but these kind of need to be kept in sync otherwise.
https://github.com/llvm/llvm-project/pull/118435
More information about the llvm-commits
mailing list