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_MCA_CONTEXT_H
19 #define LLVM_MCA_CONTEXT_H
21 #include "llvm/MC/MCRegisterInfo.h"
22 #include "llvm/MC/MCSubtargetInfo.h"
23 #include "llvm/MCA/HardwareUnits/HardwareUnit.h"
24 #include "llvm/MCA/InstrBuilder.h"
25 #include "llvm/MCA/Pipeline.h"
26 #include "llvm/MCA/SourceMgr.h"
32 /// This is a convenience struct to hold the parameters necessary for creating
33 /// the pre-built "default" out-of-order pipeline.
34 struct PipelineOptions {
35 PipelineOptions(unsigned DW, unsigned RFS, unsigned LQS, unsigned SQS,
37 : DispatchWidth(DW), RegisterFileSize(RFS), LoadQueueSize(LQS),
38 StoreQueueSize(SQS), AssumeNoAlias(NoAlias) {}
39 unsigned DispatchWidth;
40 unsigned RegisterFileSize;
41 unsigned LoadQueueSize;
42 unsigned StoreQueueSize;
47 SmallVector<std::unique_ptr<HardwareUnit>, 4> Hardware;
48 const MCRegisterInfo &MRI;
49 const MCSubtargetInfo &STI;
52 Context(const MCRegisterInfo &R, const MCSubtargetInfo &S) : MRI(R), STI(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,
69 #endif // LLVM_MCA_CONTEXT_H