Lines Matching refs:mapping

14 LLVM's code coverage mapping format is used to provide code coverage
18 This document is aimed at those who use LLVM's code coverage mapping to provide
24 then we briefly desribe LLVM's code coverage mapping format and the
26 the basics are down, more advanced features of the coverage mapping format
37 ``-fprofile-instr-generate`` option with the additional ``-fcoverage-mapping``
40 ``clang -o test -fprofile-instr-generate -fcoverage-mapping test.c``
56 LLVM's code coverage mapping format is designed to be a self contained
58 It's described in this document as a **mapping** format because its goal is
63 The mapping data is used in two places in the code coverage process:
65 1. When clang compiles a source file with ``-fcoverage-mapping``, it
66 generates the mapping information that describes the mapping between the
71 2. It is also used by *llvm-cov* - the mapping information is extracted from an
77 The coverage mapping format aims to be a "universal format" that would be
79 provide the frontend the possibility of generating the minimal coverage mapping
81 instead of emitting mapping information for each statement in a function, the
83 regions of code, and emit the mapping information only for those regions.
89 coverage mapping format works.
91 The coverage mapping format operates on a per-function level as the
94 coverage mapping data that can map between the source code ranges and
100 The function's coverage mapping data contains an array of mapping regions.
101 A mapping region stores the `source code range`_ that is covered by this region,
102 the `file id <coverage file id_>`_, the `coverage mapping counter`_ and
104 There are several kinds of mapping regions:
106 * Code regions associate portions of source code and `coverage mapping
107 counters`_. They make up the majority of the mapping regions. They are used
125 `coverage mapping counters`_, as the frontend knows that they are never
139 used by the code coverage tool to find the mapping regions that are created
141 expanded file id. They don't associate with `coverage mapping counters`_,
159 mapping region. Both locations include the line and the column numbers.
168 It enables Clang to produce mapping information for the code
179 .. _coverage mapping counter:
180 .. _coverage mapping counters:
185 A coverage mapping counter can represents a reference to the profile
191 coverage mapping counters or other expressions.
209 Finally, a coverage mapping counter can also represent an execution count of
210 of zero. The zero counter is used to provide coverage mapping for
227 The coverage mapping data is stored in the LLVM IR using a single global
233 .. _coverage mapping sample:
244 The coverage mapping variable generated by Clang is:
251 i32 20, ; The length of the string that contains the encoded coverage mapping data
252 i32 0, ; Coverage mapping format version
256 i32 9 ; Function's encoded coverage mapping data string length
260 i32 9 ; Function's encoded coverage mapping data string length
268 The coverage mapping version number can have the following values:
270 * 0 — The first (current) version of the coverage mapping format.
284 and the length of the encoded mapping data for that function.
291 mapping data for each function in this translation unit.
304 IR for the `coverage mapping sample`_ that was shown earlier:
307 coverage mapping data for the sample translation unit:
331 * The length of the substring that contains the encoded coverage mapping data
335 Therefore, the coverage mapping for the first function record is encoded
345 …of file ids used by this function. There is only one file id used by the mapping data in this func…
351 …| ``0x01`` | The number of mapping regions that are stored in an array for the function's file id …
353 …| ``0x01`` | The coverage mapping counter for the first region in this function. The value of 1 te…
354 …| | mapping counter that is a reference ot the profile instrumentation counter with an in…
356 …| ``0x01`` | The starting line of the first mapping region in this function. …
358 …| ``0x0C`` | The starting column of the first mapping region in this function. …
360 …| ``0x02`` | The ending line of the first mapping region in this function. …
362 …| ``0x02`` | The ending column of the first mapping region in this function. …
365 * The length of the substring that contains the encoded coverage mapping data
366 for the second function record is also 9. It's structured like the mapping data
369 * The two trailing bytes are zeroes and are used to pad the coverage mapping
375 The per-function coverage mapping data is encoded as a stream of bytes,
383 ``[file id mapping, counter expressions, mapping regions]``
386 `types <cvmtypes_>`_ as the per-function coverage mapping data, with the
418 .. _file id mapping:
425 File id mapping in a function's coverage mapping stream
433 A `coverage mapping counter`_ is stored in a single `LEB value <LEB128_>`_.
486 The mapping regions are stored in an array of sub-arrays where every
498 The mapping regions for a specific file id are stored in an array that is
506 The mapping region record contains two sub-records ---
531 A mapping region whose header has a counter with a non-zero tag is
544 * bit 2: expansionRegionTag. If this bit is set, then this mapping region
553 * 0 - This mapping region is a code region with a counter of zero.
554 * 2 - This mapping region is a skipped region.
566 current mapping region and the starting line of the previous mapping region.
568 If the current mapping region is the first region in the current
571 * *columnStart*: The starting column of the mapping region.
574 of the current mapping region.
576 * *columnEnd*: The ending column of the mapping region.