Commit e7c5ccf2 authored by Matthias Braun's avatar Matthias Braun
Browse files

remove unused ir_value_classify_sign()

parent 40f7487a
......@@ -333,16 +333,6 @@ typedef enum ir_builtin_kind {
ir_bk_last = ir_bk_compare_swap,
} ir_builtin_kind;
/**
* Possible return values of value_classify().
*/
typedef enum ir_value_classify_sign {
value_classified_unknown = 0, /**< could not classify */
value_classified_positive = 1, /**< value is positive, i.e. >= 0 */
value_classified_negative = -1 /**< value is negative, i.e. <= 0 if
no signed zero exists or < 0 else */
} ir_value_classify_sign;
/**
* This enumeration flags the volatility of entities and Loads/Stores.
*/
......
......@@ -606,15 +606,6 @@ FIRM_API int value_not_zero(const ir_node *n, const ir_node **confirm);
*/
FIRM_API int value_not_null(const ir_node *n, const ir_node **confirm);
/**
* Checks if the value of a node can be confirmed >= 0 or <= 0,
* If the mode of the value did not honor signed zeros, else
* check for >= 0 or < 0.
*
* @param n a node representing the value
*/
FIRM_API ir_value_classify_sign classify_value_sign(ir_node *n);
/**
* Returns the value of a Cmp if one or both predecessors are Confirm nodes.
*
......
......@@ -206,121 +206,6 @@ int value_not_null(const ir_node *n, const ir_node **confirm)
return 0;
}
#ifdef __cplusplus
extern "C++" {
static inline ir_value_classify_sign operator *(ir_value_classify_sign sign, int mul) {
return (ir_value_classify_sign) (sign*mul);
}
}
#endif
/*
* Check, if the value of a node can be confirmed >= 0 or <= 0,
* If the mode of the value did not honor signed zeros, else
* check for >= 0 or < 0.
*/
ir_value_classify_sign classify_value_sign(ir_node *n)
{
ir_tarval *tv, *c;
ir_mode *mode;
ir_relation cmp, ncmp;
int negate = 1;
for (;;) {
unsigned code = get_irn_opcode(n);
switch (code) {
case iro_Minus:
negate *= -1;
n = get_Minus_op(n);
continue;
case iro_Confirm:
break;
default:
return value_classified_unknown;
}
break;
}
if (!is_Confirm(n))
return value_classified_unknown;
tv = value_of(get_Confirm_bound(n));
if (tv == tarval_bad)
return value_classified_unknown;
mode = get_irn_mode(n);
/*
* We can handle only >=, >, <, <= cases.
* We could handle == too, but this will be optimized into
* a constant either.
*
* Note that for integer modes we have a slightly better
* optimization possibilities, so we handle this
* different.
*/
cmp = get_Confirm_relation(n);
switch (cmp) {
case ir_relation_less:
/*
* must be x < c <= 1 to be useful if integer mode and -0 = 0
* x < c <= 0 to be useful else
*/
case ir_relation_less_equal:
/*
* must be x <= c < 1 to be useful if integer mode and -0 = 0
* x <= c < 0 to be useful else
*/
c = mode_is_int(mode) && mode_honor_signed_zeros(mode) ?
get_mode_one(mode) : get_mode_null(mode);
ncmp = tarval_cmp(tv, c);
if (ncmp == ir_relation_equal)
ncmp = ir_relation_less_equal;
if (cmp != (ncmp ^ ir_relation_equal))
return value_classified_unknown;
/* yep, negative */
return value_classified_negative * negate;
case ir_relation_greater_equal:
/*
* must be x >= c > -1 to be useful if integer mode
* x >= c >= 0 to be useful else
*/
case ir_relation_greater:
/*
* must be x > c >= -1 to be useful if integer mode
* x > c >= 0 to be useful else
*/
if (mode_is_int(mode)) {
c = get_mode_minus_one(mode);
ncmp = tarval_cmp(tv, c);
if (ncmp == ir_relation_equal)
ncmp = ir_relation_greater_equal;
if (cmp != (ncmp ^ ir_relation_equal))
return value_classified_unknown;
} else {
c = get_mode_minus_one(mode);
ncmp = tarval_cmp(tv, c);
if (ncmp != ir_relation_equal && ncmp != ir_relation_greater)
return value_classified_unknown;
}
/* yep, positive */
return value_classified_positive * negate;
default:
return value_classified_unknown;
}
}
/**
* construct an interval from a value
*
......
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