Skip to content

Commit

Permalink
Merge attempt by ./merge_from_main.sh into branch amd-trunk-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
agozillon committed Mar 11, 2024
2 parents 3b5b55f + b1be69f commit cdc03d8
Show file tree
Hide file tree
Showing 5,827 changed files with 233,265 additions and 107,437 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
8 changes: 0 additions & 8 deletions .arcconfig

This file was deleted.

15 changes: 0 additions & 15 deletions .arclint

This file was deleted.

2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-use-anonymous-namespace,readability-identifier-naming'
Checks: '-*,clang-diagnostic-*,llvm-*,misc-*,-misc-const-correctness,-misc-unused-parameters,-misc-non-private-member-variables-in-classes,-misc-no-recursion,-misc-use-anonymous-namespace,readability-identifier-naming,-misc-include-cleaner'
CheckOptions:
- key: readability-identifier-naming.ClassCase
value: CamelCase
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @nikic
/llvm/lib/Transforms/InstCombine/ @nikic

/clang/include/clang/Sema/Sema.h @Endilll
/clang/test/CXX/drs/ @Endilll
/clang/www/cxx_dr_status.html @Endilll
/clang/www/make_cxx_dr_status @Endilll
Expand Down
3 changes: 3 additions & 0 deletions .github/new-prs-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,9 @@ backend:SystemZ:
third-party:unittests:
- third-party/unittests/**

third-party:benchmark:
- third-party/benchmark/**

llvm:binary-utilities:
- llvm/docs/CommandGuide/llvm-*
- llvm/include/llvm/BinaryFormat/**
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/build-ci-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,18 @@ jobs:
cp ./.github/workflows/containers/github-action-ci/storage.conf ~/.config/containers/storage.conf
podman info
# Download the container image into /mnt/podman rather than
# $GITHUB_WORKSPACE to avoid space limitations on the default drive
# and use the permissions setup for /mnt/podman.
- name: Download stage1-toolchain
uses: actions/download-artifact@v4
with:
name: stage1-toolchain
path: /mnt/podman

- name: Load stage1-toolchain
run: |
podman load -i stage1-toolchain.tar
podman load -i /mnt/podman/stage1-toolchain.tar
- name: Build Container
working-directory: ./.github/workflows/containers/github-action-ci/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ COPY --from=stage2-toolchain $LLVM_SYSROOT $LLVM_SYSROOT
# Need to install curl for hendrikmuhs/ccache-action
# Need nodejs for some of the GitHub actions.
# Need perl-modules for clang analyzer tests.
# Need git for SPIRV-Tools tests.
RUN apt-get update && \
apt-get install -y \
binutils \
cmake \
curl \
git \
libstdc++-11-dev \
ninja-build \
nodejs \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ jobs:
release-workflow \
--branch-repo-token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \
--issue-number ${{ github.event.issue.number }} \
--requested-by ${{ github.event.issue.user.login }} \
--requested-by ${{ (github.event.action == 'opened' && github.event.issue.user.login) || github.event.comment.user.login }} \
auto
10 changes: 9 additions & 1 deletion .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
prepare:
name: Prepare to build binaries
runs-on: ubuntu-22.04
if: github.repository == 'llvm/llvm-project'
outputs:
release-version: ${{ steps.vars.outputs.release-version }}
flags: ${{ steps.vars.outputs.flags }}
Expand All @@ -47,11 +48,16 @@ jobs:
- name: Checkout LLVM
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Install Dependencies
run: |
pip install -r ./llvm/utils/git/requirements.txt
- name: Check Permissions
env:
GITHUB_TOKEN: ${{ github.token }}
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
run: |
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} check-permissions
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} --user-token "$USER_TOKEN" check-permissions
- name: Collect Variables
id: vars
Expand Down Expand Up @@ -85,6 +91,7 @@ jobs:
name: "Fill Cache ${{ matrix.os }}"
needs: prepare
runs-on: ${{ matrix.os }}
if: github.repository == 'llvm/llvm-project'
strategy:
matrix:
os:
Expand Down Expand Up @@ -119,6 +126,7 @@ jobs:
- prepare
- fill-cache
runs-on: ${{ matrix.target.runs-on }}
if: github.repository == 'llvm/llvm-project'
strategy:
fail-fast: false
matrix:
Expand Down
4 changes: 4 additions & 0 deletions bolt/include/bolt/Core/BinaryContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,10 @@ class BinaryContext {
return getUniqueSectionByName(".gdb_index");
}

ErrorOr<BinarySection &> getDebugNamesSection() const {
return getUniqueSectionByName(".debug_names");
}

/// @}

/// Register \p TargetFunction as a fragment of \p Function if checks pass:
Expand Down
8 changes: 8 additions & 0 deletions bolt/include/bolt/Core/BinaryFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -2056,6 +2056,14 @@ class BinaryFunction {
/// Returns false if disassembly failed.
Error disassemble();

/// An external interface to register a branch while the function is in
/// disassembled state. Allows to make custom modifications to the
/// disassembler. E.g., a pre-CFG pass can add an instruction and register
/// a branch that will later be used during the CFG construction.
///
/// Return a label at the branch destination.
MCSymbol *registerBranch(uint64_t Src, uint64_t Dst);

Error handlePCRelOperand(MCInst &Instruction, uint64_t Address,
uint64_t Size);

Expand Down
7 changes: 5 additions & 2 deletions bolt/include/bolt/Core/DIEBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define BOLT_CORE_DIE_BUILDER_H

#include "bolt/Core/BinaryContext.h"
#include "bolt/Core/DebugNames.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
Expand Down Expand Up @@ -127,6 +128,7 @@ class DIEBuilder {
DWARFUnit *SkeletonCU{nullptr};
uint64_t UnitSize{0};
llvm::DenseSet<uint64_t> AllProcessed;
DWARF5AcceleratorTable &DebugNamesTable;

/// Returns current state of the DIEBuilder
State &getState() { return *BuilderState.get(); }
Expand Down Expand Up @@ -206,8 +208,8 @@ class DIEBuilder {
/// Update references once the layout is finalized.
void updateReferences();

/// Update the Offset and Size of DIE.
uint32_t computeDIEOffset(const DWARFUnit &CU, DIE &Die, uint32_t &CurOffset);
/// Update the Offset and Size of DIE, populate DebugNames table.
uint32_t finalizeDIEs(DWARFUnit &CU, DIE &Die, uint32_t &CurOffset);

void registerUnit(DWARFUnit &DU, bool NeedSort);

Expand Down Expand Up @@ -269,6 +271,7 @@ class DIEBuilder {

public:
DIEBuilder(BinaryContext &BC, DWARFContext *DwarfContext,
DWARF5AcceleratorTable &DebugNamesTable,
DWARFUnit *SkeletonCU = nullptr);

/// Returns enum to what we are currently processing.
Expand Down
9 changes: 6 additions & 3 deletions bolt/include/bolt/Core/DebugData.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,8 @@ class DebugStrOffsetsWriter {
/// Update Str offset in .debug_str in .debug_str_offsets.
void updateAddressMap(uint32_t Index, uint32_t Address);

/// Get offset for given index in original .debug_str_offsets section.
uint64_t getOffset(uint32_t Index) const { return StrOffsets[Index]; }
/// Writes out current sections entry into .debug_str_offsets.
void finalizeSection(DWARFUnit &Unit, DIEBuilder &DIEBldr);

Expand All @@ -463,7 +465,7 @@ class DebugStrOffsetsWriter {
std::unique_ptr<DebugStrOffsetsBufferVector> StrOffsetsBuffer;
std::unique_ptr<raw_svector_ostream> StrOffsetsStream;
std::map<uint32_t, uint32_t> IndexToAddressMap;
std::vector<uint32_t> StrOffsets;
SmallVector<uint32_t, 5> StrOffsets;
std::unordered_map<uint64_t, uint64_t> ProcessedBaseOffsets;
bool StrOffsetSectionWasModified = false;
};
Expand All @@ -484,11 +486,12 @@ class DebugStrWriter {
/// Returns False if no strings were added to .debug_str.
bool isInitialized() const { return !StrBuffer->empty(); }

/// Initializes Buffer and Stream.
void initialize();

private:
/// Mutex used for parallel processing of debug info.
std::mutex WriterMutex;
/// Initializes Buffer and Stream.
void initialize();
/// Creates internal data structures.
void create();
std::unique_ptr<DebugStrBufferVector> StrBuffer;
Expand Down
172 changes: 172 additions & 0 deletions bolt/include/bolt/Core/DebugNames.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
//===- bolt/Core/DebugNames.h - Debug names support ---*- 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 contains declaration of classes required for generation of
// .debug_names section.
//
//===----------------------------------------------------------------------===//

#ifndef BOLT_CORE_DEBUG_NAMES_H
#define BOLT_CORE_DEBUG_NAMES_H

#include "DebugData.h"
#include "llvm/CodeGen/AccelTable.h"

namespace llvm {
namespace bolt {
class BOLTDWARF5AccelTableData : public DWARF5AccelTableData {
public:
BOLTDWARF5AccelTableData(const uint64_t DieOffset,
const std::optional<uint64_t> DefiningParentOffset,
const unsigned DieTag, const unsigned UnitID,
const bool IsTU,
const std::optional<unsigned> SecondUnitID)
: DWARF5AccelTableData(DieOffset, DefiningParentOffset, DieTag, UnitID,
IsTU),
SecondUnitID(SecondUnitID) {}

uint64_t getDieOffset() const { return DWARF5AccelTableData::getDieOffset(); }
unsigned getDieTag() const { return DWARF5AccelTableData::getDieTag(); }
unsigned getUnitID() const { return DWARF5AccelTableData::getUnitID(); }
bool isTU() const { return DWARF5AccelTableData::isTU(); }
std::optional<unsigned> getSecondUnitID() const { return SecondUnitID; }

private:
std::optional<unsigned> SecondUnitID;
};

class DWARF5AcceleratorTable {
public:
DWARF5AcceleratorTable(const bool CreateDebugNames, BinaryContext &BC,
DebugStrWriter &MainBinaryStrWriter);
~DWARF5AcceleratorTable() {
for (DebugNamesAbbrev *Abbrev : AbbreviationsVector)
Abbrev->~DebugNamesAbbrev();
}
/// Add DWARF5 Accelerator table entry.
/// Input is DWARFUnit being processed, DIE that belongs to it, and potential
/// SkeletonCU if the Unit comes from a DWO section.
void addAccelTableEntry(DWARFUnit &Unit, const DIE &Die,
const std::optional<uint64_t> &DWOID);
/// Set current unit being processed.
void setCurrentUnit(DWARFUnit &Unit, const uint64_t UnitStartOffset);
/// Emit Accelerator table.
void emitAccelTable();
/// Returns true if the table was crated.
bool isCreated() const { return NeedToCreate; }
/// Returns buffer containing the accelerator table.
std::unique_ptr<DebugBufferVector> releaseBuffer() {
return std::move(FullTableBuffer);
}

private:
BinaryContext &BC;
bool NeedToCreate = false;
BumpPtrAllocator Allocator;
DebugStrWriter &MainBinaryStrWriter;
StringRef StrSection;
uint64_t CurrentUnitOffset = 0;
const DWARFUnit *CurrentUnit = nullptr;
std::unordered_map<uint32_t, uint32_t> AbbrevTagToIndexMap;

/// Represents a group of entries with identical name (and hence, hash value).
struct HashData {
uint64_t StrOffset;
uint32_t HashValue;
uint32_t EntryOffset;
std::vector<BOLTDWARF5AccelTableData *> Values;
};
using HashList = std::vector<HashData *>;
using BucketList = std::vector<HashList>;
/// Contains all the offsets of CUs.
SmallVector<uint32_t, 1> CUList;
/// Contains all the offsets of local TUs.
SmallVector<uint32_t, 1> LocalTUList;
/// Contains all the type hashes for split dwarf TUs.
SmallVector<uint64_t, 1> ForeignTUList;
using StringEntries =
MapVector<std::string, HashData, llvm::StringMap<unsigned>>;
StringEntries Entries;
/// FoldingSet that uniques the abbreviations.
FoldingSet<DebugNamesAbbrev> AbbreviationsSet;
/// Vector containing DebugNames abbreviations for iteration in order.
SmallVector<DebugNamesAbbrev *, 5> AbbreviationsVector;
/// The bump allocator to use when creating DIEAbbrev objects in the uniqued
/// storage container.
BumpPtrAllocator Alloc;
uint32_t BucketCount = 0;
uint32_t UniqueHashCount = 0;
uint32_t AbbrevTableSize = 0;
uint32_t CUIndexEncodingSize = 4;
uint32_t TUIndexEncodingSize = 4;
uint32_t AugmentationStringSize = 0;
dwarf::Form CUIndexForm = dwarf::DW_FORM_data4;
dwarf::Form TUIndexForm = dwarf::DW_FORM_data4;

BucketList Buckets;

std::unique_ptr<DebugBufferVector> FullTableBuffer;
std::unique_ptr<raw_svector_ostream> FullTableStream;
std::unique_ptr<DebugBufferVector> StrBuffer;
std::unique_ptr<raw_svector_ostream> StrStream;
std::unique_ptr<DebugBufferVector> EntriesBuffer;
std::unique_ptr<raw_svector_ostream> Entriestream;
std::unique_ptr<DebugBufferVector> AugStringBuffer;
std::unique_ptr<raw_svector_ostream> AugStringtream;
llvm::DenseMap<llvm::hash_code, uint64_t> StrCacheToOffsetMap;
// Contains DWO ID to CUList Index.
llvm::DenseMap<uint64_t, uint32_t> CUOffsetsToPatch;
/// Adds Unit to either CUList, LocalTUList or ForeignTUList.
/// Input Unit being processed, and DWO ID if Unit is being processed comes
/// from a DWO section.
void addUnit(DWARFUnit &Unit, const std::optional<uint64_t> &DWOID);
/// Returns number of buckets in .debug_name table.
ArrayRef<HashList> getBuckets() const { return Buckets; }
/// Get encoding for a given attribute.
std::optional<DWARF5AccelTable::UnitIndexAndEncoding>
getIndexForEntry(const BOLTDWARF5AccelTableData &Value) const;
/// Get encoding for a given attribute for second index.
/// Returns nullopt if there is no second index.
std::optional<DWARF5AccelTable::UnitIndexAndEncoding>
getSecondIndexForEntry(const BOLTDWARF5AccelTableData &Value) const;
/// Uniquify Entries.
void finalize();
/// Computes bucket count.
void computeBucketCount();
/// Populate Abbreviations Map.
void populateAbbrevsMap();
/// Write Entries.
void writeEntries();
/// Write an Entry.
void writeEntry(const BOLTDWARF5AccelTableData &Entry);
/// Write augmentation_string for BOLT.
void writeAugmentationString();
/// Emit out Header for DWARF5 Accelerator table.
void emitHeader() const;
/// Emit out CU list.
void emitCUList() const;
/// Emit out TU List. Combination of LocalTUList and ForeignTUList.
void emitTUList() const;
/// Emit buckets.
void emitBuckets() const;
/// Emit hashes for hash table.
void emitHashes() const;
/// Emit string offsets for hash table.
void emitStringOffsets() const;
/// Emit Entry Offsets for hash table.
void emitOffsets() const;
/// Emit abbreviation table.
void emitAbbrevs();
/// Emit entries.
void emitData();
/// Emit augmentation string.
void emitAugmentationString() const;
};
} // namespace bolt
} // namespace llvm
#endif
Loading

0 comments on commit cdc03d8

Please sign in to comment.