PIPS
comp_expr_to_pnome.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <string.h>
#include "linear.h"
#include "genC.h"
#include "ri.h"
#include "effects.h"
#include "complexity_ri.h"
#include "ri-util.h"
#include "pipsdbm.h"
#include "workspace-util.h"
#include "effects-util.h"
#include "misc.h"
#include "properties.h"
#include "complexity.h"
+ Include dependency graph for comp_expr_to_pnome.c:

Go to the source code of this file.

Macros

#define maxint_p(i)   ((i) == INT_MAX)
 
#define minint_p(i)   ((i) == (INT_MIN))
 

Functions

char * noms_var (entity e)
 comp_expr_to_pnome.c More...
 
complexity make_complexity_unknown (const char *name)
 builds a new unknown complexity attached to a virtual package More...
 
complexity expression_to_complexity_polynome (expression expr, transformer precond, list effects_list, bool keep_symbols, int maximize)
 Entry point routine of this file: More...
 
complexity syntax_to_polynome (syntax synt, transformer precond, list effects_list, bool keep_symbols, int maximize)
 1st element of expression More...
 
complexity normalized_to_polynome (normalized no, transformer precond, list effects_list, bool keep_symbols, int maximize)
 2nd element of expression More...
 
complexity pvecteur_to_polynome (Pvecteur pvect, transformer precond, list effects_list, bool keep_symbols, int maximize)
 The only element available of normalized. More...
 
complexity reference_to_polynome (reference ref, transformer precond, list effects_list, bool keep_symbols, int maximize)
 First element of the "syntax" domain. More...
 
complexity range_to_polynome (range rg __attribute__((__unused__)), transformer precond __attribute__((__unused__)), list effects_list __attribute__((__unused__)), bool keep_symbols __attribute__((__unused__)), int maximize __attribute__((__unused__)))
 2nd element of syntax More...
 
complexity call_to_polynome (call call_instr, transformer precond, list effects_list, bool keep_symbols, int maximize)
 3rd element of syntax More...
 
complexity cast_to_polynome (cast cast_instr, transformer precond, list effects_list, bool keep_symbols, int maximize)
 4th element of syntax : Molka Becher More...
 
