Revert r354244 "[DAGCombiner] Eliminate dead stores to stack."
[llvm-complete.git] / lib / Target / AMDGPU / AMDGPURegisterBankInfo.h
blob9cb7a7f8a23c3b952080431fdc7341bbce668e53
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 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPUREGISTERBANKINFO_H
14 #define LLVM_LIB_TARGET_AMDGPU_AMDGPUREGISTERBANKINFO_H
16 #include "llvm/CodeGen/GlobalISel/RegisterBankInfo.h"
18 #define GET_REGBANK_DECLARATIONS
19 #include "AMDGPUGenRegisterBank.inc"
20 #undef GET_REGBANK_DECLARATIONS
22 namespace llvm {
24 class MachineIRBuilder;
25 class SIRegisterInfo;
26 class TargetRegisterInfo;
28 /// This class provides the information for the target register banks.
29 class AMDGPUGenRegisterBankInfo : public RegisterBankInfo {
31 protected:
33 #define GET_TARGET_REGBANK_CLASS
34 #include "AMDGPUGenRegisterBank.inc"
36 class AMDGPURegisterBankInfo : public AMDGPUGenRegisterBankInfo {
37 const SIRegisterInfo *TRI;
39 /// See RegisterBankInfo::applyMapping.
40 void applyMappingImpl(const OperandsMapper &OpdMapper) const override;
42 const RegisterBankInfo::InstructionMapping &
43 getInstrMappingForLoad(const MachineInstr &MI) const;
45 unsigned getRegBankID(unsigned Reg, const MachineRegisterInfo &MRI,
46 const TargetRegisterInfo &TRI,
47 unsigned Default = AMDGPU::VGPRRegBankID) const;
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,
52 SmallVector<unsigned, 2> &Regs,
53 unsigned Reg) const;
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:
61 AMDGPURegisterBankInfo(const TargetRegisterInfo &TRI);
63 unsigned copyCost(const RegisterBank &A, const RegisterBank &B,
64 unsigned Size) const override;
66 unsigned getBreakDownCost(const ValueMapping &ValMapping,
67 const RegisterBank *CurBank = nullptr) const override;
69 const RegisterBank &
70 getRegBankFromRegClass(const TargetRegisterClass &RC) const override;
72 InstructionMappings
73 getInstrAlternativeMappings(const MachineInstr &MI) const override;
75 const InstructionMapping &
76 getInstrMapping(const MachineInstr &MI) const override;
78 } // End llvm namespace.
79 #endif