Lines Matching defs:Function
262 BinaryFunction *Function = BC->createBinaryFunction(
265 Function->setOutputAddress(Function->getAddress());
275 BinaryFunction &Function = BFI.second;
276 Function.setMaxSize(Function.getSize());
278 ErrorOr<ArrayRef<uint8_t>> FunctionData = Function.getData();
281 << "empty for function " << Function << '\n';
286 if (Function.getSize() == 0) {
287 Function.setSimple(false);
294 Function.setFileOffset(FunctionData->begin() - FileBegin);
298 DataInCode.cbegin(), DataInCode.cend(), Function.getFileOffset(),
302 Function.getFileOffset() + Function.getMaxSize())
303 Function.setSimple(false);
311 BinaryFunction &Function = BFI.second;
312 if (!Function.isSimple())
314 BC->logBOLTErrorsAndQuitOnFatal(Function.disassemble());
316 Function.print(outs(), "after disassembly");
322 BinaryFunction &Function = BFI.second;
323 if (!Function.isSimple())
325 BC->logBOLTErrorsAndQuitOnFatal(Function.buildCFG(/*AllocId*/ 0));
331 BinaryFunction &Function = BFI.second;
332 if (Function.empty())
334 Function.postProcessCFG();
336 Function.print(outs(), "after building cfg");
380 for (BinaryFunction *Function : BC->getAllBinaryFunctions()) {
381 if (!Function->isEmitted())
383 if (Function->getOutputAddress() == 0)
385 ErrorOr<BinarySection &> FuncSection = Function->getCodeSection();
388 (Twine("Cannot find section for function ") + Function->getOneName())
392 FuncSection->setOutputAddress(Function->getOutputAddress());
395 << Twine::utohexstr(Function->getOutputAddress()) << '\n');
396 MapSection(*FuncSection, Function->getOutputAddress());
397 Function->setImageAddress(FuncSection->getAllocAddress());
398 Function->setImageSize(FuncSection->getOutputSize());
408 for (BinaryFunction *Function : BC->getAllBinaryFunctions()) {
409 if (!Function->isEmitted())
411 if (Function->getOutputAddress() != 0)
413 ErrorOr<BinarySection &> FuncSection = Function->getCodeSection();
418 Function->setFileOffset(Addr - BOLT->getAddress() +
420 Function->setImageAddress(FuncSection->getAllocAddress());
421 Function->setImageSize(FuncSection->getOutputSize());
422 BC->registerNameAtAddress(Function->getOneName(), Addr, 0, 0);
512 BinaryFunction &Function = BFI.second;
513 if (!Function.isSimple())
515 assert(Function.isEmitted() && "Simple function has not been emitted");
516 if (!opts::Instrument && (Function.getImageSize() > Function.getMaxSize()))
519 outs() << "BOLT: rewriting function \"" << Function << "\"\n";
520 OS.pwrite(reinterpret_cast<char *>(Function.getImageAddress()),
521 Function.getImageSize(), Function.getFileOffset());
524 for (const BinaryFunction *Function : BC->getInjectedBinaryFunctions()) {
525 OS.pwrite(reinterpret_cast<char *>(Function->getImageAddress()),
526 Function->getImageSize(), Function->getFileOffset());