Polaris: Expression.cc File Reference

Expression.cc File Reference

Expression - 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))
Expressionconstant (int value)
 Description: Returns a pointer to an expression for a Fortran INTEGER_CONST_EXPR.
Expressionconstant (const char *data_string)
 Description: Returns a pointer to an expression for a Fortran constant specified as a char string.
Expressionkeyword (const char *data_string)
 Description: Create a keyword node for the keypair function.
Expressioncomplex (Expression *real, Expression *imag)
Expressionarray_reference (Expression *array, Expression *subscripts)
 Description: Returns a pointer to an expression for a Fortran Complex constant.
static Expressioncreate_nonbinary (List< Expression > *args, OP_TYPE op_type, const char *func_name)
Expressionadd (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for expr1 + expr2.
Expressionadd (List< Expression > *args)
 Description: Returns a pointer to an expression for (*args)[0] + (*args)[1] + (*args)[2] + ...
Expressionsub (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for expr1 - expr2.
Expressionmul (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for expr1 * expr2.
Expressionmul (List< Expression > *args)
 Description: Returns a pointer to an expression for (*args)[0] * (*args)[1] * (*args)[2] * ...
Expressiondiv (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for expr1 / expr2.
Expressionexponent (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for expr1 ** expr2.
Expressionkeypair (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for a Fortran MASK=X expression.
Expressioneq (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for a Fortran .EQ.
Expressionne (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for a Fortran .NE.
Expressionlt (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for a Fortran .LT.
Expressionle (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for a Fortran .LE.
Expressiongt (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for a Fortran .GT.
Expressionge (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for a Fortran .GE.
Expressionor (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for expr1 .OR.
Expressionor (List< Expression > *args)
 Description: Returns a pointer to an expression for (*args)[0] .OR.
Expressionand (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for expr1 .AND.
Expressionand (List< Expression > *args)
 Description: Returns a pointer to an expression for (*args)[0] .AND.
Expressioneqv (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for expr1 .EQV.
Expressioneqv (List< Expression > *args)
 Description: Returns a pointer to an expression for (*args)[0] .EQV.
Expressionneqv (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for expr1 .NEQV.
Expressionneqv (List< Expression > *args)
 Description: Returns a pointer to an expression for (*args)[0] .NEQV.
Expressionfunction_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.
Expressionintrinsic_call (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for a Fortran intrinsic call.
Expressionsubstring (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for a Fortran substring expression.
Expressionconcat (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for expr1 // expr2.
Expressioncolon (Expression *expr1, Expression *expr2, Expression *expr3 GIV(0))
Expressioncolon (List< Expression > *args)
Expressioncomma (List< Expression > *args)
 Description: Returns a pointer to an expression for (*args)[0] , (*args)[1] , (*args)[2] , ...
Expressioncomma (Expression *expr1, Expression *expr2, Expression *expr3 GIV(0), Expression *expr4 GIV(0), Expression *expr5 GIV(0))
Expressioncomma (Expression *expr1)
 Description: Returns a pointer to an expression for a CommaExpr.
Expressioncomma ()
 Description: Returns a pointer to an expression for a CommaExpr with no arguments.
Expressionunary_plus (Expression *expr)
 Description: Returns a pointer to an expression for a unary plus expression.
Expressionunary_minus (Expression *expr)
 Description: Returns a pointer to an expression for a unary minus expression.
Expressiondo_expression (Expression *expr1, Expression *expr2)
 Description: Returns a pointer to an expression for expr1 * expr2.
Expressionequal (Expression *index, Expression *iter_space)
 Description: Returns a pointer to an expression for an EqualExpr (e.g.
Expressionnot (Expression *expr)
 Description: Returns a pointer to an expression for a unary .NOT.
Expressionparen (Expression *expr)
 Description: Returns a pointer to a parenthesized expression.
Expressionid (const char *varname, const ProgramUnit &pgm)
 Description: Returns a pointer to an expression for an existing Fortran identifier.
Expressionid (const Symbol &symbol)
 Description: Returns a pointer to an expression for an existing Fortran symbol.
Expressionnew_variable (const char *varname, const Type &t, ProgramUnit &pgm)
 Description: Returns a pointer to an expression for a new Fortran identifier.
Expressionnew_function (const char *funname, const Type &t, ProgramUnit &pgm)
 Description: Returns a pointer to an expression for a new Fortran function identifier.
Expressionnew_intrinsic (const char *funname, const Type &t, ProgramUnit &pgm)
 Description: Returns a pointer to an expression for a new Fortran intrinsic function identifier.
Expressionnew_subroutine (const char *funname, ProgramUnit &pgm)
 Description: Returns a pointer to an expression for a new Fortran subroutine identifier.
Expressionnew_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))
Expressionomega ()
 Description: Returns a pointer to a null expression.
Expressionnull_to_omega (Expression *expr)
 Description: Return a pointer to a null expression if the given expression is 0 (NULL).
Expressioninfinity (int s GIV(1))
Expressionalpha (Expression *parameters)
 Description: Create a alpha GSA function with the given parameters.
Expressiongamma (Expression *gate, Expression *parameters)
 Description: Create a gamma GSA function with the given gate function and parameters.
Expressionmu (Expression *parameters)
 Description: Create a mu GSA function with the given parameters.
Expressiontheta (Expression *parameters)
Expressioneta (Expression *gate, Expression *parameters)
 ... from Expression.cc
Expressionmu (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)
Expressioncoerce (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.
Expressionsubstitute_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.
Expressionreplace (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
Expressionreplace (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))
Expressionreplace (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))
Expressionreplace (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.
Expressionsimplify_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 Expressioncheck_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.
Expressionsimplify (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.
Expressionsym_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.
Expressionsum (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

enum INVALID_CHECK
 

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

double ceil double   ) 
 

#include <math.h>

double floor double   ) 
 

Referenced by main().

void set_subst_field_print  ) 
 

----- not for public use ----------

Definition at line 234 of file Expression.cc.

References subst_field_print.

Referenced by Program::read().

Boolean is_commutative OP_TYPE  op  ) 
 

Description: Returns 1 iff 'op' is a commutative operator.

Definition at line 264 of file Expression.cc.

References ADD_OP, AND_OP, EQV_OP, False, MULT_OP, NEQV_OP, OR_OP, and True.

Referenced by _standardize_top(), same_commutative(), and Expression::standardize().

Boolean is_conjunctive_op OP_TYPE  op  ) 
 

Description: Returns 1 iff 'op' is a conjunctive operator.

Definition at line 281 of file Expression.cc.

References AND_OP, EQV_OP, False, NEQV_OP, OR_OP, and True.

Boolean is_relational_op OP_TYPE  op  ) 
 

Description: Returns 1 iff 'op' is a relational operator.

Definition at line 296 of file Expression.cc.

References EQ_OP, False, GE_OP, GT_OP, LE_OP, LT_OP, NE_OP, and True.

Referenced by _elim_known_facts(), and subsume_relation().

Boolean is_logical_false const Expression e  ) 
 

Description: Returns 1 iff 'e' is a LOGICAL_CONSTANT_OP and == .FALSE.

Definition at line 335 of file Expression.cc.

References e, LOGICAL_CONSTANT_OP, Expression::op(), and Expression::str_data().

Referenced by EvolutionGraph::_add_evolutions(), and Predicates::contradicts().

Boolean is_integer_zero const Expression e  ) 
 

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().

Boolean is_integer_one const Expression e  ) 
 

Description: Returns 1 iff 'e' is an INTEGER_CONSTANT_OP and == 1.

Definition at line 347 of file Expression.cc.

References e, INTEGER_CONSTANT_OP, Expression::op(), and Expression::value().

Referenced by _divide_by_factor1(), _p_r_o_of_add(), ar_subregion(), and expr_divides().

Boolean is_integer_constant const Expression e  ) 
 

Description: Returns 1 iff 'e' is an INTEGER_CONSTANT_OP.

Definition at line 353 of file Expression.cc.

References e, INTEGER_CONSTANT_OP, and Expression::op().

Boolean is_integer_constant const Expression e,
int  val
 

Description: Returns 1 iff 'e' is an INTEGER_CONSTANT_OP with the given value.

Definition at line 359 of file Expression.cc.

References e, INTEGER_CONSTANT_OP, Expression::op(), and Expression::value().

bool is_phi_function const Expression e  ) 
 

Description: Returns true iff 'e' is a GSA phi function (GAMMA or MU).

Definition at line 365 of file Expression.cc.

References e, ETA_OP, GAMMA_OP, MU_OP, Expression::op(), and THETA_OP.

bool is_pseudo_function const Expression e  ) 
 

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
 

Report an error in an intrinsic parameter.

These are called as part of the pre-pass.

Definition at line 462 of file Expression.cc.

Referenced by compute_intrinsic_type().

void compute_intrinsic_type Expression expr  ) 
 

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().

void propagate_expr_types Expression expr  ) 
 

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 Boolean is_arithmetic_type EXPR_TYPE  type  )  [static]
 

Definition at line 1038 of file Expression.cc.

References COMPLEX_TYPE, DOUBLE_PRECISION_TYPE, INTEGER_TYPE, and REAL_TYPE.

Referenced by arithmetic_result_type(), and expr_type().

static Type arithmetic_result_type const Type type1,
const Type type2,
const int  rank
[static]
 

... this return should never happen

Definition at line 1045 of file Expression.cc.

References COMPLEX_TYPE, Type::data_type(), DOUBLE_PRECISION_TYPE, INTEGER_TYPE, is_arithmetic_type(), make_type(), REAL_TYPE, Type::size(), and UNDEFINED_TYPE.

Referenced by expr_type().

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().

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.

... 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.

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).

Definition at line 1451 of file Expression.cc.

References Iterator< T >::current(), expr_type(), Expression::type(), and Iterator< T >::valid().

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)
 

Definition at line 1469 of file Expression.cc.

Expression* constant int  value  ) 
 

Description: Returns a pointer to an expression for a Fortran INTEGER_CONST_EXPR.

Definition at line 1501 of file Expression.cc.

Expression* constant const char *  data_string  ) 
 

Description: Returns a pointer to an expression for a Fortran constant specified as a char string.

... Convert to single-quoted character constant

Definition at line 1507 of file Expression.cc.

References CHARACTER_TYPE, Type::data_type(), DOUBLE_PRECISION_TYPE, double_to_single_quoted(), e, INTEGER_TYPE, LOGICAL_TYPE, REAL_TYPE, and string_type().

Expression* keyword const char *  data_string  ) 
 

Description: Create a keyword node for the keypair function.

Definition at line 1553 of file Expression.cc.

Referenced by s_control_type::s_control_type().

Expression* complex Expression real,
Expression imag
 

Definition at line 1561 of file Expression.cc.

Referenced by Summation::sum_mul().

Expression* array_reference Expression array,
Expression subscripts
 

Description: Returns a pointer to an expression for a Fortran Complex constant.

Expression *complex(Expression * real, Expression * imag);

Description: Returns a pointer to an expression for a Fortran array reference

Definition at line 1567 of file Expression.cc.

References determine_root_expr_type().

Referenced by TranslateObject::_translate_symbol_refs_expr(), make_afi_node(), InlineObject::map_existing_common_block(), parse_array_ref(), and process().

static Expression* create_nonbinary List< Expression > *  args,
OP_TYPE  op_type,
const char *  func_name
[inline, static]
 

Definition at line 1580 of file Expression.cc.

References expr_type().

Referenced by add(), and(), colon(), eqv(), mul(), neqv(), and or().

Expression* add Expression expr1,
Expression expr2
 

Description: Returns a pointer to an expression for expr1 + expr2.

Definition at line 1595 of file Expression.cc.

References ADD_OP, and expr_type().

Expression* add List< Expression > *  args  ) 
 

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().

