||Clarify placement of implicit value pieces
Section 220.127.116.11, pg 42
The current definition of the placement of a DW_OP_bit_piece within an
implicit value reads:
If the location is any implicit value or stack value, the
DW_OP_bit_piece operation describes a sequence of bits
using the least significant bits of that value.
It is not obvious what the "least significant bit" of an implicit
value should be. Is it located in the first or last byte of the
implicit value's data on big-endian platforms? It is also unclear why
this definition deviates from the placement rule for memory pieces,
considering that implicit values represent an arbitrary number of
bytes rather than integral values.
Furthermore the current definition seems to imply that the piece
offset shall be ignored. If this is intentional, then it should be
stated explicitly. But for consistency I rather propose to respect
the offset, like for memory pieces:
If the location is an implicit value, the DW_OP_bit_piece
operation describes a sequence of bits from that value,
starting at the given offset and using the bit numbering
and direction conventions that are appropriate to the
current language on the target system.
For instance, consider a structure variable whose members are
constant, except for an unaligned bit field in the middle that is
located in a register. A DWARF producer could represent the location
with appropriate pieces of an implicit value, a register, and another
implicit value. Using a non-zero bit offset the second implicit value
could be provided as a simple byte-wise copy of the last bytes of the
variable. Otherwise the DWARF producer would have to shift the
implicit value's bits accordingly to make them left-aligned.
Rejected -- 2/2/2017
The contents of the data bytes in DW_OP_implicit_value are interpreted
in the same target-dependent fashion as the bytes in other data blocks,
such as those represented by DW_FORM_block.
Nothing in the description of DW_OP_bit_piece should be read to
suggest that any of the operands are to be ignored.
How a producer generates a DWARF expression for a value, such as the
struct value mentioned, is a Quality of Implementation issue. A well
constructed expression using DW_OP_piece and DW_OP_bit_piece should
not require shifting values.