Skip to content

Commit 0517772

Browse files
authored
Merge branch 'main' into saddlp1d-fallback
2 parents d2f7fba + d404c37 commit 0517772

File tree

60 files changed

+1896
-808
lines changed

Some content is hidden

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

60 files changed

+1896
-808
lines changed

clang/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ if(CLANG_BUILT_STANDALONE)
8080
include(GetErrcMessages)
8181
include(LLVMDistributionSupport)
8282

83+
if(CMAKE_CROSSCOMPILING)
84+
set(LLVM_USE_HOST_TOOLS ON)
85+
include(CrossCompile)
86+
llvm_create_cross_target(Clang NATIVE "" Release)
87+
endif()
88+
8389
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
8490
set(BUG_REPORT_URL "${LLVM_PACKAGE_BUGREPORT}" CACHE STRING
8591
"Default URL where bug reports are to be submitted.")

clang/include/clang/AST/ASTContext.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@
2525
#include "clang/AST/RawCommentList.h"
2626
#include "clang/AST/SYCLKernelInfo.h"
2727
#include "clang/AST/TemplateName.h"
28+
#include "clang/AST/TypeOrdering.h"
2829
#include "clang/Basic/LLVM.h"
2930
#include "clang/Basic/PartialDiagnostic.h"
3031
#include "clang/Basic/SourceLocation.h"
3132
#include "llvm/ADT/DenseMap.h"
33+
#include "llvm/ADT/DenseMapInfo.h"
3234
#include "llvm/ADT/DenseSet.h"
3335
#include "llvm/ADT/FoldingSet.h"
3436
#include "llvm/ADT/IntrusiveRefCntPtr.h"
@@ -51,6 +53,36 @@ class FixedPointSemantics;
5153
struct fltSemantics;
5254
template <typename T, unsigned N> class SmallPtrSet;
5355

56+
struct ScalableVecTyKey {
57+
clang::QualType EltTy;
58+
unsigned NumElts;
59+
unsigned NumFields;
60+
61+
bool operator==(const ScalableVecTyKey &RHS) const {
62+
return EltTy == RHS.EltTy && NumElts == RHS.NumElts &&
63+
NumFields == RHS.NumFields;
64+
}
65+
};
66+
67+
// Provide a DenseMapInfo specialization so that ScalableVecTyKey can be used
68+
// as a key in DenseMap.
69+
template <> struct DenseMapInfo<ScalableVecTyKey> {
70+
static inline ScalableVecTyKey getEmptyKey() {
71+
return {DenseMapInfo<clang::QualType>::getEmptyKey(), ~0U, ~0U};
72+
}
73+
static inline ScalableVecTyKey getTombstoneKey() {
74+
return {DenseMapInfo<clang::QualType>::getTombstoneKey(), ~0U, ~0U};
75+
}
76+
static unsigned getHashValue(const ScalableVecTyKey &Val) {
77+
return hash_combine(DenseMapInfo<clang::QualType>::getHashValue(Val.EltTy),
78+
Val.NumElts, Val.NumFields);
79+
}
80+
static bool isEqual(const ScalableVecTyKey &LHS,
81+
const ScalableVecTyKey &RHS) {
82+
return LHS == RHS;
83+
}
84+
};
85+
5486
} // namespace llvm
5587

