diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2018-06-02 16:33:01 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2018-06-02 16:33:01 +0000 |
commit | ae6eeaea9283a2d0da50af842c3d76cc651926f8 (patch) | |
tree | 9c0d09daf7d28d668f279b185308091be499f7d5 /llvm/docs | |
parent | 93d8fbd8f263e71aabc0cbb4492098ea9105285f (diff) | |
download | bcm5719-llvm-ae6eeaea9283a2d0da50af842c3d76cc651926f8.tar.gz bcm5719-llvm-ae6eeaea9283a2d0da50af842c3d76cc651926f8.zip |
[MC] Add assembler support for .cg_profile.
Object FIle Representation
At codegen time this is emitted into the ELF file a pair of symbol indices and a weight. In assembly it looks like:
.cg_profile a, b, 32
.cg_profile freq, a, 11
.cg_profile freq, b, 20
When writing an ELF file these are put into a SHT_LLVM_CALL_GRAPH_PROFILE (0x6fff4c02) section as (uint32_t, uint32_t, uint64_t) tuples as (from symbol index, to symbol index, weight).
Differential Revision: https://reviews.llvm.org/D44965
llvm-svn: 333823
Diffstat (limited to 'llvm/docs')
-rw-r--r-- | llvm/docs/Extensions.rst | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/llvm/docs/Extensions.rst b/llvm/docs/Extensions.rst index fd67906a9ac..6f99006adc9 100644 --- a/llvm/docs/Extensions.rst +++ b/llvm/docs/Extensions.rst @@ -285,6 +285,50 @@ The following directives are specified: The paramter identifies an additional library search path to be considered when looking up libraries after the inclusion of this option. +``SHT_LLVM_CALL_GRAPH_PROFILE`` Section (Call Graph Profile) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This section is used to pass a call graph profile to the linker which can be +used to optimize the placement of sections. It contains a sequence of +(from symbol, to symbol, weight) tuples. + +It shall have a type of ``SHT_LLVM_CALL_GRAPH_PROFILE`` (0x6fff4c02), shall +have the ``SHF_EXCLUDE`` flag set, the ``sh_link`` member shall hold the section +header index of the associated symbol table, and shall have a ``sh_entsize`` of +16. It should be named ``.llvm.call-graph-profile``. + +The contents of the section shall be a sequence of ``Elf_CGProfile`` entries. + +.. code-block:: c + + typedef struct { + Elf_Word cgp_from; + Elf_Word cgp_to; + Elf_Xword cgp_weight; + } Elf_CGProfile; + +cgp_from + The symbol index of the source of the edge. + +cgp_to + The symbol index of the destination of the edge. + +cgp_weight + The weight of the edge. + +This is represented in assembly as: + +.. code-block:: gas + + .cg_profile from, to, 42 + +``.cg_profile`` directives are processed at the end of the file. It is an error +if either ``from`` or ``to`` are undefined temporary symbols. If either symbol +is a temporary symbol, then the section symbol is used instead. If either +symbol is undefined, then that symbol is defined as if ``.weak symbol`` has been +written at the end of the file. This forces the symbol to show up in the symbol +table. + Target Specific Behaviour ========================= |