LLVM  5.0.0
AArch64RegisterBankInfo.h
Go to the documentation of this file.
1 //===- AArch64RegisterBankInfo -----------------------------------*- C++ -*-==//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 /// \file
10 /// This file declares the targeting of the RegisterBankInfo class for AArch64.
11 /// \todo This should be generated by TableGen.
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64REGISTERBANKINFO_H
15 #define LLVM_LIB_TARGET_AARCH64_AARCH64REGISTERBANKINFO_H
16 
18 
19 #define GET_REGBANK_DECLARATIONS
20 #include "AArch64GenRegisterBank.inc"
21 
22 namespace llvm {
23 
24 class TargetRegisterInfo;
25 
27 protected:
28 
30  PMI_None = -1,
31  PMI_FPR32 = 1,
43  };
44 
48 
57  };
58 
59  static bool checkPartialMap(unsigned Idx, unsigned ValStartIdx,
60  unsigned ValLength, const RegisterBank &RB);
61  static bool checkValueMapImpl(unsigned Idx, unsigned FirstInBank,
62  unsigned Size, unsigned Offset);
63  static bool checkPartialMappingIdx(PartialMappingIdx FirstAlias,
64  PartialMappingIdx LastAlias,
66 
67  static unsigned getRegBankBaseIdxOffset(unsigned RBIdx, unsigned Size);
68 
69  /// Get the pointer to the ValueMapping representing the RegisterBank
70  /// at \p RBIdx with a size of \p Size.
71  ///
72  /// The returned mapping works for instructions with the same kind of
73  /// operands for up to 3 operands.
74  ///
75  /// \pre \p RBIdx != PartialMappingIdx::None
76  static const RegisterBankInfo::ValueMapping *
77  getValueMapping(PartialMappingIdx RBIdx, unsigned Size);
78 
79  /// Get the pointer to the ValueMapping of the operands of a copy
80  /// instruction from the \p SrcBankID register bank to the \p DstBankID
81  /// register bank with a size of \p Size.
82  static const RegisterBankInfo::ValueMapping *
83  getCopyMapping(unsigned DstBankID, unsigned SrcBankID, unsigned Size);
84 
85 #define GET_TARGET_REGBANK_CLASS
86 #include "AArch64GenRegisterBank.inc"
87 };
88 
89 /// This class provides the information for the target register banks.
91  /// See RegisterBankInfo::applyMapping.
92  void applyMappingImpl(const OperandsMapper &OpdMapper) const override;
93 
94  /// Get an instruction mapping where all the operands map to
95  /// the same register bank and have similar size.
96  ///
97  /// \pre MI.getNumOperands() <= 3
98  ///
99  /// \return An InstructionMappings with a statically allocated
100  /// OperandsMapping.
101  const InstructionMapping &
102  getSameKindOfOperandsMapping(const MachineInstr &MI) const;
103 
104 public:
106 
107  unsigned copyCost(const RegisterBank &A, const RegisterBank &B,
108  unsigned Size) const override;
109 
110  const RegisterBank &
111  getRegBankFromRegClass(const TargetRegisterClass &RC) const override;
112 
114  getInstrAlternativeMappings(const MachineInstr &MI) const override;
115 
116  const InstructionMapping &
117  getInstrMapping(const MachineInstr &MI) const override;
118 };
119 } // End llvm namespace.
120 #endif
AArch64RegisterBankInfo(const TargetRegisterInfo &TRI)
static const RegisterBankInfo::ValueMapping * getCopyMapping(unsigned DstBankID, unsigned SrcBankID, unsigned Size)
Get the pointer to the ValueMapping of the operands of a copy instruction from the SrcBankID register...
Helper class that represents how the value of an instruction may be mapped and what is the related co...
static bool checkPartialMappingIdx(PartialMappingIdx FirstAlias, PartialMappingIdx LastAlias, ArrayRef< PartialMappingIdx > Order)
Helper class used to get/create the virtual registers that will be used to replace the MachineOperand...
Holds all the information related to register banks.
static RegisterBankInfo::ValueMapping ValMappings[]
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
Definition: APInt.h:33
static bool checkPartialMap(unsigned Idx, unsigned ValStartIdx, unsigned ValLength, const RegisterBank &RB)
#define A
Definition: LargeTest.cpp:12
Helper struct that represents how a value is partially mapped into a register.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
#define B
Definition: LargeTest.cpp:24
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:861
InstructionMappings getInstrAlternativeMappings(const MachineInstr &MI) const override
Get the alternative mappings for MI.
unsigned copyCost(const RegisterBank &A, const RegisterBank &B, unsigned Size) const override
Get the cost of a copy from B to A, or put differently, get the cost of A = COPY B.
static unsigned getRegBankBaseIdxOffset(unsigned RBIdx, unsigned Size)
This class implements the register bank concept.
Definition: RegisterBank.h:29
Helper struct that represents how a value is mapped through different register banks.
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
static const RegisterBankInfo::ValueMapping * getValueMapping(PartialMappingIdx RBIdx, unsigned Size)
Get the pointer to the ValueMapping representing the RegisterBank at RBIdx with a size of Size...
Representation of each machine instruction.
Definition: MachineInstr.h:59
This class provides the information for the target register banks.
const InstructionMapping & getInstrMapping(const MachineInstr &MI) const override
Get the mapping of the different operands of MI on the register bank.
static bool checkValueMapImpl(unsigned Idx, unsigned FirstInBank, unsigned Size, unsigned Offset)
static PartialMappingIdx BankIDToCopyMapIdx[]
IRTranslator LLVM IR MI
const RegisterBank & getRegBankFromRegClass(const TargetRegisterClass &RC) const override
Get a register bank that covers RC.
static RegisterBankInfo::PartialMapping PartMappings[]