Move get_reg_ref to util/support.rs