complexity plus_op_handler (list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
 
complexity minus_op_handler (list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
 
complexity multiply_op_handler (list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
 
complexity field_op_handler (list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
 
complexity unary_minus_op_handler (list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
 
complexity unary_plus_op_handler (list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
 
complexity divide_op_handler (list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
 
complexity power_op_handler (list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
 
complexity evaluate_var_to_complexity (entity var, transformer precond, list effects_list __attribute__((__unused__)), int maximize)
 complexity evaluate_var_to_complexity(entity var, transformer precond, list effects_list, int maximize) Return, packed in a complexity, the exact value of variable var or its max if (maximize==MAXIMUM_VALUE), or its min, according to preconditions passed in precond. More...
 
complexity simplify_sc_to_complexity (Psysteme ps, Variable var)
 This function is recently added by L.Zhou June 5, 91 simplify_sc_to_complexity(Psysteme ps, Variable var) It looks for the egality formula containing (Variable)var in the system (Psysteme)ps. More...
 

Variables

hash_table hash_callee_to_complexity
 comp_expr_to_pnome.c More...
 
hash_table hash_complexity_parameters
 

Macro Definition Documentation

◆ maxint_p

#define maxint_p (   i)    ((i) == INT_MAX)

◆ minint_p

#define minint_p (   i)    ((i) == (INT_MIN))

Function Documentation

◆ call_to_polynome()

complexity call_to_polynome ( call  call_instr,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)

3rd element of syntax

For the moment, we don't want to evaluate the complexity of the

function defined by the users

Parameters
call_instrall_instr
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 369 of file comp_expr_to_pnome.c.

375 {
376  entity f = call_function(call_instr);
377  const char *name = module_local_name(f);
378  list args = call_arguments(call_instr);
379  type t = entity_type(f);
380  value v = entity_initial(f);
382 
383  trace_on("CALL '%s' -> pnome", name);
384 
385  if (!type_functional_p(t) ||
387  pips_internal_error("'%s' isn't an expected entity (type %d, value %d)",
388  type_tag(t), value_tag(v), name);
389 
390  switch (value_tag(v)) {
391  case is_value_code:
392  /* For the moment, we don't want to evaluate the complexity of the */
393  break; /* function defined by the users */
394  case is_value_constant:
396  break;
397  case is_value_intrinsic:
399  comp = plus_op_handler(args, precond, effects_list, keep_symbols, maximize);
400  else if (same_string_p(name, MINUS_OPERATOR_NAME))
401  comp = minus_op_handler(args, precond, effects_list, keep_symbols, maximize);
402  else if (same_string_p(name, MULTIPLY_OPERATOR_NAME))
403  comp = multiply_op_handler(args, precond, effects_list, keep_symbols, maximize);
404  else if (same_string_p(name, DIVIDE_OPERATOR_NAME))
405  comp = divide_op_handler(args, precond, effects_list, keep_symbols, maximize);
406  else if (same_string_p(name, POWER_OPERATOR_NAME))
407  comp = power_op_handler(args, precond, effects_list, keep_symbols, maximize);
409  comp = unary_minus_op_handler(args, precond, effects_list, keep_symbols, maximize);
410  else if (same_string_p(name, FIELD_OPERATOR_NAME))
411  comp = field_op_handler(args, precond, effects_list, keep_symbols, maximize);
412  else
413  pips_user_warning("operator '%s' skipped\n",name);
414  break;
415 
416  default:
417  pips_internal_error("not handled case");
418  }
419 
420  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
421  fprintf(stderr, "call->pnome '%s': ", name);
422  complexity_fprint(stderr, comp, true, true);
423  }
424 
425  trace_off();
426  return (comp);
427 }
complexity divide_op_handler(list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
complexity plus_op_handler(list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
complexity minus_op_handler(list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
complexity multiply_op_handler(list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
complexity unary_minus_op_handler(list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
complexity field_op_handler(list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
complexity power_op_handler(list args, transformer precond, list effects_list, bool keep_symbols, int maximize)
void complexity_float_add(complexity *pcomp, float f)
Add a floating point digit to the complexity May 3, 91.
Definition: comp_math.c:480
complexity make_zero_complexity()
make a zero complexity "0.0000 * TCST" with null statistics
Definition: comp_math.c:238
void trace_on(char *fmt,...)
Definition: comp_util.c:684
void complexity_fprint(FILE *fd, complexity comp, bool print_stats_p, bool print_local_names_p)
Definition: comp_util.c:217
float constant_entity_to_float(entity e)
Return if possible the value of e in a float.
Definition: comp_util.c:664
void trace_off()
"trace off"
Definition: comp_util.c:714
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define pips_user_warning
Definition: misc-local.h:146
#define pips_internal_error
Definition: misc-local.h:149
#define same_string_p(s1, s2)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
#define POWER_OPERATOR_NAME
#define MINUS_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define FIELD_OPERATOR_NAME
Definition: ri-util-local.h:91
#define DIVIDE_OPERATOR_NAME
#define UNARY_MINUS_OPERATOR_NAME
#define MULTIPLY_OPERATOR_NAME
const char * module_local_name(entity e)
Returns the module local user name.
Definition: entity.c:582
#define type_functional_p(x)
Definition: ri.h:2950
#define value_tag(x)
Definition: ri.h:3064
#define value_code_p(x)
Definition: ri.h:3065
#define call_function(x)
Definition: ri.h:709
#define value_intrinsic_p(x)
Definition: ri.h:3074
#define type_tag(x)
Definition: ri.h:2940
@ is_value_intrinsic
Definition: ri.h:3034
@ is_value_constant
Definition: ri.h:3033
@ is_value_code
Definition: ri.h:3031
#define value_constant_p(x)
Definition: ri.h:3071
#define call_arguments(x)
Definition: ri.h:711
#define entity_type(x)
Definition: ri.h:2792
#define entity_initial(x)
Definition: ri.h:2796
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References call_arguments, call_function, complexity_float_add(), complexity_fprint(), constant_entity_to_float(), divide_op_handler(), DIVIDE_OPERATOR_NAME, entity_initial, entity_type, f(), field_op_handler(), FIELD_OPERATOR_NAME, fprintf(), get_bool_property(), is_value_code, is_value_constant, is_value_intrinsic, make_zero_complexity(), minus_op_handler(), MINUS_OPERATOR_NAME, module_local_name(), multiply_op_handler(), MULTIPLY_OPERATOR_NAME, pips_internal_error, pips_user_warning, plus_op_handler(), PLUS_OPERATOR_NAME, power_op_handler(), POWER_OPERATOR_NAME, same_string_p, trace_off(), trace_on(), type_functional_p, type_tag, unary_minus_op_handler(), UNARY_MINUS_OPERATOR_NAME, value_code_p, value_constant_p, value_intrinsic_p, and value_tag.

Referenced by syntax_to_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cast_to_polynome()

complexity cast_to_polynome ( cast  cast_instr,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)

4th element of syntax : Molka Becher

Parameters
cast_instrast_instr
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 429 of file comp_expr_to_pnome.c.

435 {
436  expression exp = cast_expression(cast_instr);
437 
438  trace_on("CAST");
439 
440  complexity comp = expression_to_complexity_polynome(exp, precond, effects_list,
441  keep_symbols, maximize);
442 
443  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
444  fprintf(stderr, "cast->pnome");
445  complexity_fprint(stderr, comp, true, true);
446  }
447 
448  trace_off();
449  return (comp);
450 }
complexity expression_to_complexity_polynome(expression expr, transformer precond, list effects_list, bool keep_symbols, int maximize)
Entry point routine of this file:
#define cast_expression(x)
Definition: ri.h:747
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References cast_expression, complexity_fprint(), exp, expression_to_complexity_polynome(), fprintf(), get_bool_property(), trace_off(), and trace_on().

Referenced by syntax_to_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ divide_op_handler()

complexity divide_op_handler ( list  args,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)
Parameters
argsrgs
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 560 of file comp_expr_to_pnome.c.

566 {
567  float denominateur;
569  precond, effects_list, keep_symbols,
570  maximize);
572  precond, effects_list, DONT_KEEP_SYMBOLS,
573  -maximize);
574  if (complexity_constant_p(c2)) {
575  denominateur = complexity_TCST(c2);
576  if (denominateur == 0)
577  user_error("divide_op_handler", "division by zero\n");
578  else
579  complexity_mult(&c1, make_constant_complexity(1.0/denominateur));
580  }
581  else {
582  complexity_rm(&c1);
583  }
584 
585  complexity_rm(&c2);
586  return (c1);
587 }
float complexity_TCST(complexity comp)
return the constant term of comp.
Definition: comp_math.c:288
bool complexity_constant_p(complexity comp)
true if comp is constant.
Definition: comp_math.c:256
complexity make_constant_complexity(float f)
make a constant complexity "f * TCST" with null statistics
Definition: comp_math.c:231
void complexity_mult(complexity *pcomp1, complexity comp2)
void complexity_mult(complexity *pcomp1, comp2) performs *pcomp1 = *pcomp1 * comp2; !...
Definition: comp_math.c:418
void complexity_rm(complexity *pcomp)
remove complexity comp
Definition: comp_util.c:164
#define DONT_KEEP_SYMBOLS
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
#define user_error(fn,...)
Definition: misc-local.h:265
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217

References CAR, CDR, complexity_constant_p(), complexity_mult(), complexity_rm(), complexity_TCST(), DONT_KEEP_SYMBOLS, EXPRESSION, expression_to_complexity_polynome(), make_constant_complexity(), and user_error.

Referenced by call_to_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ evaluate_var_to_complexity()

complexity evaluate_var_to_complexity ( entity  var,
transformer  precond,
list effects_list   __attribute__(__unused__),
int  maximize 
)

complexity evaluate_var_to_complexity(entity var, transformer precond, list effects_list, int maximize) Return, packed in a complexity, the exact value of variable var or its max if (maximize==MAXIMUM_VALUE), or its min, according to preconditions passed in precond.

If nothing is found, the complexity returned is UNKNOWN_VARIABLE, with a varcount_unknown set to 1. The variable statistics are up to date in the new complexity returned, in any case.

FI: I do not understand this algorithm as it does not try the easiest substitution, using any equation in precond that uses var with a non-zero coefficient.

This is the only case that we use the precondition

added by LZ 18/02/92

for the inner loop 28/06/91 example p.f

Definition at line 643 of file comp_expr_to_pnome.c.

647 {
648  predicate pred = transformer_relation(precond);
649  Psysteme psyst = (Psysteme) predicate_system(pred);
650  Value min = VALUE_MAX;
651  Value max = VALUE_MIN;
652  bool faisable;
654 
655 #define maxint_p(i) ((i) == INT_MAX)
656 #define minint_p(i) ((i) == (INT_MIN))
657 
658  trace_on("variable %s -> pnome, maximize %d ", entity_name(var), maximize);
659 
660  /* This is the only case that we use the precondition */
661  if (entity_integer_scalar_p(var) &&
662  precond != transformer_undefined &&
663  pred != predicate_undefined &&
664  !SC_UNDEFINED_P(psyst) ) {
665  Psysteme ps = sc_dup(psyst);
666  Psysteme ps1;
667  Pvecteur pv;
668  char *precondition_to_string();
669 
670  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
671  sc_fprint(stderr, ps, (get_variable_name_t) noms_var);
672  }
673 
674  for ( pv=ps->base; !VECTEUR_NUL_P(pv); pv=pv->succ) {
675  if ( var_of(pv) != (Variable)var ) {
677  (char *)module_local_name((entity)var_of(pv)));
678 
679  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
680  fprintf(stderr,"var_of is %s -- variable is %s --bool is %d\n",
682  module_local_name((entity)(var) ), b);
683  }
684 
685  if (!b) {
686  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
687  fprintf(stderr, "in projection %s\n",noms_var((entity)var_of(pv)));
688  }
689  ps = sc_projection(ps,var_of(pv));
690  }
691  }
692  }
693 
694  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
695  fprintf(stderr, "Prec=%s", precondition_to_string(precond));
696  sc_fprint(stderr, ps, (get_variable_name_t) noms_var);
697 
698  if ( !SC_UNDEFINED_P(ps) )
699  fprintf(stderr,"ps OK\n");
700  else
701  fprintf(stderr,"ps is NULL\n");
702  }
703 
704  /* added by LZ 18/02/92 */
706  (char *) var) ) {
707  if (get_bool_property("COMPLEXITY_INTERMEDIATES"))
708  fprintf(stderr,"Don't evaluate %s------\n", noms_var(var));
709  return(make_single_var_complexity(1.0, (Variable)var));
710  }
711 
712  ps1 = sc_dup(ps);
713  faisable = sc_minmax_of_variable(ps1, (Variable) var,
714  &min, &max);
715 
716  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
717  fprintf(stderr," faisable is %d\n",faisable);
718  fprintf(stderr,"Variable %s -- ", noms_var(var));
719  fprint_string_Value(stderr, "min is ", min);
720  fprint_string_Value(stderr, ", max is ", max);
721  fprintf(stderr,", maximize is %d\n", maximize);
722  }
723 
724  if ( faisable && (value_notmin_p(min) || value_notmax_p(max)) )
725  {
726 
727  if ( value_notmax_p(max) && TAKE_MAX(maximize) ) {
728  comp = simplify_sc_to_complexity(ps,(Variable)var);
729  if ( complexity_zero_p(comp) )
732  }
733  else if ( value_notmin_p(min) && TAKE_MIN(maximize) ) {
734  comp = simplify_sc_to_complexity(ps,(Variable)var);
735  if ( complexity_zero_p(comp) )
738  }
739 
740  /* for the inner loop 28/06/91 example p.f */
741  else if ( value_max_p(max) && TAKE_MAX(maximize) ) {
742  comp = simplify_sc_to_complexity(ps,(Variable)var);
743  if ( complexity_zero_p(comp) )
746  }
747  else if ( value_min_p(min) && TAKE_MIN(maximize) ) {
748  comp = simplify_sc_to_complexity(ps,(Variable)var);
749  if ( complexity_zero_p(comp) )
752  }
753 
754  else if (min == max) {
757  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
758  fprintf(stderr,"value is ");
759  fprint_Value(stderr, val_of((ps1->egalites)->vecteur));
760  fprintf(stderr, "\n");
761  fprint_string_Value(stderr,"max = min = ",max);
762  fprintf(stderr, "\n");
763  }
764  }
765  else if ( value_notmin_p(min) && value_notmax_p(max) ) {
766  comp = simplify_sc_to_complexity(ps,(Variable)var);
767  }
768  else {
769  comp = make_single_var_complexity( 1.0, (Variable) var);
771  }
772  }
773  else if ( faisable ) {
774  comp = simplify_sc_to_complexity(ps,(Variable)var);
775  }
776  }
777  else {
778  comp = make_single_var_complexity(1.0, (Variable) var);
780  }
781 
782  trace_off();
783  return(comp);
784 }
#define value_notmin_p(val)
#define VALUE_MIN
#define value_min_p(val)
#define value_notmax_p(val)
int Value
#define VALUE_TO_FLOAT(val)
#define VALUE_MAX
#define value_max_p(val)
void fprint_Value(FILE *, Value)
Definition: io.c:42
void fprint_string_Value(FILE *, char *, Value)
Definition: io.c:47
hash_table hash_complexity_parameters
Definition: comp_scan.c:58
complexity simplify_sc_to_complexity(Psysteme ps, Variable var)
This function is recently added by L.Zhou June 5, 91 simplify_sc_to_complexity(Psysteme ps,...
char * noms_var(entity e)
comp_expr_to_pnome.c
bool complexity_zero_p(complexity comp)
zero complexity check.
Definition: comp_math.c:244
complexity make_single_var_complexity(float f, Variable var)
make a complexity "f * var" with null statistics
Definition: comp_math.c:220
#define TAKE_MAX(m)
#define hash_contains_user_var_p(htp, key)
#define hash_contains_p(htp, key)
#define TAKE_MIN(m)
#define varcount_guessed(x)
#define complexity_varcount(x)
Definition: complexity_ri.h:94
#define varcount_unknown(x)
#define varcount_bounded(x)
#define min(a, b)
#define max(a, b)
bool entity_integer_scalar_p(entity)
for variables (like I), not constants (like 1)! use integer_constant_p() for constants
Definition: variable.c:1130
#define transformer_undefined
Definition: ri.h:2847
#define entity_name(x)
Definition: ri.h:2790
#define transformer_relation(x)
Definition: ri.h:2873
#define predicate_undefined
Definition: ri.h:2046
#define predicate_system(x)
Definition: ri.h:2069
struct Ssysteme * Psysteme
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
bool sc_minmax_of_variable(Psysteme ps, Variable var, Value *pmin, Value *pmax)
void sc_minmax_of_variable(Psysteme ps, Variable var, Value *pmin, *pmax): examine un systeme pour tr...
Definition: sc_eval.c:143
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
Definition: sc_io.c:220
Pcontrainte egalites
Definition: sc-local.h:70
Pbase base
Definition: sc-local.h:75
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
struct Svecteur * succ
Definition: vecteur-local.h:92
string precondition_to_string(transformer pre)
Definition: prettyprint.c:58
#define val_of(varval)
char *(* get_variable_name_t)(Variable)
Definition: vecteur-local.h:62
#define VECTEUR_NUL_P(v)
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60
#define var_of(varval)

References Ssysteme::base, complexity_varcount, complexity_zero_p(), Ssysteme::egalites, entity_integer_scalar_p(), entity_name, fprint_string_Value(), fprint_Value(), fprintf(), get_bool_property(), hash_complexity_parameters, hash_contains_p, hash_contains_user_var_p, make_constant_complexity(), make_single_var_complexity(), make_zero_complexity(), max, min, module_local_name(), noms_var(), precondition_to_string(), predicate_system, predicate_undefined, sc_dup(), sc_fprint(), sc_minmax_of_variable(), simplify_sc_to_complexity(), Svecteur::succ, TAKE_MAX, TAKE_MIN, trace_off(), trace_on(), transformer_relation, transformer_undefined, val_of, VALUE_MAX, value_max_p, VALUE_MIN, value_min_p, value_notmax_p, value_notmin_p, VALUE_TO_FLOAT, var_of, varcount_bounded, varcount_guessed, varcount_unknown, and VECTEUR_NUL_P.

Referenced by block_to_complexity(), final_statement_to_complexity_evaluation(), new_block_to_complexity(), pvecteur_to_polynome(), and reference_to_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expression_to_complexity_polynome()

complexity expression_to_complexity_polynome ( expression  expr,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)

Entry point routine of this file:

complexity expression_to_complexity_polynome(expression expr, transformer precond, list effects_list, bool keep_symbols, int maximize) return the polynomial associated to the expression expr, or POLYNOME_UNDEFINED if it's not a polynome. or POLYNOME_NULL if it's a 0 complexity. If keep_symbols is false, we force evaluation of variables. If they can't be evaluated, they enter the polynomial, but they are replaced by the pseudo-variable UNKNOWN_VARIABLE, except when they appear in a loop range: in that case, the whole range is replaced by UNKNOWN_RANGE. The int maximize lets us use the mins and maxs of preconditions system, to compute a WORST-CASE complexity for the upper bound , maximize is 1 for the lower bound and increment, maximize is -1 (when the precondition doesn't give an exact value)

effects_list is added on 10 Nov 92 to pass the effects which can be used to determine the "must-be-written" effects to delay the variable evaluation. LZ 10 Nov 92

FI:

  • better symbol generation for unknown complexities

The following line is merely for debugging

Parameters
exprxpr
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 118 of file comp_expr_to_pnome.c.

124 {
125  normalized no = NORMALIZE_EXPRESSION(expr);
126  syntax sy = expression_syntax(expr);
128 
129  trace_on("expression -> pnome");
130 
131  if ( expr == expression_undefined ) {
132  pips_internal_error("undefined expression");
133  }
134  if ( sy == syntax_undefined ) {
135  pips_internal_error("wrong expression");
136  }
137 
138  if ( normalized_linear_p(no) ) {
139  comp = normalized_to_polynome(no, precond, effects_list,
140  keep_symbols, maximize);
141  }
142  else {
143  comp = syntax_to_polynome(sy, precond, effects_list, keep_symbols, maximize);
144  }
145 
146  if ( complexity_unknown_p(comp) ) {
147  pips_internal_error("Better unknown value name generation required!");
148  /*
149  return(make_single_var_complexity(1.0,UNKNOWN_RANGE));
150  */
151  return complexity_undefined;
152  }
153 
154  /* The following line is merely for debugging */
155 
156  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
157  fprintf(stderr, "expr->pnome ");
158  complexity_fprint(stderr, comp, true, true);
159  }
160 
161  trace_off();
162  return (comp);
163 }
complexity normalized_to_polynome(normalized no, transformer precond, list effects_list, bool keep_symbols, int maximize)
2nd element of expression
complexity syntax_to_polynome(syntax synt, transformer precond, list effects_list, bool keep_symbols, int maximize)
1st element of expression
bool complexity_unknown_p(complexity comp)
true if comp is unknown.
Definition: comp_math.c:269
#define complexity_undefined
Definition: complexity_ri.h:66
#define NORMALIZE_EXPRESSION(e)
#define normalized_linear_p(x)
Definition: ri.h:1779
#define expression_undefined
Definition: ri.h:1223
#define syntax_undefined
Definition: ri.h:2676
#define expression_syntax(x)
Definition: ri.h:1247

References complexity_fprint(), complexity_undefined, complexity_unknown_p(), expression_syntax, expression_undefined, fprintf(), get_bool_property(), make_zero_complexity(), NORMALIZE_EXPRESSION, normalized_linear_p, normalized_to_polynome(), pips_internal_error, syntax_to_polynome(), syntax_undefined, trace_off(), and trace_on().

Referenced by cast_to_polynome(), divide_op_handler(), field_op_handler(), loop_to_complexity(), minus_op_handler(), multiply_op_handler(), plus_op_handler(), power_op_handler(), replace_formal_parameters_by_real_ones(), unary_minus_op_handler(), unary_plus_op_handler(), and whileloop_to_complexity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ field_op_handler()

complexity field_op_handler ( list  args,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)
Parameters
argsrgs
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 512 of file comp_expr_to_pnome.c.

513  {
515  precond, effects_list, keep_symbols,
516  maximize);
518  precond, effects_list, keep_symbols,
519  maximize);
520 
521  complexity_add(&c1, c2);
522  complexity_rm(&c2);
523 
524  return (c1);
525 }
void complexity_add(complexity *pcomp1, complexity comp2)
void complexity_add(complexity *pcomp1, comp2) performs *pcomp1 = *pcomp1 + comp2; !...
Definition: comp_math.c:372

