reland r332579: [llvm-exegesis] Update to cover latency through another opcode.
Restructuring the code to measure latency and uops.
The end goal is to have this program spawn another process to deal with SIGILL and other malformed programs. It is not yet the case in this redesign, it is still the main program that runs the code (and may crash).
It now uses BitVector instead of Graph for performance reasons.
https://reviews.llvm.org/D46821
(with fixed ARM tests)
Authored by Guillaume Chatelet
llvm-svn: 332592
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.h
index 715ad58..679436a 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 @@
// 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 @@
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