LLVM: lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
13
14using namespace llvm;
16
22
28
33
39
42 if (N < LF_NUMERIC)
43 return 2;
44
46
47 constexpr uint32_t Sizes[] = {
48 1,
49 2,
50 2,
51 4,
52 4,
53 4,
54 8,
55 10,
56 16,
57 8,
58 8,
59 };
60
61 return 2 + Sizes[N - LF_NUMERIC];
62}
63
65 const char *S = reinterpret_cast<const char *>(Data.data());
66 return strlen(S) + 1;
67}
68
72
73 while (!Content.empty()) {
74
75
76
77
78
79
80
81
82
84
87
89 Len += 4;
92 }
93}
94
104
114
126
136
139
140
141
142
143
144
147
151
153}
154
164
174
176 bool IsIndirect,
178
179
180
181
182
183
189}
190
193
194
195
197 return 8;
198}
199
202
203
204
206 return 8;
207}
208
213 while (!Content.empty()) {
216 switch (Kind) {
217 case LF_BCLASS:
219 break;
220 case LF_ENUMERATE:
222 break;
223 case LF_MEMBER:
225 break;
226 case LF_METHOD:
228 break;
229 case LF_ONEMETHOD:
231 break;
232 case LF_NESTTYPE:
234 break;
235 case LF_STMEMBER:
237 break;
238 case LF_VBCLASS:
239 case LF_IVBCLASS:
240 ThisLen =
242 break;
243 case LF_VFUNCTAB:
245 break;
246 case LF_INDEX:
248 break;
249 default:
250 return;
251 }
252 Content = Content.drop_front(ThisLen);
254 if (!Content.empty()) {
256 if (Pad >= LF_PAD0) {
260 }
261 }
262 }
263}
264
273
277
278
279
280 switch (Kind) {
281 case TypeLeafKind::LF_FUNC_ID:
284 break;
285 case TypeLeafKind::LF_MFUNC_ID:
287 break;
288 case TypeLeafKind::LF_STRING_ID:
290 break;
291 case TypeLeafKind::LF_SUBSTR_LIST:
295 break;
296 case TypeLeafKind::LF_BUILDINFO:
300 break;
301 case TypeLeafKind::LF_UDT_SRC_LINE:
304 break;
305 case TypeLeafKind::LF_UDT_MOD_SRC_LINE:
307 break;
308 case TypeLeafKind::LF_MODIFIER:
310 break;
311 case TypeLeafKind::LF_PROCEDURE:
314 break;
315 case TypeLeafKind::LF_MFUNCTION:
318 break;
319 case TypeLeafKind::LF_ARGLIST:
323 break;
324 case TypeLeafKind::LF_ARRAY:
326 break;
327 case TypeLeafKind::LF_CLASS:
328 case TypeLeafKind::LF_STRUCTURE:
329 case TypeLeafKind::LF_INTERFACE:
331 break;
332 case TypeLeafKind::LF_UNION:
334 break;
335 case TypeLeafKind::LF_ENUM:
337 break;
338 case TypeLeafKind::LF_BITFIELD:
340 break;
341 case TypeLeafKind::LF_VFTABLE:
343 break;
344 case TypeLeafKind::LF_VTSHAPE:
345 break;
346 case TypeLeafKind::LF_METHODLIST:
348 break;
349 case TypeLeafKind::LF_FIELDLIST:
351 break;
352 case TypeLeafKind::LF_POINTER:
354 break;
355 default:
356 break;
357 }
358}
359
363
364
365
366 switch (Kind) {
367 case SymbolKind::S_GPROC32_ID:
368 case SymbolKind::S_LPROC32_ID:
369 case SymbolKind::S_LPROC32_DPC:
370 case SymbolKind::S_LPROC32_DPC_ID:
372 break;
373 case SymbolKind::S_GPROC32:
374 case SymbolKind::S_LPROC32:
376 break;
377 case SymbolKind::S_UDT:
379 break;
380 case SymbolKind::S_GDATA32:
381 case SymbolKind::S_LDATA32:
383 break;
384 case SymbolKind::S_BUILDINFO:
386 break;
387 case SymbolKind::S_LTHREAD32:
388 case SymbolKind::S_GTHREAD32:
390 break;
391 case SymbolKind::S_FILESTATIC:
393 break;
394 case SymbolKind::S_LOCAL:
396 break;
397 case SymbolKind::S_REGISTER:
399 break;
400 case SymbolKind::S_CONSTANT:
402 break;
403 case SymbolKind::S_BPREL32:
404 case SymbolKind::S_REGREL32:
406 break;
407 case SymbolKind::S_CALLSITEINFO:
409 break;
410 case SymbolKind::S_CALLERS:
411 case SymbolKind::S_CALLEES:
412 case SymbolKind::S_INLINEES:
413
416 break;
417 case SymbolKind::S_INLINESITE:
419 break;
420 case SymbolKind::S_HEAPALLOCSITE:
422 break;
423
424
425 case SymbolKind::S_DEFRANGE_REGISTER:
426 case SymbolKind::S_DEFRANGE_REGISTER_REL:
427 case SymbolKind::S_DEFRANGE_FRAMEPOINTER_REL:
428 case SymbolKind::S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE:
429 case SymbolKind::S_DEFRANGE_SUBFIELD_REGISTER:
430 case SymbolKind::S_DEFRANGE_SUBFIELD:
431 break;
432
433
434 case SymbolKind::S_LABEL32:
435 case SymbolKind::S_OBJNAME:
436 case SymbolKind::S_COMPILE:
437 case SymbolKind::S_COMPILE2:
438 case SymbolKind::S_COMPILE3:
439 case SymbolKind::S_ENVBLOCK:
440 case SymbolKind::S_BLOCK32:
441 case SymbolKind::S_FRAMEPROC:
442 case SymbolKind::S_THUNK32:
443 case SymbolKind::S_FRAMECOOKIE:
444 case SymbolKind::S_UNAMESPACE:
445 case SymbolKind::S_ARMSWITCHTABLE:
446 break;
447
448 case SymbolKind::S_END:
449 case SymbolKind::S_INLINESITE_END:
450 case SymbolKind::S_PROC_ID_END:
451 break;
452 default:
453 return false;
454 }
455 return true;
456}
457
462
467
468 if (Refs.empty())
469 return;
470
472
474 for (const auto &Ref : Refs) {
478 Indices.append(Run.begin(), Run.end());
479 }
480}
481
486
493
501
505 return ::discoverTypeIndices(Sym.content(), K, Refs);
506}
507
516
521 return false;
523 return true;
524}
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_UNLIKELY(EXPR)
static cl::opt< RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysisLegacy::AdvisorMode::Development, "development", "for training")))
static uint32_t getCStringLength(ArrayRef< uint8_t > Data)
Definition TypeIndexDiscovery.cpp:64
static uint32_t handleDataMember(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:115
static uint32_t handleListContinuation(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:200
static void resolveTypeIndexReferences(ArrayRef< uint8_t > RecordData, ArrayRef< TiReference > Refs, SmallVectorImpl< TypeIndex > &Indices)
Definition TypeIndexDiscovery.cpp:463
static uint32_t handleEnumerator(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:105
static bool isMemberPointer(uint32_t Attrs)
Definition TypeIndexDiscovery.cpp:34
static uint32_t handleNestedType(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:155
static uint32_t getEncodedIntegerLength(ArrayRef< uint8_t > Data)
Definition TypeIndexDiscovery.cpp:40
static uint32_t handleVFPtr(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:191
static uint32_t handleOneMethod(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:137
static void handleFieldList(ArrayRef< uint8_t > Content, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:209
static uint32_t handleBaseClass(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:95
static void handlePointer(ArrayRef< uint8_t > Content, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:265
static void handleMethodOverloadList(ArrayRef< uint8_t > Content, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:69
static uint32_t handleVirtualBaseClass(ArrayRef< uint8_t > Data, uint32_t Offset, bool IsIndirect, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:175
static PointerMode getPointerMode(uint32_t Attrs)
Definition TypeIndexDiscovery.cpp:29
static MethodKind getMethodKind(uint16_t Attrs)
Definition TypeIndexDiscovery.cpp:17
static uint32_t handleOverloadedMethod(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:127
static bool isIntroVirtual(uint16_t Attrs)
Definition TypeIndexDiscovery.cpp:23
static uint32_t handleStaticDataMember(ArrayRef< uint8_t > Data, uint32_t Offset, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:165
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
const T & front() const
front - Get the first element.
bool empty() const
empty - Check if the array is empty.
Provides read only access to a subclass of BinaryStream.
void setOffset(uint64_t Off)
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
ArrayRef< uint8_t > content() const
static const uint32_t PointerModeShift
static const uint32_t PointerModeMask
PointerMode
Equivalent to CV_ptrmode_e.
@ PointerToMemberFunction
LLVM_ABI bool discoverTypeIndicesInSymbol(const CVSymbol &Symbol, SmallVectorImpl< TiReference > &Refs)
Discover type indices in symbol records.
Definition TypeIndexDiscovery.cpp:502
MethodKind
Part of member attribute flags. (CV_methodprop_e)
CVRecord< TypeLeafKind > CVType
LLVM_ABI void discoverTypeIndices(ArrayRef< uint8_t > RecordData, SmallVectorImpl< TiReference > &Refs)
Definition TypeIndexDiscovery.cpp:494
CVRecord< SymbolKind > CVSymbol
TypeLeafKind
Duplicate copy of the above enum, but using the official CV names.
SymbolKind
Duplicate copy of the above enum, but using the official CV names.
uint16_t read16le(const void *P)
uint32_t read32le(const void *P)
detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned > ulittle32_t
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Count
@ Ref
The access may reference the value stored in memory.
void cantFail(Error Err, const char *Msg=nullptr)
Report a fatal error if Err is a failure value.
FunctionAddr VTableAddr uintptr_t uintptr_t Data