@@ -81,12 +81,6 @@ class VGPRRegisterRegAlloc : public RegisterRegAllocBase<VGPRRegisterRegAlloc> {
81
81
: RegisterRegAllocBase(N, D, C) {}
82
82
};
83
83
84
- class WWMRegisterRegAlloc : public RegisterRegAllocBase <WWMRegisterRegAlloc> {
85
- public:
86
- WWMRegisterRegAlloc (const char *N, const char *D, FunctionPassCtor C)
87
- : RegisterRegAllocBase(N, D, C) {}
88
- };
89
-
90
84
static bool onlyAllocateSGPRs (const TargetRegisterInfo &TRI,
91
85
const MachineRegisterInfo &MRI,
92
86
const Register Reg) {
@@ -101,24 +95,13 @@ static bool onlyAllocateVGPRs(const TargetRegisterInfo &TRI,
101
95
return !static_cast <const SIRegisterInfo &>(TRI).isSGPRClass (RC);
102
96
}
103
97
104
- static bool onlyAllocateWWMRegs (const TargetRegisterInfo &TRI,
105
- const MachineRegisterInfo &MRI,
106
- const Register Reg) {
107
- const SIMachineFunctionInfo *MFI =
108
- MRI.getMF ().getInfo <SIMachineFunctionInfo>();
109
- const TargetRegisterClass *RC = MRI.getRegClass (Reg);
110
- return !static_cast <const SIRegisterInfo &>(TRI).isSGPRClass (RC) &&
111
- MFI->checkFlag (Reg, AMDGPU::VirtRegFlag::WWM_REG);
112
- }
113
-
114
- // / -{sgpr|wwm|vgpr}-regalloc=... command line option.
98
+ // / -{sgpr|vgpr}-regalloc=... command line option.
115
99
static FunctionPass *useDefaultRegisterAllocator () { return nullptr ; }
116
100
117
101
// / A dummy default pass factory indicates whether the register allocator is
118
102
// / overridden on the command line.
119
103
static llvm::once_flag InitializeDefaultSGPRRegisterAllocatorFlag;
120
104
static llvm::once_flag InitializeDefaultVGPRRegisterAllocatorFlag;
121
- static llvm::once_flag InitializeDefaultWWMRegisterAllocatorFlag;
122
105
123
106
static SGPRRegisterRegAlloc
124
107
defaultSGPRRegAlloc (" default" ,
@@ -135,11 +118,6 @@ static cl::opt<VGPRRegisterRegAlloc::FunctionPassCtor, false,
135
118
VGPRRegAlloc (" vgpr-regalloc" , cl::Hidden, cl::init(&useDefaultRegisterAllocator),
136
119
cl::desc (" Register allocator to use for VGPRs" ));
137
120
138
- static cl::opt<WWMRegisterRegAlloc::FunctionPassCtor, false ,
139
- RegisterPassParser<WWMRegisterRegAlloc>>
140
- WWMRegAlloc (" wwm-regalloc" , cl::Hidden,
141
- cl::init (&useDefaultRegisterAllocator),
142
- cl::desc(" Register allocator to use for WWM registers" ));
143
121
144
122
static void initializeDefaultSGPRRegisterAllocatorOnce () {
145
123
RegisterRegAlloc::FunctionPassCtor Ctor = SGPRRegisterRegAlloc::getDefault ();
@@ -159,15 +137,6 @@ static void initializeDefaultVGPRRegisterAllocatorOnce() {
159
137
}
160
138
}
161
139
162
- static void initializeDefaultWWMRegisterAllocatorOnce () {
163
- RegisterRegAlloc::FunctionPassCtor Ctor = WWMRegisterRegAlloc::getDefault ();
164
-
165
- if (!Ctor) {
166
- Ctor = WWMRegAlloc;
167
- WWMRegisterRegAlloc::setDefault (WWMRegAlloc);
168
- }
169
- }
170
-
171
140
static FunctionPass *createBasicSGPRRegisterAllocator () {
172
141
return createBasicRegisterAllocator (onlyAllocateSGPRs);
173
142
}
@@ -192,18 +161,6 @@ static FunctionPass *createFastVGPRRegisterAllocator() {
192
161
return createFastRegisterAllocator (onlyAllocateVGPRs, true );
193
162
}
194
163
195
- static FunctionPass *createBasicWWMRegisterAllocator () {
196
- return createBasicRegisterAllocator (onlyAllocateWWMRegs);
197
- }
198
-
199
- static FunctionPass *createGreedyWWMRegisterAllocator () {
200
- return createGreedyRegisterAllocator (onlyAllocateWWMRegs);
201
- }
202
-
203
- static FunctionPass *createFastWWMRegisterAllocator () {
204
- return createFastRegisterAllocator (onlyAllocateWWMRegs, false );
205
- }
206
-
207
164
static SGPRRegisterRegAlloc basicRegAllocSGPR (
208
165
" basic" , " basic register allocator" , createBasicSGPRRegisterAllocator);
209
166
static SGPRRegisterRegAlloc greedyRegAllocSGPR (
@@ -220,16 +177,7 @@ static VGPRRegisterRegAlloc greedyRegAllocVGPR(
220
177
221
178
static VGPRRegisterRegAlloc fastRegAllocVGPR (
222
179
" fast" , " fast register allocator" , createFastVGPRRegisterAllocator);
223
-
224
- static WWMRegisterRegAlloc basicRegAllocWWMReg (" basic" ,
225
- " basic register allocator" ,
226
- createBasicWWMRegisterAllocator);
227
- static WWMRegisterRegAlloc
228
- greedyRegAllocWWMReg (" greedy" , " greedy register allocator" ,
229
- createGreedyWWMRegisterAllocator);
230
- static WWMRegisterRegAlloc fastRegAllocWWMReg (" fast" , " fast register allocator" ,
231
- createFastWWMRegisterAllocator);
232
- } // namespace
180
+ }
233
181
234
182
static cl::opt<bool >
235
183
EnableEarlyIfConversion (" amdgpu-early-ifcvt" , cl::Hidden,
@@ -477,7 +425,6 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget() {
477
425
initializeAMDGPURemoveIncompatibleFunctionsPass (*PR);
478
426
initializeAMDGPUSwLowerLDSLegacyPass (*PR);
479
427
initializeAMDGPULowerModuleLDSLegacyPass (*PR);
480
- initializeAMDGPUReserveWWMRegsPass (*PR);
481
428
initializeAMDGPURewriteOutArgumentsPass (*PR);
482
429
initializeAMDGPURewriteUndefForPHILegacyPass (*PR);
483
430
initializeAMDGPUUnifyMetadataPass (*PR);
@@ -1067,7 +1014,6 @@ class GCNPassConfig final : public AMDGPUPassConfig {
1067
1014
1068
1015
FunctionPass *createSGPRAllocPass (bool Optimized);
1069
1016
FunctionPass *createVGPRAllocPass (bool Optimized);
1070
- FunctionPass *createWWMRegAllocPass (bool Optimized);
1071
1017
FunctionPass *createRegAllocPass (bool Optimized) override ;
1072
1018
1073
1019
bool addRegAssignAndRewriteFast () override ;
@@ -1464,6 +1410,7 @@ void GCNPassConfig::addOptimizedRegAlloc() {
1464
1410
}
1465
1411
1466
1412
bool GCNPassConfig::addPreRewrite () {
1413
+ addPass (&SILowerWWMCopiesID);
1467
1414
if (EnableRegReassign)
1468
1415
addPass (&GCNNSAReassignID);
1469
1416
return true ;
@@ -1499,28 +1446,12 @@ FunctionPass *GCNPassConfig::createVGPRAllocPass(bool Optimized) {
1499
1446
return createFastVGPRRegisterAllocator ();
1500
1447
}
1501
1448
1502
- FunctionPass *GCNPassConfig::createWWMRegAllocPass (bool Optimized) {
1503
- // Initialize the global default.
1504
- llvm::call_once (InitializeDefaultWWMRegisterAllocatorFlag,
1505
- initializeDefaultWWMRegisterAllocatorOnce);
1506
-
1507
- RegisterRegAlloc::FunctionPassCtor Ctor = WWMRegisterRegAlloc::getDefault ();
1508
- if (Ctor != useDefaultRegisterAllocator)
1509
- return Ctor ();
1510
-
1511
- if (Optimized)
1512
- return createGreedyWWMRegisterAllocator ();
1513
-
1514
- return createFastWWMRegisterAllocator ();
1515
- }
1516
-
1517
1449
FunctionPass *GCNPassConfig::createRegAllocPass (bool Optimized) {
1518
1450
llvm_unreachable (" should not be used" );
1519
1451
}
1520
1452
1521
1453
static const char RegAllocOptNotSupportedMessage[] =
1522
- " -regalloc not supported with amdgcn. Use -sgpr-regalloc, -wwm-regalloc, "
1523
- " and -vgpr-regalloc" ;
1454
+ " -regalloc not supported with amdgcn. Use -sgpr-regalloc and -vgpr-regalloc" ;
1524
1455
1525
1456
bool GCNPassConfig::addRegAssignAndRewriteFast () {
1526
1457
if (!usingDefaultRegAlloc ())
@@ -1532,19 +1463,11 @@ bool GCNPassConfig::addRegAssignAndRewriteFast() {
1532
1463
1533
1464
// Equivalent of PEI for SGPRs.
1534
1465
addPass (&SILowerSGPRSpillsID);
1535
-
1536
- // To Allocate wwm registers used in whole quad mode operations (for shaders).
1537
1466
addPass (&SIPreAllocateWWMRegsID);
1538
1467
1539
- // For allocating other wwm register operands.
1540
- addPass (createWWMRegAllocPass (false ));
1541
-
1542
- addPass (&SILowerWWMCopiesID);
1543
- addPass (&AMDGPUReserveWWMRegsID);
1544
-
1545
- // For allocating regular VGPRs.
1546
1468
addPass (createVGPRAllocPass (false ));
1547
1469
1470
+ addPass (&SILowerWWMCopiesID);
1548
1471
return true ;
1549
1472
}
1550
1473
@@ -1564,17 +1487,8 @@ bool GCNPassConfig::addRegAssignAndRewriteOptimized() {
1564
1487
1565
1488
// Equivalent of PEI for SGPRs.
1566
1489
addPass (&SILowerSGPRSpillsID);
1567
-
1568
- // To Allocate wwm registers used in whole quad mode operations (for shaders).
1569
1490
addPass (&SIPreAllocateWWMRegsID);
1570
1491
1571
- // For allocating other whole wave mode registers.
1572
- addPass (createWWMRegAllocPass (true ));
1573
- addPass (&SILowerWWMCopiesID);
1574
- addPass (createVirtRegRewriter (false ));
1575
- addPass (&AMDGPUReserveWWMRegsID);
1576
-
1577
- // For allocating regular VGPRs.
1578
1492
addPass (createVGPRAllocPass (true ));
1579
1493
1580
1494
addPreRewrite ();
0 commit comments