unify getReg and walk