LLVM: include/llvm/ProfileData/SampleProf.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_PROFILEDATA_SAMPLEPROF_H

15#define LLVM_PROFILEDATA_SAMPLEPROF_H

16

31#include

32#include

33#include

34#include

35#include

36#include

37#include

38#include <system_error>

39#include <unordered_map>

40#include

41

42namespace llvm {

43

46

48

67

71

81

82}

83

84namespace std {

85

86template <>

87struct is_error_code_enum<llvm::sampleprof_error> : std::true_type {};

88

89}

90

91namespace llvm {

92namespace sampleprof {

93

95

104

110

117

119

120

121

122

135

137 switch (static_cast<int>(Type)) {

139 return "InvalidSection";

141 return "ProfileSummarySection";

143 return "NameTableSection";

145 return "ProfileSymbolListSection";

147 return "FuncOffsetTableSection";

149 return "FunctionMetadata";

151 return "CSNameTableSection";

153 return "LBRProfileSection";

154 default:

155 return "UnknownSection";

156 }

157}

158

159

160

170

171

172

173

180

181

182

183

196

197

198

200

201

203

204

206

207

209

210

212};

213

219

226

227

228template

230

231 if (std::is_same<SecCommonFlags, SecFlagType>())

232 return;

233

234

235 bool IsFlagLegal = false;

236 switch (Type) {

238 IsFlagLegal = std::is_same<SecNameTableFlags, SecFlagType>();

239 break;

241 IsFlagLegal = std::is_same<SecProfSummaryFlags, SecFlagType>();

242 break;

244 IsFlagLegal = std::is_same<SecFuncMetadataFlags, SecFlagType>();

245 break;

246 default:

248 IsFlagLegal = std::is_same<SecFuncOffsetFlags, SecFlagType>();

249 break;

250 }

251 if (!IsFlagLegal)

252 llvm_unreachable("Misuse of a flag in an incompatible section");

253}

254

255template

258 auto FVal = static_cast<uint64_t>(Flag);

259 bool IsCommon = std::is_same<SecCommonFlags, SecFlagType>();

260 Entry.Flags |= IsCommon ? FVal : (FVal << 32);

261}

262

263template

266 auto FVal = static_cast<uint64_t>(Flag);

267 bool IsCommon = std::is_same<SecCommonFlags, SecFlagType>();

268 Entry.Flags &= ~(IsCommon ? FVal : (FVal << 32));

269}

270

271template

274 auto FVal = static_cast<uint64_t>(Flag);

275 bool IsCommon = std::is_same<SecCommonFlags, SecFlagType>();

276 return Entry.Flags & (IsCommon ? FVal : (FVal << 32));

277}

278

279

280

281

282

283

284

285

286

287

290

293

294

296

299 std::tie(O.LineOffset, O.Discriminator);

300 }

301

305

309

313

316};

317

320 return Loc.getHashCode();

321 }

322};

323

325

326

327

328

329

331

332

333

334std::error_code

338

339

340

341

342

343

344

345

346

347

348

349

351public:

352 using CallTarget = std::pair<FunctionId, uint64_t>;

355 if (LHS.second != RHS.second)

356 return LHS.second > RHS.second;

357

358 return LHS.first < RHS.first;

359 }

360 };

361

363 using CallTargetMap = std::unordered_map<FunctionId, uint64_t>;

365

366

367

368

369

370

372 bool Overflowed;

376 }

377

378

379

381 if (S > NumSamples)

382 S = NumSamples;

383 NumSamples -= S;

384 return S;

385 }

386

387

388

389

390

391

394 uint64_t &TargetSamples = CallTargets[F];

395 bool Overflowed;

396 TargetSamples =

400 }

401

402

403

406 auto I = CallTargets.find(F);

407 if (I != CallTargets.end()) {

409 CallTargets.erase(I);

410 }

412 }

413

414

415 bool hasCalls() const { return !CallTargets.empty(); }

416

422

425 for (const auto &I : CallTargets)

426 Sum += I.second;

427 return Sum;

428 }

429

430

434 for (const auto &[Target, Frequency] : Targets) {

435 SortedTargets.emplace(Target, Frequency);

436 }

437 return SortedTargets;

438 }

439

440

442 float DistributionFactor) {

444 for (const auto &[Target, Frequency] : Targets) {

445 AdjustedTargets[Target] = Frequency * DistributionFactor;

446 }

447 return AdjustedTargets;

448 }

449

450

451

456

457

461

463 return NumSamples == Other.NumSamples && CallTargets == Other.CallTargets;

464 }

465

467 return !(*this == Other);

468 }

469

470private:

473};

474

476

477

485

486

494

495

499

501

504

508

510 return !(*this == That);

511 }

512

513 std::string toString(bool OutputLineLocation) const {

514 std::ostringstream OContextStr;

515 OContextStr << Func.str();

516 if (OutputLineLocation) {

517 OContextStr << ":" << Location.LineOffset;

519 OContextStr << "." << Location.Discriminator;

520 }

521 return OContextStr.str();

522 }

523

527 return NameHash + (LocId << 5) + LocId;

528 }

529};

530

534

537

543

544

545

546

547

548

549

550

551

552

553

555public:

557

560 assert(!Name.empty() && "Name is empty");

561 }

562

565

569 assert(!Context.empty() && "Context is empty");

571 }

572

573

574

575

577 std::list &CSNameTable,

581

582

583 bool HasContext = ContextStr.starts_with("[");

584 if (!HasContext) {

587 } else {

588 CSNameTable.emplace_back();

592 }

593 }

594

595

596

599

600 ContextStr = ContextStr.substr(1, ContextStr.size() - 2);

601 StringRef ContextRemain = ContextStr;

604 while (!ContextRemain.empty()) {

605 auto ContextSplit = ContextRemain.split(" @ ");

606 ChildContext = ContextSplit.first;

607 ContextRemain = ContextSplit.second;

610 Context.emplace_back(Callee, CallSiteLoc);

611 }

612 }

613

614

615

619

620 auto EntrySplit = ContextStr.split(':');

622

623 LineLoc = {0, 0};

624 if (!EntrySplit.second.empty()) {

625

626

627 int LineOffset = 0;

628 auto LocSplit = EntrySplit.second.split('.');

629 LocSplit.first.getAsInteger(10, LineOffset);

631

632

633 if (!LocSplit.second.empty())

634 LocSplit.second.getAsInteger(10, LineLoc.Discriminator);

635 }

636 }

