Exemplo n.º 1
0
enum ev_direction
scev_direction (const_tree chrec)
{
  const_tree step;

  if (!evolution_function_is_affine_p (chrec))
    return EV_DIR_UNKNOWN;

  step = CHREC_RIGHT (chrec);
  if (TREE_CODE (step) != INTEGER_CST)
    return EV_DIR_UNKNOWN;

  if (tree_int_cst_sign_bit (step))
    return EV_DIR_DECREASES;
  else
    return EV_DIR_GROWS;
}
Exemplo n.º 2
0
/* Return 1 if we may prove ADDR has a constant value with
   determined sign, which is put into *SIGN.  Otherwise
   return 0.  */
static bool
chkp_is_constant_addr (const address_t &addr, int *sign)
{
    *sign = 0;

    if (addr.pol.length () == 0)
        return true;
    else if (addr.pol.length () > 1)
        return false;
    else if (addr.pol[0].var)
        return false;
    else if (integer_zerop (addr.pol[0].cst))
        *sign = 0;
    else if  (tree_int_cst_sign_bit (addr.pol[0].cst))
        *sign = -1;
    else
        *sign = 1;

    return true;
}