LLVM: lib/ProfileData/SampleProfWriter.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

31#include

32#include

33#include

34#include

35#include <system_error>

36#include

37#include

38

39#define DEBUG_TYPE "llvm-profdata"

40

41using namespace llvm;

43

44

47 cl::desc("Write vtable type profile in ext-binary sample profile writer"));

48

49namespace llvm {

52namespace {

53

54

55struct SeekableWriter {

59 : OS(OS), Endian(Endian) {}

60

61 template

63 std::string StringBuf;

64 raw_string_ostream SStream(StringBuf);

65 Writer(SStream, Endian).write(Val);

66 OS.pwrite(StringBuf.data(), StringBuf.size(), Offset);

67 }

68};

69

70}

71}

72}

73}

74

80

84 size_t NumToRemove = ProfileMap.size() - NewSize;

85 if (NumToRemove < 1)

86 NumToRemove = 1;

87

88 assert(NumToRemove <= SortedFunctions.size());

90 llvm::drop_begin(SortedFunctions, SortedFunctions.size() - NumToRemove))

92 SortedFunctions.resize(SortedFunctions.size() - NumToRemove);

93}

94

98 if (OutputSizeLimit == 0)

99 return write(ProfileMap);

100

101 size_t OriginalFunctionCount = ProfileMap.size();

102

103 std::unique_ptr<raw_ostream> OriginalOutputStream;

105

106 size_t IterationCount = 0;

107 size_t TotalSize;

108

110 do {

111 StringBuffer.clear();

113 if (std::error_code EC = write(ProfileMap))

114 return EC;

115

116 TotalSize = StringBuffer.size();

117

118

119

120#ifdef _WIN32

123#endif

124 if (TotalSize <= OutputSizeLimit)

125 break;

126

127 Strategy->Erase(TotalSize);

128 IterationCount++;

129 } while (ProfileMap.size() != 0);

130

131 if (ProfileMap.size() == 0)

133

136 LLVM_DEBUG(dbgs() << "Profile originally has " << OriginalFunctionCount

137 << " functions, reduced to " << ProfileMap.size() << " in "

138 << IterationCount << " iterations\n");

139

140 (void)OriginalFunctionCount;

141 (void)IterationCount;

143}

144

145std::error_code

147 std::vector V;

149 for (const auto &I : V) {

150 if (std::error_code EC = writeSample(*I.second))

151 return EC;

152 }

154}

155

157 if (std::error_code EC = writeHeader(ProfileMap))

158 return EC;

159

161 return EC;

162

164}

165

166

167

168

175 assert(Entry.Type == Type && "Unexpected section type");

176

179 return SectionStart;

180}

181

182std::error_code SampleProfileWriterExtBinaryBase::compressAndOutput() {

185 std::string &UncompressedStrings =

187 if (UncompressedStrings.size() == 0)

192 CompressedStrings,

197 UncompressedStrings.clear();

199}

200

201

202

203

208 assert(Entry.Type == Type && "Unexpected section type");

211 if (std::error_code EC = compressAndOutput())

212 return EC;

213 }

214 SecHdrTable.push_back({Type, Entry.Flags, SectionStart - FileStart,

215 OutputStream->tell() - SectionStart, LayoutIdx});

217}

218

219std::error_code

221

222

224 CSNameTable.clear();

225 SecHdrTable.clear();

226

227 if (std::error_code EC = writeHeader(ProfileMap))

228 return EC;

229

230 std::string LocalBuf;

231 LocalBufStream = std::make_unique<raw_string_ostream>(LocalBuf);

232 if (std::error_code EC = writeSections(ProfileMap))

233 return EC;

234

235 if (std::error_code EC = writeSecHdrTable())

236 return EC;

237

239}

240

243 if (Context.hasContext())

245 else

247}

248

249std::error_code

251 const auto &Ret = CSNameTable.find(Context);

252 if (Ret == CSNameTable.end())

256}

257

258std::error_code

266

269

270

272

273

276 return EC;

279 };

280

282

283

284

285 std::map<SampleContext, uint64_t> OrderedFuncOffsetTable(

286 FuncOffsetTable.begin(), FuncOffsetTable.end());

287 for (const auto &Entry : OrderedFuncOffsetTable) {

288 if (std::error_code EC = WriteItem(Entry.first, Entry.second))

289 return EC;

290 }

