LLVM  4.0.0
Functions
AMDGPUOpenCLImageTypeLoweringPass.cpp File Reference

This pass resolves calls to OpenCL image attribute, image resource ID and sampler resource ID getter functions. More...

#include "AMDGPU.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/Transforms/Utils/Cloning.h"
Include dependency graph for AMDGPUOpenCLImageTypeLoweringPass.cpp:

Go to the source code of this file.

Functions

static bool IsImageType (StringRef TypeString)
 
static bool IsSamplerType (StringRef TypeString)
 
static FunctionGetFunctionFromMDNode (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)
 

Detailed Description

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 AMDGPUOpenCLImageTypeLoweringPass.cpp.

Function Documentation

static StringRef AccessQualFromMD ( MDNode KernelMDNode,
unsigned  ArgIdx 
)
static

Definition at line 108 of file AMDGPUOpenCLImageTypeLoweringPass.cpp.

References llvm::MDNode::getOperand().

static StringRef ArgTypeFromMD ( MDNode KernelMDNode,
unsigned  ArgIdx 
)
static

Definition at line 114 of file AMDGPUOpenCLImageTypeLoweringPass.cpp.

References llvm::MDNode::getOperand().

static MDVector GetArgMD ( MDNode KernelMDNode,
unsigned  OpIdx 
)
static

Definition at line 120 of file AMDGPUOpenCLImageTypeLoweringPass.cpp.

References llvm::MDNode::getOperand(), and i.

static Function* GetFunctionFromMDNode ( MDNode Node)
static
static bool IsImageType ( StringRef  TypeString)
inlinestatic

Definition at line 66 of file AMDGPUOpenCLImageTypeLoweringPass.cpp.

static bool IsSamplerType ( StringRef  TypeString)
inlinestatic

Definition at line 71 of file AMDGPUOpenCLImageTypeLoweringPass.cpp.

static void PushArgMD ( KernelArgMD &  MD,
const MDVector &  V 
)
static

Definition at line 130 of file AMDGPUOpenCLImageTypeLoweringPass.cpp.

References assert(), and i.