Shopify / seafoam

A tool for working with compiler graphs dumped by the GraalVM compiler
MIT License
126 stars 22 forks source link

Add basic support for getting disassembly from CFG files #10

Closed chrisseaton closed 3 years ago

chrisseaton commented 3 years ago

The BGV file format that Seafoam usually deals with is Graal's HIR (higher intermediate representation.) HIR is used for partial evaluation and most compiler phases. Graal's LIR (lower intermediate representation) is used for scheduling, register allocation, instruction selection, and code generation. The LIR equivalent of BGV files is CFG files.

CFG files can be viewed using the c1visualiser but it's unmaintained and it's a complex Netbeans application.

Instead of trying to use a disassembler from within Graal, maybe it's simpler to just use the CFG files, and add support for them to Seafoam.

Initial work in https://github.com/Shopify/seafoam/tree/cfg2asm. The idea is there would be a command like

% cfg2asm foo.cfg
...assembly code

Then we'd drop https://github.com/oracle/graal/pull/2094.

You can get new CFG files using --vm.Dgraal.Dump --vm.Dgraal.PrintBackendCFG=true (see https://github.com/oracle/graal/pull/2983.)

chrisseaton commented 3 years ago

Fixed in #15 and #18.