diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge
index 4ebf304e23d5875c23d626984d17fb1ed5004a0f..2e503c867403bcf6fc56f6eed024229b82a0cc1d 100755
--- a/.ci/generate-buildkite-pipeline-premerge
+++ b/.ci/generate-buildkite-pipeline-premerge
@@ -68,7 +68,7 @@ function compute-projects-to-test() {
done
;;
clang)
- for p in clang-tools-extra compiler-rt flang libc lldb openmp cross-project-tests; do
+ for p in clang-tools-extra compiler-rt flang lldb cross-project-tests; do
echo $p
done
;;
@@ -224,7 +224,7 @@ fi
# needs while letting them run on the infrastructure provided by LLVM.
# Figure out which projects need to be built on each platform
-all_projects="bolt clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl"
+all_projects="bolt clang clang-tools-extra compiler-rt cross-project-tests flang libc libclc lld lldb llvm mlir openmp polly pstl"
modified_projects="$(keep-modified-projects ${all_projects})"
linux_projects_to_test=$(exclude-linux $(compute-projects-to-test ${modified_projects}))
diff --git a/.ci/monolithic-linux.sh b/.ci/monolithic-linux.sh
index 9e670c447fbaddc82106905b60927fc2c5c883db..b347c443da677fd530afb91936a9605ec1218b2b 100755
--- a/.ci/monolithic-linux.sh
+++ b/.ci/monolithic-linux.sh
@@ -18,7 +18,7 @@ set -o pipefail
MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
-rm -rf ${BUILD_DIR}
+rm -rf "${BUILD_DIR}"
ccache --zero-stats
@@ -37,8 +37,8 @@ projects="${1}"
targets="${2}"
echo "--- cmake"
-pip install -q -r ${MONOREPO_ROOT}/mlir/python/requirements.txt
-cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
+pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
+cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_PROJECTS="${projects}" \
-G Ninja \
-D CMAKE_BUILD_TYPE=Release \
diff --git a/.ci/monolithic-windows.sh b/.ci/monolithic-windows.sh
index 52ba13036f915983e97ad1149ffc40ee51a4c24e..4fd88ea81c84a8e2c2e1201b5593e4305ed28b09 100755
--- a/.ci/monolithic-windows.sh
+++ b/.ci/monolithic-windows.sh
@@ -19,7 +19,7 @@ set -o pipefail
MONOREPO_ROOT="${MONOREPO_ROOT:="$(git rev-parse --show-toplevel)"}"
BUILD_DIR="${BUILD_DIR:=${MONOREPO_ROOT}/build}"
-rm -rf ${BUILD_DIR}
+rm -rf "${BUILD_DIR}"
if [[ -n "${CLEAR_CACHE:-}" ]]; then
echo "clearing sccache"
@@ -37,14 +37,14 @@ projects="${1}"
targets="${2}"
echo "--- cmake"
-pip install -q -r ${MONOREPO_ROOT}/mlir/python/requirements.txt
+pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
# The CMAKE_*_LINKER_FLAGS to disable the manifest come from research
# on fixing a build reliability issue on the build server, please
# see https://github.com/llvm/llvm-project/pull/82393 and
# https://discourse.llvm.org/t/rfc-future-of-windows-pre-commit-ci/76840/40
# for further information.
-cmake -S ${MONOREPO_ROOT}/llvm -B ${BUILD_DIR} \
+cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_PROJECTS="${projects}" \
-G Ninja \
-D CMAKE_BUILD_TYPE=Release \
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 85850848b220c4e61b447dc022657065bb914ab1..76b8266cae87c4b0b3fbf90e4bf72626aad7c9f3 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -32,6 +32,9 @@
/clang/www/cxx_dr_status.html @Endilll
/clang/www/make_cxx_dr_status @Endilll
+clang/lib/AST/Interp/ @tbaederr
+clang/test/AST/Interp/ @tbaederr
+
/lldb/ @JDevlieghere
# MLIR Interfaces.
@@ -56,8 +59,8 @@
/mlir/Dialect/*/Transforms/Bufferize.cpp @matthias-springer
# Linalg Dialect in MLIR.
-/mlir/include/mlir/Dialect/Linalg @dcaballe @nicolasvasilache
-/mlir/lib/Dialect/Linalg @dcaballe @nicolasvasilache
+/mlir/include/mlir/Dialect/Linalg/* @dcaballe @nicolasvasilache
+/mlir/lib/Dialect/Linalg/* @dcaballe @nicolasvasilache
/mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp @MaheshRavishankar @nicolasvasilache
/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp @MaheshRavishankar @nicolasvasilache
/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp @MaheshRavishankar @nicolasvasilache
@@ -74,14 +77,14 @@
/mlir/**/*SME* @banach-space @dcaballe @nicolasvasilache
/mlir/**/*SVE* @banach-space @dcaballe @nicolasvasilache
/mlir/**/*VectorInterfaces* @dcaballe @nicolasvasilache
-/mlir/**/*VectorToSCF* @banach-space @dcaballe @nicolasvasilache @matthias-springer
+/mlir/**/*VectorToSCF* @banach-space @dcaballe @matthias-springer @nicolasvasilache
/mlir/**/*VectorToLLVM* @banach-space @dcaballe @nicolasvasilache
/mlir/**/*X86Vector* @aartbik @dcaballe @nicolasvasilache
-/mlir/include/mlir/Dialect/Vector @dcaballe @nicolasvasilache
-/mlir/lib/Dialect/Vector @dcaballe @nicolasvasilache
-/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp @MaheshRavishankar @nicolasvasilache
-/mlir/**/*EmulateNarrowType* @hanhanW
+/mlir/include/mlir/Dialect/Vector/* @dcaballe @nicolasvasilache
+/mlir/lib/Dialect/Vector/* @dcaballe @nicolasvasilache
/mlir/lib/Dialect/Vector/Transforms/* @hanhanW @nicolasvasilache
+/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp @MaheshRavishankar @nicolasvasilache
+/mlir/**/*EmulateNarrowType* @dcaballe @hanhanW
# Presburger library in MLIR
/mlir/**/*Presburger* @Groverkss @Superty
@@ -93,6 +96,7 @@
# Transform Dialect in MLIR.
/mlir/include/mlir/Dialect/Transform/* @ftynse @nicolasvasilache
/mlir/lib/Dialect/Transform/* @ftynse @nicolasvasilache
+/mlir/**/*TransformOps* @ftynse @nicolasvasilache
# SPIR-V Dialect in MLIR.
/mlir/**/SPIRV/ @antiagainst @kuhar
@@ -103,5 +107,24 @@
# MLIR Sparsifier.
/mlir/**/*SparseTensor*/ @aartbik @PeimingLiu @yinying-lisa-li @matthias-springer
+# MLIR NVGPU Dialect
+/mlir/**/NVGPU*/ @grypp
+/mlir/test/**/CUDA/ @grypp
+
+# MLIR NVVM Dialect in MLIR
+/mlir/**/LLVMIR/**/BasicPtxBuilderInterface* @grypp
+/mlir/**/NVVM*/ @grypp
+
# BOLT
/bolt/ @aaupov @maksfb @rafaelauler @ayermolo @dcci
+
+# Bazel build system.
+/utils/bazel/ @rupprecht
+
+# InstallAPI and TextAPI
+/llvm/**/TextAPI/ @cyndyishida
+/clang/**/InstallAPI/ @cyndyishida
+/clang/tools/clang-installapi/ @cyndyishida
+
+# ExtractAPI
+/clang/**/ExtractAPI @daniel-grumberg
diff --git a/.github/new-prs-labeler.yml b/.github/new-prs-labeler.yml
index 9a580c6d6984e105fbc9b3516d99c72896fa888f..a0428336d300f9ac3d4eaff2f2daf4100e4ccdfc 100644
--- a/.github/new-prs-labeler.yml
+++ b/.github/new-prs-labeler.yml
@@ -629,6 +629,8 @@ backend:DirectX:
- '**/*DirectX*/**'
- '**/*DXIL*/**'
- '**/*dxil*/**'
+ - '**/*DXContainer*'
+ - '**/*DXContainer*/**'
backend:SPIR-V:
- clang/lib/Driver/ToolChains/SPIRV.*
@@ -933,3 +935,6 @@ openmp:libomp:
openmp:libomptarget:
- any: ['openmp/**', '!openmp/runtime/**']
+
+bazel:
+ - utils/bazel/**
diff --git a/.github/workflows/email-check.yaml b/.github/workflows/email-check.yaml
index ac53b5e527b0949020e0e73d90def5d2b6295cd0..8f32d020975f5d70e7eead9c34a0ea86fb836e81 100644
--- a/.github/workflows/email-check.yaml
+++ b/.github/workflows/email-check.yaml
@@ -1,7 +1,7 @@
name: "Check for private emails used in PRs"
on:
- pull_request_target:
+ pull_request:
types:
- opened
@@ -10,8 +10,6 @@ permissions:
jobs:
validate_email:
- permissions:
- pull-requests: write
runs-on: ubuntu-latest
if: github.repository == 'llvm/llvm-project'
steps:
@@ -25,20 +23,24 @@ jobs:
run: |
git log -1
echo "EMAIL=$(git show -s --format='%ae' HEAD~0)" >> $GITHUB_OUTPUT
+ # Create empty comment file
+ echo "[]" > comments
- name: Validate author email
if: ${{ endsWith(steps.author.outputs.EMAIL, 'noreply.github.com') }}
- uses: actions/github-script@v6
env:
- EMAIL: ${{ steps.author.outputs.EMAIL }}
+ COMMENT: >-
+ ⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
+ Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account.
+ See [LLVM Discourse](https://discourse.llvm.org/t/hidden-emails-on-github-should-we-do-something-about-it) for more information.
+ run: |
+ cat << EOF > comments
+ [{"body" : "$COMMENT"}]
+ EOF
+
+ - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
+ if: always()
with:
- script: |
- const { EMAIL } = process.env
- await github.rest.issues.createComment({
- issue_number: context.issue.number,
- owner: context.repo.owner,
- repo: context.repo.repo,
- body: `⚠️ We detected that you are using a GitHub private e-mail address to contribute to the repo.
- Please turn off [Keep my email addresses private](https://github.com/settings/emails) setting in your account.
- See [LLVM Discourse](https://discourse.llvm.org/t/hidden-emails-on-github-should-we-do-something-about-it) for more information.
- `})
+ name: workflow-args
+ path: |
+ comments
diff --git a/.github/workflows/issue-write.yml b/.github/workflows/issue-write.yml
new file mode 100644
index 0000000000000000000000000000000000000000..e003be006c4e15405bd977e277b0f9a64e69d2af
--- /dev/null
+++ b/.github/workflows/issue-write.yml
@@ -0,0 +1,139 @@
+name: Comment on an issue
+
+on:
+ workflow_run:
+ workflows:
+ - "Check code formatting"
+ - "Check for private emails used in PRs"
+ types:
+ - completed
+
+permissions:
+ contents: read
+
+jobs:
+ pr-comment:
+ runs-on: ubuntu-latest
+ permissions:
+ pull-requests: write
+ if: >
+ github.event.workflow_run.event == 'pull_request'
+ steps:
+ - name: 'Download artifact'
+ uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1
+ with:
+ github-token: ${{ secrets.ISSUE_WRITE_DOWNLOAD_ARTIFACT }}
+ run-id: ${{ github.event.workflow_run.id }}
+ name: workflow-args
+
+ - name: 'Comment on PR'
+ uses: actions/github-script@v3
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ script: |
+ var fs = require('fs');
+ const comments = JSON.parse(fs.readFileSync('./comments'));
+ if (!comments || comments.length == 0) {
+ return;
+ }
+
+ let runInfo = await github.actions.getWorkflowRun({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ run_id: context.payload.workflow_run.id
+ });
+
+ console.log(runInfo);
+
+
+ // Query to find the number of the pull request that triggered this job.
+ // The associated pull requests are based off of the branch name, so if
+ // you create a pull request for a branch, close it, and then create
+ // another pull request with the same branch, then this query will return
+ // two associated pull requests. This is why we have to fetch all the
+ // associated pull requests and then iterate through them to find the
+ // one that is open.
+ const gql_query = `
+ query($repo_owner : String!, $repo_name : String!, $branch: String!) {
+ repository(owner: $repo_owner, name: $repo_name) {
+ ref (qualifiedName: $branch) {
+ associatedPullRequests(first: 100) {
+ nodes {
+ baseRepository {
+ owner {
+ login
+ }
+ }
+ number
+ state
+ }
+ }
+ }
+ }
+ }
+ `
+ const gql_variables = {
+ repo_owner: runInfo.data.head_repository.owner.login,
+ repo_name: runInfo.data.head_repository.name,
+ branch: runInfo.data.head_branch
+ }
+ const gql_result = await github.graphql(gql_query, gql_variables);
+ console.log(gql_result);
+ // If the branch for the PR was deleted before this job has a chance
+ // to run, then the ref will be null. This can happen if someone:
+ // 1. Rebase the PR, which triggers some workflow.
+ // 2. Immediately merges the PR and deletes the branch.
+ // 3. The workflow finishes and triggers this job.
+ if (!gql_result.repository.ref) {
+ console.log("Ref has been deleted");
+ return;
+ }
+ console.log(gql_result.repository.ref.associatedPullRequests.nodes);
+
+ var pr_number = 0;
+ gql_result.repository.ref.associatedPullRequests.nodes.forEach((pr) => {
+ if (pr.baseRepository.owner.login = context.repo.owner && pr.state == 'OPEN') {
+ pr_number = pr.number;
+ }
+ });
+ if (pr_number == 0) {
+ console.log("Error retrieving pull request number");
+ return;
+ }
+
+ await comments.forEach(function (comment) {
+ if (comment.id) {
+ // Security check: Ensure that this comment was created by
+ // the github-actions bot, so a malicious input won't overwrite
+ // a user's comment.
+ github.issues.getComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ comment_id: comment.id
+ }).then((old_comment) => {
+ console.log(old_comment);
+ if (old_comment.data.user.login != "github-actions[bot]") {
+ console.log("Invalid comment id: " + comment.id);
+ return;
+ }
+ github.issues.updateComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: pr_number,
+ comment_id: comment.id,
+ body: comment.body
+ });
+ });
+ } else {
+ github.issues.createComment({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: pr_number,
+ body: comment.body
+ });
+ }
+ });
+
+ - name: Dump comments file
+ if: always()
+ run: cat comments
diff --git a/.github/workflows/llvm-project-tests.yml b/.github/workflows/llvm-project-tests.yml
index 43b90193406fc96983e9a73675fc322f1280c70e..a52dd2db8035ddce07a606268f6472f552841f5c 100644
--- a/.github/workflows/llvm-project-tests.yml
+++ b/.github/workflows/llvm-project-tests.yml
@@ -118,6 +118,11 @@ jobs:
else
builddir="$(pwd)"/build
fi
+ if [ "${{ runner.os }}" == "macOS" ]; then
+ # Workaround test failure on some lld tests on MacOS
+ # https://github.com/llvm/llvm-project/issues/81967
+ extra_cmake_args="-DLLVM_DISABLE_ASSEMBLY_FILES=ON"
+ fi
echo "llvm-builddir=$builddir" >> "$GITHUB_OUTPUT"
cmake -G Ninja \
-B "$builddir" \
diff --git a/.github/workflows/llvm-tests.yml b/.github/workflows/llvm-tests.yml
index 127628d76f1913ff91bf5f37bec347d75cfed084..64d60bc3da45e1ec42c158f5d316e48cfd7d6229 100644
--- a/.github/workflows/llvm-tests.yml
+++ b/.github/workflows/llvm-tests.yml
@@ -42,6 +42,7 @@ jobs:
BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }}
ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }}
BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }}
+ BASELINE_VERSION_MINOR: ${{ steps.vars.outputs.BASELINE_VERSION_MINOR }}
LLVM_VERSION_MAJOR: ${{ steps.version.outputs.LLVM_VERSION_MAJOR }}
LLVM_VERSION_MINOR: ${{ steps.version.outputs.LLVM_VERSION_MINOR }}
LLVM_VERSION_PATCH: ${{ steps.version.outputs.LLVM_VERSION_PATCH }}
@@ -58,7 +59,14 @@ jobs:
- name: Setup Variables
id: vars
run: |
- if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 ] || [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
+ # C++ ABI:
+ # 18.1.0 we aren't doing ABI checks.
+ # 18.1.1 We want to check 18.1.0.
+ # C ABI:
+ # 18.1.0 We want to check 17.0.x
+ # 18.1.1 We want to check 18.1.0
+ echo "BASELINE_VERSION_MINOR=1" >> "$GITHUB_OUTPUT"
+ if [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
{
echo "BASELINE_VERSION_MAJOR=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1))"
echo "ABI_HEADERS=llvm-c"
@@ -82,7 +90,7 @@ jobs:
include:
- name: build-baseline
llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}
- ref: llvmorg-${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}.0.0
+ ref: llvmorg-${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}.${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MINOR }}.0
repo: llvm/llvm-project
- name: build-latest
llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }}
diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml
index 3d0c23917bd403007ccd102787546793b8bfa36a..10b18f245d8965a69251038f44f1505fc40c0cf0 100644
--- a/.github/workflows/pr-code-format.yml
+++ b/.github/workflows/pr-code-format.yml
@@ -1,12 +1,9 @@
name: "Check code formatting"
on:
- pull_request_target:
+ pull_request:
branches:
- main
-permissions:
- pull-requests: write
-
jobs:
code_formatter:
runs-on: ubuntu-latest
@@ -31,12 +28,13 @@ jobs:
separator: ","
skip_initial_fetch: true
- # We need to make sure that we aren't executing/using any code from the
- # PR for security reasons as we're using pull_request_target. Checkout
- # the target branch with the necessary files.
+ # We need to pull the script from the main branch, so that we ensure
+ # we get the latest version of this script.
- name: Fetch code formatting utils
uses: actions/checkout@v4
with:
+ repository: ${{ github.repository }}
+ ref: ${{ github.base_ref }}
sparse-checkout: |
llvm/utils/git/requirements_formatting.txt
llvm/utils/git/code-format-helper.py
@@ -53,7 +51,7 @@ jobs:
- name: Install clang-format
uses: aminya/setup-cpp@v1
with:
- clangformat: 17.0.1
+ clangformat: 18.1.1
- name: Setup Python env
uses: actions/setup-python@v4
@@ -75,10 +73,20 @@ jobs:
# to take advantage of the new --diff_from_common_commit option
# explicitly in code-format-helper.py and not have to diff starting at
# the merge base.
+ # Create an empty comments file so the pr-write job doesn't fail.
run: |
+ echo "[]" > comments &&
python ./code-format-tools/llvm/utils/git/code-format-helper.py \
+ --write-comment-to-file \
--token ${{ secrets.GITHUB_TOKEN }} \
--issue-number $GITHUB_PR_NUMBER \
--start-rev $(git merge-base $START_REV $END_REV) \
--end-rev $END_REV \
--changed-files "$CHANGED_FILES"
+
+ - uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
+ if: always()
+ with:
+ name: workflow-args
+ path: |
+ comments
diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml
index b8e8ab26c3ffa61a1f3a76883034564086d1d237..ff61cf83a6af3c816e7fa4b0a55fa26f3d1471e4 100644
--- a/.github/workflows/scorecard.yml
+++ b/.github/workflows/scorecard.yml
@@ -36,7 +36,7 @@ jobs:
persist-credentials: false
- name: "Run analysis"
- uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
+ uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
with:
results_file: results.sarif
results_format: sarif
diff --git a/bolt/CMakeLists.txt b/bolt/CMakeLists.txt
index f163d45342874d0e8dd2a64a292e735ddf3cd626..cc3a70fa35e0ab1c5a5029bea080a363eebdbd0c 100644
--- a/bolt/CMakeLists.txt
+++ b/bolt/CMakeLists.txt
@@ -45,9 +45,9 @@ if (BOLT_ENABLE_RUNTIME)
execute_process(COMMAND ls /proc/self/map_files
RESULT_VARIABLE LS OUTPUT_QUIET ERROR_QUIET)
if (LS)
- set(BOLT_ENABLE_RUNTIME OFF)
message(WARNING
- "BOLT runtime is disabled as /proc/self/map_files is unreadable.")
+ "BOLT runtime may not be able to read /proc/self/map_files. Please use
+ `--instrumentation-binpath ` option.")
endif()
endif()
diff --git a/bolt/docs/BAT.md b/bolt/docs/BAT.md
index d1cab984d14834242836622ed4f5b448e887723c..f23ef1abf8761cc58fc2249ef0da43ae0034e114 100644
--- a/bolt/docs/BAT.md
+++ b/bolt/docs/BAT.md
@@ -14,9 +14,8 @@ binary onto the original binary.
# Usage
`--enable-bat` flag controls the generation of BAT section. Sampled profile
needs to be passed along with the optimized binary containing BAT section to
-`perf2bolt` which reads BAT section and produces fdata profile for the original
-binary. Note that YAML profile generation is not supported since BAT doesn't
-contain the metadata for input functions.
+`perf2bolt` which reads BAT section and produces profile for the original
+binary.
# Internals
## Section contents
@@ -43,21 +42,21 @@ and [BoltAddressTranslation.cpp](/bolt/lib/Profile/BoltAddressTranslation.cpp).
### Layout
The general layout is as follows:
```
-Hot functions table header
-|------------------|
-| Function entry |
-| |--------------| |
-| | OutOff InOff | |
-| |--------------| |
-~~~~~~~~~~~~~~~~~~~~
+Hot functions table
+Cold functions table
-Cold functions table header
+Functions table:
|------------------|
| Function entry |
-| |--------------| |
-| | OutOff InOff | |
-| |--------------| |
-~~~~~~~~~~~~~~~~~~~~
+| |
+| Address |
+| translation |
+| table |
+| |
+| Secondary entry |
+| points |
+|------------------|
+
```
### Functions table
@@ -75,28 +74,43 @@ internal offsets, and between hot and cold fragments, to better spread deltas
and save space.
Hot indices are delta encoded, implicitly starting at zero.
-| Entry | Encoding | Description |
-| ------ | ------| ----------- |
-| `Address` | Continuous, Delta, ULEB128 | Function address in the output binary |
-| `HotIndex` | Delta, ULEB128 | Cold functions only: index of corresponding hot function in hot functions table |
-| `NumEntries` | ULEB128 | Number of address translation entries for a function |
-| `EqualElems` | ULEB128 | Hot functions only: number of equal offsets in the beginning of a function |
-| `BranchEntries` | Bitmask, `alignTo(EqualElems, 8)` bits | Hot functions only: if `EqualElems` is non-zero, bitmask denoting entries with `BRANCHENTRY` bit |
+| Entry | Encoding | Description | Hot/Cold |
+| ------ | ------| ----------- | ------ |
+| `Address` | Continuous, Delta, ULEB128 | Function address in the output binary | Both |
+| `HotIndex` | Delta, ULEB128 | Index of corresponding hot function in hot functions table | Cold |
+| `FuncHash` | 8b | Function hash for input function | Hot |
+| `NumBlocks` | ULEB128 | Number of basic blocks in the original function | Hot |
+| `NumSecEntryPoints` | ULEB128 | Number of secondary entry points in the original function | Hot |
+| `NumEntries` | ULEB128 | Number of address translation entries for a function | Both |
+| `EqualElems` | ULEB128 | Number of equal offsets in the beginning of a function | Hot |
+| `BranchEntries` | Bitmask, `alignTo(EqualElems, 8)` bits | If `EqualElems` is non-zero, bitmask denoting entries with `BRANCHENTRY` bit | Hot |
-Function header is followed by `EqualElems` offsets (hot functions only) and
-`NumEntries-EqualElems` (`NumEntries` for cold functions) pairs of offsets for
-current function.
+Function header is followed by *Address Translation Table* with `NumEntries`
+total entries, and *Secondary Entry Points* table with `NumSecEntryPoints`
+entries (hot functions only).
### Address translation table
Delta encoding means that only the difference with the previous corresponding
entry is encoded. Input offsets implicitly start at zero.
-| Entry | Encoding | Description |
-| ------ | ------| ----------- |
-| `OutputOffset` | Continuous, Delta, ULEB128 | Function offset in output binary |
-| `InputOffset` | Optional, Delta, SLEB128 | Function offset in input binary with `BRANCHENTRY` LSB bit |
+| Entry | Encoding | Description | Branch/BB |
+| ------ | ------| ----------- | ------ |
+| `OutputOffset` | Continuous, Delta, ULEB128 | Function offset in output binary | Both |
+| `InputOffset` | Optional, Delta, SLEB128 | Function offset in input binary with `BRANCHENTRY` LSB bit | Both |
+| `BBHash` | Optional, 8b | Basic block hash in input binary | BB |
+| `BBIdx` | Optional, Delta, ULEB128 | Basic block index in input binary | BB |
+
+For hot fragments, the table omits the first `EqualElems` input offsets
+where the input offset equals output offset.
`BRANCHENTRY` bit denotes whether a given offset pair is a control flow source
(branch or call instruction). If not set, it signifies a control flow target
(basic block offset).
`InputAddr` is omitted for equal offsets in input and output function. In this
case, `BRANCHENTRY` bits are encoded separately in a `BranchEntries` bitvector.
+
+### Secondary Entry Points table
+The table is emitted for hot fragments only. It contains `NumSecEntryPoints`
+offsets denoting secondary entry points, delta encoded, implicitly starting at zero.
+| Entry | Encoding | Description |
+| ----- | -------- | ----------- |
+| `SecEntryPoint` | Delta, ULEB128 | Secondary entry point offset |
diff --git a/bolt/include/bolt/Core/AddressMap.h b/bolt/include/bolt/Core/AddressMap.h
index 85a9ab4473aafedd192145acaa334208e22ac6e6..31ed7d40ee7f215586e53a6b285f492c898ab765 100644
--- a/bolt/include/bolt/Core/AddressMap.h
+++ b/bolt/include/bolt/Core/AddressMap.h
@@ -14,7 +14,6 @@
#ifndef BOLT_CORE_ADDRESS_MAP_H
#define BOLT_CORE_ADDRESS_MAP_H
-#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCSymbol.h"
#include
diff --git a/bolt/include/bolt/Core/BinaryContext.h b/bolt/include/bolt/Core/BinaryContext.h
index 741b1a36af86f871bb51430686ff229ce2e1d1b8..8b1af9e8153925760985efcb954e87a046b2c1f2 100644
--- a/bolt/include/bolt/Core/BinaryContext.h
+++ b/bolt/include/bolt/Core/BinaryContext.h
@@ -265,7 +265,8 @@ class BinaryContext {
public:
static Expected>
- createBinaryContext(const ObjectFile *File, bool IsPIC,
+ createBinaryContext(Triple TheTriple, StringRef InputFileName,
+ SubtargetFeatures *Features, bool IsPIC,
std::unique_ptr DwCtx,
JournalingStreams Logger);
diff --git a/bolt/include/bolt/Core/BinaryData.h b/bolt/include/bolt/Core/BinaryData.h
index 5f1efda781905db66ec18e16a3263a88c5f0816f..495163f1b61aafd2360b9699fcda4f95844f1dd3 100644
--- a/bolt/include/bolt/Core/BinaryData.h
+++ b/bolt/include/bolt/Core/BinaryData.h
@@ -18,7 +18,6 @@
#include "llvm/ADT/Twine.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/raw_ostream.h"
-#include
#include
#include
diff --git a/bolt/include/bolt/Core/BinaryDomTree.h b/bolt/include/bolt/Core/BinaryDomTree.h
index a9565795f94631b25c6674eb699b78e9f9d5bffd..de27aa78769d23398eaf97177ad316abf3e09798 100644
--- a/bolt/include/bolt/Core/BinaryDomTree.h
+++ b/bolt/include/bolt/Core/BinaryDomTree.h
@@ -16,7 +16,6 @@
#include "bolt/Core/BinaryBasicBlock.h"
#include "llvm/IR/Dominators.h"
-#include "llvm/Support/GenericDomTreeConstruction.h"
namespace llvm {
namespace bolt {
diff --git a/bolt/include/bolt/Core/BinaryFunction.h b/bolt/include/bolt/Core/BinaryFunction.h
index c170fa6397cc927293f539391ea5a29b7389a7be..bc047fefa3151c9d32050e71ed3d182005665923 100644
--- a/bolt/include/bolt/Core/BinaryFunction.h
+++ b/bolt/include/bolt/Core/BinaryFunction.h
@@ -27,6 +27,7 @@
#include "bolt/Core/BinaryBasicBlock.h"
#include "bolt/Core/BinaryContext.h"
+#include "bolt/Core/BinaryDomTree.h"
#include "bolt/Core/BinaryLoop.h"
#include "bolt/Core/BinarySection.h"
#include "bolt/Core/DebugData.h"
@@ -51,7 +52,6 @@
#include
#include
#include
-#include
#include
#include
@@ -266,6 +266,7 @@ private:
BinaryContext &BC;
std::unique_ptr BLI;
+ std::unique_ptr BDT;
/// All labels in the function that are referenced via relocations from
/// data objects. Typically these are jump table destinations and computed
@@ -838,6 +839,14 @@ public:
/// stats.
void calculateMacroOpFusionStats();
+ /// Returns if BinaryDominatorTree has been constructed for this function.
+ bool hasDomTree() const { return BDT != nullptr; }
+
+ BinaryDominatorTree &getDomTree() { return *BDT.get(); }
+
+ /// Constructs DomTree for this function.
+ void constructDomTree();
+
/// Returns if loop detection has been run for this function.
bool hasLoopInfo() const { return BLI != nullptr; }
@@ -1159,7 +1168,7 @@ public:
/// Pass an offset of the entry point in the input binary and a corresponding
/// global symbol to the callback function.
///
- /// Return true of all callbacks returned true, false otherwise.
+ /// Return true if all callbacks returned true, false otherwise.
bool forEachEntryPoint(EntryPointCallbackTy Callback) const;
/// Return MC symbol associated with the end of the function.
diff --git a/bolt/include/bolt/Core/BinaryLoop.h b/bolt/include/bolt/Core/BinaryLoop.h
index 72dce77df8c14b970023a59b82180f6bc2bb1633..b425c75715d8b1d02e66655d8ff7e4d9115fffdd 100644
--- a/bolt/include/bolt/Core/BinaryLoop.h
+++ b/bolt/include/bolt/Core/BinaryLoop.h
@@ -15,7 +15,7 @@
#ifndef BOLT_CORE_BINARY_LOOP_H
#define BOLT_CORE_BINARY_LOOP_H
-#include "llvm/Support/GenericLoopInfoImpl.h"
+#include "llvm/Support/GenericLoopInfo.h"
namespace llvm {
namespace bolt {
diff --git a/bolt/include/bolt/Core/BinarySection.h b/bolt/include/bolt/Core/BinarySection.h
index 0f179877bd3df3b4bf7e736d1fc00e4806c9f7d2..5b7a5b08820e6e5190559ce2ad59992c7a998e2a 100644
--- a/bolt/include/bolt/Core/BinarySection.h
+++ b/bolt/include/bolt/Core/BinarySection.h
@@ -18,7 +18,6 @@
#include "bolt/Core/DebugData.h"
#include "bolt/Core/Relocation.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Object/MachO.h"
diff --git a/bolt/include/bolt/Core/DIEBuilder.h b/bolt/include/bolt/Core/DIEBuilder.h
index 4debf9363354725d612d6fae03a0f2d0e0cce1e5..06084819ec0b3ab96daa83f071a5594e8d7efcd0 100644
--- a/bolt/include/bolt/Core/DIEBuilder.h
+++ b/bolt/include/bolt/Core/DIEBuilder.h
@@ -209,7 +209,13 @@ private:
void updateReferences();
/// Update the Offset and Size of DIE, populate DebugNames table.
- uint32_t finalizeDIEs(DWARFUnit &CU, DIE &Die, uint32_t &CurOffset);
+ /// Along with current CU, and DIE being processed and the new DIE offset to
+ /// be updated, it takes in Parents vector that can be empty if this DIE has
+ /// no parents.
+ uint32_t
+ finalizeDIEs(DWARFUnit &CU, DIE &Die,
+ std::vector> &Parents,
+ uint32_t &CurOffset);
void registerUnit(DWARFUnit &DU, bool NeedSort);
diff --git a/bolt/include/bolt/Core/DebugData.h b/bolt/include/bolt/Core/DebugData.h
index 7d10b208dc83a22c9eee5d0f5acd538258401e42..166bb3617e57f68448eb662348e2e414ed885b32 100644
--- a/bolt/include/bolt/Core/DebugData.h
+++ b/bolt/include/bolt/Core/DebugData.h
@@ -27,7 +27,6 @@
#include
#include
#include
-#include
#include
#include
diff --git a/bolt/include/bolt/Core/DebugNames.h b/bolt/include/bolt/Core/DebugNames.h
index 84c448aa1354cc866a8c484e11c808724ad4d550..a4fdde7c396ad886e3d8c96bb92d25a657a4a0e1 100644
--- a/bolt/include/bolt/Core/DebugNames.h
+++ b/bolt/include/bolt/Core/DebugNames.h
@@ -14,7 +14,7 @@
#ifndef BOLT_CORE_DEBUG_NAMES_H
#define BOLT_CORE_DEBUG_NAMES_H
-#include "DebugData.h"
+#include "bolt/Core/DebugData.h"
#include "llvm/CodeGen/AccelTable.h"
namespace llvm {
@@ -36,6 +36,9 @@ public:
bool isTU() const { return DWARF5AccelTableData::isTU(); }
std::optional getSecondUnitID() const { return SecondUnitID; }
+ void setPatchOffset(uint64_t PatchOffset) { OffsetVal = PatchOffset; }
+ uint64_t getPatchOffset() const { return std::get(OffsetVal); }
+
private:
std::optional SecondUnitID;
};
@@ -49,10 +52,12 @@ public:
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 &DWOID);
+ /// Input is DWARFUnit being processed, DIE that belongs to it, potential
+ /// DWOID if the Unit comes from a DWO section, and potential parent entry.
+ std::optional
+ addAccelTableEntry(DWARFUnit &Unit, const DIE &Die,
+ const std::optional &DWOID,
+ std::optional &Parent);
/// Set current unit being processed.
void setCurrentUnit(DWARFUnit &Unit, const uint64_t UnitStartOffset);
/// Emit Accelerator table.
@@ -63,6 +68,16 @@ public:
std::unique_ptr releaseBuffer() {
return std::move(FullTableBuffer);
}
+ /// Adds a DIE that is referenced across CUs.
+ void addCrossCUDie(const DIE *Die) {
+ CrossCUDies.insert({Die->getOffset(), Die});
+ }
+ /// Returns true if the DIE can generate an entry for a cross cu reference.
+ /// This only checks TAGs of a DIE because when this is invoked DIE might not
+ /// be fully constructed.
+ bool canGenerateEntryWithCrossCUReference(
+ const DWARFUnit &Unit, const DIE &Die,
+ const DWARFAbbreviationDeclaration::AttributeSpec &AttrSpec);
private:
BinaryContext &BC;
@@ -121,6 +136,9 @@ private:
llvm::DenseMap StrCacheToOffsetMap;
// Contains DWO ID to CUList Index.
llvm::DenseMap CUOffsetsToPatch;
+ // Contains a map of Entry ID to Entry relative offset.
+ llvm::DenseMap EntryRelativeOffsets;
+ llvm::DenseMap CrossCUDies;
/// 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.
@@ -143,7 +161,7 @@ private:
/// Write Entries.
void writeEntries();
/// Write an Entry.
- void writeEntry(const BOLTDWARF5AccelTableData &Entry);
+ void writeEntry(BOLTDWARF5AccelTableData &Entry);
/// Write augmentation_string for BOLT.
void writeAugmentationString();
/// Emit out Header for DWARF5 Accelerator table.
diff --git a/bolt/include/bolt/Core/FunctionLayout.h b/bolt/include/bolt/Core/FunctionLayout.h
index 2e4c184ba4511ca6836ca9d031014c1f784385f0..b685a99c79c14cccd0e7661ed8a48991c9a53b98 100644
--- a/bolt/include/bolt/Core/FunctionLayout.h
+++ b/bolt/include/bolt/Core/FunctionLayout.h
@@ -25,7 +25,6 @@
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
#include
-#include
namespace llvm {
namespace bolt {
diff --git a/bolt/include/bolt/Core/MCPlus.h b/bolt/include/bolt/Core/MCPlus.h
index b6a9e73f2347e71faa09beb4ae2aad9ff7fc5747..601d709712864ebefce1a4156378b023f564be96 100644
--- a/bolt/include/bolt/Core/MCPlus.h
+++ b/bolt/include/bolt/Core/MCPlus.h
@@ -14,10 +14,8 @@
#ifndef BOLT_CORE_MCPLUS_H
#define BOLT_CORE_MCPLUS_H
-#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
-#include "llvm/Support/Casting.h"
#include
namespace llvm {
@@ -73,6 +71,7 @@ public:
kOffset, /// Offset in the function.
kLabel, /// MCSymbol pointing to this instruction.
kSize, /// Size of the instruction.
+ kDynamicBranch, /// Jit instruction patched at runtime.
kGeneric /// First generic annotation.
};
diff --git a/bolt/include/bolt/Core/MCPlusBuilder.h b/bolt/include/bolt/Core/MCPlusBuilder.h
index 6bb76d1b917db3159bfca8cbd3904110486a056b..f7614cf9ac9777be6812e228190cc20c810b4c3d 100644
--- a/bolt/include/bolt/Core/MCPlusBuilder.h
+++ b/bolt/include/bolt/Core/MCPlusBuilder.h
@@ -19,6 +19,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/StringMap.h"
+#include "llvm/CodeGen/TargetOpcodes.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCDisassembler/MCSymbolizer.h"
#include "llvm/MC/MCExpr.h"
@@ -27,6 +28,7 @@
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/RWMutex.h"
@@ -487,10 +489,9 @@ public:
llvm_unreachable("not implemented");
}
- virtual bool createDirectCall(MCInst &Inst, const MCSymbol *Target,
+ virtual void createDirectCall(MCInst &Inst, const MCSymbol *Target,
MCContext *Ctx, bool IsTailCall) {
llvm_unreachable("not implemented");
- return false;
}
virtual MCPhysReg getX86R11() const { llvm_unreachable("not implemented"); }
@@ -534,9 +535,7 @@ public:
return Analysis->isReturn(Inst);
}
- virtual bool isTerminator(const MCInst &Inst) const {
- return Analysis->isTerminator(Inst);
- }
+ virtual bool isTerminator(const MCInst &Inst) const;
virtual bool isNoop(const MCInst &Inst) const {
llvm_unreachable("not implemented");
@@ -1200,6 +1199,16 @@ public:
/// Set instruction size.
void setSize(MCInst &Inst, uint32_t Size) const;
+ /// Check if the branch instruction could be modified at runtime.
+ bool isDynamicBranch(const MCInst &Inst) const;
+
+ /// Return ID for runtime-modifiable instruction.
+ std::optional getDynamicBranchID(const MCInst &Inst) const;
+
+ /// Mark instruction as a dynamic branch, i.e. a branch that can be
+ /// overwritten at runtime.
+ void setDynamicBranch(MCInst &Inst, uint32_t ID) const;
+
/// Return MCSymbol that represents a target of this instruction at a given
/// operand number \p OpNum. If there's no symbol associated with
/// the operand - return nullptr.
@@ -1534,15 +1543,13 @@ public:
}
/// Create a no-op instruction.
- virtual bool createNoop(MCInst &Inst) const {
+ virtual void createNoop(MCInst &Inst) const {
llvm_unreachable("not implemented");
- return false;
}
/// Create a return instruction.
- virtual bool createReturn(MCInst &Inst) const {
+ virtual void createReturn(MCInst &Inst) const {
llvm_unreachable("not implemented");
- return false;
}
/// Store \p Target absolute address to \p RegName
@@ -1556,32 +1563,30 @@ public:
/// Creates a new unconditional branch instruction in Inst and set its operand
/// to TBB.
- ///
- /// Returns true on success.
- virtual bool createUncondBranch(MCInst &Inst, const MCSymbol *TBB,
+ virtual void createUncondBranch(MCInst &Inst, const MCSymbol *TBB,
MCContext *Ctx) const {
llvm_unreachable("not implemented");
- return false;
+ }
+
+ /// Create a version of unconditional jump that has the largest span for a
+ /// single instruction with direct target.
+ virtual void createLongUncondBranch(MCInst &Inst, const MCSymbol *Target,
+ MCContext *Ctx) const {
+ llvm_unreachable("not implemented");
}
/// Creates a new call instruction in Inst and sets its operand to
/// Target.
- ///
- /// Returns true on success.
- virtual bool createCall(MCInst &Inst, const MCSymbol *Target,
+ virtual void createCall(MCInst &Inst, const MCSymbol *Target,
MCContext *Ctx) {
llvm_unreachable("not implemented");
- return false;
}
/// Creates a new tail call instruction in Inst and sets its operand to
/// Target.
- ///
- /// Returns true on success.
- virtual bool createTailCall(MCInst &Inst, const MCSymbol *Target,
+ virtual void createTailCall(MCInst &Inst, const MCSymbol *Target,
MCContext *Ctx) {
llvm_unreachable("not implemented");
- return false;
}
virtual void createLongTailCall(InstructionListType &Seq,
@@ -1590,43 +1595,36 @@ public:
}
/// Creates a trap instruction in Inst.
- ///
- /// Returns true on success.
- virtual bool createTrap(MCInst &Inst) const {
+ virtual void createTrap(MCInst &Inst) const {
llvm_unreachable("not implemented");
- return false;
}
/// Creates an instruction to bump the stack pointer just like a call.
- virtual bool createStackPointerIncrement(MCInst &Inst, int Size = 8,
+ virtual void createStackPointerIncrement(MCInst &Inst, int Size = 8,
bool NoFlagsClobber = false) const {
llvm_unreachable("not implemented");
- return false;
}
/// Creates an instruction to move the stack pointer just like a ret.
- virtual bool createStackPointerDecrement(MCInst &Inst, int Size = 8,
+ virtual void createStackPointerDecrement(MCInst &Inst, int Size = 8,
bool NoFlagsClobber = false) const {
llvm_unreachable("not implemented");
- return false;
}
/// Create a store instruction using \p StackReg as the base register
/// and \p Offset as the displacement.
- virtual bool createSaveToStack(MCInst &Inst, const MCPhysReg &StackReg,
+ virtual void createSaveToStack(MCInst &Inst, const MCPhysReg &StackReg,
int Offset, const MCPhysReg &SrcReg,
int Size) const {
llvm_unreachable("not implemented");
- return false;
}
- virtual bool createLoad(MCInst &Inst, const MCPhysReg &BaseReg, int64_t Scale,
+ virtual void createLoad(MCInst &Inst, const MCPhysReg &BaseReg, int64_t Scale,
const MCPhysReg &IndexReg, int64_t Offset,
const MCExpr *OffsetExpr,
const MCPhysReg &AddrSegmentReg,
const MCPhysReg &DstReg, int Size) const {
llvm_unreachable("not implemented");
- return false;
}
virtual InstructionListType createLoadImmediate(const MCPhysReg Dest,
@@ -1636,32 +1634,27 @@ public:
/// Create a fragment of code (sequence of instructions) that load a 32-bit
/// address from memory, zero-extends it to 64 and jump to it (indirect jump).
- virtual bool
+ virtual void
createIJmp32Frag(SmallVectorImpl &Insts, const MCOperand &BaseReg,
const MCOperand &Scale, const MCOperand &IndexReg,
const MCOperand &Offset, const MCOperand &TmpReg) const {
llvm_unreachable("not implemented");
- return false;
}
/// Create a load instruction using \p StackReg as the base register
/// and \p Offset as the displacement.
- virtual bool createRestoreFromStack(MCInst &Inst, const MCPhysReg &StackReg,
+ virtual void createRestoreFromStack(MCInst &Inst, const MCPhysReg &StackReg,
int Offset, const MCPhysReg &DstReg,
int Size) const {
llvm_unreachable("not implemented");
- return false;
}
/// Creates a call frame pseudo instruction. A single operand identifies which
/// MCCFIInstruction this MCInst is referring to.
- ///
- /// Returns true on success.
- virtual bool createCFI(MCInst &Inst, int64_t Offset) const {
+ virtual void createCFI(MCInst &Inst, int64_t Offset) const {
Inst.clear();
Inst.setOpcode(TargetOpcode::CFI_INSTRUCTION);
Inst.addOperand(MCOperand::createImm(Offset));
- return true;
}
/// Create an inline version of memcpy(dest, src, 1).
@@ -1699,6 +1692,19 @@ public:
return Inst.getOpcode() == TargetOpcode::CFI_INSTRUCTION;
}
+ /// Create a conditional branch with a target-specific conditional code \p CC.
+ virtual void createCondBranch(MCInst &Inst, const MCSymbol *Target,
+ unsigned CC, MCContext *Ctx) const {
+ llvm_unreachable("not implemented");
+ }
+
+ /// Create long conditional branch with a target-specific conditional code
+ /// \p CC.
+ virtual void createLongCondBranch(MCInst &Inst, const MCSymbol *Target,
+ unsigned CC, MCContext *Ctx) const {
+ llvm_unreachable("not implemented");
+ }
+
/// Reverses the branch condition in Inst and update its taken target to TBB.
///
/// Returns true on success.
diff --git a/bolt/include/bolt/Passes/BinaryPasses.h b/bolt/include/bolt/Passes/BinaryPasses.h
index 046765b16f19d21b8562440f51c1b0c3c666995e..8d89ef8b5484f8e18d7ea034c3d38df57746760a 100644
--- a/bolt/include/bolt/Passes/BinaryPasses.h
+++ b/bolt/include/bolt/Passes/BinaryPasses.h
@@ -18,7 +18,6 @@
#include "bolt/Core/DynoStats.h"
#include "llvm/Support/CommandLine.h"
#include
-#include