On 21/10/16 09:30, Jiong Wang wrote:
Currently, GCC only support DW_CFA_expression in dwarf module, this patch
extend the support to DW_CFA_val_expression which share the same code
mostly the same code with DW_CFA_expression.

Meanwhile the existed dwarf expression parser only allows expressions
which can be represented using GCC RTL.  If one operation doesn't have
a correspondent GCC RTL operator, then there is no way to attach that
information in reg-note.

This patch extends the current dwarf expression support to unlimited
number of operations by using PARALLEL, and unlimited type of operations
by using UNSPEC.

All DW_OP_* of the expression are grouped together inside the PARALLEL,
and those operations which don't have RTL mapping are wrapped by
UNSPEC.  The parsing algorithm is simply something like:

  foreach elem inside PARALLEL
    if (UNSPEC)
      {
        dw_op_code = INTVAL (XVECEXP (elem, 0, 0));
    oprnd1 = INTVAL (XVECEXP (elem, 0, 1));
        oprnd2 = INTVAL (XVECEXP (elem, 0, 2));
      }
    else
      call standard RTL parser.

Any comments on the approach?

Ping ~


Thanks.

gcc/
2016-10-20  Jiong Wang  <jiong.w...@arm.com>

        * reg-notes.def (CFA_VAL_EXPRESSION): New entry.
* dwarf2cfi.c (dwarf2out_frame_debug_cfa_val_expression): New function.
        (dwarf2out_frame_debug): Support REG_CFA_VAL_EXPRESSION.
        (output_cfa_loc): Support DW_CFA_val_expression.
        (output_cfa_loc_raw): Likewise.
        (output_cfi): Likewise.
        (output_cfi_directive): Likewise.
* dwarf2out.c (dw_cfi_oprnd1_desc): Support DW_CFA_val_expression.
        (dw_cfi_oprnd2_desc): Likewise.
        (mem_loc_descriptor): Recognize new pattern generated for value
        expression.


Reply via email to