@@ -150,6 +150,13 @@ Header
150
150
Records the in-memory address of name section. Not used except for raw profile
151
151
reader error checking.
152
152
153
+ ``NumVTables ``
154
+ Records the number of instrumented vtable entries in the binary. Used for
155
+ `type profiling `_.
156
+
157
+ ``VNamesSize ``
158
+ Records the byte size in the virtual table names section. Used for `type profiling `_.
159
+
153
160
``ValueKindLast ``
154
161
Records the number of value kinds. Macro `VALUE_PROF_KIND `_ defines the value
155
162
kinds with a description of the kind.
@@ -323,6 +330,8 @@ for the design.
323
330
.. _`Modified Condition/Decision Coverage` : https://en.wikipedia.org/wiki/Modified_condition/decision_coverage
324
331
.. _`Bitmap RFC` : https://discourse.llvm.org/t/rfc-source-based-mc-dc-code-coverage/59244
325
332
333
+ .. _`function names` :
334
+
326
335
Names
327
336
^^^^^^
328
337
@@ -333,6 +342,37 @@ Function names serve as keys in the PGO data hash table when raw profiles are
333
342
converted into indexed profiles. They are also crucial for ``llvm-profdata `` to
334
343
show the profiles in a human-readable way.
335
344
345
+ Virtual Table Profile Data
346
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^
347
+
348
+ This section is used for `type profiling `_. Each entry corresponds to one virtual
349
+ table and is defined by the following C++ struct
350
+
351
+ .. code-block :: c++
352
+
353
+ struct VTableProfData {
354
+ // The start address of the vtable, collected at runtime.
355
+ uint64_t StartAddress;
356
+ // The byte size of the vtable. `StartAddress ` and `ByteSize ` specifies an address range to look up.
357
+ uint32_t ByteSize;
358
+ // The hash of vtable's (PGO) name
359
+ uint64_t MD5HashOfName;
360
+ };
361
+
362
+ At profile use time, the compiler looks up a profiled address in the sorted vtable
363
+ address ranges and maps the address to a specific vtable through hashed name.
364
+
365
+ Virtual Table Names
366
+ ^^^^^^^^^^^^^^^^^^^^
367
+
368
+ This section is similar to `function names `_ section above, except it contains the PGO
369
+ names of profiled virtual tables. It's a standalone section such that raw profile
370
+ readers could directly find each name set by accessing the corresponding profile
371
+ data section.
372
+
373
+ This section is stored in raw profiles such that `llvm-profdata ` could show the
374
+ profiles in a human-readable way.
375
+
336
376
Value Profile Data
337
377
^^^^^^^^^^^^^^^^^^^^
338
378
@@ -426,6 +466,8 @@ This section is right after profile header. It stores the serialized profile
426
466
summary. For context-sensitive IR-based instrumentation PGO, this section stores
427
467
an additional profile summary corresponding to the context-sensitive profiles.
428
468
469
+ .. _`function data` :
470
+
429
471
Function data
430
472
^^^^^^^^^^^^^^^^^^
431
473
This section stores functions and their profiling data as an on-disk hash table.
@@ -453,6 +495,16 @@ Temporal Profile Traces
453
495
The section is used to carry on temporal profile information from raw profiles.
454
496
See `temporal profiling `_ for the design.
455
497
498
+ Virtual Table Names
499
+ ^^^^^^^^^^^^^^^^^^^^
500
+ This section is used to store the names of vtables from raw profile in the indexed
501
+ profile.
502
+
503
+ Unlike function names which are stored as keys of `function data `_ hash table,
504
+ vtable names need to be stored in a standalone section in indexed profiles.
505
+ This way, `llvm-profdata ` could show the profiled vtable information in a
506
+ human-readable way.
507
+
456
508
Profile Data Usage
457
509
=======================================
458
510
@@ -476,3 +528,4 @@ based profile data. For supported usages, check out `llvm-profdata documentation
476
528
.. _`single-byte counters` : https://discourse.llvm.org/t/rfc-single-byte-counters-for-source-based-code-coverage/75685
477
529
.. _`binary profile correlation` : https://discourse.llvm.org/t/rfc-add-binary-profile-correlation-to-not-load-profile-metadata-sections-into-memory-at-runtime/74565
478
530
.. _`binary id` : https://lists.llvm.org/pipermail/llvm-dev/2021-June/151154.html
531
+ .. _`type profiling` : https://discourse.llvm.org/t/rfc-dynamic-type-profiling-and-optimizations-in-llvm/74600
0 commit comments