Lines Matching defs:BC
322 Error NormalizeCFG::runOnFunctions(BinaryContext &BC) {
324 BC, ParallelUtilities::SchedulingPolicy::SP_BB_LINEAR,
329 BC.outs() << "BOLT-INFO: removed " << NumBlocksRemoved << " empty block"
332 BC.outs() << "BOLT-INFO: merged " << NumDuplicateEdgesMerged
339 BinaryContext &BC = Function.getBinaryContext();
353 BC.createIndependentMCCodeEmitter();
358 auto L = BC.scopeLock();
361 BC.outs() << "BOLT-INFO: removed " << Count
367 Error EliminateUnreachableBlocks::runOnFunctions(BinaryContext &BC) {
377 BC, ParallelUtilities::SchedulingPolicy::SP_CONSTANT, WorkFun,
381 BC.outs() << "BOLT-INFO: UCE removed " << DeletedBlocks << " blocks and "
399 Error ReorderBasicBlocks::runOnFunctions(BinaryContext &BC) {
429 BC, ParallelUtilities::SchedulingPolicy::SP_BB_LINEAR, WorkFun, SkipFunc,
432 BC.NumProfiledFuncs + BC.NumStaleProfileFuncs;
434 BC.outs() << "BOLT-INFO: basic block reordering modified layout of "
441 BC.getBinaryFunctions().size());
444 raw_ostream &OS = BC.outs();
447 auto &BFs = BC.getBinaryFunctions();
538 Error FixupBranches::runOnFunctions(BinaryContext &BC) {
539 for (auto &It : BC.getBinaryFunctions()) {
541 if (!BC.shouldEmit(Function) || !Function.isSimple())
549 Error FinalizeFunctions::runOnFunctions(BinaryContext &BC) {
553 if (BC.HasRelocations) {
554 BC.errs() << "BOLT-ERROR: unable to fix CFI state for function " << BF
570 return !BC.shouldEmit(BF);
574 BC, ParallelUtilities::SchedulingPolicy::SP_CONSTANT, WorkFun,
581 Error CheckLargeFunctions::runOnFunctions(BinaryContext &BC) {
582 if (BC.HasRelocations)
590 BC.calculateEmittedSize(BF, /*FixBranches=*/false);
600 BC.outs() << "BOLT-INFO: " << BF << " size of " << MainFragmentSize
612 BC, ParallelUtilities::SchedulingPolicy::SP_INST_LINEAR, WorkFun,
623 Error LowerAnnotations::runOnFunctions(BinaryContext &BC) {
625 for (BinaryFunction *BF : BC.getAllBinaryFunctions()) {
632 if (!BF->usesGnuArgsSize() || !BC.MIB->isInvoke(*II))
635 const int64_t NewGnuArgsSize = BC.MIB->getGnuArgsSize(*II);
656 Error CleanMCState::runOnFunctions(BinaryContext &BC) {
657 MCContext &Ctx = *BC.Ctx;
1028 Error SimplifyConditionalTailCalls::runOnFunctions(BinaryContext &BC) {
1029 if (!BC.isX86())
1032 for (auto &It : BC.getBinaryFunctions()) {
1045 BC.outs() << "BOLT-INFO: SCTC: patched " << NumTailCallsPatched
1060 const BinaryContext &BC = Function.getBinaryContext();
1064 if (BC.MIB->getSize(Inst))
1071 if (!BC.MIB->shortenInstruction(Inst, *BC.STI))
1075 BC.scopeLock();
1076 BC.outs() << "BOLT-INFO: shortening:\nBOLT-INFO: ";
1077 BC.printInstruction(BC.outs(), OriginalInst, 0, &Function);
1078 BC.outs() << "BOLT-INFO: to:";
1079 BC.printInstruction(BC.outs(), Inst, 0, &Function);
1089 Error ShortenInstructions::runOnFunctions(BinaryContext &BC) {
1091 if (!BC.isX86())
1095 BC, ParallelUtilities::SchedulingPolicy::SP_INST_LINEAR,
1100 BC.outs() << "BOLT-INFO: " << NumShortened
1144 Error Peepholes::runOnFunctions(BinaryContext &BC) {
1151 for (auto &It : BC.getBinaryFunctions()) {
1163 BC.outs() << "BOLT-INFO: Peephole: " << NumDoubleJumps
1173 BinaryContext &BC = BF.getBinaryContext();
1174 MCPlusBuilder *MIB = BC.MIB.get();
1184 const MCInstrDesc &Desc = BC.MII->get(Opcode);
1212 BinaryData *BD = BC.getBinaryDataByName(DisplSymbol->getName());
1223 BC.getSectionForAddress(TargetAddress);
1227 if (BC.getRelocationAt(TargetAddress) ||
1228 BC.getDynamicRelocationAt(TargetAddress))
1254 Error SimplifyRODataLoads::runOnFunctions(BinaryContext &BC) {
1255 for (auto &It : BC.getBinaryFunctions()) {
1261 BC.outs() << "BOLT-INFO: simplified " << NumLoadsSimplified << " out of "
1270 Error AssignSections::runOnFunctions(BinaryContext &BC) {
1271 for (BinaryFunction *Function : BC.getInjectedBinaryFunctions()) {
1272 Function->setCodeSectionName(BC.getInjectedCodeSectionName());
1273 Function->setColdCodeSectionName(BC.getInjectedColdCodeSectionName());
1277 if (!BC.HasRelocations)
1281 BC.NumProfiledFuncs > 0 ||
1283 for (auto &BFI : BC.getBinaryFunctions()) {
1286 Function.setCodeSectionName(BC.getHotTextMoverSectionName());
1287 Function.setColdCodeSectionName(BC.getHotTextMoverSectionName());
1292 Function.setCodeSectionName(BC.getMainCodeSectionName());
1294 Function.setCodeSectionName(BC.getColdCodeSectionName());
1297 Function.setColdCodeSectionName(BC.getColdCodeSectionName());
1302 Error PrintProfileStats::runOnFunctions(BinaryContext &BC) {
1316 for (const auto &BFI : BC.getBinaryFunctions()) {
1365 for (const auto &BFI : BC.getBinaryFunctions()) {
1386 BC.outs() << format("BOLT-INFO: Profile bias score: %.4lf%% StDev: %.4lf%%\n",
1389 BC.outs() << "Worst average bias observed in "
1396 Error PrintProgramStats::runOnFunctions(BinaryContext &BC) {
1409 for (auto &BFI : BC.getBinaryFunctions()) {
1438 BC.errs() << "function with unknown control flow: " << Function << '\n';
1458 BC.outs() << StaleFuncsHeader;
1460 BC.outs() << " " << Function << '\n';
1477 LLVM_DEBUG(BC.outs() << Function << ": executed bytes "
1483 BC.NumProfiledFuncs = ProfiledFunctions.size();
1484 BC.NumStaleProfileFuncs = NumStaleProfileFunctions;
1488 BC.outs() << "BOLT-INFO: " << NumAllProfiledFunctions << " out of "
1494 BC.outs() << "BOLT-INFO: " << NumNonSimpleProfiledFunctions << " function"
1502 (float)BC.Stats.NumStaleFuncsWithEqualBlockCount /
1505 (float)BC.Stats.NumStaleBlocksWithEqualIcount /
1506 BC.Stats.NumStaleBlocks * 100.0f;
1509 BC.errs() << "BOLT-ERROR: ";
1511 BC.errs() << "BOLT-WARNING: ";
1514 BC.errs() << NumAllStaleFunctions
1521 BC.errs() << (StaleSampleCount + InferredSampleCount) << " out of "
1529 BC.outs() << "BOLT-INFO: " << BC.Stats.NumStaleFuncsWithEqualBlockCount
1531 << (BC.Stats.NumStaleFuncsWithEqualBlockCount == 1 ? "" : "s")
1535 BC.outs() << "BOLT-INFO: " << BC.Stats.NumStaleBlocksWithEqualIcount
1537 << (BC.Stats.NumStaleBlocksWithEqualIcount == 1 ? "" : "s")
1547 BC.outs() << format(
1556 BC.outs() << format(
1560 100.0 * BC.Stats.NumExactMatchedBlocks / BC.Stats.NumStaleBlocks,
1561 BC.Stats.NumExactMatchedBlocks, BC.Stats.NumStaleBlocks,
1562 100.0 * BC.Stats.ExactMatchedSampleCount / BC.Stats.StaleSampleCount,
1563 BC.Stats.ExactMatchedSampleCount, BC.Stats.StaleSampleCount);
1564 BC.outs() << format(
1568 100.0 * BC.Stats.NumPseudoProbeExactMatchedBlocks /
1569 BC.Stats.NumStaleBlocks,
1570 BC.Stats.NumPseudoProbeExactMatchedBlocks, BC.Stats.NumStaleBlocks,
1571 100.0 * BC.Stats.PseudoProbeExactMatchedSampleCount /
1572 BC.Stats.StaleSampleCount,
1573 BC.Stats.PseudoProbeExactMatchedSampleCount, BC.Stats.StaleSampleCount);
1574 BC.outs() << format(
1578 100.0 * BC.Stats.NumPseudoProbeLooseMatchedBlocks /
1579 BC.Stats.NumStaleBlocks,
1580 BC.Stats.NumPseudoProbeLooseMatchedBlocks, BC.Stats.NumStaleBlocks,
1581 100.0 * BC.Stats.PseudoProbeLooseMatchedSampleCount /
1582 BC.Stats.StaleSampleCount,
1583 BC.Stats.PseudoProbeLooseMatchedSampleCount, BC.Stats.StaleSampleCount);
1584 BC.outs() << format(
1589 100.0 * BC.Stats.NumCallMatchedBlocks / BC.Stats.NumStaleBlocks,
1590 BC.Stats.NumCallMatchedBlocks, BC.Stats.NumStaleBlocks,
1591 100.0 * BC.Stats.CallMatchedSampleCount / BC.Stats.StaleSampleCount,
1592 BC.Stats.CallMatchedSampleCount, BC.Stats.StaleSampleCount);
1593 BC.outs() << format(
1598 100.0 * BC.Stats.NumLooseMatchedBlocks / BC.Stats.NumStaleBlocks,
1599 BC.Stats.NumLooseMatchedBlocks, BC.Stats.NumStaleBlocks,
1600 100.0 * BC.Stats.LooseMatchedSampleCount / BC.Stats.StaleSampleCount,
1601 BC.Stats.LooseMatchedSampleCount, BC.Stats.StaleSampleCount);
1604 if (const uint64_t NumUnusedObjects = BC.getNumUnusedProfiledObjects()) {
1605 BC.outs() << "BOLT-INFO: profile for " << NumUnusedObjects
1611 BC.outs() << "BOLT-INFO: top called functions are:\n";
1620 BC.outs() << " " << **SFI << " : " << (*SFI)->getExecutionCount()
1629 for (auto &BFI : BC.getBinaryFunctions()) {
1666 BC.outs() << "BOLT-INFO: top functions sorted by ";
1668 BC.outs() << "dyno stats";
1670 BC.outs() << "(";
1674 BC.outs() << ", ";
1675 BC.outs() << DynoStats::Description(Category);
1678 BC.outs() << ")";
1681 BC.outs() << " are:\n";
1685 BC.outs() << " " << **SFI;
1687 BC.outs() << " (";
1691 BC.outs() << ", ";
1692 BC.outs() << dynoStatsOptName(Category) << "=" << Stats[Category];
1695 BC.outs() << ")";
1697 BC.outs() << "\n";
1701 if (!BC.TrappedFunctions.empty()) {
1702 BC.errs() << "BOLT-WARNING: " << BC.TrappedFunctions.size() << " function"
1703 << (BC.TrappedFunctions.size() > 1 ? "s" : "")
1706 if (opts::Verbosity >= 1 || BC.TrappedFunctions.size() <= 5) {
1707 BC.errs() << '\n';
1708 for (const BinaryFunction *Function : BC.TrappedFunctions)
1709 BC.errs() << " " << *Function << '\n';
1711 BC.errs() << " Use -v=1 to see the list.\n";
1718 for (auto &BFI : BC.getBinaryFunctions()) {
1745 BC.outs() << "BOLT-INFO: " << SuboptimalFuncs.size()
1752 SuboptimalFuncs[I]->print(BC.outs());
1757 BC.outs() << "BOLT-INFO: " << NumUnknownControlFlowFunctions
1760 BC.outs() << ". Use -print-unknown to see the list.";
1761 BC.outs() << '\n';
1789 BC.errs() << "BOLT-WARNING: the output profile is empty or the "
1793 BC.errs()
1800 BC.outs() << "BOLT-INFO: Functions with density >= "
1810 Error InstructionLowering::runOnFunctions(BinaryContext &BC) {
1811 for (auto &BFI : BC.getBinaryFunctions())
1814 BC.MIB->lowerTailCall(Instruction);
1818 Error StripRepRet::runOnFunctions(BinaryContext &BC) {
1819 if (!BC.isX86())
1824 for (auto &BFI : BC.getBinaryFunctions()) {
1827 if (LastInstRIter == BB.rend() || !BC.MIB->isReturn(*LastInstRIter) ||
1828 !BC.MIB->deleteREPPrefix(*LastInstRIter))
1837 BC.outs() << "BOLT-INFO: removed " << NumBytesSaved
1844 Error InlineMemcpy::runOnFunctions(BinaryContext &BC) {
1845 if (!BC.isX86())
1850 for (auto &BFI : BC.getBinaryFunctions()) {
1855 if (!BC.MIB->isCall(Inst) || MCPlus::getNumPrimeOperands(Inst) != 1 ||
1859 const MCSymbol *CalleeSymbol = BC.MIB->getTargetSymbol(Inst);
1866 const bool IsTailCall = BC.MIB->isTailCall(Inst);
1869 BC.MIB->createInlineMemcpy(IsMemcpy8);
1874 BC.MIB->createReturn(Return);
1885 BC.outs() << "BOLT-INFO: inlined " << NumInlined << " memcpy() calls";
1887 BC.outs() << ". The calls were executed " << NumInlinedDyno
1889 BC.outs() << '\n';
1932 Error SpecializeMemcpy1::runOnFunctions(BinaryContext &BC) {
1933 if (!BC.isX86())
1938 for (auto &BFI : BC.getBinaryFunctions()) {
1954 if (!BC.MIB->isCall(Inst) || MCPlus::getNumPrimeOperands(Inst) != 1 ||
1958 const MCSymbol *CalleeSymbol = BC.MIB->getTargetSymbol(Inst);
1963 if (BC.MIB->isTailCall(Inst))
1989 BC.MIB->createCmpJE(BC.MIB->getIntArgRegister(2), 1,
1990 OneByteMemcpyBB->getLabel(), BC.Ctx.get());
2004 InstructionListType OneByteMemcpy = BC.MIB->createOneByteMemcpy();
2019 BC.outs() << "BOLT-INFO: specialized " << NumSpecialized
2022 BC.outs() << ". The calls were executed " << NumSpecializedDyno
2024 BC.outs() << '\n';
2030 const BinaryContext &BC = BF.getBinaryContext();
2034 if (BC.MIB->isNoop(Inst) && BC.MIB->hasAnnotation(Inst, "NOP"))
2040 Error RemoveNops::runOnFunctions(BinaryContext &BC) {
2050 BC, ParallelUtilities::SchedulingPolicy::SP_INST_LINEAR, WorkFun,