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/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;
29
30namespace AMDGPU {
31
34
35Align getAlign(const DataLayout &DL, const GlobalVariable *GV);
36
37bool isDynamicLDS(const GlobalVariable &GV);
39
43};
44
46
47void getUsesOfLDSByFunction(const CallGraph &CG, Module &M,
48 FunctionVariableMap &kernels,
50
51bool isKernelLDS(const Function *F);
52
54
55/// Strip FnAttr attribute from any functions where we may have
56/// introduced its use.
57void removeFnAttrFromReachable(CallGraph &CG, Function *KernelRoot,
58 ArrayRef<StringRef> FnAttrs);
59
60/// Given a \p Def clobbering a load from \p Ptr according to the MSSA check
61/// if this is actually a memory update or an artificial clobber to facilitate
62/// ordering constraints.
63bool isReallyAClobber(const Value *Ptr, MemoryDef *Def, AAResults *AA);
64
65/// Check is a \p Load is clobbered in its function.
66bool isClobberedInFunction(const LoadInst *Load, MemorySSA *MSSA,
67 AAResults *AA);
68
69} // end namespace AMDGPU
70
71} // end namespace llvm
72
73#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:1948
#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: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:174
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
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)
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