This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[C, PATCH] Improve/Fix the gimplifier of C complex/vector compound literals

  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.

Andrew Pinski



	* 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.  */
+       || 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]