63 lines · c
1//===-- Decomposer.h -- Compound directive decomposition ------------------===//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#ifndef FORTRAN_LOWER_OPENMP_DECOMPOSER_H9#define FORTRAN_LOWER_OPENMP_DECOMPOSER_H10 11#include "flang/Lower/OpenMP/Clauses.h"12#include "mlir/IR/BuiltinOps.h"13#include "llvm/Frontend/OpenMP/ConstructDecompositionT.h"14#include "llvm/Frontend/OpenMP/OMP.h"15#include "llvm/Support/Compiler.h"16 17namespace llvm {18class raw_ostream;19}20 21namespace Fortran {22namespace semantics {23class SemanticsContext;24}25namespace lower::pft {26struct Evaluation;27}28} // namespace Fortran29 30namespace Fortran::lower::omp {31using UnitConstruct = tomp::DirectiveWithClauses<lower::omp::Clause>;32using ConstructQueue = List<UnitConstruct>;33 34LLVM_DUMP_METHOD llvm::raw_ostream &operator<<(llvm::raw_ostream &os,35 const UnitConstruct &uc);36 37// Given a potentially compound construct with a list of clauses that38// apply to it, break it up into individual sub-constructs each with39// the subset of applicable clauses (plus implicit clauses, if any).40// From that create a work queue where each work item corresponds to41// the sub-construct with its clauses.42ConstructQueue buildConstructQueue(mlir::ModuleOp modOp,43 semantics::SemanticsContext &semaCtx,44 lower::pft::Evaluation &eval,45 const parser::CharBlock &source,46 llvm::omp::Directive compound,47 const List<Clause> &clauses);48 49bool isLastItemInQueue(ConstructQueue::const_iterator item,50 const ConstructQueue &queue);51 52/// Try to match the leaf constructs conforming the given \c directive to the53/// range of leaf constructs starting from \c item to the end of the \c queue.54/// If \c directive doesn't represent a compound directive, check that \c item55/// matches that directive and is the only element before the end of the56/// \c queue.57bool matchLeafSequence(ConstructQueue::const_iterator item,58 const ConstructQueue &queue,59 llvm::omp::Directive directive);60} // namespace Fortran::lower::omp61 62#endif // FORTRAN_LOWER_OPENMP_DECOMPOSER_H63