//===- bolt/Passes/InstrumentationSummary.h ---------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // InstrumentationSummary holds all the data generated during // the Instrumentation pass, which will be needed latter for runtime library // binary emit and linking. // //===----------------------------------------------------------------------===// #ifndef BOLT_PASSES_INSTRUMENTATION_SUMMARY_H #define BOLT_PASSES_INSTRUMENTATION_SUMMARY_H #include "llvm/ADT/DenseSet.h" #include <string> #include <vector> namespace llvm { class MCSymbol; namespace bolt { class BinaryFunction; // All structs here are part of the program metadata serialization format and // consist of POD types or array of POD types that are trivially mapped from // disk to memory. This provides the runtime library with a basic // understanding of the program structure, so it can build a CFG for each // function and deduce execution counts for edges that don't require explicit // counters. It also provides function names and offsets used when writing the // fdata file. // Location information -- analogous to the concept of the same name in fdata // writing/reading. The difference is that the name is stored as an index to a // string table written separately. struct LocDescription { … }; // Inter-function control flow transfer instrumentation struct CallDescription { … }; // Spans multiple counters during runtime - this is an indirect call site struct IndCallDescription { … }; // This is an indirect call target (any entry point from any function). This // is stored sorted in the binary for fast lookups during data writing. struct IndCallTargetDescription { … }; // Intra-function control flow transfer instrumentation struct EdgeDescription { … }; // Basic block frequency (CFG node) instrumentation - only used for spanning // tree leaf nodes. struct InstrumentedNode { … }; // Entry basic blocks for a function. We record their output addresses to // check frequency of this address (via node number) against all tracked calls // to this address and discover traffic coming from uninstrumented code. struct EntryNode { … }; // Base struct organizing all metadata pertaining to a single function struct FunctionDescription { … }; /// Holds the summary of the data generated by the Instrumentation Pass. /// These information will be needed for binary emit. struct InstrumentationSummary { … }; } // namespace bolt } // namespace llvm #endif