summaryrefslogtreecommitdiff
path: root/gcc/c-gimplify.c
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-21 21:47:35 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2007-04-21 21:47:35 +0000
commitcae486e2e14ff0e3d0d4e78926d324ba1d8d2f1e (patch)
treeb4183139462efcda6cbc5858a9ab77488e5d3493 /gcc/c-gimplify.c
parent774244a790fbf64d41dade7e49a98b6f7f01b3a4 (diff)
downloadgcc-cae486e2e14ff0e3d0d4e78926d324ba1d8d2f1e.tar.gz
2007-04-21 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C/30265 * c-gimplifier.c (gimplify_compound_literal_expr): Mark the decl as addressable if the compound literal was marked as addressable. Mark the decl as a gimple register if it is a complex or vector decl and does not live in memory. 2007-04-21 Andrew Pinski <andrew_pinski@playstation.sony.com> PR C/30265 * gcc.c-torture/compile/compound-literal-2.c: New testcase. * gcc.c-torture/compile/compound-literal-3.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124024 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-gimplify.c')
-rw-r--r--gcc/c-gimplify.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/c-gimplify.c b/gcc/c-gimplify.c
index 7ddc88cf4ea..2a3803a6458 100644
--- a/gcc/c-gimplify.c
+++ b/gcc/c-gimplify.c
@@ -183,6 +183,20 @@ gimplify_compound_literal_expr (tree *expr_p, tree *pre_p)
{
tree decl_s = COMPOUND_LITERAL_EXPR_DECL_STMT (*expr_p);
tree decl = DECL_EXPR_DECL (decl_s);
+ /* Mark the decl as addressable if the compound literal
+ expression is addressable now, otherwise it is marked too late
+ after we gimplify the initialization expression. */
+ if (TREE_ADDRESSABLE (*expr_p))
+ TREE_ADDRESSABLE (decl) = 1;
+
+ /* 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)
+ && !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