1//===- OpenMP/OMPAssume.h --- OpenMP assumption helper functions - 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/// \file
9///
10/// This file provides helper functions and classes to deal with OpenMP
11/// assumptions, e.g., as used by `[begin/end] assumes` and `assume`.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_FRONTEND_OPENMP_OMPASSUME_H
16#define LLVM_FRONTEND_OPENMP_OMPASSUME_H
17
18#include "llvm/ADT/StringRef.h"
19
20namespace llvm {
21
22namespace omp {
23
24/// Helper to describe assume clauses.
25struct AssumptionClauseMappingInfo {
26 /// The identifier describing the (beginning of the) clause.
27 llvm::StringLiteral Identifier;
28 /// Flag to determine if the identifier is a full name or the start of a name.
29 bool StartsWith;
30 /// Flag to determine if a directive lists follows.
31 bool HasDirectiveList;
32 /// Flag to determine if an expression follows.
33 bool HasExpression;
34};
35
36/// All known assume clauses.
37static constexpr AssumptionClauseMappingInfo AssumptionClauseMappings[] = {
38#define OMP_ASSUME_CLAUSE(Identifier, StartsWith, HasDirectiveList, \
39 HasExpression) \
40 {Identifier, StartsWith, HasDirectiveList, HasExpression},
41#include "llvm/Frontend/OpenMP/OMPKinds.def"
42};
43
44inline std::string getAllAssumeClauseOptions() {
45 std::string S;
46 for (const AssumptionClauseMappingInfo &ACMI : AssumptionClauseMappings)
47 S += (S.empty() ? "'" : "', '") + ACMI.Identifier.str();
48 return S + "'";
49}
50
51} // namespace omp
52
53} // namespace llvm
54
55#endif // LLVM_FRONTEND_OPENMP_OMPASSUME_H
56

source code of llvm/include/llvm/Frontend/OpenMP/OMPAssume.h