-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[SHT_LLVM_BB_ADDR_MAP] Emit callsite offsets in the SHT_LLVM_BB_ADDR_MAP
section.
#146563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rlavaee
wants to merge
4
commits into
llvm:main
Choose a base branch
from
rlavaee:callsite_anchors_codegen
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+192
−70
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b4f744d
[SHT_LLVM_BB_ADDR_MAP] Emit callsite offsets in the section.
rlavaee b844e1d
Updated Extensions.rst.
rlavaee 0c900b5
Update ELFTypes.h to reflect that callsite offset refers to the begin…
rlavaee 03e8db5
Remove LLVM_ABI from function declaration.
rlavaee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -405,31 +405,72 @@ This section is emitted with ``-basic-block-address-map`` and will contain | |||||
a BB address map table for every function. | ||||||
|
||||||
The ``SHT_LLVM_BB_ADDR_MAP`` type provides backward compatibility to allow | ||||||
reading older versions of the BB address map generated by older compilers. Each | ||||||
function entry starts with a version byte which specifies the encoding version | ||||||
to use. The following versioning schemes are currently supported. | ||||||
reading older versions of the BB address map generated by older compilers (up to | ||||||
two years old). Each function entry starts with a version byte which specifies | ||||||
the encoding version to use. This follows by a feature byte which specifies the | ||||||
features specific to this particular entry. The function base address is stored | ||||||
as a full address. Other addresses in the entry (block begin and end addresses | ||||||
and callsite addresses) are stored in a running-offset fashion, as offset | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
relative to the prior address. | ||||||
|
||||||
Version 1 (newest): basic block address offsets are computed relative to the end | ||||||
of previous blocks. | ||||||
The following versioning schemes are currently supported (newer versions support | ||||||
features of the older versions). | ||||||
|
||||||
Version 3 (newest): Capable of encoding callsite offsets. Enabled by the 6th bit | ||||||
of the feature byte. | ||||||
|
||||||
Example: | ||||||
|
||||||
.. code-block:: gas | ||||||
|
||||||
.section ".llvm_bb_addr_map","",@llvm_bb_addr_map | ||||||
.byte 1 # version number | ||||||
.byte 0 # feature byte (reserved for future use) | ||||||
.byte 3 # version number | ||||||
.byte 32 # feature byte | ||||||
.quad .Lfunc_begin0 # address of the function | ||||||
.byte 2 # number of basic blocks | ||||||
# BB record for BB_0 | ||||||
.uleb128 .Lfunc_beign0-.Lfunc_begin0 # BB_0 offset relative to function entry (always zero) | ||||||
.byte 0 # BB_0 ID | ||||||
.uleb128 .Lfunc_begin0-.Lfunc_begin0 # BB_0 offset relative to function entry (always zero) | ||||||
.byte 0 # number of callsites in this block | ||||||
.uleb128 .LBB_END0_0-.Lfunc_begin0 # BB_0 size | ||||||
.byte x # BB_0 metadata | ||||||
# BB record for BB_1 | ||||||
.byte 1 # BB_1 ID | ||||||
.uleb128 .LBB0_1-.LBB_END0_0 # BB_1 offset relative to the end of last block (BB_0). | ||||||
.uleb128 .LBB_END0_1-.LBB0_1 # BB_1 size | ||||||
.byte 2 # number of callsites in this block | ||||||
.uleb128 .LBB0_1_CS0-.LBB0_1 # offset of callsite relative to the previous offset (.LBB0_1) | ||||||
.uleb128 .LBB0_1_CS1-.LBB0_1_CS0 # offset of callsite relative to the previous offset (.LBB0_1_CS0) | ||||||
.uleb128 .LBB_END0_1-.LBB0_1_CS1 # BB_1 size offset (Offset of the block end relative to the previous offset). | ||||||
.byte y # BB_1 metadata | ||||||
|
||||||
Version 2: Capable of encoding split functions. Enabled by the 4th bit of the | ||||||
feature byte. The base address of each split range is stored as a full address. | ||||||
The first range corresponds to the function entry. | ||||||
|
||||||
Example: | ||||||
|
||||||
.. code-block:: gas | ||||||
.section ".llvm_bb_addr_map","",@llvm_bb_addr_map | ||||||
.byte 2 # version number | ||||||
.byte 8 # feature byte | ||||||
.byte 2 # number of basic block ranges | ||||||
# 1st BB range (corresponding to the function entry) | ||||||
.quad .Lfunc_begin0 # base address | ||||||
.byte 1 # number of basic blocks in this range | ||||||
# BB record for BB_0 | ||||||
.byte 0 # BB_0 ID | ||||||
.uleb128 .Lfunc_begin0-.Lfunc_begin0 # BB_0 offset relative to function entry (always zero) | ||||||
.uleb128 .LBB_END0_0-.Lfunc_begin0 # BB_0 size | ||||||
.byte x # BB_0 metadata | ||||||
# 2nd BB range | ||||||
.quad func.part.1 | ||||||
.byte 1 # number of basic blocks in this range | ||||||
# BB record for BB_1 | ||||||
.byte 1 # BB_1 ID | ||||||
.uleb128 func.part.1-func.part.1 # BB_1 offset relative to the range begin (always zero) | ||||||
.uleb128 .LBB_END0_1-func.part.1 # BB_1 size | ||||||
.byte 1 # BB_1 metadata | ||||||
|
||||||
PGO Analysis Map | ||||||
"""""""""""""""" | ||||||
|
||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.