[PATCH] D86390: [llvm-mca][NFC] Refactor instruction printing
Andrea Di Biagio via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 01:06:34 PDT 2020
andreadb accepted this revision.
andreadb added a comment.
Looks good to me module a few nits (see below).
================
Comment at: llvm/tools/llvm-mca/Views/View.h:38
+
+ // Fields that
+ mutable std::string InstructionString;
----------------
Remove this comment.
================
Comment at: llvm/tools/llvm-mca/Views/View.h:47
+ : STI(STI), MCIP(Printer), Source(S), InstrStream(InstructionString) {}
+
+ // Return a reference to a string representing a given machine instruction.
----------------
Please add a virtual destructor.
```
virtual ~InstructionView() = defalt
```
================
Comment at: llvm/tools/llvm-mca/Views/View.h:51-57
+ StringRef printInstructionString(const llvm::MCInst &MCI) const {
+ InstructionString = "";
+ MCIP.printInst(&MCI, 0, "", STI, InstrStream);
+ InstrStream.flush();
+ // Remove any tabs or spaces at the beginning of the instruction.
+ return StringRef(InstructionString).ltrim();
+ }
----------------
Please move this definition to View.cpp.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86390/new/
https://reviews.llvm.org/D86390
More information about the llvm-commits
mailing list