1//===--------------------- InstructionTables.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-exception 6// 7//===----------------------------------------------------------------------===// 8/// \file 9/// 10/// This file implements a custom stage to generate instruction tables. 11/// See the description of command-line flag -instruction-tables in 12/// docs/CommandGuide/lvm-mca.rst 13/// 14//===----------------------------------------------------------------------===// 15 16#ifndef LLVM_MCA_STAGES_INSTRUCTIONTABLES_H 17#define LLVM_MCA_STAGES_INSTRUCTIONTABLES_H 18 19#include "llvm/ADT/SmallVector.h" 20#include "llvm/MC/MCSchedule.h" 21#include "llvm/MCA/HardwareUnits/Scheduler.h" 22#include "llvm/MCA/Stages/Stage.h" 23#include "llvm/MCA/Support.h" 24 25namespace llvm { 26namespace mca { 27 28class InstructionTables final : public Stage { 29 const MCSchedModel &SM; 30 SmallVector<ResourceUse, 4> UsedResources; 31 SmallVector<uint64_t, 8> Masks; 32 33public: 34 InstructionTables(const MCSchedModel &Model) 35 : SM(Model), Masks(Model.getNumProcResourceKinds()) { 36 computeProcResourceMasks(Model, Masks); 37 } 38 39 bool hasWorkToComplete() const override { return false; } 40 Error execute(InstRef &IR) override; 41}; 42} // namespace mca 43} // namespace llvm 44 45#endif // LLVM_MCA_STAGES_INSTRUCTIONTABLES_H 46