I was interested in contributing an option to llvm-objdump to print a histogram of all (static) instructions present in the object, so that you could do and get something like this:
$ llvm-objdump -d --mnemonic-hist test.o .. Mnemonic 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%) ...
The question is where this should live:
- This output example could also be achieved with a one-liner on the command line – not that straightforward and easy to read, but certainly doable.
- This wouldn’t work when additional instruction information, like encoding width, needs to be printed. So a script would be required, which we could e.g. contribute to
- These two options wouldn’t beat the convenience of having a built-in option.
If there are any opinions on this, please add them here or on the review: ⚙ D125008 [llvm-objdump] Print Mnemonic Histogram