summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/MCInstrDescView.h')
-rw-r--r--llvm/tools/llvm-exegesis/lib/MCInstrDescView.h50
1 files changed, 25 insertions, 25 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h
index 823c9e6b0fe..51f44cae45f 100644
--- a/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h
+++ b/llvm/tools/llvm-exegesis/lib/MCInstrDescView.h
@@ -86,10 +86,10 @@ struct Instruction {
struct InstructionBuilder {
InstructionBuilder(const Instruction &Instr);
- InstructionBuilder(const InstructionBuilder &);
- InstructionBuilder &operator=(const InstructionBuilder &);
- InstructionBuilder(InstructionBuilder &&);
- InstructionBuilder &operator=(InstructionBuilder &&);
+ InstructionBuilder(const InstructionBuilder &); // default
+ InstructionBuilder &operator=(const InstructionBuilder &); // default
+ InstructionBuilder(InstructionBuilder &&); // default
+ InstructionBuilder &operator=(InstructionBuilder &&); // default
unsigned getOpcode() const;
llvm::MCOperand &getValueFor(const Variable &Var);
@@ -102,34 +102,34 @@ struct InstructionBuilder {
// Do not use any of the registers in `ForbiddenRegs`.
void randomizeUnsetVariables(const llvm::BitVector &ForbiddenRegs);
- // Returns the instance as an llvm::MCInst. The InstructionBuilder must be
- // fully allocated (no invalid variables).
+ // Builds an llvm::MCInst from this InstructionBuilder setting its operands to
+ // the corresponding variable values.
+ // Precondition: All VariableValues must be set.
llvm::MCInst build() const;
Instruction Instr;
llvm::SmallVector<llvm::MCOperand, 4> VariableValues;
};
-// A prototype is a set of InstructionInstances with an explanation of how
-// it's been built. The prototype can then be randomized to exercice several
-// immediate values. It is also used to gather the used registers and define
-// their initial values.
-struct SnippetPrototype {
- SnippetPrototype() = default;
-
- // No copy.
- SnippetPrototype(const SnippetPrototype &) = delete;
- SnippetPrototype &operator=(const SnippetPrototype &) = delete;
-
- // Moving is OK.
- SnippetPrototype(SnippetPrototype &&);
- SnippetPrototype &operator=(SnippetPrototype &&);
-
- std::string Explanation;
- // If the prototype uses the provided scratch memory, the register in which
+// A CodeTemplate is a set of InstructionBuilders that may not be fully
+// specified (i.e. some variables are not yet set).
+// This allows the BenchmarkRunner to instantiate it many times with specific
+// values to study their impact on instruction's performance.
+struct CodeTemplate {
+ CodeTemplate() = default;
+
+ CodeTemplate(CodeTemplate &&); // default
+ CodeTemplate &operator=(CodeTemplate &&); // default
+ CodeTemplate(const CodeTemplate &) = delete;
+ CodeTemplate &operator=(const CodeTemplate &) = delete;
+
+ // Some information about how this template has been created.
+ std::string Info;
+ // The list of the instructions for this template.
+ std::vector<InstructionBuilder> Instructions;
+ // If the template uses the provided scratch memory, the register in which
// the pointer to this memory is passed in to the function.
- unsigned ScratchSpaceReg = 0;
- std::vector<InstructionBuilder> Snippet;
+ unsigned ScratchSpacePointerInReg = 0;
};
// Represents the assignment of a Register to an Operand.
OpenPOWER on IntegriCloud