Expression* sub Expression expr1,
Expression expr2
 

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().

Expression* mul Expression expr1,
Expression expr2
 

Description: Returns a pointer to an expression for expr1 * expr2.

Definition at line 1623 of file Expression.cc.

References expr_type(), and MULT_OP.

Expression* mul List< Expression > *  args  ) 
 

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.

Expression* div Expression expr1,
Expression expr2
 

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().

Expression* exponent Expression expr1,
Expression expr2
 

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().

Expression* keypair Expression expr1,
Expression expr2
 

Description: Returns a pointer to an expression for a Fortran MASK=X expression.

Definition at line 1662 of file Expression.cc.

References KEYPAIR_OP, make_type(), and VOID_TYPE.

Expression* eq Expression expr1,
Expression expr2
 

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().

Expression* ne Expression expr1,
Expression expr2
 

Description: Returns a pointer to an expression for a Fortran .NE.

expression

Definition at line 1682 of file Expression.cc.

References expr_type(), and NE_OP.

Referenced by check_div(), convert_arithmetic_if(), divides_diff(), TreeInMaking::grab(), transform_not_equal(), and PredicateRepository::transform_not_equal().

Expression* lt Expression expr1,
Expression expr2
 

Description: Returns a pointer to an expression for a Fortran .LT.

