You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: document/core/appendix/custom.rst
-80Lines changed: 0 additions & 80 deletions
Original file line number
Diff line number
Diff line change
@@ -239,63 +239,6 @@ It may only be placed on a declaration that declares exactly one local.
239
239
\end{array}
240
240
241
241
242
-
.. index:: ! branch hints section, hint
243
-
.. _binary-branchhintsec:
244
-
245
-
Branch Hint Section
246
-
~~~~~~~~~~~~~~~~~~~~
247
-
248
-
The *branch hint section* is a :ref:`custom section <binary-customsec>` whose name string is :math:`\text{metadata.code.branch\_hint}`.
249
-
The branch hints section should appear only once in a module, and only before the :ref:`code section <binary-codesec>`.
250
-
251
-
The purpose of this section is to aid the compilation of conditional branch instructions, by providing a hint that a branch is very likely (or unlikely) to be taken.
252
-
253
-
The section contains a vector of *function branch hints* each representing the branch hints for a single function.
254
-
255
-
Each *function branch hints* structure consists of
256
-
257
-
* the :ref:`function index <binary-funcidx>` of the function the hints are referring to,
258
-
* a vector of *branch hint* for the function.
259
-
260
-
Elements of the vector of *function branch hints* must appear in increasing function index order,
261
-
and a function index can appear at most once.
262
-
263
-
Each *branch hint* structure consists of
264
-
265
-
* the |U32| byte offset of the hinted instruction from the beginning of the function body,
266
-
* A |U32| with value '1',
267
-
* a |U32| indicating the meaning of the hint:
268
-
269
-
===== ===========================================
270
-
Value Meaning
271
-
===== ===========================================
272
-
0x00 branch likely not taken
273
-
0x01 branch likely taken
274
-
===== ===========================================
275
-
276
-
Elements of the vector of *branch hint* must appear in increasing byte offset order,
277
-
and a byte offset can appear at most once. A |BRIF| or |IF| instruction must be present
278
-
in the code section at the specified offset.
279
-
280
-
.. math::
281
-
\begin{array}{llcll}
282
-
\production{branch hint section} & \Bbranchhintsec &::=&
283
-
\Bsection_0(\Bbranchhintdata) \\
284
-
\production{branch hint data} & \Bbranchhintdata &::=&
285
-
n{:}\Bname & (\iff n = \text{metadata.code.branch\_hint}) \\ &&&
\production{branch hint kind} & \Bbranchhintkind &::=&
292
-
\hex{00} \\ &&|&
293
-
\hex{01} \\
294
-
\end{array}
295
-
.. index:: ! custom annotation, custom section
296
-
.. _text-customannot:
297
-
298
-
299
242
Custom Annotations
300
243
~~~~~~~~~~~~~~~~~~
301
244
@@ -394,26 +337,3 @@ Their relative placement will depend on the placement directive given for the :m
394
337
custom section "A"
395
338
custom section "D"
396
339
397
-
398
-
.. index:: ! branch hints annotation, hint
399
-
.. _text-branchhintannot:
400
-
401
-
Branch Hint Annotations
402
-
~~~~~~~~~~~~~~~~~~~~~~~
403
-
404
-
*Branch Hint annotations* are the textual analogue to the :ref:`branch hint section <binary-branchhintsec>` and provide a textual representation for it.
405
-
Consequently, their id is :math:`\T{@metadata.code.branch\_hint}`.
406
-
407
-
Branch hint annotations are allowed only on |BRIF| and |IF| instructions,
408
-
and at most one branch hint annotation may be given per instruction.
409
-
410
-
Branch hint annotations have the following format:
411
-
412
-
.. math::
413
-
\begin{array}{llclll}
414
-
\production{branch hint annotation} & \Tbranchhintannot &::=&
Copy file name to clipboardExpand all lines: document/metadata/code/binary.rst
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,8 @@
3
3
Binary Format
4
4
=============
5
5
6
+
.. _binary-codemetadata:
7
+
6
8
Code Metadata
7
9
-------------
8
10
@@ -30,6 +32,8 @@ Where *funcpos* is the byte offset of the annotation starting from the beginning
30
32
31
33
*code metadata function* entries must appear in order of increasing *function id*, and duplicate id values are not allowed. *code metadata item* entries must appear in order of increasing *instruction offset*, and duplicate offset values are not allowed.
0 commit comments