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]

[lto] PATCH: add FOR_EACH_CALL_EXPR_ARG


Already committed as obvious.

-Sandra

2006-07-07  Sandra Loosemore  <sandra@codesourcery.com>

	* gcc/tree.h (FOR_EACH_CALL_EXPR_ARG):  Define new macro for
	iterating over argument lists.

	* gcc/builtins.c (expand_builtin): Use FOR_EACH_CALL_EXPR_ARG.
	* gcc/cgraphunit.c (cgraph_create_edges): Likewise.
	* gcc/c-pretty-print.c (pp_c_postfix_expression): Likewise.
	* gcc/c-common.c (verify_tree): Likewise.
Index: gcc/tree.h
===================================================================
*** gcc/tree.h	(revision 115253)
--- gcc/tree.h	(working copy)
*************** struct tree_constructor GTY(())
*** 1541,1552 ****
  #define CALL_EXPR_ARG1(NODE) TREE_VALUE (TREE_CHAIN (CALL_EXPR_ARGS (NODE)))
  #define CALL_EXPR_ARG2(NODE) TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CALL_EXPR_ARGS (NODE))))
  
- 
  typedef struct call_expr_arg_iterator_d GTY (())
  {
    tree tail;
  } call_expr_arg_iterator;
  
  
  /* OpenMP directive and clause accessors.  */
  
--- 1541,1556 ----
  #define CALL_EXPR_ARG1(NODE) TREE_VALUE (TREE_CHAIN (CALL_EXPR_ARGS (NODE)))
  #define CALL_EXPR_ARG2(NODE) TREE_VALUE (TREE_CHAIN (TREE_CHAIN (CALL_EXPR_ARGS (NODE))))
  
  typedef struct call_expr_arg_iterator_d GTY (())
  {
    tree tail;
  } call_expr_arg_iterator;
  
+ /* Iterate through each argument ARG of CALL_EXPR CALL, using variable ITER
+    (of type call_expr_arg_iterator) to hold the iteration state.  */
+ #define FOR_EACH_CALL_EXPR_ARG(arg, iter, call)			\
+   for ((arg) = first_call_expr_arg ((call), &(iter)); (arg);	\
+        (arg) = next_call_expr_arg (&(iter)))
  
  /* OpenMP directive and clause accessors.  */
  
Index: gcc/builtins.c
===================================================================
*** gcc/builtins.c	(revision 115253)
--- gcc/builtins.c	(working copy)
*************** expand_builtin (tree exp, rtx target, rt
*** 5623,5630 ****
        tree arg;
        call_expr_arg_iterator iter;
  
!       for (arg = first_call_expr_arg (exp, &iter); arg;
! 	   arg = next_call_expr_arg (&iter))
  	if (TREE_THIS_VOLATILE (arg))
  	  {
  	    volatilep = true;
--- 5623,5629 ----
        tree arg;
        call_expr_arg_iterator iter;
  
!       FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
  	if (TREE_THIS_VOLATILE (arg))
  	  {
  	    volatilep = true;
*************** expand_builtin (tree exp, rtx target, rt
*** 5633,5640 ****
  
        if (! volatilep)
  	{
! 	  for (arg = first_call_expr_arg (exp, &iter); arg;
! 	       arg = next_call_expr_arg (&iter))
  	    expand_expr (arg, const0_rtx, VOIDmode, EXPAND_NORMAL);
  	  return const0_rtx;
  	}
--- 5632,5638 ----
  
        if (! volatilep)
  	{
! 	  FOR_EACH_CALL_EXPR_ARG (arg, iter, exp)
  	    expand_expr (arg, const0_rtx, VOIDmode, EXPAND_NORMAL);
  	  return const0_rtx;
  	}
Index: gcc/cgraphunit.c
===================================================================
*** gcc/cgraphunit.c	(revision 115254)
--- gcc/cgraphunit.c	(working copy)
*************** cgraph_create_edges (struct cgraph_node 
*** 575,582 ****
  	    cgraph_create_edge (node, cgraph_node (decl), stmt,
  				bb->count,
  				bb->loop_depth);
! 	    for (arg = first_call_expr_arg (call, &iter); arg;
! 		 arg = next_call_expr_arg (&iter))
  	      walk_tree (&arg, record_reference, node, visited_nodes);
  	    if (TREE_CODE (stmt) == MODIFY_EXPR)
  	      walk_tree (&TREE_OPERAND (stmt, 0),
--- 575,581 ----
  	    cgraph_create_edge (node, cgraph_node (decl), stmt,
  				bb->count,
  				bb->loop_depth);
! 	    FOR_EACH_CALL_EXPR_ARG (arg, iter, call)
  	      walk_tree (&arg, record_reference, node, visited_nodes);
  	    if (TREE_CODE (stmt) == MODIFY_EXPR)
  	      walk_tree (&TREE_OPERAND (stmt, 0),
Index: gcc/c-pretty-print.c
===================================================================
*** gcc/c-pretty-print.c	(revision 115254)
--- gcc/c-pretty-print.c	(working copy)
*************** pp_c_postfix_expression (c_pretty_printe
*** 1276,1283 ****
  	tree arg;
  	pp_postfix_expression (pp, CALL_EXPR_FN (e));
  	pp_c_left_paren (pp);
! 	for (arg = first_call_expr_arg (e, &iter); arg;
! 	     arg = next_call_expr_arg (&iter))
  	  {
  	    pp_expression (pp, arg);
  	    if (more_call_expr_args_p (&iter))
--- 1276,1282 ----
  	tree arg;
  	pp_postfix_expression (pp, CALL_EXPR_FN (e));
  	pp_c_left_paren (pp);
! 	FOR_EACH_CALL_EXPR_ARG (arg, iter, e)
  	  {
  	    pp_expression (pp, arg);
  	    if (more_call_expr_args_p (&iter))
Index: gcc/c-common.c
===================================================================
*** gcc/c-common.c	(revision 115254)
--- gcc/c-common.c	(working copy)
*************** verify_tree (tree x, struct tlist **pbef
*** 1421,1428 ****
  	tree arg;
  	tmp_before = tmp_nosp = 0; 
  	verify_tree (CALL_EXPR_FN (x), &tmp_before, &tmp_nosp, NULL_TREE);
! 	for (arg = first_call_expr_arg (x, &iter); arg;
! 	     arg = next_call_expr_arg (&iter))
  	  {
  	    tmp_list2 = tmp_list3 = 0;
  	    verify_tree (arg, &tmp_list2, &tmp_list3, NULL_TREE);
--- 1421,1427 ----
  	tree arg;
  	tmp_before = tmp_nosp = 0; 
  	verify_tree (CALL_EXPR_FN (x), &tmp_before, &tmp_nosp, NULL_TREE);
! 	FOR_EACH_CALL_EXPR_ARG (arg, iter, x)
  	  {
  	    tmp_list2 = tmp_list3 = 0;
  	    verify_tree (arg, &tmp_list2, &tmp_list3, NULL_TREE);

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