expression

Definition at line 1693 of file Expression.cc.

References expr_type(), and LT_OP.

Referenced by at_least_one_iteration(), AbstractAccess::calc_overlap(), compute_intrinsic_type(), convert_arithmetic_if(), TreeInMaking::grab(), intersect_ARDs(), and transform_not_equal().

Expression* le Expression expr1,
Expression expr2
 

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().

Expression* gt Expression expr1,
Expression expr2
 

Description: Returns a pointer to an expression for a Fortran .GT.

expression

Definition at line 1715 of file Expression.cc.

References expr_type(), and GT_OP.

Referenced by at_least_one_iteration(), AbstractAccess::calc_overlap(), convert_arithmetic_if(), TreeInMaking::grab(), intersect_ARDs(), peel_loop_first(), peel_loop_last(), and transform_not_equal().

Expression* ge Expression expr1,
Expression expr2
 

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().

Expression* or Expression expr1,
Expression expr2
 

Description: Returns a pointer to an expression for expr1 .OR.

expr2

Definition at line 1737 of file Expression.cc.

References expr_type(), and OR_OP.

Expression* or List< Expression > *  args  ) 
 

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.

Expression* and Expression expr1,
Expression expr2
 

Description: Returns a pointer to an expression for expr1 .AND.

expr2

