Commit 46d33ae9 by Steven Bosscher

expmed.c (ceil_log2): Move from here...

	* 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
parent 0df965d7
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.
(FORCE_EH_FRAME_INFO_IN_DATA_SECTION): Remove.
(CRIS_ASM_OUTPUT_ALIGNED_DECL_COMMON): Simpify using TARGET_ELF==1.
......
......@@ -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) \
......
......@@ -3267,14 +3267,6 @@ expand_widening_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target,
unsignedp, OPTAB_LIB_WIDEN);
}
/* 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.
......
......@@ -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. */
......
......@@ -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. */
......@@ -235,6 +238,12 @@ floor_log2 (unsigned HOST_WIDE_INT 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)
{
return x == (x & -x) && x ? ctz_hwi (x) : -1;
......
......@@ -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);
......
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment