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]

IPCP & versioning additions and fixes for tree profiling branch


Hello,

Attached are several additions and fixes to ipcp and versioning code.

Comments are welcome,
Thanks,
Razya

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

 * cgraphunit.c (cgraph_function_versioning): assign proper values to the 
TREE_DECL fields of the new version.
 * gimplify.c (create_function_name): changed code to create a unique name 
for the versioned node.
 * ipa_prop.c (constant_val_insert ): enable the insertion of the constant 
to the (versioned) function.
  (ipcp_cval_equal_cvalues): fix float constant comparison.
 
Index: cgraphunit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.1.4.35.2.44
diff -c -3 -p -r1.1.4.35.2.44 cgraphunit.c
*** cgraphunit.c        4 Mar 2005 21:25:59 -0000       1.1.4.35.2.44
--- cgraphunit.c        20 Mar 2005 10:01:52 -0000
*************** cgraph_function_versioning (struct cgrap
*** 1473,1478 ****
--- 1473,1493 ----
    /* Update the call_expr on the edges
       to the new version node. */
    update_call_expr (new_version_node, redirect_callers);
+   if (new_version_node && DECL_EXTERNAL (new_version_node->decl))
+     DECL_EXTERNAL (new_version_node->decl) = 0;
+   if (DECL_ONE_ONLY (new_version_node->decl))
+     DECL_ONE_ONLY (new_version_node->decl) = 0; 
+   if (TREE_PUBLIC (new_version_node->decl))
+     TREE_PUBLIC (new_version_node->decl) = 0;
+   if (DECL_COMDAT (new_version_node->decl))
+     DECL_COMDAT (new_version_node->decl) = 0;
+   new_version_node->local.externally_visible = 0;
+   new_version_node->local.local = 1;
+   new_version_node->local.avail = AVAIL_LOCAL;
+   if (TREE_ADDRESSABLE (new_version_node->decl))
+     TREE_ADDRESSABLE (new_version_node->decl) = 0;
+   if (new_version_node->needed)
+     abort ();
    return new_version_node;
  }
 
Index: gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimplify.c,v
retrieving revision 1.1.2.141.2.21
diff -c -3 -p -r1.1.2.141.2.21 gimplify.c
*** gimplify.c  1 Mar 2005 23:08:02 -0000       1.1.2.141.2.21
--- gimplify.c  20 Mar 2005 10:01:53 -0000
*************** create_function_name (const char *prefix
*** 337,343 ****
    len = strlen (tmp_name);
    for (i=0; i < len; i++)
      {
!       if (tmp_name[i] == '.')
          tmp_name[i] = '_';
      }
 
--- 337,343 ----
    len = strlen (tmp_name);
    for (i=0; i < len; i++)
      {
!       if (!ISALPHA (tmp_name[i]) && !ISDIGIT (tmp_name[i]) && 
tmp_name[i] != '.')
          tmp_name[i] = '_';
      }
 
Index: ipa_prop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ipa_prop.c,v
retrieving revision 1.1.2.4
diff -c -3 -p -r1.1.2.4 ipa_prop.c
*** ipa_prop.c  10 Feb 2005 23:26:49 -0000      1.1.2.4
--- ipa_prop.c  20 Mar 2005 10:01:54 -0000
*************** ipcp_cval_equal_cvalues (union info *con
*** 995,1008 ****
       return false;
 
    if (type1 == CONST_VALUE_INT  || type1 == CONST_VALUE_INT_REF) 
!   {
!     if ((const_val1->int_value.low == const_val2->int_value.low) 
!         && (const_val1->int_value.high == const_val2->int_value.high)) 
!       return true; 
!    }
!    else if(REAL_VALUES_EQUAL (const_val1->float_value, 
const_val2->float_value))
!        return true; 
! 
    return false;
  }
 
--- 995,1008 ----
       return false;
 
    if (type1 == CONST_VALUE_INT  || type1 == CONST_VALUE_INT_REF) 
!     {
!       if ((const_val1->int_value.low == const_val2->int_value.low) 
!         && (const_val1->int_value.high == const_val2->int_value.high)) 
!       return true; 
!     }
!   else if (REAL_VALUES_IDENTICAL (const_val1->float_value, 
const_val2->float_value)) 
!     return true; 
! 
    return false;
  }
 
