41 "0x%8.8" PRIx64
": missing ReturnOffset",
Offset);
47 "0x%8.8" PRIx64
": missing Flags",
Offset);
53 "0x%8.8" PRIx64
": missing MatchRegex count",
58 for (
uint32_t i = 0; i < NumEntries; ++i) {
61 "0x%8.8" PRIx64
": missing MatchRegex entry",
73 if (
Error Err = CSI.encode(O))
87 "0x%8.8" PRIx64
": missing CallSiteInfo count",
92 for (
uint32_t i = 0; i < NumCallSites; ++i) {
126 io.mapRequired(
"match_regex", callsite.
match_regex);
127 io.mapOptional(
"flags", callsite.
flags);
133 io.mapRequired(
"name",
func.name);
134 io.mapOptional(
"callsites",
func.callsites);
140 io.mapRequired(
"functions", FuncYAMLs.
functions);
156 std::unique_ptr<MemoryBuffer> Buffer = std::move(*BufferOrError);
160 yaml::Input Yin(Buffer->getMemBufferRef());
164 Buffer->getBufferIdentifier().str().c_str());
167 auto FuncMap = buildFunctionMap();
170 return processYAMLFunctions(FuncsYAML, FuncMap);
180 for (
auto &Func : Funcs) {
182 if (
auto &MFuncs = Func.MergedFunctions)
183 for (
auto &MFunc : MFuncs->MergedFunctions)
189Error CallSiteInfoLoader::processYAMLFunctions(
192 for (
const auto &FuncYAML : FuncYAMLs.
functions) {
193 auto It = FuncMap.
find(FuncYAML.name);
194 if (It == FuncMap.
end())
196 std::errc::invalid_argument,
197 "Can't find function '%s' specified in callsite YAML\n",
198 FuncYAML.name.c_str());
204 for (
const auto &CallSiteYAML : FuncYAML.callsites) {
209 for (
const auto &
Regex : CallSiteYAML.match_regex) {
215 for (
const auto &FlagStr : CallSiteYAML.flags) {
216 if (FlagStr ==
"InternalCall") {
218 }
else if (FlagStr ==
"ExternalCall") {
222 "Unknown flag in callsite YAML: %s\n",
226 FuncInfo->
CallSites->CallSites.push_back(CSI);
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,...
LLVM_ABI uint32_t insertString(StringRef S, bool Copy=true)
Insert a string into the GSYM string table.
LLVM_ABI 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.
LLVM_ABI raw_ostream & operator<<(raw_ostream &OS, const CallSiteInfo &CSI)
This is an optimization pass for GlobalISel generic memory operations.
InterleavedRange< Range > interleaved(const Range &R, StringRef Separator=", ", StringRef Prefix="", StringRef Suffix="")
Output range R as a sequence of interleaved elements.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
LLVM_ABI Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
LLVM_ABI llvm::Error encode(FileWriter &O) const
Encode this CallSiteInfoCollection object into a FileWriter stream.
std::vector< CallSiteInfo > CallSites
static LLVM_ABI 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_ABI 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)