Skip to contentSkip to conversation

Add plugin bbvgen: basic block icounts for topblocks + simpoints

PATCH Superseded Greg McGary 2 participants 3 messages Aug 5, 2024 – Aug 6, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add plugin bbvgen: basic block icounts for topblocks + simpoints

Tally icounts for basic blocks. The data is useful for producing human-readable topblocks reports, and for creating simpoints to guide accurate & efficient machine simulation runs.

QEMU's The Tiny Code Generator creates TCG blocks in a way that is expedient for JIT translation but does not conform to the model of CFG basic blocks. TCG greedily translates straight-line code until it must end the block for one of four reasons: (1) page boundary, or (2) maximum TCG block length, or (3) CSR-hacking insn, or (4) jump/branch insn. A single TCG block can span multiple CFG blocks when there are internal branch targets. Multiple TCG blocks can constitute a single CFG block when the component TCG blocks terminate at page boundary, max block length, or CSR-hacking insn.

The bbvgen plugin normalizes TCG blocks into CFG blocks.

---
 contrib/plugins/Makefile |    1 +
 contrib/plugins/bbvgen.c | 1969 ++++++++++++++++++++++++++++++++++++++
 docs/about/emulation.rst |   69 ++
 3 files changed, 2039 insertions(+)
 create mode 100644 contrib/plugins/bbvgen.c
contrib/plugins/Makefile +1 -0
index edf256cd9d..30f543e6fd 100644
@@ -29,6 +29,7 @@ NAMES += cache
 NAMES += drcov
 NAMES += ips
 NAMES += stoptrigger
+NAMES += bbvgen
 
 ifeq ($(CONFIG_WIN32),y)
 SO_SUFFIX := .dll
contrib/plugins/bbvgen.c new file +1969 -0

1,969 lines not on this page · raw message

docs/about/emulation.rst +69 -0

75 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw
Quoted 14 lines · Greg McGary

Tally icounts for basic blocks. The data is useful for producing human-readable topblocks reports, and for creating simpoints to guide accurate & efficient machine simulation runs.

QEMU's The Tiny Code Generator creates TCG blocks in a way that is expedient for JIT translation but does not conform to the model of CFG basic blocks. TCG greedily translates straight-line code until it must end the block for one of four reasons: (1) page boundary, or (2) maximum TCG block length, or (3) CSR-hacking insn, or (4) jump/branch insn. A single TCG block can span multiple CFG blocks when there are internal branch targets. Multiple TCG blocks can constitute a single CFG block when the component TCG blocks terminate at page boundary, max block length, or CSR-hacking insn.

Quoted 1 line

The bbvgen plugin normalizes TCG blocks into CFG blocks.

Are there any tools that consume this data?

<snip>

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#2 lore raw
Quoted 1 line

Are there any tools that consume this data?

Yes. I will post one soon as a follow-up patch. It takes the bbvi.json.gz as input and produces a report sorted by icount of disassembled top blocks.

G