This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Assigning memory to parameters and SSA
- From: "Thomas, George" <George dot Thomas at atmel dot com>
- To: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 21 Dec 2012 10:35:25 +0000
- Subject: Assigning memory to parameters and SSA
Hi,
I was looking into PR54218 and had some doubts about SSA partition type and how parameters are handled by it.
The issue happened because the stack variables were expanded in 2 places one is in assign_params_setup_stack and the other when
the expansion of SA partitions are done.
The following is the description of the function assign_params_setup_stack in gcc/function.c
/* A subroutine of assign_parms. Allocate stack space to hold the current
parameter. Get it there. Perform all ABI specified conversions. */
Also the comment in expand_used_vars in gcc/cfgexpand (where one of the expansions take place) says :
/* This is a PARM_DECL or RESULT_DECL. For those partitions that
contain the default def (representing the parm or result itself)
we don't do anything here. But those which don't contain the
default def (representing a temporary based on the parm/result)
we need to allocate space just like for normal VAR_DECLs. */
My questions are :
1. Why should be expansion of PARM_DECL take place in expand_used_vars when it have already been done previously.
2. Would this have to be corrected while producing the SSA information making parameters as a default of any uses of the variables in partitions or
should it by excluding PARM_DECL in expand_used_vars as it is already expanded.
The solution would be the stack getting allocated only once.
A link to some discussion that has gone on on this already with details about the bug.
Discussion : http://gcc.gnu.org/ml/gcc/2012-08/msg00050.html
Bug : http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54218
Thanks,
George