This patch contains all of the clang changes from D72959.
- Generalized the relative vtables ABI such that it can be used by other targets.
- Adds an enum VTableComponentLayout which controls whether components in the vtable should be pointers to other structs or relative offsets to those structs. Other ABIs can change this enum to restructure how components in the vtable are laid out/accessed.
- Adds methods to ConstantInitBuilder for inserting relative offsets to a specified position in the aggregate being constructed.
See D72959 for background info.
The only "struct" pointed to by the v-table is the type_info object. How are you planning to handle that? The standard ABI makes the type_info a vague-linkage symbol in most cases, so you won't be able to have a direct relative reference to it. If you adopt the Apple ARM64 modification for type_info equality, you can rely on the type_info being defined within the same linkage unit unless the v-table is being emitted as an optimization for a type defined with a key function in a different linkage unit. You could handle that by making this an "inidirectable" relative reference, where it's either a direct relative reference or a relative reference to a GOT entry, as specified by the low bit in the reference. But you need *some* solution for this.