LLVM 20.0.0git
AMDGPUMemoryUtils.h
Go to the documentation of this file.
1//===- AMDGPUMemoryUtils.h - Memory related helper functions -*- C++ -*----===//
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#ifndef LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUMEMORYUTILS_H
10#define LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUMEMORYUTILS_H
11
12#include "llvm/ADT/ArrayRef.h"
13#include "llvm/ADT/DenseMap.h"
14#include "llvm/ADT/DenseSet.h"
15
16namespace llvm {
17
18struct Align;
19class AAResults;
20class DataLayout;
21class GlobalVariable;
22class LoadInst;
23class MemoryDef;
24class MemorySSA;
25class Value;
26class Function;
27class CallGraph;
28class Module;
29class TargetExtType;
30
31namespace AMDGPU {
32
35
36Align getAlign(const DataLayout &DL, const GlobalVariable *GV);
37
38// If GV is a named-barrier return its type. Otherwise return nullptr.
40
41bool isDynamicLDS(const GlobalVariable &GV);
43
47 bool HasSpecialGVs = false;
48};
49
51
52void getUsesOfLDSByFunction(const CallGraph &CG, Module &M,
53 FunctionVariableMap &kernels,
55
56bool isKernelLDS(const Function *F);
57
59
60/// Strip FnAttr attribute from any functions where we may have
61/// introduced its use.
62void removeFnAttrFromReachable(CallGraph &CG, Function *KernelRoot,
63 ArrayRef<StringRef> FnAttrs);
64
65/// Given a \p Def clobbering a load from \p Ptr according to the MSSA check
66/// if this is actually a memory update or an artificial clobber to facilitate
67/// ordering constraints.
68bool isReallyAClobber(const Value *Ptr, MemoryDef *Def, AAResults *AA);
69
70/// Check is a \p Load is clobbered in its function.
71bool isClobberedInFunction(const LoadInst *Load, MemorySSA *MSSA,
72 AAResults *AA);
73
74} // end namespace AMDGPU
75
76} // end namespace llvm
77
78#endif // LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUMEMORYUTILS_H
Lower uses of LDS variables from non kernel functions
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
uint64_t Align
early cse Early CSE w MemorySSA
Definition: EarlyCSE.cpp:1960
#define F(x, y, z)
Definition: MD5.cpp:55
Machine Check Debug Module
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: ArrayRef.h:41
The basic data container for the call graph of a Module of IR.
Definition: CallGraph.h:71
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:63
An instruction for reading from memory.
Definition: Instructions.h:176
Represents a read-write access to memory, whether it is a must-alias, or a may-alias.
Definition: MemorySSA.h:370
Encapsulates MemorySSA, including all data associated with memory accesses.
Definition: MemorySSA.h:701
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
Class to represent target extensions types, which are generally unintrospectable from target-independ...
Definition: DerivedTypes.h:744
LLVM Value Representation.
Definition: Value.h:74
bool isDynamicLDS(const GlobalVariable &GV)
void removeFnAttrFromReachable(CallGraph &CG, Function *KernelRoot, ArrayRef< StringRef > FnAttrs)
Strip FnAttr attribute from any functions where we may have introduced its use.
void getUsesOfLDSByFunction(const CallGraph &CG, Module &M, FunctionVariableMap &kernels, FunctionVariableMap &Functions)
bool isReallyAClobber(const Value *Ptr, MemoryDef *Def, AAResults *AA)
Given a Def clobbering a load from Ptr according to the MSSA check if this is actually a memory updat...
LDSUsesInfoTy getTransitiveUsesOfLDS(const CallGraph &CG, Module &M)
TargetExtType * isNamedBarrier(const GlobalVariable &GV)
bool isLDSVariableToLower(const GlobalVariable &GV)
bool eliminateConstantExprUsesOfLDSFromAllInstructions(Module &M)
Align getAlign(const DataLayout &DL, const GlobalVariable *GV)
bool isKernelLDS(const Function *F)
bool isClobberedInFunction(const LoadInst *Load, MemorySSA *MSSA, AAResults *AA)
Check is a Load is clobbered in its function.
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
FunctionVariableMap direct_access
FunctionVariableMap indirect_access
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39