From 3acc199dde5f252bf3717ab7982f85e7f24ffeac Mon Sep 17 00:00:00 2001 From: Quentin Colombet Date: Wed, 6 Apr 2016 17:51:41 +0000 Subject: [PATCH] [RegisterBankInfo] Add a method to get the mapping RegClass -> RegBank. This should be TableGen'ed at some point. llvm-svn: 265574 --- .../llvm/CodeGen/GlobalISel/RegisterBankInfo.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h b/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h index 6469806dc9e..f78df0703af 100644 --- a/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h +++ b/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h @@ -195,6 +195,23 @@ public: /// Get the total number of register banks. unsigned getNumRegBanks() const { return NumRegBanks; } + /// Get a register bank that covers \p RC. + /// + /// \pre \p RC is a user-defined register class (as opposed as one + /// generated by TableGen). + /// + /// \note The mapping RC -> RegBank could be built while adding the + /// coverage for the register banks. However, we do not do it, because, + /// at least for now, we only need this information for register classes + /// that are used in the description of instruction. In other words, + /// there are just a handful of them and we do not want to waste space. + /// + /// \todo This should be TableGen'ed. + virtual const RegisterBank & + getRegBankFromRegClass(const TargetRegisterClass &RC) const { + llvm_unreachable("The target must override this method"); + } + /// Get the cost of a copy from \p B to \p A, or put differently, /// get the cost of A = COPY B. virtual unsigned copyCost(const RegisterBank &A,