Skip to content

Commit 87a42d7

Browse files
authored
Merge branch 'main' into inbelic/gep
2 parents c0b7bd7 + 47e4501 commit 87a42d7

File tree

172 files changed

+3959
-1000
lines changed

Some content is hidden

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

172 files changed

+3959
-1000
lines changed

bolt/lib/Core/Relocation.cpp

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,41 +1018,15 @@ void Relocation::print(raw_ostream &OS) const {
10181018
default:
10191019
OS << "RType:" << Twine::utohexstr(Type);
10201020
break;
1021-
1022-
case Triple::aarch64: {
1023-
static const char *const AArch64RelocNames[] = {
1024-
#define ELF_RELOC(name, value) #name,
1025-
#include "llvm/BinaryFormat/ELFRelocs/AArch64.def"
1026-
#undef ELF_RELOC
1027-
};
1028-
assert(Type < ArrayRef(AArch64RelocNames).size());
1029-
OS << AArch64RelocNames[Type];
1030-
} break;
1031-
1021+
case Triple::aarch64:
1022+
OS << object::getELFRelocationTypeName(ELF::EM_AARCH64, Type);
1023+
break;
10321024
case Triple::riscv64:
1033-
// RISC-V relocations are not sequentially numbered so we cannot use an
1034-
// array
1035-
switch (Type) {
1036-
default:
1037-
llvm_unreachable("illegal RISC-V relocation");
1038-
#define ELF_RELOC(name, value) \
1039-
case value: \
1040-
OS << #name; \
1025+
OS << object::getELFRelocationTypeName(ELF::EM_RISCV, Type);
10411026
break;
1042-
#include "llvm/BinaryFormat/ELFRelocs/RISCV.def"
1043-
#undef ELF_RELOC
1044-
}
1027+
case Triple::x86_64:
1028+
OS << object::getELFRelocationTypeName(ELF::EM_X86_64, Type);
10451029
break;
1046-
1047-
case Triple::x86_64: {
1048-
static const char *const X86RelocNames[] = {
1049-
#define ELF_RELOC(name, value) #name,
1050-
#include "llvm/BinaryFormat/ELFRelocs/x86_64.def"
1051-
#undef ELF_RELOC
1052-
};
1053-
assert(Type < ArrayRef(X86RelocNames).size());
1054-
OS << X86RelocNames[Type];
1055-
} break;
10561030
}
10571031
OS << ", 0x" << Twine::utohexstr(Offset);
10581032
if (Symbol) {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## Verify that llvm-bolt correctly prints relocation types.
2+
3+
# REQUIRES: system-linux
4+
5+
# RUN: %clang %cflags -nostartfiles %s -o %t.exe -Wl,-q,--no-relax
6+
# RUN: llvm-bolt %t.exe --print-cfg --print-relocations -o %t.bolt \
7+
# RUN: | FileCheck %s
8+
9+
.section .text
10+
.align 4
11+
.globl _start
12+
.type _start, %function
13+
_start:
14+
15+
adrp x0, _start
16+
# CHECK: adrp
17+
# CHECK-SAME: R_AARCH64_ADR_PREL_PG_HI21
18+
19+
add x0, x0, :lo12:_start
20+
# CHECK-NEXT: add
21+
# CHECK-SAME: R_AARCH64_ADD_ABS_LO12_NC
22+
23+
ret
24+
.size _start, .-_start

clang-tools-extra/clang-doc/JSONGenerator.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,6 @@ static void insertArray(Object &Obj, json::Value &Array, StringRef Key) {
468468
static void serializeInfo(const RecordInfo &I, json::Object &Obj,
469469
const std::optional<StringRef> &RepositoryUrl) {
470470
serializeCommonAttributes(I, Obj, RepositoryUrl);
471-
Obj["FullName"] = I.FullName;
472471
Obj["TagType"] = getTagType(I.TagType);
473472
Obj["IsTypedef"] = I.IsTypeDef;
474473
Obj["MangledName"] = I.MangledName;

clang-tools-extra/clang-doc/Representation.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,6 @@ struct FunctionInfo : public SymbolInfo {
437437
// (AS_public = 0, AS_protected = 1, AS_private = 2, AS_none = 3)
438438
AccessSpecifier Access = AccessSpecifier::AS_public;
439439

440-
// Full qualified name of this function, including namespaces and template
441-
// specializations.
442-
SmallString<16> FullName;
443-
444440
// Function Prototype
445441
SmallString<256> Prototype;
446442

@@ -460,10 +456,6 @@ struct RecordInfo : public SymbolInfo {
460456
// Type of this record (struct, class, union, interface).
461457
TagTypeKind TagType = TagTypeKind::Struct;
462458

463-
// Full qualified name of this record, including namespaces and template
464-
// specializations.
465-
SmallString<16> FullName;
466-
467459
// When present, this record is a template or specialization.
468460
std::optional<TemplateInfo> Template;
469461

clang-tools-extra/clang-doc/Serialize.cpp

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -178,55 +178,6 @@ static llvm::SmallString<16> getTypeAlias(const TypeAliasDecl *Alias) {
178178
return Result;
179179
}
180180

181-
// extract full syntax for record declaration
182-
static llvm::SmallString<16> getRecordPrototype(const CXXRecordDecl *CXXRD) {
183-
llvm::SmallString<16> Result;
184-
LangOptions LangOpts;
185-
PrintingPolicy Policy(LangOpts);
186-
Policy.SuppressTagKeyword = false;
187-
Policy.FullyQualifiedName = true;
188-
Policy.IncludeNewlines = false;
189-
llvm::raw_svector_ostream OS(Result);
190-
if (const auto *TD = CXXRD->getDescribedClassTemplate()) {
191-
OS << "template <";
192-
bool FirstParam = true;
193-
for (const auto *Param : *TD->getTemplateParameters()) {
194-
if (!FirstParam)
195-
OS << ", ";
196-
Param->print(OS, Policy);
197-
FirstParam = false;
198-
}
199-
OS << ">\n";
200-
}
201-
202-
if (CXXRD->isStruct())
203-
OS << "struct ";
204-
else if (CXXRD->isClass())
205-
OS << "class ";
206-
else if (CXXRD->isUnion())
207-
OS << "union ";
208-
209-
OS << CXXRD->getNameAsString();
210-
211-
// We need to make sure we have a good enough declaration to check. In the
212-
// case where the class is a forward declaration, we'll fail assertions in
213-
// DeclCXX.
214-
if (CXXRD->isCompleteDefinition() && CXXRD->getNumBases() > 0) {
215-
OS << " : ";
216-
bool FirstBase = true;
217-
for (const auto &Base : CXXRD->bases()) {
218-
if (!FirstBase)
219-
OS << ", ";
220-
if (Base.isVirtual())
221-
OS << "virtual ";
222-
OS << getAccessSpelling(Base.getAccessSpecifier()) << " ";
223-
OS << Base.getType().getAsString(Policy);
224-
FirstBase = false;
225-
}
226-
}
227-
return Result;
228-
}
229-
230181
// A function to extract the appropriate relative path for a given info's
231182
// documentation. The path returned is a composite of the parent namespaces.
232183
//
@@ -1033,7 +984,6 @@ emitInfo(const RecordDecl *D, const FullComment *FC, Location Loc,
1033984
parseFields(*RI, D, PublicOnly);
1034985

1035986
if (const auto *C = dyn_cast<CXXRecordDecl>(D)) {
1036-
RI->FullName = getRecordPrototype(C);
1037987
if (const TypedefNameDecl *TD = C->getTypedefNameForAnonDecl()) {
1038988
RI->Name = TD->getNameAsString();
1039989
RI->IsTypeDef = true;

clang-tools-extra/test/clang-doc/json/class.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ struct MyClass {
124124
// CHECK-NEXT: }
125125
// CHECK-NEXT: }
126126
// CHECK-NEXT: ],
127-
// COM: FIXME: FullName is not emitted correctly.
128-
// CHECK-NEXT: "FullName": "",
129127
// CHECK-NEXT: "HasEnums": true,
130128
// CHECK-NEXT: "HasPublicFunctions": true,
131129
// CHECK-NEXT: "HasPublicMembers": true,

clang-tools-extra/unittests/clang-doc/JSONGeneratorTest.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ static std::unique_ptr<Generator> getJSONGenerator() {
1616
TEST(JSONGeneratorTest, emitRecordJSON) {
1717
RecordInfo I;
1818
I.Name = "Foo";
19-
// FIXME: FullName is not emitted correctly.
20-
I.FullName = "";
2119
I.IsTypeDef = false;
2220
I.Namespace.emplace_back(EmptySID, "GlobalNamespace", InfoType::IT_namespace);
2321
I.Path = "GlobalNamespace";
@@ -64,7 +62,6 @@ TEST(JSONGeneratorTest, emitRecordJSON) {
6462
{
6563
"Access": "public",
6664
"End": true,
67-
"FullName": "",
6865
"HasPublicFunctions": true,
6966
"HasPublicMembers": true,
7067
"InfoType": "record",
@@ -115,7 +112,6 @@ TEST(JSONGeneratorTest, emitRecordJSON) {
115112
"USR": "0000000000000000000000000000000000000000"
116113
}
117114
],
118-
"FullName": "",
119115
"HasEnums": true,
120116
"HasPublicFunctions": true,
121117
"HasRecords": true,

clang/docs/LanguageExtensions.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,8 @@ of different sizes and signs is forbidden in binary and ternary builtins.
807807
T __builtin_elementwise_exp(T x) returns the base-e exponential, e^x, of the specified value floating point types
808808
T __builtin_elementwise_exp2(T x) returns the base-2 exponential, 2^x, of the specified value floating point types
809809
T __builtin_elementwise_exp10(T x) returns the base-10 exponential, 10^x, of the specified value floating point types
810+
T __builtin_elementwise_ldexp(T x, IntT y) returns the product of x and 2 raised to the power y. T: floating point types,
811+
y must be an integer type matching the shape of x. IntT: integer types
810812

811813
T __builtin_elementwise_sqrt(T x) return the square root of a floating-point number floating point types
812814
T __builtin_elementwise_roundeven(T x) round x to the nearest integer value in floating point format, floating point types

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ C23 Feature Support
214214

215215
Non-comprehensive list of changes in this release
216216
-------------------------------------------------
217+
- Added ``__builtin_elementwise_ldexp``.
218+
217219
- Added ``__builtin_elementwise_fshl`` and ``__builtin_elementwise_fshr``.
218220

219221
- ``__builtin_elementwise_abs`` can now be used in constant expression.

clang/include/clang/Basic/Builtins.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,12 @@ def ElementwiseExp10 : Builtin {
14181418
let Prototype = "void(...)";
14191419
}
14201420

1421+
def ElementwiseLdexp : Builtin {
1422+
let Spellings = ["__builtin_elementwise_ldexp"];
1423+
let Attributes = [NoThrow, Const, CustomTypeChecking];
1424+
let Prototype = "void(...)";
1425+
}
1426+
14211427
def ElementwiseFloor : Builtin {
14221428
let Spellings = ["__builtin_elementwise_floor"];
14231429
let Attributes = [NoThrow, Const, CustomTypeChecking];

0 commit comments

Comments
 (0)