References CAR, CDR, complexity_add(), complexity_rm(), EXPRESSION, and expression_to_complexity_polynome().

Referenced by call_to_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_complexity_unknown()

complexity make_complexity_unknown ( const char *  name)

builds a new unknown complexity attached to a virtual package

Parameters
nameame

Definition at line 81 of file comp_expr_to_pnome.c.

81  {
82  entity package = FindEntity(TOP_LEVEL_MODULE_NAME,COMPLEXITY_PACKAGE_NAME);
86  return make_single_var_complexity(1.f,var);
87 }
language make_language_fortran(void)
Definition: ri.c:1250
basic make_basic_int(intptr_t _field_)
Definition: ri.c:158
#define COMPLEXITY_PACKAGE_NAME
static char * package
The package name in which functions will be defined.
Definition: genLisp.c:59
#define DEFAULT_INTEGER_TYPE_SIZE
entity make_empty_program(const char *name, language l)
Definition: entity.c:261
entity make_new_scalar_variable_with_prefix(const char *, entity, basic)
Create a new scalar variable of type b in the given module.
Definition: variable.c:592
#define entity_undefined_p(x)
Definition: ri.h:2762

References COMPLEXITY_PACKAGE_NAME, DEFAULT_INTEGER_TYPE_SIZE, entity_undefined_p, make_basic_int(), make_empty_program(), make_language_fortran(), make_new_scalar_variable_with_prefix(), make_single_var_complexity(), and package.

