blob: 01ece0c8b2283e8d7522db95d58f8b24b424bf7c [file] [log] [blame]
Andrea Di Biagiod1569292018-03-26 12:04:53 +00001//===--------------------- InstructionTables.h ------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9/// \file
10///
Matt Davis0e8402e2018-07-14 23:52:50 +000011/// This file implements a custom stage to generate instruction tables.
Andrea Di Biagiod1569292018-03-26 12:04:53 +000012/// See the description of command-line flag -instruction-tables in
13/// docs/CommandGuide/lvm-mca.rst
14///
15//===----------------------------------------------------------------------===//
16
17#ifndef LLVM_TOOLS_LLVM_MCA_INSTRUCTIONTABLES_H
18#define LLVM_TOOLS_LLVM_MCA_INSTRUCTIONTABLES_H
19
Andrea Di Biagiod1569292018-03-26 12:04:53 +000020#include "InstrBuilder.h"
Matt Davis0e8402e2018-07-14 23:52:50 +000021#include "Scheduler.h"
22#include "Stage.h"
23#include "View.h"
Andrea Di Biagio5ffd2c32018-03-26 14:25:52 +000024#include "llvm/ADT/SmallVector.h"
Andrea Di Biagiod1569292018-03-26 12:04:53 +000025#include "llvm/MC/MCSchedule.h"
26
27namespace mca {
28
Matt Davis0e8402e2018-07-14 23:52:50 +000029class InstructionTables : public Stage {
Andrea Di Biagiod1569292018-03-26 12:04:53 +000030 const llvm::MCSchedModel &SM;
31 InstrBuilder &IB;
Matt Davis0e8402e2018-07-14 23:52:50 +000032 llvm::SmallVector<std::pair<ResourceRef, double>, 4> UsedResources;
Andrea Di Biagiod1569292018-03-26 12:04:53 +000033
34public:
Matt Davis0e8402e2018-07-14 23:52:50 +000035 InstructionTables(const llvm::MCSchedModel &Model, InstrBuilder &Builder)
36 : Stage(), SM(Model), IB(Builder) {}
Andrea Di Biagiod1569292018-03-26 12:04:53 +000037
Matt Davis0e8402e2018-07-14 23:52:50 +000038 bool hasWorkToComplete() const override final { return false; }
Matt Davis4bcf3692018-08-13 18:11:48 +000039 Status execute(InstRef &IR) override final;
Andrea Di Biagiod1569292018-03-26 12:04:53 +000040};
41} // namespace mca
42
43#endif