LLVM  8.0.1
Context.h
Go to the documentation of this file.
1 //===---------------------------- Context.h ---------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 /// \file
10 ///
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
14 /// stages.
15 ///
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef LLVM_MCA_CONTEXT_H
19 #define LLVM_MCA_CONTEXT_H
20 
21 #include "llvm/MC/MCRegisterInfo.h"
24 #include "llvm/MCA/InstrBuilder.h"
25 #include "llvm/MCA/Pipeline.h"
26 #include "llvm/MCA/SourceMgr.h"
27 #include <memory>
28 
29 namespace llvm {
30 namespace mca {
31 
32 /// This is a convenience struct to hold the parameters necessary for creating
33 /// the pre-built "default" out-of-order pipeline.
35  PipelineOptions(unsigned DW, unsigned RFS, unsigned LQS, unsigned SQS,
36  bool NoAlias)
38  StoreQueueSize(SQS), AssumeNoAlias(NoAlias) {}
39  unsigned DispatchWidth;
40  unsigned RegisterFileSize;
41  unsigned LoadQueueSize;
42  unsigned StoreQueueSize;
44 };
45 
46 class Context {
48  const MCRegisterInfo &MRI;
49  const MCSubtargetInfo &STI;
50 
51 public:
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;
55 
56  void addHardwareUnit(std::unique_ptr<HardwareUnit> H) {
57  Hardware.push_back(std::move(H));
58  }
59 
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,
63  InstrBuilder &IB,
64  SourceMgr &SrcMgr);
65 };
66 
67 } // namespace mca
68 } // namespace llvm
69 #endif // LLVM_MCA_CONTEXT_H
uint64_t CallInst * C
void addHardwareUnit(std::unique_ptr< HardwareUnit > H)
Definition: Context.h:56
LLVMContext & Context
This class represents lattice values for constants.
Definition: AllocatorList.h:24
SourceMgr SrcMgr
Definition: Error.cpp:24
The two locations do not alias at all.
Definition: AliasAnalysis.h:84
A builder class that knows how to construct Instruction objects.
Definition: InstrBuilder.h:39
This is a convenience struct to hold the parameters necessary for creating the pre-built "default" ou...
Definition: Context.h:34
This file implements an ordered container of stages that simulate the pipeline of a hardware backend...
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
unsigned const MachineRegisterInfo * MRI
#define H(x, y, z)
Definition: MD5.cpp:57
This file defines a base class for describing a simulated hardware unit.
PipelineOptions(unsigned DW, unsigned RFS, unsigned LQS, unsigned SQS, bool NoAlias)
Definition: Context.h:35
This is a &#39;vector&#39; (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:847
This file implements class SourceMgr.
Generic base class for all target subtargets.
A builder class for instructions that are statically analyzed by llvm-mca.
Context(const MCRegisterInfo &R, const MCSubtargetInfo &S)
Definition: Context.h:52