LLVM 24.0.0git
AMDGPUMCResourceInfo.cpp
Go to the documentation of this file.
1//===- AMDGPUMCResourceInfo.cpp --- MC Resource Info ----------------------===//
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/// \file
10/// \brief MC infrastructure to propagate the function level resource usage
11/// info.
12///
13//===----------------------------------------------------------------------===//
14
18#include "llvm/ADT/STLExtras.h"
19#include "llvm/ADT/StringRef.h"
20#include "llvm/MC/MCAsmInfo.h"
21#include "llvm/MC/MCContext.h"
22#include "llvm/MC/MCSymbol.h"
24
25#define DEBUG_TYPE "amdgpu-mc-resource-usage"
26
27using namespace llvm;
28
30 MCContext &OutContext) {
31 auto GOCS = [FuncName, &OutContext](StringRef Suffix) {
32 StringRef Prefix = OutContext.getAsmInfo().getInternalSymbolPrefix();
33 return OutContext.getOrCreateSymbol(Twine(Prefix) + FuncName +
34 Twine(Suffix));
35 };
36 switch (RIK) {
37 case RIK_NumVGPR:
38 return GOCS(".num_vgpr");
39 case RIK_NumAGPR:
40 return GOCS(".num_agpr");
41 case RIK_NumSGPR:
42 return GOCS(".numbered_sgpr");
44 return GOCS(".num_named_barrier");
46 return GOCS(".private_seg_size");
47 case RIK_UsesVCC:
48 return GOCS(".uses_vcc");
50 return GOCS(".uses_flat_scratch");
52 return GOCS(".has_dyn_sized_stack");
54 return GOCS(".has_recursion");
56 return GOCS(".has_indirect_call");
57 }
58 llvm_unreachable("Unexpected ResourceInfoKind.");
59}
60
63 MCContext &Ctx) {
64 return MCSymbolRefExpr::create(getSymbol(FuncName, RIK, Ctx), Ctx);
65}
66
67void MCResourceInfo::assignMaxRegs(MCContext &OutContext) {
68 // Assign expression to get the max register use to the max_num_Xgpr symbol.
69 MCSymbol *MaxVGPRSym = getMaxVGPRSymbol(OutContext);
70 MCSymbol *MaxAGPRSym = getMaxAGPRSymbol(OutContext);
71 MCSymbol *MaxSGPRSym = getMaxSGPRSymbol(OutContext);
72 MCSymbol *MaxNamedBarrierSym = getMaxNamedBarrierSymbol(OutContext);
73
74 auto assignMaxRegSym = [&OutContext](MCSymbol *Sym, int32_t RegCount) {
75 const MCExpr *MaxExpr = MCConstantExpr::create(RegCount, OutContext);
76 Sym->setVariableValue(MaxExpr);
77 };
78
79 assignMaxRegSym(MaxVGPRSym, MaxVGPR);
80 assignMaxRegSym(MaxAGPRSym, MaxAGPR);
81 assignMaxRegSym(MaxSGPRSym, MaxSGPR);
82 assignMaxRegSym(MaxNamedBarrierSym, MaxNamedBarrier);
83}
84
86
88 assert(!Finalized && "Cannot finalize ResourceInfo again.");
89 Finalized = true;
90 assignMaxRegs(OutContext);
91}
92
94 return OutContext.getOrCreateSymbol("amdgpu.max_num_vgpr");
95}
96
98 return OutContext.getOrCreateSymbol("amdgpu.max_num_agpr");
99}
100
102 return OutContext.getOrCreateSymbol("amdgpu.max_num_sgpr");
103}
104
106 return OutContext.getOrCreateSymbol("amdgpu.max_num_named_barrier");
107}
108
109// Max and OR are associative and idempotent. Normalize the whole cyclic
110// assignment, folding its constants and retaining each unresolved outgoing
111// symbol once, using one visited set across all callees.
112const MCExpr *MCResourceInfo::flattenedCycleExpr(
113 MCSymbol *Sym, const MCExpr *Expr, int64_t LocalValue, ResourceInfoKind RIK,
114 AMDGPUMCExpr::VariantKind Kind, MCContext &OutContext) {
116 "expected an idempotent resource expression");
118 SmallPtrSet<const MCSymbol *, 8> UnresolvedSymbols;
119 SmallVector<const MCExpr *, 8> WorkList{Expr};
120 SmallVector<const MCExpr *, 8> Args{nullptr};
121 int64_t ConstantValue = 0;
122
123 while (!WorkList.empty()) {
124 const MCExpr *CurExpr = WorkList.pop_back_val();
125 if (!Seen.insert(CurExpr).second)
126 continue;
127
128 if (const auto *Constant = dyn_cast<MCConstantExpr>(CurExpr)) {
129 ConstantValue = Kind == AMDGPUMCExpr::AGVK_Max
130 ? std::max(ConstantValue, Constant->getValue())
131 : ConstantValue | Constant->getValue();
132 continue;
133 }
134
135 if (const auto *SymExpr = dyn_cast<MCSymbolRefExpr>(CurExpr)) {
136 const MCSymbol &Ref = SymExpr->getSymbol();
137 // The current function's local value is already part of the assignment.
138 // A reference to it through a call cycle contributes nothing further.
139 if (&Ref == Sym)
140 continue;
141 if (Ref.isVariable())
142 WorkList.push_back(Ref.getVariableValue());
143 else if (UnresolvedSymbols.insert(&Ref).second)
144 Args.push_back(CurExpr);
145 continue;
146 }
147
148 if (const auto *TargetExpr = dyn_cast<AMDGPUMCExpr>(CurExpr)) {
149 if (TargetExpr->getKind() == Kind) {
150 // Push in reverse order to preserve the original expression order.
151 append_range(WorkList, reverse(TargetExpr->getArgs()));
152 continue;
153 }
154 }
155
156 // Resource symbols currently consist only of constants, symbol references,
157 // and max/OR expressions. If that changes, an unfamiliar shape within a
158 // cyclic assignment must still produce a conservative value.
159 LLVM_DEBUG(dbgs() << "MCResUse: " << Sym->getName()
160 << ": Unexpected cyclic expression; using fallback\n");
161 MCSymbol *MaxSym;
162 switch (RIK) {
163 case RIK_NumVGPR:
164 MaxSym = getMaxVGPRSymbol(OutContext);
165 break;
166 case RIK_NumAGPR:
167 MaxSym = getMaxAGPRSymbol(OutContext);
168 break;
169 case RIK_NumSGPR:
170 MaxSym = getMaxSGPRSymbol(OutContext);
171 break;
173 MaxSym = getMaxNamedBarrierSymbol(OutContext);
174 break;
175 default:
176 return MCConstantExpr::create(1, OutContext);
177 }
178 // Entry functions do not contribute to the module maximum.
180 {MCConstantExpr::create(LocalValue, OutContext),
181 MCSymbolRefExpr::create(MaxSym, OutContext)},
182 OutContext);
183 }
184
185 // The normalized shape is max(<constant>, <unresolved symbol>...) for the
186 // counts and or(...) for the flags, with the constants folded into the first
187 // operand. If no unresolved symbol is left, it is just the constant.
188 Args.front() = MCConstantExpr::create(ConstantValue, OutContext);
189 if (Args.size() == 1)
190 return Args.front();
191 return AMDGPUMCExpr::create(Kind, Args, OutContext);
192}
193
194void MCResourceInfo::assignResourceInfoExpr(
195 int64_t LocalValue, ResourceInfoKind RIK, AMDGPUMCExpr::VariantKind Kind,
196 const MachineFunction &MF, const SmallVectorImpl<const Function *> &Callees,
197 MCContext &OutContext) {
198 const TargetMachine &TM = MF.getTarget();
199 MCSymbol *FnSym = TM.getSymbol(&MF.getFunction());
200 const MCConstantExpr *LocalConstExpr =
201 MCConstantExpr::create(LocalValue, OutContext);
202 const MCExpr *SymVal = LocalConstExpr;
203 MCSymbol *Sym = getSymbol(FnSym->getName(), RIK, OutContext);
204 LLVM_DEBUG(dbgs() << "MCResUse: " << Sym->getName() << ": Adding "
205 << LocalValue << " as function local usage\n");
206 if (!Callees.empty()) {
208 SmallPtrSet<const Function *, 8> Seen;
209 ArgExprs.push_back(LocalConstExpr);
210
211 for (const Function *Callee : Callees) {
212 if (!Seen.insert(Callee).second)
213 continue;
214
215 MCSymbol *CalleeFnSym = TM.getSymbol(&Callee->getFunction());
216 MCSymbol *CalleeValSym =
217 getSymbol(CalleeFnSym->getName(), RIK, OutContext);
218 LLVM_DEBUG(dbgs() << "MCResUse: " << Sym->getName() << ": Adding "
219 << CalleeValSym->getName() << " as callee\n");
220 ArgExprs.push_back(MCSymbolRefExpr::create(CalleeValSym, OutContext));
221 }
222 if (ArgExprs.size() > 1) {
223 SymVal = AMDGPUMCExpr::create(Kind, ArgExprs, OutContext);
224 // Detect the cycle once, then normalize the complete assignment. A
225 // single visited set folds shared subexpressions across every callee.
227 LLVM_DEBUG(dbgs() << "MCResUse: " << Sym->getName()
228 << ": Normalizing cyclic resource expression\n");
229 SymVal =
230 flattenedCycleExpr(Sym, SymVal, LocalValue, RIK, Kind, OutContext);
231 }
232 }
233 }
234 Sym->setVariableValue(SymVal);
235}
236
238 const MachineFunction &MF,
240 MCContext &OutContext) {
241 // Worst case VGPR use for non-hardware-entrypoints.
242 MCSymbol *MaxVGPRSym = getMaxVGPRSymbol(OutContext);
243 MCSymbol *MaxAGPRSym = getMaxAGPRSymbol(OutContext);
244 MCSymbol *MaxSGPRSym = getMaxSGPRSymbol(OutContext);
245 MCSymbol *MaxNamedBarrierSym = getMaxNamedBarrierSymbol(OutContext);
246
248 bool IsChainCC = AMDGPU::isChainCC(CC);
249 bool IsDynamicVGPREnabled =
250 MF.getInfo<SIMachineFunctionInfo>()->isDynamicVGPREnabled();
251
253 if (!IsDynamicVGPREnabled || !IsChainCC)
258 }
259
260 const TargetMachine &TM = MF.getTarget();
261 MCSymbol *FnSym = TM.getSymbol(&MF.getFunction());
262
263 LLVM_DEBUG(dbgs() << "MCResUse: Gathering resource information for "
264 << FnSym->getName() << '\n');
265
266 auto SetToLocal = [&](int64_t Value, ResourceInfoKind RIK) {
267 MCSymbol *Sym = getSymbol(FnSym->getName(), RIK, OutContext);
269 };
270
271 // When link-time object linking is enabled, set all resource symbols to
272 // concrete local values.
274 LLVM_DEBUG(dbgs() << "MCResUse: object linking enabled, no call-graph "
275 "propagation; emitting local resource values only\n");
276 SetToLocal(FRI.NumVGPR, RIK_NumVGPR);
277 SetToLocal(FRI.NumAGPR, RIK_NumAGPR);
278 SetToLocal(FRI.NumExplicitSGPR, RIK_NumSGPR);
279 SetToLocal(FRI.NumNamedBarrier, RIK_NumNamedBarrier);
280 SetToLocal(FRI.PrivateSegmentSize, RIK_PrivateSegSize);
281 SetToLocal(FRI.UsesVCC, RIK_UsesVCC);
282 SetToLocal(FRI.UsesFlatScratch, RIK_UsesFlatScratch);
284 SetToLocal(FRI.HasRecursion, RIK_HasRecursion);
285 SetToLocal(FRI.HasIndirectCall, RIK_HasIndirectCall);
286 return;
287 }
288
289 LLVM_DEBUG({
290 if (!FRI.Callees.empty()) {
291 dbgs() << "MCResUse: Callees:\n";
292 for (const Function *Callee : FRI.Callees) {
293 MCSymbol *CalleeFnSym = TM.getSymbol(&Callee->getFunction());
294 dbgs() << "MCResUse: " << CalleeFnSym->getName() << '\n';
295 }
296 }
297 });
298
299 auto SetMaxReg = [&](MCSymbol *MaxSym, int32_t numRegs,
300 ResourceInfoKind RIK) {
301 if (!FRI.HasIndirectCall) {
302 assignResourceInfoExpr(numRegs, RIK, AMDGPUMCExpr::AGVK_Max, MF,
303 FRI.Callees, OutContext);
304 } else {
305 const MCExpr *SymRef = MCSymbolRefExpr::create(MaxSym, OutContext);
306 MCSymbol *LocalNumSym = getSymbol(FnSym->getName(), RIK, OutContext);
307 const MCExpr *MaxWithLocal = AMDGPUMCExpr::createMax(
308 {MCConstantExpr::create(numRegs, OutContext), SymRef}, OutContext);
309 LocalNumSym->setVariableValue(MaxWithLocal);
310 LLVM_DEBUG(dbgs() << "MCResUse: " << LocalNumSym->getName()
311 << ": Indirect callee within, using module maximum\n");
312 }
313 };
314
315 LLVM_DEBUG(dbgs() << "MCResUse: " << FnSym->getName() << '\n');
316
317 // When DynamicVGPR is enabled, chain functions should not propagate VGPR
318 // counts from other chain callees since each chain function can have its own
319 // VGPR allocation, but should still propagate from non-chain callees.
320 if (IsDynamicVGPREnabled && (IsChainCC || CC == CallingConv::AMDGPU_CS)) {
321 if (FRI.HasNonChainIndirectCall) {
322 // Has indirect calls to non-chain functions. Use max of local count and
323 // module-wide non-chain maximum.
324 MCSymbol *Sym = getSymbol(FnSym->getName(), RIK_NumVGPR, OutContext);
326 {MCConstantExpr::create(FRI.NumVGPR, OutContext),
327 MCSymbolRefExpr::create(MaxVGPRSym, OutContext)},
328 OutContext));
329 SetMaxReg(MaxAGPRSym, FRI.NumAGPR, RIK_NumAGPR);
330 } else {
331 // No indirect calls to non-chain functions. Propagate from direct callees
332 assignResourceInfoExpr(FRI.NumVGPR, RIK_NumVGPR, AMDGPUMCExpr::AGVK_Max,
333 MF, FRI.Callees, OutContext);
334 assignResourceInfoExpr(FRI.NumAGPR, RIK_NumAGPR, AMDGPUMCExpr::AGVK_Max,
335 MF, FRI.Callees, OutContext);
336 }
337 } else {
338 SetMaxReg(MaxVGPRSym, FRI.NumVGPR, RIK_NumVGPR);
339 SetMaxReg(MaxAGPRSym, FRI.NumAGPR, RIK_NumAGPR);
340 }
341 SetMaxReg(MaxSGPRSym, FRI.NumExplicitSGPR, RIK_NumSGPR);
342 SetMaxReg(MaxNamedBarrierSym, FRI.NumNamedBarrier, RIK_NumNamedBarrier);
343
344 bool HasPrivateSegmentCycle = false;
345 {
346 // The expression for private segment size should be: FRI.PrivateSegmentSize
347 // + max(FRI.Callees, FRI.CalleeSegmentSize)
349 MCSymbol *Sym = getSymbol(FnSym->getName(), RIK_PrivateSegSize, OutContext);
350 if (FRI.CalleeSegmentSize) {
351 LLVM_DEBUG(dbgs() << "MCResUse: " << Sym->getName() << ": Adding "
352 << FRI.CalleeSegmentSize
353 << " for indirect/recursive callees within\n");
354 ArgExprs.push_back(
356 }
357
359 Seen.insert(&MF.getFunction());
360 for (const Function *Callee : FRI.Callees) {
361 if (!Seen.insert(Callee).second)
362 continue;
363
364 // Chain callees use the same stack space. Exclude them.
365 if (!Callee->isDeclaration() &&
366 !AMDGPU::isChainCC(Callee->getCallingConv())) {
367 MCSymbol *CalleeFnSym = TM.getSymbol(&Callee->getFunction());
368 MCSymbol *CalleeValSym =
369 getSymbol(CalleeFnSym->getName(), RIK_PrivateSegSize, OutContext);
370
371 // Avoid constructing recursive definitions by detecting whether `Sym`
372 // is found transitively within any of its `CalleeValSym`.
373 if (!CalleeValSym->isVariable() ||
375 Sym, CalleeValSym->getVariableValue())) {
376 LLVM_DEBUG(dbgs() << "MCResUse: " << Sym->getName() << ": Adding "
377 << CalleeValSym->getName() << " as callee\n");
378 ArgExprs.push_back(MCSymbolRefExpr::create(CalleeValSym, OutContext));
379 } else {
380 // Dropping this edge avoids a recursive MC expression, but it also
381 // means the finite private-segment expression is no longer a proven
382 // call-graph closure. Request dynamic-stack provisioning on versions
383 // that support it. This does not prove a bound for older versions.
384 HasPrivateSegmentCycle = true;
385 LLVM_DEBUG(dbgs() << "MCResUse: " << Sym->getName()
386 << ": Private-segment call cycle found; using "
387 "dynamic-stack fallback\n");
388 }
389 }
390 }
391 const MCExpr *localConstExpr =
393 LLVM_DEBUG(dbgs() << "MCResUse: " << Sym->getName() << ": Adding "
394 << FRI.PrivateSegmentSize
395 << " as function local usage\n");
396 if (!ArgExprs.empty()) {
397 const AMDGPUMCExpr *transitiveExpr =
398 AMDGPUMCExpr::createMax(ArgExprs, OutContext);
399 localConstExpr =
400 MCBinaryExpr::createAdd(localConstExpr, transitiveExpr, OutContext);
401 }
402 Sym->setVariableValue(localConstExpr);
403 }
404
405 if (!FRI.HasIndirectCall) {
406 assignResourceInfoExpr(FRI.UsesVCC, ResourceInfoKind::RIK_UsesVCC,
407 AMDGPUMCExpr::AGVK_Or, MF, FRI.Callees, OutContext);
408 assignResourceInfoExpr(FRI.UsesFlatScratch,
410 AMDGPUMCExpr::AGVK_Or, MF, FRI.Callees, OutContext);
411 assignResourceInfoExpr(FRI.HasDynamicallySizedStack,
413 AMDGPUMCExpr::AGVK_Or, MF, FRI.Callees, OutContext);
414 assignResourceInfoExpr(FRI.HasRecursion || HasPrivateSegmentCycle,
416 AMDGPUMCExpr::AGVK_Or, MF, FRI.Callees, OutContext);
417 assignResourceInfoExpr(FRI.HasIndirectCall,
419 AMDGPUMCExpr::AGVK_Or, MF, FRI.Callees, OutContext);
420 } else {
421 SetToLocal(FRI.UsesVCC, ResourceInfoKind::RIK_UsesVCC);
423 SetToLocal(FRI.HasDynamicallySizedStack,
425 SetToLocal(FRI.HasRecursion || HasPrivateSegmentCycle,
428 }
429}
430
432 MCContext &Ctx) {
433 const TargetMachine &TM = MF.getTarget();
434 MCSymbol *FnSym = TM.getSymbol(&MF.getFunction());
436 getSymRefExpr(FnSym->getName(), RIK_NumAGPR, Ctx),
437 getSymRefExpr(FnSym->getName(), RIK_NumVGPR, Ctx), Ctx);
438}
439
441 bool hasXnack,
442 MCContext &Ctx) {
443 const TargetMachine &TM = MF.getTarget();
444 MCSymbol *FnSym = TM.getSymbol(&MF.getFunction());
446 getSymRefExpr(FnSym->getName(), RIK_NumSGPR, Ctx),
448 getSymRefExpr(FnSym->getName(), RIK_UsesVCC, Ctx),
449 getSymRefExpr(FnSym->getName(), RIK_UsesFlatScratch, Ctx), hasXnack,
450 Ctx),
451 Ctx);
452}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MC infrastructure to propagate the function level resource usage info.
static constexpr Value * getValue(Ty &ValueOrUse)
RISCVCC::CondCode CC
This file contains some templates that are useful if you are working with the STL at all.
#define LLVM_DEBUG(...)
Definition Debug.h:119
AMDGPU target specific MCExpr operations.
static const AMDGPUMCExpr * createMax(ArrayRef< const MCExpr * > Args, MCContext &Ctx)
static const AMDGPUMCExpr * createTotalNumVGPR(const MCExpr *NumAGPR, const MCExpr *NumVGPR, MCContext &Ctx)
static const AMDGPUMCExpr * create(VariantKind Kind, ArrayRef< const MCExpr * > Args, MCContext &Ctx)
static const AMDGPUMCExpr * createExtraSGPRs(const MCExpr *VCCUsed, const MCExpr *FlatScrUsed, bool XNACKUsed, MCContext &Ctx)
Allow delayed MCExpr resolve of ExtraSGPRs (in case VCCUsed or FlatScrUsed are unresolvable but neede...
static bool isSymbolUsedInExpression(const MCSymbol *Sym, const MCExpr *E)
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
Definition Function.h:273
StringRef getInternalSymbolPrefix() const
Definition MCAsmInfo.h:594
static const MCBinaryExpr * createAdd(const MCExpr *LHS, const MCExpr *RHS, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.h:339
static LLVM_ABI const MCConstantExpr * create(int64_t Value, MCContext &Ctx, bool PrintInHex=false, unsigned SizeInBytes=0)
Definition MCExpr.cpp:212
Context object for machine code objects.
Definition MCContext.h:84
LLVM_ABI MCSymbol * getOrCreateSymbol(const Twine &Name)
Lookup the symbol inside with the specified Name.
const MCAsmInfo & getAsmInfo() const
Definition MCContext.h:409
Base class for the full range of assembler expressions which are needed for parsing.
Definition MCExpr.h:31
MCResourceInfo()=default
MCSymbol * getMaxNamedBarrierSymbol(MCContext &OutContext)
void addMaxSGPRCandidate(int32_t candidate)
const MCExpr * getSymRefExpr(StringRef FuncName, ResourceInfoKind RIK, MCContext &Ctx)
MCSymbol * getMaxSGPRSymbol(MCContext &OutContext)
void addMaxNamedBarrierCandidate(int32_t candidate)
MCSymbol * getMaxAGPRSymbol(MCContext &OutContext)
const MCExpr * createTotalNumVGPRs(const MachineFunction &MF, MCContext &Ctx)
void finalize(MCContext &OutContext)
void addMaxAGPRCandidate(int32_t candidate)
MCSymbol * getMaxVGPRSymbol(MCContext &OutContext)
const MCExpr * createTotalNumSGPRs(const MachineFunction &MF, bool hasXnack, MCContext &Ctx)
MCSymbol * getSymbol(StringRef FuncName, ResourceInfoKind RIK, MCContext &OutContext)
void addMaxVGPRCandidate(int32_t candidate)
void gatherResourceInfo(const MachineFunction &MF, const AMDGPUResourceUsageAnalysisWrapperPass::FunctionResourceInfo &FRI, MCContext &OutContext)
AMDGPUResourceUsageAnalysis gathers resource usage on a per-function granularity.
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
Definition MCExpr.h:210
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition MCSymbol.h:42
StringRef getName() const
getName - Get the symbol name.
Definition MCSymbol.h:188
bool isVariable() const
isVariable - Check if this is a variable symbol.
Definition MCSymbol.h:267
LLVM_ABI void setVariableValue(const MCExpr *Value)
Definition MCSymbol.cpp:51
const MCExpr * getVariableValue() const
Get the expression of the variable symbol.
Definition MCSymbol.h:270
Function & getFunction()
Return the LLVM function that this machine code represents.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
Primary interface to the complete machine description for the target machine.
MCSymbol * getSymbol(const GlobalValue *GV) const
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition Twine.h:82
LLVM Value Representation.
Definition Value.h:75
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
LLVM_READNONE constexpr bool isEntryFunctionCC(CallingConv::ID CC)
LLVM_READNONE constexpr bool isChainCC(CallingConv::ID CC)
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
@ AMDGPU_CS
Used for Mesa/AMDPAL compute shaders.
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:643
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
Definition STLExtras.h:2229
auto reverse(ContainerTy &&C)
Definition STLExtras.h:408
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition Debug.cpp:209
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
@ Ref
The access may reference the value stored in memory.
Definition ModRef.h:32
AMDGPUResourceUsageAnalysisImpl::SIFunctionResourceInfo FunctionResourceInfo