Referenced by simplify_sc_to_complexity(), and whileloop_to_complexity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ minus_op_handler()

complexity minus_op_handler ( list  args,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)
Parameters
argsrgs
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 472 of file comp_expr_to_pnome.c.

478 {
480  precond, effects_list, keep_symbols,
481  maximize);
483  precond, effects_list, keep_symbols,
484  -maximize);
485 
486  complexity_sub(&c1, c2);
487  complexity_rm(&c2);
488 
489  return (c1);
490 }
void complexity_sub(complexity *pcomp1, complexity comp2)
void complexity_sub(complexity *pcomp1, comp2) performs *pcomp1 = *pcomp1 - comp2; !...
Definition: comp_math.c:394

References CAR, CDR, complexity_rm(), complexity_sub(), EXPRESSION, and expression_to_complexity_polynome().

Referenced by call_to_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ multiply_op_handler()

complexity multiply_op_handler ( list  args,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)
Parameters
argsrgs
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 492 of file comp_expr_to_pnome.c.

498 {
500  precond, effects_list, keep_symbols,
501  maximize);
503  precond, effects_list, keep_symbols,
504  maximize);
505 
506  complexity_mult(&c1, c2);
507  complexity_rm(&c2);
508 
509  return (c1);
510 }

References CAR, CDR, complexity_mult(), complexity_rm(), EXPRESSION, and expression_to_complexity_polynome().

