1 //===-- OMP.h - Core OpenMP definitions and declarations ---------- 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 // This file contains the core set of OpenMP definitions and declarations. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_FRONTEND_OPENMP_OMP_H 14 #define LLVM_FRONTEND_OPENMP_OMP_H 15 16 #include "llvm/Frontend/OpenMP/OMP.h.inc" 17 18 #include "llvm/ADT/ArrayRef.h" 19 #include "llvm/ADT/SmallVector.h" 20 #include "llvm/ADT/StringRef.h" 21 22 namespace llvm::omp { 23 ArrayRef<Directive> getLeafConstructs(Directive D); 24 ArrayRef<Directive> getLeafConstructsOrSelf(Directive D); 25 26 ArrayRef<Directive> 27 getLeafOrCompositeConstructs(Directive D, SmallVectorImpl<Directive> &Output); 28 29 Directive getCompoundConstruct(ArrayRef<Directive> Parts); 30 31 bool isLeafConstruct(Directive D); 32 bool isCompositeConstruct(Directive D); 33 bool isCombinedConstruct(Directive D); 34 35 /// Can clause C have an iterator-modifier. 36 static constexpr inline bool canHaveIterator(Clause C) { 37 // [5.2:67:5] 38 switch (C) { 39 case OMPC_affinity: 40 case OMPC_depend: 41 case OMPC_from: 42 case OMPC_map: 43 case OMPC_to: 44 return true; 45 default: 46 return false; 47 } 48 } 49 50 ArrayRef<unsigned> getOpenMPVersions(); 51 52 /// Create a nicer version of a function name for humans to look at. 53 std::string prettifyFunctionName(StringRef FunctionName); 54 55 /// Deconstruct an OpenMP kernel name into the parent function name and the line 56 /// number. 57 std::string deconstructOpenMPKernelName(StringRef KernelName, unsigned &LineNo); 58 59 } // namespace llvm::omp 60 61 #endif // LLVM_FRONTEND_OPENMP_OMP_H 62