[RFC] New `stack` dialect

The “analysis workflow” would look something like this:

  1. You import the binary into fused operations
  2. A pass converts the fused operations into stack + regular SSA operations
  3. The rewrites described in the first post eliminate the stack operations and leave a clean SSA module

If you don’t need anything else, you can actually just ignore the first two steps, not provide a fused dialect and just emit stack + SSA directly.

The issue comes when you want to turn SSA into stack language for codegen purposes, without a fused dialect: you would be stuck trying to pattern match against raw push and pops, or against the SSA directly. It’s possible, but it would be nice to have a way to possibly optimize the stack form in MLIR directly

1 Like