Referenced by call_to_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noms_var()

char* noms_var ( entity  e)

comp_expr_to_pnome.c

Definition at line 60 of file comp_expr_to_pnome.c.

62 {
63  bool entity_has_values_p();
64  string external_value_name();
65 
66  if(e == (entity) TCST)
67  return "";
68  else
69  return entity_has_values_p(e) ? (char *)module_local_name(e) :
70  (char *)external_value_name(e);
71 }
const char * external_value_name(entity)
Definition: value.c:753
bool entity_has_values_p(entity)
This function could be made more robust by checking the storage of e.
Definition: value.c:911
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.

References entity_has_values_p(), external_value_name(), module_local_name(), and TCST.

Referenced by evaluate_var_to_complexity(), plint(), plint_pas(), sc_resol_smith(), simplify_sc_to_complexity(), smith_int(), and sol_finale().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ normalized_to_polynome()

complexity normalized_to_polynome ( normalized  no,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)

2nd element of expression

Parameters
noo
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 211 of file comp_expr_to_pnome.c.

217 {
219 
220  trace_on("normalized -> pnome");
221 
222  if (normalized_linear_p(no) ) {
223  Pvecteur pvect = (Pvecteur)normalized_linear(no);
224  comp = pvecteur_to_polynome(pvect, precond, effects_list, keep_symbols, maximize);
225  }
226  else
227  pips_internal_error("vecteur undefined");
228 
229  trace_off();
230  return(comp);
231 }
complexity pvecteur_to_polynome(Pvecteur pvect, transformer precond, list effects_list, bool keep_symbols, int maximize)
The only element available of normalized.
#define normalized_linear(x)
Definition: ri.h:1781
struct Svecteur * Pvecteur

References make_zero_complexity(), normalized_linear, normalized_linear_p, pips_internal_error, pvecteur_to_polynome(), trace_off(), and trace_on().

