Implement invalidate_shared_regs( ) using new share_and_clear*( ) functions.
Add new functions for adding and remove shared computations.
Remove invalid computations instead of replacing them with an empty one.