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]

[PATCH] Micro optimize for_each_template_parm


Hi!

This would strip some for_each_template_parm() calls in some cases.
Bootstrap running.

Richard.


2004Jan22  Richard Guenther <richard.guenther@uni-tuebingen.de>

	cp/pt.c: (tsubst) check uses_template_parms last.
	(type_unification_real) likewise.

Index: pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.816.2.2
diff -u -c -3 -p -r1.816.2.2 pt.c
*** pt.c	19 Jan 2004 20:39:33 -0000	1.816.2.2
--- pt.c	21 Jan 2004 23:08:48 -0000
*************** tsubst (tree t, tree args, tsubst_flags_
*** 7008,7014 ****
  			ctx);
  	    return error_mark_node;
  	  }
! 	else if (!uses_template_parms (ctx) && !TYPE_BEING_DEFINED (ctx))
  	  {
  	    /* Normally, make_typename_type does not require that the CTX
  	       have complete type in order to allow things like:
--- 6999,7005 ----
  			ctx);
  	    return error_mark_node;
  	  }
! 	else if (!TYPE_BEING_DEFINED (ctx) && !uses_template_parms (ctx))
  	  {
  	    /* Normally, make_typename_type does not require that the CTX
  	       have complete type in order to allow things like:
*************** type_unification_real (tree tparms,
*** 9031,9039 ****
  	     deduced from a later argument than the one from which
  	     this parameter can be deduced.  */
  	  if (TREE_CODE (tparm) == PARM_DECL
! 	      && uses_template_parms (TREE_TYPE (tparm))
! 	      && !saw_undeduced++)
! 	    goto again;

  	  if (!allow_incomplete)
  	    error ("incomplete type unification");
--- 9022,9030 ----
  	     deduced from a later argument than the one from which
  	     this parameter can be deduced.  */
  	  if (TREE_CODE (tparm) == PARM_DECL
! 	      && !saw_undeduced
! 	      && uses_template_parms (TREE_TYPE (tparm)))
! 	    ++saw_undeduced, goto again;

  	  if (!allow_incomplete)
  	    error ("incomplete type unification");


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