Some refactoring I thought would be useful while looking at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77576 I think some duplicated code can go away by doing this, while also saving a bit of memory.