xref: /freebsd/contrib/llvm-project/llvm/lib/Target/AMDGPU/Utils/AMDGPUMemoryUtils.h (revision ba3c1f5972d7b90feb6e6da47905ff2757e0fe57)
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 isLDSVariableToLower(const GlobalVariable &GV);
32 std::vector<GlobalVariable *> findLDSVariablesToLower(Module &M,
33                                                       const Function *F);
34 
35 /// Given a \p Def clobbering a load from \p Ptr according to the MSSA check
36 /// if this is actually a memory update or an artificial clobber to facilitate
37 /// ordering constraints.
38 bool isReallyAClobber(const Value *Ptr, MemoryDef *Def, AAResults *AA);
39 
40 /// Check is a \p Load is clobbered in its function.
41 bool isClobberedInFunction(const LoadInst *Load, MemorySSA *MSSA,
42                            AAResults *AA);
43 
44 } // end namespace AMDGPU
45 
46 } // end namespace llvm
47 
48 #endif // LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUMEMORYUTILS_H
49