[Dwarf-discuss] ISSUE: vector types. V2
Thu Apr 6 10:16:46 GMT 2023
On Wed, Apr 05, 2023 at 07:16:35PM -0700, Ben Woodard via Dwarf-discuss wrote:
> To distinguish these vector types from regular C arrays, GCC's DWARF
> describes a vector type as an array with the DW_AT_GNU_vector
> attribute. Clang also supports the GCC vector extensions, and
> describes the vector types in DWARF using the same attribute as GCC.
> Support for this DWARF extension has been implemented in GDB for well
> over a decade.
> Other languages have support for vector types, with similar ABI and/or
> API implications, and so DW_AT_GNU_vector is also used for languages
> beyond C/C++ today.
> This proposal standardizes the existing behavior.
I don't think this is a good idea, we should go for
instead IMHO. DW_AT_GNU_vector used to be a good idea as an extension,
as mentioned the (generic) vector types are in many ways similar to arrays,
so even a DWARF consumer which doesn't understand DW_AT_GNU_vector could
handle the vector types sanely in some cases.
But as you also mention, vector types are in various ways different from
array types. Not sure if supporting dimensions in the way which is done
for arrays is needed (I believe vector types are always one-dimensional
indexed from 0). And we almost certainly want to allow vectors on DWARF
expression stack; I'd probably not make DW_TAG_vector_type a base type,
but extended the typed DWARF stack so that it can contain base types or
DW_TAG_vector_type of base types or something similar.
More information about the Dwarf-discuss