//===---------------------- CustomBehaviour.h -------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// \file /// /// This file defines the base class CustomBehaviour which can be inherited from /// by specific targets (ex. llvm/tools/llvm-mca/lib/X86CustomBehaviour.h). /// CustomBehaviour is designed to enforce custom behaviour and dependencies /// within the llvm-mca pipeline simulation that llvm-mca isn't already capable /// of extracting from the Scheduling Models. /// //===----------------------------------------------------------------------===// #ifndef LLVM_MCA_CUSTOMBEHAVIOUR_H #define LLVM_MCA_CUSTOMBEHAVIOUR_H #include "llvm/ADT/SmallVector.h" #include "llvm/MC/MCInst.h" #include "llvm/MC/MCInstrInfo.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MCA/SourceMgr.h" #include "llvm/MCA/View.h" namespace llvm { namespace mca { /// Class which can be overriden by targets to modify the /// mca::Instruction objects before the pipeline starts. /// A common usage of this class is to add immediate operands to certain /// instructions or to remove Defs/Uses from an instruction where the /// schedulinng model is incorrect. class InstrPostProcess { … }; /// Class which can be overriden by targets to enforce instruction /// dependencies and behaviours that aren't expressed well enough /// within the scheduling model for mca to automatically simulate /// them properly. /// If you implement this class for your target, make sure to also implement /// a target specific InstrPostProcess class as well. class CustomBehaviour { … }; class Instrument { … }; UniqueInstrument; /// This class allows targets to optionally customize the logic that resolves /// scheduling class IDs. Targets can use information encoded in Instrument /// objects to make more informed scheduling decisions. class InstrumentManager { … }; } // namespace mca } // namespace llvm #endif /* LLVM_MCA_CUSTOMBEHAVIOUR_H */