This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix var-tracking with dynamic stack realignment on x86
On Sun, May 29, 2011 at 10:57:34AM +0200, Eric Botcazou wrote:
> --- var-tracking.c (revision 174377)
> +++ var-tracking.c (working copy)
> @@ -8398,6 +8398,27 @@ vt_add_function_parameter (tree parm)
> if (GET_MODE (decl_rtl) == BLKmode || GET_MODE (incoming) == BLKmode)
> return;
>
> + /* If there is a DRAP register, rewrite the incoming location of parameters
> + passed on the stack into MEMs based on the argument pointer, as the DRAP
> + register can be reused for other purposes and we do not track locations
> + based on generic registers. See also vt_initialize. */
> + if (MEM_P (incoming)
> + && stack_realign_drap
> + && cfa_base_rtx
> + && (XEXP (incoming, 0) == crtl->args.internal_arg_pointer
> + || (GET_CODE (XEXP (incoming, 0)) == PLUS
> + && XEXP (XEXP (incoming, 0), 0)
> + == crtl->args.internal_arg_pointer
> + && CONST_INT_P (XEXP (XEXP (incoming, 0), 1)))))
> + {
> + HOST_WIDE_INT off = -FIRST_PARM_OFFSET (current_function_decl);
> + if (GET_CODE (XEXP (incoming, 0)) == PLUS)
> + off += INTVAL (XEXP (XEXP (incoming, 0), 1));
> + incoming
> + = replace_equiv_address_nv (incoming,
> + plus_constant (arg_pointer_rtx, off));
This should be cfa_base_rtx instead of arg_pointer_rtx, or the condition
should test that cfa_base_rtx == arg_pointer_rtx. We don't have a dynamic
stack realignment target which defines FRAME_POINTER_CFA_OFFSET right now,
but what if one day such target is added or just dynamic realignment
support is added.
And there should be a testcase added for it (e.g. the one I've posted in my
patch, I assume it works with your version of the patch too).
Otherwise it looks good to me, though I'm not a reviewer of this part of
GCC.
Jakub