Improve Register Setup
llvm-svn: 342464
diff --git a/llvm/tools/llvm-exegesis/lib/Target.h b/llvm/tools/llvm-exegesis/lib/Target.h
index fe8a9e2..8514793 100644
--- a/llvm/tools/llvm-exegesis/lib/Target.h
+++ b/llvm/tools/llvm-exegesis/lib/Target.h
@@ -37,30 +37,28 @@
// Generates code to move a constant into a the given register.
virtual std::vector<llvm::MCInst>
- setRegToConstant(const llvm::MCSubtargetInfo &STI, unsigned Reg) const {
- return {};
- }
+ setRegToConstant(const llvm::MCSubtargetInfo &STI, unsigned Reg) const = 0;
- // Returns the register pointing to scratch memory, or 0 if this target does
- // not support memory operands. The benchmark function uses the default
- // calling convention.
- virtual unsigned getScratchMemoryRegister(const llvm::Triple &) const {
- return 0;
- }
+ // Generates code to move a constant into a the given register.
+ virtual std::vector<llvm::MCInst> setRegTo(const llvm::MCSubtargetInfo &STI,
+ const llvm::APInt &Value,
+ unsigned Reg) const = 0;
+
+ // Returns the register pointing to scratch memory, or 0 if this target
+ // does not support memory operands. The benchmark function uses the
+ // default calling convention.
+ virtual unsigned getScratchMemoryRegister(const llvm::Triple &) const = 0;
// Fills memory operands with references to the address at [Reg] + Offset.
virtual void fillMemoryOperands(InstructionBuilder &IB, unsigned Reg,
- unsigned Offset) const {
- llvm_unreachable(
- "fillMemoryOperands() requires getScratchMemoryRegister() > 0");
- }
+ unsigned Offset) const = 0;
// Returns the maximum number of bytes a load/store instruction can access at
// once. This is typically the size of the largest register available on the
// processor. Note that this only used as a hint to generate independant
// load/stores to/from memory, so the exact returned value does not really
// matter as long as it's large enough.
- virtual unsigned getMaxMemoryAccessSize() const { return 0; }
+ virtual unsigned getMaxMemoryAccessSize() const = 0;
// Creates a snippet generator for the given mode.
std::unique_ptr<SnippetGenerator>