tree.h (enum tree_index): Add TI_INTEGER_THREE.
authorAnatoly Sokolov <aesok@post.ru>
Thu, 15 Jul 2010 18:47:23 +0000 (22:47 +0400)
committerAnatoly Sokolov <aesok@gcc.gnu.org>
Thu, 15 Jul 2010 18:47:23 +0000 (22:47 +0400)
* tree.h (enum tree_index): Add TI_INTEGER_THREE.
(integer_three_node): Add.
* tree.c (build_common_tree_nodes_2): Use integer_type_node insead of
NULL_TREE in build_int_cst calls. Initialize the integer_three_node.
* builtins.c (expand_builtin_prefetch): Use common tree nodes instead
of call build_int_cst.
* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Ditto.
* tree-ssa-loop-ivopts.c (idx_find_step): Ditto.
(find_interesting_uses_address): Ditto.
* tree-ssa-alias.c (ao_ref_init_from_ptr_and_size): Ditto.
* tree-eh.c (lower_eh_constructs_2): Ditto.
* tree-vect-loop.c (get_initial_def_for_induction): Ditto.
* c-typeck.c (really_start_incremental_init, push_init_level): Ditto.
* expmed.c (expand_divmod): Ditto.
* tree-mudflap.c (mx_register_decls): Ditto.
* varasm.c (array_size_for_constructor): Ditto.
* tree-ssa-loop-prefetch.c (issue_prefetch_ref): Ditto.
* c-parser.c (c_parser_postfix_expression): Ditto.

/cp
* decl.c (integer_three_node): Remove.
(cxx_init_decl_processing): Do not initialize the integer_three_node.
* cp-tree.h (integer_three_node): Remove.

From-SVN: r162230

18 files changed:
gcc/ChangeLog
gcc/builtins.c
gcc/c-parser.c
gcc/c-typeck.c
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/expmed.c
gcc/tree-eh.c
gcc/tree-mudflap.c
gcc/tree-ssa-alias.c
gcc/tree-ssa-loop-ivopts.c
gcc/tree-ssa-loop-prefetch.c
gcc/tree-ssa-sccvn.c
gcc/tree-vect-loop.c
gcc/tree.c
gcc/tree.h
gcc/varasm.c

index 8105229dba9147a9a5a053e0099a0e750facdd94..1ef39edf1888abb88fbb991d075ee70e7d0cfa23 100644 (file)
@@ -1,3 +1,24 @@
+2010-07-15  Anatoly Sokolov  <aesok@post.ru>
+
+       * tree.h (enum tree_index): Add TI_INTEGER_THREE.
+       (integer_three_node): Add.
+       * tree.c (build_common_tree_nodes_2): Use integer_type_node insead of
+       NULL_TREE in build_int_cst calls. Initialize the integer_three_node.
+       * builtins.c (expand_builtin_prefetch): Use common tree nodes instead
+       of call build_int_cst.
+       * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Ditto.
+       * tree-ssa-loop-ivopts.c (idx_find_step): Ditto.
+       (find_interesting_uses_address): Ditto.
+       * tree-ssa-alias.c (ao_ref_init_from_ptr_and_size): Ditto.
+       * tree-eh.c (lower_eh_constructs_2): Ditto.
+       * tree-vect-loop.c (get_initial_def_for_induction): Ditto.
+       * c-typeck.c (really_start_incremental_init, push_init_level): Ditto.
+       * expmed.c (expand_divmod): Ditto.
+       * tree-mudflap.c (mx_register_decls): Ditto.
+       * varasm.c (array_size_for_constructor): Ditto.
+       * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Ditto.
+       * c-parser.c (c_parser_postfix_expression): Ditto.
+
 2010-07-15  Bernd Schmidt  <bernds@codesourcery.com>
 
        * postreload.c (last_label_ruid, first_index_reg, last_index_reg):
index 2bcf656776a5453b16655dcee643b5025bd126e6..40327e0e858cfc25911d23e64d60e0dd5a041959 100644 (file)
@@ -1062,7 +1062,7 @@ expand_builtin_prefetch (tree exp)
   if (nargs > 2)
     arg2 = CALL_EXPR_ARG (exp, 2);
   else
-    arg2 = build_int_cst (NULL_TREE, 3);
+    arg2 = integer_three_node;
 
   /* Argument 0 is an address.  */
   op0 = expand_expr (arg0, NULL_RTX, Pmode, EXPAND_NORMAL);
index e773fe0d0fc421f0f0032a53e89e628210d74ab5..306d46ba65f28491f6bc415cb3edcddc72101d3a 100644 (file)
@@ -5847,9 +5847,8 @@ c_parser_postfix_expression (c_parser *parser)
            e1 = TYPE_MAIN_VARIANT (groktypename (t1, NULL, NULL));
            e2 = TYPE_MAIN_VARIANT (groktypename (t2, NULL, NULL));
 
