This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Expand from tuples
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: Michael Matz <matz at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 01 Sep 2009 09:51:18 +0200
- Subject: Re: Expand from tuples
- References: <Pine.LNX.4.64.0909010303340.29566@wotan.suse.de>
On 09/01/2009 03:46 AM, Michael Matz wrote:
* Interaction between builtins and call. The whole builtins.c is full of
references to the tree (call) expression, calling back and forth between
it, calls.c, targets and folders. It's a terrible maze, and will be
noisy to change. Later.
Another problem is that builtins themselves build a lot of trees. Steps
towards untangling this could be (some of them have been on my TODO list
for a long time, some I found out now after going a bit more through the
code).
* change expand_builtin_interclass_mathfn to use UN*_EXPR instead of
islessequal/isgreaterequal. In some cases we can even produce better
code, for example by doing ourselves the folding of TRUTH_NOT_EXPR to a
xor, or changing !a && !b to !(a || b).
* use expand_expr_real_2 (introducing also expand_unary/expand_binary,
maybe?) for things like these as well as COMPLEX_EXPR. All these tree
have the same location as the CALL_EXPR, so the glue code in
expand_expr_real can be applied to the container CALL_EXPR rather than
these subexpressions..
* change uses of builtin_save_expr from expand_ functions to really
expand the argument. I checked and in all cases we can control where to
expand it and use the resulting VAR_DECL, as in
static rtx expand_save (tree exp, rtx target, tree *decl)
{
rtx ret = expand_expr (exp, target, VOIDmode, EXPAND_NORMAL, NULL);
tree val;
/* Maybe also do the "then" if CONSTANT_P (ret)? */
if (TREE_ADDRESSABLE (exp) == 0
&& (TREE_CODE (exp) == PARM_DECL
|| TREE_CODE (exp) == SSA_NAME
|| (TREE_CODE (exp) == VAR_DECL && !TREE_STATIC (exp))))
val = exp;
else
{
val = build_decl (EXPR_LOCATION (exp),
VAR_DECL, NULL, TREE_TYPE (exp));
DECL_ARTIFICIAL (val) = 1;
DECL_IGNORED_P (val) = 1;
if (!CONSTANT_P (ret))
ret = copy_to_reg (ret);
SET_DECL_RTL (val, ret);
}
if (decl)
*decl = val;
return ret;
}
BTW, builtin_save_expr currently misses the case where EXP is a
SSA_NAME. This I introduced in the function above.
* make a helper for expand_expr (build_call_nary (...), ...) that hides
the creation of the tree
Paolo