[Dwarf-discuss] ISSUE: vector types. V2

Pedro Alves pedro@palves.net
Wed Apr 12 12:05:14 GMT 2023

On 2023-04-06 1:03 p.m., Jakub Jelinek via Dwarf-discuss wrote:
> On Thu, Apr 06, 2023 at 07:52:32AM -0400, Ron Brender wrote:

>>> And we almost certainly want to allow vectors on DWARF expression stack;
>> What is so special about vector types in this regard. What do you have
>> against values of array or structure types being
>> on the stack (the latter especially because they are often/mostly passed by
>> value in many languages, even C)?
>> I don't see the point of vector types being special.
> I thought Ben has posted the details.
> In memory they look the same as 0 based arrays, but they often have
> different calling conventions (argument passing, returning), they support
> various arithmetic operations on them, in C++ they support even comparisons
> (though, unlike scalar comparisons, vector comparisons produce element
> values 0 for false and -1/all ones for true), they don't promote to pointers.
> So, for the debug info consumers it is significantly different behavior than arrays.
> If a is int a[16];, then a + 2 is &a[0] + 2, while if a is int
> __attribute__((vector_size (16 * sizeof (int)))), a + 2 would be either an
> error if the language extension doesn't allow vector + scalar, or
> {a[0]+2,a[1]+2,a[2]+2,...,a[15]+2} vector.

I think the open question is more like -- why only allow base types and vector types
in the expression stack, why not allow other types like regular arrays and structs?
Why do vector types need to be put on the stack, while arrays and structs don't?
What is special about vector types in that sense?

More information about the Dwarf-discuss mailing list