[llvm] r343098 - [llvm-exegesis][NFC] Move CodeTemplate to it's own file.

Guillaume Chatelet via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 26 04:57:24 PDT 2018


Author: gchatelet
Date: Wed Sep 26 04:57:24 2018
New Revision: 343098

URL: http://llvm.org/viewvc/llvm-project?rev=343098&view=rev
Log:
[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

Added:
    llvm/trunk/tools/llvm-exegesis/lib/CodeTemplate.cpp
    llvm/trunk/tools/llvm-exegesis/lib/CodeTemplate.h
Modified:
    llvm/trunk/tools/llvm-exegesis/lib/CMakeLists.txt
    llvm/trunk/tools/llvm-exegesis/lib/MCInstrDescView.cpp
    llvm/trunk/tools/llvm-exegesis/lib/MCInstrDescView.h
    llvm/trunk/tools/llvm-exegesis/lib/SnippetGenerator.h

Modified: llvm/trunk/tools/llvm-exegesis/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/CMakeLists.txt?rev=343098&r1=343097&r2=343098&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-exegesis/lib/CMakeLists.txt Wed Sep 26 04:57:24 2018
@@ -18,6 +18,7 @@ add_library(LLVMExegesis
   BenchmarkResult.cpp
   BenchmarkRunner.cpp
   Clustering.cpp
+  CodeTemplate.cpp
   Latency.cpp
   LlvmState.cpp
   MCInstrDescView.cpp

Added: llvm/trunk/tools/llvm-exegesis/lib/CodeTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/CodeTemplate.cpp?rev=343098&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/CodeTemplate.cpp (added)
+++ llvm/trunk/tools/llvm-exegesis/lib/CodeTemplate.cpp Wed Sep 26 04:57:24 2018
@@ -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

Added: llvm/trunk/tools/llvm-exegesis/lib/CodeTemplate.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/CodeTemplate.h?rev=343098&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/CodeTemplate.h (added)
+++ llvm/trunk/tools/llvm-exegesis/lib/CodeTemplate.h Wed Sep 26 04:57:24 2018
@@ -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

Modified: llvm/trunk/tools/llvm-exegesis/lib/MCInstrDescView.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/MCInstrDescView.cpp?rev=343098&r1=343097&r2=343098&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/MCInstrDescView.cpp (original)
+++ llvm/trunk/tools/llvm-exegesis/lib/MCInstrDescView.cpp Wed Sep 26 04:57:24 2018
@@ -159,10 +159,6 @@ llvm::MCInst InstructionBuilder::build()
   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);

Modified: llvm/trunk/tools/llvm-exegesis/lib/MCInstrDescView.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/MCInstrDescView.h?rev=343098&r1=343097&r2=343098&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/MCInstrDescView.h (original)
+++ llvm/trunk/tools/llvm-exegesis/lib/MCInstrDescView.h Wed Sep 26 04:57:24 2018
@@ -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)

Modified: llvm/trunk/tools/llvm-exegesis/lib/SnippetGenerator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/SnippetGenerator.h?rev=343098&r1=343097&r2=343098&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/SnippetGenerator.h (original)
+++ llvm/trunk/tools/llvm-exegesis/lib/SnippetGenerator.h Wed Sep 26 04:57:24 2018
@@ -18,6 +18,7 @@
 
 #include "Assembler.h"
 #include "BenchmarkCode.h"
+#include "CodeTemplate.h"
 #include "LlvmState.h"
 #include "MCInstrDescView.h"
 #include "RegisterAliasing.h"




More information about the llvm-commits mailing list