//===- InstrumentationMap.h - XRay Instrumentation Map ----------*- 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 // //===----------------------------------------------------------------------===// // // Defines the interface for extracting the instrumentation map from an // XRay-instrumented binary. // //===----------------------------------------------------------------------===// #ifndef LLVM_XRAY_INSTRUMENTATIONMAP_H #define LLVM_XRAY_INSTRUMENTATIONMAP_H #include "llvm/ADT/StringRef.h" #include "llvm/Support/Error.h" #include "llvm/Support/YAMLTraits.h" #include <cstdint> #include <optional> #include <unordered_map> #include <vector> namespace llvm { namespace xray { // Forward declare to make a friend. class InstrumentationMap; /// Loads the instrumentation map from |Filename|. This auto-deduces the type of /// the instrumentation map. Expected<InstrumentationMap> loadInstrumentationMap(StringRef Filename); /// Represents an XRay instrumentation sled entry from an object file. struct SledEntry { … }; struct YAMLXRaySledEntry { … }; /// The InstrumentationMap represents the computed function id's and indicated /// function addresses from an object file (or a YAML file). This provides an /// interface to just the mapping between the function id, and the function /// address. /// /// We also provide raw access to the actual instrumentation map entries we find /// associated with a particular object file. /// class InstrumentationMap { … }; } // end namespace xray namespace yaml { template <> struct ScalarEnumerationTraits<xray::SledEntry::FunctionKinds> { … }; template <> struct MappingTraits<xray::YAMLXRaySledEntry> { … }; } // end namespace yaml } // end namespace llvm LLVM_YAML_IS_SEQUENCE_VECTOR(xray::YAMLXRaySledEntry) #endif // LLVM_XRAY_INSTRUMENTATIONMAP_H