public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* GIMPLE and datastructures
@ 2003-12-15 23:23 Jan Hubicka
  2003-12-16 20:42 ` Jan Hubicka
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Hubicka @ 2003-12-15 23:23 UTC (permalink / raw)
  To: gcc, dnovillo

Hi,
the PR 13405 is related to bugreport where BIND_EXPR contains
initializer with non-GIMPLE PTRMEM_CST expression.  What is our strategy
when dealing with data initializers?  Do we want to lower them into
something language independent, or do we want language dependencies to
leak into GIMPLE this way?

In the first case I will re-add analyze_expr hook to deal with this
correctly, but it would really simplify my life if we were able to avoid
them.  How hard is to gimplify this into ADDR_EXPR?

Honza

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: GIMPLE and datastructures
  2003-12-15 23:23 GIMPLE and datastructures Jan Hubicka
@ 2003-12-16 20:42 ` Jan Hubicka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Hubicka @ 2003-12-16 20:42 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc, dnovillo

> Hi,
> the PR 13405 is related to bugreport where BIND_EXPR contains
> initializer with non-GIMPLE PTRMEM_CST expression.  What is our strategy
> when dealing with data initializers?  Do we want to lower them into
> something language independent, or do we want language dependencies to
> leak into GIMPLE this way?
> 
> In the first case I will re-add analyze_expr hook to deal with this
> correctly, but it would really simplify my life if we were able to avoid
> them.  How hard is to gimplify this into ADDR_EXPR?

Hi,
until this is solved more properly, I am reverting the patch as
disucssed with Diego today.

I've bootstrapped and regtested the reversal on i686-pc-gnu-linux.

Index: ChangeLog.tree-ssa
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ChangeLog.tree-ssa,v
retrieving revision 1.1.2.1014
diff -c -3 -p -r1.1.2.1014 ChangeLog.tree-ssa
*** ChangeLog.tree-ssa	16 Dec 2003 18:32:30 -0000	1.1.2.1014
--- ChangeLog.tree-ssa	16 Dec 2003 20:03:00 -0000
***************
*** 1,3 ****
--- 1,11 ----
+ 2003-12-16  Jan Hubicka  <jh@suse.cz>
+ 
+ 	Revert until initializers are made language independent:
+ 	* cgraphunit.c (record_call_1): Do not call analyze_expr hook
+ 	* langhooks-def.h (LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR): Kill.
+ 	(LANG_HOOKS_CALLGRAPH_INITIALIZER): Update.
+ 	* longhooks.h (lang_hooks_for_callgraph): Kill analyze_expr.
+ 
  2003-12-16  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
  
  	* tree-pretty-print.c (dump_bb_header): Show block number when
Index: cgraphunit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.1.4.24
diff -c -3 -p -r1.1.4.24 cgraphunit.c
*** cgraphunit.c	16 Dec 2003 15:48:10 -0000	1.1.4.24
--- cgraphunit.c	16 Dec 2003 20:03:00 -0000
*************** record_call_1 (tree *tp, int *walk_subtr
*** 283,289 ****
  	}
  
        if ((unsigned int) TREE_CODE (t) >= LAST_AND_UNUSED_TREE_CODE)
! 	abort ();
        break;
      }
  
--- 283,289 ----
  	}
  
        if ((unsigned int) TREE_CODE (t) >= LAST_AND_UNUSED_TREE_CODE)
! 	return (*lang_hooks.callgraph.analyze_expr) (tp, walk_subtrees, data);
        break;
      }
  
Index: langhooks-def.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks-def.h,v
retrieving revision 1.34.2.25
diff -c -3 -p -r1.34.2.25 langhooks-def.h
*** langhooks-def.h	14 Dec 2003 01:12:02 -0000	1.34.2.25
--- langhooks-def.h	16 Dec 2003 20:03:00 -0000
*************** extern int lhd_gimplify_expr (tree *, tr
*** 187,195 ****
--- 187,197 ----
    LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \
  }
  
+ #define LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR lhd_callgraph_analyze_expr
  #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION NULL
  
  #define LANG_HOOKS_CALLGRAPH_INITIALIZER { \
+   LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR, \
    LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION, \
  }
  
Index: langhooks.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/langhooks.h,v
retrieving revision 1.42.2.26
diff -c -3 -p -r1.42.2.26 langhooks.h
*** langhooks.h	14 Dec 2003 01:12:02 -0000	1.42.2.26
--- langhooks.h	16 Dec 2003 20:03:00 -0000
*************** struct lang_hooks_for_tree_inlining
*** 53,58 ****
--- 53,62 ----
  
  struct lang_hooks_for_callgraph
  {
+   /* The node passed is a language-specific tree node.  If its contents
+      are relevant to use of other declarations, mark them.  */
+   tree (*analyze_expr) (tree *, int *, tree);
+ 
    /* Produce RTL for function passed as argument.  */
    void (*expand_function) (tree);
  };