292 } else {

293 for (const auto &Entry : FuncOffsetTable) {

294 if (std::error_code EC = WriteItem(Entry.first, Entry.second))

295 return EC;

296 }

297 }

298

299 FuncOffsetTable.clear();

301}

302

307 return EC;

308

313 }

314

316

319 NumCallsites += J.second.size();

322 for (const auto &FS : J.second) {

327 return EC;

328 }

329 }

330 }

331

333}

334

340 for (const auto &Entry : Profiles) {

342 return EC;

343 }

345}

346

348 if (!UseMD5)

350

352 std::set V;

354

355

356

357

360 for (auto N : V)

361 Writer.write(N.getHashCode());

363}

364

367 for (const auto &I : ProfileMap) {

370 }

371

372

373

374

375

376 if (!UseMD5) {

380 break;

381 }

382 }

383 }

384

386 return EC;

388}

389

391

392 std::set OrderedContexts;

393 for (const auto &I : CSNameTable)

394 OrderedContexts.insert(I.first);

395 assert(OrderedContexts.size() == CSNameTable.size() &&

396 "Unmatched ordered and unordered contexts");

398 for (auto &Context : OrderedContexts)

399 CSNameTable[Context] = I++;

400

404 for (auto Context : OrderedContexts) {

405 auto Frames = Context.getContextFrames();

407 for (auto &Callsite : Frames) {

408 if (std::error_code EC = writeNameIdx(Callsite.Func))

409 return EC;

411 encodeULEB128(Callsite.Location.Discriminator, OS);

412 }

413 }

414

416}

417

418std::error_code

420 if (ProfSymList && ProfSymList->size() > 0)

421 if (std::error_code EC = ProfSymList->write(*OutputStream))

422 return EC;

423

425}

426

429

446

448 switch (Type) {

452 return EC;

453 break;

456 return EC;

457 break;

460 return EC;

461 break;

465 return EC;

466 break;

469 return EC;

470 break;

473 return EC;

474 break;

477 return EC;

478 break;

479 default:

481 return EC;

482 break;

483 }

484 if (std::error_code EC = addNewSection(Type, LayoutIdx, SectionStart))

485 return EC;

487}

488

490 std::unique_ptr<raw_ostream> &OS)

493}

494

495std::error_code SampleProfileWriterExtBinary::writeDefaultLayout(

497

498

499

500

502 return EC;

504 return EC;

506 return EC;

508 return EC;

510 return EC;

512 return EC;

514 return EC;

516}

517

521 for (const auto &I : ProfileMap) {

522 if (I.second.getCallsiteSamples().size())

523 ContextProfileMap.insert({I.first, I.second});

524 else

525 NoContextProfileMap.insert({I.first, I.second});

526 }

527}

528

529std::error_code SampleProfileWriterExtBinary::writeCtxSplitLayout(

531 SampleProfileMap ContextProfileMap, NoContextProfileMap;

533

535 return EC;

537 return EC;

539 return EC;

541 return EC;

542

543

546 return EC;

547

548

551 return EC;

553 return EC;

555 return EC;

556

558}

559

560std::error_code SampleProfileWriterExtBinary::writeSections(

562 std::error_code EC;

564 EC = writeDefaultLayout(ProfileMap);

566 EC = writeCtxSplitLayout(ProfileMap);

567 else

569 return EC;

570}

571

572

573

574

575

576

577

578

579

584 else

586

587 if (Indent == 0)

589 OS << "\n";

591

593 for (const auto &I : SortedSamples.get()) {

596 OS.indent(Indent + 1);

597 Loc.print(OS);

599

601 OS << " " << J.first << ":" << J.second;

602 OS << "\n";

604

606 Map && !Map->empty()) {

607 OS.indent(Indent + 1);

608 Loc.print(OS);

609 OS << ": ";

611 for (const auto [TypeName, Count] : *Map) {

612 OS << TypeName << ":" << Count << " ";

613 }

614 OS << "\n";

616 }

617 }

618

621 Indent += 1;

622 for (const auto *Element : SortedCallsiteSamples.get()) {

623

627 OS.indent(Indent);

628 Loc.print(OS);

629 OS << ": ";

630 if (std::error_code EC = writeSample(CalleeSamples))

631 return EC;

632 }

633