-           expr.value = comptypes (e1, e2)
-             ? build_int_cst (NULL_TREE, 1)
-             : build_int_cst (NULL_TREE, 0);
+           expr.value
+             = comptypes (e1, e2) ? integer_one_node : integer_zero_node;
          }
          break;
        case RID_AT_SELECTOR:
index edf0d8b2c9dc00ee18f3fda49b365d325bbc4bc3..bcbc2968d98c28929376c814cf4a6285382bd966 100644 (file)
@@ -6498,14 +6498,14 @@ really_start_incremental_init (tree type)
          /* Detect non-empty initializations of zero-length arrays.  */
          if (constructor_max_index == NULL_TREE
              && TYPE_SIZE (constructor_type))
-           constructor_max_index = build_int_cst (NULL_TREE, -1);
+           constructor_max_index = integer_minus_one_node;
 
          /* constructor_max_index needs to be an INTEGER_CST.  Attempts
             to initialize VLAs will cause a proper error; avoid tree
             checking errors as well by setting a safe value.  */
          if (constructor_max_index
              && TREE_CODE (constructor_max_index) != INTEGER_CST)
-           constructor_max_index = build_int_cst (NULL_TREE, -1);
+           constructor_max_index = integer_minus_one_node;
 
          constructor_index
            = convert (bitsizetype,
@@ -6706,14 +6706,14 @@ push_init_level (int implicit, struct obstack * braced_init_obstack)
          /* Detect non-empty initializations of zero-length arrays.  */
          if (constructor_max_index == NULL_TREE
              && TYPE_SIZE (constructor_type))
-           constructor_max_index = build_int_cst (NULL_TREE, -1);
+           constructor_max_index = integer_minus_one_node;
 
          /* constructor_max_index needs to be an INTEGER_CST.  Attempts
             to initialize VLAs will cause a proper error; avoid tree
             checking errors as well by setting a safe value.  */
          if (constructor_max_index
              && TREE_CODE (constructor_max_index) != INTEGER_CST)
-           constructor_max_index = build_int_cst (NULL_TREE, -1);
+           constructor_max_index = integer_minus_one_node;
 
          constructor_index
            = convert (bitsizetype,
index 8b1399c81e6e43324aaa3ffb0d78fd8a7ba19de8..e03ca757a40caec7646df170fb8020c299f56c7d 100644 (file)
@@ -1,3 +1,9 @@
+2010-07-15  Anatoly Sokolov  <aesok@post.ru>
+
+       * decl.c (integer_three_node): Remove.
+       (cxx_init_decl_processing): Do not initialize the integer_three_node.
+       * cp-tree.h (integer_three_node): Remove.
+
 2010-07-15  Nathan Froyd  <froydnj@codesourcery.com>
 
        * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN.
index 70915cbc4ddd87b4f899c09256841de8b172f6ce..d5b01610acd881e8fa54d990d5c1462faafc2755 100644 (file)
@@ -4006,7 +4006,6 @@ typedef enum base_kind {
 
 /* For building calls to `delete'.  */
 extern GTY(()) tree integer_two_node;
-extern GTY(()) tree integer_three_node;
 
 /* The number of function bodies which we are currently processing.
    (Zero if we are at namespace scope, one inside the body of a
index 0a9f255177e2074619a78e4f0131e8e4a6369060..5d07956554e65674374ac2b44972062dedd66bdd 100644 (file)
@@ -169,9 +169,9 @@ tree static_aggregates;
 
 /* -- end of C++ */
 
-/* A node for the integer constants 2, and 3.  */
+/* A node for the integer constant 2.  */
 
-tree integer_two_node, integer_three_node;
+tree integer_two_node;
 
 /* Used only for jumps to as-yet undefined labels, since jumps to
    defined labels can have their validity checked immediately.  */
@@ -3439,7 +3439,6 @@ cxx_init_decl_processing (void)
   java_boolean_type_node = record_builtin_java_type ("__java_boolean", -1);
 
   integer_two_node = build_int_cst (NULL_TREE, 2);
-  integer_three_node = build_int_cst (NULL_TREE, 3);
 
   record_builtin_type (RID_BOOL, "bool", boolean_type_node);
   truthvalue_type_node = boolean_type_node;
index e6b30e42b2a975eda9313b04042f7cdac7ab278f..ddace9f2e3929c2ae392dc35e5c2932397408176 100644 (file)
@@ -4064,10 +4064,8 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
                            t2 = force_operand (gen_rtx_MINUS (compute_mode,
                                                               op0, t1),
                                                NULL_RTX);
-                           t3 = expand_shift
-                             (RSHIFT_EXPR, compute_mode, t2,
-                              build_int_cst (NULL_TREE, 1),
-                              NULL_RTX,1);
+                           t3 = expand_shift (RSHIFT_EXPR, compute_mode, t2,
+                                              integer_one_node, NULL_RTX, 1);
                            t4 = force_operand (gen_rtx_PLUS (compute_mode,
                                                              t1, t3),
                                                NULL_RTX);
@@ -4751,8 +4749,7 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
              }
            tem = plus_constant (op1, -1);
            tem = expand_shift (RSHIFT_EXPR, compute_mode, tem,
-                               build_int_cst (NULL_TREE, 1),
-                               NULL_RTX, 1);
+                               integer_one_node, NULL_RTX, 1);
            do_cmp_and_jump (remainder, tem, LEU, compute_mode, label);
            expand_inc (quotient, const1_rtx);
            expand_dec (remainder, op1);
@@ -4777,8 +4774,7 @@ expand_divmod (int rem_flag, enum tree_code code, enum machine_mode mode,
            abs_rem = expand_abs (compute_mode, remainder, NULL_RTX, 1, 0);
            abs_op1 = expand_abs (compute_mode, op1, NULL_RTX, 1, 0);
            tem = expand_shift (LSHIFT_EXPR, compute_mode, abs_rem,
-                               build_int_cst (NULL_TREE, 1),
-                               NULL_RTX, 1);
+                               integer_one_node, NULL_RTX, 1);
            do_cmp_and_jump (tem, abs_op1, LTU, compute_mode, label);
            tem = expand_binop (compute_mode, xor_optab, op0, op1,
                                NULL_RTX, 0, OPTAB_WIDEN);
index 1fb531f0a50eef11c69fa3cbcca9cfa3fa445aaf..ab501d5e0a63bbd3f330dfdd40a3c7c4f8760c81 100644 (file)
@@ -1877,7 +1877,7 @@ lower_eh_constructs_2 (struct leh_state *state, gimple_stmt_iterator *gsi)
              else
                {
                  /* The user has dome something silly.  Remove it.  */
-                 rhs = build_int_cst (ptr_type_node, 0);
+                 rhs = null_pointer_node;
                  goto do_replace;
                }
              break;
index b5a3e43f470bb8ffb65cc1305a0566604026f8f8..99c5bce1726cad43232514cee1ce193a418eb369 100644 (file)
@@ -1074,7 +1074,7 @@ mx_register_decls (tree decl, gimple_seq seq, location_t location)
           unregister_fncall = gimple_build_call (mf_unregister_fndecl, 3,
                                                 unregister_fncall_param,
                                                 size,
-                                                build_int_cst (NULL_TREE, 3));
+                                                integer_three_node);
 
 
           variable_name = mf_varname_tree (decl);
