Skip to content

Commit 5eb9c6b

Browse files
committed
merge main into amd-staging
2 parents be10cd0 + 74090de commit 5eb9c6b

File tree

116 files changed

+2649
-1480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+2649
-1480
lines changed

clang/docs/OpenMPSupport.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ implementation.
153153
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
154154
| device | clause: extended device | :good:`done` | |
155155
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
156-
| device | clause: uses_allocators clause | :good:`done` | |
156+
| device | clause: uses_allocators clause | :good:`done` | https://github.com/llvm/llvm-project/pull/157025 |
157157
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
158158
| device | clause: in_reduction | :part:`worked on` | r308768 |
159159
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
@@ -578,6 +578,7 @@ implementation.
578578
| | | | |
579579
| | | | Flang parser: https://github.com/llvm/llvm-project/pull/153807 |
580580
| | | | Flang sema: https://github.com/llvm/llvm-project/pull/154779 |
581+
| | | | Clang parse/sema: https://github.com/llvm/llvm-project/pull/158134 |
581582
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
582583
| variable-category on default clause | :good:`done` | :none:`unclaimed` | |
583584
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,9 +816,11 @@ OpenMP Support
816816
- Allow array length to be omitted in array section subscript expression.
817817
- Fixed non-contiguous strided update in the ``omp target update`` directive with the ``from`` clause.
818818
- Properly handle array section/assumed-size array privatization in C/C++.
819+
- Added support to handle new syntax of the ``uses_allocators`` clause.
819820
- Added support for ``variable-category`` modifier in ``default clause``.
820821
- Added support for ``defaultmap`` directive implicit-behavior ``storage``.
821822
- Added support for ``defaultmap`` directive implicit-behavior ``private``.
823+
- Added parsing and semantic analysis support for ``groupprivate`` directive.
822824

823825
Improvements
824826
^^^^^^^^^^^^

clang/include/clang/AST/ASTMutationListener.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ class ASTMutationListener {
125125
/// \param D the declaration marked OpenMP threadprivate.
126126
virtual void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {}
127127

128+
/// A declaration is marked as OpenMP groupprivate which was not
129+
/// previously marked as groupprivate.
130+
///
131+
/// \param D the declaration marked OpenMP groupprivate.
132+
virtual void DeclarationMarkedOpenMPGroupPrivate(const Decl *D) {}
133+
128134
/// A declaration is marked as OpenMP declaretarget which was not
129135
/// previously marked as declaretarget.
130136
///

clang/include/clang/AST/ASTNodeTraverser.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,11 @@ class ASTNodeTraverser
620620
Visit(E);
621621
}
622622

