@@ -837,9 +837,9 @@ convertOmpSections(Operation &opInst, llvm::IRBuilderBase &builder,
837
837
// TODO: Support the following clauses: private, firstprivate, lastprivate,
838
838
// allocate
839
839
if (!sectionsOp.getAllocateVars ().empty () ||
840
- !sectionsOp.getAllocatorVars ().empty ())
841
- return emitError ( sectionsOp.getLoc ())
842
- << " allocate clause is not supported for sections construct " ;
840
+ !sectionsOp.getAllocatorVars ().empty () ||
841
+ !sectionsOp. getPrivateVars (). empty () || sectionsOp.getPrivateSyms ())
842
+ return opInst. emitError ( " unhandled clauses for translation to LLVM IR " ) ;
843
843
844
844
llvm::ArrayRef<bool > isByRef = getIsByRef (sectionsOp.getReductionByref ());
845
845
assert (isByRef.size () == sectionsOp.getNumReductionVars ());
@@ -945,6 +945,9 @@ convertOmpSingle(omp::SingleOp &singleOp, llvm::IRBuilderBase &builder,
945
945
using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
946
946
llvm::OpenMPIRBuilder::LocationDescription ompLoc (builder);
947
947
LogicalResult bodyGenStatus = success ();
948
+ if (!singleOp.getPrivateVars ().empty () || singleOp.getPrivateSyms ())
949
+ return singleOp.emitError (" unhandled clauses for translation to LLVM IR" );
950
+
948
951
auto bodyCB = [&](InsertPointTy allocaIP, InsertPointTy codegenIP) {
949
952
builder.restoreIP (codegenIP);
950
953
convertOmpOpRegions (singleOp.getRegion (), " omp.single.region" , builder,
@@ -976,7 +979,8 @@ convertOmpTeams(omp::TeamsOp op, llvm::IRBuilderBase &builder,
976
979
LLVM::ModuleTranslation &moduleTranslation) {
977
980
using InsertPointTy = llvm::OpenMPIRBuilder::InsertPointTy;
978
981
LogicalResult bodyGenStatus = success ();
979
- if (!op.getAllocatorVars ().empty () || op.getReductionSyms ())
982
+ if (!op.getAllocatorVars ().empty () || op.getReductionSyms () ||
983
+ !op.getPrivateVars ().empty () || op.getPrivateSyms ())
980
984
return op.emitError (" unhandled clauses for translation to LLVM IR" );
981
985
982
986
auto bodyCB = [&](InsertPointTy allocaIP, InsertPointTy codegenIP) {
@@ -1017,7 +1021,8 @@ convertOmpTaskOp(omp::TaskOp taskOp, llvm::IRBuilderBase &builder,
1017
1021
LogicalResult bodyGenStatus = success ();
1018
1022
if (taskOp.getUntiedAttr () || taskOp.getMergeableAttr () ||
1019
1023
taskOp.getInReductionSyms () || taskOp.getPriority () ||
1020
- !taskOp.getAllocateVars ().empty ()) {
1024
+ !taskOp.getAllocateVars ().empty () || !taskOp.getPrivateVars ().empty () ||
1025
+ taskOp.getPrivateSyms ()) {
1021
1026
return taskOp.emitError (" unhandled clauses for translation to LLVM IR" );
1022
1027
}
1023
1028
auto bodyCB = [&](InsertPointTy allocaIP, InsertPointTy codegenIP) {
@@ -1085,11 +1090,28 @@ convertOmpTaskgroupOp(omp::TaskgroupOp tgOp, llvm::IRBuilderBase &builder,
1085
1090
ompLoc, allocaIP, bodyCB));
1086
1091
return bodyGenStatus;
1087
1092
}
1093
+
1094
+ static LogicalResult
1095
+ convertOmpTaskwaitOp (omp::TaskwaitOp twOp, llvm::IRBuilderBase &builder,
1096
+ LLVM::ModuleTranslation &moduleTranslation) {
1097
+ if (!twOp.getDependVars ().empty () || twOp.getDependKinds () ||
1098
+ twOp.getNowait ())
1099
+ return twOp.emitError (" unhandled clauses for translation to LLVM IR" );
1100
+
1101
+ moduleTranslation.getOpenMPBuilder ()->createTaskwait (builder.saveIP ());
1102
+ return success ();
1103
+ }
1104
+
1088
1105
// / Converts an OpenMP workshare loop into LLVM IR using OpenMPIRBuilder.
1089
1106
static LogicalResult
1090
1107
convertOmpWsloop (Operation &opInst, llvm::IRBuilderBase &builder,
1091
1108
LLVM::ModuleTranslation &moduleTranslation) {
1092
1109
auto wsloopOp = cast<omp::WsloopOp>(opInst);
1110
+ if (!wsloopOp.getAllocateVars ().empty () ||
1111
+ !wsloopOp.getAllocatorVars ().empty () ||
1112
+ !wsloopOp.getPrivateVars ().empty () || wsloopOp.getPrivateSyms ())
1113
+ return opInst.emitError (" unhandled clauses for translation to LLVM IR" );
1114
+
1093
1115
// FIXME: Here any other nested wrappers (e.g. omp.simd) are skipped, so
1094
1116
// codegen for composite constructs like 'DO/FOR SIMD' will be the same as for
1095
1117
// 'DO/FOR'.
@@ -1603,6 +1625,12 @@ convertOmpSimd(Operation &opInst, llvm::IRBuilderBase &builder,
1603
1625
auto simdOp = cast<omp::SimdOp>(opInst);
1604
1626
auto loopOp = cast<omp::LoopNestOp>(simdOp.getWrappedLoop ());
1605
1627
1628
+ if (!simdOp.getLinearVars ().empty () || !simdOp.getLinearStepVars ().empty () ||
1629
+ !simdOp.getPrivateVars ().empty () || simdOp.getPrivateSyms () ||
1630
+ !simdOp.getReductionVars ().empty () || simdOp.getReductionByref () ||
1631
+ simdOp.getReductionSyms ())
1632
+ return opInst.emitError (" unhandled clauses for translation to LLVM IR" );
1633
+
1606
1634
llvm::OpenMPIRBuilder::LocationDescription ompLoc (builder);
1607
1635
1608
1636
// Generator of the canonical loop body.
@@ -3032,6 +3060,18 @@ static bool targetOpSupported(Operation &opInst) {
3032
3060
return false ;
3033
3061
}
3034
3062
3063
+ if (!targetOp.getAllocateVars ().empty () ||
3064
+ !targetOp.getAllocatorVars ().empty ()) {
3065
+ opInst.emitError (" Allocate clause not yet supported" );
3066
+ return false ;
3067
+ }
3068
+
3069
+ if (!targetOp.getInReductionVars ().empty () ||
3070
+ targetOp.getInReductionByref () || targetOp.getInReductionSyms ()) {
3071
+ opInst.emitError (" In reduction clause not yet supported" );
3072
+ return false ;
3073
+ }
3074
+
3035
3075
return true ;
3036
3076
}
3037
3077
@@ -3427,10 +3467,6 @@ convertHostOrTargetOperation(Operation *op, llvm::IRBuilderBase &builder,
3427
3467
ompBuilder->createBarrier (builder.saveIP (), llvm::omp::OMPD_barrier);
3428
3468
return success ();
3429
3469
})
3430
- .Case ([&](omp::TaskwaitOp) {
3431
- ompBuilder->createTaskwait (builder.saveIP ());
3432
- return success ();
3433
- })
3434
3470
.Case ([&](omp::TaskyieldOp) {
3435
3471
ompBuilder->createTaskyield (builder.saveIP ());
3436
3472
return success ();
@@ -3498,6 +3534,9 @@ convertHostOrTargetOperation(Operation *op, llvm::IRBuilderBase &builder,
3498
3534
.Case ([&](omp::TaskgroupOp op) {
3499
3535
return convertOmpTaskgroupOp (op, builder, moduleTranslation);
3500
3536
})
3537
+ .Case ([&](omp::TaskwaitOp op) {
3538
+ return convertOmpTaskwaitOp (op, builder, moduleTranslation);
3539
+ })
3501
3540
.Case <omp::YieldOp, omp::TerminatorOp, omp::DeclareReductionOp,
3502
3541
omp::CriticalDeclareOp>([](auto op) {
3503
3542
// `yield` and `terminator` can be just omitted. The block structure
0 commit comments