18 #define DEBUG_TYPE "llvm-mca" 24 : NextAvailableSlotIdx(0), CurrentInstructionSlotIdx(0),
25 AvailableSlots(SM.MicroOpBufferSize), MaxRetirePerCycle(0) {
36 assert(AvailableSlots &&
"Invalid reorder buffer size!");
37 Queue.resize(AvailableSlots);
42 unsigned NumMicroOps) {
44 unsigned NormalizedQuantity =
45 std::min(NumMicroOps, static_cast<unsigned>(Queue.size()));
49 NormalizedQuantity =
std::max(NormalizedQuantity, 1U);
50 unsigned TokenID = NextAvailableSlotIdx;
51 Queue[NextAvailableSlotIdx] = {
IR, NormalizedQuantity,
false};
52 NextAvailableSlotIdx += NormalizedQuantity;
53 NextAvailableSlotIdx %= Queue.size();
54 AvailableSlots -= NormalizedQuantity;
59 return Queue[CurrentInstructionSlotIdx];
65 assert(Current.
IR &&
"Invalid RUToken in the RCU queue.");
69 CurrentInstructionSlotIdx += Current.
NumSlots;
70 CurrentInstructionSlotIdx %= Queue.size();
75 assert(Queue.size() > TokenID);
76 assert(Queue[TokenID].Executed ==
false && Queue[TokenID].
IR);
77 Queue[TokenID].Executed =
true;
82 dbgs() <<
"Retire Unit: { Total Slots=" << Queue.size()
83 <<
", Available Slots=" << AvailableSlots <<
" }\n";
Instruction * getInstruction()
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
This class represents lattice values for constants.
This file simulates the hardware responsible for retiring instructions.
An InstRef contains both a SourceMgr index and Instruction pair.
void consumeCurrentToken()
const RUToken & peekCurrentToken() const
void onInstructionExecuted(unsigned TokenID)
bool hasExtraProcessorInfo() const
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool isAvailable(unsigned Quantity=1) const
const MCExtraProcessorInfo & getExtraProcessorInfo() const
RetireControlUnit(const MCSchedModel &SM)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
unsigned reserveSlot(const InstRef &IS, unsigned NumMicroOps)
Machine model for scheduling, bundling, and heuristics.
Statically lint checks LLVM IR