64 lines · c
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-exception6//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 15namespace Fortran::parser {16struct Program;17class Messages;18struct Name;19class CharBlock;20struct AssignmentStmt;21struct ExecutionPartConstruct;22struct ExecutableConstruct;23struct ActionStmt;24struct IfConstruct;25struct CUFKernelDoConstruct;26struct SubroutineSubprogram;27struct FunctionSubprogram;28struct SeparateModuleSubprogram;29} // namespace Fortran::parser30 31namespace Fortran::semantics {32 33class SemanticsContext;34 35class CUDAChecker : public virtual BaseChecker {36public: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 void Enter(const parser::OpenACCBlockConstruct &);45 void Leave(const parser::OpenACCBlockConstruct &);46 void Enter(const parser::OpenACCCombinedConstruct &);47 void Leave(const parser::OpenACCCombinedConstruct &);48 void Enter(const parser::OpenACCLoopConstruct &);49 void Leave(const parser::OpenACCLoopConstruct &);50 void Enter(const parser::DoConstruct &);51 void Leave(const parser::DoConstruct &);52 void Enter(const parser::PrintStmt &);53 54private:55 SemanticsContext &context_;56 int deviceConstructDepth_{0};57};58 59bool CanonicalizeCUDA(parser::Program &);60 61} // namespace Fortran::semantics62 63#endif // FORTRAN_SEMANTICS_CHECK_CUDA_H_64