16#ifndef LLVM_MCA_HARDWAREUNITS_REGISTERFILE_H
17#define LLVM_MCA_HARDWAREUNITS_REGISTERFILE_H
40 unsigned WriteBackCycle;
45 static const unsigned INVALID_IID;
49 : IID(INVALID_IID), WriteBackCycle(), WriteResID(), RegisterID(),
93 struct RegisterMappingTracker {
98 const unsigned NumPhysRegs;
100 unsigned NumUsedPhysRegs;
105 const unsigned MaxMoveEliminatedPerCycle;
113 unsigned NumMoveEliminated;
116 bool AllowZeroMoveEliminationOnly;
118 RegisterMappingTracker(
unsigned NumPhysRegisters,
119 unsigned MaxMoveEliminated = 0U,
120 bool AllowZeroMoveElimOnly =
false)
121 : NumPhysRegs(NumPhysRegisters), NumUsedPhysRegs(0),
122 MaxMoveEliminatedPerCycle(MaxMoveEliminated), NumMoveEliminated(0U),
123 AllowZeroMoveEliminationOnly(AllowZeroMoveElimOnly) {}
144 using IndexPlusCostPairTy = std::pair<unsigned, unsigned>;
165 struct RegisterRenamingInfo {
166 IndexPlusCostPairTy IndexPlusCost;
169 bool AllowMoveElimination;
170 RegisterRenamingInfo()
171 : IndexPlusCost(std::make_pair(0U, 1U)), RenameAs(0U), AliasRegID(0U),
172 AllowMoveElimination(
false) {}
187 using RegisterMapping = std::pair<WriteRef, RegisterRenamingInfo>;
190 std::vector<RegisterMapping> RegisterMappings;
196 unsigned CurrentCycle;
217 void allocatePhysRegs(
const RegisterRenamingInfo &Entry,
222 void freePhysRegs(
const RegisterRenamingInfo &Entry,
229 void initialize(
const MCSchedModel &SM,
unsigned NumRegs);
233 unsigned NumRegs = 0);
270 unsigned PRFIndex)
const;
This file implements a class to represent arbitrary precision integral constant values and operations...
SmallVector< uint32_t, 0 > Writes
This file defines a base class for describing a simulated hardware unit.
This file defines the SmallVector class.
Class for arbitrary precision integers.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
A possibly irreducible generalization of a Loop.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Generic base class for all target subtargets.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction propagated through the simulated instruction pipeline.
Tracks register operand latency in cycles.
Manages hardware register files, and tracks register definitions for register renaming purposes.
void collectWrites(const MCSubtargetInfo &STI, const ReadState &RS, SmallVectorImpl< WriteRef > &Writes, SmallVectorImpl< WriteRef > &CommittedWrites) const
unsigned getElapsedCyclesFromWriteBack(const WriteRef &WR) const
void addRegisterWrite(WriteRef Write, MutableArrayRef< unsigned > UsedPhysRegs)
unsigned isAvailable(ArrayRef< MCPhysReg > Regs) const
unsigned getNumRegisterFiles() const
RAWHazard checkRAWHazards(const MCSubtargetInfo &STI, const ReadState &RS) const
void removeRegisterWrite(const WriteState &WS, MutableArrayRef< unsigned > FreedPhysRegs)
bool tryEliminateMoveOrSwap(MutableArrayRef< WriteState > Writes, MutableArrayRef< ReadState > Reads)
void addRegisterRead(ReadState &RS, const MCSubtargetInfo &STI) const
bool canEliminateMove(const WriteState &WS, const ReadState &RS, unsigned PRFIndex) const
void onInstructionExecuted(Instruction *IS)
A reference to a register write.
bool isAvailable() const
Returns true if this register write has been executed, and the new register value is therefore availa...
unsigned getSourceIndex() const
unsigned getWriteResourceID() const
void notifyExecuted(unsigned Cycle)
bool operator==(const WriteRef &Other) const
const WriteState * getWriteState() const
MCPhysReg getRegisterID() const
WriteState * getWriteState()
unsigned getWriteBackCycle() const
bool hasKnownWriteBackCycle() const
Tracks uses of a register definition (e.g.
This is an optimization pass for GlobalISel generic memory operations.
uint16_t MCPhysReg
An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...
A register file descriptor.
Machine model for scheduling, bundling, and heuristics.
bool hasUnknownCycles() const