diff options
author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-03-19 19:09:38 +0000 |
---|---|---|
committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-03-19 19:09:38 +0000 |
commit | 44bfcd2d63ed9cd5efd8ab342ad75d0681ea55d6 (patch) | |
tree | 8545947706a4c198e92a04e184e7582d2f1e1513 /llvm/tools/llvm-mca/Scheduler.h | |
parent | db937c9e45f569dc7bfbe6c61a362ead063ccc23 (diff) | |
download | bcm5719-llvm-44bfcd2d63ed9cd5efd8ab342ad75d0681ea55d6.tar.gz bcm5719-llvm-44bfcd2d63ed9cd5efd8ab342ad75d0681ea55d6.zip |
[llvm-mca] Simplify code. NFC
llvm-svn: 327886
Diffstat (limited to 'llvm/tools/llvm-mca/Scheduler.h')
-rw-r--r-- | llvm/tools/llvm-mca/Scheduler.h | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/llvm/tools/llvm-mca/Scheduler.h b/llvm/tools/llvm-mca/Scheduler.h index 69bd2bf9fc2..604b6975d50 100644 --- a/llvm/tools/llvm-mca/Scheduler.h +++ b/llvm/tools/llvm-mca/Scheduler.h @@ -356,27 +356,17 @@ class ResourceManager { public: ResourceManager(const llvm::MCSchedModel &SM) { initialize(SM); } + // Returns RS_BUFFER_AVAILABLE if buffered resources are not reserved, and if + // there are enough available slots in the buffers. ResourceStateEvent - canBeDispatched(const llvm::ArrayRef<uint64_t> Buffers) const { - ResourceStateEvent Result = ResourceStateEvent::RS_BUFFER_AVAILABLE; - for (uint64_t Buffer : Buffers) { - Result = isBufferAvailable(Buffer); - if (Result != ResourceStateEvent::RS_BUFFER_AVAILABLE) - break; - } - - return Result; - } + canBeDispatched(const llvm::ArrayRef<uint64_t> Buffers) const; - void reserveBuffers(const llvm::ArrayRef<uint64_t> Buffers) { - for (const uint64_t R : Buffers) - reserveBuffer(R); - } + // Consume a slot in every buffered resource from array 'Buffers'. Resource + // units that are dispatch hazards (i.e. BufferSize=0) are marked as reserved. + void reserveBuffers(const llvm::ArrayRef<uint64_t> Buffers); - void releaseBuffers(const llvm::ArrayRef<uint64_t> Buffers) { - for (const uint64_t R : Buffers) - releaseBuffer(R); - } + // Release buffer entries previously allocated by method reserveBuffers. + void releaseBuffers(const llvm::ArrayRef<uint64_t> Buffers); void reserveResource(uint64_t ResourceID) { ResourceState &Resource = *Resources[ResourceID]; @@ -479,7 +469,7 @@ class Scheduler { void issue(); /// Issue an instruction without updating the ready queue. - void issueInstruction(Instruction *IS, unsigned InstrIndex); + void issueInstruction(Instruction &IS, unsigned InstrIndex); void updatePendingQueue(); void updateIssuedQueue(); @@ -529,7 +519,7 @@ public: }; Event canBeDispatched(const InstrDesc &Desc) const; - Instruction *scheduleInstruction(unsigned Idx, Instruction *MCIS); + void scheduleInstruction(unsigned Idx, Instruction &MCIS); void cycleEvent(unsigned Cycle); @@ -545,7 +535,6 @@ public: void dump() const; #endif }; - } // Namespace mca #endif |