[Dwarf-Discuss] Vector base types...
John DelSignore
John.DelSignore@roguewave.com
Mon Oct 31 18:15:40 GMT 2011
I'm not sure you can consider this a "convention", but the GNU compiler seems to do the following for the Cell SPU vector types...
For example, "dt_v" is a parameter of type 4 vector floats:
<2><233>: Abbrev Number: 12 (DW_TAG_formal_parameter)
DW_AT_name : dt_v
DW_AT_decl_file : 1
DW_AT_decl_line : 78
DW_AT_type : <1bf>
DW_AT_location : 2 byte block: 91 70 (DW_OP_fbreg: -16)
The vector type is represented as an array with an upper bound of 3 with the DW_AT_GNU_vector attribute:
<1><1bf>: Abbrev Number: 7 (DW_TAG_array_type)
DW_AT_sibling : <1d0>
DW_AT_GNU_vector : 1
DW_AT_type : <14c>
<2><1c9>: Abbrev Number: 8 (DW_TAG_subrange_type)
DW_AT_type : <ad>
DW_AT_upper_bound : 3
The type of the index is unsigned long:
<1><ad>: Abbrev Number: 2 (DW_TAG_base_type)
DW_AT_name : (indirect string, offset: 0x9): long unsigned int
DW_AT_byte_size : 4
DW_AT_encoding : 7 (unsigned)
The base type of the array is float:
<1><14c>: Abbrev Number: 3 (DW_TAG_base_type)
DW_AT_name : float
DW_AT_byte_size : 4
DW_AT_encoding : 4 (float)
AFAICT, the only difference between the above and a "normal" array of 4 floats, is that the vector array type has the DW_AT_GNU_vector attribute.
Cheers, John D.
Relph, Richard wrote:
> Is there a convention for representing vector base types in a language?
>
> Our language (OpenCL) has 2, 3, 4, 8, and 16 element vectors of each of
> the normal C base types and we?re currently representing them in an ad
> hoc way. We?d like to follow whatever convention exists for doing this,
> but we haven?t figured out what that is. Setting DW_AT_byte_size to the
> size of one element begs the question of how many, and setting it to the
> size of the type itself is ambiguous (unless you peek at the name? which
> we are resisting, though perhaps that ?right way?.) A char4, short2, and
> int all have 4 bytes and the same encoding.
>
> We do have a DW_LANG value for OpenCL?
>
>
>
> Thanks,
>
> Richard
>
> PS. Thanks for the many replies to the question about column number usage?
>
More information about the Dwarf-discuss
mailing list