diff options
| author | Pekka Jaaskelainen <pekka.jaaskelainen@tut.fi> | 2014-01-09 13:37:30 +0000 |
|---|---|---|
| committer | Pekka Jaaskelainen <pekka.jaaskelainen@tut.fi> | 2014-01-09 13:37:30 +0000 |
| commit | 3e2101f5a61e4d05480e2a164296081d01be38c2 (patch) | |
| tree | 8b7f8193e63f3671c17e3abfc5bc760b0b042926 /lib/CodeGen/CodeGenFunction.cpp | |
| parent | 371bac98f4d6079edca2fce250ce4c548b348b17 (diff) | |
| download | clang-3e2101f5a61e4d05480e2a164296081d01be38c2.tar.gz clang-3e2101f5a61e4d05480e2a164296081d01be38c2.tar.bz2 clang-3e2101f5a61e4d05480e2a164296081d01be38c2.tar.xz | |
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!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198868 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
| -rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index c1e522d0d7..564ea11a8f 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -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(); |