Definition at line 1754 of file Expression.cc.

References AND_OP, and expr_type().

Expression* and List< Expression > *  args  ) 
 

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().

Expression* eqv Expression expr1,
Expression expr2
 

Description: Returns a pointer to an expression for expr1 .EQV.

expr2

Definition at line 1771 of file Expression.cc.

References EQV_OP, and expr_type().

Expression* eqv List< Expression > *  args  ) 
 

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.

Expression* neqv Expression expr1,
Expression expr2
 

Description: Returns a pointer to an expression for expr1 .NEQV.

expr2

Definition at line 1788 of file Expression.cc.

References expr_type(), and NEQV_OP.

Expression* neqv List< Expression > *  args  ) 
 

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.

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.

Definition at line 1805 of file Expression.cc.

References NOT_INTRINSIC.

Referenced by main(), make_afi_node(), parse_function_call(), process(), SEARCH(), and SSAProgramUnit::SEARCH().

Expression* intrinsic_call Expression expr1,
Expression expr2
 

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().

Expression* substring Expression expr1,
Expression expr2
 

Description: Returns a pointer to an expression for a Fortran substring expression.

Definition at line 1834 of file Expression.cc.

References expr_type(), and SUBSTRING_OP.

Referenced by TranslateObject::_translate_symbol_refs_expr(), String::index(), String::index_case(), and make_afi_node().

Expression* concat Expression expr1,
Expression expr2
 

Description: Returns a pointer to an expression for expr1 // expr2.

Definition at line 1847 of file Expression.cc.

References CONCAT_OP, and expr_type().

Referenced by TreeInMaking::grab(), and main().

Expression* colon Expression expr1,
Expression expr2,
Expression *expr3   GIV(0)
 

Definition at line 1861 of file Expression.cc.

References COLON_OP, make_type(), and VOID_TYPE.

Expression* colon List< Expression > *  args  ) 
 

Definition at line 1871 of file Expression.cc.

References COLON_OP, and create_nonbinary().

Expression* comma List< Expression > *  args  ) 
 

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.

Expression* comma Expression expr1,
Expression expr2,
Expression *expr3   GIV(0),
Expression *expr4   GIV(0),
Expression *expr5   GIV(0)
 

Definition at line 1883 of file Expression.cc.

Expression* comma Expression expr1  ) 
 

Description: Returns a pointer to an expression for a CommaExpr.

'expr' may not be NULL

Definition at line 1894 of file Expression.cc.

Expression* comma  ) 
 

Description: Returns a pointer to an expression for a CommaExpr with no arguments.

Definition at line 1902 of file Expression.cc.

Expression* unary_plus Expression expr  ) 
 

Description: Returns a pointer to an expression for a unary plus expression.

Definition at line 1907 of file Expression.cc.

References U_PLUS_OP.

Expression* unary_minus Expression expr  ) 
 

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().

Expression* do_expression Expression expr1,
Expression expr2
 

Description: Returns a pointer to an expression for expr1 * expr2.

Definition at line 1923 of file Expression.cc.

Expression* equal Expression index,
Expression iter_space
 

Description: Returns a pointer to an expression for an EqualExpr (e.g.

I=1,100,3)

Definition at line 1933 of file Expression.cc.

Referenced by Relation::Relation().

Expression* not Expression expr  ) 
 

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().

Expression* paren Expression expr  ) 
 

Description: Returns a pointer to a parenthesized expression.

Definition at line 1952 of file Expression.cc.

References PAREN_OP.

Referenced by _remove_local_effects_from_expr1(), _simplify_var_mods(), _subst_unkeepable_vars(), and main().

Expression* id const char *  varname,
const ProgramUnit pgm
 

Description: Returns a pointer to an expression for an existing Fortran identifier.

Definition at line 1960 of file Expression.cc.

References Symbol::type().

Expression* id const Symbol symbol  ) 
 

Description: Returns a pointer to an expression for an existing Fortran symbol.

Definition at line 1969 of file Expression.cc.

References symbol(), and Symbol::type().

Expression* new_variable const char *  varname,
const Type t,
ProgramUnit pgm
 

Description: Returns a pointer to an expression for a new Fortran identifier.

Definition at line 1975 of file Expression.cc.

References NOT_FORMAL, NOT_SAVED, and Symbol::type().

Referenced by main(), and process().

Expression* new_function const char *  funname,
const Type t,
ProgramUnit pgm
 

Description: Returns a pointer to an expression for a new Fortran function identifier.

Definition at line 1987 of file Expression.cc.

References IS_EXTERNAL, NOT_FORMAL, NOT_INTRINSIC, and Symbol::type().