637

647 bool isBaseContext() const { return FullContext.size() == 1; }

650

652 bool IncludeLeafLineLocation = false) {

653 std::ostringstream OContextStr;

654 for (uint32_t I = 0; I < Context.size(); I++) {

655 if (OContextStr.str().size()) {

656 OContextStr << " @ ";

657 }

658 OContextStr << Context[I].toString(I != Context.size() - 1 ||

659 IncludeLeafLineLocation);

660 }

661 return OContextStr.str();

662 }

663

666 return Func.str();

668 }

669

675

676

678 Func = NewFunctionID;

681 }

682

686 FullContext = Context;

687 Func = Context.back().Func;

688 State = CState;

689 }

690

692 return State == That.State && Func == That.Func &&

693 FullContext == That.FullContext;

694 }

695

697

699 if (State != That.State)

700 return State < That.State;

701

703 return Func < That.Func;

704 }

705

707 while (I < std::min(FullContext.size(), That.FullContext.size())) {

708 auto &Context1 = FullContext[I];

709 auto &Context2 = That.FullContext[I];

710 auto V = Context1.Func.compare(Context2.Func);

711 if (V)

712 return V < 0;

713 if (Context1.Location != Context2.Location)

714 return Context1.Location < Context2.Location;

715 I++;

716 }

717

718 return FullContext.size() < That.FullContext.size();

719 }

720

723 return Context.getHashCode();

724 }

725 };

726

728 auto ThisContext = FullContext;

729 auto ThatContext = That.FullContext;

730 if (ThatContext.size() < ThisContext.size())

731 return false;

732 ThatContext = ThatContext.take_front(ThisContext.size());

733

734 if (ThisContext.back().Func != ThatContext.back().Func)

735 return false;

736

738 }

739

740private:

741

742

744

746

748

750};

751

753 return Context.getHashCode();

754}

755

757 return OS << Context.toString();

758}

759

762

764

765

770 std::unordered_map<LineLocation, LineLocation, LineLocationHash>;

771

772

773

774

775

776

778public:

780

783

785 bool Overflowed;

786 TotalSamples =

790 }

791

793 if (TotalSamples < Num)

794 TotalSamples = 0;

795 else

796 TotalSamples -= Num;

797 }

798

800

802

804 bool Overflowed;

805 TotalHeadSamples =

809 }

810

813 return BodySamples[LineLocation(LineOffset, Discriminator)].addSamples(

814 Num, Weight);

815 }

816

822 return BodySamples[LineLocation(LineOffset, Discriminator)].addCalledTarget(

823 Func, Num, Weight);

824 }

825

829 return BodySamples[Location].merge(SampleRecord, Weight);

830 }

831

832

833

838 auto I = BodySamples.find(LineLocation(LineOffset, Discriminator));

839 if (I != BodySamples.end()) {

840 Count = I->second.removeCalledTarget(Func);

842 if (I->second.getSamples())

843 BodySamples.erase(I);

844 }

846 }

847

848

849

851 CallsiteSamples.clear();

852 }

853

854

856 for (auto &I : BodySamples) {

857 uint64_t TargetSamples = I.second.getCallTargetSum();

858

859

860

861

862 if (TargetSamples > I.second.getSamples())

863 I.second.addSamples(TargetSamples - I.second.getSamples());

864 }

865 }

866

867

870 for (const auto &I : BodySamples)

872

873 for (auto &I : CallsiteSamples) {

874 for (auto &CS : I.second) {

875 CS.second.updateTotalSamples();

877 }

878 }

879 }

880

881

884 for (auto &I : CallsiteSamples) {

885 for (auto &CS : I.second) {

886 CS.second.setContextSynthetic();

887 }

888 }

889 }

890

891

892

894 Context.setAttribute(Attr);

895 for (auto &I : CallsiteSamples) {

896 for (auto &CS : I.second) {

897 CS.second.setContextAttribute(Attr);

898 }

899 }

900 }

901

902

904

905

906 if (!IRToProfileLocationMap)

907 return IRLoc;

908 const auto &ProfileLoc = IRToProfileLocationMap->find(IRLoc);

909 if (ProfileLoc != IRToProfileLocationMap->end())

910 return ProfileLoc->second;

911 return IRLoc;

912 }

913

914

915

916

918 uint32_t Discriminator) const {

919 const auto &Ret = BodySamples.find(

921 if (Ret == BodySamples.end())

922 return std::error_code();

923 return Ret->second.getSamples();

924 }

925

926

927

928

931 const auto &Ret = BodySamples.find(

933 if (Ret == BodySamples.end())

934 return std::error_code();

935 return Ret->second.getCallTargets();

936 }

937

938

939

943 if (Ret == BodySamples.end())

944 return std::error_code();

945 return Ret->second.getCallTargets();

946 }

947

948

952

953

957 if (Iter == CallsiteSamples.end())

958 return nullptr;

959 return &Iter->second;

960 }

961

962

965 if (Iter == VirtualCallsiteTypeCounts.end())

966 return nullptr;

967 return &Iter->second;

968 }

969

970

971

972

973

974

975

980 *FuncNameToProfNameMap = nullptr) const;

981

982 bool empty() const { return TotalSamples == 0; }

983

984

986

987

988

989

990

991

992

994

995

996

997

998

999

1002

1003

1005 }

1007

1008

1009 if (!BodySamples.empty() &&

1010 (CallsiteSamples.empty() ||

1011 BodySamples.begin()->first < CallsiteSamples.begin()->first))

1012 Count = BodySamples.begin()->second.getSamples();

1013 else if (!CallsiteSamples.empty()) {

1014

1015

1016 for (const auto &FuncSamples : CallsiteSamples.begin()->second)

1017 Count += FuncSamples.second.getHeadSamplesEstimate();

1018 }

1019

1020 return Count ? Count : TotalSamples > 0;

1021 }

1022

1023

1025

1026

1028 return CallsiteSamples;

1029 }

1030

1031

1032

1034 return VirtualCallsiteTypeCounts;

1035 }

1036

1037

1038

1039

1043

1044

1045

1046

1047

1048

1052 bool Overflowed = false;

1054 TypeCounts[Type], &Overflowed);

1057 }

1058

1059

1060

1061

1062

1063 template

1067 static_assert((std::is_same_v<typename T::key_type, StringRef> ||

1068 std::is_same_v<typename T::key_type, FunctionId>) &&

1069 std::is_same_v<typename T::mapped_type, uint64_t>,

1070 "T must be a map with StringRef or FunctionId as key and "

1071 "uint64_t as value");

