1#ifndef LLVM_PROFILEDATA_MEMPROFYAML_H_
2#define LLVM_PROFILEDATA_MEMPROFYAML_H_
29template <>
struct ScalarTraits<memprof::GUIDHex64> {
36 if (
all_of(Scalar, [](
char C) {
return std::isdigit(
C); }))
37 return "use a hexadecimal GUID or a function instead";
40 if (Scalar.starts_with_insensitive(
"0x")) {
42 if (Scalar.getAsInteger(0, Num))
43 return "invalid hex64 number";
47 Val = memprof::IndexedMemProfRecord::getGUID(Scalar);
60 class FrameWithHex64 {
65 IsInlineFrame(
F.IsInlineFrame) {}
71 static_assert(std::is_same_v<
decltype(
Function.value),
72 decltype(memprof::Frame::Function)>);
73 decltype(memprof::Frame::LineOffset) LineOffset = 0;
74 decltype(memprof::Frame::Column) Column = 0;
75 decltype(memprof::Frame::IsInlineFrame) IsInlineFrame =
false;
79 MappingNormalization<FrameWithHex64, memprof::Frame> Keys(Io,
F);
81 Io.mapRequired(
"Function", Keys->Function);
82 Io.mapRequired(
"LineOffset", Keys->LineOffset);
83 Io.mapRequired(
"Column", Keys->Column);
84 Io.mapRequired(
"IsInlineFrame", Keys->IsInlineFrame);
89 const auto &[
Function, SymbolName, LineOffset, Column, IsInlineFrame] =
F;
93 std::unique_ptr<std::string>>);
111 static const bool flow =
true;
123#define MIBEntryDef(NameTag, Name, Type) \
124 if (KeyStr == #Name) { \
126 Io.mapRequired(KeyStr.str().c_str(), Value); \
127 MIB.Name = static_cast<Type>(Value); \
128 MIB.Schema.set(llvm::to_underlying(memprof::Meta::Name)); \
133 Io.setError(
"Key is not a valid validation event");
138#define MIBEntryDef(NameTag, Name, Type) \
139 if (Schema.test(llvm::to_underlying(memprof::Meta::Name))) { \
140 uint64_t Value = MIB.Name; \
141 Io.mapRequired(#Name, Value); \
150 Io.mapRequired(
"Callstack", AI.
CallStack);
151 Io.mapRequired(
"MemInfoBlock", AI.
Info);
160 Io.mapRequired(
"GUID", Pair.
GUID);
168 Io.mapRequired(
"HeapProfileRecords",
Data.HeapProfileRecords);
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
#define LLVM_YAML_STRONG_TYPEDEF(_base, _type)
StringRef - Represent a constant reference to a string, i.e.
This class implements an extremely fast bulk output stream that can only output to a stream.
FrameWithHex64(IO &, const memprof::Frame &F)
memprof::Frame denormalize(IO &)
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
format_object< Ts... > format(const char *Fmt, const Ts &... Vals)
These are helper functions used to produce formatted output.
std::vector< GUIDMemProfRecordPair > HeapProfileRecords
std::vector< Frame > CallStack
PortableMemInfoBlock Info
llvm::SmallVector< std::vector< Frame > > CallSites
llvm::SmallVector< AllocationInfo > AllocSites
std::bitset< llvm::to_underlying(Meta::Size)> getSchema() const
static void inputOne(IO &Io, StringRef KeyStr, memprof::PortableMemInfoBlock &MIB)
static void output(IO &Io, memprof::PortableMemInfoBlock &MIB)
static void mapping(IO &Io, memprof::AllMemProfData &Data)
static void mapping(IO &Io, memprof::AllocationInfo &AI)
static void mapping(IO &Io, memprof::Frame &F)
static void mapping(IO &Io, memprof::GUIDMemProfRecordPair &Pair)
static QuotingType mustQuote(StringRef)
static StringRef input(StringRef Scalar, void *, memprof::GUIDHex64 &Val)
static void output(const memprof::GUIDHex64 &Val, void *, raw_ostream &Out)