[Dwarf-Discuss] Representing the location of smaller values in vector registers

Cary Coutant ccoutant at gmail.com
Fri Mar 4 13:50:23 PST 2016


>  DW_TAG_variable
>    DW_AT_location( reg17 )   // xmm0 = 17
>    DW_AT_name( "f" )
>    DW_AT_decl_file( "test.c" )
>    DW_AT_decl_line( 8 )
>    DW_AT_type( {0x0000004a} ( float ) )
>
> Which causes LLDB to complain that the size of register xmm0 (128 Bits) is different from the size of f (32 Bits). I wonder who is wrong? Is LLDB being too strict, or should clang actually emit something like DW_OP_reg 17 (xmm0) DW_OP_piece 4 to make it abundantly clear that only the lower 32 bits of the vector register are interesting?

I would think that clang is right, and LLDB is wrong. It would be
silly to require the producer to use a longer representation that
essentially means the same thing. DW_OP_piece isn't meant to say that
you're only using part of the register -- it's meant for when part of
a larger *value* is in the register (whether the whole register or
part of it). Indeed, using DW_OP_piece leaves you in the same
situation -- with 32 bits placed in a 128-bit register.

How is this any different from saying a char variable is in a 32-bit register?

It's up to the ABI to define how smaller values are placed within a register.

-cary


More information about the Dwarf-Discuss mailing list