20 #define DEBUG_TYPE "llvm-mca" 27 : LQ_Size(LQ), SQ_Size(SQ),
NoAlias(AssumeNoAlias) {
44 dbgs() <<
"[LSUnit] LQ_Size = " << LQ_Size <<
'\n';
45 dbgs() <<
"[LSUnit] SQ_Size = " << SQ_Size <<
'\n';
46 dbgs() <<
"[LSUnit] NextLQSlotIdx = " << LoadQueue.
size() <<
'\n';
47 dbgs() <<
"[LSUnit] NextSQSlotIdx = " << StoreQueue.
size() <<
'\n';
51 void LSUnit::assignLQSlot(
unsigned Index) {
56 <<
",slot=" << LoadQueue.
size() <<
">\n");
60 void LSUnit::assignSQSlot(
unsigned Index) {
65 <<
",slot=" << StoreQueue.
size() <<
">\n");
77 LoadBarriers.
insert(Index);
83 StoreBarriers.
insert(Index);
102 assert((IsALoad || IsAStore) &&
"Not a memory operation!");
103 assert((!IsALoad || LoadQueue.
count(Index) == 1) &&
"Load not in queue!");
104 assert((!IsAStore || StoreQueue.
count(Index) == 1) &&
"Store not in queue!");
106 if (IsALoad && !LoadBarriers.
empty()) {
107 unsigned LoadBarrierIndex = *LoadBarriers.
begin();
109 if (Index > LoadBarrierIndex)
112 if (Index == LoadBarrierIndex && Index != *LoadQueue.
begin())
116 if (IsAStore && !StoreBarriers.
empty()) {
117 unsigned StoreBarrierIndex = *StoreBarriers.
begin();
119 if (Index > StoreBarrierIndex)
122 if (Index == StoreBarrierIndex && Index != *StoreQueue.
begin())
128 if (NoAlias && IsALoad)
131 if (StoreQueue.
size()) {
134 if (Index > *StoreQueue.
begin())
145 if (Index <= *LoadQueue.
begin())
162 if (LoadQueue.
erase(Index)) {
164 <<
" has been removed from the load queue.\n");
166 if (!LoadBarriers.
empty() && Index == *LoadBarriers.
begin()) {
168 dbgs() <<
"[LSUnit]: Instruction idx=" << Index
169 <<
" has been removed from the set of load barriers.\n");
170 LoadBarriers.
erase(Index);
175 if (StoreQueue.
erase(Index)) {
177 <<
" has been removed from the store queue.\n");
180 if (!StoreBarriers.
empty() && Index == *StoreBarriers.
begin()) {
182 dbgs() <<
"[LSUnit]: Instruction idx=" << Index
183 <<
" has been removed from the set of store barriers.\n");
184 StoreBarriers.
erase(Index);
Instruction * getInstruction()
Status isAvailable(const InstRef &IR) const
virtual bool isReady(const InstRef &IR) const
This class represents lattice values for constants.
const MCProcResourceDesc * getProcResource(unsigned ProcResourceIdx) const
The two locations do not alias at all.
void onInstructionExecuted(const InstRef &IR)
An InstRef contains both a SourceMgr index and Instruction pair.
A Load/Store unit class that models load/store queues and that implements a simple weak memory consis...
unsigned getSourceIndex() const
LLVM_NODISCARD bool empty() const
const_iterator begin() const
const InstrDesc & getDesc() const
bool hasExtraProcessorInfo() const
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
LSUnit(const MCSchedModel &SM, unsigned LQ=0, unsigned SQ=0, bool AssumeNoAlias=false)
Define a kind of processor resource that will be modeled by the scheduler.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
An instruction descriptor.
This file defines abstractions used by the Pipeline to model register reads, register writes and inst...
void dispatch(const InstRef &IR)
const MCExtraProcessorInfo & getExtraProcessorInfo() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Machine model for scheduling, bundling, and heuristics.
Statically lint checks LLVM IR
size_type count(const T &V) const
count - Return 1 if the element is in the set, 0 otherwise.