635 Map && !Map->empty()) {

636 OS.indent(Indent);

637 Loc.print(OS);

638 OS << ": ";

640 for (const auto [TypeId, Count] : *Map) {

641 OS << TypeId << ":" << Count << " ";

642 }

643 OS << "\n";

645 }

646 }

647

648 Indent -= 1;

649

651 OS.indent(Indent + 1);

654 }

655

657 OS.indent(Indent + 1);

660 }

661

662 if (Indent == 0 && MarkFlatProfiles && S.getCallsiteSamples().size() == 0)

663 OS << " !Flat\n";

664

666}

667

668std::error_code

670 assert(!Context.hasContext() && "cs profile is not supported");

672}

673

676 const auto &Ret = NTable.find(FName);

677 if (Ret == NTable.end())

681}

682

685 NTable.insert(std::make_pair(FName, 0));

686}

687

689 addName(Context.getFunction());

690}

691

693

698 }

699

700

702 for (const auto &FS : J.second) {

706 }

707

709 return;

710

711 for (const auto &VTableAccessCountMap :

713

716 }

717 }

718}

719

722 if (Context.hasContext()) {

723 for (auto &Callsite : Context.getContextFrames())

725 CSNameTable.insert(std::make_pair(Context, 0));

726 } else {

728 }

729}

730

733

735 V.insert(I.first);

736 int i = 0;

739}

740

743 std::set V;

745

746

748 for (auto N : V) {

749 OS << N;

751 }

753}

754

755std::error_code

763

764std::error_code

766

767

769

771

774 return EC;

775

776

777 for (const auto &I : ProfileMap) {

780 }

781

784}

785

790

794

795void SampleProfileWriterExtBinaryBase::allocSecHdrTable() {

797

801 Writer.write(static_cast<uint64_t>(-1));

802 Writer.write(static_cast<uint64_t>(-1));

803 Writer.write(static_cast<uint64_t>(-1));

804 Writer.write(static_cast<uint64_t>(-1));

805 }

806}

807

808std::error_code SampleProfileWriterExtBinaryBase::writeSecHdrTable() {

810 "SecHdrTable entries doesn't match SectionHdrLayout");

812 for (uint32_t TableIdx = 0; TableIdx < SecHdrTable.size(); TableIdx++) {

813 IndexMap[SecHdrTable[TableIdx].LayoutIndex] = TableIdx;

814 }

815

816

817

818

819

820

821

822

823

824

825 support::endian::SeekableWriter Writer(

826 static_cast<raw_pwrite_stream &>(*OutputStream),

828 for (uint32_t LayoutIdx = 0; LayoutIdx < SectionHdrLayout.size();

829 LayoutIdx++) {

830 assert(IndexMap[LayoutIdx] < SecHdrTable.size() &&

831 "Incorrect LayoutIdx in SecHdrTable");

832 auto Entry = SecHdrTable[IndexMap[LayoutIdx]];

833 Writer.pwrite(static_cast<uint64_t>(Entry.Type),

834 SecHdrTableOffset + 4 * LayoutIdx * sizeof(uint64_t));

835 Writer.pwrite(static_cast<uint64_t>(Entry.Flags),

836 SecHdrTableOffset + (4 * LayoutIdx + 1) * sizeof(uint64_t));

837 Writer.pwrite(static_cast<uint64_t>(Entry.Offset),

838 SecHdrTableOffset + (4 * LayoutIdx + 2) * sizeof(uint64_t));

839 Writer.pwrite(static_cast<uint64_t>(Entry.Size),

840 SecHdrTableOffset + (4 * LayoutIdx + 3) * sizeof(uint64_t));

841 }

842

844}

845

846std::error_code SampleProfileWriterExtBinaryBase::writeHeader(

849 FileStart = OS.tell();

851

852 allocSecHdrTable();

854}

855

859 "writeCallsiteVTableProf should not be called if WriteVTableProf is "

860 "false");

861

864 Loc.serialize(OS);

866 return EC;

867 }

868

870}

871

881 for (auto Entry : Entries) {

885 }

887}

891 return EC;

892

894

895

900 Loc.serialize(OS);

902 }

903

904

907 NumCallsites += J.second.size();

910 for (const auto &FS : J.second) {

911 J.first.serialize(OS);

912 if (std::error_code EC = writeBody(FS.second))

913 return EC;

914 }

915

918

