LLVM: lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp File Reference (original) (raw)

Go to the source code of this file.

Macros
#define DEBUG_TYPE "amdgpu-lower-buffer-fat-pointers"
#define PASS_DESC "Lower buffer fat pointer operations to buffer resources"
Functions
static bool isBufferFatPtrOrVector (Type *Ty)
static bool isSplitFatPtr (Type *Ty)
static bool isBufferFatPtrConst (Constant *C)
static std::pair< Constant *, Constant * > splitLoweredFatBufferConst (Constant *C)
Return the ptr addrspace(8) and i32 (resource and offset parts) in a lowered buffer fat pointer constant.
static Value * rsrcPartRoot (Value *V)
Returns the instruction that defines the resource part of the value V.
static bool isRemovablePointerIntrinsic (Intrinsic::ID IID)
Returns true if this intrinsic needs to be removed when it is applied to ptr addrspace(7) values.
static bool containsBufferFatPointers (const Function &F, BufferFatPtrToStructTypeMap *TypeMap)
Returns true if there are values that have a buffer fat pointer in them, which means we'll need to perform rewrites on this function.
static bool hasFatPointerInterface (const Function &F, BufferFatPtrToStructTypeMap *TypeMap)
static Function * moveFunctionAdaptingType (Function *OldF, FunctionType *NewTy, ValueToValueMapTy &CloneMap)
Move the body of OldF into a new function, returning it.
static void makeCloneInPraceMap (Function *F, ValueToValueMapTy &CloneMap)
INITIALIZE_PASS_BEGIN (AMDGPULowerBufferFatPointers, DEBUG_TYPE, PASS_DESC, false, false) INITIALIZE_PASS_END(AMDGPULowerBufferFatPointers

DEBUG_TYPE

#define DEBUG_TYPE "amdgpu-lower-buffer-fat-pointers"

PASS_DESC

#define PASS_DESC "Lower buffer fat pointer operations to buffer resources"

PtrParts

containsBufferFatPointers()

bool containsBufferFatPointers ( const Function & F, BufferFatPtrToStructTypeMap * TypeMap ) static

Returns true if there are values that have a buffer fat pointer in them, which means we'll need to perform rewrites on this function.

As a side effect, this will populate the type remapping cache.

Definition at line 2370 of file AMDGPULowerBufferFatPointers.cpp.

References F, and I.

hasFatPointerInterface()

bool hasFatPointerInterface ( const Function & F, BufferFatPtrToStructTypeMap * TypeMap ) static

INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( AMDGPULowerBufferFatPointers ,
DEBUG_TYPE ,
PASS_DESC ,
false ,
false )

isBufferFatPtrConst()

isBufferFatPtrOrVector()

bool isBufferFatPtrOrVector ( Type * Ty) static

isRemovablePointerIntrinsic()

Returns true if this intrinsic needs to be removed when it is applied to ptr addrspace(7) values.

Calls to these intrinsics are rewritten into calls to versions of that intrinsic on the resource descriptor.

Definition at line 2193 of file AMDGPULowerBufferFatPointers.cpp.

isSplitFatPtr()

makeCloneInPraceMap()

moveFunctionAdaptingType()

Move the body of OldF into a new function, returning it.

Definition at line 2390 of file AMDGPULowerBufferFatPointers.cpp.

References llvm::Function::args(), llvm::Function::copyAttributesFrom(), llvm::GlobalObject::copyMetadata(), llvm::Function::Create(), llvm::Function::empty(), llvm::enumerate(), llvm::Function::front(), llvm::GlobalValue::getAddressSpace(), llvm::Function::getAttributes(), llvm::Function::getContext(), llvm::GlobalValue::getDLLStorageClass(), llvm::Module::getFunctionList(), llvm::ilist_node_impl< OptionsT >::getIterator(), llvm::GlobalValue::getLinkage(), llvm::GlobalValue::getParent(), llvm::Function::getReturnType(), I, llvm::iplist_impl< IntrusiveListT, TraitsT >::insertAfter(), llvm::BasicBlock::insertInto(), llvm::Function::isIntrinsic(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::AttributeSet::removeAttributes(), llvm::BasicBlock::removeFromParent(), llvm::Function::setAttributes(), llvm::GlobalValue::setDLLStorageClass(), llvm::Value::takeName(), and llvm::Function::updateAfterNameChange().

rsrcPartRoot()

Returns the instruction that defines the resource part of the value V.

Note that this is not getUnderlyingObject(), since that looks through operations like ptrmask which might modify the resource part.

We can limit ourselves to just looking through GEPs followed by looking through addrspacecasts because only those two operations preserve the resource part, and because operations on an addrspace(8) (which is the legal input to this addrspacecast) would produce a different resource part.

Definition at line 1434 of file AMDGPULowerBufferFatPointers.cpp.

References llvm::dyn_cast(), and GEP.

splitLoweredFatBufferConst()

BufferOffsetWidth

DEBUG_TYPE

false

PASS_DESC