Lines Matching refs:Func
53 BinaryBasicBlock *getBBAtHotColdSplitPoint(BinaryFunction &Func) { in getBBAtHotColdSplitPoint() argument
54 if (!Func.isSplit() || Func.empty()) in getBBAtHotColdSplitPoint()
57 assert(!(*Func.begin()).isCold() && "Entry cannot be cold"); in getBBAtHotColdSplitPoint()
58 for (auto I = Func.getLayout().block_begin(), in getBBAtHotColdSplitPoint()
59 E = Func.getLayout().block_end(); in getBBAtHotColdSplitPoint()
78 BinaryFunction &Func = *SourceBB.getFunction(); in createNewStub() local
79 const BinaryContext &BC = Func.getBinaryContext(); in createNewStub()
82 std::unique_ptr<BinaryBasicBlock> StubBB = Func.createBasicBlock(StubSym); in createNewStub()
103 Stubs[&Func].insert(StubBB.get()); in createNewStub()
106 registerInMap(ColdLocalStubs[&Func]); in createNewStub()
111 registerInMap(HotLocalStubs[&Func]); in createNewStub()
121 const StubGroupsTy &StubGroups, const BinaryFunction &Func, in lookupStubFromGroup() argument
123 const BinaryContext &BC = Func.getBinaryContext(); in lookupStubFromGroup()
162 const BinaryFunction &Func = *SourceBB.getFunction(); in lookupGlobalStub() local
165 return lookupStubFromGroup(StubGroups, Func, Inst, TgtSym, DotAddress); in lookupGlobalStub()
172 const BinaryFunction &Func = *SourceBB.getFunction(); in lookupLocalStub() local
175 const auto Iter = StubGroups.find(&Func); in lookupLocalStub()
178 return lookupStubFromGroup(Iter->second, Func, Inst, TgtSym, DotAddress); in lookupLocalStub()
185 const BinaryFunction &Func = *BB.getFunction(); in replaceTargetWithStub() local
186 const BinaryContext &BC = Func.getBinaryContext(); in replaceTargetWithStub()
193 auto LocalStubsIter = Stubs.find(&Func); in replaceTargetWithStub()
272 void LongJmpPass::tentativeBBLayout(const BinaryFunction &Func) { in tentativeBBLayout() argument
273 const BinaryContext &BC = Func.getBinaryContext(); in tentativeBBLayout()
274 uint64_t HotDot = HotAddresses[&Func]; in tentativeBBLayout()
275 uint64_t ColdDot = ColdAddresses[&Func]; in tentativeBBLayout()
277 for (const BinaryBasicBlock *BB : Func.getLayout().blocks()) { in tentativeBBLayout()
293 for (BinaryFunction *Func : SortedFunctions) { in tentativeLayoutRelocColdPart()
294 if (!Func->isSplit()) in tentativeLayoutRelocColdPart()
298 offsetToAlignment(DotAddress, llvm::Align(Func->getAlignment())); in tentativeLayoutRelocColdPart()
299 if (Pad <= Func->getMaxColdAlignmentBytes()) in tentativeLayoutRelocColdPart()
301 ColdAddresses[Func] = DotAddress; in tentativeLayoutRelocColdPart()
302 LLVM_DEBUG(dbgs() << Func->getPrintName() << " cold tentative: " in tentativeLayoutRelocColdPart()
304 DotAddress += Func->estimateColdSize(); in tentativeLayoutRelocColdPart()
305 DotAddress = alignTo(DotAddress, Func->getConstantIslandAlignment()); in tentativeLayoutRelocColdPart()
306 DotAddress += Func->estimateConstantIslandSize(); in tentativeLayoutRelocColdPart()
341 for (BinaryFunction *Func : SortedFunctions) { in tentativeLayoutRelocMode()
342 if (!BC.shouldEmit(*Func)) { in tentativeLayoutRelocMode()
343 HotAddresses[Func] = Func->getAddress(); in tentativeLayoutRelocMode()
357 offsetToAlignment(DotAddress, llvm::Align(Func->getAlignment())); in tentativeLayoutRelocMode()
358 if (Pad <= Func->getMaxAlignmentBytes()) in tentativeLayoutRelocMode()
360 HotAddresses[Func] = DotAddress; in tentativeLayoutRelocMode()
361 LLVM_DEBUG(dbgs() << Func->getPrintName() << " tentative: " in tentativeLayoutRelocMode()
363 if (!Func->isSplit()) in tentativeLayoutRelocMode()
364 DotAddress += Func->estimateSize(); in tentativeLayoutRelocMode()
366 DotAddress += Func->estimateHotSize(); in tentativeLayoutRelocMode()
368 DotAddress = alignTo(DotAddress, Func->getConstantIslandAlignment()); in tentativeLayoutRelocMode()
369 DotAddress += Func->estimateConstantIslandSize(); in tentativeLayoutRelocMode()
373 for (BinaryFunction *Func : SortedFunctions) in tentativeLayoutRelocMode()
374 tentativeBBLayout(*Func); in tentativeLayoutRelocMode()
384 for (BinaryFunction *Func : SortedFunctions) { in tentativeLayout()
385 HotAddresses[Func] = Func->getAddress(); in tentativeLayout()
387 ColdAddresses[Func] = DotAddress; in tentativeLayout()
388 if (Func->isSplit()) in tentativeLayout()
389 DotAddress += Func->estimateColdSize(); in tentativeLayout()
390 tentativeBBLayout(*Func); in tentativeLayout()
418 bool LongJmpPass::usesStub(const BinaryFunction &Func, in usesStub() argument
420 const MCSymbol *TgtSym = Func.getBinaryContext().MIB->getTargetSymbol(Inst); in usesStub()
421 const BinaryBasicBlock *TgtBB = Func.getBasicBlockForLabel(TgtSym); in usesStub()
422 auto Iter = Stubs.find(&Func); in usesStub()
450 const BinaryFunction &Func = *StubBB.getFunction(); in relaxStub() local
451 const BinaryContext &BC = Func.getBinaryContext(); in relaxStub()
464 const BinaryBasicBlock *TgtBB = Func.getBasicBlockForLabel(RealTargetSym); in relaxStub()
504 const BinaryFunction &Func = *BB.getFunction(); in needsStub() local
505 const BinaryContext &BC = Func.getBinaryContext(); in needsStub()
509 const BinaryBasicBlock *TgtBB = Func.getBasicBlockForLabel(TgtSym); in needsStub()
527 bool LongJmpPass::relax(BinaryFunction &Func) { in relax() argument
528 const BinaryContext &BC = Func.getBinaryContext(); in relax()
536 BinaryBasicBlock *Frontier = getBBAtHotColdSplitPoint(Func); in relax()
543 for (BinaryBasicBlock &BB : Func) { in relax()
546 if (Stubs[&Func].count(&BB)) in relax()
569 if (Func.isSimple() && !BC.MIB->isCall(Inst) && FrontierAddress && in relax()
582 if (!Func.isSimple()) in relax()
583 InsertionPoint = &*std::prev(Func.end()); in relax()
597 for (BinaryBasicBlock &BB : Func) { in relax()
598 if (!Stubs[&Func].count(&BB) || !BB.isValid()) in relax()
610 Func.insertBasicBlocks(Elmt.first, std::move(NewBBs), true); in relax()
626 for (BinaryFunction *Func : Sorted) { in runOnFunctions()
627 if (relax(*Func)) { in runOnFunctions()
630 if (Func->isSimple()) in runOnFunctions()
631 Func->fixBranches(); in runOnFunctions()