LLVM 22.0.0git
OMP.h
Go to the documentation of this file.
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"
18
19#include "llvm/ADT/ArrayRef.h"
21#include "llvm/ADT/StringRef.h"
22
23namespace llvm::omp {
26
28getLeafOrCompositeConstructs(Directive D, SmallVectorImpl<Directive> &Output);
29
31
32LLVM_ABI bool isLeafConstruct(Directive D);
33LLVM_ABI bool isCompositeConstruct(Directive D);
34LLVM_ABI bool isCombinedConstruct(Directive D);
35
36/// Can clause C have an iterator-modifier.
37static constexpr inline bool canHaveIterator(Clause C) {
38 // [5.2:67:5]
39 switch (C) {
40 case OMPC_affinity:
41 case OMPC_depend:
42 case OMPC_from:
43 case OMPC_map:
44 case OMPC_to:
45 return true;
46 default:
47 return false;
48 }
49}
50
51// Can clause C create a private copy of a variable.
52static constexpr inline bool isPrivatizingClause(Clause C) {
53 switch (C) {
54 case OMPC_detach:
55 case OMPC_firstprivate:
56 // TODO case OMPC_induction:
57 case OMPC_in_reduction:
58 case OMPC_is_device_ptr:
59 case OMPC_lastprivate:
60 case OMPC_linear:
61 case OMPC_private:
62 case OMPC_reduction:
63 case OMPC_task_reduction:
64 case OMPC_use_device_ptr:
65 return true;
66 default:
67 return false;
68 }
69}
70
71static constexpr unsigned FallbackVersion = 52;
73
74/// Can directive D, under some circumstances, create a private copy
75/// of a variable in given OpenMP version?
77
78/// Create a nicer version of a function name for humans to look at.
79LLVM_ABI std::string prettifyFunctionName(StringRef FunctionName);
80
81/// Deconstruct an OpenMP kernel name into the parent function name and the line
82/// number.
84 unsigned &LineNo);
85
86} // namespace llvm::omp
87
88#endif // LLVM_FRONTEND_OPENMP_OMP_H
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
#define LLVM_ABI
Definition Compiler.h:213
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition ArrayRef.h:41
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
@ C
The default llvm calling convention, compatible with C.
Definition CallingConv.h:34
LLVM_ABI ArrayRef< unsigned > getOpenMPVersions()
Definition OMP.cpp:214
LLVM_ABI bool isCombinedConstruct(Directive D)
Definition OMP.cpp:208
LLVM_ABI std::string deconstructOpenMPKernelName(StringRef KernelName, unsigned &LineNo)
Deconstruct an OpenMP kernel name into the parent function name and the line number.
Definition OMP.cpp:245
LLVM_ABI ArrayRef< Directive > getLeafOrCompositeConstructs(Directive D, SmallVectorImpl< Directive > &Output)
Definition OMP.cpp:120
bool isPrivatizingConstruct(Directive D, unsigned Version)
Can directive D, under some circumstances, create a private copy of a variable in given OpenMP versio...
Definition OMP.cpp:219
static constexpr bool canHaveIterator(Clause C)
Can clause C have an iterator-modifier.
Definition OMP.h:37
LLVM_ABI bool isCompositeConstruct(Directive D)
Definition OMP.cpp:200
static constexpr bool isPrivatizingClause(Clause C)
Definition OMP.h:52
LLVM_ABI Directive getCompoundConstruct(ArrayRef< Directive > Parts)
Definition OMP.cpp:147
static constexpr unsigned FallbackVersion
Definition OMP.h:71
LLVM_ABI bool isLeafConstruct(Directive D)
Definition OMP.cpp:198
LLVM_ABI ArrayRef< Directive > getLeafConstructsOrSelf(Directive D)
Definition OMP.cpp:109
LLVM_ABI std::string prettifyFunctionName(StringRef FunctionName)
Create a nicer version of a function name for humans to look at.
Definition OMP.cpp:231
LLVM_ABI ArrayRef< Directive > getLeafConstructs(Directive D)
Definition OMP.cpp:101
FunctionAddr VTableAddr uintptr_t uintptr_t Version
Definition InstrProf.h:302
ArrayRef(const T &OneElt) -> ArrayRef< T >