Lines Matching refs:BC

209                              const BinaryContext &BC) {  in buildSectionName()  argument
210 if (BC.isELF()) in buildSectionName()
232 const BinaryContext &BC) { in buildCodeSectionName() argument
233 return buildSectionName(BC.isELF() ? ".local.text." : ".l.text.", Name, BC); in buildCodeSectionName()
237 const BinaryContext &BC) { in buildColdCodeSectionName() argument
238 return buildSectionName(BC.isELF() ? ".local.cold.text." : ".l.c.text.", Name, in buildColdCodeSectionName()
239 BC); in buildColdCodeSectionName()
309 if (BC.MIB->getJumpTable(Inst)) { in markUnreachableBlocks()
341 Bytes += BC.computeCodeSize(BB->begin(), BB->end()); in eraseInvalidBBs()
375 const BinaryFunction *CalleeBF = BC.getFunctionForSymbol(CalleeSymbol); in isForwardCall()
391 ErrorOr<uint64_t> CalleeAddressOrError = BC.getSymbolValue(*CalleeSymbol); in isForwardCall()
481 if (opts::PrintDynoStatsOnly || !PrintInstructions || !BC.InstPrinter) in print()
501 BC.printInstruction(OS, II.second, Offset, this); in print()
556 Offset = BC.printInstructions(OS, BB->begin(), BB->end(), Offset, this); in print()
760 const unsigned PtrSize = BC.AsmInfo->getCodePointerSize(); in processIndirectBranch()
781 if (BC.isAArch64()) { in processIndirectBranch()
782 PreserveNops = BC.HasRelocations; in processIndirectBranch()
795 IndirectBranchType BranchType = BC.MIB->analyzeIndirectBranch( in processIndirectBranch()
803 IndexRegNum = BC.MIB->getNoRegister(); in processIndirectBranch()
805 if (BC.isAArch64()) { in processIndirectBranch()
806 const MCSymbol *Sym = BC.MIB->getTargetSymbol(*PCRelBaseInstr, 1); in processIndirectBranch()
808 ErrorOr<uint64_t> SymValueOrError = BC.getSymbolValue(*Sym); in processIndirectBranch()
831 BC.MIB->replaceMemOperandDisp(*PCRelBaseInstr, in processIndirectBranch()
843 std::tie(TargetSym, TargetOffset) = BC.MIB->getTargetSymbolInfo(DispExpr); in processIndirectBranch()
844 ErrorOr<uint64_t> SymValueOrError = BC.getSymbolValue(*TargetSym); in processIndirectBranch()
847 BaseRegNum = BC.MIB->getNoRegister(); in processIndirectBranch()
848 if (BC.isAArch64()) { in processIndirectBranch()
856 if (BaseRegNum == BC.MRI->getProgramCounter()) in processIndirectBranch()
862 ErrorOr<BinarySection &> Section = BC.getSectionForAddress(ArrayStart); in processIndirectBranch()
880 ErrorOr<uint64_t> Value = BC.getPointerAtAddress(ArrayStart); in processIndirectBranch()
884 if (!BC.getSectionForAddress(ArrayStart)->isReadOnly()) in processIndirectBranch()
899 if (JumpTable *JT = BC.getJumpTableContainingAddress(ArrayStart)) { in processIndirectBranch()
909 MemType = BC.analyzeMemoryAt(ArrayStart, *this); in processIndirectBranch()
930 const MCSymbol *JTLabel = BC.getOrCreateJumpTable(*this, ArrayStart, JTType); in processIndirectBranch()
931 BC.MIB->replaceMemOperandDisp(*MemLocInstr, JTLabel, BC.Ctx.get()); in processIndirectBranch()
932 BC.MIB->setJumpTable(Instruction, ArrayStart, IndexRegNum); in processIndirectBranch()
951 if (BC.isAArch64()) { in getOrCreateLocalLabel()
956 MCSymbol *Label = BC.Ctx->createNamedTempSymbol(); in getOrCreateLocalLabel()
1018 auto &Ctx = BC.Ctx; in disassemble()
1019 auto &MIB = BC.MIB; in disassemble()
1021 BC.SymbolicDisAsm->setSymbolizer(MIB->createTargetSymbolizer(*this)); in disassemble()
1033 BC.InstPrinter->printInst(&Instruction, 0, "", *BC.STI, errs()); in disassemble()
1035 Instruction.dump_pretty(errs(), BC.InstPrinter.get()); in disassemble()
1040 if (BC.HasRelocations) in disassemble()
1053 BC.handleAddressRef(TargetAddress, *this, /*IsPCRel*/ true); in disassemble()
1055 TargetSymbol, MCSymbolRefExpr::VK_None, *BC.Ctx); in disassemble()
1058 MCConstantExpr::create(TargetOffset, *BC.Ctx); in disassemble()
1059 Expr = MCBinaryExpr::createAdd(Expr, Offset, *BC.Ctx); in disassemble()
1062 MCOperand::createExpr(BC.MIB->getTargetExprFor( in disassemble()
1063 Instruction, Expr, *BC.Ctx, 0))); in disassemble()
1071 BC.addInterproceduralReference(this, TargetAddress); in disassemble()
1072 if (opts::Verbosity >= 2 && !IsCall && Size == 2 && !BC.HasRelocations) { in disassemble()
1097 TargetSymbol = BC.getOrCreateGlobalSymbol(TargetAddress, "FUNCat"); in disassemble()
1132 MIB->createUncondBranch(Instruction, TargetSymbol, BC.Ctx.get()); in disassemble()
1137 BC.addInterproceduralReference(this, IndirectTarget); in disassemble()
1166 BC.addAdrpAddRelocAArch64(*this, *TargetLowBits, *TargetHiBits, in disassemble()
1182 if (!BC.SymbolicDisAsm->getInstruction(Instruction, Size, in disassemble()
1195 if (BC.HasRelocations && opts::TrapOnAVX512 && BC.isX86()) { in disassemble()
1197 BC.TrappedFunctions.push_back(this); in disassemble()
1206 if (opts::CheckEncoding && !BC.MIB->isBranch(Instruction) && in disassemble()
1207 !BC.MIB->isCall(Instruction) && !BC.MIB->isNoop(Instruction)) { in disassemble()
1208 if (!BC.validateEncoding(Instruction, FunctionData.slice(Offset, Size))) { in disassemble()
1211 BC.printInstruction(errs(), Instruction, AbsoluteInstrAddr); in disassemble()
1218 if (BC.HasRelocations && opts::TrapOnAVX512) { in disassemble()
1220 BC.TrappedFunctions.push_back(this); in disassemble()
1227 BC.DisAsm->getInstruction(TempInst, Size, FunctionData.slice(Offset), in disassemble()
1229 if (!BC.validateEncoding(TempInst, FunctionData.slice(Offset, Size))) { in disassemble()
1233 BC.printInstruction(errs(), TempInst, AbsoluteInstrAddr); in disassemble()
1255 if (BC.MIB->isUnsupportedBranch(Instruction.getOpcode())) { in disassemble()
1258 BC.getBinaryFunctionContainingAddress(TargetAddress)) in disassemble()
1267 if (BC.isX86()) { in disassemble()
1287 !(BC.isAArch64() && in disassemble()
1288 BC.handleAArch64Veneer(TargetAddress, /*MatchOnly*/ true))) { in disassemble()
1294 BC.MIB->createNoop(Instruction); in disassemble()
1311 BC.MIB->replaceBranchTarget(Instruction, TargetSymbol, &*Ctx); in disassemble()
1325 if (BC.isAArch64()) in disassemble()
1328 } else if (BC.isAArch64()) { in disassemble()
1336 const bool Result = BC.MIB->replaceImmWithSymbolRef( in disassemble()
1359 if (BC.keepOffsetForInstruction(Instruction)) in disassemble()
1362 if (BC.MIB->isNoop(Instruction)) { in disassemble()
1373 BC.SymbolicDisAsm->setSymbolizer(nullptr); in disassemble()
1376 Labels[Offset] = BC.Ctx->createNamedTempSymbol(); in disassemble()
1409 BC.createIndependentMCCodeEmitter(); in scanExternalRefs()
1427 if (!BC.DisAsm->getInstruction(Instruction, Size, in scanExternalRefs()
1449 if (!BC.shouldEmit(Target)) in scanExternalRefs()
1460 if (BC.forceSymbolRelocations(TargetSymbol->getName())) in scanExternalRefs()
1463 BinaryFunction *TargetFunction = BC.getFunctionForSymbol(TargetSymbol); in scanExternalRefs()
1475 if (BC.MIB->hasPCRelOperand(Instruction)) { in scanExternalRefs()
1476 if (BC.MIB->evaluateMemOperandTarget(Instruction, TargetAddress, in scanExternalRefs()
1480 } else if (BC.MIB->isCall(Instruction) || BC.MIB->isBranch(Instruction)) { in scanExternalRefs()
1481 if (BC.MIB->evaluateBranch(Instruction, AbsoluteInstrAddr, Size, in scanExternalRefs()
1491 BC.getBinaryFunctionContainingAddress(TargetAddress); in scanExternalRefs()
1501 if (!BC.HasRelocations) in scanExternalRefs()
1508 BC.MIB->replaceBranchTarget(Instruction, TargetSymbol, in scanExternalRefs()
1513 BC.MIB->replaceMemOperandDisp( in scanExternalRefs()
1514 Instruction, MCOperand::createExpr(BC.MIB->getTargetExprFor( in scanExternalRefs()
1525 if (Relocation.isPCRelative() && BC.isX86()) in scanExternalRefs()
1531 const bool Result = BC.MIB->replaceImmWithSymbolRef( in scanExternalRefs()
1547 Emitter.MCE->encodeInstruction(Instruction, VecOS, Fixups, *BC.STI); in scanExternalRefs()
1551 Optional<Relocation> Rel = BC.MIB->createRelocation(Fixup, *BC.MAB); in scanExternalRefs()
1579 if (BC.HasRelocations) { in scanExternalRefs()
1581 BC.UndefinedSymbols.insert(LI.second); in scanExternalRefs()
1583 BC.UndefinedSymbols.insert(FunctionEndLabel); in scanExternalRefs()
1589 if (Success && BC.HasRelocations) in scanExternalRefs()
1610 if (!BC.HasRelocations) in postProcessEntryPoints()
1623 if (BC.isAArch64() && Offset == getSize()) in postProcessEntryPoints()
1629 if (BC.HasRelocations) in postProcessEntryPoints()
1667 BC.getBinaryFunctionContainingAddress(EntryAddress); in postProcessJumpTables()
1680 BC.getBinaryDataAtAddress(JT.getAddress())->getSize(); in postProcessJumpTables()
1682 BC.setBinaryDataSize(JT.getAddress(), JT.getSize()); in postProcessJumpTables()
1754 uint16_t LastJTIndexReg = BC.MIB->getNoRegister(); in postProcessIndirectBranches()
1757 if (!BC.MIB->isIndirectBranch(Instr)) in postProcessIndirectBranches()
1763 BC.MIB->convertJmpToTailCall(Instr); in postProcessIndirectBranches()
1770 BC.MIB->convertJmpToTailCall(Instr); in postProcessIndirectBranches()
1776 if (BC.MIB->isTailCall(Instr) || BC.MIB->getJumpTable(Instr)) { in postProcessIndirectBranches()
1777 const unsigned PtrSize = BC.AsmInfo->getCodePointerSize(); in postProcessIndirectBranches()
1783 IndirectBranchType Type = BC.MIB->analyzeIndirectBranch( in postProcessIndirectBranches()
1792 if (BC.MIB->isTailCall(Instr)) { in postProcessIndirectBranches()
1793 BC.MIB->convertTailCallToJmp(Instr); in postProcessIndirectBranches()
1797 LastJT = BC.MIB->getJumpTable(Instr); in postProcessIndirectBranches()
1798 LastJTIndexReg = BC.MIB->getJumpTableIndexReg(Instr); in postProcessIndirectBranches()
1799 BC.MIB->unsetJumpTable(Instr); in postProcessIndirectBranches()
1801 JumpTable *JT = BC.getJumpTableContainingAddress(LastJT); in postProcessIndirectBranches()
1821 if (BC.MIB->isLeave(Instr) || BC.MIB->isPop(Instr)) { in postProcessIndirectBranches()
1827 BC.MIB->convertJmpToTailCall(Instr); in postProcessIndirectBranches()
1836 LLVM_DEBUG(BC.printInstructions(dbgs(), BB.begin(), BB.end(), in postProcessIndirectBranches()
1855 BC.MIB->setJumpTable(*LastIndirectJump, LastJT, LastJTIndexReg, AllocId); in postProcessIndirectBranches()
1864 if (HasUnknownControlFlow && !BC.HasRelocations) in postProcessIndirectBranches()
1881 if (!BC.MIB->isInvoke(Instr)) in recomputeLandingPads()
1884 const Optional<MCPlus::MCLandingPad> EHInfo = BC.MIB->getEHInfo(Instr); in recomputeLandingPads()
1899 auto &MIB = BC.MIB; in buildCFG()
1902 assert(!BC.HasRelocations && in buildCFG()
1953 if (!BC.MIB->isPseudo(*RII) && !BC.MIB->isNoop(*RII)) { in buildCFG()
1980 MIB->isNoop(Instr) && BC.SDTMarkers.count(InstrInputAddr); in buildCFG()
1981 bool IsLKMarker = BC.LKMarkers.count(InstrInputAddr); in buildCFG()
2009 auto L = BC.scopeLock(); in buildCFG()
2010 Label = BC.Ctx->createNamedTempSymbol("FT"); in buildCFG()
2071 BC.exitWithBugReport("disassembly failed - inconsistent branch found.", in buildCFG()
2187 BC.MIB->clearOffset(Inst); in postProcessCFG()
2204 const uint32_t Offset = BC.MIB->getOffsetWithDefault(*std::next(II), 0); in calculateMacroOpFusionStats()
2212 ++BC.MissedMacroFusionPairs; in calculateMacroOpFusionStats()
2213 BC.MissedMacroFusionExecCount += BB.getKnownExecutionCount(); in calculateMacroOpFusionStats()
2242 BC.MIB->getConditionalTailCall(*CTCInstr); in removeConditionalTailCalls()
2252 CTCTakenCount = BC.MIB->getAnnotationWithDefault<uint64_t>( in removeConditionalTailCalls()
2254 CTCMispredCount = BC.MIB->getAnnotationWithDefault<uint64_t>( in removeConditionalTailCalls()
2259 assert(!BC.MIB->getEHInfo(*CTCInstr) && in removeConditionalTailCalls()
2264 const MCSymbol *CTCTargetLabel = BC.MIB->getTargetSymbol(*CTCInstr); in removeConditionalTailCalls()
2267 BC.MIB->createTailCall(TailCallInstr, CTCTargetLabel, BC.Ctx.get()); in removeConditionalTailCalls()
2272 createBasicBlock(BC.Ctx->createNamedTempSymbol("TC")); in removeConditionalTailCalls()
2283 BC.MIB->convertTailCallToJmp(*CTCInstr); in removeConditionalTailCalls()
2285 BC.MIB->replaceBranchTarget(*CTCInstr, TailCallBB->getLabel(), in removeConditionalTailCalls()
2286 BC.Ctx.get()); in removeConditionalTailCalls()
2295 BC.MIB->unsetConditionalTailCall(*CTCInstr); in removeConditionalTailCalls()
2851 if (BC.HasRelocations) { in clearDisasmState()
2853 BC.UndefinedSymbols.insert(LI.second); in clearDisasmState()
2855 BC.UndefinedSymbols.insert(FunctionEndLabel); in clearDisasmState()
2864 BC.MIB->createTrap(TrapInstr); in setTrapOnEntry()
2925 const MCSymbol *Symbol = BC.MIB->getTargetSymbol(Inst, OpNum); in duplicateConstantIslands()
2937 ColdSymbol = BC.Ctx->getOrCreateSymbol(Symbol->getName() + ".cold"); in duplicateConstantIslands()
2948 Operand = MCOperand::createExpr(BC.MIB->getTargetExprFor( in duplicateConstantIslands()
2951 *BC.Ctx), in duplicateConstantIslands()
2952 *BC.Ctx, 0)); in duplicateConstantIslands()
3038 Offset = BC.printInstructions(CS, BB->begin(), BB->end(), Offset, this, in dumpGraph()
3056 const bool IsJumpTable = LastInstr && BC.MIB->getJumpTable(*LastInstr); in dumpGraph()
3063 Branch = CondBranch ? std::string(BC.InstPrinter->getOpcodeName( in dumpGraph()
3067 Branch = UncondBranch ? std::string(BC.InstPrinter->getOpcodeName( in dumpGraph()
3216 auto &MIB = BC.MIB; in fixBranches()
3217 MCContext *Ctx = BC.Ctx.get(); in fixBranches()
3255 auto L = BC.scopeLock(); in fixBranches()
3260 auto L = BC.scopeLock(); in fixBranches()
3270 if (IsSupported && BC.isX86() && in fixBranches()
3275 auto L = BC.scopeLock(); in fixBranches()
3307 if (BC.MIB->isCFI(Instr)) { in propagateGnuArgsSizeInfo()
3317 } else if (BC.MIB->isInvoke(Instr)) { in propagateGnuArgsSizeInfo()
3319 BC.MIB->addGnuArgsSize(Instr, CurrentGnuArgsSize, AllocId); in propagateGnuArgsSizeInfo()
3333 BC.MIB->isConditionalBranch(*LastInstrRI)) { in postProcessBranches()
3355 if (!BC.MIB->isTerminator(*LastInstrRI) && in postProcessBranches()
3356 !BC.MIB->isCall(*LastInstrRI)) { in postProcessBranches()
3360 BC.MIB->createReturn(ReturnInstr); in postProcessBranches()
3379 if (BinaryData *EntryBD = BC.getBinaryDataAtAddress(EntryPointAddress)) { in addEntryPointAtOffset()
3382 EntrySymbol = BC.getOrCreateGlobalSymbol( in addEntryPointAtOffset()
3387 BC.setSymbolToFunctionMap(EntrySymbol, this); in addEntryPointAtOffset()
3404 BC.Ctx->getOrCreateSymbol("__ENTRY_" + BB.getLabel()->getName()); in addEntryPoint()
3408 BC.setSymbolToFunctionMap(EntrySymbol, this); in addEntryPoint()
3537 if (BC.MIB->getCanonicalBranchCondCode(BC.MIB->getCondCode( in dfs()
3538 *CondBranch)) == BC.MIB->getCondCode(*CondBranch)) { in dfs()
3575 if (BC.MIB->isPseudo(Inst)) in computeHash()
3581 if (BC.MIB->isUnconditionalBranch(Inst)) in computeHash()
3699 if (!BC.MIB->isIndirectBranch(Inst)) in checkForAmbiguousJumpTables()
3701 uint64_t JTAddress = BC.MIB->getJumpTable(Inst); in checkForAmbiguousJumpTables()
3719 assert((opts::JumpTables != JTS_BASIC && isSimple()) || !BC.HasRelocations); in disambiguateJumpTables()
3723 if (!BC.MIB->isIndirectBranch(Inst)) in disambiguateJumpTables()
3744 BC.MIB->matchIndJmp(BC.MIB->matchReg(BaseReg1), in disambiguateJumpTables()
3745 BC.MIB->matchImm(Scale), BC.MIB->matchReg(), in disambiguateJumpTables()
3746 /*Offset=*/BC.MIB->matchSymbol(Target)); in disambiguateJumpTables()
3748 *BC.MRI, *BC.MIB, in disambiguateJumpTables()
3750 BaseReg1 != BC.MIB->getNoRegister() || Scale != 8) { in disambiguateJumpTables()
3757 BC.MIB->matchLoad(BC.MIB->matchReg(BaseReg1), in disambiguateJumpTables()
3758 BC.MIB->matchImm(Scale), BC.MIB->matchReg(), in disambiguateJumpTables()
3759 /*Offset=*/BC.MIB->matchSymbol(Target)); in disambiguateJumpTables()
3762 BC.MIB->matchIndJmp(std::move(LoadMatcherOwner)); in disambiguateJumpTables()
3764 *BC.MRI, *BC.MIB, in disambiguateJumpTables()
3766 BaseReg1 != BC.MIB->getNoRegister() || Scale != 8) { in disambiguateJumpTables()
3776 BC.MIB->matchIndJmp(BC.MIB->matchAdd( in disambiguateJumpTables()
3777 BC.MIB->matchReg(BaseReg1), in disambiguateJumpTables()
3778 BC.MIB->matchLoad(BC.MIB->matchReg(BaseReg2), in disambiguateJumpTables()
3779 BC.MIB->matchImm(Scale), BC.MIB->matchReg(), in disambiguateJumpTables()
3780 BC.MIB->matchImm(Offset)))); in disambiguateJumpTables()
3782 BC.MIB->matchLoadAddr(BC.MIB->matchSymbol(Target)); in disambiguateJumpTables()
3785 BC.MIB->matchIndJmp(BC.MIB->matchAdd(std::move(LEAMatcherOwner), in disambiguateJumpTables()
3786 BC.MIB->matchAnyOperand())); in disambiguateJumpTables()
3788 *BC.MRI, *BC.MIB, in disambiguateJumpTables()
3792 *BC.MRI, *BC.MIB, in disambiguateJumpTables()
3808 BC.duplicateJumpTable(*this, JT, Target); in disambiguateJumpTables()
3810 auto L = BC.scopeLock(); in disambiguateJumpTables()
3811 BC.MIB->replaceMemOperandDisp(*JTLoadInst, NewJTLabel, BC.Ctx.get()); in disambiguateJumpTables()
3815 BC.MIB->setJumpTable(Inst, NewJumpTableID, 0, AllocId); in disambiguateJumpTables()
3824 if (!Instr || !BC.MIB->isIndirectBranch(*Instr)) in replaceJumpTableEntryIn()
3826 uint64_t JTAddress = BC.MIB->getJumpTable(*Instr); in replaceJumpTableEntryIn()
3842 auto L = BC.scopeLock(); in splitEdge()
3843 Tmp = BC.Ctx->createNamedTempSymbol("SplitEdge"); in splitEdge()
3892 *BB->succ_begin() == *NextBB && Last && !BC.MIB->isBranch(*Last)) { in deleteConservativeEdges()
3899 if (!Last || !BC.MIB->isCall(*Last)) in deleteConservativeEdges()
3902 const MCSymbol *CalleeSymbol = BC.MIB->getTargetSymbol(*Last); in deleteConservativeEdges()
3926 if (BC.isMarker(Symbol)) in isSymbolValidInScope()
4049 if (BC.HasRelocations || isInjected()) { in updateOutputValues()
4088 if (!isSimple() && !BC.HasRelocations) in updateOutputValues()
4099 if (!BC.HasRelocations) { in updateOutputValues()
4287 if (Offset == BC.MIB->getOffsetWithDefault(Inst, InvalidOffset)) in getInstructionAtOffset()
4293 BC.MIB->getAnnotationWithDefault<uint32_t>(*LastInstr, "Size"); in getInstructionAtOffset()
4442 if (!BC.MIB->hasAnnotation(Inst, "AArch64Veneer")) in isAArch64Veneer()
4447 if (!BC.MIB->isNoop(Inst)) in isAArch64Veneer()