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 | |
| 20 | #include "HWEventListener.h" |
| 21 | #include "InstrBuilder.h" |
| 22 | #include "SourceMgr.h" |
| 23 | #include "llvm/MC/MCSchedule.h" |
| 24 | |
| 25 | namespace mca { |
| 26 | |
| 27 | class InstructionTables { |
| 28 | const llvm::MCSchedModel &SM; |
| 29 | InstrBuilder &IB; |
| 30 | SourceMgr &S; |
| 31 | std::set<HWEventListener *> Listeners; |
| 32 | |
| 33 | public: |
| 34 | InstructionTables(const llvm::MCSchedModel &Model, InstrBuilder &Builder, |
| 35 | SourceMgr &Source) |
| 36 | : SM(Model), IB(Builder), S(Source) {} |
| 37 | |
| 38 | void addEventListener(HWEventListener *Listener) { |
| 39 | if (Listener) |
| 40 | Listeners.insert(Listener); |
| 41 | } |
| 42 | |
| 43 | void run(); |
| 44 | }; |
| 45 | } // namespace mca |
| 46 | |
| 47 | #endif |