diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2013-08-30 11:13:20 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2013-08-30 11:13:20 +0000 |
commit | f7e088e7de99b6ab31dc56d2a3ed358647207256 (patch) | |
tree | 28d46552357ed039d57e797a50db601708d5d55e /gcc/var-tracking.c | |
parent | bec9ec3fc1f24d55a37a6c90ac03dc60f87d4d72 (diff) | |
download | gcc-f7e088e7de99b6ab31dc56d2a3ed358647207256.zip gcc-f7e088e7de99b6ab31dc56d2a3ed358647207256.tar.gz gcc-f7e088e7de99b6ab31dc56d2a3ed358647207256.tar.bz2 |
function.c (assign_parm_setup_reg): For a parameter passed by pointer and which can live in a register...
* function.c (assign_parm_setup_reg): For a parameter passed by pointer
and which can live in a register, always retrieve the value on entry.
* var-tracking.c (add_stores): Treat the copy on entry for a parameter
passed by invisible reference specially.
(emit_notes_in_bb) <MO_VAL_USE>: Emit notes before the instruction.
(vt_add_function_parameter): Correctly deal with a parameter passed by
invisible reference.
From-SVN: r202102
Diffstat (limited to 'gcc/var-tracking.c')
-rw-r--r-- | gcc/var-tracking.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index d82d262..cf1f08b 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -5836,7 +5836,24 @@ add_stores (rtx loc, const_rtx expr, void *cuip) { rtx xexpr = gen_rtx_SET (VOIDmode, loc, src); if (same_variable_part_p (src, REG_EXPR (loc), REG_OFFSET (loc))) - mo.type = MO_COPY; + { + /* If this is an instruction copying (part of) a parameter + passed by invisible reference to its register location, + pretend it's a SET so that the initial memory location + is discarded, as the parameter register can be reused + for other purposes and we do not track locations based + on generic registers. */ + if (MEM_P (src) + && REG_EXPR (loc) + && TREE_CODE (REG_EXPR (loc)) == PARM_DECL + && DECL_MODE (REG_EXPR (loc)) != BLKmode + && MEM_P (DECL_INCOMING_RTL (REG_EXPR (loc))) + && XEXP (DECL_INCOMING_RTL (REG_EXPR (loc)), 0) + != arg_pointer_rtx) + mo.type = MO_SET; + else + mo.type = MO_COPY; + } else mo.type = MO_SET; mo.u.loc = xexpr; @@ -9086,7 +9103,7 @@ emit_notes_in_bb (basic_block bb, dataflow_set *set) else var_mem_set (set, loc, VAR_INIT_STATUS_UNINITIALIZED, NULL); - emit_notes_for_changes (insn, EMIT_NOTE_AFTER_INSN, set->vars); + emit_notes_for_changes (insn, EMIT_NOTE_BEFORE_INSN, set->vars); } break; @@ -9533,12 +9550,11 @@ vt_add_function_parameter (tree parm) if (!vt_get_decl_and_offset (incoming, &decl, &offset)) { - if (REG_P (incoming) || MEM_P (incoming)) + if (MEM_P (incoming)) { /* This means argument is passed by invisible reference. */ offset = 0; decl = parm; - incoming = gen_rtx_MEM (GET_MODE (decl_rtl), incoming); } else { |