Index: cp/ChangeLog.tree-ssa
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/Attic/ChangeLog.tree-ssa,v
retrieving revision 1.1.2.58
diff -c -3 -p -r1.1.2.58 ChangeLog.tree-ssa
*** cp/ChangeLog.tree-ssa	14 Dec 2003 01:12:03 -0000	1.1.2.58
--- cp/ChangeLog.tree-ssa	16 Dec 2003 20:03:01 -0000
***************
*** 1,3 ****
--- 1,10 ----
+ 2003-12-16  Jan Hubicka  <jh@suse.cz>
+ 
+ 	Revert until initializers are made language independent:
+ 	* cp-lang.c (LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR): Kill.
+ 	* cp-tree.h (cxx_callgraph_analyze_expr): Kill.
+ 	* decl2.c (cxx_callgraph_analyze_expr): Kill.
+ 	
  2003-12-14  Jan Hubicka  <jh@suse.cz>
  
  	* cp-lang.c (LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR): Kill.
Index: cp/cp-lang.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-lang.c,v
retrieving revision 1.36.2.25
diff -c -3 -p -r1.36.2.25 cp-lang.c
*** cp/cp-lang.c	14 Dec 2003 01:12:03 -0000	1.36.2.25
--- cp/cp-lang.c	16 Dec 2003 20:03:01 -0000
*************** static void cxx_initialize_diagnostics (
*** 168,173 ****
--- 168,175 ----
  #undef LANG_HOOKS_EXPR_SIZE
  #define LANG_HOOKS_EXPR_SIZE cp_expr_size
  
+ #undef LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR
+ #define LANG_HOOKS_CALLGRAPH_ANALYZE_EXPR cxx_callgraph_analyze_expr
  #undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
  #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION expand_body
  
Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.719.2.46
diff -c -3 -p -r1.719.2.46 cp-tree.h
*** cp/cp-tree.h	14 Dec 2003 01:12:03 -0000	1.719.2.46
--- cp/cp-tree.h	16 Dec 2003 20:03:01 -0000
*************** extern tree build_artificial_parm (tree,
*** 3740,3745 ****
--- 3740,3746 ----
  extern tree get_guard (tree);
  extern tree get_guard_cond (tree);
  extern tree set_guard (tree);
+ extern tree cxx_callgraph_analyze_expr (tree *, int *, tree);
  
  /* XXX Not i18n clean.  */
  #define cp_deprecated(STR)						\
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.540.2.43
diff -c -3 -p -r1.540.2.43 decl2.c
*** cp/decl2.c	14 Dec 2003 01:12:03 -0000	1.540.2.43
--- cp/decl2.c	16 Dec 2003 20:03:02 -0000
*************** generate_ctor_and_dtor_functions_for_pri
*** 2504,2509 ****
--- 2504,2540 ----
    return 0;
  }
  
+ /* Called via LANGHOOK_CALLGRAPH_ANALYZE_EXPR.  It is supposed to mark
+    decls referenced from frontend specific constructs; it will be called
+    only for language-specific tree nodes.
+ 
+    Here we must deal with member pointers.  */
+ 
+ tree
+ cxx_callgraph_analyze_expr (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
+ 			    tree from ATTRIBUTE_UNUSED)
+ {
+   tree t = *tp;
+ 
+   if (flag_unit_at_a_time)
+     switch (TREE_CODE (t))
+       {
+       case PTRMEM_CST:
+ 	if (TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))
+ 	  cgraph_mark_needed_node (cgraph_node (PTRMEM_CST_MEMBER (t)));
+ 	break;
+       case BASELINK:
+ 	if (TREE_CODE (BASELINK_FUNCTIONS (t)) == FUNCTION_DECL)
+ 	  cgraph_mark_needed_node (cgraph_node (BASELINK_FUNCTIONS (t)));
+ 	break;
+ 
+       default:
+ 	break;
+       }
+ 
+   return NULL;
+ }
+ 
  /* This routine is called from the last rule in yyparse ().
     Its job is to create all the code needed to initialize and
     destroy the global aggregates.  We do the destruction

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-12-16 20:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-15 23:23 GIMPLE and datastructures Jan Hubicka
2003-12-16 20:42 ` Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).