5688
namespace clang {
@@ -505,6 +537,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
505537
SmallVector<const ObjCInterfaceDecl *, 4>>
506538
ObjCSubClasses;
507539

540+
// A mapping from Scalable Vector Type keys to their corresponding QualType.
541+
mutable llvm::DenseMap<llvm::ScalableVecTyKey, QualType> ScalableVecTyMap;
542+
508543
ASTContext &this_() { return *this; }
509544

510545
public:

clang/include/clang/Driver/Options.td

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3837,10 +3837,26 @@ let Visibility = [ClangOption, CC1Option, FC1Option, FlangOption] in {
38373837
let Group = f_Group in {
38383838

38393839
def fopenmp_target_debug_EQ : Joined<["-"], "fopenmp-target-debug=">;
3840-
def fopenmp_assume_teams_oversubscription : Flag<["-"], "fopenmp-assume-teams-oversubscription">;
3841-
def fopenmp_assume_threads_oversubscription : Flag<["-"], "fopenmp-assume-threads-oversubscription">;
3842-
def fno_openmp_assume_teams_oversubscription : Flag<["-"], "fno-openmp-assume-teams-oversubscription">;
3843-
def fno_openmp_assume_threads_oversubscription : Flag<["-"], "fno-openmp-assume-threads-oversubscription">;
3840+
def fopenmp_assume_teams_oversubscription : Flag<["-"], "fopenmp-assume-teams-oversubscription">,
3841+
HelpText<"Allow the optimizer to discretely increase the number of "
3842+
"teams. May cause ignore environment variables that set "
3843+
"the number of teams to be ignored. The combination of "
3844+
"-fopenmp-assume-teams-oversubscription "
3845+
"and -fopenmp-assume-threads-oversubscription "
3846+
"may allow the conversion of loops into sequential code by "
3847+
"ensuring that each team/thread executes at most one iteration.">;
3848+
def fopenmp_assume_threads_oversubscription : Flag<["-"], "fopenmp-assume-threads-oversubscription">,
3849+
HelpText<"Allow the optimizer to discretely increase the number of "
3850+
"threads. May cause ignore environment variables that set "
3851+
"the number of threads to be ignored. The combination of "
3852+
"-fopenmp-assume-teams-oversubscription "
3853+
"and -fopenmp-assume-threads-oversubscription "
3854+
"may allow the conversion of loops into sequential code by "
3855+
"ensuring that each team/thread executes at most one iteration.">;
3856+
def fno_openmp_assume_teams_oversubscription : Flag<["-"], "fno-openmp-assume-teams-oversubscription">,
3857+
HelpText<"Do not assume teams oversubscription.">;
3858+
def fno_openmp_assume_threads_oversubscription : Flag<["-"], "fno-openmp-assume-threads-oversubscription">,
3859+
HelpText<"Do not assume threads oversubscription.">;
38443860
def fopenmp_assume_no_thread_state : Flag<["-"], "fopenmp-assume-no-thread-state">,
38453861
HelpText<"Assert no thread in a parallel region modifies an ICV">,
38463862
MarshallingInfoFlag<LangOpts<"OpenMPNoThreadState">>;

clang/lib/AST/ASTContext.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4567,6 +4567,10 @@ QualType ASTContext::getWebAssemblyExternrefType() const {
45674567
/// type.
45684568
QualType ASTContext::getScalableVectorType(QualType EltTy, unsigned NumElts,
45694569
unsigned NumFields) const {
4570+
auto K = llvm::ScalableVecTyKey{EltTy, NumElts, NumFields};
4571+
if (auto It = ScalableVecTyMap.find(K); It != ScalableVecTyMap.end())
4572+
return It->second;
4573+
45704574
if (Target->hasAArch64ACLETypes()) {
45714575
uint64_t EltTySize = getTypeSize(EltTy);
45724576

@@ -4575,29 +4579,29 @@ QualType ASTContext::getScalableVectorType(QualType EltTy, unsigned NumElts,
45754579
if (EltTy->hasIntegerRepresentation() && !EltTy->isBooleanType() && \
45764580
EltTy->hasSignedIntegerRepresentation() == IsSigned && \
45774581
EltTySize == ElBits && NumElts == (NumEls * NF) && NumFields == 1) { \
4578-
return SingletonId; \
4582+
return ScalableVecTyMap[K] = SingletonId; \
45794583
}
45804584
#define SVE_VECTOR_TYPE_FLOAT(Name, MangledName, Id, SingletonId, NumEls, \
45814585
ElBits, NF) \
45824586
if (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \
45834587
EltTySize == ElBits && NumElts == (NumEls * NF) && NumFields == 1) { \
4584-
return SingletonId; \
4588+
return ScalableVecTyMap[K] = SingletonId; \
45854589
}
45864590
#define SVE_VECTOR_TYPE_BFLOAT(Name, MangledName, Id, SingletonId, NumEls, \
45874591
ElBits, NF) \
45884592
if (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
45894593
EltTySize == ElBits && NumElts == (NumEls * NF) && NumFields == 1) { \
4590-
return SingletonId; \
4594+
return ScalableVecTyMap[K] = SingletonId; \
45914595
}
45924596
#define SVE_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, \
45934597
ElBits, NF) \
45944598
if (EltTy->isMFloat8Type() && EltTySize == ElBits && \
45954599
NumElts == (NumEls * NF) && NumFields == 1) { \
4596-
return SingletonId; \
4600+
return ScalableVecTyMap[K] = SingletonId; \
45974601
}
45984602
#define SVE_PREDICATE_TYPE_ALL(Name, MangledName, Id, SingletonId, NumEls, NF) \
45994603
if (EltTy->isBooleanType() && NumElts == (NumEls * NF) && NumFields == 1) \
4600-
return SingletonId;
4604+
return ScalableVecTyMap[K] = SingletonId;
46014605
#include "clang/Basic/AArch64ACLETypes.def"
46024606
} else if (Target->hasRISCVVTypes()) {
46034607
uint64_t EltTySize = getTypeSize(EltTy);
@@ -4611,10 +4615,10 @@ QualType ASTContext::getScalableVectorType(QualType EltTy, unsigned NumElts,
46114615
(EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
46124616
IsBF && !IsFP)) && \
46134617
EltTySize == ElBits && NumElts == NumEls && NumFields == NF) \
4614-
return SingletonId;
4618+
return ScalableVecTyMap[K] = SingletonId;
46154619
#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
46164620
if (EltTy->isBooleanType() && NumElts == NumEls) \
4617-
return SingletonId;
4621+
return ScalableVecTyMap[K] = SingletonId;
46184622
#include "clang/Basic/RISCVVTypes.def"
46194623
}
46204624
return QualType();

clang/lib/AST/ByteCode/EvalEmitter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "EvaluationResult.h"
1717
#include "InterpState.h"
1818
#include "PrimType.h"
19+
#include "Record.h"
1920
#include "Source.h"
2021

2122
namespace clang {

clang/lib/AST/ByteCode/InterpBlock.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,10 @@ class Block final {
115115
return reinterpret_cast<const std::byte *>(this) + sizeof(Block);
116116
}
117117

118-
template <typename T> T deref() const {
118+
template <typename T> const T &deref() const {
119119
return *reinterpret_cast<const T *>(data());
120120
}
121+
template <typename T> T &deref() { return *reinterpret_cast<T *>(data()); }
121122

122123
/// Invokes the constructor.
123124
void invokeCtor() {

clang/lib/AST/ByteCode/InterpFrame.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
#define LLVM_CLANG_AST_INTERP_INTERPFRAME_H
1515

1616
#include "Frame.h"
17-
#include "Program.h"
17+
#include "InterpBlock.h"
18+
#include "Pointer.h"
1819

1920
namespace clang {
2021
namespace interp {
@@ -93,7 +94,7 @@ class InterpFrame final : public Frame {
9394
auto Pt = Params.find(Offset);
9495
if (Pt == Params.end())
9596
return stackRef<T>(Offset);
96-
return Pointer(reinterpret_cast<Block *>(Pt->second.get())).deref<T>();
97+
return reinterpret_cast<const Block *>(Pt->second.get())->deref<T>();
9798
}
9899

99100
/// Mutates a local copy of a parameter.
@@ -151,7 +152,7 @@ class InterpFrame final : public Frame {
151152

152153
/// Returns an offset to a local.
153154
template <typename T> T &localRef(unsigned Offset) const {
154-
return getLocalPointer(Offset).deref<T>();
155+
return localBlock(Offset)->deref<T>();
155156
}
156157

157158
/// Returns a pointer to a local's block.

0 commit comments

Comments
 (0)