LLVM 20.0.0git
AMDGPURegBankSelect.cpp
Go to the documentation of this file.
1//===-- AMDGPURegBankSelect.cpp -------------------------------------------===//
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//
9/// Assign register banks to all register operands of G_ instructions using
10/// machine uniformity analysis.
11/// Sgpr - uniform values and some lane masks
12/// Vgpr - divergent, non S1, values
13/// Vcc - divergent S1 values(lane masks)
14/// However in some cases G_ instructions with this register bank assignment
15/// can't be inst-selected. This is solved in AMDGPURegBankLegalize.
16//===----------------------------------------------------------------------===//
17
18#include "AMDGPU.h"
21
22#define DEBUG_TYPE "amdgpu-regbankselect"
23
24using namespace llvm;
25
26namespace {
27
28class AMDGPURegBankSelect : public MachineFunctionPass {
29public:
30 static char ID;
31
32 AMDGPURegBankSelect() : MachineFunctionPass(ID) {
34 }
35
36 bool runOnMachineFunction(MachineFunction &MF) override;
37
38 StringRef getPassName() const override {
39 return "AMDGPU Register Bank Select";
40 }
41
42 void getAnalysisUsage(AnalysisUsage &AU) const override {
44 }
45
46 // This pass assigns register banks to all virtual registers, and we maintain
47 // this property in subsequent passes
50 MachineFunctionProperties::Property::RegBankSelected);
51 }
52};
53
54} // End anonymous namespace.
55
56INITIALIZE_PASS_BEGIN(AMDGPURegBankSelect, DEBUG_TYPE,
57 "AMDGPU Register Bank Select", false, false)
58INITIALIZE_PASS_END(AMDGPURegBankSelect, DEBUG_TYPE,
59 "AMDGPU Register Bank Select", false, false)
60
61char AMDGPURegBankSelect::ID = 0;
62
63char &llvm::AMDGPURegBankSelectID = AMDGPURegBankSelect::ID;
64
66 return new AMDGPURegBankSelect();
67}
68
69bool AMDGPURegBankSelect::runOnMachineFunction(MachineFunction &MF) {
71 MachineFunctionProperties::Property::FailedISel))
72 return false;
73 return true;
74}
AMDGPU Register Bank Select
#define DEBUG_TYPE
Assign register banks to all register operands of G_ instructions using machine uniformity analysis.
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:57
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:52
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:310
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
virtual MachineFunctionProperties getSetProperties() const
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
Properties which a MachineFunction may have at a given point in time.
MachineFunctionProperties & set(Property P)
bool hasProperty(Property P) const
const MachineFunctionProperties & getProperties() const
Get the function properties.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Definition: Pass.cpp:81
Wrapper class representing virtual and physical registers.
Definition: Register.h:19
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:51
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
char & AMDGPURegBankSelectID
FunctionPass * createAMDGPURegBankSelectPass()
void initializeAMDGPURegBankSelectPass(PassRegistry &)