Skip to content

Commit

Permalink
Merged main:75b3c3d267bf into amd-gfx:d648e114f351
Browse files Browse the repository at this point in the history
Local branch amd-gfx d648e11 Revert "[AMDGPU] Try to fix the block prologs broken by RA inserted instructions (llvm#69924)"
Remote branch main 75b3c3d [ARM] Disable UpperBound loop unrolling for MVE tail predicated loops. (llvm#69709)

Change-Id: I5ed179024ddce969c97745bd3947ac42772629c0
  • Loading branch information
piotrAMD committed Oct 31, 2023
2 parents d648e11 + 75b3c3d commit adee082
Show file tree
Hide file tree
Showing 702 changed files with 69,981 additions and 16,546 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ struct UnqualNameVisitor : public RecursiveASTVisitor<UnqualNameVisitor> {

bool VisitDeclRefExpr(DeclRefExpr *S) {
DeclarationName Name = S->getNameInfo().getName();
return S->getQualifierLoc() || !Name.isIdentifier() ||
return S->getQualifierLoc() || Name.isEmpty() || !Name.isIdentifier() ||
!visitUnqualName(Name.getAsIdentifierInfo()->getName());
}

Expand Down
6 changes: 3 additions & 3 deletions clang-tools-extra/pseudo/lib/Lex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ TokenStream cook(const TokenStream &Code, const LangOptions &LangOpts) {
llvm::SmallString<64> CleanBuffer;
const char *Pos = Tok.text().begin();
while (Pos < Tok.text().end()) {
unsigned CharSize = 0;
CleanBuffer.push_back(
clang::Lexer::getCharAndSizeNoWarn(Pos, CharSize, LangOpts));
auto [Char, CharSize] =
clang::Lexer::getCharAndSizeNoWarn(Pos, LangOpts);
CleanBuffer.push_back(Char);
assert(CharSize != 0 && "no progress!");
Pos += CharSize;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,21 @@ struct TestDefaultOperatorB {
// CHECK-MESSAGES: :[[@LINE-1]]:15: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
// CHECK-FIXES: {{^}} friend auto operator<(const TestDefaultOperatorB &, const TestDefaultOperatorB &) noexcept -> bool = default;{{$}}
};

namespace PR69863 {

template <unsigned Len>
struct CustomCompileTimeString {
constexpr CustomCompileTimeString(const char (&)[Len]) noexcept {}
};

template <CustomCompileTimeString Str>
constexpr decltype(Str) operator""__csz() noexcept {
// CHECK-MESSAGES: :[[@LINE-1]]:25: warning: use a trailing return type for this function [modernize-use-trailing-return-type]
// CHECK-FIXES: {{^}}constexpr auto operator""__csz() noexcept -> decltype(Str) {
return Str;
}

inline constexpr CustomCompileTimeString SomeString = "This line will cause a crash"__csz;

}
200 changes: 200 additions & 0 deletions clang/include/clang/APINotes/APINotesReader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
//===--- APINotesReader.h - API Notes Reader --------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines the \c APINotesReader class that reads source API notes
// data providing additional information about source code as a separate input,
// such as the non-nil/nilable annotations for method parameters.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_APINOTES_READER_H
#define LLVM_CLANG_APINOTES_READER_H

#include "clang/APINotes/Types.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/VersionTuple.h"
#include <memory>

namespace clang {
namespace api_notes {

/// A class that reads API notes data from a binary file that was written by
/// the \c APINotesWriter.
class APINotesReader {
class Implementation;
std::unique_ptr<Implementation> Implementation;

APINotesReader(llvm::MemoryBuffer *InputBuffer,
llvm::VersionTuple SwiftVersion, bool &Failed);

public:
/// Create a new API notes reader from the given member buffer, which
/// contains the contents of a binary API notes file.
///
/// \returns the new API notes reader, or null if an error occurred.
static std::unique_ptr<APINotesReader>
Create(std::unique_ptr<llvm::MemoryBuffer> InputBuffer,
llvm::VersionTuple SwiftVersion);

~APINotesReader();

APINotesReader(const APINotesReader &) = delete;
APINotesReader &operator=(const APINotesReader &) = delete;

/// Captures the completed versioned information for a particular part of
/// API notes, including both unversioned API notes and each versioned API
/// note for that particular entity.
template <typename T> class VersionedInfo {
/// The complete set of results.
llvm::SmallVector<std::pair<llvm::VersionTuple, T>, 1> Results;

/// The index of the result that is the "selected" set based on the desired
/// Swift version, or null if nothing matched.
std::optional<unsigned> Selected;

public:
/// Form an empty set of versioned information.
VersionedInfo(std::nullopt_t) : Selected(std::nullopt) {}

/// Form a versioned info set given the desired version and a set of
/// results.
VersionedInfo(
llvm::VersionTuple Version,
llvm::SmallVector<std::pair<llvm::VersionTuple, T>, 1> Results);

/// Retrieve the selected index in the result set.
std::optional<unsigned> getSelected() const { return Selected; }

/// Return the number of versioned results we know about.
unsigned size() const { return Results.size(); }

/// Access all versioned results.
const std::pair<llvm::VersionTuple, T> *begin() const {
assert(!Results.empty());
return Results.begin();
}
const std::pair<llvm::VersionTuple, T> *end() const {
return Results.end();
}

/// Access a specific versioned result.
const std::pair<llvm::VersionTuple, T> &operator[](unsigned index) const {
assert(index < Results.size());
return Results[index];
}
};

/// Look for the context ID of the given Objective-C class.
///
/// \param Name The name of the class we're looking for.
///
/// \returns The ID, if known.
std::optional<ContextID> lookupObjCClassID(llvm::StringRef Name);

/// Look for information regarding the given Objective-C class.
///
/// \param Name The name of the class we're looking for.
///
/// \returns The information about the class, if known.
VersionedInfo<ObjCContextInfo> lookupObjCClassInfo(llvm::StringRef Name);

/// Look for the context ID of the given Objective-C protocol.
///
/// \param Name The name of the protocol we're looking for.
///
/// \returns The ID of the protocol, if known.
std::optional<ContextID> lookupObjCProtocolID(llvm::StringRef Name);

/// Look for information regarding the given Objective-C protocol.
///
/// \param Name The name of the protocol we're looking for.
///
/// \returns The information about the protocol, if known.
VersionedInfo<ObjCContextInfo> lookupObjCProtocolInfo(llvm::StringRef Name);

/// Look for information regarding the given Objective-C property in
/// the given context.
///
/// \param CtxID The ID that references the context we are looking for.
/// \param Name The name of the property we're looking for.
/// \param IsInstance Whether we are looking for an instance property (vs.
/// a class property).
///
/// \returns Information about the property, if known.
VersionedInfo<ObjCPropertyInfo>
lookupObjCProperty(ContextID CtxID, llvm::StringRef Name, bool IsInstance);

/// Look for information regarding the given Objective-C method in
/// the given context.
///
/// \param CtxID The ID that references the context we are looking for.
/// \param Selector The selector naming the method we're looking for.
/// \param IsInstanceMethod Whether we are looking for an instance method.
///
/// \returns Information about the method, if known.
VersionedInfo<ObjCMethodInfo> lookupObjCMethod(ContextID CtxID,
ObjCSelectorRef Selector,
bool IsInstanceMethod);

/// Look for information regarding the given global variable.
///
/// \param Name The name of the global variable.
///
/// \returns information about the global variable, if known.
VersionedInfo<GlobalVariableInfo>
lookupGlobalVariable(llvm::StringRef Name,
std::optional<Context> Ctx = std::nullopt);

/// Look for information regarding the given global function.
///
/// \param Name The name of the global function.
///
/// \returns information about the global function, if known.
VersionedInfo<GlobalFunctionInfo>
lookupGlobalFunction(llvm::StringRef Name,
std::optional<Context> Ctx = std::nullopt);

/// Look for information regarding the given enumerator.
///
/// \param Name The name of the enumerator.
///
/// \returns information about the enumerator, if known.
VersionedInfo<EnumConstantInfo> lookupEnumConstant(llvm::StringRef Name);

/// Look for information regarding the given tag
/// (struct/union/enum/C++ class).
///
/// \param Name The name of the tag.
///
/// \returns information about the tag, if known.
VersionedInfo<TagInfo> lookupTag(llvm::StringRef Name,
std::optional<Context> Ctx = std::nullopt);

/// Look for information regarding the given typedef.
///
/// \param Name The name of the typedef.
///
/// \returns information about the typedef, if known.
VersionedInfo<TypedefInfo>
lookupTypedef(llvm::StringRef Name,
std::optional<Context> Ctx = std::nullopt);

/// Look for the context ID of the given C++ namespace.
///
/// \param Name The name of the class we're looking for.
///
/// \returns The ID, if known.
std::optional<ContextID>
lookupNamespaceID(llvm::StringRef Name,
std::optional<ContextID> ParentNamespaceID = std::nullopt);
};

} // end namespace api_notes
} // end namespace clang

#endif // LLVM_CLANG_APINOTES_READER_H
8 changes: 1 addition & 7 deletions clang/include/clang/APINotes/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,10 @@ class CommonTypeInfo : public CommonEntityInfo {
return SwiftBridge;
}

void setSwiftBridge(const std::optional<std::string> &SwiftType) {
void setSwiftBridge(std::optional<std::string> SwiftType) {
SwiftBridge = SwiftType;
}

void setSwiftBridge(const std::optional<llvm::StringRef> &SwiftType) {
SwiftBridge = SwiftType
? std::optional<std::string>(std::string(*SwiftType))
: std::nullopt;
}

const std::optional<std::string> &getNSErrorDomain() const {
return NSErrorDomain;
}
Expand Down
44 changes: 6 additions & 38 deletions clang/include/clang/Basic/BuiltinsLoongArch.def
Original file line number Diff line number Diff line change
Expand Up @@ -15,46 +15,14 @@
# define TARGET_BUILTIN(ID, TYPE, ATTRS, FEATURE) BUILTIN(ID, TYPE, ATTRS)
#endif

// TODO: Support more builtins.
TARGET_BUILTIN(__builtin_loongarch_cacop_d, "vWiUWiWi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_cacop_w, "viUii", "nc", "32bit")
TARGET_BUILTIN(__builtin_loongarch_dbar, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_ibar, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_movfcsr2gr, "UiIUi", "nc", "f")
TARGET_BUILTIN(__builtin_loongarch_movgr2fcsr, "vIUiUi", "nc", "f")
TARGET_BUILTIN(__builtin_loongarch_break, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_syscall, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_cpucfg, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_asrtle_d, "vWiWi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_asrtgt_d, "vWiWi", "nc", "64bit")
// Definition of LoongArch basic builtins.
#include "clang/Basic/BuiltinsLoongArchBase.def"

TARGET_BUILTIN(__builtin_loongarch_crc_w_b_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crc_w_h_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crc_w_w_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crc_w_d_w, "iWii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_b_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_h_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_w_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_d_w, "iWii", "nc", "64bit")
// Definition of LSX builtins.
#include "clang/Basic/BuiltinsLoongArchLSX.def"

TARGET_BUILTIN(__builtin_loongarch_csrrd_w, "UiIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_csrrd_d, "UWiIUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_csrwr_w, "UiUiIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_csrwr_d, "UWiUWiIUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_csrxchg_w, "UiUiUiIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_csrxchg_d, "UWiUWiUWiIUi", "nc", "64bit")

TARGET_BUILTIN(__builtin_loongarch_iocsrrd_b, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_h, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_w, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_d, "UWiUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_b, "vUiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_h, "vUiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_w, "vUiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_d, "vUWiUi", "nc", "64bit")

TARGET_BUILTIN(__builtin_loongarch_lddir_d, "WiWiIUWi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_ldpte_d, "vWiIUWi", "nc", "64bit")
// Definition of LASX builtins.
#include "clang/Basic/BuiltinsLoongArchLASX.def"

#undef BUILTIN
#undef TARGET_BUILTIN
53 changes: 53 additions & 0 deletions clang/include/clang/Basic/BuiltinsLoongArchBase.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//============------------ BuiltinsLoongArchBase.def -------------*- C++ -*-==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines the LoongArch-specific basic builtin function database.
// Users of this file must define the BUILTIN macro to make use of this
// information.
//
//===----------------------------------------------------------------------===//

TARGET_BUILTIN(__builtin_loongarch_cacop_d, "vWiUWiWi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_cacop_w, "viUii", "nc", "32bit")
TARGET_BUILTIN(__builtin_loongarch_dbar, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_ibar, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_movfcsr2gr, "UiIUi", "nc", "f")
TARGET_BUILTIN(__builtin_loongarch_movgr2fcsr, "vIUiUi", "nc", "f")
TARGET_BUILTIN(__builtin_loongarch_break, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_syscall, "vIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_cpucfg, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_asrtle_d, "vWiWi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_asrtgt_d, "vWiWi", "nc", "64bit")

TARGET_BUILTIN(__builtin_loongarch_crc_w_b_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crc_w_h_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crc_w_w_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crc_w_d_w, "iWii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_b_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_h_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_w_w, "iii", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_crcc_w_d_w, "iWii", "nc", "64bit")

TARGET_BUILTIN(__builtin_loongarch_csrrd_w, "UiIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_csrrd_d, "UWiIUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_csrwr_w, "UiUiIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_csrwr_d, "UWiUWiIUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_csrxchg_w, "UiUiUiIUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_csrxchg_d, "UWiUWiUWiIUi", "nc", "64bit")

TARGET_BUILTIN(__builtin_loongarch_iocsrrd_b, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_h, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_w, "UiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrrd_d, "UWiUi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_b, "vUiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_h, "vUiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_w, "vUiUi", "nc", "")
TARGET_BUILTIN(__builtin_loongarch_iocsrwr_d, "vUWiUi", "nc", "64bit")

TARGET_BUILTIN(__builtin_loongarch_lddir_d, "WiWiIUWi", "nc", "64bit")
TARGET_BUILTIN(__builtin_loongarch_ldpte_d, "vWiIUWi", "nc", "64bit")
Loading

0 comments on commit adee082

Please sign in to comment.