1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

[llvm-mca] Constify the 'notify' routines. NFC.

Also fixed up some whitespace formatting in DispatchStage.cpp.

llvm-svn: 343615
This commit is contained in:
Matt Davis 2018-10-02 18:26:33 +00:00
parent 4581267dc8
commit 3f9316b070
6 changed files with 18 additions and 16 deletions

View File

@ -65,7 +65,7 @@ class DispatchStage final : public Stage {
void notifyInstructionDispatched(const InstRef &IR, void notifyInstructionDispatched(const InstRef &IR,
llvm::ArrayRef<unsigned> UsedPhysRegs, llvm::ArrayRef<unsigned> UsedPhysRegs,
unsigned uOps); unsigned uOps) const;
void collectWrites(llvm::SmallVectorImpl<WriteRef> &Vec, void collectWrites(llvm::SmallVectorImpl<WriteRef> &Vec,
unsigned RegID) const { unsigned RegID) const {

View File

@ -61,13 +61,13 @@ public:
void notifyInstructionIssued( void notifyInstructionIssued(
const InstRef &IR, const InstRef &IR,
llvm::ArrayRef<std::pair<ResourceRef, ResourceCycles>> Used); llvm::ArrayRef<std::pair<ResourceRef, ResourceCycles>> Used) const;
void notifyInstructionExecuted(const InstRef &IR); void notifyInstructionExecuted(const InstRef &IR) const;
void notifyInstructionReady(const InstRef &IR); void notifyInstructionReady(const InstRef &IR) const;
void notifyResourceAvailable(const ResourceRef &RR); void notifyResourceAvailable(const ResourceRef &RR) const;
// Notify listeners that buffered resources have been consumed or freed. // Notify listeners that buffered resources have been consumed or freed.
void notifyReservedOrReleasedBuffers(const InstRef &IR, bool Reserved); void notifyReservedOrReleasedBuffers(const InstRef &IR, bool Reserved) const;
}; };
} // namespace mca } // namespace mca

View File

@ -38,7 +38,7 @@ public:
bool hasWorkToComplete() const override { return !RCU.isEmpty(); } bool hasWorkToComplete() const override { return !RCU.isEmpty(); }
llvm::Error cycleStart() override; llvm::Error cycleStart() override;
llvm::Error execute(InstRef &IR) override; llvm::Error execute(InstRef &IR) override;
void notifyInstructionRetired(const InstRef &IR); void notifyInstructionRetired(const InstRef &IR) const;
}; };
} // namespace mca } // namespace mca

View File

