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]

Move double_int_to_tree, double_int_fits_to_tree_p and tree_to_double_int from double-int.[ch] to tree.[ch]


Hi.

  This patch move double_int_to_tree, double_int_fits_to_tree_p and
tree_to_double_int from double-int.[ch] to tree.[ch]. This should allow
remove dependency double-int.[ch] from the tree.h in future.

        * 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.

 Bootstrapped/regtested on x86_64-unknown-linux-gnu.

 Index: gcc/tree.c
===================================================================
--- gcc/tree.c  (revision 158979)
+++ gcc/tree.c  (working copy)
@@ -1082,6 +1082,30 @@
   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.  */
 
Index: gcc/tree.h
===================================================================
--- gcc/tree.h  (revision 158979)
+++ gcc/tree.h  (working copy)
@@ -3998,6 +3998,17 @@
 #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);
Index: gcc/double-int.c
===================================================================
--- gcc/double-int.c    (revision 158979)
+++ gcc/double-int.c    (working copy)
@@ -1049,30 +1049,6 @@
   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)
-{
-  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);
-}
-
 /* Returns -1 if A < B, 0 if A == B and 1 if A > B.  Signedness of the
    comparison is given by UNS.  */
 
Index: gcc/double-int.h
===================================================================
--- gcc/double-int.h    (revision 158979)
+++ gcc/double-int.h    (working copy)
@@ -61,13 +61,6 @@
 
 /* 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.  */
 


Anatoly.


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