porting mem2reg