1 //===--------------------- InstructionTables.h ------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
10 /// This file implements a custom stage to generate instruction tables.
11 /// See the description of command-line flag -instruction-tables in
12 /// docs/CommandGuide/lvm-mca.rst
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_MCA_INSTRUCTIONTABLES_H
17 #define LLVM_MCA_INSTRUCTIONTABLES_H
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/MC/MCSchedule.h"
21 #include "llvm/MCA/HardwareUnits/Scheduler.h"
22 #include "llvm/MCA/Stages/Stage.h"
23 #include "llvm/MCA/Support.h"
28 class InstructionTables final
: public Stage
{
29 const MCSchedModel
&SM
;
30 SmallVector
<std::pair
<ResourceRef
, ResourceCycles
>, 4> UsedResources
;
31 SmallVector
<uint64_t, 8> Masks
;
34 InstructionTables(const MCSchedModel
&Model
)
35 : Stage(), SM(Model
), Masks(Model
.getNumProcResourceKinds()) {
36 computeProcResourceMasks(Model
, Masks
);
39 bool hasWorkToComplete() const override
{ return false; }
40 Error
execute(InstRef
&IR
) override
;
45 #endif // LLVM_MCA_INSTRUCTIONTABLES_H