25 #define DEBUG_TYPE "amdgpu-aa"
30 "AMDGPU Address space based Alias Analysis",
false,
true)
42 : Arch(Arch_), AS(AS_) {
45 static const AliasResult ASAliasRulesPrivIsZero[6][6] = {
54 static const AliasResult ASAliasRulesGenIsZero[6][6] = {
63 assert(AS.MAX_COMMON_ADDRESS <= 5);
64 if (AS.FLAT_ADDRESS == 0) {
65 assert(AS.GLOBAL_ADDRESS == 1 &&
66 AS.REGION_ADDRESS == 4 &&
67 AS.LOCAL_ADDRESS == 3 &&
68 AS.CONSTANT_ADDRESS == 2 &&
69 AS.PRIVATE_ADDRESS == 5);
70 ASAliasRules = &ASAliasRulesGenIsZero;
72 assert(AS.PRIVATE_ADDRESS == 0 &&
73 AS.GLOBAL_ADDRESS == 1 &&
74 AS.CONSTANT_ADDRESS == 2 &&
75 AS.LOCAL_ADDRESS == 3 &&
76 AS.FLAT_ADDRESS == 4 &&
77 AS.REGION_ADDRESS == 5);
78 ASAliasRules = &ASAliasRulesPrivIsZero;
82 AliasResult AMDGPUAAResult::ASAliasRulesTy::getAliasResult(
unsigned AS1,
84 if (AS1 > AS.MAX_COMMON_ADDRESS || AS2 > AS.MAX_COMMON_ADDRESS) {
90 return (*ASAliasRules)[AS1][AS2];
98 AliasResult Result = ASAliasRules.getAliasResult(asA, asB);
99 if (Result ==
NoAlias)
return Result;
114 if (GV->isConstant())
116 }
else if (
const Argument *Arg = dyn_cast<Argument>(Base)) {
132 unsigned ArgNo = Arg->getArgNo();
Calling convention used for Mesa compute shaders.
This class represents an incoming formal argument to a Function.
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(Error Err, bool gen_crash_diag=true)
Report a serious error, calling any installed error handler.
bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
The two locations do not alias at all.
Calling convention used for Mesa geometry shaders.
INITIALIZE_PASS(AMDGPUAAWrapperPass,"amdgpu-aa","AMDGPU Address space based Alias Analysis", false, true) ImmutablePass *llvm
The two locations may or may not alias. This is the least precise result.
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
OpenCL uses address spaces to differentiate between various memory regions on the hardware...
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
check if an attributes is in the list of attributes.
SPIR_KERNEL - Calling convention for SPIR kernel functions.
AliasResult
The possible results of an alias query.
Represent the analysis usage information of a pass.
Legacy wrapper pass to provide the AMDGPUAAResult object.
Calling convention used for Mesa vertex shaders.
Value * GetUnderlyingObject(Value *V, const DataLayout &DL, unsigned MaxLookup=6)
This method strips off any GEP address adjustments and pointer casts from the specified value...
This is the AMGPU address space based alias analysis pass.
const Value * Ptr
The address of the start of the location.
Representation for a specific memory location.
ImmutablePass class - This class is used to provide information that does not need to be run...
Calling convention used for Mesa pixel shaders.
Module.h This file contains the declarations for the Module class.
Type * getType() const
All values are typed, get the type of this value.
ImmutablePass * createAMDGPUAAWrapperPass()
void setPreservesAll()
Set by analyses that do not transform their input at all.
static const unsigned CONSTANT_ADDRESS
Address space for constant memory (VTX2)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal)
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
Calling convention for AMDGPU code object kernels.