920}

921

922

923

924

925std::error_code

930

931

932

933

934

935

936

937

940 std::error_code EC;

941 std::unique_ptr<raw_ostream> OS;

944 else

946 if (EC)

947 return EC;

948

950}

951

952

953

954

955

956

957

958

962 std::error_code EC;

963 std::unique_ptr Writer;

964

965

969

978 else

980

981 if (EC)

982 return EC;

983

984 Writer->Format = Format;

985 return std::move(Writer);

986}

987

990 Summary = Builder.computeSummaryForProfiles(ProfileMap);

991}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")

Provides ErrorOr smart pointer.

static void splitProfileMapToTwo(const SampleProfileMap &ProfileMap, SampleProfileMap &ContextProfileMap, SampleProfileMap &NoContextProfileMap)

Definition SampleProfWriter.cpp:518

static cl::opt< bool > ExtBinaryWriteVTableTypeProf("extbinary-write-vtable-type-prof", cl::init(false), cl::Hidden, cl::desc("Write vtable type profile in ext-binary sample profile writer"))

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

size_t size() const

size - Get the array size.

Represents either an error or a value T.

This class implements a map that also provides access to all stored values in a deterministic order.

static LLVM_ABI const ArrayRef< uint32_t > DefaultCutoffs

A vector of useful cutoff values for detailed summary.

pointer data()

Return a pointer to the vector's buffer, even if empty().

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

StringRef - Represent a constant reference to a string, i.e.

The instances of the Type class are immutable: once they are created, they are never changed.

A raw_ostream that writes to a file descriptor.

This class implements an extremely fast bulk output stream that can only output to a stream.

An abstract base class for streams implementations that also support a pwrite operation.

A raw_ostream that writes to an std::string.

std::string & str()

Returns the string's reference.

A raw_ostream that writes to an SmallVector or SmallString.

DefaultFunctionPruningStrategy(SampleProfileMap &ProfileMap, size_t OutputSizeLimit)

Definition SampleProfWriter.cpp:75

void Erase(size_t CurrentOutputSize) override

In this default implementation, functions with fewest samples are dropped first.

Definition SampleProfWriter.cpp:81

This class represents a function that is read from a sample profile.

When writing a profile with size limit, user may want to use a different strategy to reduce function ...

virtual void Erase(size_t CurrentOutputSize)=0

SampleProfileWriter::writeWithSizeLimit() calls this after every write iteration if the output size s...

FunctionPruningStrategy(SampleProfileMap &ProfileMap, size_t OutputSizeLimit)

ProfileMap A reference to the original profile map.

SampleProfileMap & ProfileMap

Representation of the samples collected for a function.

static LLVM_ABI bool ProfileIsPreInlined

static constexpr const char * UniqSuffix

uint64_t getHeadSamples() const

For top-level functions, return the total number of branch samples that have the function as the bran...

static LLVM_ABI bool ProfileIsCS

FunctionId getFunction() const

Return the function name.

uint64_t getFunctionHash() const

const CallsiteTypeMap & getCallsiteTypeCounts() const

Returns vtable access samples for the C++ types collected in this function.

const TypeCountMap * findCallsiteTypeSamplesAt(const LineLocation &Loc) const

Returns the TypeCountMap for inlined callsites at the given Loc.

static LLVM_ABI bool ProfileIsProbeBased

static LLVM_ABI bool ProfileIsFS

If this profile uses flow sensitive discriminators.

SampleContext & getContext() const

uint64_t getTotalSamples() const

Return the total number of samples collected inside the function.

const CallsiteSampleMap & getCallsiteSamples() const

Return all the callsite samples collected in the body of the function.

const BodySampleMap & getBodySamples() const

Return all the samples collected in the body of the function.

uint32_t getAllAttributes()

std::string toString() const

This class provides operator overloads to the map container using MD5 as the key type,...

void stablizeNameTable(MapVector< FunctionId, uint32_t > &NameTable, std::set< FunctionId > &V)

Definition SampleProfWriter.cpp:731

virtual void addContext(const SampleContext &Context)

Definition SampleProfWriter.cpp:688

virtual std::error_code writeNameTable()

Definition SampleProfWriter.cpp:741

virtual std::error_code writeMagicIdent(SampleProfileFormat Format)

Definition SampleProfWriter.cpp:756

std::error_code writeSummary()