1073 bool Overflowed = false;

1074

1077 bool RowOverflow = false;

1079 Count, Weight, TypeCounts[TypeId], &RowOverflow);

1080 Overflowed |= RowOverflow;

1081 }

1084 }

1085

1086

1087

1088

1089

1093 MaxCount = std::max(MaxCount, L.second.getSamples());

1094 if (SkipCallSite)

1095 return MaxCount;

1097 for (const FunctionSamplesMap::value_type &F : C.second)

1098 MaxCount = std::max(MaxCount, F.second.getMaxCountInside());

1099 return MaxCount;

1100 }

1101

1102

1103

1108 if (Context.getFunction().empty())

1109 Context = Other.getContext();

1110 if (FunctionHash == 0) {

1111

1112 FunctionHash = Other.getFunctionHash();

1113 } else if (FunctionHash != Other.getFunctionHash()) {

1114

1115

1116

1117

1118

1119

1120

1122 }

1123

1128 for (const auto &I : Other.getBodySamples()) {

1132 }

1133 for (const auto &I : Other.getCallsiteSamples()) {

1136 for (const auto &Rec : I.second)

1138 FSMap[Rec.first].merge(Rec.second, Weight));

1139 }

1140 for (const auto &[Loc, OtherTypeMap] : Other.getCallsiteTypeCounts())

1143

1144 return Result;

1145 }

1146

1147

1148

1149

1150

1155 if (TotalSamples <= Threshold)

1156 return;

1157 auto IsDeclaration = [](const Function *F) {

1158 return F || F->isDeclaration();

1159 };

1161

1163 }

1164

1165

1166 for (const auto &BS : BodySamples)

1167 for (const auto &TS : BS.second.getCallTargets())

1168 if (TS.second > Threshold) {

1169 const Function *Callee = SymbolMap.lookup(TS.first);

1170 if (IsDeclaration(Callee))

1171 S.insert(TS.first.getHashCode());

1172 }

1173 for (const auto &CS : CallsiteSamples)

1174 for (const auto &NameFS : CS.second)

1175 NameFS.second.findInlinedFunctions(S, SymbolMap, Threshold);

1176 }

1177

1178

1180 Context.setFunction(NewFunctionID);

1181 }

1182

1183

1185

1186

1188

1190

1192

1194 assert(IRToProfileLocationMap == nullptr && "this should be set only once");

1195 IRToProfileLocationMap = LTLM;

1196 }

1197

1198

1199

1201 const char *AttrName = "sample-profile-suffix-elision-policy";

1202 auto Attr = F.getFnAttribute(AttrName).getValueAsString();

1204 }

1205

1206

1207

1210 static constexpr const char *UniqSuffix = ".__uniq.";

1211

1221

1225 if (Attr == "" || Attr == "all")

1226 return FnName.split('.').first;

1227 if (Attr == "selected") {

1229 for (const auto Suffix : Suffixes) {

1230

1231

1233 continue;

1234 auto It = Cand.rfind(Suffix);

1236 continue;

1237 auto Dit = Cand.rfind('.');

1238 if (Dit == It || Dit == It + Suffix.size() - 1)

1239 Cand = Cand.substr(0, It);

1240 }

1241 return Cand;

1242 }

1243 if (Attr == "none")

1244 return FnName;

1245 assert(false && "internal error: unknown suffix elision policy");

1246 return FnName;

1247 }

1248

1249

1250

1251

1252

1253

1254

1255

1258 return Func.stringRef();

1259

1262 }

1263

1264

1265

1267

1268

1269

1270

1271

1274

1275

1276

1277

1278

1283

1284

1285

1286

1287

1288

1289

1290

1291

1292

1293

1294

1295

1300 *FuncNameToProfNameMap = nullptr) const;

1301

1303

1305

1307

1309

1311

1312

1314

1315

1317

1318

1320

1321

1322

1324

1325

1326

1330

1331

1332

1334

1339 FunctionHash == Other.FunctionHash && Context == Other.Context &&

1340 TotalSamples == Other.TotalSamples &&

1341 TotalHeadSamples == Other.TotalHeadSamples &&

1342 BodySamples == Other.BodySamples &&

1343 CallsiteSamples == Other.CallsiteSamples;

1344 }

1345

1347 return !(*this == Other);

1348 }

1349

1350private:

1351

1353

1354

1356

1357

1358

1359

1360

1362

1363

1364

1365

1366 uint64_t TotalHeadSamples = 0;

1367

1368

1369

1370

1371

1372

1374

1375

1376

1377

1378

1379

1380

1381

1382

1383

1384

1385

1386

1387

1388

1389

1390

1392

1393

1394

1395

1396

1397

1398

1399

1400

1401

1402

1403

1404

1405

1406

1407

1409

1410

1411

1412

1413

1414

1415

1416

1417

1418

1419

1420

1421

1422

1423

1424

1425

1426

1427 const LocToLocMap *IRToProfileLocationMap = nullptr;

1428};

1429

1430

1431

1437

1439

1440

1441

1442

1443

1444

1446 : public HashKeyMap<std::unordered_map, SampleContext, FunctionSamples> {

1447public:

1448

1449

1452 if (Ret.second)

1453 Ret.first->second.setContext(Ctx);

1454 return Ret.first->second;

1455 }

1456

1461

1466

1471

1473

1475};

1476

1478

1481 std::vector &SortedProfiles);

1482

1483

1484

1485

1486

1487template <class LocationT, class SampleT> class SampleSorter {

1488public:

1491

1493 for (const auto &I : Samples)

1494 V.push_back(&I);

1496 return A->first < B->first;

1497 });

1498 }

1499

1501

1502private:

1504};

1505

1506

1507

1508

1510public:

1512

1513

1514

1515

1516

1517

1518

1520 bool TrimColdContext,

1521 bool MergeColdContext,

1522 uint32_t ColdContextFrameLength,

1523 bool TrimBaseProfileOnly);

1524

1525private:

1527};

1528

1529

1530

1531

1532

1534public:

1536

1537

1544

1545

1547

1549

1551

1553

1556 };

1557

1559 bool ProfileIsCS = false) {

1561 flattenProfile(ProfileMap, TmpProfiles, ProfileIsCS);

1562 ProfileMap = std::move(TmpProfiles);

1563 }

1564

