1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[codeview] Add support for inlinee lists

This adds type index discovery and dumper support for symbol record kind
0x1168, which is a list of inlined function ids. This symbol kind is
undocumented, but S_INLINEES is consistent with the existing
nomenclature.

Fixes PR34222

llvm-svn: 316398
This commit is contained in:
Reid Kleckner 2017-10-23 23:43:40 +00:00
parent 666ae11aa6
commit eb9ed33777
5 changed files with 48 additions and 3 deletions

View File

@ -184,7 +184,8 @@ CV_SYMBOL(S_LDATA_HLSL32 , 0x1163)
CV_SYMBOL(S_GDATA_HLSL32_EX, 0x1164)
CV_SYMBOL(S_LDATA_HLSL32_EX, 0x1165)
CV_SYMBOL(S_FASTLINK, 0x1167)
CV_SYMBOL(S_FASTLINK, 0x1167) // Undocumented
SYMBOL_RECORD_ALIAS(S_INLINEES, 0x1168, InlineesSym, CallerSym) // Undocumented
// Known symbol types
SYMBOL_RECORD(S_END , 0x0006, ScopeEndSym)
@ -234,7 +235,7 @@ SYMBOL_RECORD(S_HEAPALLOCSITE , 0x115e, HeapAllocationSiteSym)
SYMBOL_RECORD(S_FRAMECOOKIE , 0x113a, FrameCookieSym)
SYMBOL_RECORD(S_CALLEES , 0x115a, CallerSym)
SYMBOL_RECORD_ALIAS(S_CALLERS , 0x115b, CalleeSym, CallerSym)
SYMBOL_RECORD_ALIAS(S_CALLERS, 0x115b, CalleeSym, CallerSym)
SYMBOL_RECORD(S_UDT , 0x1108, UDTSym)
SYMBOL_RECORD_ALIAS(S_COBOLUDT , 0x1109, CobolUDT, UDTSym)

View File

@ -404,6 +404,7 @@ static bool discoverTypeIndices(ArrayRef<uint8_t> Content, SymbolKind Kind,
break;
case SymbolKind::S_CALLERS:
case SymbolKind::S_CALLEES:
case SymbolKind::S_INLINEES:
// The record is a count followed by an array of type indices.
Count = *reinterpret_cast<const ulittle32_t *>(Content.data());
Refs.push_back({TiRefKind::IndexRef, 4, Count}); // Callees

Binary file not shown.

View File

@ -0,0 +1,38 @@
Compile the following like so to reproduce the input:
$ cl -c -O2 t.c -Z7
void g();
static inline void f() { g(); }
static inline void h() { g(); }
void k() {
f();
h();
}
RUN: llvm-readobj -codeview %p/Inputs/codeview-inlinees.obj | FileCheck %s
CHECK: SubSectionType: InlineeLines (0xF6)
CHECK: Inlinee: f (0x1003)
CHECK: Inlinee: h (0x1004)
CHECK-NOT: Inlinee:
CHECK: GlobalProcIdSym {
CHECK: Kind: S_GPROC32_ID (0x1147)
CHECK: DisplayName: k
CHECK: LinkageName: k
CHECK: }
CHECK: InlineSiteSym
CHECK: Kind: S_INLINESITE (0x114D)
CHECK: Inlinee: h (0x1004)
CHECK: InlineSiteSym
CHECK: Kind: S_INLINESITE (0x114D)
CHECK: Inlinee: f (0x1003)
CHECK: InlineesSym {
CHECK-NEXT: Kind: S_INLINEES (0x1168)
CHECK-NEXT: Callers [
CHECK-NEXT: FuncID: f (0x1003)
CHECK-NEXT: FuncID: h (0x1004)
CHECK-NEXT: ]
CHECK: }
CHECK: ProcEnd {
CHECK: Kind: S_PROC_ID_END (0x114F)
CHECK: }

View File

@ -560,7 +560,12 @@ TEST_F(TypeIndexIteratorTest, CallerSym) {
Callers.Indices.push_back(TypeIndex(4));
Callers.Indices.push_back(TypeIndex(5));
Callers.Indices.push_back(TypeIndex(6));
writeSymbolRecords(Callees, Callers);
CallerSym Inlinees(SymbolRecordKind::InlineesSym);
Inlinees.Indices.push_back(TypeIndex(7));
Inlinees.Indices.push_back(TypeIndex(8));
Inlinees.Indices.push_back(TypeIndex(9));
writeSymbolRecords(Callees, Callers, Inlinees);
checkTypeReferences(0, TypeIndex(1), TypeIndex(2), TypeIndex(3));
checkTypeReferences(1, TypeIndex(4), TypeIndex(5), TypeIndex(6));
checkTypeReferences(2, TypeIndex(7), TypeIndex(8), TypeIndex(9));
}