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]

[tree profiling branch] Various fixes, cleanups to ipcp and versioning code


Hello,

Attached are several fixes and cleanups to both ipcp and versioning code.
The main changes for ipcp include code handling cases in which the 
constant sent by the callsite and the 
formal parameter of the callee are not of the same type. (could happen for 
old C style cases)
Also, added some cleanups in the code dealing with building of constants.
For versioning code, added some cleanups and a fix in copy_decl_for_dup to 
clear the LABEL_DECL_UID also for the case of versioning.

Comments are welcome.

Thanks
Razya


2005-05-05  Razya Ladelsky  <razya@il.ibm.com>

* ipa_prop.h (ipcp_replcae_map): Renamed to ipa_replace_map
* ipa_prop.c (ipcp_callsite_compute_param): Added check to make sure the 
constant sent in the 
   callsite and the formal parameter of the callee are of the same type. 
   (build_const_val): Added another parameter, the type of the constant 
that should be built.
   (ipcp_propagate_const, ipcp_replace_map_create): Call build_const_val 
with type parameter.
   (ipcp_method_cval_print): Added support for reference to constants 
formal parameters (as in fortran).
   (ipcp_replace_map_create): Uses ipa_replace_map instead of 
ipcp_replcae_map
   (ipcp_insert_stage): Same
* tree-inline.c (copy_decl_for_dup): Cleared the LABEL_DECL_UID also for 
the case of versioning. 
   (tree_function_versioning): Uses ipa_replace_map instead of 
ipcp_replcae_map, add allocation of the
   struct function for the new version (removed from 
cgraph_copy_node_for_versioning)
   (replace_ref_tree): Uses ipa_replace_map instead of ipcp_replcae_map
* cgraph.h (update_call_expr): Removed a parameter
* cgraphunit.c (update_call_expr): Removed a parameter, some cleanups.
   (cgraph_copy_node_for_versioning): Removed the allocation of struct 
function
   (cgraph_function_versioning): Uses the modified update_call_expr 
* testsuite/lib/scancgraph.exp : Scan all ipa files. 


Index: cgraph.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraph.h,v
retrieving revision 1.1.4.16.2.30
diff -c -3 -p -r1.1.4.16.2.30 cgraph.h
*** cgraph.h    27 Apr 2005 13:08:52 -0000      1.1.4.16.2.30
--- cgraph.h    5 May 2005 10:03:07 -0000
*************** void cgraph_clone_inlined_nodes (struct 
*** 302,308 ****
  void cgraph_mark_inline_edge (struct cgraph_edge *);
  bool cgraph_default_inline_p (struct cgraph_node *);
 
! void update_call_expr (struct cgraph_node *, varray_type);
  struct cgraph_node *cgraph_copy_node_for_versioning (struct cgraph_node 
*,
                                                       tree, varray_type);
  struct cgraph_node *cgraph_function_versioning (struct cgraph_node *,
--- 302,308 ----
  void cgraph_mark_inline_edge (struct cgraph_edge *);
  bool cgraph_default_inline_p (struct cgraph_node *);
 
! void update_call_expr (struct cgraph_node *);
  struct cgraph_node *cgraph_copy_node_for_versioning (struct cgraph_node 
*,
                                                       tree, varray_type);
  struct cgraph_node *cgraph_function_versioning (struct cgraph_node *,
Index: cgraphunit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.1.4.35.2.49
diff -c -3 -p -r1.1.4.35.2.49 cgraphunit.c
*** cgraphunit.c        25 Apr 2005 08:53:18 -0000      1.1.4.35.2.49
--- cgraphunit.c        5 May 2005 10:03:07 -0000
*************** init_cgraph (void)
*** 1383,1412 ****
  /* Update the CALL_EXPR in NEW_VERSION node callers edges.  */
 
  void
! update_call_expr (struct cgraph_node *new_version, 
!                 varray_type redirect_callers)
  {
    struct cgraph_edge *e;
-   unsigned i;
 
    if (new_version == NULL)
      abort ();
- 
-   for (i = 0; i < VARRAY_ACTIVE_SIZE (redirect_callers); i++)
-     {
-       e = VARRAY_GENERIC_PTR (redirect_callers, i);
- 
-       /* Update the call expr on the edges
-        to the new version. */ 
-        TREE_OPERAND (TREE_OPERAND (e->call_expr, 0), 0) = 
new_version->decl;
-     }
    for (e = new_version->callers; e; e = e->next_caller)
!     { 
!       /* Update the call expr on the edges
!           of recursive calls. */
!       if (e->caller == new_version)
!       TREE_OPERAND (TREE_OPERAND (e->call_expr, 0), 0) = 
new_version->decl; 
!     } 
  }
 
 
--- 1383,1398 ----
  /* Update the CALL_EXPR in NEW_VERSION node callers edges.  */
 
  void
! update_call_expr (struct cgraph_node *new_version) 
  {
    struct cgraph_edge *e;
 
    if (new_version == NULL)
      abort ();
    for (e = new_version->callers; e; e = e->next_caller)
!     /* Update the call expr on the edges
!        to be calling the new version. */
!     TREE_OPERAND (TREE_OPERAND (e->call_expr, 0), 0) = 
new_version->decl;
  }
 
 
*************** cgraph_copy_node_for_versioning (struct 
*** 1458,1474 ****
         if (!next_callee)
         break;
       }
!    for (i = 0; i < VARRAY_ACTIVE_SIZE (redirect_callers); i++) 
!      {
!        e = VARRAY_GENERIC_PTR (redirect_callers, i); 
!        /* Redirect calls to the old version node
!         to point to it's new version.  */ 
!        cgraph_redirect_edge_callee (e, new_version);
!      }
! 
!    allocate_struct_function (new_decl);
!    cfun->function_end_locus = DECL_SOURCE_LOCATION (new_decl);
! 
     return new_version;
   }
 
--- 1444,1458 ----
         if (!next_callee)
         break;
       }
!    if (redirect_callers)
!      for (i = 0; i < VARRAY_ACTIVE_SIZE (redirect_callers); i++) 
!        {
!          e = VARRAY_GENERIC_PTR (redirect_callers, i); 
!        /* Redirect calls to the old version node
!           to point to it's new version.  */ 
!          cgraph_redirect_edge_callee (e, new_version);
!        }
! 
     return new_version;
   }
 
