HomePhabricator

[CSSPGO][llvm-profgen] Disassemble text sections

Authored by wlei on Oct 19 2020, 10:02 AM.

Description

[CSSPGO][llvm-profgen] Disassemble text sections

This stack of changes introduces llvm-profgen utility which generates a profile data file from given perf script data files for sample-based PGO. It’s part of(not only) the CSSPGO work. Specifically to support context-sensitive with/without pseudo probe profile, it implements a series of functionalities including perf trace parsing, instruction symbolization, LBR stack/call frame stack unwinding, pseudo probe decoding, etc. Also high throughput is achieved by multiple levels of sample aggregation and compatible format with one stop is generated at the end. Please refer to: https://groups.google.com/g/llvm-dev/c/1p1rdYbL93s for the CSSPGO RFC.

This change enables disassembling the text sections to build various address maps that are potentially used by the virtual unwinder. A switch --show-disassembly is being added to print the disassembly code.

Like the llvm-objdump tool, this change leverages existing LLVM components to parse and disassemble ELF binary files. So far X86 is supported.

Test Plan:

ninja check-llvm

Reviewed By: wmi, wenlei

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

Details

Committed
wleiNov 20 2020, 2:26 PM
Reviewer
wmi
Differential Revision
D89712: [CSSPGO][llvm-profgen] Disassemble text sections
Parents
rGa94fa8622971: [CSSPGO][llvm-profgen] Parse mmap events from perf script
Branches
Unknown
Tags
Unknown