LLVM  9.0.0svn
AMDGPURegisterBankInfo.h
Go to the documentation of this file.
1 //===- AMDGPURegisterBankInfo -----------------------------------*- C++ -*-==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 /// This file declares the targeting of the RegisterBankInfo class for AMDGPU.
10 /// \todo This should be generated by TableGen.
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUREGISTERBANKINFO_H
14 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUREGISTERBANKINFO_H
15 
17 
18 #define GET_REGBANK_DECLARATIONS
19 #include "AMDGPUGenRegisterBank.inc"
20 #undef GET_REGBANK_DECLARATIONS
21 
22 namespace llvm {
23 
24 class MachineIRBuilder;
25 class SIRegisterInfo;
26 class TargetRegisterInfo;
27 
28 /// This class provides the information for the target register banks.
30 
31 protected:
32 
33 #define GET_TARGET_REGBANK_CLASS
34 #include "AMDGPUGenRegisterBank.inc"
35 };
37  const SIRegisterInfo *TRI;
38 
39  /// See RegisterBankInfo::applyMapping.
40  void applyMappingImpl(const OperandsMapper &OpdMapper) const override;
41 
43  getInstrMappingForLoad(const MachineInstr &MI) const;
44 
45  unsigned getRegBankID(unsigned Reg, const MachineRegisterInfo &MRI,
46  const TargetRegisterInfo &TRI,
47  unsigned Default = AMDGPU::VGPRRegBankID) const;
48 
49  /// Split 64-bit value \p Reg into two 32-bit halves and populate them into \p
50  /// Regs. This appropriately sets the regbank of the new registers.
51  void split64BitValueForMapping(MachineIRBuilder &B,
53  unsigned Reg) const;
54 
55  bool isSALUMapping(const MachineInstr &MI) const;
56  const InstructionMapping &getDefaultMappingSOP(const MachineInstr &MI) const;
57  const InstructionMapping &getDefaultMappingVOP(const MachineInstr &MI) const;
58  const InstructionMapping &getDefaultMappingAllVGPR(
59  const MachineInstr &MI) const;
60 public:
62 
63  unsigned copyCost(const RegisterBank &A, const RegisterBank &B,
64  unsigned Size) const override;
65 
66  unsigned getBreakDownCost(const ValueMapping &ValMapping,
67  const RegisterBank *CurBank = nullptr) const override;
68 
69  const RegisterBank &
70  getRegBankFromRegClass(const TargetRegisterClass &RC) const override;
71 
73  getInstrAlternativeMappings(const MachineInstr &MI) const override;
74 
75  const InstructionMapping &
76  getInstrMapping(const MachineInstr &MI) const override;
77 };
78 } // End llvm namespace.
79 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
Helper class that represents how the value of an instruction may be mapped and what is the related co...
unsigned Reg
Helper class used to get/create the virtual registers that will be used to replace the MachineOperand...
unsigned const TargetRegisterInfo * TRI
Holds all the information related to register banks.
virtual unsigned getBreakDownCost(const ValueMapping &ValMapping, const RegisterBank *CurBank=nullptr) const
Get the cost of using ValMapping to decompose a register.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
unsigned const MachineRegisterInfo * MRI
virtual const InstructionMapping & getInstrMapping(const MachineInstr &MI) const
Get the mapping of the different operands of MI on the register bank.
Helper class to build MachineInstr.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
This class implements the register bank concept.
Definition: RegisterBank.h:28
Helper struct that represents how a value is mapped through different register banks.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
Definition: MachineInstr.h:63
virtual void applyMappingImpl(const OperandsMapper &OpdMapper) const
See applyMapping.
virtual InstructionMappings getInstrAlternativeMappings(const MachineInstr &MI) const
Get the alternative mappings for MI.
virtual unsigned copyCost(const RegisterBank &A, const RegisterBank &B, unsigned Size) const
Get the cost of a copy from B to A, or put differently, get the cost of A = COPY B.
uint32_t Size
Definition: Profile.cpp:46
This class provides the information for the target register banks.
IRTranslator LLVM IR MI
virtual const RegisterBank & getRegBankFromRegClass(const TargetRegisterClass &RC) const
Get a register bank that covers RC.