xref: /llvm-project/flang/lib/Semantics/check-cuda.h (revision cfc095118c149d6d95a828139ed54fb34e99a3f3)
1 //===-- lib/Semantics/check-cuda.h ------------------------------*- C++ -*-===//
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 
9 #ifndef FORTRAN_SEMANTICS_CHECK_CUDA_H_
10 #define FORTRAN_SEMANTICS_CHECK_CUDA_H_
11 
12 #include "flang/Semantics/semantics.h"
13 #include <list>
14 
15 namespace Fortran::parser {
16 struct Program;
17 class Messages;
18 struct Name;
19 class CharBlock;
20 struct AssignmentStmt;
21 struct ExecutionPartConstruct;
22 struct ExecutableConstruct;
23 struct ActionStmt;
24 struct IfConstruct;
25 struct CUFKernelDoConstruct;
26 struct SubroutineSubprogram;
27 struct FunctionSubprogram;
28 struct SeparateModuleSubprogram;
29 } // namespace Fortran::parser
30 
31 namespace Fortran::semantics {
32 
33 class SemanticsContext;
34 
35 class CUDAChecker : public virtual BaseChecker {
36 public:
37   explicit CUDAChecker(SemanticsContext &c) : context_{c} {}
38   void Enter(const parser::SubroutineSubprogram &);
39   void Enter(const parser::FunctionSubprogram &);
40   void Enter(const parser::SeparateModuleSubprogram &);
41   void Enter(const parser::CUFKernelDoConstruct &);
42   void Leave(const parser::CUFKernelDoConstruct &);
43   void Enter(const parser::AssignmentStmt &);
44 
45 private:
46   SemanticsContext &context_;
47   bool inCUFKernelDoConstruct_ = false;
48 };
49 
50 bool CanonicalizeCUDA(parser::Program &);
51 
52 } // namespace Fortran::semantics
53 
54 #endif // FORTRAN_SEMANTICS_CHECK_CUDA_H_
55