*************** static void 
*** 1015,1048 ****
  constant_val_insert (tree fn, tree parm1, tree val)
  {
    struct function *func;
!   basic_block bb;
!   block_stmt_iterator new_bsi;
!   tree init_stmt, stmt;
! 
!   /* Temporary, until it is debugged completely.  */ 
!   return;
    init_stmt = build2 (MODIFY_EXPR, void_type_node, parm1, val);
    func = DECL_STRUCT_FUNCTION (fn);
!   bb = ENTRY_BLOCK_PTR_FOR_FUNCTION (func)->next_bb;
!   new_bsi = bsi_start (bb);
!   if (empty_block_p (bb))
!      {
!         bsi_insert_before (&new_bsi, init_stmt, BSI_NEW_STMT);
!       }
!   else
!   {
!   stmt = bsi_stmt (new_bsi);
!   if (TREE_CODE (stmt) == LABEL_EXPR)
!   {
!     new_bsi = bsi_after_labels (bb);
!     bsi_insert_after (&new_bsi, init_stmt, BSI_NEW_STMT);
!   } 
!   else
!     {
! 
!     bsi_insert_before (&new_bsi, init_stmt, BSI_NEW_STMT);
!     }
!   }
  }
 
  static tree 
--- 1015,1029 ----
  constant_val_insert (tree fn, tree parm1, tree val)
  {
    struct function *func;
!   tree init_stmt;
!   edge e_step;
!   edge_iterator ei; 
    init_stmt = build2 (MODIFY_EXPR, void_type_node, parm1, val);
    func = DECL_STRUCT_FUNCTION (fn);
!   cfun = func; 
!   if (ENTRY_BLOCK_PTR_FOR_FUNCTION (func)->succs)
!     FOR_EACH_EDGE(e_step,ei,ENTRY_BLOCK_PTR_FOR_FUNCTION (func)->succs)
!       bsi_insert_on_edge_immediate (e_step, init_stmt); 
  }
 
  static tree 
*************** ipcp_insert_stage (void)
*** 1255,1263 ****
    tree parm_tree;
    enum Cvalue_type type;
    struct ipcp_replace_map *replace_param;
! 
    for (node = cgraph_nodes; node; node = node->next)
!     { 
        /* Propagation of the constant is forbidden in 
           certain conditions.  */
        if (ipcp_method_dont_insert_const (node))
--- 1236,1244 ----
    tree parm_tree;
    enum Cvalue_type type;
    struct ipcp_replace_map *replace_param;
! 
    for (node = cgraph_nodes; node; node = node->next)
!     { 
        /* Propagation of the constant is forbidden in 
           certain conditions.  */
        if (ipcp_method_dont_insert_const (node))
*************** ipcp_insert_stage (void)
*** 1296,1302 ****
        /* Redirecting all the callers of the node to the 
         new versioned node.  */
        node1 =  cgraph_function_versioning (node, redirect_callers, 
replace_trees);
- 
        VARRAY_CLEAR (redirect_callers);
        VARRAY_CLEAR (replace_trees);
        if (node1 == NULL)
--- 1277,1282 ----
*************** ipcp_insert_stage (void)
*** 1313,1320 ****
              parm_tree = ipcp_method_get_tree (node, i);
              if ( type != CONST_VALUE_INT_REF && type != 
CONST_VALUE_FLOAT_REF 
                   && !TREE_READONLY (parm_tree))
!               ipcp_propagate_const (node1, i, cvalue, type);
! 
            }
        }
      }
--- 1293,1299 ----
              parm_tree = ipcp_method_get_tree (node, i);
              if ( type != CONST_VALUE_INT_REF && type != 
CONST_VALUE_FLOAT_REF 
                   && !TREE_READONLY (parm_tree))
!               ipcp_propagate_const (node1, i, cvalue, type); 
            }
        }
      } 


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