1//===-------------------- X86CustomBehaviour.h ------------------*-C++ -* -===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8/// \file
9///
10/// This file defines the X86CustomBehaviour class which inherits from
11/// CustomBehaviour. This class is used by the tool llvm-mca to enforce
12/// target specific behaviour that is not expressed well enough in the
13/// scheduling model for mca to enforce it automatically.
14///
15//===----------------------------------------------------------------------===//
16
17#ifndef LLVM_LIB_TARGET_X86_MCA_X86CUSTOMBEHAVIOUR_H
18#define LLVM_LIB_TARGET_X86_MCA_X86CUSTOMBEHAVIOUR_H
19
20#include "llvm/MCA/CustomBehaviour.h"
21#include "llvm/TargetParser/TargetParser.h"
22
23namespace llvm {
24namespace mca {
25
26class X86InstrPostProcess : public InstrPostProcess {
27 /// Called within X86InstrPostProcess to specify certain instructions
28 /// as load and store barriers.
29 void setMemBarriers(Instruction &Inst, const MCInst &MCI);
30
31 /// Called within X86InstrPostPorcess to remove some rsp read operands
32 /// on stack instructions to better simulate the stack engine. We currently
33 /// do not model features of the stack engine like sync uops.
34 void useStackEngine(Instruction &Inst, const MCInst &MCI);
35
36public:
37 X86InstrPostProcess(const MCSubtargetInfo &STI, const MCInstrInfo &MCII)
38 : InstrPostProcess(STI, MCII) {}
39
40 ~X86InstrPostProcess() override = default;
41
42 void postProcessInstruction(Instruction &Inst, const MCInst &MCI) override;
43};
44
45} // namespace mca
46} // namespace llvm
47
48#endif
49