[PATCH] D84191: [llvm-objdump] Symbolize binary addresses for low-noisy asm diff.

Hongtao Yu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 10:16:17 PDT 2020


hoyFB created this revision.
Herald added subscribers: llvm-commits, rupprecht, MaskRay, hiraditya.
Herald added a reviewer: jhenderson.
Herald added a reviewer: MaskRay.
Herald added a project: LLVM.

When diffing disassembly dump of two binaries, I see lots of noises from mismatched jump target addresses and global data references, which unnecessarily causes diffs on every function, making it impractical. I'm trying to symbolize the raw binary addresses to minimize the diff noise.
In this change, a local branch target is modeled as a label and the branch target operand will simply be printed as a label. Local labels are collected by a separate pre-decoding pass beforehand. A global data memory operand will be printed as a global symbol instead of the raw data address. Unfortunately, due to the way the disassembler is set up and to be less intrusive, a global symbol is always printed as the last operand of a memory access instruction. This is less than ideal but is probably acceptable from checking code quality point of view since on most targets where an instruction can have at most one memory operand.

So far only X86 Intel disassembler is supported.

Test Plan:


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84191

Files:
  llvm/include/llvm/MC/MCInstPrinter.h
  llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86IntelInstPrinter.cpp
  llvm/test/tools/llvm-objdump/X86/disassemble-symbolize-operands.s
  llvm/tools/llvm-objdump/llvm-objdump.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84191.279299.patch
Type: text/x-patch
Size: 9995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200720/0418c974/attachment.bin>


More information about the llvm-commits mailing list