Referenced by main(), and process().

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.

Definition at line 1999 of file Expression.cc.

References IS_INTRINSIC, NOT_EXTERNAL, NOT_FORMAL, and Symbol::type().

Referenced by TranslateObject::_translate_symbol_refs_expr(), fix_alternate_expr(), and process().

Expression* new_subroutine const char *  funname,
ProgramUnit pgm
 

Description: Returns a pointer to an expression for a new Fortran subroutine identifier.

Definition at line 2011 of file Expression.cc.

References IS_EXTERNAL, NOT_FORMAL, NOT_INTRINSIC, and Symbol::type().

Referenced by main().

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)
 

Definition at line 2022 of file Expression.cc.

References COLON_OP, NOT_FORMAL, NOT_SAVED, and Symbol::type().

Expression* omega  ) 
 

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().

Expression* null_to_omega Expression expr  ) 
 

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().

Expression* infinity int s   GIV(1)  ) 
 

Definition at line 2092 of file Expression.cc.

Expression* alpha Expression parameters  ) 
 

Description: Create a alpha GSA function with the given parameters.

Definition at line 2100 of file Expression.cc.

References ALPHA_OP, expr_type(), and parameters().

Referenced by SEARCH(), and SSAProgramUnit::SEARCH().

Expression* gamma Expression gate,
Expression parameters
 

Description: Create a gamma GSA function with the given gate function and parameters.

Definition at line 2110 of file Expression.cc.

References expr_type(), GAMMA_OP, and parameters().

Referenced by build_expr(), make_phi_function(), and parse_phi_expr().

Expression* mu Expression parameters  ) 
 

Description: Create a mu GSA function with the given parameters.

Definition at line 2120 of file Expression.cc.

References expr_type(), MU_OP, and parameters().

Expression* theta Expression parameters  ) 
 

Definition at line 2130 of file Expression.cc.

References expr_type(), parameters(), and THETA_OP.

Referenced by add_dummy_global_assignments_at_calls().

Expression* eta Expression gate,
Expression parameters
 

... from Expression.cc

Definition at line 2140 of file Expression.cc.

References ETA_OP, expr_type(), and parameters().

Referenced by add_dummy_eta_assignments_after_loops().

Expression* mu Expression parameters,
Expression gate
 

Definition at line 2150 of file Expression.cc.

References expr_type(), MU_OP, and parameters().

static void _cannot_coerce const Type from,
EXPR_TYPE  to
[static]
 

Definition at line 2162 of file Expression.cc.

References Type::format(), and Expression::format().

Referenced by _assert_can_coerce(), and coerce().

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]
 

Definition at line 2178 of file Expression.cc.

References _cannot_coerce().

Referenced by coerce().

static Expression* _coerce Expression expr,
const char *  intrin_name,
EXPR_TYPE   NOTUSED(type),
ProgramUnit pgm
[static]
 

... Select size by default

Definition at line 2194 of file Expression.cc.

References Symbol::intrinsic(), IS_INTRINSIC, NOT_EXTERNAL, NOT_FORMAL, and Symbol::type().

Referenced by coerce().

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).

... 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
 

Definition at line 3001 of file Expression.cc.

References Expression::_overflow, e, DistributeExpr::print_debug(), and subst_field_print.

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().

void print_prec OP_TYPE  parent_op,
const Expression e,
ostream &  o
 

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().

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.

ot is op_type of parent expr.

... An empty COLON list is meaningful. i.e. A(:)

... An single element COLON list is meaningful. i.e. A(5:)

Definition at line 3267 of file Expression.cc.

References COLON_OP, Iterator< T >::current(), Iterator< T >::end(), Iterator< T >::next(), and print_prec().

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.

... 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().

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.

... Check to see if symbol matches (if not, there is nothing to do)

Definition at line 7580 of file Expression.cc.

References Expression::arg_list(), e, ID_OP, Expression::op(), substitute_var(), DistributeExpr::symbol(), and List< T >::valid().

Boolean _non_wc_match const Expression e1,
const Expression e2,
Boolean  consider_side_effects
[inline]
 

_non_wc_match()

Assume no wildcards in e1 or e2, all signatures are correct, both exprs are in canonical form. Returns True iff e1 is structurally equivalent to e2. HOWEVER:

If consider_side_effects == True: False is returned if either expression may contain side effects. If consider_side_effects == False: Side effects are ignored (i.e. producing a pure structural equality check only).

Since neither expression contains side effects, and neither expression contains wildcards, the side effect information no longer is important.

Definition at line 7655 of file Expression.cc.

References Expression::compare(), False, ExprSignature::has_fn_call(), ExprSignature::hash_value(), and Expression::signature().

Referenced by Expression::_match(), and wildcard_compare_args().

