Lines Matching refs:mapping
14 LLVM's code coverage mapping format is used to provide code coverage
19 mapping works under the hood. A prior knowledge of how Clang's profile guided
24 We start by briefly describing LLVM's code coverage mapping format and the
26 the basics are down, more advanced features of the coverage mapping format
33 LLVM's code coverage mapping format is designed to be a self contained
35 It's described in this document as a **mapping** format because its goal is
40 The mapping data is used in two places in the code coverage process:
42 1. When clang compiles a source file with ``-fcoverage-mapping``, it
43 generates the mapping information that describes the mapping between the
48 2. It is also used by *llvm-cov* - the mapping information is extracted from an
54 The coverage mapping format aims to be a "universal format" that would be
56 provide the frontend the possibility of generating the minimal coverage mapping
58 instead of emitting mapping information for each statement in a function, the
60 regions of code, and emit the mapping information only for those regions.
66 coverage mapping format works.
68 The coverage mapping format operates on a per-function level as the
71 coverage mapping data that can map between the source code ranges and
77 The function's coverage mapping data contains an array of mapping regions.
78 A mapping region stores the `source code range`_ that is covered by this region,
79 the `file id <coverage file id_>`_, the `coverage mapping counter`_ and
81 There are several kinds of mapping regions:
83 * Code regions associate portions of source code and `coverage mapping
84 counters`_. They make up the majority of the mapping regions. They are used
102 `coverage mapping counters`_, as the frontend knows that they are never
116 used by the code coverage tool to find the mapping regions that are created
118 expanded file id. They don't associate with `coverage mapping counters`_,
130 with a `coverage mapping counter`_ to track how many times an individual
131 condition evaluated to 'true' and another `coverage mapping counter`_ to
168 mapping region. Both locations include the line and the column numbers.
177 It enables Clang to produce mapping information for the code
188 .. _coverage mapping counter:
189 .. _coverage mapping counters:
194 A coverage mapping counter can represent a reference to the profile
200 coverage mapping counters or other expressions.
218 Finally, a coverage mapping counter can also represent an execution count of
219 of zero. The zero counter is used to provide coverage mapping for
234 code and refer to two coverage mapping counters, one to track the number of
241 The coverage mapping data is stored in the LLVM IR using a global constant
247 .. _coverage mapping sample:
258 The coverage mapping variable generated by Clang has 2 fields:
260 * Coverage mapping header.
276 …In prior versions, the length of the affixed string that contains the encoded coverage mapping data
277 i32 3, ; Coverage mapping format version
303 unit) reduces size bloat in the coverage mapping data. As part of this
304 change, region mapping information for a function is now included within the
318 i32 9, ; Function's encoded coverage mapping data string length
328 i32 9, ; Function's encoded coverage mapping data string length
334 As shown above, the coverage mapping header has the following fields:
340 …rd field of *__llvm_coverage_mapping* that contains any encoded coverage mapping data affixed to t…
355 It contains the function name's MD5, the length of the encoded mapping data for
357 in the function's translation unit, and the encoded mapping data.
363 IR for the `coverage mapping sample`_ that was shown earlier:
366 coverage mapping data for the sample translation unit:
381 * The coverage mapping from the first function record is encoded in this string:
390 …of file ids used by this function. There is only one file id used by the mapping data in this func…
396 …| ``0x01`` | The number of mapping regions that are stored in an array for the function's file id …
398 …| ``0x01`` | The coverage mapping counter for the first region in this function. The value of 1 te…
399 …| | mapping counter that is a reference to the profile instrumentation counter with an in…
401 …| ``0x01`` | The starting line of the first mapping region in this function. …
403 …| ``0x0C`` | The starting column of the first mapping region in this function. …
405 …| ``0x02`` | The ending line of the first mapping region in this function. …
407 …| ``0x02`` | The ending column of the first mapping region in this function. …
410 * The length of the substring that contains the encoded coverage mapping data
411 for the second function record is also 9. It's structured like the mapping data
414 * The two trailing bytes are zeroes and are used to pad the coverage mapping
420 The per-function coverage mapping data is encoded as a stream of bytes,
428 ``[file id mapping, counter expressions, mapping regions]``
431 `types <cvmtypes_>`_ as the per-function coverage mapping data, with the
463 .. _file id mapping:
470 File id mapping in a function's coverage mapping stream
478 A `coverage mapping counter`_ is stored in a single `LEB value <LEB128_>`_.
531 The mapping regions are stored in an array of sub-arrays where every
543 The mapping regions for a specific file id are stored in an array that is
551 The mapping region record contains two sub-records ---
577 A mapping region whose header has a counter with a non-zero tag is
590 * bit 2: expansionRegionTag. If this bit is set, then this mapping region
599 * 0 - This mapping region is a code region with a counter of zero.
600 * 2 - This mapping region is a skipped region.
601 * 4 - This mapping region is a branch region.
613 current mapping region and the starting line of the previous mapping region.
615 If the current mapping region is the first region in the current
618 * *columnStart*: The starting column of the mapping region.
621 of the current mapping region.
623 * *columnEnd*: The ending column of the mapping region. If the high bit is set,
624 the current mapping region is a gap area. A count for a gap area is only used