14#ifndef LLVM_XRAY_INSTRUMENTATIONMAP_H
15#define LLVM_XRAY_INSTRUMENTATIONMAP_H
23#include <unordered_map>
31class InstrumentationMap;
109template <>
struct ScalarEnumerationTraits<xray::SledEntry::FunctionKinds> {
111 IO.enumCase(Kind,
"function-enter", xray::SledEntry::FunctionKinds::ENTRY);
112 IO.enumCase(Kind,
"function-exit", xray::SledEntry::FunctionKinds::EXIT);
113 IO.enumCase(Kind,
"tail-exit", xray::SledEntry::FunctionKinds::TAIL);
114 IO.enumCase(Kind,
"log-args-enter",
115 xray::SledEntry::FunctionKinds::LOG_ARGS_ENTER);
116 IO.enumCase(Kind,
"custom-event",
117 xray::SledEntry::FunctionKinds::CUSTOM_EVENT);
123 IO.mapRequired(
"id", Entry.FuncId);
124 IO.mapRequired(
"address", Entry.Address);
125 IO.mapRequired(
"function", Entry.Function);
126 IO.mapRequired(
"kind", Entry.Kind);
127 IO.mapRequired(
"always-instrument", Entry.AlwaysInstrument);
128 IO.mapOptional(
"function-name", Entry.FunctionName);
129 IO.mapOptional(
"version", Entry.Version, 0);
132 static constexpr bool flow =
true;
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
Tagged union holding either a T or a Error.
StringRef - Represent a constant reference to a string, i.e.
The InstrumentationMap represents the computed function id's and indicated function addresses from an...
std::unordered_map< int32_t, uint64_t > FunctionAddressMap
std::unordered_map< uint64_t, int32_t > FunctionAddressReverseMap
const SledContainer & sleds() const
Provide read-only access to the entries of the instrumentation map.
LLVM_ABI friend Expected< InstrumentationMap > loadInstrumentationMap(StringRef)
Loads the instrumentation map from |Filename|.
std::vector< SledEntry > SledContainer
LLVM_ABI std::optional< int32_t > getFunctionId(uint64_t Addr) const
Returns an XRay computed function id, provided a function address.
const FunctionAddressMap & getFunctionAddresses()
Provides a raw accessor to the unordered map of function addresses.
LLVM_ABI std::optional< uint64_t > getFunctionAddr(int32_t FuncId) const
Returns the function address for a function id.
LLVM_ABI Expected< InstrumentationMap > loadInstrumentationMap(StringRef Filename)
Loads the instrumentation map from |Filename|.
This is an optimization pass for GlobalISel generic memory operations.
Represents an XRay instrumentation sled entry from an object file.
uint64_t Address
The address of the sled.
uint64_t Function
The address of the function.
FunctionKinds
Each entry here represents the kinds of supported instrumentation map entries.
bool AlwaysInstrument
Whether the sled was annotated to always be instrumented.
FunctionKinds Kind
The kind of sled.
SledEntry::FunctionKinds Kind
static void mapping(IO &IO, xray::YAMLXRaySledEntry &Entry)
static void enumeration(IO &IO, xray::SledEntry::FunctionKinds &Kind)