summaryrefslogtreecommitdiffstats
path: root/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
diff options
context:
space:
mode:
authorSven van Haastregt <sven.vanhaastregt@arm.com>2019-11-05 10:07:43 +0000
committerSven van Haastregt <sven.vanhaastregt@arm.com>2019-11-05 10:26:47 +0000
commit9a8d477a0e00c15d6d33a52486fa931483b7f2ea (patch)
tree0c0fd20a1bb13aabce83e8145aff625d1a2e98b3 /clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
parent4ecff91ed1df05edbdb55cb2ccdf58466f1333b0 (diff)
downloadbcm5719-llvm-9a8d477a0e00c15d6d33a52486fa931483b7f2ea.tar.gz
bcm5719-llvm-9a8d477a0e00c15d6d33a52486fa931483b7f2ea.zip
[OpenCL] Add builtin function attribute handling
Add handling for the "pure", "const" and "convergent" function attributes for OpenCL builtin functions. Patch by Pierre Gondois and Sven van Haastregt. Differential Revision: https://reviews.llvm.org/D64319
Diffstat (limited to 'clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp')
-rw-r--r--clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
index c8975d7bf61..983e267ce9a 100644
--- a/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
+++ b/clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp
@@ -271,6 +271,12 @@ struct OpenCLBuiltinStruct {
// the SignatureTable represent the complete signature. The first type at
// index SigTableIndex is the return type.
const unsigned NumTypes;
+ // Function attribute __attribute__((pure))
+ const bool IsPure;
+ // Function attribute __attribute__((const))
+ const bool IsConst;
+ // Function attribute __attribute__((convergent))
+ const bool IsConv;
// First OpenCL version in which this overload was introduced (e.g. CL20).
const unsigned short MinVersion;
// First OpenCL version in which this overload was removed (e.g. CL20).
@@ -409,6 +415,9 @@ void BuiltinNameEmitter::EmitBuiltinTable() {
for (const auto &Overload : FOM.second) {
OS << " { " << Overload.second << ", "
<< Overload.first->getValueAsListOfDefs("Signature").size() << ", "
+ << (Overload.first->getValueAsBit("IsPure")) << ", "
+ << (Overload.first->getValueAsBit("IsConst")) << ", "
+ << (Overload.first->getValueAsBit("IsConv")) << ", "
<< Overload.first->getValueAsDef("MinVersion")->getValueAsInt("ID")
<< ", "
<< Overload.first->getValueAsDef("MaxVersion")->getValueAsInt("ID")
OpenPOWER on IntegriCloud