623+
void VisitOMPGroupPrivateDecl(const OMPGroupPrivateDecl *D) {
624+
for (const auto *E : D->varlist())
625+
Visit(E);
626+
}
627+
623628
void VisitOMPDeclareReductionDecl(const OMPDeclareReductionDecl *D) {
624629
Visit(D->getCombiner());
625630
if (const auto *Initializer = D->getInitializer())

clang/include/clang/AST/DeclOpenMP.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,68 @@ class OMPThreadPrivateDecl final : public OMPDeclarativeDirective<Decl> {
158158
static bool classofKind(Kind K) { return K == OMPThreadPrivate; }
159159
};
160160

161+
/// This represents '#pragma omp groupprivate ...' directive.
162+
/// For example, in the following, both 'a' and 'A::b' are groupprivate:
163+
///
164+
/// \code
165+
/// int a;
166+
/// #pragma omp groupprivate(a)
167+
/// struct A {
168+
/// static int b;
169+
/// #pragma omp groupprivate(b)
170+
/// };
171+
/// \endcode
172+
///
173+
class OMPGroupPrivateDecl final : public OMPDeclarativeDirective<Decl> {
174+
friend class OMPDeclarativeDirective<Decl>;
175+
176+
LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION();
177+
178+
OMPGroupPrivateDecl(DeclContext *DC = nullptr,
179+
SourceLocation L = SourceLocation())
180+
: OMPDeclarativeDirective<Decl>(OMPGroupPrivate, DC, L) {}
181+
182+
ArrayRef<const Expr *> getVars() const {
183+
auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
184+
return {Storage, Data->getNumChildren()};
185+
}
186+
187+
MutableArrayRef<Expr *> getVars() {
188+
auto **Storage = reinterpret_cast<Expr **>(Data->getChildren().data());
189+
return {Storage, Data->getNumChildren()};
190+
}
191+
192+
void setVars(ArrayRef<Expr *> VL);
193+
194+
public:
195+
static OMPGroupPrivateDecl *Create(ASTContext &C, DeclContext *DC,
196+
SourceLocation L, ArrayRef<Expr *> VL);
197+
static OMPGroupPrivateDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID,
198+
unsigned N);
199+
200+
typedef MutableArrayRef<Expr *>::iterator varlist_iterator;
201+
typedef ArrayRef<const Expr *>::iterator varlist_const_iterator;
202+
typedef llvm::iterator_range<varlist_iterator> varlist_range;
203+
typedef llvm::iterator_range<varlist_const_iterator> varlist_const_range;
204+
205+
unsigned varlist_size() const { return Data->getNumChildren(); }
206+
bool varlist_empty() const { return Data->getChildren().empty(); }
207+
208+
varlist_range varlist() {
209+
return varlist_range(varlist_begin(), varlist_end());
210+
}
211+
varlist_const_range varlist() const {
212+
return varlist_const_range(varlist_begin(), varlist_end());
213+
}
214+
varlist_iterator varlist_begin() { return getVars().begin(); }
215+
varlist_iterator varlist_end() { return getVars().end(); }
216+
varlist_const_iterator varlist_begin() const { return getVars().begin(); }
217+
varlist_const_iterator varlist_end() const { return getVars().end(); }
218+
219+
static bool classof(const Decl *D) { return classofKind(D->getKind()); }
220+
static bool classofKind(Kind K) { return K == OMPGroupPrivate; }
221+
};
222+
161223
enum class OMPDeclareReductionInitKind {
162224
Call, // Initialized by function call.
163225
Direct, // omp_priv(<expr>)

clang/include/clang/AST/Expr.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,8 @@ class Expr : public ValueStmt {
634634

635635
EvalStatus() = default;
636636

637-
// hasSideEffects - Return true if the evaluated expression has
638-
// side effects.
637+
/// Return true if the evaluated expression has
638+
/// side effects.
639639
bool hasSideEffects() const {
640640
return HasSideEffects;
641641
}
@@ -646,8 +646,8 @@ class Expr : public ValueStmt {
646646
/// Val - This is the value the expression can be folded to.
647647
APValue Val;
648648

649-
// isGlobalLValue - Return true if the evaluated lvalue expression
650-
// is global.
649+
/// Return true if the evaluated lvalue expression
650+
/// is global.
651651
bool isGlobalLValue() const;
652652
};
653653

@@ -715,9 +715,7 @@ class Expr : public ValueStmt {
715715
/// EvaluateKnownConstInt - Call EvaluateAsRValue and return the folded
716716
/// integer. This must be called on an expression that constant folds to an
717717
/// integer.
718-
llvm::APSInt EvaluateKnownConstInt(
719-
const ASTContext &Ctx,
720-
SmallVectorImpl<PartialDiagnosticAt> *Diag = nullptr) const;
718+
llvm::APSInt EvaluateKnownConstInt(const ASTContext &Ctx) const;
721719

722720
llvm::APSInt EvaluateKnownConstIntCheckOverflow(
723721
const ASTContext &Ctx,

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,12 @@ DEF_TRAVERSE_DECL(OMPThreadPrivateDecl, {
18871887
}
18881888
})
18891889

1890+
DEF_TRAVERSE_DECL(OMPGroupPrivateDecl, {
1891+
for (auto *I : D->varlist()) {
1892+
TRY_TO(TraverseStmt(I));
1893+
}
1894+
})
1895+
18901896
DEF_TRAVERSE_DECL(OMPRequiresDecl, {
18911897
for (auto *C : D->clauselists()) {
18921898
TRY_TO(TraverseOMPClause(C));

clang/include/clang/Basic/Attr.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4585,6 +4585,12 @@ def OMPThreadPrivateDecl : InheritableAttr {
45854585
let Documentation = [InternalOnly];
45864586
}
45874587

4588+
def OMPGroupPrivateDecl : InheritableAttr {
4589+
let Spellings = [];
4590+
let SemaHandler = 0;
4591+
let Documentation = [InternalOnly];
4592+
}
4593+
45884594
def OMPCaptureNoInit : InheritableAttr {
45894595
// This attribute has no spellings as it is only ever created implicitly.
45904596
let Spellings = [];

clang/include/clang/Basic/DeclNodes.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ def OutlinedFunction : DeclNode<Decl>, DeclContext;
106106
def Captured : DeclNode<Decl>, DeclContext;
107107
def Import : DeclNode<Decl>;
108108
def OMPThreadPrivate : DeclNode<Decl>;
109+
def OMPGroupPrivate : DeclNode<Decl>;
109110
def OMPAllocate : DeclNode<Decl>;
110111
def OMPRequires : DeclNode<Decl>;
111112
def Empty : DeclNode<Decl>;

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,6 +1497,8 @@ def err_omp_multiple_step_or_linear_modifier : Error<
14971497
"multiple %select{'step size'|'linear modifier'}0 found in linear clause">;
14981498
def err_omp_deprecate_old_syntax: Error<
14991499
"old syntax '%0' on '%1' clause was deprecated, use new syntax '%2'">;
1500+
def err_omp_allocator_comma_separator :
1501+
Error<"',' not allowed as separator in 'uses_allocators' clause, use ';' instead">;
15001502
def warn_omp_future_directive_spelling: Warning<
15011503
"directive spelling '%0' is introduced in a later OpenMP version">,
15021504
InGroup<OpenMPFuture>;

0 commit comments

Comments
 (0)