void _sort_expr_list List< Expression > &  expr_list  ) 
 

_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().

Boolean wildcard_compare_args Expression e1,
Expression e2,
Boolean  consider_side_effects
[inline]
 

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().

Expression* _replace_check_parent Expression e,
Expression parent_ref,
Expression pattern,
ReplaceOptions rep_options,
Boolean continue_traversal
[inline]
 

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().

Expression* _replace_or_traverse_aux Expression e,
Expression parent_ref,
Expression pattern,
ReplaceOptions rep_options
 

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().

Expression* _replace_or_traverse Expression e,
Expression pattern,
ReplaceOptions rep_options
 

Note: this function has been declared a friend to Expression.

Definition at line 8949 of file Expression.cc.

References _replace_or_traverse_aux(), Expression::create_signature(), and e.

Referenced by replace(), and traverse().

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

Definition at line 8987 of file Expression.cc.

References _replace_or_traverse(), and e.

Referenced by clean_statement(), do_funny3(), precalc_non_do_expr(), remove_lambda_calls(), replace_lambda_call(), replace_lambda_call_expr(), and test_expr_str().

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)
 

Definition at line 9007 of file Expression.cc.

References _replace_or_traverse(), and e.

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)
 

Definition at line 9032 of file Expression.cc.

References _replace_or_traverse(), and e.

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)
 

Definition at line 9054 of file Expression.cc.

References _replace_or_traverse(), and e.

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)
 

... This cannot have changed anything (specifically the top level)

Definition at line 9081 of file Expression.cc.

References _replace_or_traverse(), e, NON_RECURSIVE_REPLACE, and POSTORDER_REPLACE.

Referenced by collect_lambda_formals(), replace_lambda_call(), and test_expr_str().

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)
 

... This cannot have changed anything (specifically the top level)

Definition at line 9114 of file Expression.cc.

References _replace_or_traverse(), e, NON_RECURSIVE_REPLACE, and POSTORDER_REPLACE.

static Expression * _additive_inverse Expression e  )  [static]
 

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().

static Expression * _logical_complement Expression e  )  [static]
 

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]
 

gcd Return the greatest common divisor for the expression.

Definition at line 11489 of file Expression.cc.

Referenced by NonBinaryExpr::_divide_by_int(), IntConstExpr::_divide_by_int(), _fold_divisible_in_plus(), and NonBinaryExpr::_gcd().

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().

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.

... 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().

static Expression * _fold_divisible_top Expression expr  )  [static]
 

_fold_divisible_top Merge all division expressions whose denominator evenly divides their numerator in the given expression.

... Do nothing

Definition at line 13773 of file Expression.cc.

References _fold_divisible_in_div(), _fold_divisible_in_exp(), _fold_divisible_in_mult(), _fold_divisible_in_plus(), _simplify_options, ADD_OP, EXP_OP, INTDIV_OP, and MULT_OP.

Referenced by _additive_inverse(), and simplify_top().

static Boolean _combine_int_relations List< Expression > &  arg_list,
OP_TYPE  op
[static]
 

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().

static Boolean _combine_other_logicals List< Expression > &  arg_list  )  [static]
 

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 * _join OP_TYPE  op,
Expression e1,
Expression e2
[static]
 

join Join the two expressions into a single expression with the given NonBinaryExpr operator

Definition at line 11851 of file Expression.cc.

References Expression::arg_list(), List< T >::entries(), expr_type(), List< T >::grab(), List< T >::ins_first(), List< T >::ins_last(), List< T >::last_ref(), Expression::op(), and Expression::type().

static Expression* _s_constant int  value  )  [static]
 

_s_constant Create a constant Expression object with an updated signature.

Definition at line 9209 of file Expression.cc.

References _simplify_options, constant(), e, and Expression::update_signature().

Referenced by _additive_inverse(), _calc_factor(), _combine_int_relations(), _combine_min_max(), _fold_divisible_in_plus(), _pull_out_divisible(), and sym_factors().

static Expression* _s_constant const char *  data_string  )  [static]
 

Definition at line 9220 of file Expression.cc.

References _simplify_options, constant(), e, and Expression::update_signature().

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  ) 
 

is_commutative_intrinsic_name - Returns 1 iff the intrinsic function specified by 'name' is commutative.

Definition at line 9252 of file Expression.cc.

Referenced by Expression::standardize().

static Boolean _expr_can_contain_omega OP_TYPE  op  )  [static]
 

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().

static Expression * _push_down_nots Expression expr  )  [static]
 

_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]
 

Definition at line 9300 of file Expression.cc.

References _push_down_nots(), Mutator< T >::assign(), Iterator< T >::current(), NOT_OP, Expression::op(), Mutator< T >::pull(), and Iterator< T >::valid().

Referenced by _push_down_nots().

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]
 

Definition at line 9355 of file Expression.cc.

