brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · 88dd0f3 Raw
56 lines · c
1//===-- SnippetRepetitor.h --------------------------------------*- C++ -*-===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8///9/// \file10/// Defines helpers to fill functions with repetitions of a snippet.11///12//===----------------------------------------------------------------------===//13 14#ifndef LLVM_TOOLS_LLVM_EXEGESIS_FUNCTIONFILLER_H15#define LLVM_TOOLS_LLVM_EXEGESIS_FUNCTIONFILLER_H16 17#include "Assembler.h"18#include "BenchmarkResult.h"19#include "LlvmState.h"20#include "llvm/ADT/BitVector.h"21#include "llvm/CodeGen/MachineFunction.h"22#include "llvm/MC/MCInst.h"23#include "llvm/MC/MCInstrInfo.h"24#include "llvm/Object/Binary.h"25 26namespace llvm {27namespace exegesis {28 29class SnippetRepetitor {30public:31  static std::unique_ptr<const SnippetRepetitor>32  Create(Benchmark::RepetitionModeE Mode, const LLVMState &State,33         MCRegister LoopRegister);34 35  virtual ~SnippetRepetitor();36 37  // Returns the set of registers that are reserved by the repetitor.38  virtual BitVector getReservedRegs() const = 0;39 40  // Returns a functor that repeats `Instructions` so that the function executes41  // at least `MinInstructions` instructions.42  virtual FillFunction Repeat(ArrayRef<MCInst> Instructions,43                              unsigned MinInstructions, unsigned LoopBodySize,44                              bool CleanupMemory) const = 0;45 46  explicit SnippetRepetitor(const LLVMState &State) : State(State) {}47 48protected:49  const LLVMState &State;50};51 52} // namespace exegesis53} // namespace llvm54 55#endif56