OSDN Git Service

* double-int.h (tree_to_double_int): Remove macro.
authoraesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 May 2010 16:21:15 +0000 (16:21 +0000)
committerMasaki Muranaka <monaka@monami-software.com>
Sun, 23 May 2010 05:37:53 +0000 (14:37 +0900)
(double_int_to_tree, double_int_fits_to_tree_p): Move prototypes ...
* tree.h (double_int_to_tree, double_int_fits_to_tree_p): ... here.
(tree_to_double_int): New function.
* double-int.c (double_int_to_tree, double_int_fits_to_tree_p):
Move ...
* tree.c (double_int_to_tree, double_int_fits_to_tree_p): ... here.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158993 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/double-int.c
gcc/double-int.h
gcc/tree.c
gcc/tree.h

index e461f4b..485dfbe 100644 (file)
@@ -1,3 +1,13 @@
+2010-05-03  Anatoly Sokolov  <aesok@post.ru>
+
+       * double-int.h (tree_to_double_int): Remove macro.
+       (double_int_to_tree, double_int_fits_to_tree_p): Move prototypes ...
+       * tree.h (double_int_to_tree, double_int_fits_to_tree_p): ... here.
+       (tree_to_double_int): New function.
+       * double-int.c (double_int_to_tree, double_int_fits_to_tree_p):
+       Move ...
+       * tree.c (double_int_to_tree, double_int_fits_to_tree_p): ... here.
+
 2010-05-03  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/43971
 2010-05-03  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/43971
index d8b596e..000be2b 100644 (file)
@@ -1049,32 +1049,6 @@ double_int_rshift (double_int a, HOST_WIDE_INT count, unsigned int prec, bool ar
   return ret;
 }
 
   return ret;
 }
 
-/* Constructs tree in type TYPE from with value given by CST.  Signedness of CST
-   is assumed to be the same as the signedness of TYPE.  */
-
-tree
-double_int_to_tree (tree type, double_int cst)
-{
-  if (bitpos < HOST_BITS_PER_WIDE_INT)
-    a.low |= (unsigned HOST_WIDE_INT) 1 << bitpos;
-  else
-    a.high |= (HOST_WIDE_INT) 1 <<  (bitpos - HOST_BITS_PER_WIDE_INT);
-  return a;
-}
-
-/* Shift A left by COUNT places keeping only PREC bits of result.  Shift
-   right if COUNT is negative.  ARITH true specifies arithmetic shifting;
-   otherwise use logical shift.  */
-
-double_int
-double_int_lshift (double_int a, HOST_WIDE_INT count, unsigned int prec, bool arith)
-{
-  double_int ret;
-  lshift_double (a.low, a.high, count, prec, &ret.low, &ret.high, arith);
-  return ret;
-}
-
 /* Returns -1 if A < B, 0 if A == B and 1 if A > B.  Signedness of the
    comparison is given by UNS.  */
 
 /* Returns -1 if A < B, 0 if A == B and 1 if A > B.  Signedness of the
    comparison is given by UNS.  */
 
index 47991ca..65d25ef 100644 (file)
@@ -61,13 +61,6 @@ typedef struct
 
 /* Constructors and conversions.  */
 
 
 /* Constructors and conversions.  */
 
-tree double_int_to_tree (tree, double_int);
-bool double_int_fits_to_tree_p (const_tree, double_int);
-
-/* Constructs double_int from tree CST.  */
-
-#define tree_to_double_int(cst) (TREE_INT_CST (cst))
-
 /* Constructs double_int from integer CST.  The bits over the precision of
    HOST_WIDE_INT are filled with the sign bit.  */
 
 /* Constructs double_int from integer CST.  The bits over the precision of
    HOST_WIDE_INT are filled with the sign bit.  */
 
index 24482af..b8f80de 100644 (file)
@@ -1082,6 +1082,30 @@ build_int_cst_wide_type (tree type,
   return build_int_cst_wide (type, low, high);
 }
 
   return build_int_cst_wide (type, low, high);
 }
 
+/* Constructs tree in type TYPE from with value given by CST.  Signedness
+   of CST is assumed to be the same as the signedness of TYPE.  */
+
+tree
+double_int_to_tree (tree type, double_int cst)
+{
+  cst = double_int_ext (cst, TYPE_PRECISION (type), TYPE_UNSIGNED (type));
+
+  return build_int_cst_wide (type, cst.low, cst.high);
+}
+
+/* Returns true if CST fits into range of TYPE.  Signedness of CST is assumed
+   to be the same as the signedness of TYPE.  */
+
+bool
+double_int_fits_to_tree_p (const_tree type, double_int cst)
+{
+  double_int ext = double_int_ext (cst,
+                                  TYPE_PRECISION (type),
+                                  TYPE_UNSIGNED (type));
+
+  return double_int_equal_p (cst, ext);
+}
+
 /* These are the hash table functions for the hash table of INTEGER_CST
    nodes of a sizetype.  */
 
 /* These are the hash table functions for the hash table of INTEGER_CST
    nodes of a sizetype.  */
 
index 0cfdcad..0a16c0d 100644 (file)
@@ -3998,6 +3998,17 @@ extern tree build_var_debug_value_stat (tree, tree MEM_STAT_DECL);
 #define build_var_debug_value(t1,t2) \
   build_var_debug_value_stat (t1,t2 MEM_STAT_INFO)
 
 #define build_var_debug_value(t1,t2) \
   build_var_debug_value_stat (t1,t2 MEM_STAT_INFO)
 
+/* Constructs double_int from tree CST.  */
+
+static inline double_int
+tree_to_double_int (const_tree cst)
+{
+  return TREE_INT_CST (cst);
+}
+
+extern tree double_int_to_tree (tree, double_int);
+extern bool double_int_fits_to_tree_p (const_tree, double_int);
+
 extern tree build_int_cst (tree, HOST_WIDE_INT);
 extern tree build_int_cst_type (tree, HOST_WIDE_INT);
 extern tree build_int_cstu (tree, unsigned HOST_WIDE_INT);
 extern tree build_int_cst (tree, HOST_WIDE_INT);
 extern tree build_int_cst_type (tree, HOST_WIDE_INT);
 extern tree build_int_cstu (tree, unsigned HOST_WIDE_INT);