Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:55

0001 //===- OpenMP/OMPAssume.h --- OpenMP assumption helper functions  - C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 /// \file
0009 ///
0010 /// This file provides helper functions and classes to deal with OpenMP
0011 /// assumptions, e.g., as used by `[begin/end] assumes` and `assume`.
0012 ///
0013 //===----------------------------------------------------------------------===//
0014 
0015 #ifndef LLVM_FRONTEND_OPENMP_OMPASSUME_H
0016 #define LLVM_FRONTEND_OPENMP_OMPASSUME_H
0017 
0018 #include "llvm/ADT/StringRef.h"
0019 
0020 namespace llvm {
0021 
0022 namespace omp {
0023 
0024 /// Helper to describe assume clauses.
0025 struct AssumptionClauseMappingInfo {
0026   /// The identifier describing the (beginning of the) clause.
0027   llvm::StringLiteral Identifier;
0028   /// Flag to determine if the identifier is a full name or the start of a name.
0029   bool StartsWith;
0030   /// Flag to determine if a directive lists follows.
0031   bool HasDirectiveList;
0032   /// Flag to determine if an expression follows.
0033   bool HasExpression;
0034 };
0035 
0036 /// All known assume clauses.
0037 static constexpr AssumptionClauseMappingInfo AssumptionClauseMappings[] = {
0038 #define OMP_ASSUME_CLAUSE(Identifier, StartsWith, HasDirectiveList,            \
0039                           HasExpression)                                       \
0040   {Identifier, StartsWith, HasDirectiveList, HasExpression},
0041 #include "llvm/Frontend/OpenMP/OMPKinds.def"
0042 };
0043 
0044 inline std::string getAllAssumeClauseOptions() {
0045   std::string S;
0046   for (const AssumptionClauseMappingInfo &ACMI : AssumptionClauseMappings)
0047     S += (S.empty() ? "'" : "', '") + ACMI.Identifier.str();
0048   return S + "'";
0049 }
0050 
0051 } // namespace omp
0052 
0053 } // namespace llvm
0054 
0055 #endif // LLVM_FRONTEND_OPENMP_OMPASSUME_H