LLVM
8.0.1
|
This pass resolves calls to OpenCL image attribute, image resource ID and sampler resource ID getter functions. More...
#include "AMDGPU.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Use.h"
#include "llvm/IR/User.h"
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include "llvm/Transforms/Utils/ValueMapper.h"
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <tuple>
Go to the source code of this file.
Functions | |
static bool | IsImageType (StringRef TypeString) |
static bool | IsSamplerType (StringRef TypeString) |
static Function * | GetFunctionFromMDNode (MDNode *Node) |
static StringRef | AccessQualFromMD (MDNode *KernelMDNode, unsigned ArgIdx) |
static StringRef | ArgTypeFromMD (MDNode *KernelMDNode, unsigned ArgIdx) |
static MDVector | GetArgMD (MDNode *KernelMDNode, unsigned OpIdx) |
static void | PushArgMD (KernelArgMD &MD, const MDVector &V) |
Variables | |
static StringRef | GetImageSizeFunc = "llvm.OpenCL.image.get.size" |
static StringRef | GetImageFormatFunc = "llvm.OpenCL.image.get.format" |
static StringRef | GetImageResourceIDFunc = "llvm.OpenCL.image.get.resource.id" |
static StringRef | GetSamplerResourceIDFunc |
static StringRef | ImageSizeArgMDType = "__llvm_image_size" |
static StringRef | ImageFormatArgMDType = "__llvm_image_format" |
static StringRef | KernelsMDNodeName = "opencl.kernels" |
static StringRef | KernelArgMDNodeNames [] |
static const unsigned | NumKernelArgMDNodes = 5 |
This pass resolves calls to OpenCL image attribute, image resource ID and sampler resource ID getter functions.
Image attributes (size and format) are expected to be passed to the kernel as kernel arguments immediately following the image argument itself, therefore this pass adds image size and format arguments to the kernel functions in the module. The kernel functions with image arguments are re-created using the new signature. The new arguments are added to the kernel metadata with kernel_arg_type set to "image_size" or "image_format". Note: this pass may invalidate pointers to functions.
Resource IDs of read-only images, write-only images and samplers are defined to be their index among the kernel arguments of the same type and access qualifier.
Definition in file R600OpenCLImageTypeLoweringPass.cpp.
Definition at line 125 of file R600OpenCLImageTypeLoweringPass.cpp.
References llvm::MDNode::getOperand().
Referenced by PushArgMD().
Definition at line 131 of file R600OpenCLImageTypeLoweringPass.cpp.
References llvm::MDNode::getOperand().
Referenced by PushArgMD().
Definition at line 137 of file R600OpenCLImageTypeLoweringPass.cpp.
References NumKernelArgMDNodes.
Referenced by PushArgMD().
Definition at line 93 of file R600OpenCLImageTypeLoweringPass.cpp.
Referenced by PushArgMD().
Definition at line 83 of file R600OpenCLImageTypeLoweringPass.cpp.
Referenced by PushArgMD().
Definition at line 88 of file R600OpenCLImageTypeLoweringPass.cpp.
Referenced by PushArgMD().
|
static |
Definition at line 147 of file R600OpenCLImageTypeLoweringPass.cpp.
References AccessQualFromMD(), Arg, llvm::Function::arg_begin(), llvm::Function::arg_end(), llvm::Function::args(), ArgTypeFromMD(), assert(), llvm::SmallVectorImpl< T >::clear(), llvm::CloneFunctionInto(), Context, llvm::Function::Create(), llvm::dyn_cast(), llvm::Function::eraseFromParent(), F(), llvm::ConstantInt::get(), llvm::FunctionType::get(), llvm::ArrayType::get(), llvm::ConstantAsMetadata::get(), llvm::MDString::get(), llvm::MDNode::get(), GetArgMD(), llvm::Argument::getArgNo(), llvm::Function::getAttributes(), llvm::Module::getContext(), GetFunctionFromMDNode(), llvm::Module::getFunctionList(), llvm::Function::getFunctionType(), llvm::Type::getInt32Ty(), llvm::GlobalValue::getLinkage(), llvm::Value::getName(), llvm::Module::getNamedMetadata(), llvm::NamedMDNode::getNumOperands(), llvm::FunctionType::getNumParams(), llvm::NamedMDNode::getOperand(), llvm::Module::getOrInsertFunction(), llvm::FunctionType::getParamType(), llvm::FunctionType::getReturnType(), llvm::Use::getUser(), IsImageType(), IsSamplerType(), llvm_unreachable, Modified, Name, NumKernelArgMDNodes, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::iplist_impl< IntrusiveListT, TraitsT >::push_back(), llvm::Value::replaceAllUsesWith(), llvm::NamedMDNode::setOperand(), llvm::SmallVectorBase::size(), llvm::StringRef::startswith(), and llvm::Value::uses().
|
static |
Definition at line 56 of file R600OpenCLImageTypeLoweringPass.cpp.
|
static |
Definition at line 57 of file R600OpenCLImageTypeLoweringPass.cpp.
|
static |
Definition at line 55 of file R600OpenCLImageTypeLoweringPass.cpp.
|
static |
Definition at line 58 of file R600OpenCLImageTypeLoweringPass.cpp.
|
static |
Definition at line 62 of file R600OpenCLImageTypeLoweringPass.cpp.
|
static |
Definition at line 61 of file R600OpenCLImageTypeLoweringPass.cpp.
|
static |
Definition at line 65 of file R600OpenCLImageTypeLoweringPass.cpp.
|
static |
Definition at line 64 of file R600OpenCLImageTypeLoweringPass.cpp.
Definition at line 71 of file R600OpenCLImageTypeLoweringPass.cpp.
Referenced by GetArgMD(), and PushArgMD().