Definition SampleProfWriter.cpp:872

MapVector< FunctionId, uint32_t > NameTable

void addNames(const FunctionSamples &S)

Definition SampleProfWriter.cpp:692

std::error_code writeCallsiteVTableProf(const CallsiteTypeMap &CallsiteTypeMap, raw_ostream &OS)

Write CallsiteTypeMap to the output stream OS.

Definition SampleProfWriter.cpp:856

virtual std::error_code writeContextIdx(const SampleContext &Context)

Definition SampleProfWriter.cpp:669

std::error_code writeSample(const FunctionSamples &S) override

Write samples of a top-level function to a binary file.

Definition SampleProfWriter.cpp:926

std::error_code writeHeader(const SampleProfileMap &ProfileMap) override

Write a file header for the profile file.

Definition SampleProfWriter.cpp:765

virtual MapVector< FunctionId, uint32_t > & getNameTable()

std::error_code writeBody(const FunctionSamples &S)

Definition SampleProfWriter.cpp:888

std::error_code writeNameIdx(FunctionId FName)

Definition SampleProfWriter.cpp:674

void addName(FunctionId FName)

Definition SampleProfWriter.cpp:683

std::error_code writeNameTableSection(const SampleProfileMap &ProfileMap)

Definition SampleProfWriter.cpp:365

SmallVector< SecHdrTableEntry, 8 > SectionHdrLayout

std::error_code writeFuncMetadata(const SampleProfileMap &Profiles)

Definition SampleProfWriter.cpp:335

void setToCompressSection(SecType Type)

Definition SampleProfWriter.cpp:791

virtual std::error_code writeCustomSection(SecType Type)=0

virtual std::error_code writeOneSection(SecType Type, uint32_t LayoutIdx, const SampleProfileMap &ProfileMap)

Definition SampleProfWriter.cpp:427

std::error_code writeFuncOffsetTable()

Definition SampleProfWriter.cpp:267

std::error_code writeCSNameTableSection()

Definition SampleProfWriter.cpp:390

std::error_code writeCSNameIdx(const SampleContext &Context)

Definition SampleProfWriter.cpp:250

virtual std::error_code writeSections(const SampleProfileMap &ProfileMap)=0

std::error_code writeNameTable() override

Definition SampleProfWriter.cpp:347

void addSectionFlag(SecType Type, SecFlagType Flag)

std::error_code writeProfileSymbolListSection()

Definition SampleProfWriter.cpp:419

uint64_t markSectionStart(SecType Type, uint32_t LayoutIdx)

Return the current position and prepare to use it as the start position of a section given the sectio...

Definition SampleProfWriter.cpp:170

void addContext(const SampleContext &Context) override

Definition SampleProfWriter.cpp:720

std::error_code addNewSection(SecType Sec, uint32_t LayoutIdx, uint64_t SectionStart)

Add a new section into section header table given the section type Type, its position LayoutIdx in Se...

Definition SampleProfWriter.cpp:204

void setToCompressAllSections() override

Definition SampleProfWriter.cpp:786

uint64_t SecLBRProfileStart

std::error_code write(const SampleProfileMap &ProfileMap) override

Write all the sample profiles in the given map of samples.

Definition SampleProfWriter.cpp:220

std::error_code writeContextIdx(const SampleContext &Context) override

Definition SampleProfWriter.cpp:241

std::error_code writeSample(const FunctionSamples &S) override

Write samples of a top-level function to a binary file.

Definition SampleProfWriter.cpp:259

SampleProfileWriterExtBinary(std::unique_ptr< raw_ostream > &OS)

Definition SampleProfWriter.cpp:489

Sample-based profile writer (text format).

std::error_code writeSample(const FunctionSamples &S) override

Write samples to a text file.

Definition SampleProfWriter.cpp:580

std::unique_ptr< ProfileSummary > Summary

Profile summary.

virtual std::error_code writeSample(const FunctionSamples &S)=0

Write sample profiles in S.

SampleProfileFormat Format

Profile format.

std::error_code writeWithSizeLimitInternal(SampleProfileMap &ProfileMap, size_t OutputSizeLimit, FunctionPruningStrategy *Strategy)

Definition SampleProfWriter.cpp:95

void computeSummary(const SampleProfileMap &ProfileMap)

Compute summary for this profile.