@@ -1087,7 +1087,7 @@ mx_register_decls (tree decl, gimple_seq seq, location_t location)
          register_fncall = gimple_build_call (mf_register_fndecl, 4,
                                               register_fncall_param,
                                               size,
-                                              build_int_cst (NULL_TREE, 3),
+                                              integer_three_node,
                                               variable_name);
 
 
index d73ff5965f05729c577debf08d67bf6d20283b8a..a95d78caca1824e8fead42f7f5a50707ab9132a0 100644 (file)
@@ -517,7 +517,7 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size)
   else
     {
       ref->base = build2 (MEM_REF, char_type_node,
-                         ptr, build_int_cst (ptr_type_node, 0));
+                         ptr, null_pointer_node);
       ref->offset = 0;
     }
   if (size
index 83ec13e4a76c6ca234b993bc833bf566a6765eda..5f2c6ae0eb80ec6cd783fed62c17818e738f02c4 100644 (file)
@@ -1418,7 +1418,7 @@ idx_find_step (tree base, tree *idx, void *data)
     }
   else
     /* The step for pointer arithmetics already is 1 byte.  */
-    step = build_int_cst (sizetype, 1);
+    step = size_one_node;
 
   iv_base = iv->base;
   iv_step = iv->step;
@@ -1611,7 +1611,7 @@ may_be_nonaddressable_p (tree expr)
 static void
 find_interesting_uses_address (struct ivopts_data *data, gimple stmt, tree *op_p)
 {
-  tree base = *op_p, step = build_int_cst (sizetype, 0);
+  tree base = *op_p, step = size_zero_node;
   struct iv *civ;
   struct ifs_ivopts_data ifs_ivopts_data;
 
@@ -1669,7 +1669,7 @@ find_interesting_uses_address (struct ivopts_data *data, gimple stmt, tree *op_p
     {
       ifs_ivopts_data.ivopts_data = data;
       ifs_ivopts_data.stmt = stmt;
-      ifs_ivopts_data.step = build_int_cst (sizetype, 0);
+      ifs_ivopts_data.step = size_zero_node;
       if (!for_each_index (&base, idx_find_step, &ifs_ivopts_data)
          || integer_zerop (ifs_ivopts_data.step))
        goto fail;
index 008f2ce4b7b8d442a20641d25cb71d07985172d8..a5b511262f9ed9064ac60359aac4cdf00667af8b 100644 (file)
@@ -1083,7 +1083,7 @@ issue_prefetch_ref (struct mem_ref *ref, unsigned unroll_factor, unsigned ahead)
   addr_base = force_gimple_operand_gsi (&bsi, unshare_expr (addr_base),
                                        true, NULL, true, GSI_SAME_STMT);
   write_p = ref->write_p ? integer_one_node : integer_zero_node;
-  local = build_int_cst (integer_type_node, nontemporal ? 0 : 3);
+  local = nontemporal ? integer_zero_node : integer_three_node;
 
   for (ap = 0; ap < n_prefetches; ap++)
     {
index 9ce37f705e5cf81bdcbd63aa11f66f0d111a705d..8eafd9b9821829a35640f4b25fa6dd538392bd3f 100644 (file)
@@ -564,7 +564,7 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
 
       base = TMR_SYMBOL (ref) ? TMR_SYMBOL (ref) : TMR_BASE (ref);
       if (!base)
-       base = build_int_cst (ptr_type_node, 0);
+       base = null_pointer_node;
 
       memset (&temp, 0, sizeof (temp));
       /* We do not care for spurious type qualifications.  */
index ecfc6705dacd629b264475999802d213ad7c0ae8..49a8721c55d4f5c5de9f2f012c265f6763d43f2c 100644 (file)
@@ -2608,7 +2608,7 @@ get_initial_def_for_induction (gimple iv_phi)
   if (INTEGRAL_TYPE_P (scalar_type))
     step_expr = build_int_cst (scalar_type, 0);
   else if (POINTER_TYPE_P (scalar_type))
-    step_expr = build_int_cst (sizetype, 0);
+    step_expr = size_zero_node;
   else
     step_expr = build_real (scalar_type, dconst0);
 
index 7f37d45fba28760a76fbe4e13c99c32214dad778..5726ca427ced4e3944551d48019b2a305b96d34c 100644 (file)
@@ -8969,9 +8969,10 @@ void
 build_common_tree_nodes_2 (int short_double)
 {
   /* Define these next since types below may used them.  */
-  integer_zero_node = build_int_cst (NULL_TREE, 0);
-  integer_one_node = build_int_cst (NULL_TREE, 1);
-  integer_minus_one_node = build_int_cst (NULL_TREE, -1);
+  integer_zero_node = build_int_cst (integer_type_node, 0);
+  integer_one_node = build_int_cst (integer_type_node, 1);
+  integer_three_node = build_int_cst (integer_type_node, 3);
+  integer_minus_one_node = build_int_cst (integer_type_node, -1);
 
   size_zero_node = size_int (0);
   size_one_node = size_int (1);
index 326950c5c6d1af84a3057e5e3a97f6f14aab3802..3c0806e4e3aade337213f60fef6dbe3852b7824b 100644 (file)
@@ -3515,6 +3515,7 @@ enum tree_index
 
   TI_INTEGER_ZERO,
   TI_INTEGER_ONE,
+  TI_INTEGER_THREE,
   TI_INTEGER_MINUS_ONE,
   TI_NULL_POINTER,
 
@@ -3669,6 +3670,7 @@ extern GTY(()) tree global_trees[TI_MAX];
 
 #define integer_zero_node              global_trees[TI_INTEGER_ZERO]
 #define integer_one_node               global_trees[TI_INTEGER_ONE]
+#define integer_three_node              global_trees[TI_INTEGER_THREE]
 #define integer_minus_one_node         global_trees[TI_INTEGER_MINUS_ONE]
 #define size_zero_node                 global_trees[TI_SIZE_ZERO]
 #define size_one_node                  global_trees[TI_SIZE_ONE]
index 00b4af93a9f50f4a8a84944dc929341e691a9560..9a4c193e2e76bbfcdf1d10b8258c7687d8773397 100644 (file)
@@ -4908,7 +4908,7 @@ array_size_for_constructor (tree val)
   tmp = TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (val)));
   i = size_binop (MINUS_EXPR, fold_convert (sizetype, max_index),
                  fold_convert (sizetype, tmp));
-  i = size_binop (PLUS_EXPR, i, build_int_cst (sizetype, 1));
+  i = size_binop (PLUS_EXPR, i, size_one_node);
 
   /* Multiply by the array element unit size to find number of bytes.  */
   i = size_binop (MULT_EXPR, i, TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (val))));