This code has no license restrictions, and is considered public
domain.
- Changes copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
- Inc.
+ Changes copyright (C) 2005, 2006, 2007, 2008, 2009,
+ 2010 Free Software Foundation, Inc.
Contributed by Sebastian Pop <sebastian.pop@inria.fr>
This file is part of GCC.
#include "config.h"
#include "system.h"
#include "coretypes.h"
-#include "tm.h"
-#include "ggc.h"
#include "tree.h"
-#include "diagnostic.h"
+#include "diagnostic-core.h"
#include "tree-pass.h"
#include "omega.h"
return a - b * int_div (a, b);
}
-/* For X and Y positive integers, return X multiplied by Y and check
- that the result does not overflow. */
-
-static inline int
-check_pos_mul (int x, int y)
-{
- if (x != 0)
- gcc_assert ((INT_MAX) / x > y);
-
- return x * y;
-}
-
-/* Return X multiplied by Y and check that the result does not
- overflow. */
-
-static inline int
-check_mul (int x, int y)
-{
- if (x >= 0)
- {
- if (y >= 0)
- return check_pos_mul (x, y);
- else
- return -check_pos_mul (x, -y);
- }
- else if (y >= 0)
- return -check_pos_mul (-x, y);
- else
- return check_pos_mul (-x, -y);
-}
-
/* Test whether equation E is red. */
static inline bool
void (*omega_when_reduced) (omega_pb) = omega_no_procedure;
-/* Compute the greatest common divisor of A and B. */
-
-static inline int
-gcd (int b, int a)
-{
- if (b == 1)
- return 1;
-
- while (b != 0)
- {
- int t = b;
- b = a % b;
- a = t;
- }
-
- return a;
-}
-
/* Print to FILE from PB equation E with all its coefficients
multiplied by C. */
/* Debug problem PB. */
-void
+DEBUG_FUNCTION void
debug_omega_problem (omega_pb pb)
{
omega_print_problem (stderr, pb);
|| pb->geqs[e3].color == omega_red)
goto nextE3;
- alpha3 = alpha3;
/* verify alpha1*v1+alpha2*v2 = alpha3*v3 */
for (k = pb->num_vars; k >= 1; k--)
if (alpha3 * pb->geqs[e3].coef[k]
max_splinters += -minC - 1;
else
max_splinters +=
- check_pos_mul ((pb->geqs[e].coef[i] - 1),
- (-minC - 1)) / (-minC) + 1;
+ pos_mul_hwi ((pb->geqs[e].coef[i] - 1),
+ (-minC - 1)) / (-minC) + 1;
}
/* #ifdef Omega3 */
for (k = 0; k <= n_vars; k++)
pb->geqs[Ue].coef[k] =
- check_mul (pb->geqs[Ue].coef[k], Lc) +
- check_mul (lbeqn->coef[k], Uc);
+ mul_hwi (pb->geqs[Ue].coef[k], Lc) +
+ mul_hwi (lbeqn->coef[k], Uc);
if (dump_file && (dump_flags & TDF_DETAILS))
{
for (k = n_vars; k >= 0; k--)
pb->geqs[e2].coef[k] =
- check_mul (pb->geqs[Ue].coef[k], Lc) +
- check_mul (pb->geqs[Le].coef[k], Uc);
+ mul_hwi (pb->geqs[Ue].coef[k], Lc) +
+ mul_hwi (pb->geqs[Le].coef[k], Uc);
pb->geqs[e2].coef[n_vars + 1] = 0;
pb->geqs[e2].touched = 1;
{
for (k = n_vars; k >= 0; k--)
iS->geqs[e2].coef[k] = rS->geqs[e2].coef[k] =
- check_mul (pb->geqs[Ue].coef[k], Lc) +
- check_mul (pb->geqs[Le].coef[k], Uc);
+ mul_hwi (pb->geqs[Ue].coef[k], Lc) +
+ mul_hwi (pb->geqs[Le].coef[k], Uc);
iS->geqs[e2].coef[0] -= (Uc - 1) * (Lc - 1);
}