Andrea Di Biagio | d156929 | 2018-03-26 12:04:53 +0000 | [diff] [blame] | 1 | //===--------------------- 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 Biagio | 5ffd2c3 | 2018-03-26 14:25:52 +0000 | [diff] [blame] | 20 | #include "View.h" |
Andrea Di Biagio | d156929 | 2018-03-26 12:04:53 +0000 | [diff] [blame] | 21 | #include "InstrBuilder.h" |
| 22 | #include "SourceMgr.h" |
Andrea Di Biagio | 5ffd2c3 | 2018-03-26 14:25:52 +0000 | [diff] [blame] | 23 | #include "llvm/ADT/SmallVector.h" |
Andrea Di Biagio | d156929 | 2018-03-26 12:04:53 +0000 | [diff] [blame] | 24 | #include "llvm/MC/MCSchedule.h" |
| 25 | |
| 26 | namespace mca { |
| 27 | |
| 28 | class InstructionTables { |
| 29 | const llvm::MCSchedModel &SM; |
| 30 | InstrBuilder &IB; |
| 31 | SourceMgr &S; |
Andrea Di Biagio | 5ffd2c3 | 2018-03-26 14:25:52 +0000 | [diff] [blame] | 32 | llvm::SmallVector<std::unique_ptr<View>, 8> Views; |
Andrea Di Biagio | d156929 | 2018-03-26 12:04:53 +0000 | [diff] [blame] | 33 | |
| 34 | public: |
| 35 | InstructionTables(const llvm::MCSchedModel &Model, InstrBuilder &Builder, |
| 36 | SourceMgr &Source) |
| 37 | : SM(Model), IB(Builder), S(Source) {} |
| 38 | |
Andrea Di Biagio | 5ffd2c3 | 2018-03-26 14:25:52 +0000 | [diff] [blame] | 39 | void addView(std::unique_ptr<View> V) { |
| 40 | Views.emplace_back(std::move(V)); |
Andrea Di Biagio | d156929 | 2018-03-26 12:04:53 +0000 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | void run(); |
Andrea Di Biagio | 5ffd2c3 | 2018-03-26 14:25:52 +0000 | [diff] [blame] | 44 | |
| 45 | void printReport(llvm::raw_ostream &OS) const; |
Andrea Di Biagio | d156929 | 2018-03-26 12:04:53 +0000 | [diff] [blame] | 46 | }; |
| 47 | } // namespace mca |
| 48 | |
| 49 | #endif |