Bernd Schmidt - Move function determine_max_iter (original) (raw)
This is the mail archive of the gcc-patches@gcc.gnu.orgmailing 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] |
- From: Bernd Schmidt <bernds_cb1 at t-online dot de>
- To: GCC Patches
- Date: Fri, 23 Feb 2007 19:05:32 +0100
- Subject: Move function determine_max_iter
This patch just moves the function determine_max_iter in front of its sole user. No functional changes - these will be added in a followup patch. The move is necessary to be able to use functions defined earlier in this file.Bootstrapped on i686-linux and committed as 122264.
Bernd
This footer brought to you by insane German lawmakers. Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen Registergericht Muenchen HRB 40368 Geschaeftsfuehrer Thomas Wessel, Vincent Roche, Joseph E. McDonough
Index: ChangeLog
--- ChangeLog (revision 122262) +++ ChangeLog (working copy) @@ -3,6 +3,8 @@ * config/bfin/bfin.md (doloop_end): Fail for loops that can iterate 2^32-1 or more times unless flag_unsafe_loop_optimizations. + * loop-iv.c (determine_max_iter): Moved in front of its sole user. + 2007-02-23 Kaveh R. Ghazi ghazi@caip.rutgers.edu * builtins.c (fold_builtin_logb, fold_builtin_significand): New. Index: loop-iv.c
--- loop-iv.c (revision 122255) +++ loop-iv.c (working copy) @@ -1261,71 +1261,6 @@ inverse (unsigned HOST_WIDEST_INT x, int return rslt; } -/* Tries to estimate the maximum number of iterations. */
-static unsigned HOST_WIDEST_INT -determine_max_iter (struct niter_desc *desc) -{ - rtx niter = desc->niter_expr; - rtx mmin, mmax, left, right; - unsigned HOST_WIDEST_INT nmax, inc;
if (GET_CODE (niter) == AND
&& GET_CODE (XEXP (niter, 0)) == CONST_INT)
{
nmax = INTVAL (XEXP (niter, 0));
if (!(nmax & (nmax + 1)))
{
desc->niter_max = nmax;
return nmax;
}
}
get_mode_bounds (desc->mode, desc->signed_p, desc->mode, &mmin, &mmax);
nmax = INTVAL (mmax) - INTVAL (mmin);
if (GET_CODE (niter) == UDIV)
{
if (GET_CODE (XEXP (niter, 1)) != CONST_INT)
{
desc->niter_max = nmax;
return nmax;
}
inc = INTVAL (XEXP (niter, 1));
niter = XEXP (niter, 0);
}
else
inc = 1;
if (GET_CODE (niter) == PLUS)
{
left = XEXP (niter, 0);
right = XEXP (niter, 0);
if (GET_CODE (right) == CONST_INT)
right = GEN_INT (-INTVAL (right));
}
else if (GET_CODE (niter) == MINUS)
{
left = XEXP (niter, 0);
right = XEXP (niter, 0);
}
else
{
left = niter;
right = mmin;
}
if (GET_CODE (left) == CONST_INT)
mmax = left;
if (GET_CODE (right) == CONST_INT)
mmin = right;
nmax = INTVAL (mmax) - INTVAL (mmin);
desc->niter_max = nmax / inc;
return nmax / inc; -}
/* Checks whether register *REG is in set ALT. Callback for for_each_rtx. */
static int
@@ -1981,6 +1916,71 @@ canonicalize_iv_subregs (struct rtx_iv * return true; }
+/* Tries to estimate the maximum number of iterations. */ + +static unsigned HOST_WIDEST_INT +determine_max_iter (struct niter_desc *desc) +{
- rtx niter = desc->niter_expr;
- rtx mmin, mmax, left, right;
- unsigned HOST_WIDEST_INT nmax, inc;
- if (GET_CODE (niter) == AND
&& GET_CODE (XEXP (niter, 0)) == CONST_INT)
- {
nmax = INTVAL (XEXP (niter, 0));
if (!(nmax & (nmax + 1)))
- {
desc->niter_max = nmax;
return nmax;
- }
- }
- get_mode_bounds (desc->mode, desc->signed_p, desc->mode, &mmin, &mmax);
- nmax = INTVAL (mmax) - INTVAL (mmin);
- if (GET_CODE (niter) == UDIV)
- {
if (GET_CODE (XEXP (niter, 1)) != CONST_INT)
- {
desc->niter_max = nmax;
return nmax;
- }
inc = INTVAL (XEXP (niter, 1));
niter = XEXP (niter, 0);
- }
- else
- inc = 1;
- if (GET_CODE (niter) == PLUS)
- {
left = XEXP (niter, 0);
right = XEXP (niter, 0);
if (GET_CODE (right) == CONST_INT)
- right = GEN_INT (-INTVAL (right));
- }
- else if (GET_CODE (niter) == MINUS)
- {
left = XEXP (niter, 0);
right = XEXP (niter, 0);
- }
- else
- {
left = niter;
right = mmin;
- }
- if (GET_CODE (left) == CONST_INT)
- mmax = left;
- if (GET_CODE (right) == CONST_INT)
- mmin = right;
- nmax = INTVAL (mmax) - INTVAL (mmin);
- desc->niter_max = nmax / inc;
- return nmax / inc; +}
- /* Computes number of iterations of the CONDITION in INSN in LOOP and stores the result into DESC. Very similar to determine_number_of_iterations (basically its rtl version), complicated by things like subregs. */
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |