From 9a8d477a0e00c15d6d33a52486fa931483b7f2ea Mon Sep 17 00:00:00 2001 From: Sven van Haastregt Date: Tue, 5 Nov 2019 10:07:43 +0000 Subject: [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 --- clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp') 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") -- cgit v1.2.3