//===- OpenMPDialect.h - MLIR Dialect for OpenMP ----------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file declares the OpenMP dialect in MLIR.
//
//===----------------------------------------------------------------------===//

#ifndef MLIR_DIALECT_OPENMP_OPENMPDIALECT_H_
#define MLIR_DIALECT_OPENMP_OPENMPDIALECT_H_

#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/OpenACCMPCommon/Interfaces/AtomicInterfaces.h"
#include "mlir/Dialect/OpenACCMPCommon/Interfaces/OpenACCMPOpsInterfaces.h"
#include "mlir/Dialect/OpenMP/OpenMPInterfaces.h"
#include "mlir/Dialect/OpenMP/OpenMPUtils.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/OpDefinition.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "llvm/Frontend/OpenMP/OMPConstants.h"
#include "llvm/Frontend/OpenMP/OMPDeviceConstants.h"

#define GET_TYPEDEF_CLASSES
#include "mlir/Dialect/OpenMP/OpenMPOpsTypes.h.inc"

#include "mlir/Dialect/OpenMP/OpenMPOpsDialect.h.inc"

#include "mlir/Dialect/OpenMP/OpenMPClauseOperands.h"

#include "mlir/Dialect/OpenMP/OpenMPTypeInterfaces.h.inc"

#define GET_OP_CLASSES
#include "mlir/Dialect/OpenMP/OpenMPOps.h.inc"

/// Operations implementing LoopWrapperInterface.
#define OMP_LOOP_WRAPPER_OPS                                                   \
  mlir::omp::WorkshareLoopWrapperOp, mlir::omp::LoopOp, mlir::omp::WsloopOp,   \
      mlir::omp::SimdOp, mlir::omp::DistributeOp, mlir::omp::TaskloopWrapperOp

/// Operations implementing OutlineableOpenMPOpInterface.
#define OMP_OUTLINEABLE_OPS                                                    \
  mlir::omp::ParallelOp, mlir::omp::TeamsOp, mlir::omp::TaskOp,                \
      mlir::omp::TargetOp

namespace mlir::omp {
/// Find the omp.new_cli, generator, and consumer of a canonical loop info.
std::tuple<NewCliOp, OpOperand *, OpOperand *> decodeCli(mlir::Value cli);

/// Convert a proc_bind kind from the LLVM frontend enum to the corresponding
/// OpenMP dialect enum. The LLVM 'default' and 'unknown' kinds have no dialect
/// counterpart and are not valid inputs.
ClauseProcBindKind convertProcBindKind(llvm::omp::ProcBindKind kind);
} // namespace mlir::omp

#endif // MLIR_DIALECT_OPENMP_OPENMPDIALECT_H_