Referenced by expression_to_complexity_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ plus_op_handler()

complexity plus_op_handler ( list  args,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)
Parameters
argsrgs
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 452 of file comp_expr_to_pnome.c.

458 {
460  precond, effects_list, keep_symbols,
461  maximize);
463  precond, effects_list, keep_symbols,
464  maximize);
465 
466  complexity_add(&c1, c2);
467  complexity_rm(&c2);
468 
469  return (c1);
470 }

References CAR, CDR, complexity_add(), complexity_rm(), EXPRESSION, and expression_to_complexity_polynome().

Referenced by call_to_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ power_op_handler()

complexity power_op_handler ( list  args,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)

polynome_rm(&(complexity_eval(c1)));

(Ppolynome) complexity_eval(c1) = pp;

Parameters
argsrgs
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 589 of file comp_expr_to_pnome.c.

595 {
596  float power;
598  precond, effects_list, keep_symbols,
599  maximize);
601  precond, effects_list, DONT_KEEP_SYMBOLS,
602  maximize);
603 
604  if (complexity_constant_p(c2)) {
605  power = complexity_TCST(c2);
606  complexity_rm(&c2);
607  if (power == (int) power) {
609  (int) power);
610  Ppolynome pt = complexity_eval(c1);
611 
612  /* polynome_rm(&(complexity_eval(c1))); */
613  polynome_rm(&pt);
614  /* (Ppolynome) complexity_eval(c1) = pp; */
616  return (c1);
617  }
618  }
619  else
620  complexity_rm(&c2);
621 
622  complexity_rm(&c1);
623  return (make_zero_complexity());
624 }
Ppolynome complexity_polynome(complexity comp)
Because complexity is composed of two elements, we use this function to get the first element : polyn...
Definition: comp_math.c:506
#define complexity_eval(x)
Definition: complexity_ri.h:92
#define complexity_eval_(x)
Definition: complexity_ri.h:91
#define newgen_Ppolynome(p)
Definition: complexity_ri.h:19
void polynome_rm(Ppolynome *ppp)
void polynome_rm(Ppolynome* ppp) frees space occupied by polynomial *ppp returns *ppp pointing to POL...
Definition: pnome-alloc.c:170
Ppolynome polynome_power_n(Ppolynome pp, int n)
Ppolynome polynome_power_n(Ppolynome pp, int n) returns pp ^ n (n>=0)
Definition: pnome-scal.c:121

References CAR, CDR, complexity_constant_p(), complexity_eval, complexity_eval_, complexity_polynome(), complexity_rm(), complexity_TCST(), DONT_KEEP_SYMBOLS, EXPRESSION, expression_to_complexity_polynome(), make_zero_complexity(), newgen_Ppolynome, polynome_power_n(), and polynome_rm().

Referenced by call_to_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pvecteur_to_polynome()

complexity pvecteur_to_polynome ( Pvecteur  pvect,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)

The only element available of normalized.

bool must_be_written = false;

