Home | History | Annotate | Download | only in llvm-mca
      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 stage 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 "InstrBuilder.h"
     21 #include "Scheduler.h"
     22 #include "Stage.h"
     23 #include "View.h"
     24 #include "llvm/ADT/SmallVector.h"
     25 #include "llvm/MC/MCSchedule.h"
     26 
     27 namespace mca {
     28 
     29 class InstructionTables : public Stage {
     30   const llvm::MCSchedModel &SM;
     31   InstrBuilder &IB;
     32   llvm::SmallVector<std::pair<ResourceRef, double>, 4> UsedResources;
     33 
     34 public:
     35   InstructionTables(const llvm::MCSchedModel &Model, InstrBuilder &Builder)
     36       : Stage(), SM(Model), IB(Builder) {}
     37 
     38   bool hasWorkToComplete() const override final { return false; }
     39   bool execute(InstRef &IR) override final;
     40 };
     41 } // namespace mca
     42 
     43 #endif
     44