LLVM 19.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/DenseMap.h"
13#include "llvm/ADT/DenseSet.h"
14
15namespace llvm {
16
17struct Align;
18class AAResults;
19class DataLayout;
20class GlobalVariable;
21class LoadInst;
22class MemoryDef;
23class MemorySSA;
24class Value;
25class Function;
26class CallGraph;
27class Module;
28
29namespace AMDGPU {
30
33
34Align getAlign(const DataLayout &DL, const GlobalVariable *GV);
35
36bool isDynamicLDS(const GlobalVariable &GV);
38
42};
43
45
46void getUsesOfLDSByFunction(const CallGraph &CG, Module &M,
47 FunctionVariableMap &kernels,
49
50bool isKernelLDS(const Function *F);
51
53
54/// Strip FnAttr attribute from any functions where we may have
55/// introduced its use.
56void removeFnAttrFromReachable(CallGraph &CG, Function *KernelRoot,
58
59/// Given a \p Def clobbering a load from \p Ptr according to the MSSA check
60/// if this is actually a memory update or an artificial clobber to facilitate
61/// ordering constraints.
62bool isReallyAClobber(const Value *Ptr, MemoryDef *Def, AAResults *AA);
63
64/// Check is a \p Load is clobbered in its function.
65bool isClobberedInFunction(const LoadInst *Load, MemorySSA *MSSA,
66 AAResults *AA);
67
68} // end namespace AMDGPU
69
70} // end namespace llvm
71
72#endif // LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUMEMORYUTILS_H
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Lower uses of LDS variables from non kernel functions
@ FnAttr
Definition: Attributes.cpp:666
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:1948
#define F(x, y, z)
Definition: MD5.cpp:55
Machine Check Debug Module
The basic data container for the call graph of a Module of IR.
Definition: CallGraph.h:72
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:110
An instruction for reading from memory.
Definition: Instructions.h:184
Represents a read-write access to memory, whether it is a must-alias, or a may-alias.
Definition: MemorySSA.h:373
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
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
LLVM Value Representation.
Definition: Value.h:74
bool isDynamicLDS(const GlobalVariable &GV)
void removeFnAttrFromReachable(CallGraph &CG, Function *KernelRoot, StringRef FnAttr)
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)
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