I'm looking for some feedback, this is definitively not the final solution.
I was wondering if there was an alternative to pass this information in the dwarf debug-info.
Consider the following sturctures when targetting:
struct foo { int space[4]; char a : 8; char b : 8; char x : 8; char y : 8; }; struct bar { int space[4]; char a : 8; char b : 8; char : 0; char x : 8; char y : 8; };
Even if both structs have the same layout in memory, they are handled
differenlty by the AMDGPU ABI.
With the following code:
// clang --target=amdgcn-amd-amdhsa -g -O1 example.c -S
char use_foo(struct foo f) { return f.y; }
char use_bar(struct bar b) { return b.y; }
For use_foo, the 'y' field is passed in v4
; v_ashrrev_i32_e32 v0, 24, v4
; s_setpc_b64 s[30:31]
For use_bar, the 'y' field is passed in v5
; v_bfe_i32 v0, v5, 8, 8
; s_setpc_b64 s[30:31]
To make this distinction, we record a single 0-size bitfield for every member that is preceded
by it.
Please keep that final .