References _remove_ratdivs(), and False.

static void _read_simplify_opts  )  [static]
 

_read_simplify_opts Read in the options to simplify.

Definition at line 9366 of file Expression.cc.

References _simplify_options, and switch_value().

Referenced by set_simplifier_opts(), and simplify().

void reset_simplifier_opts  ) 
 

reset_simplifier_opts Reset the options to simplify.

Definition at line 9388 of file Expression.cc.

References _saved_simplify_options, and _simplify_options.

void set_simplifier_opts  ) 
 

set_simplifier_opts Set the options to simplify.

Definition at line 9399 of file Expression.cc.

References _read_simplify_opts(), _saved_simplify_options, and _simplify_options.

Expression* simplify_top Expression e  ) 
 

simplify_top Simplify the given expression with the given assumption that the expression's arguments have already been simplified.

Definition at line 9414 of file Expression.cc.

References Expression::_combine_top(), Expression::_distribute_top(), _fold_divisible_top(), Expression::_fold_top(), _modify_expr(), _standardize_top(), and e.

Referenced by _fold_divisible_in_exp(), _fold_divisible_in_mult(), _fold_divisible_in_plus(), and _simplify().

static Expression* _simplify Expression e  )  [static]
 

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().

static Expression* check_div Expression expr,
int  value
[static]
 

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().

Expression* _simplify_div_int Expression expr  ) 
 

Try to normalize integer constant factors.

Definition at line 9585 of file Expression.cc.

References check_div(), EQ_OP, extract_possible_factors(), GE_OP, GT_OP, LE_OP, LT_OP, and NE_OP.

Referenced by simplify().

Expression* simplify Expression e  ) 
 

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]
 

power_of_factor If factor^p is a factor of the given expression, then return p.

Else return 0. The expression parameters are assummed to be fully simplified.

Definition at line 10181 of file Expression.cc.

References min().

Referenced by _calc_factor(), _power_of_factor(), and sym_factors().

static int _power_of_factor const Expression expr,
const Expression factor
[static]
 

Definition at line 10192 of file Expression.cc.

References _nearer_to_zero(), ADD_OP, Expression::arg_list(), Iterator< T >::current(), EXP_OP, INTEGER_CONSTANT_OP, MULT_OP, and Iterator< T >::valid().

Referenced by _calc_factor(), _divide_by_factor1(), and sym_factors().

static void _calc_factor const Expression expr1,
const Expression expr2,
const Expression factor,
List< Expression > &  factors
[static]
 

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().

static Expression* _divide_by_factor1 Expression expr,
const Expression factor,
int &  power
[static]
 

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().

static Expression* _divide_by_factor Expression expr,
const Expression factor
[static]
 

Definition at line 10354 of file Expression.cc.

References _divide_by_factor1(), EXP_OP, INTEGER_CONSTANT_OP, Expression::right_guarded(), and Expression::value().

Referenced by _sym_factor(), and sym_factors().

static void _sym_factor Expression *&  expr1,
Expression *&  expr2,
List< Expression > &  factors
[static]
 

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().

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.

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().

static Boolean _is_expr_evenly_divisible Expression expr  )  [static]
 

_is_expr_evenly_divisible Like is_evenly_divisible, but takes division expressions.

Definition at line 10537 of file Expression.cc.

References DIV_OP, False, INTDIV_OP, INTEGER_CONSTANT_OP, Expression::is_evenly_divisible, RATDIV_OP, switch_value(), and True.

Referenced by _fold_divisible_in_exp(), and _grab_divisible().

static ExprCountElem* _loc_in_siglist const List< ExprCountElem > &  l,
const Expression e
[static]
 

*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().

static ExprExponentElem* _loc_in_siglist_expon const List< ExprExponentElem > &  l,
const Expression e
[static]
 

*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().

static Boolean _is_not_in_siglist const List< ExprCountElem > &  l,
const Expression e,
int  count
[static]
 

_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 Expression* _loc_of_integer_constant List< Expression > &  l  )  [static]
 

*loc_of_integer_constant*

This function returns the first subexpression that is an integer constant in the given list.

Definition at line 12167 of file Expression.cc.

References Iterator< T >::current(), INTEGER_CONSTANT_OP, Expression::op(), and Iterator< T >::valid().

Referenced by _combine_int_relations(), and _combine_min_max().

static Boolean _is_relation const Expression e  )  [static]
 

_is_relation Return true if the given expression is an relation operator

Definition at line 12673 of file Expression.cc.

References e, EQ_OP, GE_OP, GT_OP, LE_OP, LT_OP, NE_OP, and Expression::op().

Referenced by _combine_int_relations(), and _combine_other_logicals().

void _remove_duplicates List< Expression > &  arg_list  ) 
 

remove_duplicates Remove duplicate expressions from the given list of expressions.

