Skip to content

Commit 21166d1

Browse files
committed
merge main into amd-staging
Change-Id: I40141e59bb99df641b19fe85a0e03175cfc5fbbe
2 parents 800cee3 + bf3d5db commit 21166d1

File tree

368 files changed

+11790
-4458
lines changed

Some content is hidden

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

368 files changed

+11790
-4458
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,10 @@ linux_projects=$(add-dependencies ${linux_projects_to_test} | sort | uniq)
233233

234234
windows_projects_to_test=$(exclude-windows $(compute-projects-to-test ${modified_projects}))
235235
windows_check_targets=$(check-targets ${windows_projects_to_test} | sort | uniq)
236-
windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq)
236+
# Temporary disable the windows job.
237+
# See https://discourse.llvm.org/t/rfc-future-of-windows-pre-commit-ci/76840
238+
#windows_projects=$(add-dependencies ${windows_projects_to_test} | sort | uniq)
239+
windows_projects=""
237240

238241
# Generate the appropriate pipeline
239242
if [[ "${linux_projects}" != "" ]]; then

.github/workflows/approved-prs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "Prompt reviewers to merge PRs on behalf of authors"
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request_review:
8+
types:
9+
- submitted
10+
11+
jobs:
12+
merge-on-behalf-information-comment:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
pull-requests: write
16+
if: >-
17+
(github.repository == 'llvm/llvm-project') &&
18+
(github.event.review.state == 'APPROVED')
19+
steps:
20+
- name: Checkout Automation Script
21+
uses: actions/checkout@v4
22+
with:
23+
sparse-checkout: llvm/utils/git/
24+
ref: main
25+
26+
- name: Setup Automation Script
27+
working-directory: ./llvm/utils/git/
28+
run: |
29+
pip install -r requirements.txt
30+
31+
- name: Add Merge On Behalf Comment
32+
working-directory: ./llvm/utils/git/
33+
run: |
34+
python3 ./github-automation.py \
35+
--token '${{ secrets.GITHUB_TOKEN }}' \
36+
pr-merge-on-behalf-information \
37+
--issue-number "${{ github.event.pull_request.number }}" \
38+
--author "${{ github.event.pull_request.user.login }}" \
39+
--reviewer "${{ github.event.review.user.login }}"

clang/docs/LanguageExtensions.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,6 +2764,39 @@ Query for this feature with ``__has_builtin(__builtin_readcyclecounter)``. Note
27642764
that even if present, its use may depend on run-time privilege or other OS
27652765
controlled state.
27662766
2767+
``__builtin_readsteadycounter``
2768+
-------------------------------
2769+
2770+
``__builtin_readsteadycounter`` is used to access the fixed frequency counter
2771+
register (or a similar steady-rate clock) on those targets that support it.
2772+
The function is similar to ``__builtin_readcyclecounter`` above except that the
2773+
frequency is fixed, making it suitable for measuring elapsed time.
2774+
2775+
**Syntax**:
2776+
2777+
.. code-block:: c++
2778+
2779+
__builtin_readsteadycounter()
2780+
2781+
**Example of Use**:
2782+
2783+
.. code-block:: c++
2784+
2785+
unsigned long long t0 = __builtin_readsteadycounter();
2786+
do_something();
2787+
unsigned long long t1 = __builtin_readsteadycounter();
2788+
unsigned long long secs_to_do_something = (t1 - t0) / tick_rate;
2789+
2790+
**Description**:
2791+
2792+
The ``__builtin_readsteadycounter()`` builtin returns the frequency counter value.
2793+
When not supported by the target, the return value is always zero. This builtin
2794+
takes no arguments and produces an unsigned long long result. The builtin does
2795+
not guarantee any particular frequency, only that it is stable. Knowledge of the
2796+
counter's true frequency will need to be provided by the user.
2797+
2798+
Query for this feature with ``__has_builtin(__builtin_readsteadycounter)``.
2799+
27672800
``__builtin_dump_struct``
27682801
-------------------------
27692802

clang/docs/ReleaseNotes.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ C23 Feature Support
122122
Non-comprehensive list of changes in this release
123123
-------------------------------------------------
124124