@ -29,7 +29,7 @@ namespace mca {
void DispatchStage::notifyInstructionDispatched(const InstRef &IR, void DispatchStage::notifyInstructionDispatched(const InstRef &IR,
ArrayRef<unsigned> UsedRegs, ArrayRef<unsigned> UsedRegs,
unsigned UOps) { unsigned UOps) const {
LLVM_DEBUG(dbgs() << "[E] Instruction Dispatched: #" << IR << '\n'); LLVM_DEBUG(dbgs() << "[E] Instruction Dispatched: #" << IR << '\n');
notifyEvent<HWInstructionEvent>( notifyEvent<HWInstructionEvent>(
HWInstructionDispatchedEvent(IR, UsedRegs, UOps)); HWInstructionDispatchedEvent(IR, UsedRegs, UOps));
@ -115,7 +115,8 @@ Error DispatchStage::dispatch(InstRef IR) {
// to the instruction. // to the instruction.
SmallVector<unsigned, 4> RegisterFiles(PRF.getNumRegisterFiles()); SmallVector<unsigned, 4> RegisterFiles(PRF.getNumRegisterFiles());
for (std::unique_ptr<WriteState> &WS : IS.getDefs()) for (std::unique_ptr<WriteState> &WS : IS.getDefs())
PRF.addRegisterWrite(WriteRef(IR.getSourceIndex(), WS.get()), RegisterFiles); PRF.addRegisterWrite(WriteRef(IR.getSourceIndex(), WS.get()),
RegisterFiles);
// Reserve slots in the RCU, and notify the instruction that it has been // Reserve slots in the RCU, and notify the instruction that it has been
// dispatched to the schedulers for execution. // dispatched to the schedulers for execution.
@ -138,7 +139,7 @@ Error DispatchStage::cycleStart() {
unsigned DispatchedOpcodes = DispatchWidth - AvailableEntries; unsigned DispatchedOpcodes = DispatchWidth - AvailableEntries;
CarryOver -= DispatchedOpcodes; CarryOver -= DispatchedOpcodes;
assert(CarriedOver.isValid() && "Invalid dispatched instruction"); assert(CarriedOver.isValid() && "Invalid dispatched instruction");
SmallVector<unsigned, 8> RegisterFiles(PRF.getNumRegisterFiles(), 0U); SmallVector<unsigned, 8> RegisterFiles(PRF.getNumRegisterFiles(), 0U);
notifyInstructionDispatched(CarriedOver, RegisterFiles, DispatchedOpcodes); notifyInstructionDispatched(CarriedOver, RegisterFiles, DispatchedOpcodes);
if (!CarryOver) if (!CarryOver)

View File

@ -136,19 +136,19 @@ Error ExecuteStage::execute(InstRef &IR) {
return issueInstruction(IR); return issueInstruction(IR);
} }
void ExecuteStage::notifyInstructionExecuted(const InstRef &IR) { void ExecuteStage::notifyInstructionExecuted(const InstRef &IR) const {
LLVM_DEBUG(dbgs() << "[E] Instruction Executed: #" << IR << '\n'); LLVM_DEBUG(dbgs() << "[E] Instruction Executed: #" << IR << '\n');
notifyEvent<HWInstructionEvent>( notifyEvent<HWInstructionEvent>(
HWInstructionEvent(HWInstructionEvent::Executed, IR)); HWInstructionEvent(HWInstructionEvent::Executed, IR));
} }
void ExecuteStage::notifyInstructionReady(const InstRef &IR) { void ExecuteStage::notifyInstructionReady(const InstRef &IR) const {
LLVM_DEBUG(dbgs() << "[E] Instruction Ready: #" << IR << '\n'); LLVM_DEBUG(dbgs() << "[E] Instruction Ready: #" << IR << '\n');
notifyEvent<HWInstructionEvent>( notifyEvent<HWInstructionEvent>(
HWInstructionEvent(HWInstructionEvent::Ready, IR)); HWInstructionEvent(HWInstructionEvent::Ready, IR));
} }
void ExecuteStage::notifyResourceAvailable(const ResourceRef &RR) { void ExecuteStage::notifyResourceAvailable(const ResourceRef &RR) const {
LLVM_DEBUG(dbgs() << "[E] Resource Available: [" << RR.first << '.' LLVM_DEBUG(dbgs() << "[E] Resource Available: [" << RR.first << '.'
<< RR.second << "]\n"); << RR.second << "]\n");
for (HWEventListener *Listener : getListeners()) for (HWEventListener *Listener : getListeners())
@ -156,7 +156,8 @@ void ExecuteStage::notifyResourceAvailable(const ResourceRef &RR) {
} }
void ExecuteStage::notifyInstructionIssued( void ExecuteStage::notifyInstructionIssued(
const InstRef &IR, ArrayRef<std::pair<ResourceRef, ResourceCycles>> Used) { const InstRef &IR,
ArrayRef<std::pair<ResourceRef, ResourceCycles>> Used) const {
LLVM_DEBUG({ LLVM_DEBUG({
dbgs() << "[E] Instruction Issued: #" << IR << '\n'; dbgs() << "[E] Instruction Issued: #" << IR << '\n';
for (const std::pair<ResourceRef, ResourceCycles> &Resource : Used) { for (const std::pair<ResourceRef, ResourceCycles> &Resource : Used) {
@ -169,7 +170,7 @@ void ExecuteStage::notifyInstructionIssued(
} }
void ExecuteStage::notifyReservedOrReleasedBuffers(const InstRef &IR, void ExecuteStage::notifyReservedOrReleasedBuffers(const InstRef &IR,
bool Reserved) { bool Reserved) const {
const InstrDesc &Desc = IR.getInstruction()->getDesc(); const InstrDesc &Desc = IR.getInstruction()->getDesc();
if (Desc.Buffers.empty()) if (Desc.Buffers.empty())
return; return;

View File

@ -47,7 +47,7 @@ llvm::Error RetireStage::execute(InstRef &IR) {
return llvm::ErrorSuccess(); return llvm::ErrorSuccess();
} }
void RetireStage::notifyInstructionRetired(const InstRef &IR) { void RetireStage::notifyInstructionRetired(const InstRef &IR) const {
LLVM_DEBUG(llvm::dbgs() << "[E] Instruction Retired: #" << IR << '\n'); LLVM_DEBUG(llvm::dbgs() << "[E] Instruction Retired: #" << IR << '\n');
llvm::SmallVector<unsigned, 4> FreedRegs(PRF.getNumRegisterFiles()); llvm::SmallVector<unsigned, 4> FreedRegs(PRF.getNumRegisterFiles());
const Instruction &Inst = *IR.getInstruction(); const Instruction &Inst = *IR.getInstruction();