Maintaining the live intervals
If you do not rely on the live intervals within your pass, you could just ignore them because they are automatically recomputed by the regular invalidation mechanism of the pass managers. However, you must actively maintain this information yourself within your pass if you rely on it being correct while modifying the IR. Additionally, if your pass runs in the middle of the register allocation pipeline, you may still want to maintain this representation because, if you invalidate it by modifying the IR, recomputing it may hurt the performance of your compiler since it is compile-time-intensive.
Aside from the updates that you need to perform on the mapping of the SlotIndexes
instance, as you saw in the Introducing the slot indexes section, you need to use the APIs of the LiveIntervals
class to update the live interval of your virtual registers.
Here is an overview of some of the methods of the LiveIntervals
class that you will need to use for...