File indexing completed on 2026-05-10 08:44:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef LLVM_MCA_CONTEXT_H
0018 #define LLVM_MCA_CONTEXT_H
0019
0020 #include "llvm/MC/MCRegisterInfo.h"
0021 #include "llvm/MC/MCSubtargetInfo.h"
0022 #include "llvm/MCA/CustomBehaviour.h"
0023 #include "llvm/MCA/HardwareUnits/HardwareUnit.h"
0024 #include "llvm/MCA/Pipeline.h"
0025 #include "llvm/MCA/SourceMgr.h"
0026 #include <memory>
0027
0028 namespace llvm {
0029 namespace mca {
0030
0031
0032
0033 struct PipelineOptions {
0034 PipelineOptions(unsigned UOPQSize, unsigned DecThr, unsigned DW, unsigned RFS,
0035 unsigned LQS, unsigned SQS, bool NoAlias,
0036 bool ShouldEnableBottleneckAnalysis = false)
0037 : MicroOpQueueSize(UOPQSize), DecodersThroughput(DecThr),
0038 DispatchWidth(DW), RegisterFileSize(RFS), LoadQueueSize(LQS),
0039 StoreQueueSize(SQS), AssumeNoAlias(NoAlias),
0040 EnableBottleneckAnalysis(ShouldEnableBottleneckAnalysis) {}
0041 unsigned MicroOpQueueSize;
0042 unsigned DecodersThroughput;
0043 unsigned DispatchWidth;
0044 unsigned RegisterFileSize;
0045 unsigned LoadQueueSize;
0046 unsigned StoreQueueSize;
0047 bool AssumeNoAlias;
0048 bool EnableBottleneckAnalysis;
0049 };
0050
0051 class Context {
0052 SmallVector<std::unique_ptr<HardwareUnit>, 4> Hardware;
0053 const MCRegisterInfo &MRI;
0054 const MCSubtargetInfo &STI;
0055
0056 public:
0057 Context(const MCRegisterInfo &R, const MCSubtargetInfo &S) : MRI(R), STI(S) {}
0058 Context(const Context &C) = delete;
0059 Context &operator=(const Context &C) = delete;
0060
0061 const MCRegisterInfo &getMCRegisterInfo() const { return MRI; }
0062 const MCSubtargetInfo &getMCSubtargetInfo() const { return STI; }
0063
0064 void addHardwareUnit(std::unique_ptr<HardwareUnit> H) {
0065 Hardware.push_back(std::move(H));
0066 }
0067
0068
0069
0070 std::unique_ptr<Pipeline> createDefaultPipeline(const PipelineOptions &Opts,
0071 SourceMgr &SrcMgr,
0072 CustomBehaviour &CB);
0073
0074
0075
0076 std::unique_ptr<Pipeline> createInOrderPipeline(const PipelineOptions &Opts,
0077 SourceMgr &SrcMgr,
0078 CustomBehaviour &CB);
0079 };
0080
0081 }
0082 }
0083 #endif