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) {
156 std::unique_ptr<MemoryBuffer> Buffer = std::move(*BufferOrError);
164 Buffer->getBufferIdentifier().str().c_str());
167 auto FuncMap = buildFunctionMap();
170 return processYAMLFunctions(FuncsYAML, FuncMap);
180 for (
auto &Func : Funcs) {
181 FuncMap.
try_emplace(GCreator.getString(Func.Name), &Func);
182 if (
auto &MFuncs = Func.MergedFunctions)
183 for (
auto &MFunc : MFuncs->MergedFunctions)
184 FuncMap.
try_emplace(GCreator.getString(MFunc.Name), &MFunc);
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") {
217 CSI.
Flags |=
static_cast<uint8_t
>(CallSiteInfo::InternalCall);
218 }
else if (FlagStr ==
"ExternalCall") {
219 CSI.
Flags |=
static_cast<uint8_t
>(CallSiteInfo::ExternalCall);
222 "Unknown flag in callsite YAML: %s\n",
226 FuncInfo->
CallSites->CallSites.push_back(CSI);
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
Utility for declaring that a std::vector of a particular type should be considered a YAML sequence.
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.
LLVM_ABI llvm::Error loadYAML(StringRef YAMLFile)
This method reads the specified YAML file, parses its content, and updates the Funcs vector with call...
CallSiteInfoLoader(GsymCreator &GCreator, std::vector< FunctionInfo > &Funcs)
Constructor that initializes the CallSiteInfoLoader with necessary data structures.
A simplified binary data writer class that doesn't require targets, target definitions,...
This class implements an extremely fast bulk output stream that can only output to a stream.
void mapOptional(const char *Key, T &Val)
void mapRequired(const char *Key, T &Val)
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.
FunctionAddr VTableAddr uintptr_t uintptr_t Data
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.
LLVM_ABI llvm::Error encode(FileWriter &O) const
Encode this CallSiteInfo object into a FileWriter 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)
This class should be specialized by any type that needs to be converted to/from a YAML mapping.