LLVM  14.0.0git
AMDGPUAttributor.cpp
Go to the documentation of this file.
1 //===- AMDGPUAttributor.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 /// \file This pass uses Attributor framework to deduce AMDGPU attributes.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "AMDGPU.h"
14 #include "GCNSubtarget.h"
16 #include "llvm/IR/IntrinsicsAMDGPU.h"
17 #include "llvm/IR/IntrinsicsR600.h"
20 
21 #define DEBUG_TYPE "amdgpu-attributor"
22 
23 using namespace llvm;
24 
27 
28  // SGPRs
29  DISPATCH_PTR = 1 << 0,
30  QUEUE_PTR = 1 << 1,
31  DISPATCH_ID = 1 << 2,
32  IMPLICIT_ARG_PTR = 1 << 3,
33  WORKGROUP_ID_X = 1 << 4,
34  WORKGROUP_ID_Y = 1 << 5,
35  WORKGROUP_ID_Z = 1 << 6,
36 
37  // VGPRS:
38  WORKITEM_ID_X = 1 << 7,
39  WORKITEM_ID_Y = 1 << 8,
40  WORKITEM_ID_Z = 1 << 9,
41  ALL_ARGUMENT_MASK = (1 << 10) - 1
42 };
43 
44 static constexpr std::pair<ImplicitArgumentMask,
46  {DISPATCH_PTR, "amdgpu-no-dispatch-ptr"},
47  {QUEUE_PTR, "amdgpu-no-queue-ptr"},
48  {DISPATCH_ID, "amdgpu-no-dispatch-id"},
49  {IMPLICIT_ARG_PTR, "amdgpu-no-implicitarg-ptr"},
50  {WORKGROUP_ID_X, "amdgpu-no-workgroup-id-x"},
51  {WORKGROUP_ID_Y, "amdgpu-no-workgroup-id-y"},
52  {WORKGROUP_ID_Z, "amdgpu-no-workgroup-id-z"},
53  {WORKITEM_ID_X, "amdgpu-no-workitem-id-x"},
54  {WORKITEM_ID_Y, "amdgpu-no-workitem-id-y"},
55  {WORKITEM_ID_Z, "amdgpu-no-workitem-id-z"}
56 };
57 
58 // We do not need to note the x workitem or workgroup id because they are always
59 // initialized.
60 //
61 // TODO: We should not add the attributes if the known compile time workgroup
62 // size is 1 for y/z.
64 intrinsicToAttrMask(Intrinsic::ID ID, bool &NonKernelOnly, bool &IsQueuePtr) {
65  switch (ID) {
66  case Intrinsic::amdgcn_workitem_id_x:
67  NonKernelOnly = true;
68  return WORKITEM_ID_X;
69  case Intrinsic::amdgcn_workgroup_id_x:
70  NonKernelOnly = true;
71  return WORKGROUP_ID_X;
72  case Intrinsic::amdgcn_workitem_id_y:
73  case Intrinsic::r600_read_tidig_y:
74  return WORKITEM_ID_Y;
75  case Intrinsic::amdgcn_workitem_id_z:
76  case Intrinsic::r600_read_tidig_z:
77  return WORKITEM_ID_Z;
78  case Intrinsic::amdgcn_workgroup_id_y:
79  case Intrinsic::r600_read_tgid_y:
80  return WORKGROUP_ID_Y;
81  case Intrinsic::amdgcn_workgroup_id_z:
82  case Intrinsic::r600_read_tgid_z:
83  return WORKGROUP_ID_Z;
84  case Intrinsic::amdgcn_dispatch_ptr:
85  return DISPATCH_PTR;
86  case Intrinsic::amdgcn_dispatch_id:
87  return DISPATCH_ID;
88  case Intrinsic::amdgcn_implicitarg_ptr:
89  return IMPLICIT_ARG_PTR;
90  case Intrinsic::amdgcn_queue_ptr:
91  case Intrinsic::amdgcn_is_shared:
92  case Intrinsic::amdgcn_is_private:
93  // TODO: Does not require queue ptr on gfx9+
94  case Intrinsic::trap:
95  case Intrinsic::debugtrap:
96  IsQueuePtr = true;
97  return QUEUE_PTR;
98  default:
99  return NOT_IMPLICIT_INPUT;
100  }
101 }
102 
103 static bool castRequiresQueuePtr(unsigned SrcAS) {
104  return SrcAS == AMDGPUAS::LOCAL_ADDRESS || SrcAS == AMDGPUAS::PRIVATE_ADDRESS;
105 }
106 
107 static bool isDSAddress(const Constant *C) {
108  const GlobalValue *GV = dyn_cast<GlobalValue>(C);
109  if (!GV)
110  return false;
111  unsigned AS = GV->getAddressSpace();
113 }
114 
116 public:
120  : InformationCache(M, AG, Allocator, CGSCC), TM(TM) {}
122 
123  enum ConstantStatus { DS_GLOBAL = 1 << 0, ADDR_SPACE_CAST = 1 << 1 };
124 
125  /// Check if the subtarget has aperture regs.
127  const GCNSubtarget &ST = TM.getSubtarget<GCNSubtarget>(F);
128  return ST.hasApertureRegs();
129  }
130 
131 private:
132  /// Check if the ConstantExpr \p CE requires queue ptr attribute.
133  static bool visitConstExpr(const ConstantExpr *CE) {
134  if (CE->getOpcode() == Instruction::AddrSpaceCast) {
135  unsigned SrcAS = CE->getOperand(0)->getType()->getPointerAddressSpace();
136  return castRequiresQueuePtr(SrcAS);
137  }
138  return false;
139  }
140 
141  /// Get the constant access bitmap for \p C.
142  uint8_t getConstantAccess(const Constant *C) {
143  auto It = ConstantStatus.find(C);
144  if (It != ConstantStatus.end())
145  return It->second;
146 
147  uint8_t Result = 0;
148  if (isDSAddress(C))
149  Result = DS_GLOBAL;
150 
151  if (const auto *CE = dyn_cast<ConstantExpr>(C))
152  if (visitConstExpr(CE))
153  Result |= ADDR_SPACE_CAST;
154 
155  for (const Use &U : C->operands()) {
156  const auto *OpC = dyn_cast<Constant>(U);
157  if (!OpC)
158  continue;
159 
160  Result |= getConstantAccess(OpC);
161  }
162  return Result;
163  }
164 
165 public:
166  /// Returns true if \p Fn needs a queue ptr attribute because of \p C.
167  bool needsQueuePtr(const Constant *C, Function &Fn) {
168  bool IsNonEntryFunc = !AMDGPU::isEntryFunctionCC(Fn.getCallingConv());
169  bool HasAperture = hasApertureRegs(Fn);
170 
171  // No need to explore the constants.
172  if (!IsNonEntryFunc && HasAperture)
173  return false;
174 
175  uint8_t Access = getConstantAccess(C);
176 
177  // We need to trap on DS globals in non-entry functions.
178  if (IsNonEntryFunc && (Access & DS_GLOBAL))
179  return true;
180 
181  return !HasAperture && (Access & ADDR_SPACE_CAST);
182  }
183 
184 private:
185  /// Used to determine if the Constant needs a queue ptr attribute.
187 };
188 
190  BitIntegerState<uint16_t, ALL_ARGUMENT_MASK, 0>, AbstractAttribute> {
193 
194  AAAMDAttributes(const IRPosition &IRP, Attributor &A) : Base(IRP) {}
195 
196  /// Create an abstract attribute view for the position \p IRP.
197  static AAAMDAttributes &createForPosition(const IRPosition &IRP,
198  Attributor &A);
199 
200  /// See AbstractAttribute::getName().
201  const std::string getName() const override { return "AAAMDAttributes"; }
202 
203  /// See AbstractAttribute::getIdAddr().
204  const char *getIdAddr() const override { return &ID; }
205 
206  /// This function should return true if the type of the \p AA is
207  /// AAAMDAttributes.
208  static bool classof(const AbstractAttribute *AA) {
209  return (AA->getIdAddr() == &ID);
210  }
211 
212  /// Unique ID (due to the unique address)
213  static const char ID;
214 };
215 const char AAAMDAttributes::ID = 0;
216 
218  : public StateWrapper<BooleanState, AbstractAttribute> {
221 
222  /// Create an abstract attribute view for the position \p IRP.
223  static AAUniformWorkGroupSize &createForPosition(const IRPosition &IRP,
224  Attributor &A);
225 
226  /// See AbstractAttribute::getName().
227  const std::string getName() const override {
228  return "AAUniformWorkGroupSize";
229  }
230 
231  /// See AbstractAttribute::getIdAddr().
232  const char *getIdAddr() const override { return &ID; }
233 
234  /// This function should return true if the type of the \p AA is
235  /// AAAMDAttributes.
236  static bool classof(const AbstractAttribute *AA) {
237  return (AA->getIdAddr() == &ID);
238  }
239 
240  /// Unique ID (due to the unique address)
241  static const char ID;
242 };
243 const char AAUniformWorkGroupSize::ID = 0;
244 
247  : AAUniformWorkGroupSize(IRP, A) {}
248 
249  void initialize(Attributor &A) override {
250  Function *F = getAssociatedFunction();
251  CallingConv::ID CC = F->getCallingConv();
252 
253  if (CC != CallingConv::AMDGPU_KERNEL)
254  return;
255 
256  bool InitialValue = false;
257  if (F->hasFnAttribute("uniform-work-group-size"))
258  InitialValue = F->getFnAttribute("uniform-work-group-size")
259  .getValueAsString()
260  .equals("true");
261 
262  if (InitialValue)
263  indicateOptimisticFixpoint();
264  else
265  indicatePessimisticFixpoint();
266  }
267 
270 
271  auto CheckCallSite = [&](AbstractCallSite CS) {
272  Function *Caller = CS.getInstruction()->getFunction();
273  LLVM_DEBUG(dbgs() << "[AAUniformWorkGroupSize] Call " << Caller->getName()
274  << "->" << getAssociatedFunction()->getName() << "\n");
275 
276  const auto &CallerInfo = A.getAAFor<AAUniformWorkGroupSize>(
277  *this, IRPosition::function(*Caller), DepClassTy::REQUIRED);
278 
279  Change = Change | clampStateAndIndicateChange(this->getState(),
280  CallerInfo.getState());
281 
282  return true;
283  };
284 
285  bool AllCallSitesKnown = true;
286  if (!A.checkForAllCallSites(CheckCallSite, *this, true, AllCallSitesKnown))
287  indicatePessimisticFixpoint();
288 
289  return Change;
290  }
291 
293  SmallVector<Attribute, 8> AttrList;
294  LLVMContext &Ctx = getAssociatedFunction()->getContext();
295 
296  AttrList.push_back(Attribute::get(Ctx, "uniform-work-group-size",
297  getAssumed() ? "true" : "false"));
298  return IRAttributeManifest::manifestAttrs(A, getIRPosition(), AttrList,
299  /* ForceReplace */ true);
300  }
301 
302  bool isValidState() const override {
303  // This state is always valid, even when the state is false.
304  return true;
305  }
306 
307  const std::string getAsStr() const override {
308  return "AMDWorkGroupSize[" + std::to_string(getAssumed()) + "]";
309  }
310 
311  /// See AbstractAttribute::trackStatistics()
312  void trackStatistics() const override {}
313 };
314 
317  Attributor &A) {
319  return *new (A.Allocator) AAUniformWorkGroupSizeFunction(IRP, A);
321  "AAUniformWorkGroupSize is only valid for function position");
322 }
323 
326  : AAAMDAttributes(IRP, A) {}
327 
328  void initialize(Attributor &A) override {
329  Function *F = getAssociatedFunction();
330  for (auto Attr : ImplicitAttrs) {
331  if (F->hasFnAttribute(Attr.second))
332  addKnownBits(Attr.first);
333  }
334 
335  if (F->isDeclaration())
336  return;
337 
338  // Ignore functions with graphics calling conventions, these are currently
339  // not allowed to have kernel arguments.
340  if (AMDGPU::isGraphics(F->getCallingConv())) {
341  indicatePessimisticFixpoint();
342  return;
343  }
344  }
345 
347  Function *F = getAssociatedFunction();
348  // The current assumed state used to determine a change.
349  auto OrigAssumed = getAssumed();
350 
351  // Check for Intrinsics and propagate attributes.
352  const AACallEdges &AAEdges = A.getAAFor<AACallEdges>(
353  *this, this->getIRPosition(), DepClassTy::REQUIRED);
354  if (AAEdges.hasNonAsmUnknownCallee())
355  return indicatePessimisticFixpoint();
356 
357  bool IsNonEntryFunc = !AMDGPU::isEntryFunctionCC(F->getCallingConv());
358  auto &InfoCache = static_cast<AMDGPUInformationCache &>(A.getInfoCache());
359 
360  bool NeedsQueuePtr = false;
361 
362  for (Function *Callee : AAEdges.getOptimisticEdges()) {
363  Intrinsic::ID IID = Callee->getIntrinsicID();
364  if (IID == Intrinsic::not_intrinsic) {
365  const AAAMDAttributes &AAAMD = A.getAAFor<AAAMDAttributes>(
367  *this &= AAAMD;
368  continue;
369  }
370 
371  bool NonKernelOnly = false;
372  ImplicitArgumentMask AttrMask =
373  intrinsicToAttrMask(IID, NonKernelOnly, NeedsQueuePtr);
374  if (AttrMask != NOT_IMPLICIT_INPUT) {
375  if ((IsNonEntryFunc || !NonKernelOnly))
376  removeAssumedBits(AttrMask);
377  }
378  }
379 
380  // If we found that we need amdgpu-queue-ptr, nothing else to do.
381  if (NeedsQueuePtr) {
382  removeAssumedBits(QUEUE_PTR);
383  return getAssumed() != OrigAssumed ? ChangeStatus::CHANGED :
385  }
386 
387  auto CheckAddrSpaceCasts = [&](Instruction &I) {
388  unsigned SrcAS = static_cast<AddrSpaceCastInst &>(I).getSrcAddressSpace();
389  if (castRequiresQueuePtr(SrcAS)) {
390  NeedsQueuePtr = true;
391  return false;
392  }
393  return true;
394  };
395 
396  bool HasApertureRegs = InfoCache.hasApertureRegs(*F);
397 
398  // `checkForAllInstructions` is much more cheaper than going through all
399  // instructions, try it first.
400 
401  // amdgpu-queue-ptr is not needed if aperture regs is present.
402  if (!HasApertureRegs) {
403  bool UsedAssumedInformation = false;
404  A.checkForAllInstructions(CheckAddrSpaceCasts, *this,
405  {Instruction::AddrSpaceCast},
406  UsedAssumedInformation);
407  }
408 
409  // If we found that we need amdgpu-queue-ptr, nothing else to do.
410  if (NeedsQueuePtr) {
411  removeAssumedBits(QUEUE_PTR);
412  return getAssumed() != OrigAssumed ? ChangeStatus::CHANGED :
414  }
415 
416  if (!IsNonEntryFunc && HasApertureRegs) {
417  return getAssumed() != OrigAssumed ? ChangeStatus::CHANGED :
419  }
420 
421  for (BasicBlock &BB : *F) {
422  for (Instruction &I : BB) {
423  for (const Use &U : I.operands()) {
424  if (const auto *C = dyn_cast<Constant>(U)) {
425  if (InfoCache.needsQueuePtr(C, *F)) {
426  removeAssumedBits(QUEUE_PTR);
427  return getAssumed() != OrigAssumed ? ChangeStatus::CHANGED :
429  }
430  }
431  }
432  }
433  }
434 
435  return getAssumed() != OrigAssumed ? ChangeStatus::CHANGED :
437  }
438 
440  SmallVector<Attribute, 8> AttrList;
441  LLVMContext &Ctx = getAssociatedFunction()->getContext();
442 
443  for (auto Attr : ImplicitAttrs) {
444  if (isKnown(Attr.first))
445  AttrList.push_back(Attribute::get(Ctx, Attr.second));
446  }
447 
448  return IRAttributeManifest::manifestAttrs(A, getIRPosition(), AttrList,
449  /* ForceReplace */ true);
450  }
451 
452  const std::string getAsStr() const override {
453  std::string Str;
454  raw_string_ostream OS(Str);
455  OS << "AMDInfo[";
456  for (auto Attr : ImplicitAttrs)
457  OS << ' ' << Attr.second;
458  OS << " ]";
459  return OS.str();
460  }
461 
462  /// See AbstractAttribute::trackStatistics()
463  void trackStatistics() const override {}
464 };
465 
467  Attributor &A) {
469  return *new (A.Allocator) AAAMDAttributesFunction(IRP, A);
470  llvm_unreachable("AAAMDAttributes is only valid for function position");
471 }
472 
473 class AMDGPUAttributor : public ModulePass {
474 public:
476 
477  /// doInitialization - Virtual method overridden by subclasses to do
478  /// any necessary initialization before any pass is run.
479  bool doInitialization(Module &) override {
480  auto *TPC = getAnalysisIfAvailable<TargetPassConfig>();
481  if (!TPC)
482  report_fatal_error("TargetMachine is required");
483 
484  TM = &TPC->getTM<TargetMachine>();
485  return false;
486  }
487 
488  bool runOnModule(Module &M) override {
489  SetVector<Function *> Functions;
490  AnalysisGetter AG;
491  for (Function &F : M) {
492  if (!F.isIntrinsic())
493  Functions.insert(&F);
494  }
495 
496  CallGraphUpdater CGUpdater;
498  AMDGPUInformationCache InfoCache(M, AG, Allocator, nullptr, *TM);
501 
502  Attributor A(Functions, InfoCache, CGUpdater, &Allowed);
503 
504  for (Function &F : M) {
505  if (!F.isIntrinsic()) {
506  A.getOrCreateAAFor<AAAMDAttributes>(IRPosition::function(F));
507  A.getOrCreateAAFor<AAUniformWorkGroupSize>(IRPosition::function(F));
508  }
509  }
510 
511  ChangeStatus Change = A.run();
512  return Change == ChangeStatus::CHANGED;
513  }
514 
515  StringRef getPassName() const override { return "AMDGPU Attributor"; }
517  static char ID;
518 };
519 
520 char AMDGPUAttributor::ID = 0;
521 
523 INITIALIZE_PASS(AMDGPUAttributor, DEBUG_TYPE, "AMDGPU Attributor", false, false)
AMDGPUInformationCache
Definition: AMDGPUAttributor.cpp:115
llvm::CallGraphUpdater
Wrapper to unify "old style" CallGraph and "new style" LazyCallGraph.
Definition: CallGraphUpdater.h:28
llvm::IRPosition::function
static const IRPosition function(const Function &F, const CallBaseContext *CBContext=nullptr)
Create a position describing the function scope of F.
Definition: Attributor.h:338
getName
static StringRef getName(Value *V)
Definition: ProvenanceAnalysisEvaluator.cpp:42
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
AAAMDAttributesFunction::updateImpl
ChangeStatus updateImpl(Attributor &A) override
The actual update/transfer function which has to be implemented by the derived classes.
Definition: AMDGPUAttributor.cpp:346
llvm::createAMDGPUAttributorPass
Pass * createAMDGPUAttributorPass()
Definition: AMDGPUAttributor.cpp:522
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
AAUniformWorkGroupSizeFunction::updateImpl
ChangeStatus updateImpl(Attributor &A) override
The actual update/transfer function which has to be implemented by the derived classes.
Definition: AMDGPUAttributor.cpp:268
llvm::ModulePass
ModulePass class - This class is used to implement unstructured interprocedural optimizations and ana...
Definition: Pass.h:238
AAUniformWorkGroupSizeFunction::manifest
ChangeStatus manifest(Attributor &A) override
Hook for the Attributor to trigger the manifestation of the information represented by the abstract a...
Definition: AMDGPUAttributor.cpp:292
ImplicitAttrs
static constexpr std::pair< ImplicitArgumentMask, StringLiteral > ImplicitAttrs[]
Definition: AMDGPUAttributor.cpp:45
WORKITEM_ID_Y
@ WORKITEM_ID_Y
Definition: AMDGPUAttributor.cpp:39
llvm::Function
Definition: Function.h:61
AMDGPUAttributor
Definition: AMDGPUAttributor.cpp:473
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:625
AMDGPUInformationCache::needsQueuePtr
bool needsQueuePtr(const Constant *C, Function &Fn)
Returns true if Fn needs a queue ptr attribute because of C.
Definition: AMDGPUAttributor.cpp:167
llvm::Attribute::get
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
Definition: Attributes.cpp:92
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1168
AAAMDAttributesFunction
Definition: AMDGPUAttributor.cpp:324
ImplicitArgumentMask
ImplicitArgumentMask
Definition: AMDGPUAttributor.cpp:25
llvm::StateWrapper
Helper to tie a abstract state implementation to an abstract attribute.
Definition: Attributor.h:2524
AAAMDAttributes
Definition: AMDGPUAttributor.cpp:189
AAUniformWorkGroupSize::getIdAddr
const char * getIdAddr() const override
See AbstractAttribute::getIdAddr().
Definition: AMDGPUAttributor.cpp:232
llvm::InformationCache
Data structure to hold cached (LLVM-IR) information.
Definition: Attributor.h:864
IMPLICIT_ARG_PTR
@ IMPLICIT_ARG_PTR
Definition: AMDGPUAttributor.cpp:32
llvm::GCNSubtarget
Definition: GCNSubtarget.h:31
llvm::Intrinsic::not_intrinsic
@ not_intrinsic
Definition: Intrinsics.h:45
llvm::AbstractCallSite
AbstractCallSite.
Definition: AbstractCallSite.h:50
AAUniformWorkGroupSize::createForPosition
static AAUniformWorkGroupSize & createForPosition(const IRPosition &IRP, Attributor &A)
Create an abstract attribute view for the position IRP.
Definition: AMDGPUAttributor.cpp:316
llvm::AACallEdges::hasNonAsmUnknownCallee
virtual bool hasNonAsmUnknownCallee() const =0
Is there any call with a unknown callee, excluding any inline asm.
AMDGPUAttributor::getPassName
StringRef getPassName() const override
getPassName - Return a nice clean name for a pass.
Definition: AMDGPUAttributor.cpp:515
AAAMDAttributesFunction::initialize
void initialize(Attributor &A) override
Initialize the state with the information in the Attributor A.
Definition: AMDGPUAttributor.cpp:328
LLVM_DEBUG
#define LLVM_DEBUG(X)
Definition: Debug.h:101
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::CallingConv::AMDGPU_KERNEL
@ AMDGPU_KERNEL
Calling convention for AMDGPU code object kernels.
Definition: CallingConv.h:216
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
AAAMDAttributesFunction::manifest
ChangeStatus manifest(Attributor &A) override
Hook for the Attributor to trigger the manifestation of the information represented by the abstract a...
Definition: AMDGPUAttributor.cpp:439
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
llvm::StringLiteral
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
Definition: StringRef.h:891
llvm::clampStateAndIndicateChange
ChangeStatus clampStateAndIndicateChange(StateType &S, const StateType &R)
Helper function to clamp a state S of type StateType with the information in R and indicate/return if...
Definition: Attributor.h:2749
TargetMachine.h
llvm::AddrSpaceCastInst
This class represents a conversion between pointers from one address space to another.
Definition: Instructions.h:5240
GCNSubtarget.h
llvm::ChangeStatus
ChangeStatus
{
Definition: Attributor.h:209
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
INITIALIZE_PASS
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
Definition: PassSupport.h:37
AAAMDAttributes::createForPosition
static AAAMDAttributes & createForPosition(const IRPosition &IRP, Attributor &A)
Create an abstract attribute view for the position IRP.
Definition: AMDGPUAttributor.cpp:466
NOT_IMPLICIT_INPUT
@ NOT_IMPLICIT_INPUT
Definition: AMDGPUAttributor.cpp:26
llvm::ms_demangle::QualifierMangleMode::Result
@ Result
AAUniformWorkGroupSizeFunction::AAUniformWorkGroupSizeFunction
AAUniformWorkGroupSizeFunction(const IRPosition &IRP, Attributor &A)
Definition: AMDGPUAttributor.cpp:246
llvm::Instruction
Definition: Instruction.h:45
llvm::IRPosition::getPositionKind
Kind getPositionKind() const
Return the associated position kind.
Definition: Attributor.h:535
llvm::report_fatal_error
void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
Definition: Error.cpp:140
AAAMDAttributesFunction::trackStatistics
void trackStatistics() const override
See AbstractAttribute::trackStatistics()
Definition: AMDGPUAttributor.cpp:463
AAUniformWorkGroupSize::ID
static const char ID
Unique ID (due to the unique address)
Definition: AMDGPUAttributor.cpp:241
WORKGROUP_ID_Y
@ WORKGROUP_ID_Y
Definition: AMDGPUAttributor.cpp:34
WORKITEM_ID_X
@ WORKITEM_ID_X
Definition: AMDGPUAttributor.cpp:38
AAUniformWorkGroupSize::AAUniformWorkGroupSize
AAUniformWorkGroupSize(const IRPosition &IRP, Attributor &A)
Definition: AMDGPUAttributor.cpp:220
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::AMDGPU::isEntryFunctionCC
bool isEntryFunctionCC(CallingConv::ID CC)
Definition: AMDGPUBaseInfo.cpp:1382
llvm::ARMBuildAttrs::Allowed
@ Allowed
Definition: ARMBuildAttributes.h:121
llvm::ChangeStatus::UNCHANGED
@ UNCHANGED
AAAMDAttributes::getName
const std::string getName() const override
See AbstractAttribute::getName().
Definition: AMDGPUAttributor.cpp:201
AAAMDAttributes::AAAMDAttributes
AAAMDAttributes(const IRPosition &IRP, Attributor &A)
Definition: AMDGPUAttributor.cpp:194
isDSAddress
static bool isDSAddress(const Constant *C)
Definition: AMDGPUAttributor.cpp:107
DEBUG_TYPE
#define DEBUG_TYPE
Definition: AMDGPUAttributor.cpp:21
llvm::DenseSet
Implements a dense probed hash-table based set.
Definition: DenseSet.h:268
AAAMDAttributesFunction::AAAMDAttributesFunction
AAAMDAttributesFunction(const IRPosition &IRP, Attributor &A)
Definition: AMDGPUAttributor.cpp:325
Attributor.h
llvm::GlobalValue
Definition: GlobalValue.h:44
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::AbstractAttribute
Base struct for all "concrete attribute" deductions.
Definition: Attributor.h:2629
llvm::DepClassTy::REQUIRED
@ REQUIRED
The target cannot be valid if the source is not.
llvm::Function::getCallingConv
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
Definition: Function.h:239
llvm::AACallEdges::ID
static const char ID
Unique ID (due to the unique address)
Definition: Attributor.h:4341
llvm::AACallEdges::getOptimisticEdges
virtual const SetVector< Function * > & getOptimisticEdges() const =0
Get the optimistic edges.
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
llvm::BumpPtrAllocatorImpl
Allocate memory in an ever growing pool, as if by bump-pointer.
Definition: Allocator.h:67
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
llvm::IRPosition::IRP_FUNCTION
@ IRP_FUNCTION
An attribute for a function (scope).
Definition: Attributor.h:315
llvm::DenseMap< const Constant *, uint8_t >
AMDGPUAttributor::TM
TargetMachine * TM
Definition: AMDGPUAttributor.cpp:516
I
#define I(x, y, z)
Definition: MD5.cpp:59
TargetPassConfig.h
AMDGPUInformationCache::hasApertureRegs
bool hasApertureRegs(Function &F)
Check if the subtarget has aperture regs.
Definition: AMDGPUAttributor.cpp:126
llvm::AMDGPUAS::LOCAL_ADDRESS
@ LOCAL_ADDRESS
Address space for local memory.
Definition: AMDGPU.h:354
intrinsicToAttrMask
static ImplicitArgumentMask intrinsicToAttrMask(Intrinsic::ID ID, bool &NonKernelOnly, bool &IsQueuePtr)
Definition: AMDGPUAttributor.cpp:64
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:79
llvm::IRPosition
Helper to describe and deal with positions in the LLVM-IR.
Definition: Attributor.h:303
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::SetVector::insert
bool insert(const value_type &X)
Insert a new element into the SetVector.
Definition: SetVector.h:141
llvm::AMDGPUAS::REGION_ADDRESS
@ REGION_ADDRESS
Address space for region memory. (GDS)
Definition: AMDGPU.h:351
castRequiresQueuePtr
static bool castRequiresQueuePtr(unsigned SrcAS)
Definition: AMDGPUAttributor.cpp:103
AMDGPUAttributor::ID
static char ID
Definition: AMDGPUAttributor.cpp:517
AAUniformWorkGroupSize
Definition: AMDGPUAttributor.cpp:217
llvm::CGSCC
@ CGSCC
Definition: Attributor.h:4618
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
AMDGPU.h
AMDGPUAttributor::AMDGPUAttributor
AMDGPUAttributor()
Definition: AMDGPUAttributor.cpp:475
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::IRAttributeManifest::manifestAttrs
static ChangeStatus manifestAttrs(Attributor &A, const IRPosition &IRP, const ArrayRef< Attribute > &DeducedAttrs, bool ForceReplace=false)
Definition: Attributor.cpp:485
DISPATCH_ID
@ DISPATCH_ID
Definition: AMDGPUAttributor.cpp:31
llvm::AMDGPU::isGraphics
bool isGraphics(CallingConv::ID cc)
Definition: AMDGPUBaseInfo.cpp:1374
llvm::ChangeStatus::CHANGED
@ CHANGED
llvm::AACallEdges
An abstract state for querying live call edges.
Definition: Attributor.h:4300
QUEUE_PTR
@ QUEUE_PTR
Definition: AMDGPUAttributor.cpp:30
Callee
amdgpu Simplify well known AMD library false FunctionCallee Callee
Definition: AMDGPULibCalls.cpp:206
AAUniformWorkGroupSize::classof
static bool classof(const AbstractAttribute *AA)
This function should return true if the type of the AA is AAAMDAttributes.
Definition: AMDGPUAttributor.cpp:236
llvm::AMDGPUAS::PRIVATE_ADDRESS
@ PRIVATE_ADDRESS
Address space for private memory.
Definition: AMDGPU.h:355
llvm::ConstantExpr
A constant value that is initialized with an expression using other constant values.
Definition: Constants.h:936
AAUniformWorkGroupSizeFunction::initialize
void initialize(Attributor &A) override
Initialize the state with the information in the Attributor A.
Definition: AMDGPUAttributor.cpp:249
AAAMDAttributes::getIdAddr
const char * getIdAddr() const override
See AbstractAttribute::getIdAddr().
Definition: AMDGPUAttributor.cpp:204
DISPATCH_PTR
@ DISPATCH_PTR
Definition: AMDGPUAttributor.cpp:29
AAAMDAttributesFunction::getAsStr
const std::string getAsStr() const override
This function should return the "summarized" assumed state as string.
Definition: AMDGPUAttributor.cpp:452
AMDGPUInformationCache::AMDGPUInformationCache
AMDGPUInformationCache(const Module &M, AnalysisGetter &AG, BumpPtrAllocator &Allocator, SetVector< Function * > *CGSCC, TargetMachine &TM)
Definition: AMDGPUAttributor.cpp:117
AAUniformWorkGroupSize::getName
const std::string getName() const override
See AbstractAttribute::getName().
Definition: AMDGPUAttributor.cpp:227
llvm::Attributor
The fixpoint analysis framework that orchestrates the attribute deduction.
Definition: Attributor.h:1139
WORKGROUP_ID_X
@ WORKGROUP_ID_X
Definition: AMDGPUAttributor.cpp:33
AMDGPUAttributor::doInitialization
bool doInitialization(Module &) override
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
Definition: AMDGPUAttributor.cpp:479
llvm::GlobalValue::getAddressSpace
unsigned getAddressSpace() const
Definition: Globals.cpp:112
llvm::Pass
Pass interface - Implemented by all 'passes'.
Definition: Pass.h:91
Allocator
Basic Register Allocator
Definition: RegAllocBasic.cpp:146
llvm::to_string
std::string to_string(const T &Value)
Definition: ScopedPrinter.h:63
llvm::AnalysisGetter
Wrapper for FunctoinAnalysisManager.
Definition: Attributor.h:837
AAUniformWorkGroupSizeFunction::isValidState
bool isValidState() const override
Return if this abstract state is in a valid state.
Definition: AMDGPUAttributor.cpp:302
AAAMDAttributes::classof
static bool classof(const AbstractAttribute *AA)
This function should return true if the type of the AA is AAAMDAttributes.
Definition: AMDGPUAttributor.cpp:208
AMDGPUInformationCache::ConstantStatus
ConstantStatus
Definition: AMDGPUAttributor.cpp:123
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
AAUniformWorkGroupSizeFunction
Definition: AMDGPUAttributor.cpp:245
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
AMDGPUAttributor::runOnModule
bool runOnModule(Module &M) override
runOnModule - Virtual method overriden by subclasses to process the module being operated on.
Definition: AMDGPUAttributor.cpp:488
AAUniformWorkGroupSizeFunction::getAsStr
const std::string getAsStr() const override
This function should return the "summarized" assumed state as string.
Definition: AMDGPUAttributor.cpp:307
AMDGPUInformationCache::TM
TargetMachine & TM
Definition: AMDGPUAttributor.cpp:121
WORKGROUP_ID_Z
@ WORKGROUP_ID_Z
Definition: AMDGPUAttributor.cpp:35
llvm::SetVector< Function * >
AAAMDAttributes::ID
static const char ID
Unique ID (due to the unique address)
Definition: AMDGPUAttributor.cpp:213
llvm::AbstractAttribute::getIdAddr
virtual const char * getIdAddr() const =0
This function should return the address of the ID of the AbstractAttribute.
llvm::raw_string_ostream::str
std::string & str()
Flushes the stream contents to the target string and returns the string's reference.
Definition: raw_ostream.h:643
AAUniformWorkGroupSizeFunction::trackStatistics
void trackStatistics() const override
See AbstractAttribute::trackStatistics()
Definition: AMDGPUAttributor.cpp:312
WORKITEM_ID_Z
@ WORKITEM_ID_Z
Definition: AMDGPUAttributor.cpp:40
ALL_ARGUMENT_MASK
@ ALL_ARGUMENT_MASK
Definition: AMDGPUAttributor.cpp:41
llvm::Use
A Use represents the edge between a Value definition and its users.
Definition: Use.h:44
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:37