if (we_must_evaluate && must_be_written) {

should be multiplied by "val" here

We keep this symbol (including TCST) in the polynome

Parameters
pvectvect
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 234 of file comp_expr_to_pnome.c.

240 {
242  Ppolynome ppvar;
243  Pvecteur pv;
244  Variable var;
245  Value val;
246  bool we_must_evaluate;
247 /* bool must_be_written = false; */
248 
249  trace_on("pvecteur -> pnome maximize is %d", maximize);
250 
251  if ( get_bool_property("COMPLEXITY_INTERMEDIATES") ) {
252  fprintf(stderr, "expr->pnome: pvecteur = ");
253  vect_fprint(stderr, pvect, variable_name);
254  }
255 
256  for(pv=pvect; !VECTEUR_NUL_P(pv); pv = pv->succ) {
257  var = vect_first_var(pv);
258  val = vect_coeff(var, pv);
259 
260  we_must_evaluate =
261  (var != TCST) &&
263  (char *)module_local_name((entity)var)))
264  : true);
265 /*
266  must_be_written = is_must_be_written_var(effects_list,
267  variable_local_name(var));
268 
269  if ( get_debug_level() >= 3 ) {
270  fprintf(stderr, "Must be written var %s\n", variable_local_name(var) );
271  }
272 */
273 /*
274  if (we_must_evaluate && must_be_written) {
275 */
276  if (we_must_evaluate && get_bool_property("COMPLEXITY_EARLY_EVALUATION")) {
277  complexity ctmp;
278  ctmp = evaluate_var_to_complexity((entity)var, precond, effects_list, maximize);
279  /* should be multiplied by "val" here */
281  complexity_add(&comp, ctmp);
282  }
283  else {
284  /* We keep this symbol (including TCST) in the polynome */
285  Value exp = VALUE_ONE;
286  float coeff = VALUE_TO_FLOAT(val);
287 
288  ppvar = make_polynome(coeff, var, exp);
289  if (complexity_zero_p(comp))
290  comp = polynome_to_new_complexity(ppvar);
291  else
292  complexity_polynome_add(&comp, ppvar);
294  }
295  }
296 
297  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
298  fprintf(stderr, "Pvecteur evaluation = ");
299  prc(comp);
300  }
301 
302  trace_off();
303  return (comp);
304 }
#define VALUE_ONE
complexity evaluate_var_to_complexity(entity var, transformer precond, list effects_list __attribute__((__unused__)), int maximize)
complexity evaluate_var_to_complexity(entity var, transformer precond, list effects_list,...
void complexity_scalar_mult(complexity *pcomp, float f)
multiply a complexity by a floating-point number.
Definition: comp_math.c:303
void complexity_polynome_add(complexity *pcomp, Ppolynome pp)
Definition: comp_math.c:463
complexity polynome_to_new_complexity(Ppolynome pp)
Create a complexity equal to Ppolynome pp with null statistics.
Definition: comp_math.c:200
void prc(complexity comp)
Definition: comp_util.c:233
#define varcount_symbolic(x)
void vect_fprint(FILE *f, Pvecteur v, get_variable_name_t variable_name)
void vect_fprint(FILE * f, Pvecteur v, char * (*variable_name)()): impression d'un vecteur creux v su...
Definition: io.c:124
Ppolynome make_polynome(float coeff, Variable var, Value expo)
Ppolynome make_polynome(float coeff, Variable var, Value expo) PRIVATE allocates space for,...
Definition: pnome-alloc.c:100
Variable vect_first_var(Pvecteur pvec)
PRIVATE: marquage du couple var_val comme visite par remplacement de var par -var dans le couple (OBS...
Definition: private.c:227
char * variable_name(Variable v)
polynome_ri.c
Definition: polynome_ri.c:73
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228

References complexity_add(), complexity_polynome_add(), complexity_scalar_mult(), complexity_varcount, complexity_zero_p(), evaluate_var_to_complexity(), exp, fprintf(), get_bool_property(), hash_complexity_parameters, hash_contains_p, make_polynome(), make_zero_complexity(), module_local_name(), polynome_to_new_complexity(), prc(), Svecteur::succ, TCST, trace_off(), trace_on(), VALUE_ONE, VALUE_TO_FLOAT, varcount_symbolic, variable_name(), vect_coeff(), vect_first_var(), vect_fprint(), and VECTEUR_NUL_P.

Referenced by normalized_to_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ range_to_polynome()

complexity range_to_polynome ( range rg   __attribute__(__unused__),
transformer precond   __attribute__(__unused__),
list effects_list   __attribute__(__unused__),
bool keep_symbols   __attribute__(__unused__),
int maximize   __attribute__(__unused__) 
)

2nd element of syntax

Definition at line 352 of file comp_expr_to_pnome.c.

357 {
359 
360  trace_on("range -> pnome");
361 
362  pips_internal_error("Don't you know");
363 
364  trace_off();
365  return(comp);
366 }

References make_zero_complexity(), pips_internal_error, trace_off(), and trace_on().

Referenced by syntax_to_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reference_to_polynome()

complexity reference_to_polynome ( reference  ref,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)

First element of the "syntax" domain.

bool must_be_written;

if it's an array: let us fail

We keep this symbol in the polynome

Parameters
refef
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 307 of file comp_expr_to_pnome.c.

312 {
314  bool we_must_evaluate;
315 /* bool must_be_written; */
317 
318  trace_on("reference -> pnome");
319 
320  if ( reference_indices(ref) == NIL) {
321  /* if it's an array: let us fail */
322  we_must_evaluate = (keep_symbols ?
324  (char *)module_local_name((entity)var) ):
325  true);
326 /*
327  must_be_written = is_must_be_written_var(effects_list, var);
328 
329  if ( get_debug_level() >= 3 ) {
330  fprintf(stderr, "Must be written var %s\n", noms_var(var) );
331  }
332 */
333 /*
334  if (we_must_evaluate && must_be_written) {
335 */
336  if (we_must_evaluate && get_bool_property("COMPLEXITY_EARLY_EVALUATION")) {
337  comp = evaluate_var_to_complexity((entity)var, precond, effects_list, maximize);
338  }
339  else { /* We keep this symbol in the polynome */
340  Ppolynome pp = make_polynome((float) 1, (Variable) var, VALUE_ONE);
341  comp = polynome_to_new_complexity(pp);
343  polynome_rm(&pp);
344  }
345  }
346 
347  trace_off();
348  return(comp);
349 }
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
#define true
Definition: newgen_types.h:81
#define reference_variable(x)
Definition: ri.h:2326
#define reference_indices(x)
Definition: ri.h:2328

References complexity_varcount, evaluate_var_to_complexity(), get_bool_property(), hash_complexity_parameters, hash_contains_p, make_polynome(), make_zero_complexity(), module_local_name(), NIL, polynome_rm(), polynome_to_new_complexity(), ref, reference_indices, reference_variable, trace_off(), trace_on(), VALUE_ONE, and varcount_symbolic.

Referenced by syntax_to_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ simplify_sc_to_complexity()

complexity simplify_sc_to_complexity ( Psysteme  ps,
Variable  var 
)

This function is recently added by L.Zhou June 5, 91 simplify_sc_to_complexity(Psysteme ps, Variable var) It looks for the egality formula containing (Variable)var in the system (Psysteme)ps.

If ps->egalites is NULL, zero complexity is returned. The rest of the variable in that formula should be the known variable for example: formal parameter(s), inductible variable, etc. EX: M1 - M2 = 1 where M1 is formal parameter where M2 is an inductible variable This function returns M2 = M1 - 1 packed in the polynomial of the complexity the statistics of this complexity should be all zero.

Parameters
pss
varar

Definition at line 798 of file comp_expr_to_pnome.c.

801 {
803  Value var_coeff=VALUE_ONE;
804 
805  if (get_bool_property("COMPLEXITY_INTERMEDIATES")) {
806  sc_fprint(stderr, ps, (get_variable_name_t) noms_var);
807  }
808 
809  if ( !SC_UNDEFINED_P(ps) && !CONTRAINTE_UNDEFINED_P(ps->egalites) ) {
810  Pvecteur v = (ps->egalites)->vecteur;
811 
812  for ( ; !VECTEUR_NUL_P(v); v=v->succ ) {
813  if ( v->var != TCST ) {
814  if ( v->var != (Variable)var ) {
816  (VALUE_TO_FLOAT(v->val),v->var);
817  complexity_add(&comp, c);
818  complexity_rm(&c);
819  }
820  else {
821  var_coeff = value_uminus(v->val);
822  }
823  }
824  else {
826  (VALUE_TO_FLOAT(v->val));
827  complexity_add(&comp, c);
828  complexity_rm(&c);
829  }
830  }
831  }
832  else {
834  (char *)module_local_name((entity)var));
835 
836  if ( b )
837  comp = make_single_var_complexity(1.0, (Variable)var);
838  else
840  }
841 
842  complexity_scalar_mult(&comp,1.0/VALUE_TO_FLOAT(var_coeff));
844 
845  return (comp);
846 }
#define value_uminus(val)
unary operators on values
complexity make_complexity_unknown(const char *name)
builds a new unknown complexity attached to a virtual package
#define UNKNOWN_VARIABLE_NAME
pseudo-variable for unknown variables
#define CONTRAINTE_UNDEFINED_P(c)
Value val
Definition: vecteur-local.h:91
Variable var
Definition: vecteur-local.h:90

