The OpenCL specification states that images are allocated
from the global address space (6.5.1 of the OpenCL 1.2 specification). This makes clang construct the image arguments in the global address space and generate the argument metadata with the correct address space descriptor. Patch by Pedro Ferreira! llvm-svn: 198868
This commit is contained in:
@@ -383,7 +383,12 @@ static void GenOpenCLArgMetadata(const FunctionDecl *FD, llvm::Function *Fn,
|
||||
if (pointeeTy.isVolatileQualified())
|
||||
typeQuals += typeQuals.empty() ? "volatile" : " volatile";
|
||||
} else {
|
||||
addressQuals.push_back(Builder.getInt32(0));
|
||||
uint32_t AddrSpc = 0;
|
||||
if (ty->isImageType())
|
||||
AddrSpc =
|
||||
CGM.getContext().getTargetAddressSpace(LangAS::opencl_global);
|
||||
|
||||
addressQuals.push_back(Builder.getInt32(AddrSpc));
|
||||
|
||||
// Get argument type name.
|
||||
std::string typeName = ty.getUnqualifiedType().getAsString();
|
||||
|
||||
Reference in New Issue
Block a user