1567 bool ProfileIsCS = false) {

1568 if (ProfileIsCS) {

1569 for (const auto &I : InputProfiles) {

1570

1571

1573 FS.merge(I.second);

1574 }

1575 } else {

1576 for (const auto &I : InputProfiles)

1577 flattenNestedProfile(OutputProfiles, I.second);

1578 }

1579 }

1580

1581private:

1582 static void flattenNestedProfile(SampleProfileMap &OutputProfiles,

1584

1585

1587 auto Ret = OutputProfiles.try_emplace(Context, FS);

1589 if (Ret.second) {

1590

1591

1592 Profile.removeAllCallsiteSamples();

1593

1594 Profile.setTotalSamples(0);

1595 } else {

1598 }

1599 }

1600

1602 "There should be no inlinees' profiles after flattening.");

1603

1604

1605

1606

1607

1608 uint64_t TotalSamples = FS.getTotalSamples();

1609

1610 for (const auto &I : FS.getCallsiteSamples()) {

1611 for (const auto &Callee : I.second) {

1612 const auto &CalleeProfile = Callee.second;

1613

1614 Profile.addBodySamples(I.first.LineOffset, I.first.Discriminator,

1615 CalleeProfile.getHeadSamplesEstimate());

1616

1617 Profile.addCalledTargetSamples(

1618 I.first.LineOffset, I.first.Discriminator,

1619 CalleeProfile.getFunction(),

1620 CalleeProfile.getHeadSamplesEstimate());

1621

1622 TotalSamples = TotalSamples >= CalleeProfile.getTotalSamples()

1623 ? TotalSamples - CalleeProfile.getTotalSamples()

1624 : 0;

1625 TotalSamples += CalleeProfile.getHeadSamplesEstimate();

1626

1627 flattenNestedProfile(OutputProfiles, CalleeProfile);

1628 }

1629 }

1630 Profile.addTotalSamples(TotalSamples);

1631

1632 Profile.setHeadSamples(Profile.getHeadSamplesEstimate());

1633 }

1634

1635

1637 FrameNode *getOrCreateContextPath(const SampleContext &Context);

1638

1639 SampleProfileMap &ProfileMap;

1641};

1642

1643

1644

1645

1646

1648public:

1649

1650

1652 if (!Copy) {

1653 Syms.insert(Name);

1654 return;

1655 }

1656 Syms.insert(Name.copy(Allocator));

1657 }

1658

1660

1662 for (auto Sym : List.Syms)

1663 add(Sym, true);

1664 }

1665

1666 unsigned size() { return Syms.size(); }

1668

1671

1675

1676private:

1677

1678

1679

1680 bool ToCompress = false;

1683};

1684

1685}

1686

1687using namespace sampleprof;

1688

1704

1705

1706

1707

1708

1709

1717

1718

1719 llvm::APInt IntHash(128, Str.str(), 16);

1720 return toString(IntHash, 10, false)

1722}

1723

1724}

1725

1726#endif

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

This file defines the BumpPtrAllocator interface.

static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")

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

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")

This file defines the DenseSet and SmallDenseSet classes.

Provides ErrorOr smart pointer.

Defines HashKeyMap template.

static cl::opt< unsigned > ColdCountThreshold("mfs-count-threshold", cl::desc("Minimum number of times a block must be executed to be retained."), cl::init(1), cl::Hidden)

This file implements a map that provides insertion order iteration.

Defines FunctionId class.

This file defines the SmallVector class.

Class for arbitrary precision integers.

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

ArrayRef< T > take_front(size_t N=1) const

Return a copy of *this with only the first N elements.

size_t size() const

size - Get the array size.

ArrayRef< T > drop_back(size_t N=1) const

Drop the last N elements of the array.

ValueT lookup(const_arg_type_t< KeyT > Val) const

lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...

Implements a dense probed hash-table based set.

Represents either an error or a value T.

static LLVM_ABI GUID getGUIDAssumingExternalLinkage(StringRef GlobalName)

Return a 64-bit global unique ID constructed from the name of a global symbol.

LLVM_ABI void update(ArrayRef< uint8_t > Data)

Updates the hash for the byte stream provided.

static LLVM_ABI void stringifyResult(MD5Result &Result, SmallVectorImpl< char > &Str)

Translates the bytes in Res to a hex string that is deposited into Str.

LLVM_ABI void final(MD5Result &Result)

Finishes off the hash and puts the result in result.

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

SmallString - A SmallString is just a SmallVector with methods and accessors that make it work better...

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.

std::pair< StringRef, StringRef > split(char Separator) const

Split into two substrings around the first occurrence of a separator character.

static constexpr size_t npos

constexpr StringRef substr(size_t Start, size_t N=npos) const

Return a reference to the substring from [Start, Start + N).

bool starts_with(StringRef Prefix) const

Check if this string starts with the given Prefix.

constexpr bool empty() const

empty - Check if the string is empty.

constexpr size_t size() const

size - Get the string size.

size_t rfind(char C, size_t From=npos) const

Search for the last character C in the string.

Target - Wrapper for Target specific information.

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

std::pair< iterator, bool > insert(const ValueT &V)

An opaque object representing a hash code.

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

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

uint64_t getHashCode() const

Get hash code of this object.

Representation of the samples collected for a function.

Definition SampleProf.h:777

void setTotalSamples(uint64_t Num)

Definition SampleProf.h:799

static LLVM_ABI bool ProfileIsPreInlined

Definition SampleProf.h:1306

void setContextAttribute(ContextAttributeMask Attr)

Definition SampleProf.h:893

void findInlinedFunctions(DenseSet< GlobalValue::GUID > &S, const HashKeyMap< std::unordered_map, FunctionId, Function * > &SymbolMap, uint64_t Threshold) const

Recursively traverses all children, if the total sample count of the corresponding function is no les...

Definition SampleProf.h:1151

bool operator!=(const FunctionSamples &Other) const

Definition SampleProf.h:1346

void updateTotalSamples()

Definition SampleProf.h:868

void setHeadSamples(uint64_t Num)

Definition SampleProf.h:801

LLVM_ABI const FunctionSamples * findFunctionSamplesAt(const LineLocation &Loc, StringRef CalleeName, SampleProfileReaderItaniumRemapper *Remapper, const HashKeyMap< std::unordered_map, FunctionId, FunctionId > *FuncNameToProfNameMap=nullptr) const

Returns a pointer to FunctionSamples at the given callsite location Loc with callee CalleeName.

sampleprof_error addTotalSamples(uint64_t Num, uint64_t Weight=1)

