@@ -405,31 +405,72 @@ This section is emitted with ``-basic-block-address-map`` and will contain
405
405
a BB address map table for every function.
406
406
407
407
The ``SHT_LLVM_BB_ADDR_MAP `` type provides backward compatibility to allow
408
- reading older versions of the BB address map generated by older compilers. Each
409
- function entry starts with a version byte which specifies the encoding version
410
- to use. The following versioning schemes are currently supported.
408
+ reading older versions of the BB address map generated by older compilers (up to
409
+ two years old). Each function entry starts with a version byte which specifies
410
+ the encoding version to use. This follows by a feature byte which specifies the
411
+ features specific to this particular entry. The function base address is stored
412
+ as a full address. Other addresses in the entry (block begin and end addresses
413
+ and callsite addresses) are stored in a running-offset fashion, as offset
414
+ relative to the prior address.
411
415
412
- Version 1 (newest): basic block address offsets are computed relative to the end
413
- of previous blocks.
416
+ The following versioning schemes are currently supported (newer versions support
417
+ features of the older versions).
418
+
419
+ Version 3 (newest): Capable of encoding callsite offsets. Enabled by the 6th bit
420
+ of the feature byte.
414
421
415
422
Example:
416
423
417
424
.. code-block :: gas
418
425
419
426
.section ".llvm_bb_addr_map","",@llvm_bb_addr_map
420
- .byte 1 # version number
421
- .byte 0 # feature byte (reserved for future use)
427
+ .byte 3 # version number
428
+ .byte 32 # feature byte
422
429
.quad .Lfunc_begin0 # address of the function
423
430
.byte 2 # number of basic blocks
424
431
# BB record for BB_0
425
- .uleb128 .Lfunc_beign0-.Lfunc_begin0 # BB_0 offset relative to function entry (always zero)
432
+ .byte 0 # BB_0 ID
433
+ .uleb128 .Lfunc_begin0-.Lfunc_begin0 # BB_0 offset relative to function entry (always zero)
434
+ .byte 0 # number of callsites in this block
426
435
.uleb128 .LBB_END0_0-.Lfunc_begin0 # BB_0 size
427
436
.byte x # BB_0 metadata
428
437
# BB record for BB_1
438
+ .byte 1 # BB_1 ID
429
439
.uleb128 .LBB0_1-.LBB_END0_0 # BB_1 offset relative to the end of last block (BB_0).
430
- .uleb128 .LBB_END0_1-.LBB0_1 # BB_1 size
440
+ .byte 2 # number of callsites in this block
441
+ .uleb128 .LBB0_1_CS0-.LBB0_1 # offset of callsite relative to the previous offset (.LBB0_1)
442
+ .uleb128 .LBB0_1_CS1-.LBB0_1_CS0 # offset of callsite relative to the previous offset (.LBB0_1_CS0)
443
+ .uleb128 .LBB_END0_1-.LBB0_1_CS1 # BB_1 size offset (Offset of the block end relative to the previous offset).
431
444
.byte y # BB_1 metadata
432
445
446
+ Version 2: Capable of encoding split functions. Enabled by the 4th bit of the
447
+ feature byte. The base address of each split range is stored as a full address.
448
+ The first range corresponds to the function entry.
449
+
450
+ Example:
451
+
452
+ .. code-block :: gas
453
+ .section ".llvm_bb_addr_map","",@llvm_bb_addr_map
454
+ .byte 2 # version number
455
+ .byte 8 # feature byte
456
+ .byte 2 # number of basic block ranges
457
+ # 1st BB range (corresponding to the function entry)
458
+ .quad .Lfunc_begin0 # base address
459
+ .byte 1 # number of basic blocks in this range
460
+ # BB record for BB_0
461
+ .byte 0 # BB_0 ID
462
+ .uleb128 .Lfunc_begin0-.Lfunc_begin0 # BB_0 offset relative to function entry (always zero)
463
+ .uleb128 .LBB_END0_0-.Lfunc_begin0 # BB_0 size
464
+ .byte x # BB_0 metadata
465
+ # 2nd BB range
466
+ .quad func.part.1
467
+ .byte 1 # number of basic blocks in this range
468
+ # BB record for BB_1
469
+ .byte 1 # BB_1 ID
470
+ .uleb128 func.part.1-func.part.1 # BB_1 offset relative to the range begin (always zero)
471
+ .uleb128 .LBB_END0_1-func.part.1 # BB_1 size
472
+ .byte 1 # BB_1 metadata
473
+
433
474
PGO Analysis Map
434
475
""""""""""""""""
435
476
0 commit comments