]> gcc.gnu.org Git - gcc.git/commitdiff
tree.h (size_int_type): Remove.
authorNathan Sidwell <nathan@codesourcery.com>
Fri, 27 Aug 2004 16:45:20 +0000 (16:45 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Fri, 27 Aug 2004 16:45:20 +0000 (16:45 +0000)
* tree.h (size_int_type): Remove.
* fold-const.c: Do not #include gt-fold-const.h.
(size_htab_hash, size_htab_eq): Remove.
(size_int_kind): Use build_int_cst.
(new_const, size_htab): Remove.
(size_int_type): Remove.
(round_up): Use build_int_cst.
(round_down): Likewise. Remove spurious constant build.

* ada/utils2.c (build_allocator): Use ssize_int.

* cp/class.c (build_vtbl_initializer): Use ssize_int.
* cp/decl.c (complete_array_type): Likewise.
* cp/method.c (finish_thunk): Likewise.
* cp/search.c (get_dynamic_base_type): Likewise.

From-SVN: r86667

gcc/ChangeLog
gcc/ada/ChangeLog
gcc/ada/utils2.c
gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/decl.c
gcc/cp/method.c
gcc/cp/search.c
gcc/fold-const.c
gcc/tree.h

index b583862145c13b9d7fe9aa2b3f7f4520ba1f1774..5e5e1511092386092d88fcf234c83833a2d01253 100644 (file)
@@ -1,3 +1,14 @@
+2004-08-27  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * tree.h (size_int_type): Remove.
+       * fold-const.c: Do not #include gt-fold-const.h.
+       (size_htab_hash, size_htab_eq): Remove.
+       (size_int_kind): Use build_int_cst.
+       (new_const, size_htab): Remove.
+       (size_int_type): Remove.
+       (round_up): Use build_int_cst.
+       (round_down): Likewise. Remove spurious constant build.
+
 2004-08-27  Nathan Sidwell  <nathan@codesourcery.com>
 
        * configure.ac: Add ENABLE_ASSERT_CHECKING control.
index 27f6361a0ffca626e531814e355e727de8faf21f..5d5187771efe1ad80166190799432f8c04c66a18 100644 (file)
@@ -1,5 +1,7 @@
 2004-08-27  Nathan Sidwell  <nathan@codesourcery.com>
 
+       * utils2.c (build_allocator): Use ssize_int.
+
        * utils.c (gnat_init_decl_processing): Ada has a signed sizetype.
 
 2004-08-27  Andreas Schwab  <schwab@suse.de>
index 10da013f91e7bce2ac0c0b0f5c80ff6b45e31768..093e6f00feedf88c34d49c9491b3c035ab2efbb0 100644 (file)
@@ -1799,7 +1799,7 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
       /* If the size overflows, pass -1 so the allocator will raise
         storage error.  */
       if (TREE_CODE (size) == INTEGER_CST && TREE_OVERFLOW (size))
-       size = build_int_cst (ssizetype, -1);
+       size = ssize_int (-1);
 
       storage = build_call_alloc_dealloc (NULL_TREE, size,
                                          TYPE_ALIGN (storage_type),
@@ -1872,7 +1872,7 @@ build_allocator (tree type, tree init, tree result_type, Entity_Id gnat_proc,
   /* If the size overflows, pass -1 so the allocator will raise
      storage error.  */
   if (TREE_CODE (size) == INTEGER_CST && TREE_OVERFLOW (size))
-    size = build_int_cst (ssizetype, -1);
+    size = ssize_int (-1);
 
   /* If this is a type whose alignment is larger than the
      biggest we support in normal alignment and this is in
index ac5344eddc168f5f09eeb289aeaf74990921507d..b2e109dbc367602482b3141cdf5ff7f0ab7529e4 100644 (file)
@@ -1,3 +1,10 @@
+2004-08-27  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * class.c (build_vtbl_initializer): Use ssize_int.
+       * decl.c (complete_array_type): Likewise.
+       * method.c (finish_thunk): Likewise.
+       * search.c (get_dynamic_base_type): Likewise.
+
 2004-08-26  Richard Henderson  <rth@redhat.com>
 
        * cp-tree.h (DECL_FIELD_IS_BASE): New.
index d6115b4fb28eaa19d21f33f0206e5670e2868fcf..8785de75b7d90494e82d194f9e4ca9dcb23971dc 100644 (file)
@@ -7282,8 +7282,7 @@ build_vtbl_initializer (tree binfo,
   vid.ctor_vtbl_p = !same_type_p (BINFO_TYPE (rtti_binfo), t);
   vid.generate_vcall_entries = true;
   /* The first vbase or vcall offset is at index -3 in the vtable.  */
-  vid.index = build_int_cst (ssizetype,
-                            -3 * TARGET_VTABLE_DATA_ENTRY_DISTANCE);
+  vid.index = ssize_int(-3 * TARGET_VTABLE_DATA_ENTRY_DISTANCE);
 
   /* Add entries to the vtable for RTTI.  */
   build_rtti_vtbl_entries (binfo, &vid);
index dfb5681932481549af660833d956ba0c20a29596..a5c6309deed03961fe6f8ba33ce6c5647bb453e2 100644 (file)
@@ -5260,7 +5260,7 @@ complete_array_type (tree type, tree initial_value, int do_default)
        {
          tree elts = CONSTRUCTOR_ELTS (initial_value);
 
-         maxindex = build_int_cst (ssizetype, -1);
+         maxindex = ssize_int (-1);
          for (; elts; elts = TREE_CHAIN (elts))
            {
              if (TREE_PURPOSE (elts))
index 11107b1a077e7fd254ae3355b879ba9af585b255..13fe0a492aa4bec2af32ac69d2c230fe35519d0f 100644 (file)
@@ -179,7 +179,7 @@ void
 finish_thunk (tree thunk)
 {
   tree function, name;
-  tree fixed_offset = build_int_cst (ssizetype, THUNK_FIXED_OFFSET (thunk));
+  tree fixed_offset = ssize_int (THUNK_FIXED_OFFSET (thunk));
   tree virtual_offset = THUNK_VIRTUAL_OFFSET (thunk);
 
   my_friendly_assert (!DECL_NAME (thunk) && DECL_THUNK_P (thunk), 20021127);
index 4acd2d5a1cadc1c7e8a36727ea9932a71058cf93..c0342ad75de9c6fa3e1dde9f91c3af168c150670 100644 (file)
@@ -347,7 +347,7 @@ get_dynamic_cast_base_type (tree subtype, tree target)
   
   if (!boff)
     return offset;
-  offset = build_int_cst (ssizetype, boff);
+  offset = ssize_int (boff);
   return offset;
 }
 
index 1c8c401d3a0eb98020ab5fd8431b7cfedce6f66a..f728db60edc3fc815d4297651e86a7ed254b146e 100644 (file)
@@ -89,8 +89,6 @@ static tree negate_expr (tree);
 static tree split_tree (tree, enum tree_code, tree *, tree *, tree *, int);
 static tree associate_trees (tree, tree, enum tree_code, tree);
 static tree const_binop (enum tree_code, tree, tree, int);
-static hashval_t size_htab_hash (const void *);
-static int size_htab_eq (const void *, const void *);
 static tree fold_convert_const (enum tree_code, tree, tree);
 static enum tree_code invert_tree_comparison (enum tree_code, bool);
 static enum comparison_code comparison_to_compcode (enum tree_code);
@@ -1597,101 +1595,15 @@ const_binop (enum tree_code code, tree arg1, tree arg2, int notrunc)
   return 0;
 }
 
-/* These are the hash table functions for the hash table of INTEGER_CST
-   nodes of a sizetype.  */
-
-/* Return the hash code code X, an INTEGER_CST.  */
-
-static hashval_t
-size_htab_hash (const void *x)
-{
-  tree t = (tree) x;
-
-  return (TREE_INT_CST_HIGH (t) ^ TREE_INT_CST_LOW (t)
-         ^ htab_hash_pointer (TREE_TYPE (t))
-         ^ (TREE_OVERFLOW (t) << 20));
-}
-
-/* Return nonzero if the value represented by *X (an INTEGER_CST tree node)
-   is the same as that given by *Y, which is the same.  */
-
-static int
-size_htab_eq (const void *x, const void *y)
-{
-  tree xt = (tree) x;
-  tree yt = (tree) y;
-
-  return (TREE_INT_CST_HIGH (xt) == TREE_INT_CST_HIGH (yt)
-         && TREE_INT_CST_LOW (xt) == TREE_INT_CST_LOW (yt)
-         && TREE_TYPE (xt) == TREE_TYPE (yt)
-         && TREE_OVERFLOW (xt) == TREE_OVERFLOW (yt));
-}
-\f
-/* Return an INTEGER_CST with value whose low-order HOST_BITS_PER_WIDE_INT
-   bits are given by NUMBER and of the sizetype represented by KIND.  */
+/* Create a size type INT_CST node with NUMBER sign extended.  KIND
+   indicates which particular sizetype to create.  */
 
 tree
 size_int_kind (HOST_WIDE_INT number, enum size_type_kind kind)
 {
-  return size_int_type (number, sizetype_tab[(int) kind]);
+  return build_int_cst (sizetype_tab[(int) kind], number);
 }
-
-/* Likewise, but the desired type is specified explicitly.  */
-
-static GTY (()) tree new_const;
-static GTY ((if_marked ("ggc_marked_p"), param_is (union tree_node)))
-     htab_t size_htab;
-
-tree
-size_int_type (HOST_WIDE_INT number, tree type)
-{
-  void **slot;
-  unsigned int prec;
-  HOST_WIDE_INT high;
-  unsigned HOST_WIDE_INT low;
-
-  if (size_htab == 0)
-    {
-      size_htab = htab_create_ggc (1024, size_htab_hash, size_htab_eq, NULL);
-      new_const = make_node (INTEGER_CST);
-    }
-
-  /* Adjust NEW_CONST to be the constant we want.  If it's already in the
-     hash table, we return the value from the hash table.  Otherwise, we
-     place that in the hash table and make a new node for the next time.  */
-  prec = TYPE_PRECISION (type);
-  TREE_TYPE (new_const) = type;
-  TREE_OVERFLOW (new_const) = TREE_CONSTANT_OVERFLOW (new_const) = 0;
-  low = number;
-  if (number >= 0)
-    high = 0;
-  else
-    {
-      /* Sizetype IS sign extended.  */
-      high = -1;
-      if (prec <= HOST_BITS_PER_WIDE_INT)
-       low |= (HOST_WIDE_INT)(-1) << (prec - 1);
-    }
-  TREE_INT_CST_LOW (new_const) = low;
-  TREE_INT_CST_HIGH (new_const) = high;
-
-  if (low != (unsigned HOST_WIDE_INT)number
-      || high != (number < 0 ? -1 : 0))
-    TREE_OVERFLOW (new_const) = TREE_CONSTANT_OVERFLOW (new_const) = 1;
-  
-  slot = htab_find_slot (size_htab, new_const, INSERT);
-  if (*slot == 0)
-    {
-      tree t = new_const;
-
-      *slot = new_const;
-      new_const = make_node (INTEGER_CST);
-      return t;
-    }
-  else
-    return (tree) *slot;
-}
-
+\f
 /* Combine operands OP1 and OP2 with arithmetic operation CODE.  CODE
    is a tree code.  The type of the result is taken from the operands.
    Both must be the same type integer type and it must be a size type.
@@ -10649,7 +10561,7 @@ round_up (tree value, int divisor)
      doing it. */
   if (TREE_CODE (value) != INTEGER_CST)
     {
-      div = size_int_type (divisor, TREE_TYPE (value));
+      div = build_int_cst (TREE_TYPE (value), divisor);
 
       if (multiple_of_p (TREE_TYPE (value), value, div))
        return value;
@@ -10668,7 +10580,7 @@ round_up (tree value, int divisor)
   else
     {
       if (!div)
-       div = size_int_type (divisor, TREE_TYPE (value));
+       div = build_int_cst (TREE_TYPE (value), divisor);
       value = size_binop (CEIL_DIV_EXPR, value, div);
       value = size_binop (MULT_EXPR, value, div);
     }
@@ -10688,15 +10600,13 @@ round_down (tree value, int divisor)
   if (divisor == 1)
     return value;
 
-  div = size_int_type (divisor, TREE_TYPE (value));
-
   /* See if VALUE is already a multiple of DIVISOR.  If so, we don't
      have to do anything.  Only do this when we are not given a const,
      because in that case, this check is more expensive than just
      doing it. */
   if (TREE_CODE (value) != INTEGER_CST)
     {
-      div = size_int_type (divisor, TREE_TYPE (value));
+      div = build_int_cst (TREE_TYPE (value), divisor);
 
       if (multiple_of_p (TREE_TYPE (value), value, div))
        return value;
@@ -10713,11 +10623,10 @@ round_down (tree value, int divisor)
   else
     {
       if (!div)
-       div = size_int_type (divisor, TREE_TYPE (value));
+       div = build_int_cst (TREE_TYPE (value), divisor);
       value = size_binop (FLOOR_DIV_EXPR, value, div);
       value = size_binop (MULT_EXPR, value, div);
     }
 
   return value;
 }
-#include "gt-fold-const.h"
index bc0b1418e66728a9e4bacaa29fafc939522a9d15..59905a47b87480a1ae4ed267ba188401abd45339 100644 (file)
@@ -3091,10 +3091,9 @@ extern GTY(()) tree sizetype_tab[(int) TYPE_KIND_LAST];
 #define ssizetype sizetype_tab[(int) SSIZETYPE]
 #define sbitsizetype sizetype_tab[(int) SBITSIZETYPE]
 
+extern tree size_int_kind (HOST_WIDE_INT, enum size_type_kind);
 extern tree size_binop (enum tree_code, tree, tree);
 extern tree size_diffop (tree, tree);
-extern tree size_int_kind (HOST_WIDE_INT, enum size_type_kind);
-extern tree size_int_type (HOST_WIDE_INT, tree);
 
 #define size_int(L) size_int_kind (L, SIZETYPE)
 #define ssize_int(L) size_int_kind (L, SSIZETYPE)
This page took 0.136419 seconds and 5 git commands to generate.