Add support for patches such as `add_struct`, `set_struct_type` to regz. This requires quite a bit of refactoring to be done in the code. Something like this would be useful in nrf51 patches to avoid a lot of code duplication in the hal.