@@ -39,6 +39,8 @@ MCSymbol *MCResourceInfo::getSymbol(StringRef FuncName, ResourceInfoKind RIK,
39
39
return GOCS (" .num_agpr" );
40
40
case RIK_NumSGPR:
41
41
return GOCS (" .numbered_sgpr" );
42
+ case RIK_NumNamedBarrier:
43
+ return GOCS (" .num_named_barrier" );
42
44
case RIK_PrivateSegSize:
43
45
return GOCS (" .private_seg_size" );
44
46
case RIK_UsesVCC:
@@ -66,6 +68,7 @@ void MCResourceInfo::assignMaxRegs(MCContext &OutContext) {
66
68
MCSymbol *MaxVGPRSym = getMaxVGPRSymbol (OutContext);
67
69
MCSymbol *MaxAGPRSym = getMaxAGPRSymbol (OutContext);
68
70
MCSymbol *MaxSGPRSym = getMaxSGPRSymbol (OutContext);
71
+ MCSymbol *MaxNamedBarrierSym = getMaxNamedBarrierSymbol (OutContext);
69
72
70
73
auto assignMaxRegSym = [&OutContext](MCSymbol *Sym, int32_t RegCount) {
71
74
const MCExpr *MaxExpr = MCConstantExpr::create (RegCount, OutContext);
@@ -75,6 +78,7 @@ void MCResourceInfo::assignMaxRegs(MCContext &OutContext) {
75
78
assignMaxRegSym (MaxVGPRSym, MaxVGPR);
76
79
assignMaxRegSym (MaxAGPRSym, MaxAGPR);
77
80
assignMaxRegSym (MaxSGPRSym, MaxSGPR);
81
+ assignMaxRegSym (MaxNamedBarrierSym, MaxNamedBarrier);
78
82
}
79
83
80
84
void MCResourceInfo::reset () { *this = MCResourceInfo (); }
@@ -97,6 +101,10 @@ MCSymbol *MCResourceInfo::getMaxSGPRSymbol(MCContext &OutContext) {
97
101
return OutContext.getOrCreateSymbol (" amdgpu.max_num_sgpr" );
98
102
}
99
103
104
+ MCSymbol *MCResourceInfo::getMaxNamedBarrierSymbol (MCContext &OutContext) {
105
+ return OutContext.getOrCreateSymbol (" amdgpu.max_num_named_barrier" );
106
+ }
107
+
100
108
// Tries to flatten recursive call register resource gathering. Simple cycle
101
109
// avoiding dfs to find the constants in the propagated symbols.
102
110
// Assumes:
@@ -227,6 +235,10 @@ void MCResourceInfo::assignResourceInfoExpr(
227
235
case RIK_NumAGPR:
228
236
ArgExprs.push_back (flattenedCycleMax (CalleeValSym, RIK, OutContext));
229
237
break ;
238
+ case RIK_NumNamedBarrier:
239
+ ArgExprs.push_back (MCSymbolRefExpr::create (
240
+ getMaxNamedBarrierSymbol (OutContext), OutContext));
241
+ break ;
230
242
}
231
243
}
232
244
}
@@ -245,11 +257,13 @@ void MCResourceInfo::gatherResourceInfo(
245
257
MCSymbol *MaxAGPRSym = getMaxAGPRSymbol (OutContext);
246
258
MCSymbol *MaxSGPRSym = getMaxSGPRSymbol (OutContext);
247
259
bool IsLocal = MF.getFunction ().hasLocalLinkage ();
260
+ MCSymbol *MaxNamedBarrierSym = getMaxNamedBarrierSymbol (OutContext);
248
261
249
262
if (!AMDGPU::isEntryFunctionCC (MF.getFunction ().getCallingConv ())) {
250
263
addMaxVGPRCandidate (FRI.NumVGPR );
251
264
addMaxAGPRCandidate (FRI.NumAGPR );
252
265
addMaxSGPRCandidate (FRI.NumExplicitSGPR );
266
+ addMaxNamedBarrierCandidate (FRI.NumNamedBarrier );
253
267
}
254
268
255
269
const TargetMachine &TM = MF.getTarget ();
@@ -288,6 +302,7 @@ void MCResourceInfo::gatherResourceInfo(
288
302
SetMaxReg (MaxVGPRSym, FRI.NumVGPR , RIK_NumVGPR);
289
303
SetMaxReg (MaxAGPRSym, FRI.NumAGPR , RIK_NumAGPR);
290
304
SetMaxReg (MaxSGPRSym, FRI.NumExplicitSGPR , RIK_NumSGPR);
305
+ SetMaxReg (MaxNamedBarrierSym, FRI.NumNamedBarrier , RIK_NumNamedBarrier);
291
306
292
307
{
293
308
// The expression for private segment size should be: FRI.PrivateSegmentSize
0 commit comments