This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C, PATCH] Improve/Fix the gimplifier of C complex/vector compound literals
- From: Andrew Pinski <pinskia at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 14 Dec 2006 22:35:46 -0800
- Subject: [C, PATCH] Improve/Fix the gimplifier of C complex/vector compound literals
Hi,
Since the decl for a compound literal is added to the temporary
variable list while gimplifing, we don't get the chance to mark the decl
as DECL_GIMPLE_REG_P unlike if the decl was in the BLOCK. Since the
decl is not marked with DECL_GIMPLE_REG_P, we get an extra temporary for
complex and vector compound literals which seems wrong.
OK? Bootstrapped and tested on i686-linux-gnu with no regressions.
Thanks,
Andrew Pinski
:ADDPATCH C:
ChangeLog:
* c-gimplifier.c (gimplify_compound_literal_expr): Mark the
decl as a gimple register if it is a complex or vector decl
and does not live in memory.
Index: c-gimplify.c
===================================================================
--- c-gimplify.c (revision 119876)
+++ c-gimplify.c (working copy)
@@ -183,6 +183,15 @@ gimplify_compound_literal_expr (tree *ex
{
tree decl_s = COMPOUND_LITERAL_EXPR_DECL_STMT (*expr_p);
tree decl = DECL_EXPR_DECL (decl_s);
+ /* Preliminarily mark non-addressed complex variables as eligible
+ for promotion to gimple registers. We'll transform their uses
+ as we find them. */
+ if ((TREE_CODE (TREE_TYPE (decl)) == COMPLEX_TYPE
+ || TREE_CODE (TREE_TYPE (decl)) == VECTOR_TYPE)
+ && !TREE_THIS_VOLATILE (decl)
+ && (TREE_CODE (decl) == VAR_DECL && !DECL_HARD_REGISTER (decl))
+ && !needs_to_live_in_memory (decl))
+ DECL_GIMPLE_REG_P (decl) = 1;
/* This decl isn't mentioned in the enclosing block, so add it to the
list of temps. FIXME it seems a bit of a kludge to say that