dt: add helper for phandle allocation