Definition SampleProf.h:784

static constexpr const char * UniqSuffix

Definition SampleProf.h:1210

void updateCallsiteSamples()

Definition SampleProf.h:855

static StringRef getCanonicalFnName(StringRef FnName, StringRef Attr="selected")

Definition SampleProf.h:1212

sampleprof_error addTypeSamplesAt(const LineLocation &Loc, FunctionId Type, uint64_t Count)

At location Loc, add a type sample for the given Type with Count.

Definition SampleProf.h:1049

bool operator==(const FunctionSamples &Other) const

Definition SampleProf.h:1335

static constexpr const char * PartSuffix

Definition SampleProf.h:1209

static uint64_t getCallSiteHash(FunctionId Callee, const LineLocation &Callsite)

Returns a unique hash code for a combination of a callsite location and the callee function name.

Definition SampleProf.h:1279

const FunctionSamplesMap * findFunctionSamplesMapAt(const LineLocation &Loc) const

Returns the FunctionSamplesMap at the given Loc.

Definition SampleProf.h:955

void removeAllCallsiteSamples()

Definition SampleProf.h:850

uint64_t getMaxCountInside(bool SkipCallSite=false) const

Return the maximum of sample counts in a function body.

Definition SampleProf.h:1090

void removeTotalSamples(uint64_t Num)

Definition SampleProf.h:792

uint64_t getHeadSamples() const

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

Definition SampleProf.h:993

void setFunction(FunctionId NewFunctionID)

Set the name of the function.

Definition SampleProf.h:1179

ErrorOr< uint64_t > findSamplesAt(uint32_t LineOffset, uint32_t Discriminator) const

Return the number of samples collected at the given location.

Definition SampleProf.h:917

static LLVM_ABI bool ProfileIsCS

Definition SampleProf.h:1304

ErrorOr< const SampleRecord::CallTargetMap & > findCallTargetMapAt(const LineLocation &CallSite) const

Returns the call target map collected at a given location specified by CallSite.

Definition SampleProf.h:941

const LineLocation & mapIRLocToProfileLoc(const LineLocation &IRLoc) const

Definition SampleProf.h:903

static StringRef getCanonicalFnName(StringRef FnName, ArrayRef< StringRef > Suffixes, StringRef Attr="selected")

Definition SampleProf.h:1222

FunctionId getFunction() const

Return the function name.

Definition SampleProf.h:1184

uint64_t getFunctionHash() const

Definition SampleProf.h:1191

const CallsiteTypeMap & getCallsiteTypeCounts() const

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

Definition SampleProf.h:1033

sampleprof_error addCallsiteVTableTypeProfAt(const LineLocation &Loc, const T &Other, uint64_t Weight=1)

Scale Other sample counts by Weight and add the scaled result to the type samples for Loc.

Definition SampleProf.h:1064

static constexpr const char * LLVMSuffix

Name suffixes which canonicalization should handle to avoid profile mismatch.

Definition SampleProf.h:1208

StringRef getFuncName(FunctionId Func) const

Translate Func into its original name.

Definition SampleProf.h:1256

const TypeCountMap * findCallsiteTypeSamplesAt(const LineLocation &Loc) const

Returns the TypeCountMap for inlined callsites at the given Loc.

Definition SampleProf.h:963

sampleprof_error addHeadSamples(uint64_t Num, uint64_t Weight=1)

Definition SampleProf.h:803

sampleprof_error addSampleRecord(LineLocation Location, const SampleRecord &SampleRecord, uint64_t Weight=1)

Definition SampleProf.h:826

uint64_t removeCalledTargetAndBodySample(uint32_t LineOffset, uint32_t Discriminator, FunctionId Func)

Definition SampleProf.h:834

DenseMap< uint64_t, StringRef > * GUIDToFuncNameMap

GUIDToFuncNameMap saves the mapping from GUID to the symbol name, for all the function symbols define...

Definition SampleProf.h:1323

sampleprof_error addCalledTargetSamples(uint32_t LineOffset, uint32_t Discriminator, FunctionId Func, uint64_t Num, uint64_t Weight=1)

Definition SampleProf.h:817

FunctionSamplesMap & functionSamplesAt(const LineLocation &Loc)

Return the function samples at the given callsite location.

Definition SampleProf.h:949

bool empty() const

Definition SampleProf.h:982

LLVM_ABI const FunctionSamples * findFunctionSamples(const DILocation *DIL, SampleProfileReaderItaniumRemapper *Remapper=nullptr, const HashKeyMap< std::unordered_map, FunctionId, FunctionId > *FuncNameToProfNameMap=nullptr) const

Get the FunctionSamples of the inline instance where DIL originates from.

static LLVM_ABI bool ProfileIsProbeBased

Definition SampleProf.h:1302

void setIRToProfileLocationMap(const LocToLocMap *LTLM)

Definition SampleProf.h:1193

static StringRef getCanonicalFnName(const Function &F)

Return the canonical name for a function, taking into account suffix elision policy attributes.

Definition SampleProf.h:1200

StringRef getFuncName() const

Return the original function name.

Definition SampleProf.h:1187

LLVM_ABI void findAllNames(DenseSet< FunctionId > &NameSet) const

sampleprof_error addBodySamples(uint32_t LineOffset, uint32_t Discriminator, uint64_t Num, uint64_t Weight=1)

Definition SampleProf.h:811

static LLVM_ABI unsigned getOffset(const DILocation *DIL)

Returns the line offset to the start line of the subprogram.

void setContextSynthetic()

Definition SampleProf.h:882

void setFunctionHash(uint64_t Hash)

Definition SampleProf.h:1189

static LLVM_ABI bool ProfileIsFS

If this profile uses flow sensitive discriminators.

Definition SampleProf.h:1319

ErrorOr< const SampleRecord::CallTargetMap & > findCallTargetMapAt(uint32_t LineOffset, uint32_t Discriminator) const

Returns the call target map collected at a given location.

Definition SampleProf.h:930

SampleContext & getContext() const

Definition SampleProf.h:1308

static LLVM_ABI bool HasUniqSuffix

Whether the profile contains any ".__uniq." suffix in a name.

Definition SampleProf.h:1316

uint64_t getTotalSamples() const

Return the total number of samples collected inside the function.

Definition SampleProf.h:985

LLVM_ABI void print(raw_ostream &OS=dbgs(), unsigned Indent=0) const

Print the samples collected for a function on stream OS.

