egraphs-good / eggcc

MIT License
51 stars 11 forks source link

Memory ops for RVSDG => Bril #353

Closed ezrosent closed 9 months ago

ezrosent commented 9 months ago

Wire in memory ops in to_cfg. Opening a draft as there are a few questions in to_cfg I'd like to resolve.

Fixes #343

ezrosent commented 9 months ago

Done! This uncovered a preexisting issue with converting empty functions:

@funcA(p: ptr<int>) {
  ret;
}

@main {
  five: int = const 5;
  x: ptr<int> = alloc five;
  call @funcA x;
  free x;
}

Gets translated back correctly, but @funcA had an empty body

@funcA(p: ptr<int>) {
}

Which caused the bril interpreter to panic. I added some code to fix that.