TIL: zero size types take up no space in the calling conventions for x86_64.
Hence tag dispatch is totally invisible, not taking up any of the useful calling registers or padding out the stack space. This is not the case for armv8, these tags take space.
https://godbolt.org/z/nadE7ne7K
So I think that means that it is preferable to do tag dispatch as the last argument of a function. The idea is not to waste useful registers. Is that a good take?
godbolt.orgCompiler Explorer - C++struct Tag {};
void dispatch(Tag, int, int);
void dispatch(int, Tag, int);
void dispatch(int, int, Tag);
// what happen when we spill to the stack
// edi, esi, edx, ecx, r8d, r9d .... stack
// w0, w1, w2, w3, w4, w5, w6, w7, .... stack
void dispatch(int, int, int, int, int, int, /*x86_64*/ int, int,
/*armv8-a*/ int, Tag, int);
void test() {
dispatch(Tag(), 1, 2);
dispatch(3, Tag(), 4);
dispatch(5, 6, Tag());
dispatch(7, 8, 9, 10, 11, 12, 13, 14, 15, Tag(), 16);
}