sampleprof_error merge(const FunctionSamples &Other, uint64_t Weight=1)

Merge the samples in Other into this one.

Definition SampleProf.h:1104

FunctionSamples()=default

const CallsiteSampleMap & getCallsiteSamples() const

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

Definition SampleProf.h:1027

LLVM_ABI void dump() const

void setContext(const SampleContext &FContext)

Definition SampleProf.h:1310

static LLVM_ABI LineLocation getCallSiteIdentifier(const DILocation *DIL, bool ProfileIsFS=false)

Returns a unique call site identifier for a given debug location of a call instruction.

uint64_t getHeadSamplesEstimate() const

Return an estimate of the sample count of the function entry basic block.

Definition SampleProf.h:1000

uint64_t getGUID() const

Return the GUID of the context's name.

Definition SampleProf.h:1327

TypeCountMap & getTypeSamplesAt(const LineLocation &Loc)

Returns the vtable access samples for the C++ types for Loc.

Definition SampleProf.h:1040

const BodySampleMap & getBodySamples() const

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

Definition SampleProf.h:1024

static LLVM_ABI bool UseMD5

Whether the profile uses MD5 to represent string.

Definition SampleProf.h:1313

This class is a wrapper to associative container MapT<KeyT, ValueT> using the hash value of the origi...

FunctionSamples mapped_type

std::pair< iterator, bool > try_emplace(const key_type &Hash, const original_key_type &Key, Ts &&...Args)

typename base_type::iterator iterator

decltype(hash_value(SampleContext())) key_type

size_t erase(const original_key_type &Ctx)

iterator find(const original_key_type &Key)

typename base_type::const_iterator const_iterator

LLVM_ABI ProfileConverter(SampleProfileMap &Profiles)

LLVM_ABI void convertCSProfiles()

static void flattenProfile(SampleProfileMap &ProfileMap, bool ProfileIsCS=false)

Definition SampleProf.h:1558

static void flattenProfile(const SampleProfileMap &InputProfiles, SampleProfileMap &OutputProfiles, bool ProfileIsCS=false)

Definition SampleProf.h:1565

ProfileSymbolList records the list of function symbols shown up in the binary used to generate the pr...

Definition SampleProf.h:1647

void setToCompress(bool TC)

Definition SampleProf.h:1669

void add(StringRef Name, bool Copy=false)

copy indicates whether we need to copy the underlying memory for the input Name.

Definition SampleProf.h:1651

bool toCompress()

Definition SampleProf.h:1670

LLVM_ABI std::error_code write(raw_ostream &OS)

void reserve(size_t Size)

Definition SampleProf.h:1667

LLVM_ABI void dump(raw_ostream &OS=dbgs()) const

void merge(const ProfileSymbolList &List)

Definition SampleProf.h:1661

bool contains(StringRef Name)

Definition SampleProf.h:1659

unsigned size()

Definition SampleProf.h:1666

LLVM_ABI std::error_code read(const uint8_t *Data, uint64_t ListSize)

SampleContextTrimmer(SampleProfileMap &Profiles)

Definition SampleProf.h:1511

LLVM_ABI void trimAndMergeColdContextProfiles(uint64_t ColdCountThreshold, bool TrimColdContext, bool MergeColdContext, uint32_t ColdContextFrameLength, bool TrimBaseProfileOnly)

Definition SampleProf.h:554

static void createCtxVectorFromStr(StringRef ContextStr, SampleContextFrameVector &Context)

Create a context vector from a given context string and save it in Context.

Definition SampleProf.h:597

bool operator==(const SampleContext &That) const

Definition SampleProf.h:691

void setFunction(FunctionId NewFunctionID)

Set the name of the function and clear the current context.

Definition SampleProf.h:677

SampleContext(SampleContextFrames Context, ContextStateMask CState=RawContext)

Definition SampleProf.h:566

bool operator<(const SampleContext &That) const

Definition SampleProf.h:698

SampleContext(StringRef ContextStr, std::list< SampleContextFrameVector > &CSNameTable, ContextStateMask CState=RawContext)

Definition SampleProf.h:576

bool hasState(ContextStateMask S)

Definition SampleProf.h:643

bool hasContext() const

Definition SampleProf.h:646

void clearState(ContextStateMask S)

Definition SampleProf.h:645

SampleContextFrames getContextFrames() const

Definition SampleProf.h:649

SampleContext(FunctionId Func)

Definition SampleProf.h:563

bool isBaseContext() const

Definition SampleProf.h:647

static void decodeContextString(StringRef ContextStr, FunctionId &Func, LineLocation &LineLoc)

Definition SampleProf.h:616

static std::string getContextString(SampleContextFrames Context, bool IncludeLeafLineLocation=false)

Definition SampleProf.h:651

bool operator!=(const SampleContext &That) const

Definition SampleProf.h:696

void setState(ContextStateMask S)

Definition SampleProf.h:644

void setAllAttributes(uint32_t A)

Definition SampleProf.h:642

uint64_t getHashCode() const

Definition SampleProf.h:670

void setContext(SampleContextFrames Context, ContextStateMask CState=RawContext)

Definition SampleProf.h:683

FunctionId getFunction() const

Definition SampleProf.h:648

SampleContext()

Definition SampleProf.h:556

uint32_t getAllAttributes()

Definition SampleProf.h:641

void setAttribute(ContextAttributeMask A)

Definition SampleProf.h:640

bool hasAttribute(ContextAttributeMask A)

Definition SampleProf.h:639

std::string toString() const

Definition SampleProf.h:664

SampleContext(StringRef Name)

Definition SampleProf.h:558

bool isPrefixOf(const SampleContext &That) const

Definition SampleProf.h:727

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

Definition SampleProf.h:1446

iterator find(const SampleContext &Ctx)

Definition SampleProf.h:1457

mapped_type & create(const SampleContext &Ctx)

Definition SampleProf.h:1450

iterator erase(iterator It)

Definition SampleProf.h:1474

size_t erase(const key_type &Key)

Definition SampleProf.h:1472

const_iterator find(const SampleContext &Ctx) const

Definition SampleProf.h:1462

size_t erase(const SampleContext &Ctx)

Definition SampleProf.h:1467

SampleProfileReaderItaniumRemapper remaps the profile data from a sample profile data reader,...

Representation of a single sample record.

Definition SampleProf.h:350

std::unordered_map< FunctionId, uint64_t > CallTargetMap

Definition SampleProf.h:363

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.

LLVM_ABI void dump() const