References complexity_add(), complexity_rm(), complexity_scalar_mult(), complexity_varcount, CONTRAINTE_UNDEFINED_P, get_bool_property(), hash_complexity_parameters, hash_contains_p, make_complexity_unknown(), make_constant_complexity(), make_single_var_complexity(), make_zero_complexity(), module_local_name(), noms_var(), sc_fprint(), Svecteur::succ, TCST, UNKNOWN_VARIABLE_NAME, Svecteur::val, VALUE_ONE, VALUE_TO_FLOAT, value_uminus, Svecteur::var, varcount_unknown, and VECTEUR_NUL_P.

Referenced by evaluate_var_to_complexity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syntax_to_polynome()

complexity syntax_to_polynome ( syntax  synt,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)

1st element of expression

This expression cannot be used within a polynomial, just like an array reference

Parameters
syntynt
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 166 of file comp_expr_to_pnome.c.

172 {
173  complexity comp = make_zero_complexity();// complexity_undefined;
174 
175  trace_on("syntax -> pnome");
176 
177  switch (syntax_tag(synt)) {
178  case is_syntax_reference:
180  precond, effects_list, keep_symbols, maximize);
181  break;
182  case is_syntax_range:
183  comp = range_to_polynome(syntax_range(synt),
184  precond, effects_list, keep_symbols, maximize);
185  break;
186  case is_syntax_call:
187  comp = call_to_polynome(syntax_call(synt),
188  precond, effects_list, keep_symbols, maximize);
189  break;
190  case is_syntax_cast:
191  comp = cast_to_polynome(syntax_cast(synt),
192  precond, effects_list, keep_symbols, maximize);
193  break;
195  case is_syntax_subscript:
197  case is_syntax_va_arg:
198  /* This expression cannot be used within a polynomial, just like
199  an array reference */
200  comp = make_zero_complexity();
201  break;
202  default:
203  pips_internal_error("Unexpected tag:%d\n", syntax_tag(synt));
204  }
205 
206  trace_off();
207  return (comp);
208 }
complexity reference_to_polynome(reference ref, transformer precond, list effects_list, bool keep_symbols, int maximize)
First element of the "syntax" domain.
complexity call_to_polynome(call call_instr, transformer precond, list effects_list, bool keep_symbols, int maximize)
3rd element of syntax
complexity cast_to_polynome(cast cast_instr, transformer precond, list effects_list, bool keep_symbols, int maximize)
4th element of syntax : Molka Becher
complexity range_to_polynome(range rg __attribute__((__unused__)), transformer precond __attribute__((__unused__)), list effects_list __attribute__((__unused__)), bool keep_symbols __attribute__((__unused__)), int maximize __attribute__((__unused__)))
2nd element of syntax
#define syntax_reference(x)
Definition: ri.h:2730
#define syntax_tag(x)
Definition: ri.h:2727
#define syntax_cast(x)
Definition: ri.h:2739
#define syntax_range(x)
Definition: ri.h:2733
@ is_syntax_range
Definition: ri.h:2692
@ is_syntax_application
Definition: ri.h:2697
@ is_syntax_cast
Definition: ri.h:2694
@ is_syntax_call
Definition: ri.h:2693
@ is_syntax_va_arg
Definition: ri.h:2698
@ is_syntax_reference
Definition: ri.h:2691
@ is_syntax_sizeofexpression
Definition: ri.h:2695
@ is_syntax_subscript
Definition: ri.h:2696
#define syntax_call(x)
Definition: ri.h:2736

References call_to_polynome(), cast_to_polynome(), is_syntax_application, is_syntax_call, is_syntax_cast, is_syntax_range, is_syntax_reference, is_syntax_sizeofexpression, is_syntax_subscript, is_syntax_va_arg, make_zero_complexity(), pips_internal_error, range_to_polynome(), reference_to_polynome(), syntax_call, syntax_cast, syntax_range, syntax_reference, syntax_tag, trace_off(), and trace_on().

Referenced by expression_to_complexity_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unary_minus_op_handler()

complexity unary_minus_op_handler ( list  args,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)
Parameters
argsrgs
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 527 of file comp_expr_to_pnome.c.

533 {
535  precond, effects_list, keep_symbols,
536  -maximize);
538 
539  complexity_sub(&c1, c2);
540  complexity_rm(&c2);
541 
542  return (c1);
543 }

References CAR, complexity_rm(), complexity_sub(), EXPRESSION, expression_to_complexity_polynome(), and make_zero_complexity().

Referenced by call_to_polynome().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unary_plus_op_handler()

complexity unary_plus_op_handler ( list  args,
transformer  precond,
list  effects_list,
bool  keep_symbols,
int  maximize 
)
Parameters
argsrgs
precondrecond
effects_listffects_list
keep_symbolseep_symbols
maximizeaximize

Definition at line 545 of file comp_expr_to_pnome.c.

551 {
553  precond, effects_list, keep_symbols,
554  maximize);
555 
556  return (c1);
557 }

References CAR, EXPRESSION, and expression_to_complexity_polynome().

+ Here is the call graph for this function:

Variable Documentation

◆ hash_callee_to_complexity

hash_table hash_callee_to_complexity
extern

comp_expr_to_pnome.c

scan a ri expression and try to make a polynomial of it Modif: – entity_local_name is replaced by module_local_name. LZ 230993 – MAXINT replaced by INT_MAX, -MAXINT by INT_MIN FI 1/12/95 useful, pips_error is defined there

Definition at line 57 of file comp_scan.c.

◆ hash_complexity_parameters

hash_table hash_complexity_parameters
extern