9#ifndef LLVM_IR_MODULESUMMARYINDEXYAML_H
10#define LLVM_IR_MODULESUMMARYINDEXYAML_H
20 io.enumCase(
value,
"Unknown", TypeTestResolution::Unknown);
21 io.enumCase(
value,
"Unsat", TypeTestResolution::Unsat);
22 io.enumCase(
value,
"ByteArray", TypeTestResolution::ByteArray);
23 io.enumCase(
value,
"Inline", TypeTestResolution::Inline);
24 io.enumCase(
value,
"Single", TypeTestResolution::Single);
25 io.enumCase(
value,
"AllOnes", TypeTestResolution::AllOnes);
31 io.mapOptional(
"Kind", res.
TheKind);
33 io.mapOptional(
"AlignLog2", res.
AlignLog2);
34 io.mapOptional(
"SizeM1", res.
SizeM1);
35 io.mapOptional(
"BitMask", res.
BitMask);
44 io.enumCase(
value,
"Indir", WholeProgramDevirtResolution::ByArg::Indir);
45 io.enumCase(
value,
"UniformRetVal",
46 WholeProgramDevirtResolution::ByArg::UniformRetVal);
47 io.enumCase(
value,
"UniqueRetVal",
48 WholeProgramDevirtResolution::ByArg::UniqueRetVal);
49 io.enumCase(
value,
"VirtualConstProp",
50 WholeProgramDevirtResolution::ByArg::VirtualConstProp);
56 io.mapOptional(
"Kind", res.
TheKind);
57 io.mapOptional(
"Info", res.
Info);
58 io.mapOptional(
"Byte", res.
Byte);
59 io.mapOptional(
"Bit", res.
Bit);
64struct CustomMappingTraits<
65 std::map<std::vector<uint64_t>, WholeProgramDevirtResolution::ByArg>> {
69 std::vector<uint64_t> Args;
70 std::pair<StringRef, StringRef>
P = {
"", Key};
71 while (!
P.second.empty()) {
72 P =
P.second.split(
',');
74 if (
P.first.getAsInteger(0, Arg)) {
75 io.setError(
"key not an integer");
80 io.mapRequired(Key.str().c_str(), V[Args]);
90 Key += llvm::utostr(Arg);
92 io.mapRequired(Key.c_str(),
P.second);
99 io.enumCase(
value,
"Indir", WholeProgramDevirtResolution::Indir);
100 io.enumCase(
value,
"SingleImpl", WholeProgramDevirtResolution::SingleImpl);
101 io.enumCase(
value,
"BranchFunnel",
102 WholeProgramDevirtResolution::BranchFunnel);
108 io.mapOptional(
"Kind", res.
TheKind);
110 io.mapOptional(
"ResByArg", res.
ResByArg);
115struct CustomMappingTraits<
std::map<uint64_t, WholeProgramDevirtResolution>> {
117 std::map<uint64_t, WholeProgramDevirtResolution> &V) {
119 if (Key.getAsInteger(0, KeyInt)) {
120 io.setError(
"key not an integer");
123 io.mapRequired(Key.str().c_str(), V[KeyInt]);
125 static void output(IO &io, std::map<uint64_t, WholeProgramDevirtResolution> &V) {
127 io.mapRequired(llvm::utostr(
P.first).c_str(),
P.second);
133 io.mapOptional(
"TTRes", summary.
TTRes);
134 io.mapOptional(
"WPDRes", summary.
WPDRes);
158 io.mapOptional(
"GUID",
id.GUID);
159 io.mapOptional(
"Offset",
id.
Offset);
165 io.mapOptional(
"VFunc",
id.VFunc);
166 io.mapOptional(
"Args",
id.Args);
181 io.mapOptional(
"Linkage", summary.
Linkage);
182 io.mapOptional(
"Visibility", summary.
Visibility);
184 io.mapOptional(
"Live", summary.
Live);
185 io.mapOptional(
"Local", summary.
IsLocal);
186 io.mapOptional(
"CanAutoHide", summary.
CanAutoHide);
187 io.mapOptional(
"ImportType", summary.
ImportType);
188 io.mapOptional(
"Refs", summary.
Refs);
189 io.mapOptional(
"TypeTests", summary.
TypeTests);
192 io.mapOptional(
"TypeTestAssumeConstVCalls",
194 io.mapOptional(
"TypeCheckedLoadConstVCalls",
210 std::vector<FunctionSummaryYaml> FSums;
211 io.mapRequired(Key.str().c_str(), FSums);
213 if (Key.getAsInteger(0, KeyInt)) {
214 io.setError(
"key not an integer");
217 if (!V.count(KeyInt))
218 V.emplace(KeyInt,
false);
219 auto &Elem = V.find(KeyInt)->second;
220 for (
auto &FSum : FSums) {
221 std::vector<ValueInfo> Refs;
222 for (
auto &RefGUID : FSum.Refs) {
223 if (!V.count(RefGUID))
224 V.emplace(RefGUID,
false);
225 Refs.push_back(
ValueInfo(
false, &*V.find(RefGUID)));
227 Elem.SummaryList.push_back(std::make_unique<FunctionSummary>(
231 FSum.NotEligibleToImport, FSum.Live, FSum.IsLocal,
236 std::move(FSum.TypeTestAssumeVCalls),
237 std::move(FSum.TypeCheckedLoadVCalls),
238 std::move(FSum.TypeTestAssumeConstVCalls),
239 std::move(FSum.TypeCheckedLoadConstVCalls),
246 std::vector<FunctionSummaryYaml> FSums;
247 for (
auto &Sum :
P.second.SummaryList) {
248 if (
auto *FSum = dyn_cast<FunctionSummary>(Sum.get())) {
249 std::vector<uint64_t> Refs;
250 for (
auto &VI : FSum->refs())
251 Refs.push_back(VI.getGUID());
253 FSum->flags().
Linkage, FSum->flags().Visibility,
254 static_cast<bool>(FSum->flags().NotEligibleToImport),
255 static_cast<bool>(FSum->flags().Live),
256 static_cast<bool>(FSum->flags().DSOLocal),
257 static_cast<bool>(FSum->flags().CanAutoHide),
258 FSum->flags().ImportType, Refs, FSum->type_tests(),
259 FSum->type_test_assume_vcalls(), FSum->type_checked_load_vcalls(),
260 FSum->type_test_assume_const_vcalls(),
261 FSum->type_checked_load_const_vcalls()});
265 io.mapRequired(llvm::utostr(
P.first).c_str(), FSums);
273 io.mapRequired(Key.str().c_str(), TId);
274 V.insert({GlobalValue::getGUID(Key), {std::string(Key), TId}});
277 for (
auto &TidIter : V)
278 io.mapRequired(TidIter.second.first.c_str(), TidIter.second.second);
284 io.mapOptional(
"GlobalValueMap", index.GlobalValueMap);
285 io.mapOptional(
"TypeIdMap", index.TypeIdMap);
286 io.mapOptional(
"WithGlobalValueDeadStripping",
287 index.WithGlobalValueDeadStripping);
289 if (io.outputting()) {
290 std::vector<std::string> CfiFunctionDefs(index.CfiFunctionDefs.begin(),
291 index.CfiFunctionDefs.end());
292 io.mapOptional(
"CfiFunctionDefs", CfiFunctionDefs);
293 std::vector<std::string> CfiFunctionDecls(index.CfiFunctionDecls.begin(),
294 index.CfiFunctionDecls.end());
295 io.mapOptional(
"CfiFunctionDecls", CfiFunctionDecls);
297 std::vector<std::string> CfiFunctionDefs;
298 io.mapOptional(
"CfiFunctionDefs", CfiFunctionDefs);
299 index.CfiFunctionDefs = {CfiFunctionDefs.begin(), CfiFunctionDefs.end()};
300 std::vector<std::string> CfiFunctionDecls;
301 io.mapOptional(
"CfiFunctionDecls", CfiFunctionDecls);
302 index.CfiFunctionDecls = {CfiFunctionDecls.begin(),
303 CfiFunctionDecls.end()};
Given that RA is a live value
ModuleSummaryIndex.h This file contains the declarations the classes that hold the module index and s...
#define LLVM_YAML_IS_SEQUENCE_VECTOR(type)
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Function summary information to aid decisions and implementation of importing.
VisibilityTypes
An enumeration for the kinds of visibility of global values.
LinkageTypes
An enumeration for the kinds of linkage for global values.
Class to hold module path string table and global value map, and encapsulate methods for operating on...
StringRef - Represent a constant reference to a string, i.e.
This is an optimization pass for GlobalISel generic memory operations.
std::multimap< GlobalValue::GUID, std::pair< std::string, TypeIdSummary > > TypeIdSummaryMapTy
Map of a type GUID to type id string and summary (multimap used in case of GUID conflicts).
std::map< GlobalValue::GUID, GlobalValueSummaryInfo > GlobalValueSummaryMapTy
Map from global value GUID to corresponding summary structures.
Implement std::hash so that hash_code can be used in STL containers.
A specification for a virtual function call with all constant integer arguments.
Flags specific to function summaries.
An "identifier" for a virtual function.
Group flags (Linkage, NotEligibleToImport, etc.) as a bitfield.
std::map< uint64_t, WholeProgramDevirtResolution > WPDRes
Mapping from byte offset to whole-program devirt resolution for that (typeid, byte offset) pair.
Kind
Specifies which kind of type check we should emit for this byte array.
unsigned SizeM1BitWidth
Range of size-1 expressed as a bit width.
enum llvm::TypeTestResolution::Kind TheKind
Struct that holds a reference to a particular GUID in a global value summary.
uint64_t Info
Additional information for the resolution:
enum llvm::WholeProgramDevirtResolution::ByArg::Kind TheKind
enum llvm::WholeProgramDevirtResolution::Kind TheKind
std::map< std::vector< uint64_t >, ByArg > ResByArg
Resolutions for calls with all constant integer arguments (excluding the first argument,...
std::string SingleImplName
static void output(IO &io, GlobalValueSummaryMapTy &V)
static void inputOne(IO &io, StringRef Key, GlobalValueSummaryMapTy &V)
static void output(IO &io, TypeIdSummaryMapTy &V)
static void inputOne(IO &io, StringRef Key, TypeIdSummaryMapTy &V)
static void inputOne(IO &io, StringRef Key, std::map< std::vector< uint64_t >, WholeProgramDevirtResolution::ByArg > &V)
static void output(IO &io, std::map< std::vector< uint64_t >, WholeProgramDevirtResolution::ByArg > &V)
static void inputOne(IO &io, StringRef Key, std::map< uint64_t, WholeProgramDevirtResolution > &V)
static void output(IO &io, std::map< uint64_t, WholeProgramDevirtResolution > &V)
std::vector< uint64_t > Refs
std::vector< FunctionSummary::ConstVCall > TypeTestAssumeConstVCalls
std::vector< FunctionSummary::VFuncId > TypeCheckedLoadVCalls
std::vector< FunctionSummary::ConstVCall > TypeCheckedLoadConstVCalls
std::vector< uint64_t > TypeTests
std::vector< FunctionSummary::VFuncId > TypeTestAssumeVCalls
static void mapping(IO &io, FunctionSummaryYaml &summary)
static void mapping(IO &io, FunctionSummary::ConstVCall &id)
static void mapping(IO &io, FunctionSummary::VFuncId &id)
static void mapping(IO &io, ModuleSummaryIndex &index)
static void mapping(IO &io, TypeIdSummary &summary)
static void mapping(IO &io, TypeTestResolution &res)
static void mapping(IO &io, WholeProgramDevirtResolution &res)
static void mapping(IO &io, WholeProgramDevirtResolution::ByArg &res)
static void enumeration(IO &io, TypeTestResolution::Kind &value)
static void enumeration(IO &io, WholeProgramDevirtResolution::ByArg::Kind &value)
static void enumeration(IO &io, WholeProgramDevirtResolution::Kind &value)