... 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

... Check each expression against the existing unique ones ... If an expression is found to be identical to an existing one, remove it

Definition at line 13147 of file Expression.cc.

References _loc_in_siglist(), Iterator< T >::current(), List< T >::ins_last(), INTEGER_CONSTANT_OP, and Iterator< T >::valid().

static void _get_top_scalars const Expression expr,
RefSet< Symbol > &  scalars
[static]
 

get_top_scalars; Return the set of all scalar variables used in the given expression.

Scalars contained in array reference expressions are ignored.

Definition at line 13182 of file Expression.cc.

References ARRAY_REF_OP, Iterator< T >::current(), FUNCTION_CALL_OP, ID_OP, List< T >::ins(), INTRINSIC_CALL_OP, SYMBOLIC_CONSTANT_CLASS, Iterator< T >::valid(), and VARIABLE_CLASS.

Referenced by is_evenly_divisible().

static int _var_power_in_expr const Expression expr,
const Symbol var
[static]
 

var_power_in_expr Return the maximum power of the given variable in the given expression.

Definition at line 13208 of file Expression.cc.

References Iterator< T >::current(), EXP_OP, ID_OP, INTEGER_CONSTANT_OP, and Iterator< T >::valid().

Referenced by _is_evenly_divisible_for_var(), _monotonicity_for_var(), _var_power_in_expr(), and is_evenly_divisible().

static Boolean _is_evenly_divisible1 const Expression expr,
int  divisor,
const RefSet< Symbol > &  scalars
[static]
 

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.

Note: This function assumes that the expression has already been simplified.

Definition at line 13342 of file Expression.cc.

References _is_evenly_divisible_for_var(), RefSet< T >::entries(), False, RefSet< T >::grab(), and True.

Referenced by _is_base_case_evenly_divisible(), and is_evenly_divisible().

static Boolean _is_base_case_evenly_divisible const Expression expr,
int  divisor,
const RefSet< Symbol > &  scalars,
const Symbol var
[static]
 

Definition at line 13254 of file Expression.cc.

References _is_evenly_divisible1(), constant(), is_var_in_expr(), Expression::simplify, and substitute_var().

Referenced by _is_evenly_divisible_for_var().

static Boolean _is_evenly_divisible_for_var const Expression expr,
int  divisor,
const RefSet< Symbol > &  scalars,
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().

Boolean is_evenly_divisible const Expression expr,
int  divisor
 

... 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().

static void _grab_divisible Expression expr,
List< Expression > &  divisible
[static]
 

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.

Definition at line 13405 of file Expression.cc.

References _is_expr_evenly_divisible(), Iterator< T >::current(), Mutator< T >::grab(), is_integer_constant(), Expression::right_guarded(), Expression::simplify, and Iterator< T >::valid().

Referenced by _fold_divisible_in_mult(), and _fold_divisible_in_plus().

static Expression* _fold_divisible_in_mult Expression expr  )  [static]
 

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 Expression* _fold_divisible_in_exp Expression expr  )  [static]
 

fold_divisible_in_exp Merge all division expressions whose denominator evenly divides their numerator in a exponentiation expression

Definition at line 13495 of file Expression.cc.

References _is_expr_evenly_divisible(), Expression::clone(), EXP_OP, exponent(), Expression::grab_left(), Expression::grab_right(), INTEGER_TYPE, Expression::left(), Expression::right(), and simplify_top().

Referenced by _fold_divisible_top().

static int _num_divisible_candidates const Expression expr  )  [static]
 

Definition at line 13518 of file Expression.cc.

References Expression::arg_list(), Iterator< T >::current(), DIV_OP, INTEGER_CONSTANT_OP, Expression::op(), RATDIV_OP, Expression::right_guarded(), and Iterator< T >::valid().

Referenced by _fold_divisible_in_plus().

static Expression* _fold_divisible_in_plus 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().

static Expression* _fold_divisible_in_div Expression expr  )  [static]
 

_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().

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.

Definition at line 14160 of file Expression.cc.

References Summation::sum().

Referenced by AbstractAccess::calc_overlap(), contiguous_aggregation(), and test_expr_str().


Variable Documentation

int subst_field_print = 0 [static]
 

Definition at line 128 of file Expression.cc.

Referenced by operator<<(), Expression::print(), and set_subst_field_print().

char* op_string[NUM_OP_TYPES] [static]
 

Expression base class code:.

Definition at line 134 of file Expression.cc.

Referenced by expr_type().

unsigned int _simplify_options = UNREAD_OPTIONS [static]
 

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().

unsigned int _saved_simplify_options = UNREAD_OPTIONS [static]
 

Definition at line 9162 of file Expression.cc.

Referenced by reset_simplifier_opts(), and set_simplifier_opts().

 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:06:21 2005