bool hasCalls() const

Return true if this sample record contains function calls.

Definition SampleProf.h:415

LLVM_ABI sampleprof_error merge(const SampleRecord &Other, uint64_t Weight=1)

Merge the samples in Other into this record.

static const SortedCallTargetSet sortCallTargets(const CallTargetMap &Targets)

Sort call targets in descending order of call frequency.

Definition SampleProf.h:432

const CallTargetMap & getCallTargets() const

Definition SampleProf.h:418

std::set< CallTarget, CallTargetComparator > SortedCallTargetSet

Definition SampleProf.h:362

uint64_t getSamples() const

Definition SampleProf.h:417

uint64_t getCallTargetSum() const

Definition SampleProf.h:423

uint64_t removeSamples(uint64_t S)

Decrease the number of samples for this record by S.

Definition SampleProf.h:380

sampleprof_error addSamples(uint64_t S, uint64_t Weight=1)

Increment the number of samples for this record by S.

Definition SampleProf.h:371

uint64_t removeCalledTarget(FunctionId F)

Remove called function from the call target map.

Definition SampleProf.h:404

const SortedCallTargetSet getSortedCallTargets() const

Definition SampleProf.h:419

static const CallTargetMap adjustCallTargets(const CallTargetMap &Targets, float DistributionFactor)

Prorate call targets by a distribution factor.

Definition SampleProf.h:441

std::pair< FunctionId, uint64_t > CallTarget

Definition SampleProf.h:352

bool operator!=(const SampleRecord &Other) const

Definition SampleProf.h:466

bool operator==(const SampleRecord &Other) const

Definition SampleProf.h:462

LLVM_ABI void print(raw_ostream &OS, unsigned Indent) const

Print the sample record to the stream OS indented by Indent.

sampleprof_error addCalledTarget(FunctionId F, uint64_t S, uint64_t Weight=1)

Add called function F with samples S.

Definition SampleProf.h:392

std::pair< const LocationT, SampleT > SamplesWithLoc

Definition SampleProf.h:1489

SampleSorter(const std::map< LocationT, SampleT > &Samples)

Definition SampleProf.h:1492

const SamplesWithLocList & get() const

Definition SampleProf.h:1500

SmallVector< const SamplesWithLoc *, 20 > SamplesWithLocList

Definition SampleProf.h:1490

#define llvm_unreachable(msg)

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

@ C

The default llvm calling convention, compatible with C.

static FunctionId getRepInFormat(StringRef Name)

Get the proper representation of a string according to whether the current Format uses MD5 to represe...

Definition SampleProf.h:1432

static void verifySecFlag(SecType Type, SecFlagType Flag)

Definition SampleProf.h:229

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

static uint64_t SPMagic(SampleProfileFormat Format=SPF_Binary)

Definition SampleProf.h:111

SecCommonFlags

Definition SampleProf.h:174

@ SecFlagCompress

Definition SampleProf.h:176

@ SecFlagFlat

Definition SampleProf.h:178

@ SecFlagInValid

Definition SampleProf.h:175

SampleProfileFormat

Definition SampleProf.h:96

@ SPF_Binary

Definition SampleProf.h:102

@ SPF_Ext_Binary

Definition SampleProf.h:101

@ SPF_GCC

Definition SampleProf.h:100

@ SPF_None

Definition SampleProf.h:97

@ SPF_Compact_Binary

Definition SampleProf.h:99

@ SPF_Text

Definition SampleProf.h:98

static void addSecFlag(SecHdrTableEntry &Entry, SecFlagType Flag)

Definition SampleProf.h:256

std::map< LineLocation, FunctionSamplesMap > CallsiteSampleMap

Definition SampleProf.h:767

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

Definition SampleProf.h:272

ContextStateMask

Definition SampleProf.h:478

@ InlinedContext

Definition SampleProf.h:482

@ RawContext

Definition SampleProf.h:480

@ MergedContext

Definition SampleProf.h:483

@ UnknownContext

Definition SampleProf.h:479

@ SyntheticContext

Definition SampleProf.h:481

ArrayRef< SampleContextFrame > SampleContextFrames

Definition SampleProf.h:536

SecNameTableFlags

Definition SampleProf.h:184

@ SecFlagMD5Name

Definition SampleProf.h:186

@ SecFlagUniqSuffix

Definition SampleProf.h:192

@ SecFlagFixedLengthMD5

Definition SampleProf.h:189

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

Definition SampleProf.h:1477

ContextAttributeMask

Definition SampleProf.h:487

@ ContextNone

Definition SampleProf.h:488

@ ContextDuplicatedIntoBase

Definition SampleProf.h:491

@ ContextWasInlined

Definition SampleProf.h:489

@ ContextShouldBeInlined

Definition SampleProf.h:490

SecProfSummaryFlags

Definition SampleProf.h:194

@ SecFlagIsPreInlined

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

Definition SampleProf.h:208

@ SecFlagHasVTableTypeProf

SecFlagHasVTableTypeProf means this profile contains vtable type profiles.

Definition SampleProf.h:211

@ SecFlagPartial

SecFlagPartial means the profile is for common/shared code.

Definition SampleProf.h:199

@ SecFlagFSDiscriminator

SecFlagFSDiscriminator means this profile uses flow-sensitive discriminators.

Definition SampleProf.h:205

@ SecFlagFullContext

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

Definition SampleProf.h:202

static void removeSecFlag(SecHdrTableEntry &Entry, SecFlagType Flag)

Definition SampleProf.h:264

SmallVector< SampleContextFrame, 1 > SampleContextFrameVector

Definition SampleProf.h:535

std::map< FunctionId, FunctionSamples > FunctionSamplesMap

Definition SampleProf.h:766

SecFuncOffsetFlags

Definition SampleProf.h:220

@ SecFlagOrdered

Definition SampleProf.h:224

std::unordered_map< LineLocation, LineLocation, LineLocationHash > LocToLocMap

Definition SampleProf.h:769

raw_ostream & operator<<(raw_ostream &OS, const FunctionId &Obj)

SecFuncMetadataFlags

Definition SampleProf.h:214

@ SecFlagHasAttribute

Definition SampleProf.h:217

@ SecFlagIsProbeBased

Definition SampleProf.h:216

@ SecFlagInvalid

Definition SampleProf.h:215

std::map< FunctionId, uint64_t > TypeCountMap

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

Definition SampleProf.h:330

static std::string getSecName(SecType Type)

Definition SampleProf.h:136

