|
|
22033d |
2015-12-02 Pierre-Marie de Rodat <derodat@adacore.com>
|
|
|
22033d |
|
|
|
22033d |
* dwarf2out.c (dwar2out_var_location): Enhance pattern matching to get
|
|
|
22033d |
the SYMBOL_REF they embed.
|
|
|
22033d |
(gen_subprogram_die): Handle such calls.
|
|
|
22033d |
|
|
|
22033d |
--- gcc/dwarf2out.c (revision 231184)
|
|
|
22033d |
+++ gcc/dwarf2out.c (revision 231185)
|
|
|
22033d |
@@ -18051,18 +18051,23 @@ gen_subprogram_die (tree decl, dw_die_re
|
|
|
22033d |
}
|
|
|
22033d |
if (mode == VOIDmode || mode == BLKmode)
|
|
|
22033d |
continue;
|
|
|
22033d |
- if (XEXP (XEXP (arg, 0), 0) == pc_rtx)
|
|
|
22033d |
+ /* Get dynamic information about call target only if we
|
|
|
22033d |
+ have no static information: we cannot generate both
|
|
|
22033d |
+ DW_AT_abstract_origin and DW_AT_GNU_call_site_target
|
|
|
22033d |
+ attributes. */
|
|
|
22033d |
+ if (ca_loc->symbol_ref == NULL_RTX)
|
|
|
22033d |
{
|
|
|
22033d |
- gcc_assert (ca_loc->symbol_ref == NULL_RTX);
|
|
|
22033d |
- tloc = XEXP (XEXP (arg, 0), 1);
|
|
|
22033d |
- continue;
|
|
|
22033d |
- }
|
|
|
22033d |
- else if (GET_CODE (XEXP (XEXP (arg, 0), 0)) == CLOBBER
|
|
|
22033d |
- && XEXP (XEXP (XEXP (arg, 0), 0), 0) == pc_rtx)
|
|
|
22033d |
- {
|
|
|
22033d |
- gcc_assert (ca_loc->symbol_ref == NULL_RTX);
|
|
|
22033d |
- tlocc = XEXP (XEXP (arg, 0), 1);
|
|
|
22033d |
- continue;
|
|
|
22033d |
+ if (XEXP (XEXP (arg, 0), 0) == pc_rtx)
|
|
|
22033d |
+ {
|
|
|
22033d |
+ tloc = XEXP (XEXP (arg, 0), 1);
|
|
|
22033d |
+ continue;
|
|
|
22033d |
+ }
|
|
|
22033d |
+ else if (GET_CODE (XEXP (XEXP (arg, 0), 0)) == CLOBBER
|
|
|
22033d |
+ && XEXP (XEXP (XEXP (arg, 0), 0), 0) == pc_rtx)
|
|
|
22033d |
+ {
|
|
|
22033d |
+ tlocc = XEXP (XEXP (arg, 0), 1);
|
|
|
22033d |
+ continue;
|
|
|
22033d |
+ }
|
|
|
22033d |
}
|
|
|
22033d |
reg = NULL;
|
|
|
22033d |
if (REG_P (XEXP (XEXP (arg, 0), 0)))
|
|
|
22033d |
@@ -20842,15 +20847,27 @@ dwarf2out_var_location (rtx loc_note)
|
|
|
22033d |
if (!CALL_P (prev))
|
|
|
22033d |
prev = XVECEXP (PATTERN (prev), 0, 0);
|
|
|
22033d |
ca_loc->tail_call_p = SIBLING_CALL_P (prev);
|
|
|
22033d |
+
|
|
|
22033d |
+ /* Look for a SYMBOL_REF in the "prev" instruction. */
|
|
|
22033d |
x = get_call_rtx_from (PATTERN (prev));
|
|
|
22033d |
if (x)
|
|
|
22033d |
{
|
|
|
22033d |
- x = XEXP (XEXP (x, 0), 0);
|
|
|
22033d |
- if (GET_CODE (x) == SYMBOL_REF
|
|
|
22033d |
- && SYMBOL_REF_DECL (x)
|
|
|
22033d |
- && TREE_CODE (SYMBOL_REF_DECL (x)) == FUNCTION_DECL)
|
|
|
22033d |
- ca_loc->symbol_ref = x;
|
|
|
22033d |
+ /* Try to get the call symbol, if any. */
|
|
|
22033d |
+ if (MEM_P (XEXP (x, 0)))
|
|
|
22033d |
+ x = XEXP (x, 0);
|
|
|
22033d |
+ /* First, look for a memory access to a symbol_ref. */
|
|
|
22033d |
+ if (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
|
|
|
22033d |
+ && SYMBOL_REF_DECL (XEXP (x, 0))
|
|
|
22033d |
+ && TREE_CODE (SYMBOL_REF_DECL (XEXP (x, 0))) == FUNCTION_DECL)
|
|
|
22033d |
+ ca_loc->symbol_ref = XEXP (x, 0);
|
|
|
22033d |
+ /* Otherwise, look at a compile-time known user-level function
|
|
|
22033d |
+ declaration. */
|
|
|
22033d |
+ else if (MEM_P (x)
|
|
|
22033d |
+ && MEM_EXPR (x)
|
|
|
22033d |
+ && TREE_CODE (MEM_EXPR (x)) == FUNCTION_DECL)
|
|
|
22033d |
+ ca_loc->symbol_ref = XEXP (DECL_RTL (MEM_EXPR (x)), 0);
|
|
|
22033d |
}
|
|
|
22033d |
+
|
|
|
22033d |
ca_loc->block = insn_scope (prev);
|
|
|
22033d |
if (call_arg_locations)
|
|
|
22033d |
call_arg_loc_last->next = ca_loc;
|