Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:04

0001 //===----- SemaOpenCL.h --- Semantic Analysis for OpenCL constructs -------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 /// \file
0009 /// This file declares semantic analysis routines for OpenCL.
0010 ///
0011 //===----------------------------------------------------------------------===//
0012 
0013 #ifndef LLVM_CLANG_SEMA_SEMAOPENCL_H
0014 #define LLVM_CLANG_SEMA_SEMAOPENCL_H
0015 
0016 #include "clang/AST/ASTFwd.h"
0017 #include "clang/Sema/SemaBase.h"
0018 
0019 namespace clang {
0020 class ParsedAttr;
0021 
0022 class SemaOpenCL : public SemaBase {
0023 public:
0024   SemaOpenCL(Sema &S);
0025 
0026   void handleNoSVMAttr(Decl *D, const ParsedAttr &AL);
0027   void handleAccessAttr(Decl *D, const ParsedAttr &AL);
0028 
0029   // Handles intel_reqd_sub_group_size.
0030   void handleSubGroupSize(Decl *D, const ParsedAttr &AL);
0031 
0032   // Performs semantic analysis for the read/write_pipe call.
0033   // \param S Reference to the semantic analyzer.
0034   // \param Call A pointer to the builtin call.
0035   // \return True if a semantic error has been found, false otherwise.
0036   bool checkBuiltinRWPipe(CallExpr *Call);
0037 
0038   // Performs a semantic analysis on the {work_group_/sub_group_
0039   //        /_}reserve_{read/write}_pipe
0040   // \param S Reference to the semantic analyzer.
0041   // \param Call The call to the builtin function to be analyzed.
0042   // \return True if a semantic error was found, false otherwise.
0043   bool checkBuiltinReserveRWPipe(CallExpr *Call);
0044 
0045   bool checkSubgroupExt(CallExpr *Call);
0046 
0047   // Performs a semantic analysis on {work_group_/sub_group_
0048   //        /_}commit_{read/write}_pipe
0049   // \param S Reference to the semantic analyzer.
0050   // \param Call The call to the builtin function to be analyzed.
0051   // \return True if a semantic error was found, false otherwise.
0052   bool checkBuiltinCommitRWPipe(CallExpr *Call);
0053 
0054   // Performs a semantic analysis on the call to built-in Pipe
0055   //        Query Functions.
0056   // \param S Reference to the semantic analyzer.
0057   // \param Call The call to the builtin function to be analyzed.
0058   // \return True if a semantic error was found, false otherwise.
0059   bool checkBuiltinPipePackets(CallExpr *Call);
0060 
0061   // OpenCL v2.0 s6.13.9 - Address space qualifier functions.
0062   // Performs semantic analysis for the to_global/local/private call.
0063   // \param S Reference to the semantic analyzer.
0064   // \param BuiltinID ID of the builtin function.
0065   // \param Call A pointer to the builtin call.
0066   // \return True if a semantic error has been found, false otherwise.
0067   bool checkBuiltinToAddr(unsigned BuiltinID, CallExpr *Call);
0068 
0069   /// OpenCL C v2.0, s6.13.17 - Enqueue kernel function contains four different
0070   /// overload formats specified in Table 6.13.17.1.
0071   /// int enqueue_kernel(queue_t queue,
0072   ///                    kernel_enqueue_flags_t flags,
0073   ///                    const ndrange_t ndrange,
0074   ///                    void (^block)(void))
0075   /// int enqueue_kernel(queue_t queue,
0076   ///                    kernel_enqueue_flags_t flags,
0077   ///                    const ndrange_t ndrange,
0078   ///                    uint num_events_in_wait_list,
0079   ///                    clk_event_t *event_wait_list,
0080   ///                    clk_event_t *event_ret,
0081   ///                    void (^block)(void))
0082   /// int enqueue_kernel(queue_t queue,
0083   ///                    kernel_enqueue_flags_t flags,
0084   ///                    const ndrange_t ndrange,
0085   ///                    void (^block)(local void*, ...),
0086   ///                    uint size0, ...)
0087   /// int enqueue_kernel(queue_t queue,
0088   ///                    kernel_enqueue_flags_t flags,
0089   ///                    const ndrange_t ndrange,
0090   ///                    uint num_events_in_wait_list,
0091   ///                    clk_event_t *event_wait_list,
0092   ///                    clk_event_t *event_ret,
0093   ///                    void (^block)(local void*, ...),
0094   ///                    uint size0, ...)
0095   bool checkBuiltinEnqueueKernel(CallExpr *TheCall);
0096 
0097   /// OpenCL C v2.0, s6.13.17.6 - Check the argument to the
0098   /// get_kernel_work_group_size
0099   /// and get_kernel_preferred_work_group_size_multiple builtin functions.
0100   bool checkBuiltinKernelWorkGroupSize(CallExpr *TheCall);
0101 
0102   bool checkBuiltinNDRangeAndBlock(CallExpr *TheCall);
0103 };
0104 
0105 } // namespace clang
0106 
0107 #endif // LLVM_CLANG_SEMA_SEMAOPENCL_H