Skip to content

Commit 24c3950

Browse files
committed
Manually merged main:6a91b7051df7 into amd-gfx:cbe644758d17
Local branch amd-gfx cbe6447 Unrevert "[AMDGPU] Do not ignore exec use where exec is read as data" Remote branch main 6a91b70 [NFC][TableGen] Update CHECK lines in test typeof-errors.td.
2 parents cbe6447 + 6a91b70 commit 24c3950

File tree

2,316 files changed

+79037
-30784
lines changed

Some content is hidden

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

2,316 files changed

+79037
-30784
lines changed

.github/workflows/docs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ on:
2323
- 'lld/docs/**'
2424
- 'openmp/docs/**'
2525
- 'polly/docs/**'
26+
- 'flang/docs/**'
2627
pull_request:
2728
paths:
2829
- 'llvm/docs/**'
@@ -35,11 +36,13 @@ on:
3536
- 'lld/docs/**'
3637
- 'openmp/docs/**'
3738
- 'polly/docs/**'
39+
- 'flang/docs/**'
3840

3941
jobs:
4042
check-docs-build:
4143
name: "Test documentation build"
4244
runs-on: ubuntu-latest
45+
if: github.repository == 'llvm/llvm-project'
4346
steps:
4447
# Don't fetch before checking for file changes to force the file changes
4548
# action to use the Github API in pull requests. If it's a push to a
@@ -75,6 +78,8 @@ jobs:
7578
- 'openmp/docs/**'
7679
polly:
7780
- 'polly/docs/**'
81+
flang:
82+
- 'flang/docs/**'
7883
- name: Fetch LLVM sources (PR)
7984
if: ${{ github.event_name == 'pull_request' }}
8085
uses: actions/checkout@v4
@@ -143,4 +148,11 @@ jobs:
143148
run: |
144149
cmake -B polly-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="polly" -DLLVM_ENABLE_SPHINX=ON ./llvm
145150
TZ=UTC ninja -C polly-build docs-polly-html docs-polly-man
151+
- name: Build Flang docs
152+
if: steps.docs-changed-subprojects.outputs.flang_any_changed == 'true'
153+
# TODO(boomanaiden154): Remove the SPHINX_WARNINGS_AS_ERRORS from the
154+
# CMake invocation once the warnings in the flang docs build are fixed.
155+
run: |
156+
cmake -B flang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;mlir;flang" -DLLVM_ENABLE_SPHINX=ON -DSPHINX_WARNINGS_AS_ERRORS=OFF ./llvm
157+
TZ=UTC ninja -C flang-build docs-flang-html docs-flang-man
146158

