21#include <unordered_map>
43 "0x%8.8" PRIx64
": missing ReturnOffset",
Offset);
49 "0x%8.8" PRIx64
": missing Flags",
Offset);
55 "0x%8.8" PRIx64
": missing MatchRegex count",
60 for (
uint32_t i = 0; i < NumEntries; ++i) {
63 "0x%8.8" PRIx64
": missing MatchRegex entry",
75 if (
Error Err = CSI.encode(O))
89 "0x%8.8" PRIx64
": missing CallSiteInfo count",
94 for (
uint32_t i = 0; i < NumCallSites; ++i) {
128 io.mapRequired(
"match_regex", callsite.
match_regex);
129 io.mapOptional(
"flags", callsite.
flags);
135 io.mapRequired(
"name",
func.name);
136 io.mapOptional(
"callsites",
func.callsites);
142 io.mapRequired(
"functions", FuncYAMLs.
functions);
158 std::unique_ptr<MemoryBuffer> Buffer = std::move(*BufferOrError);
162 yaml::Input Yin(Buffer->getMemBufferRef());
166 Buffer->getBufferIdentifier().str().c_str());
169 auto FuncMap = buildFunctionMap();
172 return processYAMLFunctions(FuncsYAML, FuncMap);
182 for (
auto &Func : Funcs) {
184 if (
auto &MFuncs = Func.MergedFunctions)
185 for (
auto &MFunc : MFuncs->MergedFunctions)
191Error CallSiteInfoLoader::processYAMLFunctions(
194 for (
const auto &FuncYAML : FuncYAMLs.
functions) {
195 auto It = FuncMap.
find(FuncYAML.name);
196 if (It == FuncMap.
end())
198 std::errc::invalid_argument,
199 "Can't find function '%s' specified in callsite YAML\n",
200 FuncYAML.name.c_str());
206 for (
const auto &CallSiteYAML : FuncYAML.callsites) {
211 for (
const auto &
Regex : CallSiteYAML.match_regex) {
217 for (
const auto &FlagStr : CallSiteYAML.flags) {
218 if (FlagStr ==
"InternalCall") {
220 }
else if (FlagStr ==
"ExternalCall") {
224 "Unknown flag in callsite YAML: %s\n",
228 FuncInfo->
CallSites->CallSites.push_back(CSI);
This file defines CachedHashString and CachedHashStringRef.
static Error loadYAML(sys::fs::file_t Fd, size_t FileSize, StringRef Filename, InstrumentationMap::SledContainer &Sleds, InstrumentationMap::FunctionAddressMap &FunctionAddresses, InstrumentationMap::FunctionAddressReverseMap &FunctionIds)
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Error takeError()
Take ownership of the stored error.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFile(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, bool IsVolatile=false, std::optional< Align > Alignment=std::nullopt)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful,...
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
iterator find(StringRef Key)
std::pair< iterator, bool > try_emplace(StringRef Key, ArgsTy &&...Args)
Emplace a new element for the specified key into the map if the key isn't already in the map.
StringRef - Represent a constant reference to a string, i.e.
A simplified binary data writer class that doesn't require targets, target definitions,...
uint32_t insertString(StringRef S, bool Copy=true)
Insert a string into the GSYM string table.
StringRef getString(uint32_t Offset)
Retrieve a string from the GSYM string table given its offset.
This class implements an extremely fast bulk output stream that can only output to a stream.
raw_ostream & operator<<(raw_ostream &OS, const CallSiteInfo &CSI)
This is an optimization pass for GlobalISel generic memory operations.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
llvm::Error encode(FileWriter &O) const
Encode this CallSiteInfoCollection object into a FileWriter stream.
std::vector< CallSiteInfo > CallSites
static llvm::Expected< CallSiteInfoCollection > decode(DataExtractor &Data)
Decode a CallSiteInfoCollection object from a binary data stream.
std::vector< uint32_t > MatchRegex
Offsets into the string table for function names regex patterns.
uint64_t ReturnOffset
The return offset of the call site - relative to the function start.
static llvm::Expected< CallSiteInfo > decode(DataExtractor &Data, uint64_t &Offset)
Decode a CallSiteInfo object from a binary data stream.
Function information in GSYM files encodes information for one contiguous address range.
std::optional< CallSiteInfoCollection > CallSites
std::vector< std::string > flags
std::vector< std::string > match_regex
std::vector< CallSiteYAML > callsites
std::vector< FunctionYAML > functions
static void mapping(IO &io, CallSiteYAML &callsite)
static void mapping(IO &io, FunctionYAML &func)
static void mapping(IO &io, FunctionsYAML &FuncYAMLs)