jon.recoil.org

Module Fdo_info

type info = private {
  1. dbg : Debuginfo.t;
  2. discriminator : int;
}

Fdo_info identifies instructions in low-level intermediate representation for the purpose of mapping execution counters directly back to them, instead of source locations.

Fdo_info is added to Linear by ocamlfdo tool, and then emitted by the compiler as a discriminator on .loc directive. By default, the compiler uses dbg field of Linear.instruction to emit .loc directives. There are a couple of obstacles to using dbg field for FDO directly: 1) Debuginfo.item does not have a field for discriminators. Adding it requires changes to the upstream part of the compiler, which is unmodified in oxcaml. 2) Many instructions do not have any associated Debuginfo, which is required to output .loc directives. To address it, ocamlfdo infers the missing ones, using the semantics of debug_line. The inferred information cannot be stored in dbg field, because dbg fields is also used for emitting frametable's debug info entries required for backtraces. FDO info should not affect backtraces.

type t = Fdo_info.info option
val none : Fdo_info.t
val is_none : Fdo_info.t -> bool
val create : dbg:Debuginfo.t -> discriminator:int -> Fdo_info.t
val equal_info : Fdo_info.info -> Fdo_info.info -> bool
val equal : Fdo_info.t -> Fdo_info.t -> bool