Skip to content

Clean up repairable

rarbore2 requested to merge repairable2 into main
  • Clean up the prototype repairable / function editor implementation done by @xrouth2.
  • Core interface is edit method on a FunctionEditor struct, which contains a &mut Function. edit takes a closure that implements a single edit on the function. edit is passed a FunctionEdit, on which there are methods delete_node, add_node, and replace_all_uses_with. Per-edit, an entry is added to a list internal to the FunctionEditor containing each edit, where one edit contains a deleted node set and an added node set.
    • The FunctionEditor also contains a mutable def_use map that it incrementally updates based off of replace_all_uses_with. This def_use map is available to use by passes.
  • Each transformation is passed a FunctionEditor, on which it accumulates edits to the function using edit. After the transformation, the pass manager 1. uses the edit list to repair partitions and debug info and 2. recompacts node IDs by deleting gravestone nodes and updating side data structures containing node IDs (partitions and debug info)
  • Partitions are repaired in the following way:
    1. Collapse all of the edits in the edit list into a single edit
    2. Compute the reverse postorder of the function, and assign added nodes to partitions in order that they're in the rev po - this logic is per-node specific
    3. Delete deleted nodes from partitions
  • Closes #3 (closed)
Edited by rarbore2

Merge request reports

Loading