diff options
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h')
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h index 715ad5884c1..679436a2cf7 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h @@ -16,9 +16,10 @@ #ifndef LLVM_TOOLS_LLVM_EXEGESIS_BENCHMARKRUNNER_H #define LLVM_TOOLS_LLVM_EXEGESIS_BENCHMARKRUNNER_H +#include "Assembler.h" #include "BenchmarkResult.h" -#include "InMemoryAssembler.h" #include "LlvmState.h" +#include "RegisterAliasing.h" #include "llvm/MC/MCInst.h" #include "llvm/Support/Error.h" #include <vector> @@ -28,6 +29,8 @@ namespace exegesis { // Common code for all benchmark modes. class BenchmarkRunner { public: + explicit BenchmarkRunner(const LLVMState &State); + // Subtargets can disable running benchmarks for some instructions by // returning an error here. class InstructionFilter { @@ -42,21 +45,29 @@ public: virtual ~BenchmarkRunner(); - InstructionBenchmark run(const LLVMState &State, unsigned Opcode, - unsigned NumRepetitions, - const InstructionFilter &Filter) const; + InstructionBenchmark run(unsigned Opcode, const InstructionFilter &Filter, + unsigned NumRepetitions); + +protected: + const LLVMState &State; + const llvm::MCInstrInfo &MCInstrInfo; + const llvm::MCRegisterInfo &MCRegisterInfo; private: virtual const char *getDisplayName() const = 0; virtual llvm::Expected<std::vector<llvm::MCInst>> - createCode(const LLVMState &State, unsigned OpcodeIndex, - unsigned NumRepetitions, - const JitFunctionContext &Context) const = 0; + createSnippet(RegisterAliasingTrackerCache &RATC, unsigned Opcode, + llvm::raw_ostream &Debug) const = 0; virtual std::vector<BenchmarkMeasure> - runMeasurements(const LLVMState &State, const JitFunction &Function, - unsigned NumRepetitions) const = 0; + runMeasurements(const ExecutableFunction &EF, + const unsigned NumRepetitions) const = 0; + + llvm::Expected<std::string> + writeObjectFile(llvm::ArrayRef<llvm::MCInst> Code) const; + + RegisterAliasingTrackerCache RATC; }; } // namespace exegesis |