#include "Assembler.h"
#include "SnippetRepetitor.h"
#include "SubprocessMemory.h"
#include "Target.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/CodeGen/FunctionLoweringInfo.h"
#include "llvm/CodeGen/GlobalISel/CallLowering.h"
#include "llvm/CodeGen/GlobalISel/MachineIRBuilder.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetPassConfig.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/ExecutionEngine/Orc/LLJIT.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/Object/SymbolSize.h"
#include "llvm/Support/Alignment.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#ifdef HAVE_LIBPFM
#include "perfmon/perf_event.h"
#endif
#ifdef __linux__
#include <unistd.h>
#endif
namespace llvm {
namespace exegesis {
static constexpr const char ModuleID[] = …;
static constexpr const char FunctionID[] = …;
static const Align kFunctionAlignment(4096);
static bool generateSnippetSetupCode(const ExegesisTarget &ET,
const MCSubtargetInfo *const MSI,
BasicBlockFiller &BBF,
const BenchmarkKey &Key,
bool GenerateMemoryInstructions) { … }
static bool addPass(PassManagerBase &PM, StringRef PassName,
TargetPassConfig &TPC) { … }
MachineFunction &createVoidVoidPtrMachineFunction(StringRef FunctionName,
Module *Module,
MachineModuleInfo *MMI) { … }
BasicBlockFiller::BasicBlockFiller(MachineFunction &MF, MachineBasicBlock *MBB,
const MCInstrInfo *MCII)
: … { … }
void BasicBlockFiller::addInstruction(const MCInst &Inst, const DebugLoc &DL) { … }
void BasicBlockFiller::addInstructions(ArrayRef<MCInst> Insts,
const DebugLoc &DL) { … }
void BasicBlockFiller::addReturn(const ExegesisTarget &ET,
bool SubprocessCleanup, const DebugLoc &DL) { … }
FunctionFiller::FunctionFiller(MachineFunction &MF,
std::vector<unsigned> RegistersSetUp)
: … { … }
BasicBlockFiller FunctionFiller::addBasicBlock() { … }
ArrayRef<unsigned> FunctionFiller::getRegistersSetUp() const { … }
static std::unique_ptr<Module>
createModule(const std::unique_ptr<LLVMContext> &Context, const DataLayout &DL) { … }
BitVector getFunctionReservedRegs(const TargetMachine &TM) { … }
Error assembleToStream(const ExegesisTarget &ET,
std::unique_ptr<LLVMTargetMachine> TM,
ArrayRef<unsigned> LiveIns, const FillFunction &Fill,
raw_pwrite_stream &AsmStream, const BenchmarkKey &Key,
bool GenerateMemoryInstructions) { … }
object::OwningBinary<object::ObjectFile>
getObjectFromBuffer(StringRef InputData) { … }
object::OwningBinary<object::ObjectFile> getObjectFromFile(StringRef Filename) { … }
Expected<ExecutableFunction> ExecutableFunction::create(
std::unique_ptr<LLVMTargetMachine> TM,
object::OwningBinary<object::ObjectFile> &&ObjectFileHolder) { … }
ExecutableFunction::ExecutableFunction(std::unique_ptr<LLVMContext> Ctx,
std::unique_ptr<orc::LLJIT> EJIT,
StringRef FB)
: … { … }
Error getBenchmarkFunctionBytes(const StringRef InputData,
std::vector<uint8_t> &Bytes) { … }
}
}