replace TI and RI with register references