brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · 8868b93 Raw
77 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUMEMORYUTILS_H10#define LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUMEMORYUTILS_H11 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;29class TargetExtType;30 31namespace AMDGPU {32 33using FunctionVariableMap = DenseMap<Function *, DenseSet<GlobalVariable *>>;34using VariableFunctionMap = DenseMap<GlobalVariable *, DenseSet<Function *>>;35 36Align getAlign(const DataLayout &DL, const GlobalVariable *GV);37 38// If GV is a named-barrier return its type. Otherwise return nullptr.39TargetExtType *isNamedBarrier(const GlobalVariable &GV);40 41bool isDynamicLDS(const GlobalVariable &GV);42bool isLDSVariableToLower(const GlobalVariable &GV);43 44struct LDSUsesInfoTy {45  FunctionVariableMap direct_access;46  FunctionVariableMap indirect_access;47  bool HasSpecialGVs = false;48};49 50bool eliminateConstantExprUsesOfLDSFromAllInstructions(Module &M);51 52void getUsesOfLDSByFunction(const CallGraph &CG, Module &M,53                            FunctionVariableMap &kernels,54                            FunctionVariableMap &functions);55 56LDSUsesInfoTy getTransitiveUsesOfLDS(const CallGraph &CG, Module &M);57 58/// Strip FnAttr attribute from any functions where we may have59/// introduced its use.60void removeFnAttrFromReachable(CallGraph &CG, Function *KernelRoot,61                               ArrayRef<StringRef> FnAttrs);62 63/// Given a \p Def clobbering a load from \p Ptr according to the MSSA check64/// if this is actually a memory update or an artificial clobber to facilitate65/// ordering constraints.66bool isReallyAClobber(const Value *Ptr, MemoryDef *Def, AAResults *AA);67 68/// Check is a \p Load is clobbered in its function.69bool isClobberedInFunction(const LoadInst *Load, MemorySSA *MSSA,70                           AAResults *AA);71 72} // end namespace AMDGPU73 74} // end namespace llvm75 76#endif // LLVM_LIB_TARGET_AMDGPU_UTILS_AMDGPUMEMORYUTILS_H77