1 //===- AArch64RegisterBankInfo -----------------------------------*- C++ -*-==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 /// This file declares the targeting of the RegisterBankInfo class for AArch64.
11 /// \todo This should be generated by TableGen.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64REGISTERBANKINFO_H
15 #define LLVM_LIB_TARGET_AARCH64_AARCH64REGISTERBANKINFO_H
17 #include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
21 class TargetRegisterInfo;
25 GPRRegBankID = 0, /// General Purpose Registers: W, X.
26 FPRRegBankID = 1, /// Floating Point/Vector Registers: B, H, S, D, Q.
27 CCRRegBankID = 2, /// Conditional register: NZCV.
30 } // End AArch64 namespace.
32 /// This class provides the information for the target register banks.
33 class AArch64RegisterBankInfo : public RegisterBankInfo {
34 /// See RegisterBankInfo::applyMapping.
35 void applyMappingImpl(const OperandsMapper &OpdMapper) const override;
38 AArch64RegisterBankInfo(const TargetRegisterInfo &TRI);
39 /// Get the cost of a copy from \p B to \p A, or put differently,
40 /// get the cost of A = COPY B. Since register banks may cover
41 /// different size, \p Size specifies what will be the size in bits
42 /// that will be copied around.
44 /// \note Since this is a copy, both registers have the same size.
45 unsigned copyCost(const RegisterBank &A, const RegisterBank &B,
46 unsigned Size) const override;
48 /// Get a register bank that covers \p RC.
50 /// \pre \p RC is a user-defined register class (as opposed as one
51 /// generated by TableGen).
53 /// \note The mapping RC -> RegBank could be built while adding the
54 /// coverage for the register banks. However, we do not do it, because,
55 /// at least for now, we only need this information for register classes
56 /// that are used in the description of instruction. In other words,
57 /// there are just a handful of them and we do not want to waste space.
59 /// \todo This should be TableGen'ed.
61 getRegBankFromRegClass(const TargetRegisterClass &RC) const override;
63 /// Get the alternative mappings for \p MI.
64 /// Alternative in the sense different from getInstrMapping.
66 getInstrAlternativeMappings(const MachineInstr &MI) const override;
68 } // End llvm namespace.