.github/workflows/pr-code-format.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ permissions:
66
jobs:
77
code_formatter:
88
runs-on: ubuntu-latest
9+
if: github.repository == 'llvm/llvm-project'
910
steps:
1011
- name: Fetch LLVM sources
1112
uses: actions/checkout@v4

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,15 @@ class BinaryContext {
680680
/// the execution of the binary is completed.
681681
std::optional<uint64_t> FiniFunctionAddress;
682682

683+
/// DT_FINI.
684+
std::optional<uint64_t> FiniAddress;
685+
686+
/// DT_FINI_ARRAY. Only used when DT_FINI is not set.
687+
std::optional<uint64_t> FiniArrayAddress;
688+
689+
/// DT_FINI_ARRAYSZ. Only used when DT_FINI is not set.
690+
std::optional<uint64_t> FiniArraySize;
691+
683692
/// Page alignment used for code layout.
684693
uint64_t PageAlign{HugePageSize};
685694

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2309,15 +2309,10 @@ class BinaryFunction {
23092309
/// removed.
23102310
uint64_t translateInputToOutputAddress(uint64_t Address) const;
23112311

2312-
/// Take address ranges corresponding to the input binary and translate
2313-
/// them to address ranges in the output binary.
2314-
DebugAddressRangesVector translateInputToOutputRanges(
2315-
const DWARFAddressRangesVector &InputRanges) const;
2316-
2317-
/// Similar to translateInputToOutputRanges() but operates on location lists
2318-
/// and moves associated data to output location lists.
2319-
DebugLocationsVector
2320-
translateInputToOutputLocationList(const DebugLocationsVector &InputLL) const;
2312+
/// Translate a contiguous range of addresses in the input binary into a set
2313+
/// of ranges in the output binary.
2314+
DebugAddressRangesVector
2315+
translateInputToOutputRange(DebugAddressRange InRange) const;
23212316

23222317
/// Return true if the function is an AArch64 linker inserted veneer
23232318
bool isAArch64Veneer() const;

bolt/include/bolt/Core/BinarySection.h

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,12 @@ class BinarySection {
375375
/// Add a dynamic relocation at the given /p Offset.
376376
void addDynamicRelocation(uint64_t Offset, MCSymbol *Symbol, uint64_t Type,
377377
uint64_t Addend, uint64_t Value = 0) {
378-
assert(Offset < getSize() && "offset not within section bounds");
379-
DynamicRelocations.emplace(Relocation{Offset, Symbol, Type, Addend, Value});
378+
addDynamicRelocation(Relocation{Offset, Symbol, Type, Addend, Value});
379+
}
380+
381+
void addDynamicRelocation(const Relocation &Reloc) {
382+
assert(Reloc.Offset < getSize() && "offset not within section bounds");
383+
DynamicRelocations.emplace(Reloc);
380384
}
381385

382386
/// Add relocation against the original contents of this section.
@@ -410,6 +414,18 @@ class BinarySection {
410414
return Itr != DynamicRelocations.end() ? &*Itr : nullptr;
411415
}
412416

417+
std::optional<Relocation> takeDynamicRelocationAt(uint64_t Offset) {
418+
Relocation Key{Offset, 0, 0, 0, 0};
419+
auto Itr = DynamicRelocations.find(Key);
420+
421+
if (Itr == DynamicRelocations.end())
422+
return std::nullopt;
423+
424+
Relocation Reloc = *Itr;
425+
DynamicRelocations.erase(Itr);
426+
return Reloc;
427+
}
428+
413429
uint64_t hash(const BinaryData &BD) const {
414430
std::map<const BinaryData *, uint64_t> Cache;
415431
return hash(BD, Cache);

bolt/include/bolt/Core/DebugData.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "llvm/CodeGen/DIE.h"
1919
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
2020
#include "llvm/MC/MCDwarf.h"
21+
#include "llvm/Support/FormatVariadic.h"
2122
#include "llvm/Support/SMLoc.h"
2223
#include "llvm/Support/raw_ostream.h"
2324
#include <cstdint>
@@ -95,6 +96,12 @@ static inline bool operator<(const DebugAddressRange &LHS,
9596
return std::tie(LHS.LowPC, LHS.HighPC) < std::tie(RHS.LowPC, RHS.HighPC);
9697
}
9798

99+
inline raw_ostream &operator<<(raw_ostream &OS,
100+
const DebugAddressRange &Range) {
101+
OS << formatv("[{0:x}, {1:x})", Range.LowPC, Range.HighPC);
102+
return OS;
103+
}
104+
98105
/// DebugAddressRangesVector - represents a set of absolute address ranges.
99106
using DebugAddressRangesVector = SmallVector<DebugAddressRange, 2>;
100107

@@ -106,6 +113,18 @@ struct DebugLocationEntry {
106113
SmallVector<uint8_t, 4> Expr;
107114
};
108115

116+
inline raw_ostream &operator<<(raw_ostream &OS,
117+
const DebugLocationEntry &Entry) {
118+
OS << formatv("[{0:x}, {1:x}) : [", Entry.LowPC, Entry.HighPC);
119+
const char *Sep = "";
120+
for (unsigned Byte : Entry.Expr) {
121+
OS << Sep << Byte;
122+
Sep = ", ";
123+
}
124+
OS << "]";
125+
return OS;
126+
}
127+
109128
using DebugLocationsVector = SmallVector<DebugLocationEntry, 4>;
110129

111130
/// References a row in a DWARFDebugLine::LineTable by the DWARF

bolt/include/bolt/Core/MCPlus.h

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,16 @@ namespace MCPlus {
3232
/// pad and the uint64_t represents the action.
3333
using MCLandingPad = std::pair<const MCSymbol *, uint64_t>;
3434

35-
/// An extension to MCInst is provided via an extra operand of type MCInst with
36-
/// ANNOTATION_LABEL opcode (i.e. we are tying an annotation instruction to an
37-
/// existing one). The annotation instruction contains a list of Immediate
38-
/// operands. Each operand either contains a value, or is a pointer to
39-
/// an instance of class MCAnnotation.
35+
/// An extension to MCInst is provided via extra operands, i.e. operands that
36+
/// are not used in the instruction assembly. Any kind of metadata can be
37+
/// attached to MCInst with this "annotation" extension using MCPlusBuilder
38+
/// interface.
39+
//
40+
/// The first extra operand must be of type kInst with an empty (nullptr)
41+
/// value. The kInst operand type is unused on most non-VLIW architectures.
42+
/// We use it to mark the beginning of annotations operands. The rest of the
43+
/// operands are of Immediate type with annotation info encoded into the value
44+
/// of the immediate.
4045
///
4146
/// There are 2 distinct groups of annotations. The first group is a first-class
4247
/// annotation that affects semantics of the instruction, such as an
@@ -55,7 +60,7 @@ using MCLandingPad = std::pair<const MCSymbol *, uint64_t>;
5560
/// of their corresponding operand.
5661
///
5762
/// Annotations in the second group could be addressed either by name, or by
58-
/// by and index which could be queried by providing a name.
63+
/// by index which could be queried by providing the name.
5964
class MCAnnotation {
6065
public:
6166
enum Kind {
@@ -106,10 +111,11 @@ template <typename ValueType> class MCSimpleAnnotation : public MCAnnotation {
106111
/// Return a number of operands in \Inst excluding operands representing
107112
/// annotations.
108113
inline unsigned getNumPrimeOperands(const MCInst &Inst) {
109-
if (Inst.getNumOperands() > 0 && std::prev(Inst.end())->isInst()) {
110-
assert(std::prev(Inst.end())->getInst()->getOpcode() ==
111-
TargetOpcode::ANNOTATION_LABEL);
112-
return Inst.getNumOperands() - 1;
114+
for (signed I = Inst.getNumOperands() - 1; I >= 0; --I) {
115+
if (Inst.getOperand(I).isInst())
116+
return I;
117+
if (!Inst.getOperand(I).isImm())
118+
return Inst.getNumOperands();
113119
}
114120
return Inst.getNumOperands();
115121
}

0 commit comments

Comments
 (0)