constexpr char kVTableProfPrefix[]

Definition SampleProf.h:94

uint64_t hash_value(const FunctionId &Obj)

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()

Definition SampleProf.h:118

std::map< LineLocation, TypeCountMap > CallsiteTypeMap

Definition SampleProf.h:768

std::map< LineLocation, SampleRecord > BodySampleMap

Definition SampleProf.h:763

SampleProfileLayout

Definition SampleProf.h:105

@ SPL_Flat

Definition SampleProf.h:108

@ SPL_None

Definition SampleProf.h:106

@ SPL_Nest

Definition SampleProf.h:107

SecType

Definition SampleProf.h:123

@ SecNameTable

Definition SampleProf.h:126

@ SecLBRProfile

Definition SampleProf.h:133

@ SecFuncProfileFirst

Definition SampleProf.h:132

@ SecProfSummary

Definition SampleProf.h:125

@ SecCSNameTable

Definition SampleProf.h:130

@ SecFuncMetadata

Definition SampleProf.h:129

@ SecProfileSymbolList

Definition SampleProf.h:127

@ SecFuncOffsetTable

Definition SampleProf.h:128

@ SecInValid

Definition SampleProf.h:124

This is an optimization pass for GlobalISel generic memory operations.

void stable_sort(R &&Range)

std::error_code make_error_code(BitcodeError E)

sampleprof_error mergeSampleProfErrors(sampleprof_error &Accumulator, sampleprof_error Result)

Definition SampleProf.h:72

sampleprof_error

Definition SampleProf.h:49

@ success

Definition SampleProf.h:50

@ illegal_line_offset

Definition SampleProf.h:65

@ counter_overflow

Definition SampleProf.h:60

@ not_implemented

Definition SampleProf.h:59

@ unsupported_writing_format

Definition SampleProf.h:57

@ truncated_name_table

Definition SampleProf.h:58

@ hash_mismatch

Definition SampleProf.h:64

@ ostream_seek_unsupported

Definition SampleProf.h:61

LLVM_ABI raw_ostream & dbgs()

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

FunctionAddr VTableAddr Count

std::enable_if_t< std::is_unsigned_v< T >, T > SaturatingMultiplyAdd(T X, T Y, T A, bool *ResultOverflowed=nullptr)

Multiply two unsigned integers, X and Y, and add the unsigned integer, A to the product.

LLVM_ATTRIBUTE_VISIBILITY_DEFAULT AnalysisKey InnerAnalysisManagerProxy< AnalysisManagerT, IRUnitT, ExtraArgTs... >::Key

LLVM_ABI const std::error_category & sampleprof_category()

FunctionAddr VTableAddr uintptr_t uintptr_t Data

std::string getUniqueInternalLinkagePostfix(const StringRef &FName)

Definition SampleProf.h:1710

std::string toString(const APInt &I, unsigned Radix, bool Signed, bool formatAsCLiteral=false, bool UpperCase=true, bool InsertSeparators=false)

BumpPtrAllocatorImpl<> BumpPtrAllocator

The standard BumpPtrAllocator which just uses the default template parameters.

LogicalResult success(bool IsSuccess=true)

Utility function to generate a LogicalResult.

hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)

Compute a hash_code for a sequence of values.

Implement std::hash so that hash_code can be used in STL containers.

static unsigned getHashValue(const SampleContext &Val)

Definition SampleProf.h:1696

static SampleContext getTombstoneKey()

Definition SampleProf.h:1692

static SampleContext getEmptyKey()

Definition SampleProf.h:1690

static bool isEqual(const SampleContext &LHS, const SampleContext &RHS)

Definition SampleProf.h:1700

An information struct used to provide DenseMap with the various necessary components for a given valu...

Definition SampleProf.h:318

uint64_t operator()(const LineLocation &Loc) const

Definition SampleProf.h:319

Represents the relative location of an instruction.

Definition SampleProf.h:288

LLVM_ABI void serialize(raw_ostream &OS) const

LLVM_ABI void print(raw_ostream &OS) const

LineLocation(uint32_t L, uint32_t D)

Definition SampleProf.h:289

bool operator!=(const LineLocation &O) const

Definition SampleProf.h:306

bool operator<(const LineLocation &O) const

Definition SampleProf.h:297

uint64_t getHashCode() const

Definition SampleProf.h:310

bool operator==(const LineLocation &O) const

Definition SampleProf.h:302

uint32_t LineOffset

Definition SampleProf.h:314

LLVM_ABI void dump() const

uint32_t Discriminator

Definition SampleProf.h:315

Definition SampleProf.h:1539

LineLocation CallSiteLoc

Definition SampleProf.h:1552

FunctionSamples * FuncSamples

Definition SampleProf.h:1550

FunctionId FuncName

Definition SampleProf.h:1548

FrameNode(FunctionId FName=FunctionId(), FunctionSamples *FSamples=nullptr, LineLocation CallLoc={0, 0})

Definition SampleProf.h:1540

LLVM_ABI FrameNode * getOrCreateChildFrame(const LineLocation &CallSite, FunctionId CalleeName)

std::map< uint64_t, FrameNode > AllChildFrames

Definition SampleProf.h:1546

Definition SampleProf.h:538

uint64_t operator()(const SampleContextFrameVector &S) const

Definition SampleProf.h:539

Definition SampleProf.h:496

bool operator==(const SampleContextFrame &That) const

Definition SampleProf.h:505

SampleContextFrame(FunctionId Func, LineLocation Location)

Definition SampleProf.h:502

SampleContextFrame()

Definition SampleProf.h:500

bool operator!=(const SampleContextFrame &That) const

Definition SampleProf.h:509

std::string toString(bool OutputLineLocation) const

Definition SampleProf.h:513

uint64_t getHashCode() const

Definition SampleProf.h:524

LineLocation Location

Definition SampleProf.h:498

FunctionId Func

Definition SampleProf.h:497

Definition SampleProf.h:721

uint64_t operator()(const SampleContext &Context) const

Definition SampleProf.h:722

Definition SampleProf.h:353

bool operator()(const CallTarget &LHS, const CallTarget &RHS) const

Definition SampleProf.h:354

Definition SampleProf.h:161

uint64_t Offset

Definition SampleProf.h:164

uint64_t Flags

Definition SampleProf.h:163

SecType Type

Definition SampleProf.h:162

uint64_t LayoutIndex

Definition SampleProf.h:168

uint64_t Size

Definition SampleProf.h:165