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