forked from OSchip/llvm-project
[llvm-exegesis][NFC] Move CodeTemplate to it's own file.
Summary: This is is preparation of exploring value ranges. Reviewers: courbet Reviewed By: courbet Subscribers: mgorny, tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D52542 llvm-svn: 343098
This commit is contained in:
parent
26223bccde
commit
7f8d310b76
|
@ -18,6 +18,7 @@ add_library(LLVMExegesis
|
|||
BenchmarkResult.cpp
|
||||
BenchmarkRunner.cpp
|
||||
Clustering.cpp
|
||||
CodeTemplate.cpp
|
||||
Latency.cpp
|
||||
LlvmState.cpp
|
||||
MCInstrDescView.cpp
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
//===-- CodeTemplate.cpp ----------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "CodeTemplate.h"
|
||||
|
||||
namespace exegesis {
|
||||
|
||||
CodeTemplate::CodeTemplate(CodeTemplate &&) = default;
|
||||
|
||||
CodeTemplate &CodeTemplate::operator=(CodeTemplate &&) = default;
|
||||
|
||||
} // namespace exegesis
|
|
@ -0,0 +1,44 @@
|
|||
//===-- CodeTemplate.h ------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
///
|
||||
/// \file
|
||||
/// 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.
|
||||
///
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_TOOLS_LLVM_EXEGESIS_CODETEMPLATE_H
|
||||
#define LLVM_TOOLS_LLVM_EXEGESIS_CODETEMPLATE_H
|
||||
|
||||
#include "MCInstrDescView.h"
|
||||
|
||||
namespace exegesis {
|
||||
|
||||
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 ScratchSpacePointerInReg = 0;
|
||||
};
|
||||
|
||||
} // namespace exegesis
|
||||
|
||||
#endif // LLVM_TOOLS_LLVM_EXEGESIS_CODETEMPLATE_H
|
|
@ -159,10 +159,6 @@ llvm::MCInst InstructionBuilder::build() const {
|
|||
return Result;
|
||||
}
|
||||
|
||||
CodeTemplate::CodeTemplate(CodeTemplate &&) = default;
|
||||
|
||||
CodeTemplate &CodeTemplate::operator=(CodeTemplate &&) = default;
|
||||
|
||||
bool RegisterOperandAssignment::
|
||||
operator==(const RegisterOperandAssignment &Other) const {
|
||||
return std::tie(Op, Reg) == std::tie(Other.Op, Other.Reg);
|
||||
|
|
|
@ -111,27 +111,6 @@ struct InstructionBuilder {
|
|||
llvm::SmallVector<llvm::MCOperand, 4> VariableValues;
|
||||
};
|
||||
|
||||
// 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 ScratchSpacePointerInReg = 0;
|
||||
};
|
||||
|
||||
// Represents the assignment of a Register to an Operand.
|
||||
struct RegisterOperandAssignment {
|
||||
RegisterOperandAssignment(const Operand *Operand, llvm::MCPhysReg Reg)
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "Assembler.h"
|
||||
#include "BenchmarkCode.h"
|
||||
#include "CodeTemplate.h"
|
||||
#include "LlvmState.h"
|
||||
#include "MCInstrDescView.h"
|
||||
#include "RegisterAliasing.h"
|
||||
|
|
Loading…
Reference in New Issue