[PATCH] D125008: [llvm-objdump] Print Mnemonic Histogram

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 05:47:15 PDT 2022


SjoerdMeijer created this revision.
SjoerdMeijer added reviewers: jhenderson, MaskRay, ostannard, keith, DavidSpickett.
Herald added subscribers: StephenFan, rupprecht, mgrang.
Herald added a project: All.
SjoerdMeijer requested review of this revision.
Herald added a project: LLVM.

This adds option --mnemonic-hist to print a histogram of all (static) instructions/mnemonics. For example:

  $ llvm-objdump --triple=thumbv7 -d --mnemonic-hist
  ..
  Instruction histogram:
           ldr:   120 (27.3973%)
           mov:    96 (21.9178%)
           blx:    56 (12.7854%)
           bl:    31 (7.07763%)
           str:    26 (5.93607%)
           add:    18 (4.10959%)
           b:    12 (2.73973%)
           sub:    10 (2.28311%)
           cmp:     9 (2.05479%)
           ..

I am probably interested in printing more information, like the encoding width, but this seems a good first step.


https://reviews.llvm.org/D125008

Files:
  llvm/test/tools/llvm-objdump/ARM/mnemonic-hist0.test
  llvm/test/tools/llvm-objdump/ARM/mnemonic-hist1.test
  llvm/tools/llvm-objdump/ObjdumpOpts.td
  llvm/tools/llvm-objdump/llvm-objdump.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125008.427288.patch
Type: text/x-patch
Size: 4504 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220505/1806c2b6/attachment.bin>


More information about the llvm-commits mailing list