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

Sjoerd Meijer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 6 06:43:04 PDT 2022


SjoerdMeijer updated this revision to Diff 427616.
SjoerdMeijer added a comment.

I haven't addressed feedback yet, but have just added a few things to help with the discussion where this belongs.
This now also prints the number of bytes per instruction, so for thumb it now distinguishes between the narrow/wide encodings, and I have also added printing a histogram of  immediates. This will look now look like this:

    Mnemonic histogram:
    Mnemonic Freq             Bytes
    ldr (T1): 112 ( 25.5708%)   224 ( 22.0472%)
    mov (T1):  95 ( 21.6895%)   190 ( 18.7008%)
    blx (T1):  56 ( 12.7854%)   112 ( 11.0236%)
     bl (T2):  31 ( 7.07763%)   124 ( 12.2047%)
    str (T1):  23 ( 5.25114%)    46 ( 4.52756%)
      b (T1):  11 ( 2.51142%)    22 ( 2.16535%)
    add (T1):  11 ( 2.51142%)    22 ( 2.16535%)
    sub (T1):  10 ( 2.28311%)    20 (  1.9685%)
    cmp (T1):   8 ( 1.82648%)    16 (  1.5748%)
    ldr (T2):   8 ( 1.82648%)    32 ( 3.14961%)
    add (T2):   7 ( 1.59817%)    28 ( 2.75591%)
    asr (T1):   6 ( 1.36986%)    12 (  1.1811%)
   ldrb (T1):   5 ( 1.14155%)    10 (0.984252%)
   ..
  Immediate histogram:
        14:       425
         0:        40
        -4:        32
         3:        26
         1:        21
        10:        15
         2:        14
         8:        11
         5:         9
        16:         8
        18:         6


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125008/new/

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.427616.patch
Type: text/x-patch
Size: 6402 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220506/afe7330e/attachment.bin>


More information about the llvm-commits mailing list