1 //===---------------------------- Context.h ---------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// This file defines a class for holding ownership of various simulated
12 /// hardware units. A Context also provides a utility routine for constructing
13 /// a default out-of-order pipeline with fetch, dispatch, execute, and retire
16 //===----------------------------------------------------------------------===//
18 #ifndef LLVM_TOOLS_LLVM_MCA_CONTEXT_H
19 #define LLVM_TOOLS_LLVM_MCA_CONTEXT_H
20 #include "HardwareUnit.h"
21 #include "InstrBuilder.h"
23 #include "SourceMgr.h"
24 #include "llvm/MC/MCRegisterInfo.h"
25 #include "llvm/MC/MCSchedule.h"
26 #include "llvm/MC/MCSubtargetInfo.h"
31 /// This is a convenience struct to hold the parameters necessary for creating
32 /// the pre-built "default" out-of-order pipeline.
33 struct PipelineOptions {
34 PipelineOptions(unsigned DW, unsigned RFS, unsigned LQS, unsigned SQS,
36 : DispatchWidth(DW), RegisterFileSize(RFS), LoadQueueSize(LQS),
37 StoreQueueSize(SQS), AssumeNoAlias(NoAlias) {}
38 unsigned DispatchWidth;
39 unsigned RegisterFileSize;
40 unsigned LoadQueueSize;
41 unsigned StoreQueueSize;
46 llvm::SmallVector<std::unique_ptr<HardwareUnit>, 4> Hardware;
47 const llvm::MCRegisterInfo &MRI;
48 const llvm::MCSubtargetInfo &STI;
51 Context(const llvm::MCRegisterInfo &R, const llvm::MCSubtargetInfo &S)
53 Context(const Context &C) = delete;
54 Context &operator=(const Context &C) = delete;
56 void addHardwareUnit(std::unique_ptr<HardwareUnit> H) {
57 Hardware.push_back(std::move(H));
60 /// Construct a basic pipeline for simulating an out-of-order pipeline.
61 /// This pipeline consists of Fetch, Dispatch, Execute, and Retire stages.
62 std::unique_ptr<Pipeline> createDefaultPipeline(const PipelineOptions &Opts,
68 #endif // LLVM_TOOLS_LLVM_MCA_CONTEXT_H