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: [C++ patch] PR C++/12574


> On Tue, 2003-10-14 at 09:20, Jan Hubicka wrote:
> > > On Tue, 2003-10-14 at 01:46, Jan Hubicka wrote:
> > > > Hi,
> > > > the testcase shows that there is yet another way to reffer to functiona
> > > > ddress using baselink expression.  I am not quite sure I deal with all
> > > > cases correctly as perhaps I should do something about TEMPLATE_DECL and
> > > > OVERLOAD too.  Mark?
> > > 
> > > I think that if this patch is necessary something else is wrong.
> > > 
> > > First, the language-specific tree code is BASELINK, not ADDR_EXPR.  So,
> > 
> > OK, can BASELINK appear in other context than ADDR_EXPR too, for
> > instance to represent direct call?
> 
> Don't know -- but cxx_callgraph_expr should be parallel to
> cxx_expand_expr.  That's the canonical source of front-end specific tree
> nodes that can be seen by the middle end.

Hi,
the attached patch also appears to work.  It would lose in case BASELINK
may appear inside CALL_EXPR, but we would just miss optimization.  OK?

2003-10-14  Jan Hubicka  <jh@suse.cz>
	* decl2.c (cxx_callgraph_analyze_expr): Deal with BASELINK.
Index: decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.683
diff -c -3 -p -r1.683 decl2.c
*** decl2.c	14 Oct 2003 08:19:06 -0000	1.683
--- decl2.c	14 Oct 2003 19:37:25 -0000
*************** cxx_callgraph_analyze_expr (tree *tp, in
*** 2521,2526 ****
--- 2521,2531 ----
        if (TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))
  	cgraph_mark_needed_node (cgraph_node (PTRMEM_CST_MEMBER (t)));
        break;
+     case BASELINK:
+       if (flag_unit_at_a_time
+ 	  && TREE_CODE (BASELINK_FUNCTIONS (t)) == FUNCTION_DECL)
+         cgraph_mark_needed_node (cgraph_node (BASELINK_FUNCTIONS (t)));
+       break;
  
      default:
        break;


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