Lines Matching refs:BC

38   const BinaryContext &BC = StubBB.getFunction()->getBinaryContext();  in relaxStubToShortJmp()  local
40 BC.MIB->createShortJmp(Seq, Tgt, BC.Ctx.get()); in relaxStubToShortJmp()
46 const BinaryContext &BC = StubBB.getFunction()->getBinaryContext(); in relaxStubToLongJmp() local
48 BC.MIB->createLongJmp(Seq, Tgt, BC.Ctx.get()); in relaxStubToLongJmp()
68 bool shouldInsertStub(const BinaryContext &BC, const MCInst &Inst) { in shouldInsertStub() argument
69 return (BC.MIB->isBranch(Inst) || BC.MIB->isCall(Inst)) && in shouldInsertStub()
70 !BC.MIB->isIndirectBranch(Inst) && !BC.MIB->isIndirectCall(Inst); in shouldInsertStub()
79 const BinaryContext &BC = Func.getBinaryContext(); in createNewStub() local
81 MCSymbol *StubSym = BC.Ctx->createNamedTempSymbol("Stub"); in createNewStub()
84 BC.MIB->createUncondBranch(Inst, TgtSym, BC.Ctx.get()); in createNewStub()
86 BC.MIB->convertJmpToTailCall(Inst); in createNewStub()
104 StubBits[StubBB.get()] = BC.MIB->getUncondBranchEncodingSize(); in createNewStub()
123 const BinaryContext &BC = Func.getBinaryContext(); in lookupStubFromGroup() local
143 int BitsAvail = BC.MIB->getPCRelEncodingSize(Inst) - 1; in lookupStubFromGroup()
186 const BinaryContext &BC = Func.getBinaryContext(); in replaceTargetWithStub() local
188 const MCSymbol *TgtSym = BC.MIB->getTargetSymbol(Inst); in replaceTargetWithStub()
200 TgtSym = BC.MIB->getTargetSymbol(*SSIter->second->begin()); in replaceTargetWithStub()
207 TgtSym = BC.MIB->getTargetSymbol(*TgtBB->begin()); in replaceTargetWithStub()
250 BC.MIB->replaceBranchTarget(Inst, StubSymbol, BC.Ctx.get()); in replaceTargetWithStub()
273 const BinaryContext &BC = Func.getBinaryContext(); in tentativeBBLayout() local
281 ColdDot += BC.computeCodeSize(BB->begin(), BB->end()); in tentativeBBLayout()
284 HotDot += BC.computeCodeSize(BB->begin(), BB->end()); in tentativeBBLayout()
290 const BinaryContext &BC, std::vector<BinaryFunction *> &SortedFunctions, in tentativeLayoutRelocColdPart() argument
312 const BinaryContext &BC, std::vector<BinaryFunction *> &SortedFunctions, in tentativeLayoutRelocMode() argument
342 if (!BC.shouldEmit(*Func)) { in tentativeLayoutRelocMode()
349 tentativeLayoutRelocColdPart(BC, SortedFunctions, DotAddress); in tentativeLayoutRelocMode()
380 const BinaryContext &BC, std::vector<BinaryFunction *> &SortedFunctions) { in tentativeLayout() argument
381 uint64_t DotAddress = BC.LayoutStartAddress; in tentativeLayout()
383 if (!BC.HasRelocations) { in tentativeLayout()
399 EstimatedTextSize = tentativeLayoutRelocMode(BC, SortedFunctions, 0); in tentativeLayout()
402 if (EstimatedTextSize <= BC.OldTextSectionSize) { in tentativeLayout()
403 DotAddress = BC.OldTextSectionAddress; in tentativeLayout()
406 if (Pad + EstimatedTextSize <= BC.OldTextSectionSize) { in tentativeLayout()
412 if (!EstimatedTextSize || EstimatedTextSize > BC.OldTextSectionSize) in tentativeLayout()
413 DotAddress = alignTo(BC.LayoutStartAddress, opts::AlignText); in tentativeLayout()
415 tentativeLayoutRelocMode(BC, SortedFunctions, DotAddress); in tentativeLayout()
428 uint64_t LongJmpPass::getSymbolAddress(const BinaryContext &BC, in getSymbolAddress() argument
437 const BinaryFunction *TargetFunc = BC.getFunctionForSymbol(Target, &EntryID); in getSymbolAddress()
442 ErrorOr<uint64_t> ValueOrError = BC.getSymbolValue(*Target); in getSymbolAddress()
451 const BinaryContext &BC = Func.getBinaryContext(); in relaxStub() local
454 if (Bits == static_cast<int>(BC.AsmInfo->getCodePointerSize() * 8)) in relaxStub()
457 const static int RangeShortJmp = BC.MIB->getShortJmpEncodingSize(); in relaxStub()
458 const static int RangeSingleInstr = BC.MIB->getUncondBranchEncodingSize(); in relaxStub()
463 const MCSymbol *RealTargetSym = BC.MIB->getTargetSymbol(*StubBB.begin()); in relaxStub()
465 uint64_t TgtAddress = getSymbolAddress(BC, RealTargetSym, TgtBB); in relaxStub()
489 if (BC.isAArch64() && !BC.HasFixedLoadAddress) { in relaxStub()
498 StubBits[&StubBB] = static_cast<int>(BC.AsmInfo->getCodePointerSize() * 8); in relaxStub()
505 const BinaryContext &BC = Func.getBinaryContext(); in needsStub() local
506 const MCSymbol *TgtSym = BC.MIB->getTargetSymbol(Inst); in needsStub()
517 int BitsAvail = BC.MIB->getPCRelEncodingSize(Inst) - 1; in needsStub()
520 uint64_t PCRelTgtAddress = getSymbolAddress(BC, TgtSym, TgtBB); in needsStub()
528 const BinaryContext &BC = Func.getBinaryContext(); in relax() local
531 assert(BC.isAArch64() && "Unsupported arch"); in relax()
550 if (BC.MIB->isPseudo(Inst)) in relax()
553 if (!shouldInsertStub(BC, Inst)) { in relax()
569 if (Func.isSimple() && !BC.MIB->isCall(Inst) && FrontierAddress && in relax()
571 int BitsAvail = BC.MIB->getPCRelEncodingSize(Inst) - 1; in relax()
616 void LongJmpPass::runOnFunctions(BinaryContext &BC) { in runOnFunctions() argument
618 std::vector<BinaryFunction *> Sorted = BC.getSortedFunctions(); in runOnFunctions()
624 tentativeLayout(BC, Sorted); in runOnFunctions()