xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/Utils/AMDGPUMemoryUtils.h (revision 02e9120893770924227138ba49df1edb3896112a)
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 <vector>
13 
14 namespace llvm {
15 
16 struct Align;
17 class AAResults;
18 class DataLayout;
19 class Function;
20 class GlobalVariable;
21 class LoadInst;
22 class MemoryDef;
23 class MemorySSA;
24 class Module;
25 class Value;
26 
27 namespace AMDGPU {
28 
29 Align getAlign(DataLayout const &DL, const GlobalVariable *GV);
30 
31 bool isDynamicLDS(const GlobalVariable &GV);
32 bool isLDSVariableToLower(const GlobalVariable &GV);
33 
34 /// Given a \p Def clobbering a load from \p Ptr according to the MSSA check
35 /// if this is actually a memory update or an artificial clobber to facilitate
36 /// ordering constraints.
37 bool isReallyAClobber(const Value *Ptr, MemoryDef *Def, AAResults *AA);
38 
39 /// Check is a \p Load is clobbered in its function.
40 bool isClobberedInFunction(const LoadInst *Load, MemorySSA *MSSA,
41                            AAResults *AA);
42 
43 } // end namespace AMDGPU
44 
45 } // end namespace llvm
46 
47 #endif // LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUMEMORYUTILS_H
48