]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
expmed.c (ceil_log2): Move from here...
authorSteven Bosscher <steven@gcc.gnu.org>
Sun, 17 Jun 2012 21:01:25 +0000 (21:01 +0000)
committerSteven Bosscher <steven@gcc.gnu.org>
Sun, 17 Jun 2012 21:01:25 +0000 (21:01 +0000)
* expmed.c (ceil_log2): Move from here...
* hwint.c: ... to here for older GCCs...
* hwint.h: ... and here for newer GCCs.
* rtl.h (ceil_log2): Remove prototype.

* tree-phinodes.c: Do not include rtl.h.
* Makefile.in (tree-phinodes.o): Do not depend on RTL_H.

From-SVN: r188710

gcc/ChangeLog
gcc/Makefile.in
gcc/expmed.c
gcc/hwint.c
gcc/hwint.h
gcc/rtl.h
gcc/tree-phinodes.c

index d1ce2271b60269dc661c4fab2c780791d69f412d..32080f2233c12bd046da85f15750b46da6346689 100644 (file)
@@ -1,3 +1,13 @@
+2012-06-17  Steven Bosscher  <steven@gcc.gnu.org>
+
+       * expmed.c (ceil_log2): Move from here...
+       * hwint.c: ... to here for older GCCs...
+       * hwint.h: ... and here for newer GCCs.
+       * rtl.h (ceil_log2): Remove prototype.
+
+       * tree-phinodes.c: Do not include rtl.h.
+       * Makefile.in (tree-phinodes.o): Do not depend on RTL_H.
+
 2012-06-17  Steven Bosscher  <steven@gcc.gnu.org>
 
        * config/cris/cris.h (TARGET_ELF): Remove.
index a404a5f3e416d6e579485eac295dd2dd7a289cae..32190ec90f120edf4c84e60253203f711552ec02 100644 (file)
@@ -2410,7 +2410,7 @@ tree-ssanames.o : tree-ssanames.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
    $(TM_H) $(TREE_H) $(TREE_FLOW_H) $(TREE_PASS_H)
 tree-phinodes.o : tree-phinodes.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
    $(TM_H) $(TREE_H) $(GGC_H) $(BASIC_BLOCK_H) $(TREE_FLOW_H) \
-   gt-tree-phinodes.h $(RTL_H) $(DIAGNOSTIC_CORE_H)  $(GIMPLE_H)
+   gt-tree-phinodes.h $(DIAGNOSTIC_CORE_H) $(GIMPLE_H)
 domwalk.o : domwalk.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(BASIC_BLOCK_H) domwalk.h sbitmap.h
 tree-ssa-live.o : tree-ssa-live.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
index b456bac177c71fbd3f2b8fa534bf6e7f563c5cdc..9f5f6a207aec98870e652ce6b85d465732556394 100644 (file)
@@ -3267,14 +3267,6 @@ expand_widening_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target,
                       unsignedp, OPTAB_LIB_WIDEN);
 }
 \f
-/* Return the smallest n such that 2**n >= X.  */
-
-int
-ceil_log2 (unsigned HOST_WIDE_INT x)
-{
-  return floor_log2 (x - 1) + 1;
-}
-
 /* Choose a minimal N + 1 bit approximation to 1/D that can be used to
    replace division by D, and put the least significant N bits of the result
    in *MULTIPLIER_PTR and return the most significant bit.
index 533133c7b4db10dabf47f60593538a56753716b7..bfc5e3dedcdd84200ae4b5a29c99b3aecc4ee684 100644 (file)
@@ -25,10 +25,11 @@ along with GCC; see the file COPYING3.  If not see
 
 #if GCC_VERSION < 3004
 
-/* The functions clz_hwi, ctz_hwi, ffs_hwi, floor_log2 and exact_log2
-   are defined as inline functions in hwint.h if GCC_VERSION >= 3004.
-   The definitions here are used for older versions of GCC and non-GCC
-   bootstrap compilers.  */
+/* The functions clz_hwi, ctz_hwi, ffs_hwi, floor_log2, ceil_log2,
+   and exact_log2 are defined as inline functions in hwint.h
+   if GCC_VERSION >= 3004.
+   The definitions here are used for older versions of GCC and
+   non-GCC bootstrap compilers.  */
 
 /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
    If X is 0, return -1.  */
@@ -61,6 +62,14 @@ floor_log2 (unsigned HOST_WIDE_INT x)
   return t;
 }
 
+/* Given X, an unsigned number, return the largest Y such that 2**Y >= X.  */
+
+int
+ceil_log2 (unsigned HOST_WIDE_INT x)
+{
+  return floor_log2 (x - 1) + 1;
+}
+
 /* Return the logarithm of X, base 2, considering X unsigned,
    if X is a power of 2.  Otherwise, returns -1.  */
 
index 17346392f91bd7dc25c7180fd10b136770b8bcc2..00c9538fb112a2cb0784aef36b48ea34c702d055 100644 (file)
@@ -185,6 +185,9 @@ extern int exact_log2                  (unsigned HOST_WIDE_INT);
 /* Return floor of log2, with -1 for zero.  */
 extern int floor_log2                  (unsigned HOST_WIDE_INT);
 
+/* Return the smallest n such that 2**n >= X.  */
+extern int ceil_log2                   (unsigned HOST_WIDE_INT);
+
 #else /* GCC_VERSION >= 3004 */
 
 /* For convenience, define 0 -> word_size.  */
@@ -234,6 +237,12 @@ floor_log2 (unsigned HOST_WIDE_INT x)
   return HOST_BITS_PER_WIDE_INT - 1 - clz_hwi (x);
 }
 
+static inline int
+ceil_log2 (unsigned HOST_WIDE_INT x)
+{
+  return floor_log2 (x - 1) + 1;
+}
+
 static inline int
 exact_log2 (unsigned HOST_WIDE_INT x)
 {
index 1d71971335a0d2f75510a1671a96baeb092508dd..f9864cb48479cbeb8bb072a5313a5dda479a0969 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1638,9 +1638,6 @@ extern int currently_expanding_to_rtl;
 
 /* Generally useful functions.  */
 
-/* In expmed.c */
-extern int ceil_log2 (unsigned HOST_WIDE_INT);
-
 /* In explow.c */
 extern HOST_WIDE_INT trunc_int_for_mode        (HOST_WIDE_INT, enum machine_mode);
 extern rtx plus_constant (enum machine_mode, rtx, HOST_WIDE_INT);
index bd0bde399e168260fcac898b4af83855b1cc62c0..6408a52529806c8f9bb7b1d8ca58f09602e34ed5 100644 (file)
@@ -23,7 +23,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
-#include "rtl.h"       /* FIXME: Only for ceil_log2, of all things...  */
 #include "ggc.h"
 #include "basic-block.h"
 #include "tree-flow.h"