Lines Matching refs:BF

377 BinaryContext::handleAddressRef(uint64_t Address, BinaryFunction &BF,  in handleAddressRef()  argument
384 if (MCSymbol *IslandSym = BF.getOrCreateIslandAccess(Address)) in handleAddressRef()
394 IslandIter->second->getOrCreateProxyIslandAccess(Address, BF)) { in handleAddressRef()
395 BF.createIslandDependency(IslandSym, IslandIter->second); in handleAddressRef()
405 if (BF.containsAddress(Address, /*UseMaxSize=*/isAArch64())) { in handleAddressRef()
406 if (Address != BF.getAddress()) { in handleAddressRef()
411 << Twine::utohexstr(Address) << " in function " << BF << '\n'; in handleAddressRef()
413 BF.HasInternalLabelReference = true; in handleAddressRef()
415 BF.addEntryPointAtOffset(Address - BF.getAddress()), Addend); in handleAddressRef()
418 addInterproceduralReference(&BF, Address); in handleAddressRef()
425 const MemoryContentsType MemType = analyzeMemoryAt(Address, BF); in handleAddressRef()
428 getOrCreateJumpTable(BF, Address, JumpTable::JTT_PIC); in handleAddressRef()
444 BinaryFunction &BF) { in analyzeMemoryAt() argument
455 << Twine::utohexstr(Address) << " referenced from function " << BF in analyzeMemoryAt()
472 if (analyzeJumpTable(Address, JumpTable::JTT_PIC, BF)) in analyzeMemoryAt()
475 if (analyzeJumpTable(Address, JumpTable::JTT_NORMAL, BF)) in analyzeMemoryAt()
495 BinaryFunction &BF, const uint64_t NextJTAddress, in analyzeJumpTable() argument
510 if (BF.containsAddress(Addr)) in analyzeJumpTable()
516 if (BF.isFragment()) { in analyzeJumpTable()
519 return registerFragment(BF, *TargetBF); in analyzeJumpTable()
522 return TargetBF->isFragment() && registerFragment(*TargetBF, BF); in analyzeJumpTable()
541 LLVM_DEBUG(dbgs() << "BOLT-DEBUG: analyzeJumpTable in " << BF.getPrintName() in analyzeJumpTable()
570 if (Value == BF.getAddress() + BF.getSize()) { in analyzeJumpTable()
581 if (!doesBelongToFunction(Value, TargetBF) || Value == BF.getAddress()) { in analyzeJumpTable()
583 if (!BF.containsAddress(Value)) { in analyzeJumpTable()
596 if (Value == BF.getAddress()) in analyzeJumpTable()
611 if (TargetBF != &BF) in analyzeJumpTable()
612 BF.setHasIndirectTargetToSplitFragment(true); in analyzeJumpTable()
630 for (BinaryFunction *BF : JT->Parents) in populateJumpTables()
631 NonSimpleParent |= !BF->isSimple(); in populateJumpTables()
717 BinaryFunction *BF = FragmentQueue[I]; in skipMarkedFragments() local
718 assert(FragmentsToSkip.count(BF) && in skipMarkedFragments()
721 errs() << "BOLT-WARNING: Ignoring " << BF->getPrintName() << '\n'; in skipMarkedFragments()
722 BF->setSimple(false); in skipMarkedFragments()
723 BF->setHasIndirectTargetToSplitFragment(true); in skipMarkedFragments()
725 llvm::for_each(BF->Fragments, addToWorklist); in skipMarkedFragments()
726 llvm::for_each(BF->ParentFragments, addToWorklist); in skipMarkedFragments()
759 BinaryFunction *BF = &Result.first->second; in createBinaryFunction() local
762 setSymbolToFunctionMap(BF->getSymbol(), BF); in createBinaryFunction()
763 return BF; in createBinaryFunction()
868 std::string BinaryContext::generateJumpTableName(const BinaryFunction &BF, in generateJumpTableName() argument
872 if (const JumpTable *JT = BF.getJumpTableContainingAddress(Address)) { in generateJumpTableName()
879 Id = JumpTableIds[Address] = BF.JumpTables.size(); in generateJumpTableName()
881 return ("JUMP_TABLE/" + BF.getOneName().str() + "." + std::to_string(Id) + in generateJumpTableName()
885 bool BinaryContext::hasValidCodePadding(const BinaryFunction &BF) { in hasValidCodePadding() argument
890 if (BF.getSize() == BF.getMaxSize()) in hasValidCodePadding()
893 ErrorOr<ArrayRef<unsigned char>> FunctionData = BF.getData(); in hasValidCodePadding()
896 uint64_t Offset = BF.getSize(); in hasValidCodePadding()
899 uint64_t InstrAddress = BF.getAddress() + Offset; in hasValidCodePadding()
905 for (; Offset < BF.getMaxSize(); in hasValidCodePadding()
920 for (; Offset < BF.getMaxSize(); ++Offset) in hasValidCodePadding()
929 if (skipInstructions(isBreakpoint) && Offset == BF.getMaxSize()) in hasValidCodePadding()
941 TargetAddress <= BF.getAddress() + BF.getMaxSize()) { in hasValidCodePadding()
953 if (Offset == BF.getMaxSize()) in hasValidCodePadding()
958 << Twine::utohexstr(BF.getAddress() + BF.getSize()) in hasValidCodePadding()
959 << " starting at offset " << (Offset - BF.getSize()) in hasValidCodePadding()
960 << " in function " << BF << '\n' in hasValidCodePadding()
961 << FunctionData->slice(BF.getSize(), BF.getMaxSize() - BF.getSize()) in hasValidCodePadding()
970 BinaryFunction &BF = BFI.second; in adjustCodePadding() local
971 if (!shouldEmit(BF)) in adjustCodePadding()
974 if (!hasValidCodePadding(BF)) { in adjustCodePadding()
977 outs() << "BOLT-INFO: function " << BF in adjustCodePadding()
980 BF.setIgnored(); in adjustCodePadding()
982 BF.setMaxSize(BF.getSize()); in adjustCodePadding()
1140 void BinaryContext::addAdrpAddRelocAArch64(BinaryFunction &BF, in addAdrpAddRelocAArch64() argument
1146 std::tie(TargetSymbol, Addend) = handleAddressRef(Target, BF, in addAdrpAddRelocAArch64()
1617 const BinaryFunction &BF = KV.second; in preprocessDebugInfo() local
1618 if (shouldEmit(BF) && BF.getDWARFUnit()) in preprocessDebugInfo()
1619 ProcessedCUs.insert(BF.getDWARFUnit()); in preprocessDebugInfo()
1624 BinaryFunction &BF = KV.second; in preprocessDebugInfo() local
1625 if (BF.getDWARFUnit() && !ProcessedCUs.count(BF.getDWARFUnit())) in preprocessDebugInfo()
1626 BF.setDWARFUnit(nullptr); in preprocessDebugInfo()
2129 BinaryFunction *BF = BFI->second; in getFunctionForSymbol() local
2131 *EntryDesc = BF->getEntryIDForSymbol(Symbol); in getFunctionForSymbol()
2133 return BF; in getFunctionForSymbol()
2159 BinaryFunction *BF = InjectedBinaryFunctions.back(); in createInjectedBinaryFunction() local
2160 setSymbolToFunctionMap(BF->getSymbol(), BF); in createInjectedBinaryFunction()
2161 BF->CurrentState = BinaryFunction::State::CFG; in createInjectedBinaryFunction()
2162 return BF; in createInjectedBinaryFunction()
2166 BinaryContext::calculateEmittedSize(BinaryFunction &BF, bool FixBranches) { in calculateEmittedSize() argument
2169 BF.fixBranches(); in calculateEmittedSize()
2201 emitFunctionBody(*Streamer, BF, /*EmitColdPart=*/false, in calculateEmittedSize()
2205 if (BF.isSplit()) { in calculateEmittedSize()
2207 LocalCtx->getELFSection(BF.getColdCodeSectionName(), ELF::SHT_PROGBITS, in calculateEmittedSize()
2213 emitFunctionBody(*Streamer, BF, /*EmitColdPart=*/true, in calculateEmittedSize()
2232 const uint64_t ColdSize = BF.isSplit() in calculateEmittedSize()
2307 BinaryFunction *BF = getFunctionForSymbol(BD->getSymbol(), &EntryID); in getBinaryFunctionAtAddress() local
2308 if (BF && EntryID == 0) in getBinaryFunctionAtAddress()
2309 return BF; in getBinaryFunctionAtAddress()