[MCA] Use references to LSUnitBase in class Scheduler and add helper methods to acquire/release LS queue entries. NFCI
llvm-svn: 373236
This commit is contained in:
parent
ad88884658
commit
2730df2e16
|
@ -209,8 +209,10 @@ public:
|
||||||
|
|
||||||
unsigned getUsedLQEntries() const { return UsedLQEntries; }
|
unsigned getUsedLQEntries() const { return UsedLQEntries; }
|
||||||
unsigned getUsedSQEntries() const { return UsedSQEntries; }
|
unsigned getUsedSQEntries() const { return UsedSQEntries; }
|
||||||
unsigned assignLQSlot() { return UsedLQEntries++; }
|
void acquireLQSlot() { ++UsedLQEntries; }
|
||||||
unsigned assignSQSlot() { return UsedSQEntries++; }
|
void acquireSQSlot() { ++UsedSQEntries; }
|
||||||
|
void releaseLQSlot() { --UsedLQEntries; }
|
||||||
|
void releaseSQSlot() { --UsedSQEntries; }
|
||||||
|
|
||||||
bool assumeNoAlias() const { return NoAlias; }
|
bool assumeNoAlias() const { return NoAlias; }
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ public:
|
||||||
/// instructions from the dispatch stage, until the write-back stage.
|
/// instructions from the dispatch stage, until the write-back stage.
|
||||||
///
|
///
|
||||||
class Scheduler : public HardwareUnit {
|
class Scheduler : public HardwareUnit {
|
||||||
LSUnit &LSU;
|
LSUnitBase &LSU;
|
||||||
|
|
||||||
// Instruction selection strategy for this Scheduler.
|
// Instruction selection strategy for this Scheduler.
|
||||||
std::unique_ptr<SchedulerStrategy> Strategy;
|
std::unique_ptr<SchedulerStrategy> Strategy;
|
||||||
|
@ -154,15 +154,15 @@ class Scheduler : public HardwareUnit {
|
||||||
bool promoteToPendingSet(SmallVectorImpl<InstRef> &Pending);
|
bool promoteToPendingSet(SmallVectorImpl<InstRef> &Pending);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Scheduler(const MCSchedModel &Model, LSUnit &Lsu)
|
Scheduler(const MCSchedModel &Model, LSUnitBase &Lsu)
|
||||||
: Scheduler(Model, Lsu, nullptr) {}
|
: Scheduler(Model, Lsu, nullptr) {}
|
||||||
|
|
||||||
Scheduler(const MCSchedModel &Model, LSUnit &Lsu,
|
Scheduler(const MCSchedModel &Model, LSUnitBase &Lsu,
|
||||||
std::unique_ptr<SchedulerStrategy> SelectStrategy)
|
std::unique_ptr<SchedulerStrategy> SelectStrategy)
|
||||||
: Scheduler(std::make_unique<ResourceManager>(Model), Lsu,
|
: Scheduler(std::make_unique<ResourceManager>(Model), Lsu,
|
||||||
std::move(SelectStrategy)) {}
|
std::move(SelectStrategy)) {}
|
||||||
|
|
||||||
Scheduler(std::unique_ptr<ResourceManager> RM, LSUnit &Lsu,
|
Scheduler(std::unique_ptr<ResourceManager> RM, LSUnitBase &Lsu,
|
||||||
std::unique_ptr<SchedulerStrategy> SelectStrategy)
|
std::unique_ptr<SchedulerStrategy> SelectStrategy)
|
||||||
: LSU(Lsu), Resources(std::move(RM)), BusyResourceUnits(0),
|
: LSU(Lsu), Resources(std::move(RM)), BusyResourceUnits(0),
|
||||||
NumDispatchedToThePendingSet(0), HadTokenStall(false) {
|
NumDispatchedToThePendingSet(0), HadTokenStall(false) {
|
||||||
|
|
|
@ -72,9 +72,9 @@ unsigned LSUnit::dispatch(const InstRef &IR) {
|
||||||
assert((Desc.MayLoad || Desc.MayStore) && "Not a memory operation!");
|
assert((Desc.MayLoad || Desc.MayStore) && "Not a memory operation!");
|
||||||
|
|
||||||
if (Desc.MayLoad)
|
if (Desc.MayLoad)
|
||||||
assignLQSlot();
|
acquireLQSlot();
|
||||||
if (Desc.MayStore)
|
if (Desc.MayStore)
|
||||||
assignSQSlot();
|
acquireSQSlot();
|
||||||
|
|
||||||
if (Desc.MayStore) {
|
if (Desc.MayStore) {
|
||||||
// Always create a new group for store operations.
|
// Always create a new group for store operations.
|
||||||
|
@ -173,13 +173,13 @@ void LSUnitBase::onInstructionExecuted(const InstRef &IR) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsALoad) {
|
if (IsALoad) {
|
||||||
UsedLQEntries--;
|
releaseLQSlot();
|
||||||
LLVM_DEBUG(dbgs() << "[LSUnit]: Instruction idx=" << IR.getSourceIndex()
|
LLVM_DEBUG(dbgs() << "[LSUnit]: Instruction idx=" << IR.getSourceIndex()
|
||||||
<< " has been removed from the load queue.\n");
|
<< " has been removed from the load queue.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsAStore) {
|
if (IsAStore) {
|
||||||
UsedSQEntries--;
|
releaseSQSlot();
|
||||||
LLVM_DEBUG(dbgs() << "[LSUnit]: Instruction idx=" << IR.getSourceIndex()
|
LLVM_DEBUG(dbgs() << "[LSUnit]: Instruction idx=" << IR.getSourceIndex()
|
||||||
<< " has been removed from the store queue.\n");
|
<< " has been removed from the store queue.\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue