14#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
20template <
typename OpTy>
21class OpenMPClauseCIREmitter final
24 CIRGen::CIRGenFunction &cgf;
25 CIRGen::CIRGenBuilderTy &builder;
28 OpenMPClauseCIREmitter(OpTy &operation, CIRGen::CIRGenFunction &cgf,
29 CIRGen::CIRGenBuilderTy &builder)
30 : operation(operation), cgf(cgf), builder(builder) {}
32 void VisitOMPClause(
const OMPClause *clause) {
33 cgf.cgm.errorNYI(clause->
getBeginLoc(),
"OpenMPClause ",
37 void VisitOMPProcBindClause(
const OMPProcBindClause *clause) {
38 if constexpr (std::is_same_v<OpTy, mlir::omp::ParallelOp>) {
39 mlir::omp::ClauseProcBindKind
kind;
41 case llvm::omp::ProcBindKind::OMP_PROC_BIND_master:
42 kind = mlir::omp::ClauseProcBindKind::Master;
44 case llvm::omp::ProcBindKind::OMP_PROC_BIND_close:
45 kind = mlir::omp::ClauseProcBindKind::Close;
47 case llvm::omp::ProcBindKind::OMP_PROC_BIND_spread:
48 kind = mlir::omp::ClauseProcBindKind::Spread;
50 case llvm::omp::ProcBindKind::OMP_PROC_BIND_primary:
51 kind = mlir::omp::ClauseProcBindKind::Primary;
53 case llvm::omp::ProcBindKind::OMP_PROC_BIND_default:
58 case llvm::omp::ProcBindKind::OMP_PROC_BIND_unknown:
59 llvm_unreachable(
"unknown proc-bind kind");
61 operation.setProcBindKind(kind);
65 "OMPProcBindClause unimplemented on this directive kind");
69 void emitClauses(ArrayRef<const OMPClause *> clauses) {
70 for (
const auto *
c : clauses)
74template <
typename OpTy>
77 return OpenMPClauseCIREmitter<OpTy>(op, cgf, builder);
82void CIRGenFunction::emitOpenMPClauses(Op &op,
84 mlir::OpBuilder::InsertionGuard guardCase(builder);
85 builder.setInsertionPoint(op);
86 makeClauseEmitter(op, *
this, builder).emitClauses(clauses);
92 template void CIRGenFunction::emitOpenMPClauses<N>( \
93 N &, ArrayRef<const OMPClause *>);
__device__ __2f16 float c
SourceLocation getBeginLoc() const
Returns the starting location of the clause.
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
llvm::omp::ProcBindKind getProcBindKind() const
Returns kind of the clause.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
The JSON file list parser is used to communicate input to InstallAPI.