#include "bolt/Passes/LongJmp.h"
#define DEBUG_TYPE …
usingnamespacellvm;
namespace opts {
extern cl::OptionCategory BoltOptCategory;
extern llvm::cl::opt<unsigned> AlignText;
extern cl::opt<unsigned> AlignFunctions;
extern cl::opt<bool> UseOldText;
extern cl::opt<bool> HotFunctionsAtEnd;
static cl::opt<bool> GroupStubs("group-stubs",
cl::desc("share stubs across functions"),
cl::init(true), cl::cat(BoltOptCategory));
}
namespace llvm {
namespace bolt {
constexpr unsigned ColdFragAlign = …;
static void relaxStubToShortJmp(BinaryBasicBlock &StubBB, const MCSymbol *Tgt) { … }
static void relaxStubToLongJmp(BinaryBasicBlock &StubBB, const MCSymbol *Tgt) { … }
static BinaryBasicBlock *getBBAtHotColdSplitPoint(BinaryFunction &Func) { … }
static bool shouldInsertStub(const BinaryContext &BC, const MCInst &Inst) { … }
std::pair<std::unique_ptr<BinaryBasicBlock>, MCSymbol *>
LongJmpPass::createNewStub(BinaryBasicBlock &SourceBB, const MCSymbol *TgtSym,
bool TgtIsFunc, uint64_t AtAddress) { … }
BinaryBasicBlock *LongJmpPass::lookupStubFromGroup(
const StubGroupsTy &StubGroups, const BinaryFunction &Func,
const MCInst &Inst, const MCSymbol *TgtSym, uint64_t DotAddress) const { … }
BinaryBasicBlock *
LongJmpPass::lookupGlobalStub(const BinaryBasicBlock &SourceBB,
const MCInst &Inst, const MCSymbol *TgtSym,
uint64_t DotAddress) const { … }
BinaryBasicBlock *LongJmpPass::lookupLocalStub(const BinaryBasicBlock &SourceBB,
const MCInst &Inst,
const MCSymbol *TgtSym,
uint64_t DotAddress) const { … }
std::unique_ptr<BinaryBasicBlock>
LongJmpPass::replaceTargetWithStub(BinaryBasicBlock &BB, MCInst &Inst,
uint64_t DotAddress,
uint64_t StubCreationAddress) { … }
void LongJmpPass::updateStubGroups() { … }
void LongJmpPass::tentativeBBLayout(const BinaryFunction &Func) { … }
uint64_t LongJmpPass::tentativeLayoutRelocColdPart(
const BinaryContext &BC, std::vector<BinaryFunction *> &SortedFunctions,
uint64_t DotAddress) { … }
uint64_t LongJmpPass::tentativeLayoutRelocMode(
const BinaryContext &BC, std::vector<BinaryFunction *> &SortedFunctions,
uint64_t DotAddress) { … }
void LongJmpPass::tentativeLayout(
const BinaryContext &BC, std::vector<BinaryFunction *> &SortedFunctions) { … }
bool LongJmpPass::usesStub(const BinaryFunction &Func,
const MCInst &Inst) const { … }
uint64_t LongJmpPass::getSymbolAddress(const BinaryContext &BC,
const MCSymbol *Target,
const BinaryBasicBlock *TgtBB) const { … }
Error LongJmpPass::relaxStub(BinaryBasicBlock &StubBB, bool &Modified) { … }
bool LongJmpPass::needsStub(const BinaryBasicBlock &BB, const MCInst &Inst,
uint64_t DotAddress) const { … }
Error LongJmpPass::relax(BinaryFunction &Func, bool &Modified) { … }
Error LongJmpPass::runOnFunctions(BinaryContext &BC) { … }
}
}