Definition SampleProfWriter.cpp:988

virtual std::error_code writeFuncProfiles(const SampleProfileMap &ProfileMap)

Definition SampleProfWriter.cpp:146

std::unique_ptr< raw_ostream > OutputStream

Output stream where to emit the profile to.

size_t LineCount

For writeWithSizeLimit in text mode, each newline takes 1 additional byte on Windows when actually wr...

static ErrorOr< std::unique_ptr< SampleProfileWriter > > create(StringRef Filename, SampleProfileFormat Format)

Profile writer factory.

Definition SampleProfWriter.cpp:939

virtual std::error_code writeHeader(const SampleProfileMap &ProfileMap)=0

Write a file header for the profile file.

virtual std::error_code write(const SampleProfileMap &ProfileMap)

Write all the sample profiles in the given map of samples.

Definition SampleProfWriter.cpp:156

Representation of a single sample record.

LLVM_ABI std::error_code serialize(raw_ostream &OS, const MapVector< FunctionId, uint32_t > &NameTable) const

Serialize the sample record to the output stream using ULEB128 encoding.

const CallTargetMap & getCallTargets() const

uint64_t getSamples() const

const SortedCallTargetSet getSortedCallTargets() const

Sort a LocationT->SampleT map by LocationT.

const SamplesWithLocList & get() const

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

initializer< Ty > init(const Ty &Val)

LLVM_ABI void compress(ArrayRef< uint8_t > Input, SmallVectorImpl< uint8_t > &CompressedBuffer, int Level=DefaultCompression)

LLVM_ABI bool isAvailable()

constexpr int BestSizeCompression

LLVM_ABI void sortFuncProfiles(const SampleProfileMap &ProfileMap, std::vector< NameFunctionSamples > &SortedProfiles)

static uint64_t SPMagic(SampleProfileFormat Format=SPF_Binary)

static void addSecFlag(SecHdrTableEntry &Entry, SecFlagType Flag)

static bool hasSecFlag(const SecHdrTableEntry &Entry, SecFlagType Flag)

std::pair< hash_code, const FunctionSamples * > NameFunctionSamples

@ SecFlagIsPreInlined

SecFlagIsPreInlined means this profile contains ShouldBeInlined contexts thus this is CS preinliner c...

@ SecFlagHasVTableTypeProf

SecFlagHasVTableTypeProf means this profile contains vtable type profiles.

@ SecFlagFSDiscriminator

SecFlagFSDiscriminator means this profile uses flow-sensitive discriminators.

@ SecFlagFullContext

SecFlagContext means this is context-sensitive flat profile for CSSPGO.

std::map< FunctionId, FunctionSamples > FunctionSamplesMap

std::map< FunctionId, uint64_t > TypeCountMap

Key represents type of a C++ polymorphic class type by its vtable and value represents its counter.

constexpr char kVTableProfPrefix[]

std::error_code serializeTypeMap(const TypeCountMap &Map, const MapVector< FunctionId, uint32_t > &NameTable, raw_ostream &OS)

Write Map to the output stream.

static uint64_t SPVersion()

std::map< LineLocation, TypeCountMap > CallsiteTypeMap

@ OF_TextWithCRLF

The file should be opened in text mode and use a carriage linefeed '\r '.

This is an optimization pass for GlobalISel generic memory operations.

auto drop_begin(T &&RangeOrContainer, size_t N=1)

Return a range covering RangeOrContainer with the first N elements excluded.

ArrayRef< CharT > arrayRefFromStringRef(StringRef Input)

Construct a string ref from an array ref of unsigned chars.

@ unsupported_writing_format

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

auto make_first_range(ContainerTy &&c)

Given a container of pairs, return a range over the first elements.

FunctionAddr VTableAddr Count

auto make_second_range(ContainerTy &&c)

Given a container of pairs, return a range over the second elements.

unsigned encodeULEB128(uint64_t Value, raw_ostream &OS, unsigned PadTo=0)

Utility function to encode a ULEB128 value to an output stream.

PointerUnion< const Value *, const PseudoSourceValue * > ValueType

StringRef toStringRef(bool B)

Construct a string ref from a boolean.

Represents the relative location of an instruction.

Adapter to write values to a stream in a particular byte order.

void write(ArrayRef< value_type > Val)

static uint64_t round(uint64_t Acc, uint64_t Input)