*************** cgraph_function_versioning (struct cgrap
*** 1512,1518 ****
    tree_function_versioning (old_decl, new_decl, tree_map);
    /* Update the call_expr on the edges
       to the new version node. */
!   update_call_expr (new_version_node, redirect_callers);
    DECL_EXTERNAL (new_version_node->decl) = 0;
    DECL_ONE_ONLY (new_version_node->decl) = 0; 
    TREE_PUBLIC (new_version_node->decl) = 0;
--- 1496,1502 ----
    tree_function_versioning (old_decl, new_decl, tree_map);
    /* Update the call_expr on the edges
       to the new version node. */
!   update_call_expr (new_version_node);
    DECL_EXTERNAL (new_version_node->decl) = 0;
    DECL_ONE_ONLY (new_version_node->decl) = 0; 
    TREE_PUBLIC (new_version_node->decl) = 0;
Index: ipa_prop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ipa_prop.c,v
retrieving revision 1.1.2.5
diff -c -3 -p -r1.1.2.5 ipa_prop.c
*** ipa_prop.c  21 Mar 2005 09:08:52 -0000      1.1.2.5
--- ipa_prop.c  5 May 2005 10:03:09 -0000
*************** static void 
*** 446,452 ****
  ipcp_callsite_compute_param (ipcp_callsite cs)
  {
    tree callTree;
!   tree arg, cst_decl;
    int arg_num;
    int i;
    ipcp_method mt;
--- 446,452 ----
  ipcp_callsite_compute_param (ipcp_callsite cs)
  {
    tree callTree;
!   tree arg, cst_decl, arg_type, formal_type;
    int arg_num;
    int i;
    ipcp_method mt;
*************** ipcp_callsite_compute_param (ipcp_callsi
*** 476,506 ****
        }
        else if (TREE_CODE (TREE_VALUE (arg)) == INTEGER_CST)
        {
!         ipcp_callsite_param_set_type (cs, arg_num, CONST_IPATYPE_INT);
!         ipcp_callsite_param_set_info_type_int (cs, arg_num,
!                                            &TREE_INT_CST (TREE_VALUE 
(arg)));
        }
        else if (TREE_CODE (TREE_VALUE (arg)) == REAL_CST)
!         {
!           ipcp_callsite_param_set_type (cs, arg_num, 
CONST_IPATYPE_FLOAT);
!         ipcp_callsite_param_set_info_type_float (cs, arg_num,
!                                            TREE_REAL_CST_PTR (TREE_VALUE 
(arg)));
! 
        }
!       else if (TREE_CODE (TREE_VALUE (arg)) == ADDR_EXPR)
        { 
!         if( TREE_CODE (TREE_OPERAND (TREE_VALUE (arg), 0)) == CONST_DECL 
)
            {
!             cst_decl = TREE_OPERAND (TREE_VALUE (arg), 0);
!             if (TREE_CODE (DECL_INITIAL (cst_decl)) == INTEGER_CST)
                {
                  ipcp_callsite_param_set_type (cs, arg_num, 
CONST_IPATYPE_INT_REF);
                  ipcp_callsite_param_set_info_type_int (cs, arg_num,
!                                                     &TREE_INT_CST 
(DECL_INITIAL (cst_decl)));
                }
!             else if (TREE_CODE (DECL_INITIAL (cst_decl)) == REAL_CST)
                {
-                 cst_decl =  TREE_OPERAND (TREE_VALUE (arg), 0);
                  ipcp_callsite_param_set_type (cs, arg_num, 
CONST_IPATYPE_FLOAT_REF);
                  ipcp_callsite_param_set_info_type_float (cs, arg_num,
 TREE_REAL_CST_PTR (DECL_INITIAL (cst_decl))); 
--- 476,542 ----
        }
        else if (TREE_CODE (TREE_VALUE (arg)) == INTEGER_CST)
        {
!           arg_type = TREE_TYPE (TREE_VALUE (arg));
!           formal_type =  TREE_TYPE (ipcp_method_get_tree (cs->callee, 
arg_num));
!           if (TYPE_NAME (arg_type) == TYPE_NAME (formal_type)
!             && TYPE_CONTEXT (arg_type) == TYPE_CONTEXT (formal_type) 
!             && attribute_list_equal (TYPE_ATTRIBUTES (arg_type),
!                                      TYPE_ATTRIBUTES (formal_type)))
!             {
!               ipcp_callsite_param_set_type (cs, arg_num, 
CONST_IPATYPE_INT);
!               ipcp_callsite_param_set_info_type_int (cs, arg_num,
!                                                    &TREE_INT_CST 
(TREE_VALUE (arg)));
!             } 
!         else
!           ipcp_callsite_param_set_type (cs, arg_num, UNKNOWN_IPATYPE);
        }
        else if (TREE_CODE (TREE_VALUE (arg)) == REAL_CST)
!         { 
!           arg_type = TREE_TYPE (TREE_VALUE (arg));
!           formal_type =  TREE_TYPE (ipcp_method_get_tree (cs->callee, 
arg_num));
!           if (TYPE_NAME (arg_type) == TYPE_NAME (formal_type)
!             && TYPE_CONTEXT (arg_type) == TYPE_CONTEXT (formal_type)
!             && attribute_list_equal (TYPE_ATTRIBUTES (arg_type),
!                                      TYPE_ATTRIBUTES (formal_type)))
!             {
!               ipcp_callsite_param_set_type (cs, arg_num, 
CONST_IPATYPE_FLOAT);
!               ipcp_callsite_param_set_info_type_float (cs, arg_num,
!                                                        TREE_REAL_CST_PTR 
(TREE_VALUE (arg)));
!             }
!           else
!           ipcp_callsite_param_set_type (cs, arg_num, UNKNOWN_IPATYPE);
! 
        }
!       else if (TREE_CODE (TREE_VALUE (arg)) == ADDR_EXPR 
!              && TREE_CODE (TREE_OPERAND (TREE_VALUE (arg), 0)) == 
CONST_DECL)
        { 
!         cst_decl = TREE_OPERAND (TREE_VALUE (arg), 0);
!         arg_type = TREE_TYPE (DECL_INITIAL (cst_decl));
!         formal_type =  TREE_TYPE (TREE_TYPE (ipcp_method_get_tree 
(cs->callee, arg_num)));
!         if (TREE_CODE (DECL_INITIAL (cst_decl)) == INTEGER_CST)
            {
!             if (TYPE_NAME (arg_type) == TYPE_NAME (formal_type)
!                 && TYPE_CONTEXT (arg_type) == TYPE_CONTEXT (formal_type)
!                 && attribute_list_equal (TYPE_ATTRIBUTES (arg_type),
!                                          TYPE_ATTRIBUTES (formal_type)))
! 
                {
                  ipcp_callsite_param_set_type (cs, arg_num, 
CONST_IPATYPE_INT_REF);
                  ipcp_callsite_param_set_info_type_int (cs, arg_num,
!                                                        &TREE_INT_CST 
(DECL_INITIAL (cst_decl)));
! 
                }
!             else
!               ipcp_callsite_param_set_type (cs, arg_num, 
UNKNOWN_IPATYPE);
!           }
!         else if (TREE_CODE (DECL_INITIAL (cst_decl)) == REAL_CST)
!           {
!             if (TYPE_NAME (arg_type) == TYPE_NAME (formal_type)
!                 && TYPE_CONTEXT (arg_type) == TYPE_CONTEXT (formal_type)
!                 && attribute_list_equal (TYPE_ATTRIBUTES (arg_type),
!                                          TYPE_ATTRIBUTES (formal_type)))
! 
                {
                  ipcp_callsite_param_set_type (cs, arg_num, 
CONST_IPATYPE_FLOAT_REF);
                  ipcp_callsite_param_set_info_type_float (cs, arg_num,
 TREE_REAL_CST_PTR (DECL_INITIAL (cst_decl))); 
*************** ipcp_modify_walk_tree (tree *tp, int *wa
*** 835,841 ****
        if (TREE_CODE(TREE_OPERAND (t, 0)) == PARM_DECL)
        {
          i = ipcp_method_tree_map (mt, TREE_OPERAND (t, 0));
!           ipcp_method_modify_set (mt, i, true);
        } 
        break;
      case ADDR_EXPR:
--- 871,877 ----
        if (TREE_CODE(TREE_OPERAND (t, 0)) == PARM_DECL)
        {
          i = ipcp_method_tree_map (mt, TREE_OPERAND (t, 0));
!         ipcp_method_modify_set (mt, i, true);
        } 
        break;
      case ADDR_EXPR:
*************** ipcp_modify_walk_tree (tree *tp, int *wa
*** 845,851 ****
        if( TREE_CODE (TREE_OPERAND (t, 0)) == PARM_DECL )
          {
          i = ipcp_method_tree_map (mt, TREE_OPERAND (t, 0));
!           ipcp_method_modify_set (mt, i, true);
          }
        break;
      case ASM_EXPR: 
--- 881,887 ----
        if( TREE_CODE (TREE_OPERAND (t, 0)) == PARM_DECL )
          {
          i = ipcp_method_tree_map (mt, TREE_OPERAND (t, 0));
!         ipcp_method_modify_set (mt, i, true);
          }
        break;
      case ASM_EXPR: 
*************** constant_val_insert (tree fn, tree parm1
*** 1027,1041 ****
  }
 
  static tree 
! build_const_val (union info *cvalue, enum Cvalue_type type)
  {
    tree const_val;
 
    if (type == CONST_VALUE_INT ||  type ==  CONST_VALUE_INT_REF)
!     const_val = build_int_cst_wide (NULL_TREE, cvalue->int_value.low, 
!                                   cvalue->int_value.high); 
    else if (type == CONST_VALUE_FLOAT || type == CONST_VALUE_FLOAT_REF)
!     const_val = build_real ( float_type_node, cvalue->float_value);
    else
      abort (); 
    return const_val;
--- 1063,1077 ----
  }
 
  static tree 
! build_const_val (union info *cvalue, enum Cvalue_type type, tree 
tree_type)
  {
    tree const_val;
 
    if (type == CONST_VALUE_INT ||  type ==  CONST_VALUE_INT_REF)
!     const_val = build_int_cst_wide (tree_type, cvalue->int_value.low,
!                                     cvalue->int_value.high);
    else if (type == CONST_VALUE_FLOAT || type == CONST_VALUE_FLOAT_REF)
!     const_val = build_real (tree_type, cvalue->float_value);
    else
      abort (); 
    return const_val;
*************** ipcp_propagate_const (ipcp_method mt, in
*** 1056,1068 ****
               cgraph_node_name (mt));
    fndecl = mt->decl;
    parm_tree = ipcp_method_get_tree (mt, param);
!   if (type == CONST_VALUE_INT)
!     const_val = build_int_cst_wide (NULL_TREE, cvalue->int_value.low, 
!                                   cvalue->int_value.high); 
!   else if (type == CONST_VALUE_FLOAT)
!     const_val = build_real ( TREE_TYPE (parm_tree), 
cvalue->float_value);
!   else
!     abort ();
    if (parm_tree != NULL)
      if(fndecl != NULL)
        constant_val_insert (fndecl, parm_tree, const_val); 
--- 1092,1098 ----
               cgraph_node_name (mt));
    fndecl = mt->decl;
    parm_tree = ipcp_method_get_tree (mt, param);
!   const_val = build_const_val (cvalue, type, TREE_TYPE (parm_tree));
    if (parm_tree != NULL)
      if(fndecl != NULL)
        constant_val_insert (fndecl, parm_tree, const_val); 
*************** ipcp_propagate_stage (void)
*** 1182,1202 ****
 
  }
 
! /* Builds and initializes ipcp_replace_map struct 
     according to type. This struct is read by versioning, which 
     operates according to the flags sent.  */
! static struct ipcp_replace_map*
  ipcp_replace_map_create (enum Cvalue_type type, tree parm_tree, 
                         union info *cvalue)
  {
!   struct ipcp_replace_map* replace_map;
    tree const_val;
 
!   replace_map = xcalloc (1, sizeof (struct ipcp_replace_map)); 
    gcc_assert (ipcp_type_is_const (type));
    if (type == CONST_VALUE_INT_REF || type == CONST_VALUE_FLOAT_REF)
      {
!       const_val = build_const_val (cvalue, type);
        replace_map->old_tree = parm_tree;
        replace_map->new_tree = const_val;
        replace_map->replace_p = true;
--- 1212,1232 ----
 
  }
 
! /* Builds and initializes ipa_replace_map struct 
     according to type. This struct is read by versioning, which 
     operates according to the flags sent.  */
! static struct ipa_replace_map*
  ipcp_replace_map_create (enum Cvalue_type type, tree parm_tree, 
                         union info *cvalue)
  {
!   struct ipa_replace_map* replace_map;
    tree const_val;
 
!   replace_map = xcalloc (1, sizeof (struct ipa_replace_map)); 
    gcc_assert (ipcp_type_is_const (type));
    if (type == CONST_VALUE_INT_REF || type == CONST_VALUE_FLOAT_REF)
      {
!       const_val = build_const_val (cvalue, type, TREE_TYPE (TREE_TYPE 
(parm_tree)));
        replace_map->old_tree = parm_tree;
        replace_map->new_tree = const_val;
        replace_map->replace_p = true;
*************** ipcp_replace_map_create (enum Cvalue_typ
*** 1204,1210 ****
      }
    else if (TREE_READONLY (parm_tree) && !TREE_ADDRESSABLE (parm_tree))
      {
!       const_val = build_const_val (cvalue, type);
        replace_map->old_tree = parm_tree;
        replace_map->new_tree = const_val;
        replace_map->replace_p = true;
--- 1234,1240 ----
      }
    else if (TREE_READONLY (parm_tree) && !TREE_ADDRESSABLE (parm_tree))
      {
!       const_val = build_const_val (cvalue, type, TREE_TYPE (parm_tree));
        replace_map->old_tree = parm_tree;
        replace_map->new_tree = const_val;
        replace_map->replace_p = true;
*************** ipcp_insert_stage (void)
*** 1235,1241 ****
    int node_callers, count;
    tree parm_tree;
    enum Cvalue_type type;
!   struct ipcp_replace_map *replace_param;
 
    for (node = cgraph_nodes; node; node = node->next)
      { 
--- 1265,1271 ----
    int node_callers, count;
    tree parm_tree;
    enum Cvalue_type type;
!   struct ipa_replace_map *replace_param;
 
    for (node = cgraph_nodes; node; node = node->next)
      { 
*************** ipcp_method_cval_print (FILE *f)
*** 1508,1514 ****
        for(i = 0; i < count; i++)
          {
            if (ipcp_cval_get_cvalue_type (ipcp_method_cval (node, i)) 
!               == CONST_VALUE_INT) 
              {
                fprintf (f, " param [%d]: ", i);
                fprintf (f, "type is CONST_INT ");
--- 1538,1545 ----
        for(i = 0; i < count; i++)
          {
            if (ipcp_cval_get_cvalue_type (ipcp_method_cval (node, i)) 
!               == CONST_VALUE_INT || ipcp_cval_get_cvalue_type 
(ipcp_method_cval (node, i))
!               == CONST_VALUE_INT_REF)
              {
                fprintf (f, " param [%d]: ", i);
                fprintf (f, "type is CONST_INT ");
*************** ipcp_method_cval_print (FILE *f)
*** 1518,1524 ****
                         cvalue->high, cvalue->low);
              }
            else if (ipcp_cval_get_cvalue_type (ipcp_method_cval (node, 
i)) 
!               == CONST_VALUE_FLOAT)
            { 
              char string[100];
                REAL_VALUE_TYPE d;
--- 1549,1556 ----
                         cvalue->high, cvalue->low);
              }
            else if (ipcp_cval_get_cvalue_type (ipcp_method_cval (node, 
i)) 
!               == CONST_VALUE_FLOAT || ipcp_cval_get_cvalue_type 
(ipcp_method_cval (node, i))
!               == CONST_VALUE_FLOAT_REF)
            { 
              char string[100];
                REAL_VALUE_TYPE d;
Index: ipa_prop.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ipa_prop.h,v
retrieving revision 1.1.2.2
diff -c -3 -p -r1.1.2.2 ipa_prop.h
*** ipa_prop.h  10 Feb 2005 23:26:49 -0000      1.1.2.2
--- ipa_prop.h  5 May 2005 10:03:09 -0000
*************** struct ipcp_modify
*** 66,72 ****
  {
    bool mod;
  };
! struct ipcp_replace_map
  {
    tree old_tree;
    tree new_tree;
--- 66,72 ----
  {
    bool mod;
  };
! struct ipa_replace_map
  {
    tree old_tree;
    tree new_tree;
Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.26.2.83.2.47
diff -c -3 -p -r1.26.2.83.2.47 tree-inline.c
*** tree-inline.c       30 Apr 2005 20:22:36 -0000      1.26.2.83.2.47
--- tree-inline.c       5 May 2005 10:03:10 -0000
*************** copy_decl_for_dup (tree decl, tree from_
*** 2665,2672 ****
        if (TREE_CODE (copy) == LABEL_DECL)
        {
          TREE_ADDRESSABLE (copy) = 0;
!         if (!versioning)
!           LABEL_DECL_UID (copy) = -1;
        }
      }
 
--- 2665,2671 ----
        if (TREE_CODE (copy) == LABEL_DECL)
        {
          TREE_ADDRESSABLE (copy) = 0;
!         LABEL_DECL_UID (copy) = -1;
        }
      }
 
*************** tree_function_versioning (tree old_decl,
*** 2821,2827 ****
    inline_data id;
    tree p, new_fndecl;
    unsigned i;
!   struct ipcp_replace_map *replace_info;
    basic_block old_entry_block;
 
    gcc_assert (TREE_CODE (old_decl) == FUNCTION_DECL
--- 2820,2826 ----
    inline_data id;
    tree p, new_fndecl;
    unsigned i;
!   struct ipa_replace_map *replace_info;
    basic_block old_entry_block;
 
    gcc_assert (TREE_CODE (old_decl) == FUNCTION_DECL
*************** tree_function_versioning (tree old_decl,
*** 2830,2835 ****
--- 2829,2837 ----
    old_version_node = cgraph_node (old_decl);
    new_version_node = cgraph_node (new_decl);
 
+   allocate_struct_function (new_decl);
+   cfun->function_end_locus = DECL_SOURCE_LOCATION (new_decl);
+ 
    /* FIXME: For the moment debug information for the new
       version is not supported.  */
    DECL_ARTIFICIAL (new_decl) = 1;
*************** tree_function_versioning (tree old_decl,
*** 2865,2899 ****
    /* Copy the function's static chain. */
    p = DECL_STRUCT_FUNCTION (old_decl)->static_chain_decl;
    if (p)
!     {
!       DECL_STRUCT_FUNCTION (new_decl)->static_chain_decl =
!       copy_static_chain (DECL_STRUCT_FUNCTION 
(old_decl)->static_chain_decl,
!                          &id);
!     }
! 
    /* Copy the function's arguments. */
    if (DECL_ARGUMENTS (old_decl) != NULL_TREE)
!     {
!       DECL_ARGUMENTS (new_decl) =
!       copy_arguments_for_versioning (DECL_ARGUMENTS (old_decl), &id);
!      }
! 
!   for (i = 0; i < VARRAY_ACTIVE_SIZE (tree_map); i++)
!     {
!       replace_info = VARRAY_GENERIC_PTR (tree_map, i);
!       if (replace_info->replace_p && !replace_info->ref_p)
!       insert_decl_map (&id, replace_info->old_tree, 
replace_info->new_tree);
!       else if (replace_info->replace_p && replace_info->ref_p)
!       id.ipa_info = tree_map;
!     }
! 
    if (DECL_STRUCT_FUNCTION (old_decl)->unexpanded_var_list != NULL_TREE)
!     {
!       DECL_STRUCT_FUNCTION (new_decl)->unexpanded_var_list =
!       copy_local_vars (DECL_STRUCT_FUNCTION 
(old_decl)->unexpanded_var_list,
!                        &id);
!     }
! 
    /* Copy the Function's body. */
    old_entry_block = ENTRY_BLOCK_PTR_FOR_FUNCTION
                      (DECL_STRUCT_FUNCTION (old_decl));
--- 2867,2892 ----
    /* Copy the function's static chain. */
    p = DECL_STRUCT_FUNCTION (old_decl)->static_chain_decl;
    if (p)
!     DECL_STRUCT_FUNCTION (new_decl)->static_chain_decl = 
!       copy_static_chain (DECL_STRUCT_FUNCTION 
(old_decl)->static_chain_decl,
!                        &id); 
    /* Copy the function's arguments. */
    if (DECL_ARGUMENTS (old_decl) != NULL_TREE)
!     DECL_ARGUMENTS (new_decl) =
!       copy_arguments_for_versioning (DECL_ARGUMENTS (old_decl), &id);
!   if (tree_map) 
!     for (i = 0; i < VARRAY_ACTIVE_SIZE (tree_map); i++)
!       {
!         replace_info = VARRAY_GENERIC_PTR (tree_map, i);
!         if (replace_info->replace_p && !replace_info->ref_p)
!           insert_decl_map (&id, replace_info->old_tree, 
replace_info->new_tree);
!         else if (replace_info->replace_p && replace_info->ref_p)
!           id.ipa_info =tree_ map;
!       }
    if (DECL_STRUCT_FUNCTION (old_decl)->unexpanded_var_list != NULL_TREE)
!     DECL_STRUCT_FUNCTION (new_decl)->unexpanded_var_list =
!       copy_local_vars (DECL_STRUCT_FUNCTION 
(old_decl)->unexpanded_var_list,
!                      &id);
    /* Copy the Function's body. */
    old_entry_block = ENTRY_BLOCK_PTR_FOR_FUNCTION
                      (DECL_STRUCT_FUNCTION (old_decl));
*************** replace_ref_tree (inline_data *id, tree*
*** 2940,2946 ****
 
        for (i = 0; i < VARRAY_ACTIVE_SIZE (id->ipa_info); i++)
        {
!         struct ipcp_replace_map *replace_info;
          replace_info = VARRAY_GENERIC_PTR (id->ipa_info, i);
 
          if (replace_info->replace_p && replace_info->ref_p)
--- 2933,2939 ----
 
        for (i = 0; i < VARRAY_ACTIVE_SIZE (id->ipa_info); i++)
        {
!         struct ipa_replace_map *replace_info;
          replace_info = VARRAY_GENERIC_PTR (id->ipa_info, i);
 
          if (replace_info->replace_p && replace_info->ref_p)
Index: testsuite/lib/scancgraph.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/lib/Attic/scancgraph.exp,v
retrieving revision 1.1.2.1
diff -c -3 -p -r1.1.2.1 scancgraph.exp
*** testsuite/lib/scancgraph.exp        10 Feb 2005 23:26:55 -0000 1.1.2.1
--- testsuite/lib/scancgraph.exp        5 May 2005 10:03:18 -0000
*************** proc scan-ipa-dump-times { args } {
*** 49,55 ****
      upvar 2 name testcase
 
      # This must match the rule in gcc-dg.exp.
!     set output_file "[glob [file tail $testcase].i02.[lindex $args 2]]"
 
      set fd [open $output_file r]
      set text [read $fd]
--- 49,55 ----
      upvar 2 name testcase
 
      # This must match the rule in gcc-dg.exp.
!     set output_file "[glob [file tail $testcase].i??.[lindex $args 2]]"
 
      set fd [open $output_file r]
      set text [read $fd]


 
 


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