Expression.cc File ReferenceExpression - related code: Expression class and all derived classes. More...
Go to the source code of this file.
|
Enumerations |
| enum | INVALID_CHECK {
LOOKING_FOR_INVALID,
NOT_LOOKING_FOR_INVALID
} |
| | ExprCountElem object: This keeps track of expressions and counts associated with them. More...
|
Functions |
| double | ceil (double) |
| | #include <math.h>
|
| double | floor (double) |
| void | set_subst_field_print () |
| | ----- not for public use ----------
|
| Boolean | is_commutative (OP_TYPE op) |
| | Description: Returns 1 iff 'op' is a commutative operator.
|
| Boolean | is_conjunctive_op (OP_TYPE op) |
| | Description: Returns 1 iff 'op' is a conjunctive operator.
|
| Boolean | is_relational_op (OP_TYPE op) |
| | Description: Returns 1 iff 'op' is a relational operator.
|
| Boolean | is_logical_false (const Expression &e) |
| | Description: Returns 1 iff 'e' is a LOGICAL_CONSTANT_OP and == .FALSE.
|
| Boolean | is_integer_zero (const Expression &e) |
| | Description: Returns 1 iff 'e' is an INTEGER_CONSTANT_OP and == 0.
|
| Boolean | is_integer_one (const Expression &e) |
| | Description: Returns 1 iff 'e' is an INTEGER_CONSTANT_OP and == 1.
|
| Boolean | is_integer_constant (const Expression &e) |
| | Description: Returns 1 iff 'e' is an INTEGER_CONSTANT_OP.
|
| Boolean | is_integer_constant (const Expression &e, int val) |
| | Description: Returns 1 iff 'e' is an INTEGER_CONSTANT_OP with the given value.
|
| bool | is_phi_function (const Expression &e) |
| | Description: Returns true iff 'e' is a GSA phi function (GAMMA or MU).
|
| bool | is_pseudo_function (const Expression &e) |
| | Description: Returns true iff 'op' is a GSA pseudo function (ALPHA, GAMMA, MU or BETA).
|
| static char * | double_to_single_quoted (const char *dbl) |
| | Given a Fortran character constant enclosed in double quotes, convert it into a character constant enclosed in single quotes (making all necessary syntactic changes) The string returned must be deleted using 'delete []' Returns 0 if there was an error.
|
| void | report_param_error (Expression &expr, char *intrin, int param_num, char *expected) |
| | Report an error in an intrinsic parameter.
|
| void | compute_intrinsic_type (Expression &expr) |
| | Compute the type of expr which is an IntrinsicCallExpr.
|
| void | determine_root_expr_type (Expression &expr) |
| | Assuming the types of all of expr's subexpressions are complete (i.e.
|
| void | propagate_expr_types (Expression &expr) |
| | Description: Propagate rank information through an expression.
|
| static Boolean | is_arithmetic_type (EXPR_TYPE type) |
| static Type | arithmetic_result_type (const Type &type1, const Type &type2, const int rank) |
| Type | string_type (const char *data_string, Boolean ignore_errors GIV(False)) |
| int | compute_rank (const Type &left_type, const Type &right_type, const OP_TYPE op) |
| | Determine the rank of an intrinsic binary operator using the following rule: "The shape of the result of '[x1] op x2' is the shape of x2 if op is unary or if x1 is scalar, and is the shape of x1 otherwise".
|
| Type | expr_type (const OP_TYPE op, const Type &left_type, const Type &right_type) |
| | Description: Calculates the type of an expression involving the given operator (op) and two operands.
|
| Type | expr_type (const OP_TYPE op, const List< Expression > &args) |
| | Description: Calculates the type of an expression involving the given operator (op) and a list containing any positive number of arguments (it is a run-time error to call this function with an empty 'args' list).
|
| List< Expression > * | expr_list (Expression *expr1 GIV(0), Expression *expr2 GIV(0), Expression *expr3 GIV(0), Expression *expr4 GIV(0), Expression *expr5 GIV(0), Expression *expr6 GIV(0), Expression *expr7 GIV(0), Expression *expr8 GIV(0), Expression *expr9 GIV(0), Expression *expr10 GIV(0)) |
| Expression * | constant (int value) |
| | Description: Returns a pointer to an expression for a Fortran INTEGER_CONST_EXPR.
|
| Expression * | constant (const char *data_string) |
| | Description: Returns a pointer to an expression for a Fortran constant specified as a char string.
|
| Expression * | keyword (const char *data_string) |
| | Description: Create a keyword node for the keypair function.
|
| Expression * | complex (Expression *real, Expression *imag) |
| Expression * | array_reference (Expression *array, Expression *subscripts) |
| | Description: Returns a pointer to an expression for a Fortran Complex constant.
|
| static Expression * | create_nonbinary (List< Expression > *args, OP_TYPE op_type, const char *func_name) |
| Expression * | add (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for expr1 + expr2.
|
| Expression * | add (List< Expression > *args) |
| | Description: Returns a pointer to an expression for (*args)[0] + (*args)[1] + (*args)[2] + ...
|
| Expression * | sub (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for expr1 - expr2.
|
| Expression * | mul (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for expr1 * expr2.
|
| Expression * | mul (List< Expression > *args) |
| | Description: Returns a pointer to an expression for (*args)[0] * (*args)[1] * (*args)[2] * ...
|
| Expression * | div (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for expr1 / expr2.
|
| Expression * | exponent (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for expr1 ** expr2.
|
| Expression * | keypair (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for a Fortran MASK=X expression.
|
| Expression * | eq (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for a Fortran .EQ.
|
| Expression * | ne (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for a Fortran .NE.
|
| Expression * | lt (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for a Fortran .LT.
|
| Expression * | le (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for a Fortran .LE.
|
| Expression * | gt (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for a Fortran .GT.
|
| Expression * | ge (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for a Fortran .GE.
|
| Expression * | or (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for expr1 .OR.
|
| Expression * | or (List< Expression > *args) |
| | Description: Returns a pointer to an expression for (*args)[0] .OR.
|
| Expression * | and (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for expr1 .AND.
|
| Expression * | and (List< Expression > *args) |
| | Description: Returns a pointer to an expression for (*args)[0] .AND.
|
| Expression * | eqv (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for expr1 .EQV.
|
| Expression * | eqv (List< Expression > *args) |
| | Description: Returns a pointer to an expression for (*args)[0] .EQV.
|
| Expression * | neqv (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for expr1 .NEQV.
|
| Expression * | neqv (List< Expression > *args) |
| | Description: Returns a pointer to an expression for (*args)[0] .NEQV.
|
| Expression * | function_call (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for a Fortran function call 'function' may be an id-expression for an external or intrinsic Fortran function symbol.
|
| Expression * | intrinsic_call (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for a Fortran intrinsic call.
|
| Expression * | substring (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for a Fortran substring expression.
|
| Expression * | concat (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for expr1 // expr2.
|
| Expression * | colon (Expression *expr1, Expression *expr2, Expression *expr3 GIV(0)) |
| Expression * | colon (List< Expression > *args) |
| Expression * | comma (List< Expression > *args) |
| | Description: Returns a pointer to an expression for (*args)[0] , (*args)[1] , (*args)[2] , ...
|
| Expression * | comma (Expression *expr1, Expression *expr2, Expression *expr3 GIV(0), Expression *expr4 GIV(0), Expression *expr5 GIV(0)) |
| Expression * | comma (Expression *expr1) |
| | Description: Returns a pointer to an expression for a CommaExpr.
|
| Expression * | comma () |
| | Description: Returns a pointer to an expression for a CommaExpr with no arguments.
|
| Expression * | unary_plus (Expression *expr) |
| | Description: Returns a pointer to an expression for a unary plus expression.
|
| Expression * | unary_minus (Expression *expr) |
| | Description: Returns a pointer to an expression for a unary minus expression.
|
| Expression * | do_expression (Expression *expr1, Expression *expr2) |
| | Description: Returns a pointer to an expression for expr1 * expr2.
|
| Expression * | equal (Expression *index, Expression *iter_space) |
| | Description: Returns a pointer to an expression for an EqualExpr (e.g.
|
| Expression * | not (Expression *expr) |
| | Description: Returns a pointer to an expression for a unary .NOT.
|
| Expression * | paren (Expression *expr) |
| | Description: Returns a pointer to a parenthesized expression.
|
| Expression * | id (const char *varname, const ProgramUnit &pgm) |
| | Description: Returns a pointer to an expression for an existing Fortran identifier.
|
| Expression * | id (const Symbol &symbol) |
| | Description: Returns a pointer to an expression for an existing Fortran symbol.
|
| Expression * | new_variable (const char *varname, const Type &t, ProgramUnit &pgm) |
| | Description: Returns a pointer to an expression for a new Fortran identifier.
|
| Expression * | new_function (const char *funname, const Type &t, ProgramUnit &pgm) |
| | Description: Returns a pointer to an expression for a new Fortran function identifier.
|
| Expression * | new_intrinsic (const char *funname, const Type &t, ProgramUnit &pgm) |
| | Description: Returns a pointer to an expression for a new Fortran intrinsic function identifier.
|
| Expression * | new_subroutine (const char *funname, ProgramUnit &pgm) |
| | Description: Returns a pointer to an expression for a new Fortran subroutine identifier.
|
| Expression * | new_array_variable (const char *varname, const Type &t, ProgramUnit &pgm, Expression *bounds1, Expression *bounds2 GIV(0), Expression *bounds3 GIV(0), Expression *bounds4 GIV(0), Expression *bounds5 GIV(0)) |
| Expression * | omega () |
| | Description: Returns a pointer to a null expression.
|
| Expression * | null_to_omega (Expression *expr) |
| | Description: Return a pointer to a null expression if the given expression is 0 (NULL).
|
| Expression * | infinity (int s GIV(1)) |
| Expression * | alpha (Expression *parameters) |
| | Description: Create a alpha GSA function with the given parameters.
|
| Expression * | gamma (Expression *gate, Expression *parameters) |
| | Description: Create a gamma GSA function with the given gate function and parameters.
|
| Expression * | mu (Expression *parameters) |
| | Description: Create a mu GSA function with the given parameters.
|
| Expression * | theta (Expression *parameters) |
| Expression * | eta (Expression *gate, Expression *parameters) |
| | ... from Expression.cc
|
| Expression * | mu (Expression *parameters, Expression *gate) |
| static void | _cannot_coerce (const Type &from, EXPR_TYPE to) |
| static void | _assert_can_coerce (const Type &from, EXPR_TYPE to, EXPR_TYPE from1, EXPR_TYPE from2=(EXPR_TYPE)(-1), EXPR_TYPE from3=(EXPR_TYPE)(-1), EXPR_TYPE from4=(EXPR_TYPE)(-1), EXPR_TYPE from5=(EXPR_TYPE)(-1)) |
| static Expression * | _coerce (Expression *expr, const char *intrin_name, EXPR_TYPE NOTUSED(type), ProgramUnit &pgm) |
| Expression * | coerce (Expression *expr, EXPR_TYPE type, ProgramUnit &pgm) |
| | Description: Returns a new expression which coerces 'expr' into the same type as that of 'type', IF NECESSARY (if 'expr' is already of the same type as 'type', it returns 'expr' unchanged).
|
| ostream & | operator<< (ostream &o, const Expression &e) |
| int | operator_precedence (const OP_TYPE ot) |
| | Function used for writing expressions, specifies Fortran 77 operator-precedence.
|
| void | print_prec (OP_TYPE parent_op, const Expression *e, ostream &o) |
| | print the expression to \'o\', parenthesizing if the precedence calls for it.
|
| void | print_prec_list (ostream &o, OP_TYPE optype, const List< Expression > &l, const char *c) |
| | Helper function used to print the given list, sepperating each element by c.
|
| Expression * | substitute_var (Expression *e, const Symbol &var, const Expression &value) |
| | Description: Substitute all occurences of the given variable in the given expression with the given value, then return the result.
|
| void | substitute_var (Expression &e, const Symbol &var, const Symbol &new_var) |
| | Description: Substitute (in place) all occurances of the given variable in the given expression with the given new variable.
|
| Boolean | _non_wc_match (const Expression &e1, const Expression &e2, Boolean consider_side_effects) |
| | _non_wc_match()
|
| void | _sort_expr_list (List< Expression > &expr_list) |
| | _sort_expr_list -
|
| Boolean | wildcard_compare_args (Expression &e1, Expression &e2, Boolean consider_side_effects) |
| | wildcard_args_are_equal(expr1, expr2, consider_side_effects) - Return True if all args of expr1 match those of expr2 either by exact equality or by wildcard matching.
|
| Expression * | _replace_check_parent (Expression *e, Expression *parent_ref, Expression &pattern, ReplaceOptions &rep_options, Boolean &continue_traversal) |
| | Note: Whatever is returned has entire correct signatures and is still in standardized form.
|
| Expression * | _replace_or_traverse_aux (Expression *e, Expression *parent_ref, Expression &pattern, ReplaceOptions &rep_options) |
| | Note: This function has been declared 'friend' to Expression.
|
| Expression * | _replace_or_traverse (Expression *e, Expression &pattern, ReplaceOptions &rep_options) |
| | Note: this function has been declared a friend to Expression.
|
| Expression * | replace (Expression *e, Expression &pattern, const Expression &replacement, REPLACE_OPTION trav_option GIV(NON_RECURSIVE_REPLACE), REPLACE_ORDER trav_order GIV(PREORDER_REPLACE)) |
| | interface functions -- replace, traverse
|
| Expression * | replace (Expression *e, Expression &pattern, semantic_check_func_t semantic_check_func, const Expression &replacement, REPLACE_OPTION trav_option GIV(NON_RECURSIVE_REPLACE), REPLACE_ORDER trav_order GIV(PREORDER_REPLACE)) |
| Expression * | replace (Expression *e, Expression &pattern, replace_func_t replacement_func, ExtraInfo &other_args, REPLACE_OPTION trav_option GIV(NON_RECURSIVE_REPLACE), REPLACE_ORDER trav_order GIV(PREORDER_REPLACE)) |
| Expression * | replace (Expression *e, Expression &pattern, semantic_check_func_t semantic_check_func, replace_func_t replacement_func, ExtraInfo &other_args, REPLACE_OPTION trav_option GIV(NON_RECURSIVE_REPLACE), REPLACE_ORDER trav_order GIV(PREORDER_REPLACE)) |
| void | traverse (Expression &e, Expression &pattern, semantic_check_func_t semantic_check_func, traverse_action_func_t traverse_action_func, ExtraInfo &other_args, REPLACE_OPTION trav_option GIV(NON_RECURSIVE_REPLACE), REPLACE_ORDER trav_order GIV(PREORDER_REPLACE)) |
| void | traverse (Expression &e, Expression &pattern, traverse_action_func_t traverse_action_func, ExtraInfo &other_args, REPLACE_OPTION trav_option GIV(NON_RECURSIVE_REPLACE), REPLACE_ORDER trav_order GIV(PREORDER_REPLACE)) |
| static Expression * | _additive_inverse (Expression *e) |
| | Holds the options to simplify.
|
| static Expression * | _logical_complement (Expression *e) |
| | logical_complement Perform a logical complement on myself.
|
| static int | _lgcd (int, int) |
| | gcd Return the greatest common divisor for the expression.
|
| static void | _pull_out_divisible (Expression &expr, int divisor, Expression &pulled_terms) |
| | _pull_out_divisible Pull out all terms in the addition expression that are divisible by the given integer, divide them by that integer, and place them in the pulled_terms addition expression.
|
| void | _combine_min_max (List< Expression > &arg_list, Boolean is_max) |
| | combine_min_max Combine all terms with equal symbolic parts in the given argument list for an min or max expression.
|
| static Expression * | _fold_divisible_top (Expression *expr) |
| | _fold_divisible_top Merge all division expressions whose denominator evenly divides their numerator in the given expression.
|
| static Boolean | _combine_int_relations (List< Expression > &arg_list, OP_TYPE op) |
| | combine_int_relations Combine terms in a logical AND or OR expression.
|
| static Boolean | _combine_other_logicals (List< Expression > &arg_list) |
| | combine_other_logicals Combine terms in a logical AND or OR expression.
|
| static Expression * | _join (OP_TYPE op, Expression *e1, Expression *e2) |
| | join Join the two expressions into a single expression with the given NonBinaryExpr operator
|
| static Expression * | _s_constant (int value) |
| | _s_constant Create a constant Expression object with an updated signature.
|
| static Expression * | _s_constant (const char *data_string) |
| static void | _standardize_top (Expression &e) |
| | _standardize_top Put the top-level expression into standard form then update the signature for the top-level expression.
|
| Boolean | is_commutative_intrinsic_name (const char *name) |
| | is_commutative_intrinsic_name - Returns 1 iff the intrinsic function specified by 'name' is commutative.
|
| static Boolean | _expr_can_contain_omega (OP_TYPE op) |
| | expr_can_contain_omega Return True if it is allowable to have omega in the expression's arguments
|
| static Expression * | _push_down_nots (Expression *expr) |
| | _push_down_nots Push any NOT expressions as deeply in the expression's arguments as possible.
|
| static void | _push_down_args_nots (Expression &expr) |
| static void | _remove_ratdivs (Expression &expr, Boolean &signature_needs_updating) |
| | _remove_ratdivs Replace all RATDIV_OP and INTDIV_OP operators with DIV_OP operators.
|
| static void | _remove_ratdivs (Expression &expr) |
| static void | _read_simplify_opts () |
| | _read_simplify_opts Read in the options to simplify.
|
| void | reset_simplifier_opts () |
| | reset_simplifier_opts Reset the options to simplify.
|
| void | set_simplifier_opts () |
| | set_simplifier_opts Set the options to simplify.
|
| Expression * | simplify_top (Expression *e) |
| | simplify_top Simplify the given expression with the given assumption that the expression's arguments have already been simplified.
|
| static Expression * | _simplify (Expression *e) |
| | simplify Simplify the given expression
|
| static Expression * | check_div (Expression &expr, int value) |
| static void | extract_possible_factors (Expression &expr, set< int > &factors) |
| | Extract integer constant factors common to all terms.
|
| Expression * | _simplify_div_int (Expression *expr) |
| | Try to normalize integer constant factors.
|
| Expression * | simplify (Expression *e) |
| | Simplify the given expression, and return the simplified result.
|
| int | _nearer_to_zero (int x, int y) |
| | power_of_factor If factor^p is a factor of the given expression, then return p.
|
| static int | _power_of_factor (const Expression &expr, const Expression &factor) |
| static void | _calc_factor (const Expression &expr1, const Expression &expr2, const Expression &factor, List< Expression > &factors) |
| | calc_factors Determine whether the given expression is a factor of the given pair of expressions.
|
| static Expression * | _divide_by_factor1 (Expression *expr, const Expression &factor, int &power) |
| | divide_by_factor Divide the given expression by the given symbolic factor.
|
| static Expression * | _divide_by_factor (Expression *expr, const Expression &factor) |
| static void | _sym_factor (Expression *&expr1, Expression *&expr2, List< Expression > &factors) |
| | sym_factor Remove all common factors from the given pair of expressions and place these factors in the given list.
|
| Expression * | sym_factors (const Expression &ex, List< Expression > &factors) |
| | Factor the given sum-of-products expression and return a list of factors (ID_OPs), and also the Expression resulting from dividing sum_of_prods by the factors as the function result.
|
| static Boolean | _is_expr_evenly_divisible (Expression &expr) |
| | _is_expr_evenly_divisible Like is_evenly_divisible, but takes division expressions.
|
| static ExprCountElem * | _loc_in_siglist (const List< ExprCountElem > &l, const Expression &e) |
| | *loc_in_siglist*
|
| static ExprExponentElem * | _loc_in_siglist_expon (const List< ExprExponentElem > &l, const Expression &e) |
| | *loc_in_siglist_expon*
|
| static Boolean | _is_not_in_siglist (const List< ExprCountElem > &l, const Expression &e, int count) |
| | _is_not_in_siglist Returns true if the siglist does not contain an ExprCountElem with the given expression and count fields.
|
| static Expression * | _loc_of_integer_constant (List< Expression > &l) |
| | *loc_of_integer_constant*
|
| static Boolean | _is_relation (const Expression &e) |
| | _is_relation Return true if the given expression is an relation operator
|
| void | _remove_duplicates (List< Expression > &arg_list) |
| | remove_duplicates Remove duplicate expressions from the given list of expressions.
|
| static void | _get_top_scalars (const Expression &expr, RefSet< Symbol > &scalars) |
| | get_top_scalars; Return the set of all scalar variables used in the given expression.
|
| static int | _var_power_in_expr (const Expression &expr, const Symbol &var) |
| | var_power_in_expr Return the maximum power of the given variable in the given expression.
|
| static Boolean | _is_evenly_divisible1 (const Expression &expr, int divisor, const RefSet< Symbol > &scalars) |
| | is_base_case_evenly_divisible_for_var Try to prove that the given expression is evenly divisible if the given variable was set to zero.
|
| static Boolean | _is_base_case_evenly_divisible (const Expression &expr, int divisor, const RefSet< Symbol > &scalars, const Symbol &var) |
| static Boolean | _is_evenly_divisible_for_var (const Expression &expr, int divisor, const RefSet< Symbol > &scalars, const Symbol &var) |
| | is_evenly_divisible_for_var Try to prove by induction that the given expression is evenly divisible in respect to the given variable.
|
| Boolean | is_evenly_divisible (const Expression &expr, int divisor) |
| static void | _grab_divisible (Expression &expr, List< Expression > &divisible) |
| | grab_divisible Grab all division expressions whose denominator evenly divides their numerator in the given non-binary expression and place these expressions in the given list.
|
| static Expression * | _fold_divisible_in_mult (Expression *expr) |
| | fold_divisible_in_mult Merge all division expressions whose denominator evenly divides their numerator in a multiplication expression
|
| static Expression * | _fold_divisible_in_exp (Expression *expr) |
| | fold_divisible_in_exp Merge all division expressions whose denominator evenly divides their numerator in a exponentiation expression
|
| static int | _num_divisible_candidates (const Expression &expr) |
| static Expression * | _fold_divisible_in_plus (Expression *expr) |
| | fold_divisible_in_plus Merge all division expressions whose denominator evenly divides their numerator in an addition expression.
|
| static Expression * | _fold_divisible_in_div (Expression *expr) |
| | _fold_divisible_in_div Check for exponentiations in a division, and simplify where possible.
|
| Expression * | sum (Expression *ex, Expression &id, const Expression &lower, const Expression &upper) |
| | Description: Returns a the summation of id from lower to upper over the expression ex.
|
Variables |
| static int | subst_field_print = 0 |
| static char * | op_string [NUM_OP_TYPES] |
| | Expression base class code:.
|
| static unsigned int | _simplify_options = UNREAD_OPTIONS |
| static unsigned int | _saved_simplify_options = UNREAD_OPTIONS |
Detailed Description
Expression - related code: Expression class and all derived classes.
Definition in file Expression.cc.
Enumeration Type Documentation
|
|
ExprCountElem object: This keeps track of expressions and counts associated with them.
A special case is an INTEGER_CONSTANT_OP expression which is represented as an _expr of 0. - Enumeration values:
-
| LOOKING_FOR_INVALID |
|
| NOT_LOOKING_FOR_INVALID |
|
Definition at line 11953 of file Expression.cc. |
Function Documentation
| void set_subst_field_print |
( |
|
) |
|
|
|
|
Description: Returns 1 iff 'e' is an INTEGER_CONSTANT_OP and == 0.
Definition at line 341 of file Expression.cc.
References e, INTEGER_CONSTANT_OP, Expression::op(), and Expression::value().
Referenced by _combine_int_relations(), _extract_ranges_rel(), _handle_omega_in_mod(), _remove_truncates1(), ar_offsets_match(), SimBiGraph::calc_similarity(), divides_diff(), intersect_ARDs(), is_affine(), main(), InlineObject::remap_arg_names(), and subsume_relation(). |
|
|
Description: Returns true iff 'op' is a GSA pseudo function (ALPHA, GAMMA, MU or BETA).
Definition at line 380 of file Expression.cc.
References ALPHA_OP, e, ETA_OP, Expression::function(), FUNCTION_CALL_OP, GAMMA_OP, MU_OP, Symbol::name_ref(), Expression::op(), Expression::symbol(), and THETA_OP.
Referenced by TranslateObject::_translate_symbol_refs_expr(), occurs(), optimize_ssa_beta(), substitute_argument(), and TranslateObject::translate_GSA_symbol_refs(). |
| static char* double_to_single_quoted |
( |
const char * |
dbl |
) |
[static] |
|
|
|
Given a Fortran character constant enclosed in double quotes, convert it into a character constant enclosed in single quotes (making all necessary syntactic changes) The string returned must be deleted using 'delete []' Returns 0 if there was an error.
(i.e. mismatched quotes, etc.)
... Need a workspace of a most 2*len(dbl) size
... First single quote
... Now go through, changing single quotes to single quote pairs, and ... changing double quotes pairs to double quotes
... Everything between the outer quotes
... Replace with pair
... Replace pair with single
... This is not a double quote pair -- error
... Skip the extra in the pair
... Last single quote
... NULL-terminate
Definition at line 407 of file Expression.cc.
Referenced by constant(), and string_type(). |
| void report_param_error |
( |
Expression & |
expr, |
|
|
char * |
intrin, |
|
|
int |
param_num, |
|
|
char * |
expected |
|
) |
|
|
|
|
Compute the type of expr which is an IntrinsicCallExpr.
... Check if parameter has been axed (what the hell does this mean?)
... Make sure it does not require global special handling
... Make sure there are some parameters
... Make sure there are the correct number of parameters ... NOTE: if the number of paramters is listed as 0, the number ... is variable.
... Make sure the parameters are of the correct type ... NOTE: Should also check if they are the correct rank
... Types don`t match--check exceptions
... OK, nothing to do
... OK, nothing to do
... OK, nothing to do
... OK, nothing to do
... Problem!
... make sure rank is known
... if there are more than 4 params, ... type-check using the 4th
... Determine result type -- set the expr`s type. ... First, set the type kind
... The type is taken from the type of the first parameter ... unless the special_type flag is up, in which case it ... is done on a case by case basis.
... 1st param type
... take type from 2nd argument
... use rules from table 7.1.4
... make scalar to avoid
... rank conflicts
... log * log = log for dotproduct
... Set the resulting type shape
... Take the shape from the shape of the first argument ... 1st param type
... shape == SPECIAL ... Use rules derived from keywords or match on names
... Intrinsic type: INTRINSIC(MASK, DIM) ... scalar if DIM absent; else it is rank(MASK) - 1 ... * OR * ... Intrinsic type: INTRINSIC(ARRAY, DIM, MASK) ... scalar if DIM absent ... otherwise rank is rank(ARRAY) - 1 ... * HANDLED THE SAME *
... 1st param type
... Intrinsic type: INTRINSIC(ARRAY, MASK) ... result is an array of rank 1
... MATMUL-style intrinsic
... Intrinsic violates derived rules--handle case by case ... scalar if dim present, else rank 1
... DIM is present
... intrinsic _DOES_ require global special handling ... handle on a case by case basis
Definition at line 478 of file Expression.cc.
References Expression::arg_list(), IntrinsicTable::axed(), CHARACTER_TYPE, COMPLEX_TYPE, Type::data_type(), DOUBLE_PRECISION_TYPE, expr_type(), False, GENERIC_TYPE, INT_OR_REAL_TYPES, INTEGER_TYPE, LOGICAL_TYPE, IntrinsicTable::lookup_intrinsic(), lt(), make_type(), MULT_OP, IntrinsicTable::num_params(), IntrinsicTable::num_req_params(), IntrinsicTable::param_key(), IntrinsicTable::param_req_rank(), IntrinsicTable::param_type(), Expression::parameters_guarded(), Type::rank(), Type::rank_known(), REAL_TYPE, Type::redimension(), report_param_error(), IntrinsicTable::return_length(), IntrinsicTable::return_shape(), IntrinsicTable::return_special(), IntrinsicTable::return_type(), and IntrinsicTable::special().
Referenced by determine_root_expr_type(). |
| void determine_root_expr_type |
( |
Expression & |
expr |
) |
|
|
|
|
Assuming the types of all of expr's subexpressions are complete (i.e.
contain dimension info), determine expr's complete type.
... Mark as a scalar
... Rank = # of COLON_OPs in the list of subscripts
... Type is the same as the first sub-expression's type
... Use the intrinsic table.
... (CASTAWAY(Type &) expr.type()).rank_known(False); ... (CASTAWAY(Type &) expr.type()).set(UNKNOWN_TYPE);
... Statement functions must be scalar
... Return integer is scalar
... unary operations take the type from their
... sub-expression.
... silvius:
... Infer ranks of BinaryExprs. Determine using type-inference ... routines. If a sub-expression does not exist, use the type ... of the existing sub-expression.
... Rank makes no sense in these contexts
Definition at line 818 of file Expression.cc.
References ADD_OP, ALPHA_OP, AND_OP, ARG_OP, ARRAY_REF_OP, COLON_OP, COMMA_OP, COMPLEX_OP, compute_intrinsic_type(), CONCAT_OP, Iterator< T >::current(), Iterator< T >::current_valid(), DIV_OP, DO_OP, EQ_OP, EQUAL_OP, EQV_OP, ETA_OP, EXP_OP, expr_type(), False, FORMAT_OP, FUNCTION_CALL_OP, GAMMA_OP, GE_OP, GT_OP, INFINITY_OP, INTDIV_OP, INTRINSIC_CALL_OP, IO_STAR_OP, KEYPAIR_OP, LABEL_OP, LAMBDA_CALL_OP, LE_OP, LT_OP, MU_OP, MULT_OP, NE_OP, NEQV_OP, NOT_OP, OMEGA_OP, OR_OP, PAREN_OP, Type::rank_known(), RATDIV_OP, REPSTAR_OP, RETURN_OP, STMT_LABEL_OP, SUB_OP, SUBSTRING_OP, TABLE_ENTRY, THETA_OP, Expression::type(), Expression::type_ref(), U_MINUS_OP, U_PLUS_OP, and Iterator< T >::valid().
Referenced by array_reference(), intrinsic_call(), and propagate_expr_types(). |
|
|
Description: Propagate rank information through an expression.
Update the Type with dimension data. WARNING: This routine makes heavy use of casting away consts in order to modify the const type expression.
... An IDExpr has the same dimensionality as it`s symbol
... mark constants as scalar (NOTE: this does not handle ... array constants)
... Determine types of the sub-expressions
Definition at line 1005 of file Expression.cc.
References determine_root_expr_type(), HOLLERITH_CONSTANT_OP, ID_OP, INTEGER_CONSTANT_OP, LOGICAL_CONSTANT_OP, propagate_expr_types(), REAL_CONSTANT_OP, Type::redimension(), and STRING_CONSTANT_OP.
Referenced by ProgramUnit::_propagate_types(), propagate_expr_types(), and simplify(). |
| static Type arithmetic_result_type |
( |
const Type & |
type1, |
|
|
const Type & |
type2, |
|
|
const int |
rank |
|
) |
[static] |
|
| Type string_type |
( |
const char * |
data_string, |
|
|
Boolean ignore_errors |
GIV(False) |
|
) |
|
|
|
|
... We have a string constant - count up its real length ('' == ')
... We have a string constant with double quotes - ... convert to single quotes, then count up its real length ('' == ')
... If nothing but digits thus far, OK
... Match stated length with string length
... Fine - all is OK, keep going
Definition at line 1097 of file Expression.cc.
References CHARACTER_TYPE, DOUBLE_PRECISION_TYPE, double_to_single_quoted(), False, fortran_string_length(), INTEGER_TYPE, LOGICAL_TYPE, make_type(), REAL_TYPE, True, UNDEFINED_TYPE, and upcase_ch(). |
| int compute_rank |
( |
const Type & |
left_type, |
|
|
const Type & |
right_type, |
|
|
const OP_TYPE |
op |
|
) |
|
|
|
|
Determine the rank of an intrinsic binary operator using the following rule: "The shape of the result of '[x1] op x2' is the shape of x2 if op is unary or if x1 is scalar, and is the shape of x1 otherwise".
(section 7.1.4.2, FORTRAN 8x spec.) This results in a failed polaris assertion if the types are not in shape conformance. Returning -1 indicates that the rank is not known.
... both ranks are known
... They are both arrays
... Types not in shape conformance
Definition at line 1221 of file Expression.cc.
References Type::rank().
Referenced by expr_type(). |
|
|
Description: Calculates the type of an expression involving the given operator (op) and two operands.
... NonBinaryExpr operator
... NonBinaryExpr operator
... NonBinaryExpr operator
... NonBinaryExpr operator
... BinaryExpr operator
... NonBinaryExpr operator
... NonBinaryExpr operator
... This is only valid for F77, it is possible in F90.
... Treat these as normal operations
... but ignore OMEGA_OP arguments
Definition at line 1257 of file Expression.cc.
References ADD_OP, ALPHA_OP, AND_OP, arithmetic_result_type(), ARRAY_REF_OP, CHARACTER_TYPE, COLON_OP, COMPLEX_OP, COMPLEX_TYPE, compute_rank(), CONCAT_OP, Type::data_type(), DIV_OP, DOUBLE_PRECISION_TYPE, EQ_OP, EQV_OP, ETA_OP, EXP_OP, GAMMA_OP, GE_OP, GT_OP, INTDIV_OP, INTEGER_TYPE, is_arithmetic_type(), KEYPAIR_OP, LE_OP, LOGICAL_TYPE, LT_OP, make_ranked_type(), make_type(), MU_OP, MULT_OP, NE_OP, NEQV_OP, op_string, OR_OP, RATDIV_OP, Type::size(), SUB_OP, SUBSTRING_OP, switch_value(), THETA_OP, UNDEFINED_TYPE, UNKNOWN_TYPE, and VOID_TYPE. |
|
|
Description: Returns a pointer to an expression for a Fortran INTEGER_CONST_EXPR.
Definition at line 1501 of file Expression.cc. |
|
|
Description: Returns a pointer to an expression for (*args)[0] + (*args)[1] + (*args)[2] + ...
where 'args' may contain any number ( > 0) of Expressions. The 'args' list may be created by hand or by a call to expr_list() (elsewhere in this file). The 'args' list is automatically deleted by this routine, so the user must NOT delete this list after a call to this function.
Definition at line 1606 of file Expression.cc.
References ADD_OP, and create_nonbinary(). |
|
|
Description: Returns a pointer to an expression for expr1 - expr2.
Definition at line 1612 of file Expression.cc.
References expr_type(), and SUB_OP.
Referenced by Collection::_check_subscript(), EvolutionGraph::_compute_cyclic_evolutions(), RefSet< T >::_element(), Set< T >::_element(), _fold_divisible_in_div(), _forward_diff(), _invert_expr(), _is_evenly_divisible_for_var(), EvolutionGraph::_local_range(), _loop_index_last_val(), _loop_range(), _max_abs_expr(), _multiply_out_div(), _p_r_o_of_mod(), EvolutionGraph::_possible_ranges(), _remove_truncates1(), Collection::_subscript_error(), TranslateObject::_translate_symbol_refs_expr(), ar_interleave(), ar_subregion(), array_element_count(), BaseList::assign(), base_offset(), coalese_loop(), AbstractAccess::compute_new_dimension(), compute_top(), conformable_test(), contiguous_aggregation(), eg_distance(), eg_distance_1_dim(), extract_stride(), EvolutionGraph::get_trace_details(), TreeInMaking::grab(), included(), intersect_ARDs(), is_affine(), iteration_count(), last_element_offset(), last_value(), linearize_zero_registered(), main(), make_bytesize_expr(), InlineObject::make_conformable(), normalize_loop(), Array< T >::operator[](), Collection::operator[](), ExprTable::operator[](), List< T >::operator[](), RefList< T >::operator[](), p_greater_equal(), p_greater_than(), p_less_equal(), p_less_than(), peel_loop_first(), peel_loop_last(), EvolutionGraph::perfect_trace_from_mu(), preroll_loop(), process(), InlineObject::remap_arg_names(), reshape_array(), same_gate(), stripmine_horiz_loop(), stripmine_vert_loop(), subsume_relation(), subtract_evolution(), Summation::sum_aux(), Summation::sum_exp(), Summation::sum_mul(), and test_monotonicity(). |
|
|
Description: Returns a pointer to an expression for (*args)[0] * (*args)[1] * (*args)[2] * ...
where 'args' may contain any number ( > 0) of Expressions. The 'args' list may be created by hand or by a call to expr_list() (elsewhere in this file). The 'args' list is automatically deleted by this routine, so the user must NOT delete this list after a call to this function.
Definition at line 1634 of file Expression.cc.
References create_nonbinary(), and MULT_OP. |
|
|
Description: Returns a pointer to an expression for expr1 / expr2.
Definition at line 1640 of file Expression.cc.
References DIV_OP, and expr_type().
Referenced by _extract_a_range(), _fold_divisible_in_mult(), _fold_divisible_in_plus(), _invert_expr(), _loop_index_last_val(), _loop_range(), _p_r_o_of_divide(), _pull_in_div_expr(), _remove_truncates1(), _solve_linear_expr(), coalese_loop(), AbstractAccess::compute_new_dimension(), divides_diff(), expr_divides(), TreeInMaking::grab(), iteration_count(), main(), stripmine_vert_loop(), Summation::sum_aux(), Summation::sum_exp(), and Summation::sum_exp_aux(). |
|
|
Description: Returns a pointer to an expression for expr1 ** expr2.
Definition at line 1651 of file Expression.cc.
References EXP_OP, and expr_type().
Referenced by _calc_factor(), _fold_divisible_in_div(), _fold_divisible_in_exp(), _multiply_out_divs_for_var1(), _p_r_o_of_exp(), _pull_in_exp_expr(), TreeInMaking::grab(), main(), Summation::sum_exp_aux(), and sym_factors(). |
|
|
Description: Returns a pointer to an expression for a Fortran .EQ.
expression
Definition at line 1671 of file Expression.cc.
References EQ_OP, and expr_type().
Referenced by _make_range(), _recognize(), _simplify_using_ranges(), check_div(), EquivalenceDict::clean(), ProgramUnit::clean(), convert_arithmetic_if(), EquivalenceDict::exchange_convert(), extract_ranges(), TreeInMaking::grab(), main(), move_saved_vars(), and p_getsubopt(). |
|
|
Description: Returns a pointer to an expression for a Fortran .LE.
expression
Definition at line 1704 of file Expression.cc.
References expr_type(), and LE_OP.
Referenced by _get_array_ref_preds(), TranslateObject::_translate_symbol_refs_expr(), _update_do_succs(), apply_limits(), at_least_one_iteration(), convert_arithmetic_if(), enforce_standard_within_bounds(), TreeInMaking::grab(), increase(), Predicates::Predicates(), and PropCtrlRangeWS::PropCtrlRangeWS(). |
|
|
Description: Returns a pointer to an expression for a Fortran .GE.
expression
Definition at line 1726 of file Expression.cc.
References expr_type(), and GE_OP.
Referenced by _get_array_ref_preds(), _remove_unreachable(), _update_do_succs(), apply_limits(), at_least_one_iteration(), convert_arithmetic_if(), TreeInMaking::grab(), intersect_ARDs(), Predicates::Predicates(), and PropCtrlRangeWS::PropCtrlRangeWS(). |
|
|
Description: Returns a pointer to an expression for (*args)[0] .OR.
(*args)[1] .OR. (*args)[2] .OR. ... where 'args' may contain any number ( > 0) of Expressions. The 'args' list may be created by hand or by a call to expr_list() (elsewhere in this file). The 'args' list is automatically deleted by this routine, so the user must NOT delete this list after a call to this function.
Definition at line 1748 of file Expression.cc.
References create_nonbinary(), and OR_OP. |
|
|
Description: Returns a pointer to an expression for (*args)[0] .AND.
(*args)[1] .AND. (*args)[2] .AND. ... where 'args' may contain any number ( > 0) of Expressions. The 'args' list may be created by hand or by a call to expr_list() (elsewhere in this file). The 'args' list is automatically deleted by this routine, so the user must NOT delete this list after a call to this function.
Definition at line 1765 of file Expression.cc.
References AND_OP, and create_nonbinary(). |
|
|
Description: Returns a pointer to an expression for (*args)[0] .EQV.
(*args)[1] .EQV. (*args)[2] .EQV. ... where 'args' may contain any number ( > 0) of Expressions. The 'args' list may be created by hand or by a call to expr_list() (elsewhere in this file). The 'args' list is automatically deleted by this routine, so the user must NOT delete this list after a call to this function.
Definition at line 1782 of file Expression.cc.
References create_nonbinary(), and EQV_OP. |
|
|
Description: Returns a pointer to an expression for (*args)[0] .NEQV.
(*args)[1] .NEQV. (*args)[2] .NEQV. ... where 'args' may contain any number ( > 0) of Expressions. The 'args' list may be created by hand or by a call to expr_list() (elsewhere in this file). The 'args' list is automatically deleted by this routine, so the user must NOT delete this list after a call to this function.
Definition at line 1799 of file Expression.cc.
References create_nonbinary(), and NEQV_OP. |
|
|
Description: Returns a pointer to an expression for a Fortran intrinsic call.
Definition at line 1817 of file Expression.cc.
References determine_root_expr_type(), and IS_INTRINSIC.
Referenced by _loop_index_last_val(), _pull_out_common_min_max1(), TranslateObject::_translate_symbol_refs_expr(), coalese_loop(), AbstractAccess::compute_new_dimension(), eg_distance(), eg_distance_1_dim(), fix_alternate_expr(), iteration_count(), make_afi_node(), make_best(), max_expr(), EvolutionGraph::min_distance(), min_expr(), mod_expr(), parse_intrinsic_call(), peel_loop_first(), peel_loop_last(), preroll_loop(), process(), stripmine_horiz_loop(), and stripmine_vert_loop(). |
|
|
Description: Returns a pointer to an expression for (*args)[0] , (*args)[1] , (*args)[2] , ...
where 'args' may contain any number ( > 0) of Expressions. The 'args' list may be created by hand or by a call to expr_list() (elsewhere in this file). The 'args' list is automatically deleted by this routine, so the user must NOT delete this list after a call to this function.
Definition at line 1877 of file Expression.cc. |
|
|
Description: Returns a pointer to an expression for a CommaExpr.
'expr' may not be NULL
Definition at line 1894 of file Expression.cc. |
|
|
Description: Returns a pointer to an expression for a unary plus expression.
Definition at line 1907 of file Expression.cc.
References U_PLUS_OP. |
|
|
Description: Returns a pointer to an expression for a unary minus expression.
Definition at line 1915 of file Expression.cc.
References U_MINUS_OP.
Referenced by _extract_a_range(), _handle_omega_in_mod(), _max_abs_expr(), _min_abs_expr(), _multiply_out_div(), _negate_range(), _p_r_o_of_mod(), _solve_linear_expr(), abs_to_max(), divides_diff(), main(), reverse_loop(), and subsume_relation(). |
|
|
Description: Returns a pointer to an expression for expr1 * expr2.
Definition at line 1923 of file Expression.cc. |
|
|
Description: Returns a pointer to an expression for a unary .NOT.
expression
Definition at line 1943 of file Expression.cc.
References NOT_OP.
Referenced by _combine_other_logicals(), _logical_complement(), _simplify_using_ranges(), add_dummy_eta_assignments_after_loops(), cdg2cfg(), eg_redundant_gate(), extract_ranges(), get_gates_from_trace(), EvolutionGraph::get_trace_details(), implies(), incompatible_gates(), infer_preds(), main(), PredicateRepository::not_pred(), Predicates::Predicates(), and remove_gotos(). |
|
|
Description: Returns a pointer to an expression for an existing Fortran identifier.
Definition at line 1960 of file Expression.cc.
References Symbol::type(). |
|
|
Description: Returns a pointer to a null expression.
Definition at line 2080 of file Expression.cc.
Referenced by _create_new_actual_consts(), _filter_out_mod_params(), GSAFullRangeDict::_get_range_ref(), SSAFullRangeDict::_get_range_ref(), _p_r_o_of_mod(), _pull_ranges_out(), _remove_local_effects_from_expr(), _replace_vars_with_omega(), _subst_vars_in_expr1(), _update_old_consts(), AllocateStmt::AllocateStmt(), ArithmeticIfStmt::ArithmeticIfStmt(), AssignedGotoStmt::AssignedGotoStmt(), AssignStmt::AssignStmt(), build_expr(), CallStmt::CallStmt(), ComputedGotoStmt::ComputedGotoStmt(), IPCPProcData::create_jump_function(), DeallocateStmt::DeallocateStmt(), DoStmt::DoStmt(), ElseIfStmt::ElseIfStmt(), EntryStmt::EntryStmt(), IfStmt::IfStmt(), IOStmt::IOStmt(), last_element_offset(), main(), null_to_omega(), NullifyStmt::NullifyStmt(), parse_expr(), PauseStmt::PauseStmt(), pull_ranges_out(), ReturnStmt::ReturnStmt(), RangeAccessor::set_range(), sink_return_points(), StopStmt::StopStmt(), and WhileStmt::WhileStmt(). |
|
|
Description: Return a pointer to a null expression if the given expression is 0 (NULL).
Otherwise return the given expression.
Definition at line 2086 of file Expression.cc.
References omega().
Referenced by UnaryExpr::_expr(), BinaryExpr::_left(), BinaryExpr::_right(), AllocateStmt::AllocateStmt(), ArithmeticIfStmt::ArithmeticIfStmt(), AssignedGotoStmt::AssignedGotoStmt(), AssignmentStmt::AssignmentStmt(), AssignStmt::AssignStmt(), BinaryExpr::BinaryExpr(), CallStmt::CallStmt(), ComputedGotoStmt::ComputedGotoStmt(), DeallocateStmt::DeallocateStmt(), DoStmt::DoStmt(), ElseIfStmt::ElseIfStmt(), EntryStmt::EntryStmt(), GSAExpr::gate(), IfStmt::IfStmt(), IOStmt::IOStmt(), NullifyStmt::NullifyStmt(), PauseStmt::PauseStmt(), ReturnStmt::ReturnStmt(), StopStmt::StopStmt(), UnaryExpr::UnaryExpr(), and WhileStmt::WhileStmt(). |
| static void _cannot_coerce |
( |
const Type & |
from, |
|
|
EXPR_TYPE |
to |
|
) |
[static] |
|
|
|
Description: Returns a new expression which coerces 'expr' into the same type as that of 'type', IF NECESSARY (if 'expr' is already of the same type as 'type', it returns 'expr' unchanged).
... const char *intrin_name = 0;
Definition at line 2220 of file Expression.cc.
References _assert_can_coerce(), _cannot_coerce(), _coerce(), CHARACTER_TYPE, COMPLEX_TYPE, DOUBLE_PRECISION_TYPE, INTEGER_TYPE, REAL_TYPE, and VOID_TYPE.
Referenced by precalc_loop(). |
| ostream& operator<< |
( |
ostream & |
o, |
|
|
const Expression & |
e |
|
) |
|
|
| int operator_precedence |
( |
const OP_TYPE |
ot |
) |
|
|
|
|
Function used for writing expressions, specifies Fortran 77 operator-precedence.
Definition at line 3125 of file Expression.cc.
References ADD_OP, AND_OP, ARG_OP, COMMA_OP, CONCAT_OP, DIV_OP, EQ_OP, EQV_OP, EXP_OP, GE_OP, GT_OP, INTDIV_OP, LAMBDA_CALL_OP, LE_OP, LT_OP, MULT_OP, NE_OP, NEQV_OP, NOT_OP, OR_OP, PAREN_OP, RATDIV_OP, SUB_OP, U_MINUS_OP, and U_PLUS_OP.
Referenced by print_prec(). |
|
|
print the expression to \'o\', parenthesizing if the precedence calls for it.
... do nothing
... Override and ADD parentheses only if the following ... cases hold. (Pretty much things that are leaves ... don't want parentheses for aesthetic and syntax reasons).
... DO override for anything not specifically specified
... DON'T OVERRIDE FOR THESE LEAF-TYPES
Definition at line 3184 of file Expression.cc.
References ARG_OP, ARRAY_REF_OP, COMMA_OP, Expression::data_ref(), dbx_full_parenthesization, DO_OP, e, EQUAL_OP, EXP_OP, False, FORMAT_OP, FUNCTION_CALL_OP, HOLLERITH_CONSTANT_OP, ID_OP, INTEGER_CONSTANT_OP, INTRINSIC_CALL_OP, IO_STAR_OP, Expression::is_wildcard(), KEY_OP, KEYPAIR_OP, LABEL_OP, LAMBDA_CALL_OP, LOGICAL_CONSTANT_OP, Expression::op(), operator_precedence(), REAL_CONSTANT_OP, RETURN_OP, STRING_CONSTANT_OP, SUBSTRING_OP, True, U_MINUS_OP, U_PLUS_OP, and Expression::value().
Referenced by print_prec_list(). |
|
|
Description: Substitute all occurences of the given variable in the given expression with the given value, then return the result.
... Check to see if symbol matches (if not, there is nothing to do)
else if ((e->op() == ARRAY_REF_OP) && (value.op() == RANGE_OP) && is_var_in_expr(e->subscript(), var)) { delete e; e = new OmegaExpr(); }
Definition at line 7550 of file Expression.cc.
References Expression::arg_list(), DistributeExpr::clone(), e, ID_OP, Expression::op(), substitute_var(), DistributeExpr::symbol(), and List< T >::valid(). |
|
|
_sort_expr_list -
PRE: Assume that all signatures are correct.
Sort the arguments of the given list of expressions.
This method makes sure that all integer constants of the list are on the far left or the far right, for aesthetic reasons. If consts_to_right is true, they are moved to the far right, otherwise the far left. All expressions containing wildcards are moved to the far left (farther than anything else). And, at the far left end of the wildcards are all (if any) wildcards of the type ANY_EXPR_SUBSET_WC.
... We want particularly to do the minimum amount of work necessary for ... the common and simple case, that of the list already being sorted. ... The minimum amount of work necessary in such a case is ... (expr_list.entries() - 1). We will use an insertion sort. This is ... likely the best anyway for small lists. For larger lists, someone ... should implement quicksort or something similar.
... To allow for the already sorted case, we will pull things off of ... the end of expr_list and insert them into the front of new_list.
... Two element expression lists are a very common case, so for speed, ... just do a simple compare-and-swap rather than an entire insertion ... sort for this case.
... Test whether the list has already been sorted. If so, don't ... bother sorting it again.
... Traverse the new list until we hit the end or until ... curr_expr <= new_iter.current()
... *curr_expr <= iter.current() -- insert before iter.current()
... Insert at end of new_list
... Get the next element and insert it
... Now move all elements from new_list back to expr_list
Definition at line 7689 of file Expression.cc.
References Expression::compare(), Iterator< T >::current(), dbx_wildcards_debug_level, List< T >::entries(), expr_list(), False, List< T >::first_ref(), List< T >::fix_size(), List< T >::grab(), List< T >::ins_before(), List< T >::ins_last(), List< T >::last_ref(), List< T >::prev_ref(), Iterator< T >::set_to_last(), List< T >::static_size(), List< T >::unfix_size(), and Iterator< T >::valid().
Referenced by IntrinsicCallExpr::_combine_top(), _standardize_top(), Expression::standardize(), and test_expr_str(). |
|
|
wildcard_args_are_equal(expr1, expr2, consider_side_effects) - Return True if all args of expr1 match those of expr2 either by exact equality or by wildcard matching.
Only expr2 is allowed to have wildcards, and it is assumed that expr2 itselfs is NOT a wild card, because that case should have been handled elsewhere.
NOTE: This function is inlined because the case in which there are no wildcard subexpressions is very small and should be efficient.
Also, there are only a few places in this code where this routine is called.
Definition at line 8494 of file Expression.cc.
References _non_wc_match(), Expression::_wildcard_is_equal_to(), False, ExprSignature::has_wildcard(), Expression::signature(), and True.
Referenced by BinaryExpr::_args_are_equal(), and UnaryExpr::_args_are_equal(). |
|
|
Note: Whatever is returned has entire correct signatures and is still in standardized form.
NULL is returned if the expression was not replaced (i.e., either it did not match, or calling 'rep_options.semantic_check_func' resulted in False, or this was a traversal with no replacements). continue_traversal is set to True if recursive traversal should continue, or else to False if it should not continue in the direction it was going. It will be True if no match was found or if traverse() was the interface routine called and we are operating in RECURSIVE_REPLACE mode.
... If we have a match on the parent...
... Did not match -- return 0 to indicate no replacement done
... We have a syntactic match
... First try checking semantics constraints, if any
... Semantic constraints failed -- no replacement to take place ... We need to invalidate the current matches before continuing
... If we are doing a simple traversal (i.e. not a replace)
... Since we are just doing a traversal and do not want any changes, ... we call the traversal action function and return without ... changing anything.
... If this is non-recursive, then subtrees should not ... be checked for more patterns
... We need to invalidate current matches before continuing
... signal no changes
... -- We are doing a replace() --
... No need to continue recursive traversing in calling routine, ... since we handle our own recursion here if necessary.
... Get a replacement value
... This subexpression has a parent, so the subexpression must be ... first removed from the parent ('pulled').
... (User responsible for garbage collecting 'e')
... No replacement function specified -- throw away the current ... expression and replace it with a copy of the replacement ... expression, which is what 'orep_options.extra_info' is ... pointing to
... Our pattern may contain wildcards with hooks to subexpressions ... with the old expression that we matched. ... These hooks are now invalid, since that subtree has been ... replaced, so we need to "backtrack" through the pattern, ... backing up all hooks.
... (Re)create the signature for the new expression
... We are operating recursively, so try again on the ... replacement expression itself. This one will also operate ... recursively, so this is only necessary once.
... (Notice that the parent_ref is 0 since we have disconnected ... this expression from its parent
... Now, then, return the replacement value (after inserting it into the ... parent, if any)
Definition at line 8706 of file Expression.cc.
References Expression::_backup(), _replace_or_traverse_aux(), Expression::_wildcard_is_equal_to(), Expression::arg_list(), Expression::clone(), Expression::create_signature(), Expression::data(), e, False, List< T >::index(), NON_RECURSIVE_REPLACE, List< T >::pull(), RECURSIVE_REPLACE, and True.
Referenced by _replace_or_traverse_aux(). |
|
|
Note: This function has been declared 'friend' to Expression.
... new_parent already has correct signature and standardized ... form, so return the replacement
... Stop the traversal here
... Now check children
... For INORDER_REPLACE, we must check the parent after the first ... argument (if any). To do this properly, we unroll the first ... iteration of the children loop and check the parent after the ... first iteration (whether or not it is empty)
... Loop init
... First iteration
... Check for parent
... new_parent already has correct signature and ... standardized form, so return the replacement
... Stop traversal here
... Now for the rest of the children, if any
... If any of the children were changed, the ordering of children may ... no longer be standard for a commutative expression, so update
... new_parent already has correct signature and standardized ... form, so return the replacement
... Stop traversal here
... this should still be entirely up-to-date with signature and form
Definition at line 8839 of file Expression.cc.
References _replace_check_parent(), Expression::arg_list(), Iterator< T >::current(), e, False, INORDER_REPLACE, POSTORDER_REPLACE, PREORDER_REPLACE, Expression::update_signature(), and Iterator< T >::valid().
Referenced by _replace_check_parent(), and _replace_or_traverse(). |
|
|
Holds the options to simplify.
Ownership for the given expression is transferred to this routine.
Definition at line 9807 of file Expression.cc.
References _fold_divisible_top(), _s_constant(), _standardize_top(), ADD_OP, Expression::arg_list(), Mutator< T >::assign(), Iterator< T >::current(), Expression::data(), Expression::data_ref(), Mutator< T >::del(), e, List< T >::entries(), Expression::expr(), List< T >::first_ref(), List< T >::grab(), Expression::grab_expr(), INFINITY_OP, List< T >::ins_first(), INTEGER_CONSTANT_OP, mul(), MULT_OP, Expression::op(), PAREN_OP, Mutator< T >::pull(), REAL_CONSTANT_OP, Expression::sign(), Expression::str_data(), Iterator< T >::valid(), and Expression::value().
Referenced by _pull_out_divisible(). |
|
|
logical_complement Perform a logical complement on myself.
... Use the first argument.
Definition at line 9902 of file Expression.cc.
References Expression::_fold_top(), _modify_expr(), _standardize_top(), AND_OP, Expression::arg_list(), Mutator< T >::assign(), DistributeExpr::clone(), Iterator< T >::current(), Expression::data(), e, List< T >::entries(), EQ_OP, EQV_OP, Expression::expr(), GE_OP, Expression::grab_expr(), GT_OP, LE_OP, LOGICAL_CONSTANT_OP, LT_OP, NE_OP, NEQV_OP, not(), NOT_OP, Expression::op(), OR_OP, PAREN_OP, Mutator< T >::pull(), Iterator< T >::reset(), Expression::str_data(), and Iterator< T >::valid().
Referenced by _push_down_nots(). |
| static int _lgcd |
( |
int |
a, |
|
|
int |
b |
|
) |
[static] |
|
| static void _pull_out_divisible |
( |
Expression & |
expr, |
|
|
int |
divisor, |
|
|
Expression & |
pulled_terms |
|
) |
[static] |
|
|
|
_pull_out_divisible Pull out all terms in the addition expression that are divisible by the given integer, divide them by that integer, and place them in the pulled_terms addition expression.
Definition at line 10769 of file Expression.cc.
References _additive_inverse(), Expression::_divide_by_int(), Expression::_gcd(), _modify_expr(), _s_constant(), _standardize_top(), ADD_OP, Expression::arg_list(), Iterator< T >::current(), Mutator< T >::del(), Mutator< T >::grab(), List< T >::ins_last(), INTEGER_CONSTANT_OP, Expression::op(), Iterator< T >::valid(), and Expression::value(). |
|
|
combine_min_max Combine all terms with equal symbolic parts in the given argument list for an min or max expression.
... If the Expression has two arguments and one of them is an integer, ... then we know that we cannot combine any symbolic terms and hence do ... not need to do the analysis
... Value number and combine the expressions
... Rebuild the current subnode's signature,
... since we just modified it
... Put the combined arguments back into the expression
Definition at line 13043 of file Expression.cc.
References _loc_in_siglist(), _loc_of_integer_constant(), _s_constant(), _standardize_top(), add(), ADD_OP, Expression::arg_list(), ExprCountElem::count(), Iterator< T >::current(), List< T >::del(), List< T >::entries(), ExprCountElem::expr_ref(), List< T >::first_ref(), List< T >::grab(), List< T >::ins_first(), List< T >::ins_last(), INTEGER_CONSTANT_OP, is_max(), min(), Expression::op(), Expression::update_signature(), Iterator< T >::valid(), and Expression::value().
Referenced by IntrinsicCallExpr::_combine_top(). |
|
|
combine_int_relations Combine terms in a logical AND or OR expression.
Both identical terms and terms and their negations are combined. Only integer relation operations are combined
... Value number and combine the expressions
... Pull the additive integer term out of the relation expression
... Store the relation expression without its constant offset in ... the siglist, if it isn't there already.
... Combine X-1<=0 .AND. X-2<=0 into X-1<=0 ... or X-1<=0 .OR. X-2<=0 into X-2<=0
... Expression already exists
... Combine X==1 .AND. X==2 into .FALSE. ... or X!=1 .OR. X!=2 into .TRUE.
... Put the combined arguments back into the expression
... Try to cancel out relation expressions with their negations. ... If not possible, put the combined relation back into the ... expression.
... First, try to find the relation`s negation in the siglist
... The negation expression exists, so try to see if it cancels ... out the current expression.
... count_sum is essentially the difference between ... the upper and lower bounds (lower - upper)
... Combine x-1<=0 .AND. -x-2<=0 into .FALSE.
... Combine x-1<=0 .AND. -x-1<=0 into x-1==0
... Combine x-1<=0 .OR. -x-2<=0 into .TRUE.
... Combine x-1<=0 .OR. -x+3<=0 into x-2!=0
... combined_expr->op() == EQ_OP or NE_OP
... Combine x==0 .AND. x!=0 into .FALSE. ... or x==0 .OR. x!=0 into .TRUE.
... Combine x==0 .AND. x-1!=0 into x==0 ... or x==0 .OR. x-1!=0 into x-1!=0
... Put the extracted integer constant back into the relation
Definition at line 12724 of file Expression.cc.
References _is_not_in_siglist(), _is_relation(), _loc_in_siglist(), _loc_of_integer_constant(), _s_constant(), _standardize_top(), add(), ADD_OP, AND_OP, Expression::arg_list(), Expression::clone(), ExprCountElem::count(), Iterator< T >::current(), List< T >::del(), List< T >::entries(), EQ_OP, ExprCountElem::expr_ref(), False, List< T >::first_ref(), List< T >::grab(), Mutator< T >::grab(), Expression::grab_left(), List< T >::ins_first(), List< T >::ins_last(), INTEGER_TYPE, is_integer_zero(), LE_OP, Expression::left(), Expression::left_guarded(), min(), NE_OP, Expression::op(), OR_OP, Expression::right_guarded(), True, Expression::type(), Iterator< T >::valid(), and Expression::value(). |
|
|
combine_other_logicals Combine terms in a logical AND or OR expression.
Both identical terms and terms and their negations are combined. Only terms that are not relationships between integer expressions are combined.
... Value number and combine the expressions
... is_bottom is true if the expression would simplify to .FALSE. for an ... .AND. expression or .TRUE. for an .OR. expression
... Combine P .AND. P into P or P .AND. .NOT. P into .FALSE. ... or P .OR. P into P or P .OR. .NOT. P into .TRUE.
... Put the combined arguments back into the expression
... Combine x<=0 .AND. -x<0 into .FALSE. ... or x<=0 .OR. -x<0 into .TRUE.
Definition at line 12947 of file Expression.cc.
References _is_relation(), _loc_in_siglist(), _standardize_top(), Expression::clone(), ExprCountElem::count(), Iterator< T >::current(), List< T >::entries(), ExprCountElem::expr_ref(), False, List< T >::first_ref(), List< T >::grab(), Mutator< T >::grab(), Expression::grab_expr(), List< T >::ins_last(), INTEGER_TYPE, Expression::left_guarded(), not(), NOT_OP, Expression::op(), Expression::right_guarded(), True, Expression::type(), and Iterator< T >::valid(). |
| static Expression* _s_constant |
( |
int |
value |
) |
[static] |
|
| static Expression* _s_constant |
( |
const char * |
data_string |
) |
[static] |
|
| static void _standardize_top |
( |
Expression & |
e |
) |
[static] |
|
|
|
_standardize_top Put the top-level expression into standard form then update the signature for the top-level expression.
Definition at line 9236 of file Expression.cc.
References _simplify_options, _sort_expr_list(), Expression::arg_list(), e, is_commutative(), Expression::op(), and Expression::update_signature().
Referenced by _additive_inverse(), _calc_factor(), _combine_int_relations(), _combine_min_max(), _combine_other_logicals(), NonBinaryExpr::_divide_by_int(), _fold_divisible_in_plus(), _logical_complement(), _pull_out_divisible(), _remove_ratdivs(), _simplify(), simplify_top(), and sym_factors(). |
| Boolean is_commutative_intrinsic_name |
( |
const char * |
name |
) |
|
|
|
|
expr_can_contain_omega Return True if it is allowable to have omega in the expression's arguments
Definition at line 9265 of file Expression.cc.
References ARRAY_REF_OP, COLON_OP, COMMA_OP, CONCAT_OP, DO_OP, ETA_OP, False, FORMAT_OP, GAMMA_OP, IO_STAR_OP, MU_OP, RETURN_OP, SUBSTRING_OP, THETA_OP, and True.
Referenced by NonBinaryExpr::_fold_top(), BinaryExpr::_fold_top(), and UnaryExpr::_fold_top(). |
|
|
_push_down_nots Push any NOT expressions as deeply in the expression's arguments as possible.
This routine is needed to pervent the simplifier from distributing argument of the NOT expression, resulting in a large AND of OR expressions, then negating this expression into an OR of AND expressions, then distributing this expression again into a monstrous AND of OR expressions.
Definition at line 9314 of file Expression.cc.
References _logical_complement(), _push_down_args_nots(), and NOT_OP.
Referenced by _push_down_args_nots(), and simplify(). |
| static void _push_down_args_nots |
( |
Expression & |
expr |
) |
[static] |
|
| static void _remove_ratdivs |
( |
Expression & |
expr, |
|
|
Boolean & |
signature_needs_updating |
|
) |
[static] |
|
|
|
_remove_ratdivs Replace all RATDIV_OP and INTDIV_OP operators with DIV_OP operators.
Definition at line 9332 of file Expression.cc.
References _standardize_top(), Expression::arg_list(), Iterator< T >::current(), DIV_OP, False, INTDIV_OP, Expression::op(), RATDIV_OP, True, and Iterator< T >::valid().
Referenced by _remove_ratdivs(), and simplify(). |
| static void _remove_ratdivs |
( |
Expression & |
expr |
) |
[static] |
|
| static void _read_simplify_opts |
( |
|
) |
[static] |
|
| void reset_simplifier_opts |
( |
|
) |
|
|
| void set_simplifier_opts |
( |
|
) |
|
|
|
|
simplify Simplify the given expression
... The expression's signature really doesn't need to be cleared, but it ... makes signature updating errors more prominant.
... new_expr->_signature.clear();
... Don't bother simplifying integers and variables, since they cannot ... be simplified any further. (Just an optimization.)
... Simplify the expression's arguments.
... Don't bother simplifying args that are integers and variables, ... since they cannot be simplified any further.
Definition at line 9432 of file Expression.cc.
References _standardize_top(), Expression::arg_list(), Mutator< T >::assign(), Iterator< T >::current(), e, ID_OP, INTEGER_CONSTANT_OP, Expression::op(), Mutator< T >::pull(), simplify_top(), and Iterator< T >::valid().
Referenced by _fold_divisible_in_div(), and simplify(). |
|
|
Definition at line 9477 of file Expression.cc.
References add(), ADD_OP, Expression::clone(), constant(), Iterator< T >::current(), eq(), EQ_OP, INTEGER_CONSTANT_OP, mul(), MULT_OP, ne(), NE_OP, and Iterator< T >::valid().
Referenced by _simplify_div_int(). |
| static void extract_possible_factors |
( |
Expression & |
expr, |
|
|
set< int > & |
factors |
|
) |
[static] |
|
|
|
Extract integer constant factors common to all terms.
Save only strictly positive absolute values.
Definition at line 9562 of file Expression.cc.
References ADD_OP, Iterator< T >::current(), EQ_OP, GE_OP, GT_OP, INTEGER_CONSTANT_OP, LE_OP, LT_OP, MULT_OP, NE_OP, and Iterator< T >::valid().
Referenced by _simplify_div_int(). |
|
|
Simplify the given expression, and return the simplified result.
... Make sure the types are right throughout the tree
Definition at line 9616 of file Expression.cc.
References _push_down_nots(), _read_simplify_opts(), _remove_ratdivs(), _simplify(), _simplify_div_int(), _simplify_options, e, and propagate_expr_types().
Referenced by EvolutionGraph::_add_evolutions(), EvolutionGraph::_compute_cyclic_evolutions(), _eg_forward_substitute(), _exit_range(), _extract_a_range(), _forward_diff(), _get_array_ref_preds(), _invert_expr(), EvolutionGraph::_local_range(), _loop_index_last_val(), _loop_range(), _make_range(), _max_abs_expr(), _multiply_out_divs_for_var(), _p_r_o_of_add(), _p_r_o_of_exp(), EvolutionGraph::_possible_ranges(), EvolutionGraph::_relax(), _remove_mods_with_var(), _remove_truncates1(), _simplify_using_ranges(), _simplify_var_mods(), _solve_linear_expr(), _subst_var_in_stmt(), _update_assign_succs(), _update_do_succs(), abs_to_max(), add_dummy_eta_assignments_after_loops(), and_predicate(), ar_interleave(), ar_subregion(), array_element_count(), at_least_one_iteration(), base_offset(), build_in_out_set(), AbstractAccess::calc_overlap(), cdg2cfg(), coalese_loop(), RangeComparator::compare(), AbstractAccess::compute_new_dimension(), compute_top(), compute_top_range_from_actuals(), conformable_test(), contiguous_aggregation(), Predicates::contradicts(), AbstractAccess::convert_size(), divides_diff(), eg_distance(), eg_distance_1_dim(), eg_forward_substitute(), eg_redundant_gate(), elim_known_facts(), eliminate_loop(), enforce_standard_within_bounds(), expand_substituted(), expr_divides(), expr_expand_substituted(), extract_ranges(), extract_stride(), Directive::generate_omp_parallel_directive(), get_gates_from_trace(), EvolutionGraph::get_trace_details(), included(), incompatible_gates(), infer_preds(), int_const_val(), intersect_ARDs(), intersect_ranges(), is_affine(), iteration_count(), last_element_offset(), last_value(), linearize_zero_registered(), main(), make_bytesize_expr(), may_be_reduction(), EvolutionGraph::min_distance(), normalize_loop(), PredicateRepository::not_pred(), Evolution< Value >::operator *=(), Evolution< Value >::operator+=(), or_predicate(), p_greater_equal(), p_greater_than(), p_less_equal(), p_less_than(), parse_range(), peel_loop_first(), peel_loop_last(), EvolutionGraph::perfect_trace_from_mu(), Predicates::Predicates(), preroll_loop(), program_wide_range(), InlineObject::remap_arg_names(), AbstractAccess::remap_interface_vars(), remove_gotos(), replace_expression(), replace_lambda_call(), replace_symbol(), reshape_array(), reverse_loop(), same_gate(), simplify_control_flow(), simplify_descriptors(), simplify_expressions(), Statement::simplify_expressions(), StmtRanges::simplify_min_max(), simplify_subs_exprs(), VariableSymbol::size(), stripmine_horiz_loop(), stripmine_vert_loop(), EvolutionGraph::substitute(), substitute_parameters(), subsume_relation(), subtract_evolution(), Summation::sum(), test_expr_str(), test_monotonicity(), translate_and_reshape(), AbstractAccess::try_coalescing(), union_ranges(), and unroll_loop(). |
| int _nearer_to_zero |
( |
int |
x, |
|
|
int |
y |
|
) |
[inline] |
|
|
|
calc_factors Determine whether the given expression is a factor of the given pair of expressions.
If so, add this factor to the given list of factors.
Definition at line 10233 of file Expression.cc.
References _nearer_to_zero(), _power_of_factor(), _s_constant(), _standardize_top(), Expression::clone(), EXP_OP, exponent(), INTEGER_CONSTANT_OP, Expression::left_guarded(), Expression::right_guarded(), and Expression::value().
Referenced by _sym_factor(). |
|
|
divide_by_factor Divide the given expression by the given symbolic factor.
Definition at line 10271 of file Expression.cc.
References _power_of_factor(), ADD_OP, Expression::arg_list(), Mutator< T >::assign(), constant(), Iterator< T >::current(), Mutator< T >::del(), EXP_OP, List< T >::grab(), Expression::grab_left(), INTEGER_CONSTANT_OP, is_integer_one(), MULT_OP, Mutator< T >::pull(), Expression::right_guarded(), Iterator< T >::valid(), and Expression::value().
Referenced by _divide_by_factor(). |
|
|
sym_factor Remove all common factors from the given pair of expressions and place these factors in the given list.
This function currently cannot perform full factorization, (e.g., factor x+1 out of x**2 + 2*x + 1). This function cannot also handle integer factorization (e.g, factor 3 out of 9 and 12).
... Calculate the common symbolic factors of expr1 and expr2.
... Remove the common symbolic factors from expr1 and expr2.
Definition at line 10377 of file Expression.cc.
References _calc_factor(), _divide_by_factor(), ADD_OP, Expression::arg_list(), Iterator< T >::current(), List< T >::first_ref(), MULT_OP, Expression::op(), Expression::standardize(), and Iterator< T >::valid(). |
|
|
Factor the given sum-of-products expression and return a list of factors (ID_OPs), and also the Expression resulting from dividing sum_of_prods by the factors as the function result.
So, given the expression A*B + A*C + A + N*A*C, it would return the list of factors: A.
... Verify sum-of-products form
... Only useful for sum-of-products
... Develop a list of all the possible variables which could be factors of the expr
... For IDs, only allow one and save it - it will be the only candidate
... If no possible factors, return
... Calculate the common symbolic factors of the list of exprs
... Check whether the possible_factor was a factor of every sub-expression in the ADD_OP
... Remove the common symbolic factors from all terms of the ADD_OP
Definition at line 10414 of file Expression.cc.
References _divide_by_factor(), _nearer_to_zero(), _power_of_factor(), _s_constant(), _standardize_top(), ADD_OP, Expression::arg_list(), Mutator< T >::assign(), Expression::base_variable_ref(), RefSet< T >::clear(), Iterator< T >::current(), RefSet< T >::entries(), EXP_OP, exponent(), id(), ID_OP, RefSet< T >::ins(), MULT_OP, Expression::op(), Mutator< T >::pull(), Iterator< T >::reset(), Expression::simplify, Expression::standardize(), Expression::update_signature(), and Iterator< T >::valid().
Referenced by intersect_ARDs(). |
|
|
*loc_in_siglist*
This function assumes that the hash_values of all expressions involved are up-to-date.
Attempt to find the given Expression in the given list (this is for the purpose of finding out whether the given expression is structurally equivalent to an expression on the list).
If the Expression's hash value doesn't match any of the hash values in the list, then it is definitely not structurally the same as any in the list. If the hash value matches the hash value of an Expression on the list, then use "compare" to further check structural equality. "Compare" returns 0 if the two expressions are structurally equal.
Definition at line 12069 of file Expression.cc.
References Expression::compare(), Iterator< T >::current(), e, ExprCountElem::expr_ref(), ExprSignature::has_fn_call(), ExprSignature::hash_value(), Expression::signature(), and Iterator< T >::valid().
Referenced by _combine_int_relations(), _combine_min_max(), _combine_other_logicals(), and _remove_duplicates(). |
|
|
*loc_in_siglist_expon*
This is analogous to loc_in_siglist, but for ExprExponentElems.
This function assumes that the hash_values of all expressions involved are up-to-date.
Attempt to find the given Expression in the given list (this is for the purpose of finding out whether the given expression is structurally equivalent to an expression on the list).
If the Expression's hash value doesn't match any of the hash values in the list, then it is definitely not structurally the same as any in the list. If the hash value matches the hash value of an Expression on the list, then use "compare" to further check structural equality. "Compare" returns 0 if the two expressions are structurally equal.
Definition at line 12111 of file Expression.cc.
References Expression::compare(), Iterator< T >::current(), e, ExprExponentElem::expr_ref(), ExprSignature::has_fn_call(), ExprSignature::hash_value(), Expression::signature(), and Iterator< T >::valid(). |
|
|
_is_not_in_siglist Returns true if the siglist does not contain an ExprCountElem with the given expression and count fields.
Definition at line 12138 of file Expression.cc.
References Expression::compare(), ExprCountElem::count(), Iterator< T >::current(), e, ExprCountElem::expr_ref(), False, ExprSignature::has_fn_call(), ExprSignature::hash_value(), Expression::signature(), True, and Iterator< T >::valid().
Referenced by _combine_int_relations(). |
| static int _var_power_in_expr |
( |
const Expression & |
expr, |
|
|
const Symbol & |
var |
|
) |
[static] |
|
|
|
is_evenly_divisible_for_var Try to prove by induction that the given expression is evenly divisible in respect to the given variable.
This is done by induction. For the base case, it first tries to prove that the expression is evenly divisible with var=0. Then, for the inductive step, it tries to prove recursively that the forward difference of the expression (i.e., expr(var+1) - expr(var)) is evenly divisible. (The recursion was transformed into a while loop for efficiency.)
... Delta is trivially evenly divisible.
Definition at line 13284 of file Expression.cc.
References Expression::_gcd(), _is_base_case_evenly_divisible(), _var_power_in_expr(), add(), Expression::clone(), constant(), False, Expression::simplify, sub(), and substitute_var().
Referenced by _is_evenly_divisible1(). |
|
|
... Weed out any trivial cases
... Collect the set of top level scalars in the expression.
... Remove any scalars that are of power 1, since the expr._gcd() divisor ... test above guarantees that that the expression will not be evenly ... divisible in respect to these variables.
Definition at line 13361 of file Expression.cc.
References _get_top_scalars(), _is_evenly_divisible1(), _var_power_in_expr(), Iterator< T >::current(), Mutator< T >::del(), RefSet< T >::entries(), False, ID_OP, switch_value(), True, and Iterator< T >::valid().
Referenced by _multiply_out_div(), _remove_truncates1(), and Summation::sum_aux(). |
|
|
fold_divisible_in_mult Merge all division expressions whose denominator evenly divides their numerator in a multiplication expression
... Merge all the divisible expressions into a single expression
... new_denom *= divis.right_guarded().value();
... _s_constant(new_denom));
... Multiply the numerator of the merged divisible expression with the ... other factors.
... Simplify the merged expression.
Definition at line 13428 of file Expression.cc.
References _grab_divisible(), Expression::arg_list(), Iterator< T >::current(), div(), List< T >::entries(), List< T >::first_ref(), Mutator< T >::grab(), List< T >::grab(), Expression::grab_left(), Expression::grab_right(), List< T >::ins_first(), List< T >::ins_last(), Expression::left(), Expression::left_guarded(), MULT_OP, NonBinaryExpr::NonBinaryExpr(), Expression::op(), RATDIV_OP, simplify_top(), and Iterator< T >::valid().
Referenced by _fold_divisible_top(). |
| static int _num_divisible_candidates |
( |
const Expression & |
expr |
) |
[static] |
|
|
|
fold_divisible_in_plus Merge all division expressions whose denominator evenly divides their numerator in an addition expression.
... Calculate the least common multiple of the denominators of the ... evenly divisible division expressions.
... Merge all the divisible expressions into a single expression
... Simplify the merged evenly divisible expression.
Definition at line 13541 of file Expression.cc.
References _grab_divisible(), _lgcd(), _modify_expr(), _num_divisible_candidates(), _s_constant(), _standardize_top(), ADD_OP, Expression::arg_list(), Iterator< T >::current(), div(), List< T >::entries(), List< T >::first_ref(), List< T >::grab(), Expression::grab_left(), List< T >::ins_last(), INTEGER_CONSTANT_OP, MU_OP, mul(), NonBinaryExpr::NonBinaryExpr(), Expression::op(), RATDIV_OP, Iterator< T >::reset(), Expression::right_guarded(), simplify_top(), Iterator< T >::valid(), and Expression::value().
Referenced by _fold_divisible_top(). |
|
|
_fold_divisible_in_div Check for exponentiations in a division, and simplify where possible.
Two cases checked for now:
1. (X**Y) / X == X**(Y-1)
2. (x**Y) / (X**Z) == X**(Y-Z)
... Left operand is an exponentiation of an integer or a variable ... check right base
... Now, we know we are dividing two exponentials. ... Check whether the bases are the same
... Now we know we have the same integer constant as a base
... So, we have ID_OPs as bases
... Now we know we have the same variable for both bases
... Now we know that we have the same integer constant as a base
... Now we know that we have the same variable as a base
Definition at line 13627 of file Expression.cc.
References _simplify(), Expression::clone(), constant(), EXP_OP, exponent(), ID_OP, INTDIV_OP, INTEGER_CONSTANT_OP, Expression::left_guarded(), Expression::op(), Expression::right_guarded(), sub(), Expression::symbol(), and Expression::value().
Referenced by _fold_divisible_top(). |
Variable Documentation
|
|
Definition at line 9161 of file Expression.cc.
Referenced by IntrinsicCallExpr::_combine_top(), NonBinaryExpr::_combine_top(), NonBinaryExpr::_distribute_top(), _fold_divisible_top(), IntrinsicCallExpr::_fold_top(), NonBinaryExpr::_fold_top(), BinaryExpr::_fold_top(), UnaryExpr::_fold_top(), _read_simplify_opts(), _s_constant(), _standardize_top(), reset_simplifier_opts(), set_simplifier_opts(), and simplify(). |
|