blob: 200083d371569456d19f492093789b50aeb97390 [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///
11/// This file implements a custom driver to generate instruction tables.
12/// 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 Biagio5ffd2c32018-03-26 14:25:52 +000020#include "View.h"
Andrea Di Biagiod1569292018-03-26 12:04:53 +000021#include "InstrBuilder.h"
22#include "SourceMgr.h"
Andrea Di Biagio5ffd2c32018-03-26 14:25:52 +000023#include "llvm/ADT/SmallVector.h"
Andrea Di Biagiod1569292018-03-26 12:04:53 +000024#include "llvm/MC/MCSchedule.h"
25
26namespace mca {
27
28class InstructionTables {
29 const llvm::MCSchedModel &SM;
30 InstrBuilder &IB;
31 SourceMgr &S;
Andrea Di Biagio5ffd2c32018-03-26 14:25:52 +000032 llvm::SmallVector<std::unique_ptr<View>, 8> Views;
Andrea Di Biagiod1569292018-03-26 12:04:53 +000033
34public:
35 InstructionTables(const llvm::MCSchedModel &Model, InstrBuilder &Builder,
36 SourceMgr &Source)
37 : SM(Model), IB(Builder), S(Source) {}
38
Andrea Di Biagio5ffd2c32018-03-26 14:25:52 +000039 void addView(std::unique_ptr<View> V) {
40 Views.emplace_back(std::move(V));
Andrea Di Biagiod1569292018-03-26 12:04:53 +000041 }
42
43 void run();
Andrea Di Biagio5ffd2c32018-03-26 14:25:52 +000044
45 void printReport(llvm::raw_ostream &OS) const;
Andrea Di Biagiod1569292018-03-26 12:04:53 +000046};
47} // namespace mca
48
49#endif