HomePhabricator

[AsmPrinter] Add per BB instruction mix remark.

Authored by fhahn on Oct 26 2020, 2:01 AM.

Description

[AsmPrinter] Add per BB instruction mix remark.

This patch adds a remarks that provides counts for each opcode per basic block.

An snippet of the generated information can be seen below.

The current implementation uses the target specific opcode for the counts. For example, on AArch64 this means we currently get 2 entries for add instructions if the block contains 32 and 64 bit adds. Similarly, immediate version are treated differently.

Unfortunately there seems to be no convenient way to get only the mnemonic part of the instruction as a string AFAIK. This could be improved in the future.

--- !Analysis
Pass:            asm-printer
Name:            InstructionMix
DebugLoc:        { File: arm64-instruction-mix-remarks.ll, Line: 30, Column: 30 }
Function:        foo
Args:
  - String:          'BasicBlock: '
  - BasicBlock:      else
  - String:          "\n"
  - String:          INST_MADDWrrr
  - String:          ': '
  - INST_MADDWrrr:   '2'
  - String:          "\n"
  - String:          INST_MOVZWi
  - String:          ': '
  - INST_MOVZWi:     '1'

Reviewed By: anemet, thegameg, paquette

Differential Revision: https://reviews.llvm.org/D89892

Details

Committed
fhahnOct 26 2020, 2:25 AM
Reviewer
anemet
Differential Revision
D89892: [AsmPrinter] Add per BB instruction mix remark.
Parents
rGa094b4fa4b7f: [AMDGPU] Emit new pal metadata by default
Branches
Unknown
Tags
Unknown