[PATCH] D44309: [llvm-mca] Revactor event listeners to make the backend agnostic to event types.

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 10 00:23:48 PST 2018


RKSimon added a reviewer: RKSimon.
RKSimon added a comment.

Some minor style comments



================
Comment at: tools/llvm-mca/Backend.h:85
   unsigned getNumInstructions() const { return SM.size(); }
+  const Instruction& getInstruction(unsigned Index) const { return *Instructions.find(Index)->second; }
+  void eraseInstruction(unsigned Index) { Instructions.erase(Index); }
----------------
andreadb wrote:
> 80-col.
Add an assertion before dereferencing pointer?


================
Comment at: tools/llvm-mca/HWEventListener.h:52
+  HWInstructionIssuedEvent(unsigned Index, llvm::ArrayRef<std::pair<ResourceRef, unsigned>> UsedResources)
+      : HWInstructionEvent(HWInstructionEvent::Issued, Index), UsedResources(UsedResources) {}
 
----------------
UsedResources(UsedResources) ? scary - don't name arguments the same as class members


================
Comment at: tools/llvm-mca/Scheduler.h:489
 
+  void setDispatchUnit(DispatchUnit* DU) { this->DU = DU; }
+
----------------
Avoid the same name for a argument as a member.


Repository:
  rL LLVM

https://reviews.llvm.org/D44309





More information about the llvm-commits mailing list