clang  20.0.0git
SemaOpenCL.h
Go to the documentation of this file.
1 //===----- SemaOpenCL.h --- Semantic Analysis for OpenCL constructs -------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 /// \file
9 /// This file declares semantic analysis routines for OpenCL.
10 ///
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_SEMA_SEMAOPENCL_H
14 #define LLVM_CLANG_SEMA_SEMAOPENCL_H
15 
16 #include "clang/AST/ASTFwd.h"
17 #include "clang/Sema/SemaBase.h"
18 
19 namespace clang {
20 class ParsedAttr;
21 
22 class SemaOpenCL : public SemaBase {
23 public:
24  SemaOpenCL(Sema &S);
25 
26  void handleNoSVMAttr(Decl *D, const ParsedAttr &AL);
27  void handleAccessAttr(Decl *D, const ParsedAttr &AL);
28 
29  // Performs semantic analysis for the read/write_pipe call.
30  // \param S Reference to the semantic analyzer.
31  // \param Call A pointer to the builtin call.
32  // \return True if a semantic error has been found, false otherwise.
33  bool checkBuiltinRWPipe(CallExpr *Call);
34 
35  // Performs a semantic analysis on the {work_group_/sub_group_
36  // /_}reserve_{read/write}_pipe
37  // \param S Reference to the semantic analyzer.
38  // \param Call The call to the builtin function to be analyzed.
39  // \return True if a semantic error was found, false otherwise.
41 
42  bool checkSubgroupExt(CallExpr *Call);
43 
44  // Performs a semantic analysis on {work_group_/sub_group_
45  // /_}commit_{read/write}_pipe
46  // \param S Reference to the semantic analyzer.
47  // \param Call The call to the builtin function to be analyzed.
48  // \return True if a semantic error was found, false otherwise.
50 
51  // Performs a semantic analysis on the call to built-in Pipe
52  // Query Functions.
53  // \param S Reference to the semantic analyzer.
54  // \param Call The call to the builtin function to be analyzed.
55  // \return True if a semantic error was found, false otherwise.
57 
58  // OpenCL v2.0 s6.13.9 - Address space qualifier functions.
59  // Performs semantic analysis for the to_global/local/private call.
60  // \param S Reference to the semantic analyzer.
61  // \param BuiltinID ID of the builtin function.
62  // \param Call A pointer to the builtin call.
63  // \return True if a semantic error has been found, false otherwise.
64  bool checkBuiltinToAddr(unsigned BuiltinID, CallExpr *Call);
65 
66  /// OpenCL C v2.0, s6.13.17 - Enqueue kernel function contains four different
67  /// overload formats specified in Table 6.13.17.1.
68  /// int enqueue_kernel(queue_t queue,
69  /// kernel_enqueue_flags_t flags,
70  /// const ndrange_t ndrange,
71  /// void (^block)(void))
72  /// int enqueue_kernel(queue_t queue,
73  /// kernel_enqueue_flags_t flags,
74  /// const ndrange_t ndrange,
75  /// uint num_events_in_wait_list,
76  /// clk_event_t *event_wait_list,
77  /// clk_event_t *event_ret,
78  /// void (^block)(void))
79  /// int enqueue_kernel(queue_t queue,
80  /// kernel_enqueue_flags_t flags,
81  /// const ndrange_t ndrange,
82  /// void (^block)(local void*, ...),
83  /// uint size0, ...)
84  /// int enqueue_kernel(queue_t queue,
85  /// kernel_enqueue_flags_t flags,
86  /// const ndrange_t ndrange,
87  /// uint num_events_in_wait_list,
88  /// clk_event_t *event_wait_list,
89  /// clk_event_t *event_ret,
90  /// void (^block)(local void*, ...),
91  /// uint size0, ...)
92  bool checkBuiltinEnqueueKernel(CallExpr *TheCall);
93 
94  /// OpenCL C v2.0, s6.13.17.6 - Check the argument to the
95  /// get_kernel_work_group_size
96  /// and get_kernel_preferred_work_group_size_multiple builtin functions.
98 
100 };
101 
102 } // namespace clang
103 
104 #endif // LLVM_CLANG_SEMA_SEMAOPENCL_H
Forward declaration of all AST node types.
const Decl * D
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2882
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
ParsedAttr - Represents a syntactic attribute.
Definition: ParsedAttr.h:129
bool checkBuiltinNDRangeAndBlock(CallExpr *TheCall)
Definition: SemaOpenCL.cpp:134
bool checkBuiltinKernelWorkGroupSize(CallExpr *TheCall)
OpenCL C v2.0, s6.13.17.6 - Check the argument to the get_kernel_work_group_size and get_kernel_prefe...
Definition: SemaOpenCL.cpp:158
bool checkBuiltinEnqueueKernel(CallExpr *TheCall)
OpenCL C v2.0, s6.13.17 - Enqueue kernel function contains four different overload formats specified ...
Definition: SemaOpenCL.cpp:219
bool checkBuiltinCommitRWPipe(CallExpr *Call)
Definition: SemaOpenCL.cpp:487
bool checkBuiltinPipePackets(CallExpr *Call)
Definition: SemaOpenCL.cpp:505
void handleNoSVMAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaOpenCL.cpp:23
bool checkSubgroupExt(CallExpr *Call)
Definition: SemaOpenCL.cpp:118
void handleAccessAttr(Decl *D, const ParsedAttr &AL)
Definition: SemaOpenCL.cpp:32
bool checkBuiltinToAddr(unsigned BuiltinID, CallExpr *Call)
Definition: SemaOpenCL.cpp:518
bool checkBuiltinRWPipe(CallExpr *Call)
Definition: SemaOpenCL.cpp:413
bool checkBuiltinReserveRWPipe(CallExpr *Call)
Definition: SemaOpenCL.cpp:463
SemaOpenCL(Sema &S)
Definition: SemaOpenCL.cpp:21
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:493
The JSON file list parser is used to communicate input to InstallAPI.