range_util.h File Reference
Go to the source code of this file.
|
Enumerations |
| enum | RANGE_HANDLING {
TAKE_RANGE_MIN,
TAKE_RANGE_MAX,
KEEP_WHOLE_RANGE
} |
Functions |
| class Relation | compare (const Expression &expr1, RangeComparator &comparator1, const Expression &expr2, RangeComparator &comparator2) |
| | Description Extract and return all possible ranges from the given logical expression.
|
| Map< Symbol, Set< Expression > > * | extract_ranges (const Expression &expr, bool complement_expr=False) |
| | Description: Return the intersection of the two ranges.
|
| Expression * | intersect_ranges (const Expression *range1_ref, RangeComparator &comparator1, const Expression *range2_ref, RangeComparator &comparator2) |
| | Description: Return the union of the two ranges.
|
| Expression * | union_ranges (const Expression *range1_ref, RangeComparator &comparator1, const Expression *range2_ref, RangeComparator &comparator2) |
| | Description: Perform a widening operator on the given expression and return the result.
|
| Expression * | widen_range (const Expression *expr_ref, const Expression *widener_ref, RangeComparator &comparator) |
| | Description: Perform a narrowing operator on the given expression and return the result.
|
| Expression * | narrow_range (const Expression *expr_ref, const Expression *narrower_ref, RangeComparator &comparator) |
| | Description: Create a new MIN intrinsic with the given arguments.
|
| Expression * | min_expr (Expression *e1, Expression *e2, const Symtab &symtab) |
| | Description: Create a new MAX intrinsic with the given arguments.
|
| Expression * | max_expr (Expression *e1, Expression *e2, const Symtab &symtab) |
| | Description: Return true if the given expression is a MIN intrinsic.
|
| bool | is_min (const Expression &e) |
| | Description: Return true if the given expression is a MAX intrinsic.
|
| bool | is_max (const Expression &e) |
| | Description: Return true if the given expression is a MOD intrinsic.
|
| bool | is_mod (const Expression &e) |
| | Description: Return true if the given expression is a ABS intrinsic.
|
| bool | is_abs (const Expression &e) |
| | Description: Return true if the given expression is a MIN or MAX intrinsic.
|
| bool | is_min_or_max (const Expression &e) |
| | Description: Return true if the given expression contains a MIN or MAX intrinsic.
|
| bool | contains_min_or_max (const Expression &e) |
| | Description: Change a MIN intrinsic into a MAX intrinsic or vice_versa.
|
| void | swap_min_max (Expression &e, const Symtab &symtab) |
| | Description: Convert any ABS expressions in the given expression to MAX expressions.
|
| Expression * | abs_to_max (Expression *e, const Symtab &symtab) |
| | Description: Eliminate all terms of MIN or MAX subexpressions of the given expression which can be proved to never be the minimum or maximum value respectively.
|
| Expression * | remove_redundant_min_max_terms (Expression *expr, RangeComparator &comparator) |
| | Description: Create a new MOD intrinsic with the given arguments.
|
| Expression * | mod_expr (Expression *e1, Expression *e2, Symtab &symtab) |
| | Description: Print the given range expression as an (in)equality for the given variable.
|
| void | pretty_print_range (ostream &o, const Expression &expr, const Symbol &var) |
| | Routines for simplifying expressions containing RangeExprs.
|
| Expression * | pull_ranges_out (Expression *e, RangeComparator &comparator, RANGE_HANDLING range_handling=KEEP_WHOLE_RANGE) |
| | Description: Pull all MIN or MAX intrinsics to the top levels of the expression.
|
| Expression * | pull_min_max_out (Expression *e, RangeComparator &comparator) |
| | pull_min_max_out Pull all MIN or MAX intrinsics to the top levels of the expression.
|
| Expression * | elim_known_facts (Expression *e, RangeComparator &comparator) |
| | elim_known_facts
|
| void | copy_expr_ranges (Expression &expr, RangeAccessor &r_acc, StmtRanges &ranges) |
| void | apply_limits (Expression &expr, Expression *lower, Expression *upper, StmtRanges &ranges, RefSet< Symbol > &set) |
| | This routine checks expr for containing exactly one variable, and if it does, applies the [lower:upper] range to it.
|
| void | set_ranges_for_symbol (Expression &expr, const Symbol &sym, StmtRanges &ranges) |
| | This routine extracts ranges for a particular symbol from an expression and sets them in the given StmtRanges object.
|
| void | tighten_lower_bound (Expression &expr, const Expression *lower, StmtRanges &ranges, RefSet< Symbol > &set) |
| void | tighten_upper_bound (Expression &expr, const Expression *upper, StmtRanges &ranges, RefSet< Symbol > &set) |
Enumeration Type Documentation
|
|
- Enumeration values:
-
| TAKE_RANGE_MIN |
|
| TAKE_RANGE_MAX |
|
| KEEP_WHOLE_RANGE |
|
Definition at line 202 of file range_util.h. |
Function Documentation
|
|
Description Extract and return all possible ranges from the given logical expression.
Expression 1 is less than expression 2 if it is indicated to be less than by both range comparaters. Other relations are computed similarly.
The given expression must be a logical expression (i.e. made up of relation and .AND., .OR., and .NOT. operators) or it will be ignored. If complement_expr is true, this method will extract the ranges from the complement of this expression.
Definition at line 2400 of file range_util.cc.
References Relation::is_unknown().
Referenced by intersect_ranges(), and union_ranges(). |
|
|
Description: Return the intersection of the two ranges.
That is, return the range whose lower bound is the larger of the lower bounds of the two given ranges, and whose upper bound is the smaller of the upper bounds of the two given ranges. If one of the given ranges is NULL, then that range is assumed to be [-Infinity:Infinity]. Similarly, if the resulting range is the [-Infinity:Infinity], the function returns NULL. |
|
|
Description: Return the union of the two ranges.
... New range has one element.
... New range has no elements.
Definition at line 2165 of file range_util.cc.
References _join_ranges(), _pull_out_common_min_max(), Expression::clone(), Expression::compare(), compare(), constant(), convert_to_range(), expr_expand_substituted(), RangeExpr::grab_lb(), RangeExpr::grab_ub(), Relation::is_circular(), is_empty_range(), Relation::is_equal(), Relation::is_greater_equal(), Relation::is_greater_than(), Relation::is_less_equal(), Relation::is_unknown(), RangeExpr::lb(), max_expr(), min(), min_expr(), OMEGA_OP, simplify(), and RangeExpr::ub().
Referenced by GSAFullRangeDict::_get_range_ref(), SSAFullRangeDict::_get_range_ref(), and RangeAccessor::get_range_ref(). |
|
|
Description: Perform a widening operator on the given expression and return the result.
... New range has one element.
Definition at line 2250 of file range_util.cc.
References _join_ranges(), _pull_out_common_min_max(), Expression::clone(), compare(), convert_to_range(), expr_expand_substituted(), RangeExpr::grab_lb(), RangeExpr::grab_ub(), RangeExpr::has_lb(), RangeExpr::has_ub(), is_empty_range(), Relation::is_equal(), Relation::is_greater_equal(), Relation::is_less_equal(), RangeExpr::lb(), max_expr(), min(), min_expr(), OMEGA_OP, simplify(), and RangeExpr::ub().
Referenced by RangeAccessor::get_range_ref(). |
|
|
Description: Perform a narrowing operator on the given expression and return the result.
... New range has one element.
Definition at line 2318 of file range_util.cc.
References _join_ranges(), _pull_out_common_min_max(), Expression::clone(), convert_to_range(), RangeExpr::grab_lb(), RangeExpr::has_lb(), RangeExpr::has_ub(), is_empty_range(), RangeExpr::lb(), OMEGA_OP, RangeExpr::ub(), and widen_range().
Referenced by widen_range(). |
|
|
Description: Return true if the given expression is a MOD intrinsic.
Definition at line 1413 of file range_util.cc.
References e, Expression::intrinsic(), INTRINSIC_CALL_OP, Symbol::name_ref(), Expression::op(), and Expression::symbol().
Referenced by _combine_min_max(), _elim_known_facts(), _is_pos_max(), _pull_out_common_min_max1(), remove_redundant_min_max_terms(), and RangeComparator::signz(). |
|
|
Description: Return true if the given expression contains a MIN or MAX intrinsic.
Definition at line 1448 of file range_util.cc.
References e, Expression::intrinsic(), INTRINSIC_CALL_OP, Symbol::name_ref(), Expression::op(), and Expression::symbol().
Referenced by _find_visit_order(), _multiply_out_divs_for_var1(), _p_mm_o_of_add(), _p_mm_o_of_divide(), _p_mm_o_of_exp(), _p_mm_o_of_mult(), _pull_in_add_expr(), _pull_in_div_expr(), _pull_in_exp_expr(), _pull_in_mult_expr(), _pull_min_max_out_top(), _substitute_mono_var(), _substitute_mono_var1(), contains_min_or_max(), remove_redundant_min_max_terms(), and swap_min_max(). |
|
|
Description: Eliminate all terms of MIN or MAX subexpressions of the given expression which can be proved to never be the minimum or maximum value respectively.
Definition at line 1485 of file range_util.cc.
References abs_to_max(), Expression::arg_list(), Mutator< T >::assign(), Expression::clone(), constant(), e, List< T >::grab(), List< T >::ins_first(), is_abs(), max_expr(), Expression::parameters_guarded(), Mutator< T >::pull(), simplify(), unary_minus(), and Iterator< T >::valid().
Referenced by abs_to_max(). |
|
|
Description: Create a new MOD intrinsic with the given arguments.
Definition at line 1928 of file range_util.cc.
References Expression::arg_list(), Mutator< T >::assign(), Iterator< T >::current(), Mutator< T >::del(), List< T >::entries(), List< T >::first_ref(), List< T >::grab(), List< T >::ins_last(), Relation::is_greater_equal(), Relation::is_less_equal(), is_max(), is_min_or_max(), Expression::parameters_guarded(), Mutator< T >::pull(), remove_redundant_min_max_terms(), and Iterator< T >::valid().
Referenced by remove_redundant_min_max_terms(), and StmtRanges::simplify_min_max(). |
|
|
Description: Print the given range expression as an (in)equality for the given variable.
Definition at line 1375 of file range_util.cc.
References comma(), INTEGER_TYPE, Symbol::intrinsic(), intrinsic_call(), IS_INTRINSIC, make_type(), mod_expr(), NOT_EXTERNAL, NOT_FORMAL, NOT_INTRINSIC, and Expression::type().
Referenced by _multiply_out_div(), _remove_truncates1(), and mod_expr(). |
| void pretty_print_range |
( |
ostream & |
o, |
|
|
const Expression & |
expr, |
|
|
const Symbol & |
var |
|
) |
|
|
|
|
Routines for simplifying expressions containing RangeExprs.
Meant for internal use of RangeComparator. Shouldn't be used externally.
Definition at line 2742 of file range_util.cc.
References RangeExpr::has_lb(), RangeExpr::has_ub(), RangeExpr::lb(), OMEGA_OP, RANGE_OP, and RangeExpr::ub().
Referenced by BaseStmtRanges::pretty_print(), ControlRangeDict::pretty_print(), GSAControlRangeDict::pretty_print(), GSAFullRangeDict::pretty_print(), RangeAccessor::pretty_print(), SSAControlRangeDict::pretty_print(), SSAFullRangeDict::pretty_print(), GSAControlRangeData::print(), and SSAControlRangeData::print(). |
|
|
Description: Pull all MIN or MAX intrinsics to the top levels of the expression.
|
|
|
This routine checks expr for containing exactly one variable, and if it does, applies the [lower:upper] range to it.
If the variable already has an upper or lower bound associated with it, then apply the limits to that bound.
... Now, if expr is just an ID_OP, assert that its range bounds are ... within the bounds of the declaration, or if one of its range bounds ... is an InfinityExpr, change that to the declaration bounds.
... Don't allow infinite recursion
... Check for Infinity in lower bound
... if not, constrain the lower bound to be within the declaration bound
... Check for infinity in upper bound
... if not, constrain the upper bound to be within the declaration bound
... Range is a single value - KDIM: kmax
Definition at line 3003 of file range_util.cc.
References and(), apply_limits(), RefSet< T >::clear(), Expression::clone(), ge(), ID_OP, INFINITY_OP, INTEGER_CONSTANT_OP, is_ID_OP(), le(), Expression::op(), RANGE_OP, set_ranges_for_symbol(), substitute_var(), tighten_lower_bound(), and tighten_upper_bound().
Referenced by _add_subscript_constraints_to_ranges(), and apply_limits(). |
|