This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: [tree-ssa] Virtual operands of &a[1]?


Hello,

> > Is it correct to assume that
> > anything inside ADDR_EXPR never creates VUSEs?
> > 
> No.  &VAR.FIELD[i] should create a use for 'i'.  You could in this case,
> but you have to be careful in the general case.

OK. This seems to do what I want, now that Richard has fixed the
non-gimple expressions created problem.  Bootstrapped and regtested on
i686.

Zdenek

	* tree-dfa.c (opf_no_vuses): New.
	(add_stmt_operand): Don't create virtual operands when opf_no_vuses
	is passed in flags.
	(get_expr_operands): Don't create VUSEs if the argument of & is
	invariant.

Index: tree-dfa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-dfa.c,v
retrieving revision 1.1.4.193
diff -c -3 -p -r1.1.4.193 tree-dfa.c
*** tree-dfa.c	2 Dec 2003 04:21:53 -0000	1.1.4.193
--- tree-dfa.c	2 Dec 2003 08:47:58 -0000
*************** static const int opf_none	= 0;
*** 112,117 ****
--- 112,120 ----
  /* Operand is the target of an assignment expression.  */
  static const int opf_is_def 	= 1 << 0;
  
+ /* No virtual uses should be created in the expression.  */
+ static const int opf_no_vuses 	= 1 << 1;
+ 
  /* Debugging dumps.  */
  static FILE *dump_file;
  static int dump_flags;
*************** get_expr_operands (tree stmt, tree *expr
*** 357,362 ****
--- 360,370 ----
  	  && subcode != ARRAY_REF)
  	return;
  
+       /* If the address is invariant, there should be no VOPS created,
+ 	 since the referenced objects are not really accessed.  */
+       if (is_gimple_min_invariant (expr))
+ 	flags |= opf_no_vuses;
+ 
        /* Avoid recursion.  */
        code = subcode;
        class = TREE_CODE_CLASS (code);
*************** add_stmt_operand (tree *var_p, tree stmt
*** 598,603 ****
--- 606,615 ----
      {
        /* The variable is not a GIMPLE register.  Add it (or its aliases) to
  	 virtual operands.  */
+ 
+       if (flags & opf_no_vuses)
+ 	return;
+ 
        aliases = v_ann->may_aliases;
        if (aliases == NULL)
  	{


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