@@ -3701,14 +3701,18 @@ class OMPSharedClause final
3701
3701
class OMPReductionClause final
3702
3702
: public OMPVarListClause<OMPReductionClause>,
3703
3703
public OMPClauseWithPostUpdate,
3704
- private llvm::TrailingObjects<OMPReductionClause, Expr *> {
3704
+ private llvm::TrailingObjects<OMPReductionClause, Expr *, bool > {
3705
3705
friend class OMPClauseReader ;
3706
3706
friend OMPVarListClause;
3707
3707
friend TrailingObjects;
3708
3708
3709
3709
// / Reduction modifier.
3710
3710
OpenMPReductionClauseModifier Modifier = OMPC_REDUCTION_unknown;
3711
3711
3712
+ // / Original Sharing modifier.
3713
+ OpenMPOriginalSharingModifier OriginalSharingModifier =
3714
+ OMPC_ORIGINAL_SHARING_default;
3715
+
3712
3716
// / Reduction modifier location.
3713
3717
SourceLocation ModifierLoc;
3714
3718
@@ -3734,12 +3738,14 @@ class OMPReductionClause final
3734
3738
OMPReductionClause (SourceLocation StartLoc, SourceLocation LParenLoc,
3735
3739
SourceLocation ModifierLoc, SourceLocation ColonLoc,
3736
3740
SourceLocation EndLoc,
3737
- OpenMPReductionClauseModifier Modifier, unsigned N,
3738
- NestedNameSpecifierLoc QualifierLoc,
3741
+ OpenMPReductionClauseModifier Modifier,
3742
+ OpenMPOriginalSharingModifier OriginalSharingModifier,
3743
+ unsigned N, NestedNameSpecifierLoc QualifierLoc,
3739
3744
const DeclarationNameInfo &NameInfo)
3740
3745
: OMPVarListClause<OMPReductionClause>(llvm::omp::OMPC_reduction,
3741
3746
StartLoc, LParenLoc, EndLoc, N),
3742
3747
OMPClauseWithPostUpdate (this ), Modifier(Modifier),
3748
+ OriginalSharingModifier (OriginalSharingModifier),
3743
3749
ModifierLoc (ModifierLoc), ColonLoc(ColonLoc),
3744
3750
QualifierLoc (QualifierLoc), NameInfo(NameInfo) {}
3745
3751
@@ -3755,6 +3761,11 @@ class OMPReductionClause final
3755
3761
// / Sets reduction modifier.
3756
3762
void setModifier (OpenMPReductionClauseModifier M) { Modifier = M; }
3757
3763
3764
+ // / Sets Original Sharing modifier.
3765
+ void setOriginalSharingModifier (OpenMPOriginalSharingModifier M) {
3766
+ OriginalSharingModifier = M;
3767
+ }
3768
+
3758
3769
// / Sets location of the modifier.
3759
3770
void setModifierLoc (SourceLocation Loc) { ModifierLoc = Loc; }
3760
3771
@@ -3800,6 +3811,31 @@ class OMPReductionClause final
3800
3811
// / reduction copies.
3801
3812
void setRHSExprs (ArrayRef<Expr *> RHSExprs);
3802
3813
3814
+ // / Set the list private reduction flags
3815
+ void setPrivateVariableReductionFlags (ArrayRef<bool > Flags) {
3816
+ assert (Flags.size () == varlist_size () &&
3817
+ " Number of private flags does not match vars" );
3818
+ llvm::copy (Flags, getTrailingObjects<bool >());
3819
+ }
3820
+
3821
+ // / Get the list of help private variable reduction flags
3822
+ MutableArrayRef<bool > getPrivateVariableReductionFlags () {
3823
+ return MutableArrayRef (getTrailingObjects<bool >(), varlist_size ());
3824
+ }
3825
+ ArrayRef<bool > getPrivateVariableReductionFlags () const {
3826
+ return ArrayRef (getTrailingObjects<bool >(), varlist_size ());
3827
+ }
3828
+
3829
+ // / Returns the number of Expr* objects in trailing storage
3830
+ size_t numTrailingObjects (OverloadToken<Expr *>) const {
3831
+ return varlist_size () * (Modifier == OMPC_REDUCTION_inscan ? 8 : 5 );
3832
+ }
3833
+
3834
+ // / Returns the number of bool flags in trailing storage
3835
+ size_t numTrailingObjects (OverloadToken<bool >) const {
3836
+ return varlist_size ();
3837
+ }
3838
+
3803
3839
// / Get the list of helper destination expressions.
3804
3840
MutableArrayRef<Expr *> getRHSExprs () {
3805
3841
return MutableArrayRef<Expr *>(getLHSExprs ().end (), varlist_size ());
@@ -3897,6 +3933,7 @@ class OMPReductionClause final
3897
3933
// / region with this clause.
3898
3934
// / \param PostUpdate Expression that must be executed after exit from the
3899
3935
// / OpenMP region with this clause.
3936
+ // / \param IsPrivateVarReduction array for private variable reduction flags
3900
3937
static OMPReductionClause *
3901
3938
Create (const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
3902
3939
SourceLocation ModifierLoc, SourceLocation ColonLoc,
@@ -3906,7 +3943,8 @@ class OMPReductionClause final
3906
3943
ArrayRef<Expr *> LHSExprs, ArrayRef<Expr *> RHSExprs,
3907
3944
ArrayRef<Expr *> ReductionOps, ArrayRef<Expr *> CopyOps,
3908
3945
ArrayRef<Expr *> CopyArrayTemps, ArrayRef<Expr *> CopyArrayElems,
3909
- Stmt *PreInit, Expr *PostUpdate);
3946
+ Stmt *PreInit, Expr *PostUpdate, ArrayRef<bool > IsPrivateVarReduction,
3947
+ OpenMPOriginalSharingModifier OriginalSharingModifier);
3910
3948
3911
3949
// / Creates an empty clause with the place for \a N variables.
3912
3950
// /
@@ -3920,6 +3958,11 @@ class OMPReductionClause final
3920
3958
// / Returns modifier.
3921
3959
OpenMPReductionClauseModifier getModifier () const { return Modifier; }
3922
3960
3961
+ // / Returns Original Sharing Modifier.
3962
+ OpenMPOriginalSharingModifier getOriginalSharingModifier () const {
3963
+ return OriginalSharingModifier;
3964
+ }
3965
+
3923
3966
// / Returns modifier location.
3924
3967
SourceLocation getModifierLoc () const { return ModifierLoc; }
3925
3968
@@ -3937,6 +3980,11 @@ class OMPReductionClause final
3937
3980
using helper_expr_range = llvm::iterator_range<helper_expr_iterator>;
3938
3981
using helper_expr_const_range =
3939
3982
llvm::iterator_range<helper_expr_const_iterator>;
3983
+ using helper_flag_iterator = MutableArrayRef<bool >::iterator;
3984
+ using helper_flag_const_iterator = ArrayRef<bool >::iterator;
3985
+ using helper_flag_range = llvm::iterator_range<helper_flag_iterator>;
3986
+ using helper_flag_const_range =
3987
+ llvm::iterator_range<helper_flag_const_iterator>;
3940
3988
3941
3989
helper_expr_const_range privates () const {
3942
3990
return helper_expr_const_range (getPrivates ().begin (), getPrivates ().end ());
@@ -3962,6 +4010,16 @@ class OMPReductionClause final
3962
4010
return helper_expr_range (getRHSExprs ().begin (), getRHSExprs ().end ());
3963
4011
}
3964
4012
4013
+ helper_flag_const_range private_var_reduction_flags () const {
4014
+ return helper_flag_const_range (getPrivateVariableReductionFlags ().begin (),
4015
+ getPrivateVariableReductionFlags ().end ());
4016
+ }
4017
+
4018
+ helper_flag_range private_var_reduction_flags () {
4019
+ return helper_flag_range (getPrivateVariableReductionFlags ().begin (),
4020
+ getPrivateVariableReductionFlags ().end ());
4021
+ }
4022
+
3965
4023
helper_expr_const_range reduction_ops () const {
3966
4024
return helper_expr_const_range (getReductionOps ().begin (),
3967
4025
getReductionOps ().end ());
0 commit comments