Page MenuHomePhabricator

[NFC][GISel]: Provide an standard interface to observe changes across GISel passes

Authored by aditya_nandakumar on Nov 27 2018, 3:22 PM.



Currently to track changes to the MachineFunction (to keep work lists updated etc) in the legalizer and combiner, we use different mechanisms that are overlapping and inconsistent.
For eg, in the legalizer, we use MachineIRBuilder::recordInsertions to track new instructions - but the legalizer also mutates instructions which also call recordInsertion. This name is inconsistent with what it does, and also the MachineIRBuilder seems like the wrong abstraction to keep track of removals/mutations.
In the combiner, we use CombinerObserver which also track these changes to instructions using it's own API.
This patch unifies them in a consistent API called GISelChangeObserver that will be passed into most APIs. Now MachineIRBuilder::recordInsertion is removed, and instead the user can install an Observer to MachineIRBuilder or even notify the observer of changes. Additionally, with the MachineFunction::Delegate interface available, we can install the Observer to the MachineFunction to automatically track insertions and deletions.
This should be NFC.

Diff Detail


Event Timeline

volkan accepted this revision.Dec 5 2018, 11:30 AM


This revision is now accepted and ready to land.Dec 5 2018, 11:30 AM

Thanks Volkan. Committed in r348406.