125+
- Added ``__builtin_readsteadycounter`` for reading fixed frequency hardware
126+
counters.
127+
125128
New Compiler Flags
126129
------------------
127130

@@ -161,6 +164,8 @@ Improvements to Clang's diagnostics
161164
- The ``-Wshorten-64-to-32`` diagnostic is now grouped under ``-Wimplicit-int-conversion`` instead
162165
of ``-Wconversion``. Fixes `#69444 <https://github.com/llvm/llvm-project/issues/69444>`_.
163166

167+
- Clang now diagnoses friend declarations with an ``enum`` elaborated-type-specifier in language modes after C++98.
168+
164169
Improvements to Clang's time-trace
165170
----------------------------------
166171

@@ -260,6 +265,8 @@ X86 Support
260265
Arm and AArch64 Support
261266
^^^^^^^^^^^^^^^^^^^^^^^
262267

268+
- Fixed the incorrect definition of the __ARM_ARCH macro for architectures greater than or equal to v8.1.
269+
263270
Android Support
264271
^^^^^^^^^^^^^^^
265272

clang/include/clang-c/Index.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2145,7 +2145,11 @@ enum CXCursorKind {
21452145
*/
21462146
CXCursor_OMPScopeDirective = 306,
21472147

2148-
CXCursor_LastStmt = CXCursor_OMPScopeDirective,
2148+
/** OpenACC Compute Construct.
2149+
*/
2150+
CXCursor_OpenACCComputeConstruct = 320,
2151+
2152+
CXCursor_LastStmt = CXCursor_OpenACCComputeConstruct,
21492153

21502154
/**
21512155
* Cursor that represents the translation unit itself.

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "clang/AST/Stmt.h"
3535
#include "clang/AST/StmtCXX.h"
3636
#include "clang/AST/StmtObjC.h"
37+
#include "clang/AST/StmtOpenACC.h"
3738
#include "clang/AST/StmtOpenMP.h"
3839
#include "clang/AST/TemplateBase.h"
3940
#include "clang/AST/TemplateName.h"
@@ -505,6 +506,9 @@ template <typename Derived> class RecursiveASTVisitor {
505506
bool VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *Node);
506507

507508
bool PostVisitStmt(Stmt *S);
509+
bool TraverseOpenACCConstructStmt(OpenACCConstructStmt *S);
510+
bool
511+
TraverseOpenACCAssociatedStmtConstruct(OpenACCAssociatedStmtConstruct *S);
508512
};
509513

510514
template <typename Derived>
@@ -3910,6 +3914,24 @@ bool RecursiveASTVisitor<Derived>::VisitOMPXBareClause(OMPXBareClause *C) {
39103914
return true;
39113915
}
39123916

3917+
template <typename Derived>
3918+
bool RecursiveASTVisitor<Derived>::TraverseOpenACCConstructStmt(
3919+
OpenACCConstructStmt *) {
3920+
// TODO OpenACC: When we implement clauses, ensure we traverse them here.
3921+
return true;
3922+
}
3923+
3924+
template <typename Derived>
3925+
bool RecursiveASTVisitor<Derived>::TraverseOpenACCAssociatedStmtConstruct(
3926+
OpenACCAssociatedStmtConstruct *S) {
3927+
TRY_TO(TraverseOpenACCConstructStmt(S));
3928+
TRY_TO(TraverseStmt(S->getAssociatedStmt()));
3929+
return true;
3930+
}
3931+
3932+
DEF_TRAVERSE_STMT(OpenACCComputeConstruct,
3933+
{ TRY_TO(TraverseOpenACCAssociatedStmtConstruct(S)); })
3934+
39133935
// FIXME: look at the following tricky-seeming exprs to see if we
39143936
// need to recurse on anything. These are ones that have methods
39153937
// returning decls or qualtypes or nestednamespecifier -- though I'm

clang/include/clang/AST/StmtOpenACC.h

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
//===- StmtOpenACC.h - Classes for OpenACC directives ----------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
/// \file
9+
/// This file defines OpenACC AST classes for statement-level contructs.
10+
///
11+
//===----------------------------------------------------------------------===//
12+
13+
#ifndef LLVM_CLANG_AST_STMTOPENACC_H
14+
#define LLVM_CLANG_AST_STMTOPENACC_H
15+
16+
#include "clang/AST/Stmt.h"
17+
#include "clang/Basic/OpenACCKinds.h"
18+
#include "clang/Basic/SourceLocation.h"
19+
20+
namespace clang {
21+
/// This is the base class for an OpenACC statement-level construct, other
22+
/// construct types are expected to inherit from this.
23+
class OpenACCConstructStmt : public Stmt {
24+
friend class ASTStmtWriter;
25+
friend class ASTStmtReader;
26+
/// The directive kind. Each implementation of this interface should handle
27+
/// specific kinds.
28+
OpenACCDirectiveKind Kind = OpenACCDirectiveKind::Invalid;
29+
/// The location of the directive statement, from the '#' to the last token of
30+
/// the directive.
31+
SourceRange Range;
32+
33+
// TODO OPENACC: Clauses should probably be collected in this class.
34+
35+
protected:
36+
OpenACCConstructStmt(StmtClass SC, OpenACCDirectiveKind K,
37+
SourceLocation Start, SourceLocation End)
38+
: Stmt(SC), Kind(K), Range(Start, End) {}
39+
40+
public:
41+
OpenACCDirectiveKind getDirectiveKind() const { return Kind; }
42+
43+
static bool classof(const Stmt *S) {
44+
return S->getStmtClass() >= firstOpenACCConstructStmtConstant &&
45+
S->getStmtClass() <= lastOpenACCConstructStmtConstant;
46+
}
47+
48+
SourceLocation getBeginLoc() const { return Range.getBegin(); }
49+
SourceLocation getEndLoc() const { return Range.getEnd(); }
50+
51+
child_range children() {
52+
return child_range(child_iterator(), child_iterator());
53+
}
54+
55+
const_child_range children() const {
56+
return const_cast<OpenACCConstructStmt *>(this)->children();
57+
}
58+
};
59+
60+
/// This is a base class for any OpenACC statement-level constructs that have an
61+
/// associated statement. This class is not intended to be instantiated, but is
62+
/// a convenient place to hold the associated statement.
63+
class OpenACCAssociatedStmtConstruct : public OpenACCConstructStmt {
64+
friend class ASTStmtWriter;
65+
friend class ASTStmtReader;
66+
template <typename Derived> friend class RecursiveASTVisitor;
67+
Stmt *AssociatedStmt = nullptr;
68+
69+
protected:
70+
OpenACCAssociatedStmtConstruct(StmtClass SC, OpenACCDirectiveKind K,
71+
SourceLocation Start, SourceLocation End)
72+
: OpenACCConstructStmt(SC, K, Start, End) {}
73+
74+
void setAssociatedStmt(Stmt *S) { AssociatedStmt = S; }
75+
Stmt *getAssociatedStmt() { return AssociatedStmt; }
76+
const Stmt *getAssociatedStmt() const {
77+
return const_cast<OpenACCAssociatedStmtConstruct *>(this)
78+
->getAssociatedStmt();
79+
}
80+
81+
public:
82+
child_range children() {
83+
if (getAssociatedStmt())
84+
return child_range(&AssociatedStmt, &AssociatedStmt + 1);
85+
return child_range(child_iterator(), child_iterator());
86+
}
87+
88+
const_child_range children() const {
89+
return const_cast<OpenACCAssociatedStmtConstruct *>(this)->children();
90+
}
91+
};
92+
/// This class represents a compute construct, representing a 'Kind' of
93+
/// `parallel', 'serial', or 'kernel'. These constructs are associated with a
94+
/// 'structured block', defined as:
95+
///
96+
/// in C or C++, an executable statement, possibly compound, with a single
97+
/// entry at the top and a single exit at the bottom
98+
///
99+
/// At the moment there is no real motivation to have a different AST node for
100+
/// those three, as they are semantically identical, and have only minor
101+
/// differences in the permitted list of clauses, which can be differentiated by
102+
/// the 'Kind'.
103+
class OpenACCComputeConstruct : public OpenACCAssociatedStmtConstruct {
104+
friend class ASTStmtWriter;
105+
friend class ASTStmtReader;
106+
friend class ASTContext;
107+
OpenACCComputeConstruct()
108+
: OpenACCAssociatedStmtConstruct(OpenACCComputeConstructClass,
109+
OpenACCDirectiveKind::Invalid,
110+
SourceLocation{}, SourceLocation{}) {}
111+
112+
OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start,
113+
SourceLocation End)
114+
: OpenACCAssociatedStmtConstruct(OpenACCComputeConstructClass, K, Start,
115+
End) {
116+
assert((K == OpenACCDirectiveKind::Parallel ||
117+
K == OpenACCDirectiveKind::Serial ||
118+
K == OpenACCDirectiveKind::Kernels) &&
119+
"Only parallel, serial, and kernels constructs should be "
120+
"represented by this type");
121+
}
122+
123+
void setStructuredBlock(Stmt *S) { setAssociatedStmt(S); }
124+
125+
public:
126+
static bool classof(const Stmt *T) {
127+
return T->getStmtClass() == OpenACCComputeConstructClass;
128+
}
129+
130+
static OpenACCComputeConstruct *CreateEmpty(const ASTContext &C, EmptyShell);
131+
static OpenACCComputeConstruct *Create(const ASTContext &C,
132+
OpenACCDirectiveKind K,
133+
SourceLocation BeginLoc,
134+
SourceLocation EndLoc);
135+
136+
Stmt *getStructuredBlock() { return getAssociatedStmt(); }
137+
const Stmt *getStructuredBlock() const {
138+
return const_cast<OpenACCComputeConstruct *>(this)->getStructuredBlock();
139+
}
140+
};
141+
} // namespace clang
142+
#endif // LLVM_CLANG_AST_STMTOPENACC_H

clang/include/clang/AST/StmtVisitor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
#ifndef LLVM_CLANG_AST_STMTVISITOR_H
1414
#define LLVM_CLANG_AST_STMTVISITOR_H
1515

16-
#include "clang/AST/ExprConcepts.h"
1716
#include "clang/AST/ExprCXX.h"
17+
#include "clang/AST/ExprConcepts.h"
1818
#include "clang/AST/ExprObjC.h"
1919
#include "clang/AST/ExprOpenMP.h"
2020
#include "clang/AST/Stmt.h"
2121
#include "clang/AST/StmtCXX.h"
2222
#include "clang/AST/StmtObjC.h"
23+
#include "clang/AST/StmtOpenACC.h"
2324
#include "clang/AST/StmtOpenMP.h"
2425
#include "clang/Basic/LLVM.h"
2526
#include "llvm/ADT/STLExtras.h"

clang/include/clang/AST/TextNodeDumper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ class TextNodeDumper
401401
void
402402
VisitLifetimeExtendedTemporaryDecl(const LifetimeExtendedTemporaryDecl *D);
403403
void VisitHLSLBufferDecl(const HLSLBufferDecl *D);
404+
void VisitOpenACCConstructStmt(const OpenACCConstructStmt *S);
404405
};
405406

406407
} // namespace clang

clang/include/clang/Basic/Attr.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2891,6 +2891,13 @@ def Suppress : DeclOrStmtAttr {
28912891
let Spellings = [CXX11<"gsl", "suppress">, Clang<"suppress">];
28922892
let Args = [VariadicStringArgument<"DiagnosticIdentifiers">];
28932893
let Accessors = [Accessor<"isGSL", [CXX11<"gsl", "suppress">]>];
2894+
// There's no fundamental reason why we can't simply accept all Decls
2895+
// but let's make a short list so that to avoid supporting something weird
2896+
// by accident. We can always expand the list later.
2897+
let Subjects = SubjectList<[
2898+
Stmt, Var, Field, ObjCProperty, Function, ObjCMethod, Record, ObjCInterface,
2899+
ObjCImplementation, Namespace, Empty
2900+
], ErrorDiag, "variables, functions, structs, interfaces, and namespaces">;
28942901
let Documentation = [SuppressDocs];
28952902
}
28962903

0 commit comments

Comments
 (0)