PIPS
static_controlize.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define STATIC_CONTROLIZE_MODULE_NAME   "STATCON"
 Warning! Do not modify this file that is automatically generated! More...
 
#define NLC_PREFIX   "NLC"
 
#define NSP_PREFIX   "NSP"
 
#define NUB_PREFIX   "NUB"
 
#define give_entity(n)
 
#define ENTITY_GE   give_entity(GREATER_OR_EQUAL_OPERATOR_NAME)
 
#define ENTITY_GT   give_entity(GREATER_THAN_OPERATOR_NAME)
 
#define ENTITY_LE   give_entity(LESS_OR_EQUAL_OPERATOR_NAME)
 
#define ENTITY_LT   give_entity(LESS_THAN_OPERATOR_NAME)
 
#define ENTITY_NOT   give_entity(NOT_OPERATOR_NAME)
 
#define ENTITY_EQ   give_entity(EQUAL_OPERATOR_NAME)
 
#define ENTITY_NE   give_entity(NOT_EQUAL_OPERATOR_NAME)
 
#define ENTITY_OR   give_entity(OR_OPERATOR_NAME)
 
#define ENTITY_AND   give_entity(AND_OPERATOR_NAME)
 
#define ENTITY_NLC_P(e)   (strncmp(entity_local_name(e), NLC_PREFIX, 3) == 0)
 
#define ENTITY_NSP_P(e)   (strncmp(entity_local_name(e), NSP_PREFIX, 3) == 0)
 
#define ENTITY_NUB_P(e)   (strcmp(entity_local_name(e), NUB_PREFIX, 3) == 0)
 
#define ENTITY_SP_P(ent)    (gen_find_eq(ent, Gstructure_parameters) != chunk_undefined)
 
#define ENTITY_STRICT_LOGICAL_OPERATOR_P(e)
 

Functions

bool print_code_static_control (const string)
 cproto-generated files More...
 
text text_static_control (entity, int, statement)
 
text store_sc_text_line (static_control)
 ================================================================ More...
 
conswords_test_list (list)
 ================================================================ More...
 
conswords_loop_list (list)
 ================================================================ More...
 
list words_entity_list (list)
 ================================================================ More...
 
static_control static_controlize_call (call)
 ================================================================ More...
 
static_control static_controlize_loop (loop)
 ================================================================= More...
 
static_control static_controlize_forloop (forloop)
 ================================================================= More...
 
static_control static_controlize_whileloop (whileloop)
 ================================================================= More...
 
static_control static_controlize_statement (statement)
 
static_control static_controlize_unstructured (unstructured)
 ================================================================= More...
 
bool static_controlize (string)
 ================================================================= More...
 
list loop_normalize_of_loop (loop, hash_table, list *, list *, list *, int *)
 ================================================================= More...
 
list loop_normalize_of_statement (statement, hash_table, list *, list *, list *, int *)
 ================================================================= More...
 
void loop_normalize_of_unstructured (unstructured, hash_table, list *, list *, list *, int *)
 ================================================================= More...
 
list stco_same_loops (statement_mapping, statement, statement)
 utils.c More...
 
int stco_renumber_code (statement, int)
 ================================================================ More...
 
expression sc_opposite_exp_of_conjunction (expression, list *)
 ================================================================ More...
 
bool splc_positive_relation_p (expression, list *)
 ================================================================ More...
 
list ndf_normalized_test (expression, list *)
 ================================================================ More...
 
expression normalize_test_leaves (expression, list *)
 ================================================================ More...
 
expression sc_conditional (expression, list *)
 ================================================================ More...
 
list loops_to_indices (list)
 ================================================================ More...
 
bool splc_linear_expression_p (expression, list *)
 ================================================================ More...
 
bool splc_linear_expression_list_p (list, list *)
 ================================================================ More...
 
bool splc_linear_access_to_arrays_p (list, list *)
 ================================================================ More...
 
string print_structurals (list)
 ================================================================ More...
 
list sc_list_of_exp_dup (list)
 ================================================================ More...
 
list sc_list_of_entity_dup (list)
 ================================================================ More...
 
list sc_list_of_loop_dup (list)
 ================================================================ More...
 
loop sc_loop_dup (loop)
 ================================================================ More...
 
list make_undefined_list (void)
 ================================================================ More...
 
int in_forward_defined (entity, list *)
 ================================================================ More...
 
bool in_forward_defined_p (entity, list *)
 ================================================================ More...
 
void verify_structural_parameters (list, list *)
 ================================================================ More...
 
list sc_entity_to_formal_integer_parameters (entity)
 ================================================================ More...
 
bool sp_linear_expression_p (expression)
 ================================================================ More...
 
bool splc_feautrier_expression_p (expression, list *)
 ================================================================ More...
 
bool sp_feautrier_expression_p (expression)
 ================================================================ More...
 
entity sp_feautrier_scalar_assign_call (call)
 ================================================================ More...
 
bool get_sp_of_call_p (call, hash_table, list *)
 ================================================================ More...
 
void forward_substitute_in_anyloop (void *, hash_table)
 
void forward_substitute_in_exp (expression *, hash_table)
 
void forward_substitute_in_call (call *, hash_table)
 
bool normalizable_loop_p (loop)
 bool normalizable_loop_p(loop l) Returns true if "l" has a constant step. More...
 
bool normalizable_loop_p_retrieved (loop)
 Code retrieved from revision 14476, transformations/loop_normalize.c. More...
 
bool is_expression_in_list (expression, list)
 State if an expression OR part of that expression corresponds to one of the entity of the list l. More...
 
bool get_reference_assignments (statement, list *)
 Allows the static_controlize phase to keep and update a list containing all the variables of the program assigned directly or indirectly by an array. More...
 

Variables

int Gcount_nlc
 
int Gcount_nsp
 ================================================================ More...
 
int Gcount_nub
 
list Gstructure_parameters
 static_controlize.c More...
 
statement_mapping Gstatic_control_map
 
list assigned_var
 ================================================================= More...
 

Macro Definition Documentation

◆ ENTITY_AND

#define ENTITY_AND   give_entity(AND_OPERATOR_NAME)

Definition at line 47 of file static_controlize.h.

◆ ENTITY_EQ

#define ENTITY_EQ   give_entity(EQUAL_OPERATOR_NAME)

Definition at line 44 of file static_controlize.h.

◆ ENTITY_GE

Definition at line 39 of file static_controlize.h.

◆ ENTITY_GT

#define ENTITY_GT   give_entity(GREATER_THAN_OPERATOR_NAME)

Definition at line 40 of file static_controlize.h.

◆ ENTITY_LE

#define ENTITY_LE   give_entity(LESS_OR_EQUAL_OPERATOR_NAME)

Definition at line 41 of file static_controlize.h.

◆ ENTITY_LT

#define ENTITY_LT   give_entity(LESS_THAN_OPERATOR_NAME)

Definition at line 42 of file static_controlize.h.

◆ ENTITY_NE

#define ENTITY_NE   give_entity(NOT_EQUAL_OPERATOR_NAME)

Definition at line 45 of file static_controlize.h.

◆ ENTITY_NLC_P

#define ENTITY_NLC_P (   e)    (strncmp(entity_local_name(e), NLC_PREFIX, 3) == 0)

Definition at line 49 of file static_controlize.h.

◆ ENTITY_NOT

#define ENTITY_NOT   give_entity(NOT_OPERATOR_NAME)

Definition at line 43 of file static_controlize.h.

◆ ENTITY_NSP_P

#define ENTITY_NSP_P (   e)    (strncmp(entity_local_name(e), NSP_PREFIX, 3) == 0)

Definition at line 50 of file static_controlize.h.

◆ ENTITY_NUB_P

#define ENTITY_NUB_P (   e)    (strcmp(entity_local_name(e), NUB_PREFIX, 3) == 0)

Definition at line 51 of file static_controlize.h.

◆ ENTITY_OR

#define ENTITY_OR   give_entity(OR_OPERATOR_NAME)

Definition at line 46 of file static_controlize.h.

◆ ENTITY_SP_P

#define ENTITY_SP_P (   ent)     (gen_find_eq(ent, Gstructure_parameters) != chunk_undefined)

Definition at line 52 of file static_controlize.h.

◆ ENTITY_STRICT_LOGICAL_OPERATOR_P

#define ENTITY_STRICT_LOGICAL_OPERATOR_P (   e)
Value:
( ENTITY_AND_P(e) || \
ENTITY_OR_P(e) || \
ENTITY_EQUIV_P(e) || \
ENTITY_NON_EQUIV_P(e) || \
ENTITY_NOT_P(e) )
#define ENTITY_AND_P(e)

Definition at line 54 of file static_controlize.h.

◆ give_entity

#define give_entity (   n)
Value:
string make_entity_fullname(const char *module_name, const char *local_name)
END_EOLE.
Definition: entity_names.c:230
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
Definition: naming-local.h:101
void * gen_find_tabulated(const char *, int)
Definition: tabulated.c:218
#define entity_domain
newgen_syntax_domain_defined
Definition: ri.h:410

Definition at line 37 of file static_controlize.h.

◆ NLC_PREFIX

#define NLC_PREFIX   "NLC"

Definition at line 33 of file static_controlize.h.

◆ NSP_PREFIX

#define NSP_PREFIX   "NSP"

Definition at line 34 of file static_controlize.h.

◆ NUB_PREFIX

#define NUB_PREFIX   "NUB"

Definition at line 35 of file static_controlize.h.

◆ STATIC_CONTROLIZE_MODULE_NAME

#define STATIC_CONTROLIZE_MODULE_NAME   "STATCON"

Warning! Do not modify this file that is automatically generated!

Modify src/Libs/static_controlize/static_controlize-local.h instead, to add your own modifications. header file built by cproto static_controlize-local.h

Definition at line 32 of file static_controlize.h.

Function Documentation

◆ forward_substitute_in_anyloop()

void forward_substitute_in_anyloop ( void *  pl,
hash_table  fst 
)

Would it be better to loop over with HASH_MAP or to check every reference?

Parameters
pll
fstst

Definition at line 1139 of file utils.c.

1140 {
1141  /* Would it be better to loop over with HASH_MAP or to check every
1142  reference? */
1145  NULL);
1146 }
void gen_context_multi_recurse(void *o, void *context,...)
Multi-recursion with context function visitor.
Definition: genClib.c:3373
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
Definition: properties.c:783
#define expression_domain
newgen_execution_domain_defined
Definition: ri.h:154
static void substitute_variable_by_expression(expression e, hash_table fst)
rewriting of forward_substitute_in_exp, in_loop,...
Definition: utils.c:1122

References expression_domain, gen_context_multi_recurse(), gen_true(), pl, and substitute_variable_by_expression().

Referenced by loop_normalize_of_statement(), and static_controlize_statement().

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

◆ forward_substitute_in_call()

void forward_substitute_in_call ( call pc,
hash_table  fst 
)

Would it be better to loop over with HASH_MAP or to check every reference?

Parameters
pcc
fstst

Definition at line 1157 of file utils.c.

1158 {
1159  pips_assert("call c is consistent_p\n", call_consistent_p(*pc));
1160 
1161  /* Would it be better to loop over with HASH_MAP or to check every
1162  reference? */
1163  gen_context_multi_recurse(*pc, fst,
1165  NULL);
1166 }
bool call_consistent_p(call p)
Definition: ri.c:242
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172

References call_consistent_p(), expression_domain, gen_context_multi_recurse(), gen_true(), pips_assert, and substitute_variable_by_expression().

Referenced by loop_normalize_of_statement(), and static_controlize_statement().

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

◆ forward_substitute_in_exp()

void forward_substitute_in_exp ( expression pe,
hash_table  fst 
)

Would it be better to loop over with HASH_MAP or to check every reference?

Parameters
pee
fstst

Definition at line 1148 of file utils.c.

1149 {
1150  /* Would it be better to loop over with HASH_MAP or to check every
1151  reference? */
1152  gen_context_multi_recurse(*pe, fst,
1154  NULL);
1155 }

References expression_domain, gen_context_multi_recurse(), gen_true(), and substitute_variable_by_expression().

Referenced by adg_dataflowgraph(), loop_normalize_of_statement(), and static_controlize_statement().

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

◆ get_reference_assignments()

bool get_reference_assignments ( statement  s,
list l 
)

Allows the static_controlize phase to keep and update a list containing all the variables of the program assigned directly or indirectly by an array.

Definition at line 1300 of file utils.c.

1300  {
1301  // we only compute assignments
1302  if (!assignment_statement_p(s)) {
1303  return false;
1304  }
1306  // May not be necessary
1307  if (!instruction_call_p(inst)) {
1308  return false;
1309  }
1310  // Being an assignment, logically this call has only two arguments
1311  call c = instruction_call(inst);
1312  list args = call_arguments(c);
1313  // Left member of the assignment
1314  expression left = gen_car(args);
1315  entity eleft = expression_to_entity(left);
1316  // Right member of the assignment
1317  expression right = gen_car(CDR(args));
1318  // If the assigned variable is not in the list
1319  if (gen_find_eq(eleft, *l) == chunk_undefined) {
1320  // Test if the assignment is static control
1322  syntax s = expression_syntax(left);
1323  // We look for the right member in the list in order to know if the variable read has not been assigned by an array
1324  bool isRightArrayAccess = is_expression_in_list(right, *l);
1325  // If the left member is a scalar and if the right member is not static control or if it is a variable previously assigned
1326  // by an array, then we add the left member to the list
1327  if ((syntax_reference_p(s) && reference_indices(syntax_reference(s)) == NIL) && (entity_undefined_p(e) || isRightArrayAccess == true)) {
1328  *l = gen_cons(eleft, *l);
1329  }
1330  }
1331  return true;
1332 }
#define chunk_undefined
obsolete
Definition: genC.h:79
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
list gen_cons(const void *item, const list next)
Definition: list.c:888
#define CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
void * gen_find_eq(const void *item, const list seq)
Definition: list.c:422
void * gen_car(list l)
Definition: list.c:364
bool assignment_statement_p(statement)
Test if a statement is an assignment.
Definition: statement.c:135
entity expression_to_entity(expression e)
just returns the entity of an expression, or entity_undefined
Definition: expression.c:3140
#define syntax_reference_p(x)
Definition: ri.h:2728
#define syntax_reference(x)
Definition: ri.h:2730
#define entity_undefined_p(x)
Definition: ri.h:2762
#define reference_indices(x)
Definition: ri.h:2328
#define instruction_call_p(x)
Definition: ri.h:1527
#define statement_instruction(x)
Definition: ri.h:2458
#define instruction_call(x)
Definition: ri.h:1529
#define call_arguments(x)
Definition: ri.h:711
#define expression_syntax(x)
Definition: ri.h:1247
bool is_expression_in_list(expression exp, list l)
State if an expression OR part of that expression corresponds to one of the entity of the list l.
Definition: utils.c:1200
entity sp_feautrier_scalar_assign_call(call c)
================================================================
Definition: utils.c:1029
The structure used to build lists in NewGen.
Definition: newgen_list.h:41

References assignment_statement_p(), call_arguments, CDR, chunk_undefined, entity_undefined_p, expression_syntax, expression_to_entity(), gen_car(), gen_cons(), gen_find_eq(), instruction_call, instruction_call_p, is_expression_in_list(), NIL, reference_indices, sp_feautrier_scalar_assign_call(), statement_instruction, syntax_reference, and syntax_reference_p.

Referenced by static_controlize_statement().

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

◆ get_sp_of_call_p()

bool get_sp_of_call_p ( call  c,
hash_table  fst,
list swfl 
)

================================================================

bool get_sp_of_call_p( (call) c, fst) AL 04/93 Updates the global variables Gstructure_parameters and Gforward_substitute_table according to the type of call. Returns true if the call has to be modified (redefinition of a structural parameter), false in all the other cases.

AP, sep 95 : Gforward_substitute_table is no longer a global variable, we pass it as an argument.

I: not too sure about the false parameter...

Parameters
fstst
swflbool get_sp_of_call_p( (call) c, fst) AL 04/93 Updates the global variables Gstructure_parameters and Gforward_substitute_table according to the type of call. Returns true if the call has to be modified (redefinition of a structural parameter), false in all the other cases.

AP, sep 95 : Gforward_substitute_table is no longer a global variable, we pass it as an argument. forward substitute table

Definition at line 1056 of file utils.c.

1060 {
1061  entity lhs_ent, ent;
1062  bool ret_bool = false;
1063 
1064  pips_debug(7, "begin\n");
1065  /*FI: not too sure about the false parameter... */
1066  pips_debug(9, "input call : %s \n",
1067  words_to_string(Words_Regular_Call(c, false )));
1068  pips_debug(9, "struct param. before : %s \n",
1070 
1071  if (ENTITY_READ_P( call_function(c) )) {
1072  list the_arg = call_arguments( c );
1073 
1074  MAPL( exp_ptr,
1075  {
1076  expression exp = EXPRESSION(CAR( exp_ptr ));
1078  if ((ent != entity_undefined) && !in_forward_defined_p(ent, swfl))
1080  },
1081  the_arg);
1082  }
1083 
1084  if ( ((lhs_ent = sp_feautrier_scalar_assign_call(c)) != entity_undefined)
1085  && (in_forward_defined(lhs_ent, swfl) <= 1) ) {
1086 
1087  expression nsp_exp;
1088  entity nsp_ent;
1089 
1090  if ( !ENTITY_SP_P( lhs_ent ) ) {
1092  }
1093  else {
1094  nsp_ent = make_nsp_entity();
1095  nsp_exp = make_entity_expression( nsp_ent, NIL );
1096  hash_put(fst, (char*) lhs_ent, (char*) nsp_exp );
1098  ret_bool = true;
1099  }
1100  }
1101 
1102  pips_debug(9, "struct param. after : %s \n",
1104  pips_debug(9, "call has to be modified : %s \n",
1105  ((ret_bool == true)?"TRUE":"FALSE") );
1106  pips_debug(7, "end\n");
1107  return( ret_bool );
1108 }
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#define MAPL(_map_list_cp, _code, _l)
Apply some code on the addresses of all the elements of a list.
Definition: newgen_list.h:203
void hash_put(hash_table htp, const void *key, const void *val)
This functions stores a couple (key,val) in the hash table pointed to by htp.
Definition: hash.c:364
#define ADD_ELEMENT_TO_LIST(_list, _type, _element)
Definition: icfg-local.h:50
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
entity expression_int_scalar(expression exp)
================================================================
entity make_nsp_entity()
entity make_nsp_entity() Makes a new NSP (for New Structural Parameter) .
list Words_Regular_Call(call obj, bool is_a_subroutine)
Definition: misc.c:1081
#define ENTITY_READ_P(e)
expression make_entity_expression(entity e, cons *inds)
Definition: expression.c:176
#define call_function(x)
Definition: ri.h:709
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define entity_undefined
Definition: ri.h:2761
#define ENTITY_SP_P(ent)
string print_structurals(list l)
================================================================
Definition: utils.c:732
int in_forward_defined(entity ent, list *swfl)
================================================================
Definition: utils.c:836
bool in_forward_defined_p(entity ent, list *swfl)
================================================================
Definition: utils.c:855
list Gstructure_parameters
Global variables
string words_to_string(cons *lw)
Definition: print.c:211
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References ADD_ELEMENT_TO_LIST, call_arguments, call_function, CAR, ENTITY, ENTITY_READ_P, ENTITY_SP_P, entity_undefined, exp, EXPRESSION, expression_int_scalar(), Gstructure_parameters, hash_put(), in_forward_defined(), in_forward_defined_p(), make_entity_expression(), make_nsp_entity(), MAPL, NIL, pips_debug, print_structurals(), sp_feautrier_scalar_assign_call(), Words_Regular_Call(), and words_to_string().

+ Here is the call graph for this function:

◆ in_forward_defined()

int in_forward_defined ( entity  ent,
list swfl 
)

================================================================

int in_forward_defined( (entity) ent ) AL 30/08/93 Returns the number of entities ent in the list Gscalar_written_forward.

Parameters
entnt
swflwfl

Definition at line 836 of file utils.c.

837 {
838  cons *pc;
839  int ret_int = 0;
840 
841  pips_debug(9, "doing \n");
842  for (pc = *swfl; pc != NIL; pc = pc->cdr ) {
843  if ((void *) ent == CAR(pc).p)
844  ret_int++;
845  }
846 
847  pips_debug(9, "returns : %d\n", ret_int);
848  return( ret_int );
849 }
struct cons * cdr
The pointer to the next element.
Definition: newgen_list.h:43

References CAR, cons::cdr, NIL, and pips_debug.

Referenced by get_sp_of_call_p().

+ Here is the caller graph for this function:

◆ in_forward_defined_p()

bool in_forward_defined_p ( entity  ent,
list swfl 
)

================================================================

bool in_forward_defined_p( (entity) ent ) AL 04/93 Returns true if ent is in global variable Gscalar_written_forward.

Parameters
entnt
swflwfl

Definition at line 855 of file utils.c.

856 {
857  entity ch;
858 
859  pips_debug(7, "doing \n");
860  ch = (entity) gen_find_eq(ent, *swfl );
861  pips_debug(9, "scalar written_forward = %s\n",
862  print_structurals(*swfl) );
863  return( ch != entity_undefined );
864 }
struct _newgen_struct_entity_ * entity
Definition: abc_private.h:14

References entity_undefined, gen_find_eq(), pips_debug, and print_structurals().

Referenced by get_sp_of_call_p().

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

◆ is_expression_in_list()

bool is_expression_in_list ( expression  exp,
list  l 
)

State if an expression OR part of that expression corresponds to one of the entity of the list l.

This function was specifically designed in order to find if an expression is using one of the variable/entity listed in l. The function considers that the list only contains scalar variables.

Parameters
expxp

Definition at line 1200 of file utils.c.

1200  {
1201  if (l == NIL)
1202  return false;
1204  switch (syntax_tag(s)) {
1205  // If the expression is an array we go look among the indices by calling
1206  // the function on these indices
1207  case is_syntax_reference :
1208  {
1210  if (reference_indices(ref) != NIL) {
1212  if(is_expression_in_list(e, l))
1213  return true;
1214  }
1215  }
1216  else {
1217  entity ent = reference_variable(ref);
1218  if (gen_find_eq(ent, l) != chunk_undefined)
1219  return true;
1220  }
1221  }
1222  break;
1223  // Same principle, we go look among the arguments of the call
1224  case is_syntax_call :
1225  {
1226  call c = syntax_call(s);
1228  if(is_expression_in_list(e, l))
1229  return true;
1230  }
1231  }
1232  break;
1233  case is_syntax_cast :
1234  {
1235  cast ca = syntax_cast(s);
1237  if (gen_find_eq(ent, l) != chunk_undefined) {
1238  return true;
1239  }
1240  }
1241  break;
1242  // We call the function on every component of the range object
1243  case is_syntax_range :
1244  {
1245  range ra = syntax_range(s);
1247  }
1248  break;
1249  case is_syntax_subscript :
1250  {
1251  subscript sub = syntax_subscript(s);
1252  bool isinArray = is_expression_in_list(subscript_array(sub), l);
1253  if (isinArray)
1254  return true;
1256  if (is_expression_in_list(e, l)) {
1257  return true;
1258  }
1259  }
1260  }
1261  break;
1262  case is_syntax_application :
1263  {
1265  bool isinFunction = is_expression_in_list(application_function(app), l);
1266  if (isinFunction)
1267  return true;
1269  if (is_expression_in_list(e, l)) {
1270  return true;
1271  }
1272  }
1273  }
1274  break;
1275  case is_syntax_va_arg :
1276  {
1277  list sil = syntax_va_arg(s);
1278  FOREACH(sizeofexpression, soe, sil) {
1280  return true;
1281  }
1282  }
1283  break;
1285  {
1288  return true;
1289  }
1290  break;
1291  default :
1292  return false;
1293  }
1294  return false;
1295  }
static reference ref
Current stmt (an integer)
Definition: adg_read_paf.c:163
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
Definition: newgen_list.h:179
#define syntax_tag(x)
Definition: ri.h:2727
#define reference_variable(x)
Definition: ri.h:2326
#define range_upper(x)
Definition: ri.h:2290
#define sizeofexpression_expression(x)
Definition: ri.h:2409
#define syntax_cast(x)
Definition: ri.h:2739
#define syntax_application(x)
Definition: ri.h:2748
#define syntax_va_arg(x)
Definition: ri.h:2751
#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 range_increment(x)
Definition: ri.h:2292
#define cast_expression(x)
Definition: ri.h:747
#define application_arguments(x)
Definition: ri.h:510
#define subscript_indices(x)
Definition: ri.h:2563
#define syntax_sizeofexpression(x)
Definition: ri.h:2742
#define syntax_call(x)
Definition: ri.h:2736
#define subscript_array(x)
Definition: ri.h:2561
#define application_function(x)
Definition: ri.h:508
#define range_lower(x)
Definition: ri.h:2288
#define syntax_subscript(x)
Definition: ri.h:2745

References application_arguments, application_function, call_arguments, cast_expression, chunk_undefined, exp, expression_syntax, expression_to_entity(), FOREACH, gen_find_eq(), is_expression_in_list(), 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, NIL, range_increment, range_lower, range_upper, ref, reference_indices, reference_variable, sizeofexpression_expression, subscript_array, subscript_indices, syntax_application, syntax_call, syntax_cast, syntax_range, syntax_reference, syntax_sizeofexpression, syntax_subscript, syntax_tag, and syntax_va_arg.

Referenced by get_reference_assignments(), and is_expression_in_list().

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

◆ loop_normalize_of_loop()

list loop_normalize_of_loop ( loop  l,
hash_table  fst,
list ell,
list etl,
list swfl,
int Gcount_nlc 
)

=================================================================

================================================================= list loop_normalize_of_loop((loop) l, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc) AL 04/93

FI/SG Question: why change the loop index when it is not necessary? To have a uniform behavior when it is necessary?

loop_body( l ) = make_block_with_stmt( loop_body( l ));

If it is not a constant step, we just normalize the loop body

new upper bound, or at least iteration count

Generate the new loop index and the new loop bounds

assume C

Generate the change of basis expression: the new index starts at 0 in C and 1 in Fortran:

old_index = rl + (new_index * ri) // C

old_index = rl + (new_index * ri) - ri // Fortran

Compute the value of the index when the loop is exited: exp_max

nub3 is not used any longer

FI: Why copy nub? it does not seem used anywhere else.

Parameters
fstst
ell================================================================= list loop_normalize_of_loop((loop) l, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc) AL 04/93

FI/SG Question: why change the loop index when it is not necessary? To have a uniform behavior when it is necessary? forward substitute table

Parameters
etl================================================================= list loop_normalize_of_loop((loop) l, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc) AL 04/93

FI/SG Question: why change the loop index when it is not necessary? To have a uniform behavior when it is necessary? enclosing loops list

Parameters
swfl================================================================= list loop_normalize_of_loop((loop) l, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc) AL 04/93

FI/SG Question: why change the loop index when it is not necessary? To have a uniform behavior when it is necessary? enclosing tests list

Parameters
Gcount_nlc================================================================= list loop_normalize_of_loop((loop) l, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc) AL 04/93

FI/SG Question: why change the loop index when it is not necessary? To have a uniform behavior when it is necessary? scalar written forward list

Definition at line 616 of file static_controlize.c.

623 {
624  entity index, nlc_ent, max_ent;
625  expression rl, ru, ri, nub, nlc_exp, exp_plus;
626  expression nub2, nub3, index_exp, new_index_exp;
628  range lr;
630  statement end_stmt = statement_undefined;
631  list stmt_list = NIL;
632 
633  pips_debug(4, "begin LOOP\n");
634 
636  /* loop_body( l ) = make_block_with_stmt( loop_body( l ));*/
638  index = loop_index( l );
639 
640  /* If it is not a constant step, we just normalize the loop body */
641  if(!normalizable_loop_p(l)) {
642  ADD_ELEMENT_TO_LIST(*swfl, ENTITY, index);
643  (void) loop_normalize_of_statement(loop_body( l ), fst, ell,
644  etl, swfl, Gcount_nlc);
645  return( make_undefined_list() );
646  }
647 
648  lr = loop_range( l );
649  rl = range_lower( lr );
650  ru = range_upper( lr );
651  ri = range_increment( lr );
652 
653  /* new upper bound, or at least iteration count */
657  copy_expression(ru),
658  copy_expression(rl)),
659  copy_expression(ri)),
660  copy_expression(ri));
661  nub2 = copy_expression(nub);
662 
663  ADD_ELEMENT_TO_LIST( stmt_list, STATEMENT, before_stmt );
664 
665  /* Generate the new loop index and the new loop bounds */
666  nlc_ent = make_nlc_entity(Gcount_nlc);
667  ADD_ELEMENT_TO_LIST(*swfl, ENTITY, nlc_ent);
668  nlc_exp = make_entity_expression( nlc_ent, NIL);
669  loop_index( l ) = nlc_ent;
671  range_lower( lr ) = int_to_expression( 1 );
672  range_upper( lr ) = nub2;
673  }
674  else {
675  /* assume C */
676  range_lower( lr ) = int_to_expression( 0 );
678  int_to_expression(1));
679  }
680  range_increment( lr ) = int_to_expression( 1 );
681 
682  /* Generate the change of basis expression: the new index starts at
683  0 in C and 1 in Fortran:
684 
685  old_index = rl + (new_index * ri) // C
686 
687  old_index = rl + (new_index * ri) - ri // Fortran
688 
689  */
690  new_index_exp = make_op_exp(MULTIPLY_OPERATOR_NAME,
691  copy_expression(ri),
692  nlc_exp);
694  new_index_exp = make_op_exp(MINUS_OPERATOR_NAME,
695  new_index_exp,
696  copy_expression(ri));
697  }
698  new_index_exp = make_op_exp(PLUS_OPERATOR_NAME,
699  new_index_exp,
700  copy_expression(rl));
701  hash_put(fst, (char*) index, (char*) new_index_exp);
702 
703  /* Compute the value of the index when the loop is exited: exp_max */
704  nub3 = copy_expression( nub );
705  if ( expression_constant_p( nub3 )) {
706  int upper = expression_to_int( nub3 );
707  if ( upper > 0 )
708  /* nub3 is not used any longer */
709  exp_max = int_to_expression( upper );
710  }
711  else {
714  entity_domain);
715  /* FI: Why copy nub? it does not seem used anywhere else. */
716  exp_max = make_max_exp(max_ent, copy_expression( nub ),
717  int_to_expression( 0 ));
718  }
719  if ( exp_max == expression_undefined )
720  exp_plus = copy_expression( rl );
721  else
722  exp_plus = make_op_exp(PLUS_OPERATOR_NAME,
724  copy_expression( ri ),
725  exp_max),
726  copy_expression( rl ));
727  index_exp = make_entity_expression( index, NIL );
728  end_stmt = make_assign_statement(copy_expression(index_exp), exp_plus );
730 
731  loop_normalize_of_statement(loop_body(l), fst , ell, etl, swfl, Gcount_nlc);
732 
733  hash_del(fst, (char*) index );
734  pips_debug(4, "end LOOP\n");
735  return( stmt_list );
736 }
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
list stmt_list
The "stmt_list" global variable is the list the assign statement of the program (with all fields empt...
Definition: adg_read_paf.c:144
statement make_block_with_stmt_if_not_already(statement)
Build a statement block from a statement if not already a statement block.
Definition: statement.c:768
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
statement make_assign_statement(expression, expression)
Definition: statement.c:583
statement make_continue_statement(entity)
Definition: statement.c:953
void * hash_del(hash_table htp, const void *key)
this function removes from the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:439
bool expression_constant_p(expression)
HPFC module by Fabien COELHO.
Definition: expression.c:2453
entity make_nlc_entity(int *Gcount_nlc)
================================================================
expression make_max_exp(entity ent, expression exp1, expression exp2)
================================================================
#define MAX_OPERATOR_NAME
#define MINUS_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define DIVIDE_OPERATOR_NAME
#define MULTIPLY_OPERATOR_NAME
entity entity_empty_label(void)
Definition: entity.c:1105
bool fortran_module_p(entity m)
Test if a module is in Fortran.
Definition: entity.c:2799
int expression_to_int(expression exp)
================================================================
Definition: expression.c:2205
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
Definition: expression.c:1188
expression make_op_exp(char *op_name, expression exp1, expression exp2)
================================================================
Definition: expression.c:2012
#define loop_body(x)
Definition: ri.h:1644
#define expression_undefined
Definition: ri.h:1223
#define loop_label(x)
Definition: ri.h:1646
#define loop_range(x)
Definition: ri.h:1642
#define loop_index(x)
Definition: ri.h:1640
#define statement_undefined
Definition: ri.h:2419
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
int Gcount_nlc
list loop_normalize_of_statement(statement s, hash_table fst, list *ell, list *etl, list *swfl, int *Gcount_nlc)
=================================================================
list make_undefined_list(void)
================================================================
Definition: utils.c:815
bool normalizable_loop_p(loop)
bool normalizable_loop_p(loop l) Returns true if "l" has a constant step.
Definition: utils.c:1172

References ADD_ELEMENT_TO_LIST, copy_expression(), DIVIDE_OPERATOR_NAME, ENTITY, entity_domain, entity_empty_label(), expression_constant_p(), expression_to_int(), expression_undefined, fortran_module_p(), Gcount_nlc, gen_find_tabulated(), get_current_module_entity(), hash_del(), hash_put(), int_to_expression(), loop_body, loop_index, loop_label, loop_normalize_of_statement(), loop_range, make_assign_statement(), make_block_with_stmt_if_not_already(), make_continue_statement(), make_entity_expression(), make_entity_fullname(), make_max_exp(), make_nlc_entity(), make_op_exp(), make_undefined_list(), MAX_OPERATOR_NAME, MINUS_OPERATOR_NAME, MULTIPLY_OPERATOR_NAME, NIL, normalizable_loop_p(), pips_debug, PLUS_OPERATOR_NAME, range_increment, range_lower, range_upper, STATEMENT, statement_undefined, stmt_list, and TOP_LEVEL_MODULE_NAME.

Referenced by loop_normalize_of_statement().

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

◆ loop_normalize_of_statement()

list loop_normalize_of_statement ( statement  s,
hash_table  fst,
list ell,
list etl,
list swfl,
int Gcount_nlc 
)

=================================================================

list loop_normalize_of_statement(statement s, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc): Normalization of a statement.

Before walking down the statements, we forward-substitute the new-loop-counters on each type of statements. We then return a list of two statements to be put before and after statement 's'. These two new statements are generated by loops when they are treated. See document for more detail, section : "Normalisation des boucles".

est_true(t) = make_block_with_stmt( test_true(t) );

test_false(t) = make_block_with_stmt( test_false(t) );

Parameters
fstst
elllist loop_normalize_of_statement(statement s, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc): Normalization of a statement.

Before walking down the statements, we forward-substitute the new-loop-counters on each type of statements. We then return a list of two statements to be put before and after statement 's'. These two new statements are generated by loops when they are treated. See document for more detail, section : "Normalisation des boucles". forward substitute table

Parameters
etllist loop_normalize_of_statement(statement s, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc): Normalization of a statement.

Before walking down the statements, we forward-substitute the new-loop-counters on each type of statements. We then return a list of two statements to be put before and after statement 's'. These two new statements are generated by loops when they are treated. See document for more detail, section : "Normalisation des boucles". enclosing loops list

Parameters
swfllist loop_normalize_of_statement(statement s, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc): Normalization of a statement.

Before walking down the statements, we forward-substitute the new-loop-counters on each type of statements. We then return a list of two statements to be put before and after statement 's'. These two new statements are generated by loops when they are treated. See document for more detail, section : "Normalisation des boucles". enclosing tests list

Parameters
Gcount_nlclist loop_normalize_of_statement(statement s, hash_table fst, list *ell, *etl, *swfl, int *Gcount_nlc): Normalization of a statement.

Before walking down the statements, we forward-substitute the new-loop-counters on each type of statements. We then return a list of two statements to be put before and after statement 's'. These two new statements are generated by loops when they are treated. See document for more detail, section : "Normalisation des boucles". scalar written forward list

Definition at line 750 of file static_controlize.c.

757 {
759  list return_list = NIL;
760 
761  pips_assert("statement s is consistent\n", statement_consistent_p(s));
762 
763  pips_debug(3, "begin STATEMENT\n");
764  return_list = make_undefined_list();
765 
766  switch(instruction_tag(inst))
767  {
768  case is_instruction_block :
769  {
770  list tail, head;
771 
772  tail = instruction_block(inst);
773  for(head = NIL ; tail != NIL; )
774  {
775  statement stmt, before_stmt, after_stmt;
776  list insert_stmt;
777 
778  stmt = STATEMENT(CAR(tail));
779  insert_stmt = loop_normalize_of_statement(stmt, fst, ell,
780  etl, swfl, Gcount_nlc);
781  before_stmt = STATEMENT(CAR( insert_stmt ));
782  after_stmt = STATEMENT(CAR(CDR( insert_stmt )));
783 
784  if( before_stmt != statement_undefined)
785  ADD_ELEMENT_TO_LIST( head, STATEMENT, before_stmt);
787  if (after_stmt != statement_undefined )
788  ADD_ELEMENT_TO_LIST( head, STATEMENT, after_stmt );
789 
790  tail = CDR(tail);
791  }
792  instruction_block(inst) = head;
793  break;
794  }
795  case is_instruction_test :
796  {
797  test t = instruction_test(inst);
798  (void) forward_substitute_in_exp(&test_condition(t), fst);
800  /*test_true(t) = make_block_with_stmt( test_true(t) );*/
802  /* test_false(t) = make_block_with_stmt( test_false(t) );*/
805  etl, swfl, Gcount_nlc);
807  etl, swfl, Gcount_nlc);
808  gen_remove(etl, (gen_chunk*) test_condition( t ));
809  break;
810  }
811  case is_instruction_loop :
812  {
814  ADD_ELEMENT_TO_LIST(*ell, LOOP, instruction_loop( inst ));
815  return_list = loop_normalize_of_loop(instruction_loop(inst), fst, ell,
816  etl, swfl, Gcount_nlc);
817  gen_remove(ell, (gen_chunk*) instruction_loop( inst ));
818  break;
819  }
820  case is_instruction_call :
821  {
822  (void) forward_substitute_in_call(&instruction_call(inst), fst);
824  etl, swfl);
825  break;
826  }
827  case is_instruction_goto : break;
829  {
831  etl, swfl, Gcount_nlc);
832  break;
833  }
834  default : pips_internal_error("Bad instruction tag");
835  }
836  pips_debug(3, "end STATEMENT\n");
837  return( return_list );
838 }
bool statement_consistent_p(statement p)
Definition: ri.c:2195
void gen_remove(list *cpp, const void *o)
remove all occurences of item o from list *cpp, which is thus modified.
Definition: list.c:685
#define pips_internal_error
Definition: misc-local.h:149
void scalar_written_in_call(call the_call, list *ell, list *etl, list *swfl)
scalar_written_in_call((call) the_call) Detects and puts a scalar written in an assignement call,...
#define is_instruction_block
soft block->sequence transition
#define instruction_block(i)
#define LOOP(x)
LOOP.
Definition: ri.h:1606
#define instruction_loop(x)
Definition: ri.h:1520
#define test_false(x)
Definition: ri.h:2837
@ is_instruction_goto
Definition: ri.h:1473
@ is_instruction_unstructured
Definition: ri.h:1475
@ is_instruction_test
Definition: ri.h:1470
@ is_instruction_call
Definition: ri.h:1474
@ is_instruction_loop
Definition: ri.h:1471
#define instruction_tag(x)
Definition: ri.h:1511
#define test_true(x)
Definition: ri.h:2835
#define test_condition(x)
Definition: ri.h:2833
#define instruction_test(x)
Definition: ri.h:1517
#define instruction_unstructured(x)
Definition: ri.h:1532
void loop_normalize_of_unstructured(unstructured u, hash_table fst, list *ell, list *etl, list *swfl, int *Gcount_nlc)
=================================================================
list loop_normalize_of_loop(loop l, hash_table fst, list *ell, list *etl, list *swfl, int *Gcount_nlc)
=================================================================
void forward_substitute_in_exp(expression *, hash_table)
Definition: utils.c:1148
void forward_substitute_in_call(call *, hash_table)
Definition: utils.c:1157
void forward_substitute_in_anyloop(void *, hash_table)
Definition: utils.c:1139
Definition: statement.c:54
A gen_chunk is used to store every object.
Definition: genC.h:58

References ADD_ELEMENT_TO_LIST, CAR, CDR, EXPRESSION, forward_substitute_in_anyloop(), forward_substitute_in_call(), forward_substitute_in_exp(), Gcount_nlc, gen_remove(), instruction_block, instruction_call, instruction_loop, instruction_tag, instruction_test, instruction_unstructured, is_instruction_block, is_instruction_call, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, LOOP, loop_normalize_of_loop(), loop_normalize_of_unstructured(), make_block_with_stmt_if_not_already(), make_undefined_list(), NIL, pips_assert, pips_debug, pips_internal_error, scalar_written_in_call(), STATEMENT, statement_consistent_p(), statement_instruction, statement_undefined, test_condition, test_false, and test_true.

Referenced by loop_normalize_of_loop(), and loop_normalize_of_unstructured().

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

◆ loop_normalize_of_unstructured()

void loop_normalize_of_unstructured ( unstructured  u,
hash_table  fst,
list ell,
list etl,
list swfl,
int Gcount_nlc 
)

=================================================================

void loop_normalize_of_unstructured(unstructured u, fst): Normalization of an unstructured instruction.

tmt = make_block_with_stmt( stmt );

Parameters
fstst
ellvoid loop_normalize_of_unstructured(unstructured u, fst): Normalization of an unstructured instruction. forward substitute table
etlvoid loop_normalize_of_unstructured(unstructured u, fst): Normalization of an unstructured instruction. enclosing loops list
swflvoid loop_normalize_of_unstructured(unstructured u, fst): Normalization of an unstructured instruction. enclosing tests list
Gcount_nlcvoid loop_normalize_of_unstructured(unstructured u, fst): Normalization of an unstructured instruction. scalar written forward list

Definition at line 845 of file static_controlize.c.

852 {
853  list blocs = NIL, lc;
854  list insert_stmts;
855 
856  pips_debug(2, "begin UNSTRUCTURED\n");
858  blocs = gen_nreverse( blocs ) ;
859 
860  for(lc = blocs; lc != NIL; lc = CDR(lc)) {
861  list head = NIL;
862  control ctl;
863  statement before_stmt, after_stmt, stmt;
864 
865  ctl = CONTROL(CAR( lc ));
866  stmt = control_statement( ctl );
867  insert_stmts = loop_normalize_of_statement(stmt, fst,
868  ell, etl,
869  swfl,
870  Gcount_nlc);
871  before_stmt = STATEMENT(CAR( insert_stmts ));
872  after_stmt = STATEMENT(CAR(CDR( insert_stmts )));
873 
874  if (!undefined_statement_list_p( insert_stmts )) {
875  if( before_stmt != statement_undefined)
876  ADD_ELEMENT_TO_LIST( head, STATEMENT, before_stmt );
878  if (after_stmt != statement_undefined )
879  ADD_ELEMENT_TO_LIST( head, STATEMENT, after_stmt );
880  /*stmt = make_block_with_stmt( stmt );*/
883  head = NIL;
884  }
885  }
886 
887  gen_free_list(blocs);
888  pips_debug(2, "end UNSTRUCTURED\n");
889 }
void control_map_get_blocs(control c, list *l)
Build recursively the list of all controls reachable from a control of an unstructured.
Definition: control.c:75
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
bool undefined_statement_list_p(list l)
=================================================================
#define unstructured_control
After the modification in Newgen: unstructured = entry:control x exit:control we have create a macro ...
#define CONTROL(x)
CONTROL.
Definition: ri.h:910
#define control_statement(x)
Definition: ri.h:941

References ADD_ELEMENT_TO_LIST, CAR, CDR, CONTROL, control_map_get_blocs(), control_statement, Gcount_nlc, gen_free_list(), gen_nreverse(), instruction_block, loop_normalize_of_statement(), make_block_with_stmt_if_not_already(), NIL, pips_debug, STATEMENT, statement_instruction, statement_undefined, undefined_statement_list_p(), and unstructured_control.

Referenced by loop_normalize_of_statement().

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

◆ loops_to_indices()

list loops_to_indices ( list  l)

================================================================

list loops_to_indices((loop) l ) AL 04/93 Returns indices of the loop -list l.

Definition at line 630 of file utils.c.

631 {
632  list rl = NIL;
633  loop lo;
634 
635  pips_debug(7, "doing\n");
636  if (l == NIL) return(NIL);
637  MAPL( loop_ptr, {
638  lo = LOOP(CAR( loop_ptr ));
639  ADD_ELEMENT_TO_LIST( rl, ENTITY, loop_index( lo ) );
640  }, l);
641  return rl;
642 }

References ADD_ELEMENT_TO_LIST, CAR, ENTITY, LOOP, loop_index, MAPL, NIL, and pips_debug.

Referenced by splc_linear_expression_p().

+ Here is the caller graph for this function:

◆ make_undefined_list()

list make_undefined_list ( void  )

================================================================

list make_undefined_list( ) AL 04/93 Duplicates a list of 2 undefined statements.

FI: this is no longer possible. List elements must be defined. Maybe empty/nop statements could be used instead?

Definition at line 815 of file utils.c.

816 {
817  list the_list = NIL;
818 
819  pips_debug(7, "doing\n");
820  /*
821  ADD_ELEMENT_TO_LIST( the_list, STATEMENT, statement_undefined);
822  ADD_ELEMENT_TO_LIST( the_list, STATEMENT, statement_undefined);
823  */
824  ADD_ELEMENT_TO_LIST( the_list, STATEMENT,
826  ADD_ELEMENT_TO_LIST( the_list, STATEMENT,
828  return the_list;
829 }

References ADD_ELEMENT_TO_LIST, entity_empty_label(), make_continue_statement(), NIL, pips_debug, and STATEMENT.

Referenced by loop_normalize_of_loop(), and loop_normalize_of_statement().

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

◆ ndf_normalized_test()

list ndf_normalized_test ( expression  exp,
list ell 
)

================================================================

list ndf_normalized_test( (expression) exp, (list) *ell) AL 04/93 Returns a list of positive linear forms from an input expression which is a logical combinaison of affine forms of structural parameters and of loop counters.

Redon FND propagation : see document.

We propagate an Exclusive Normal Disjunctive Form

if (ENTITY_OR_P( fun )) { list not_l1, not_l2, l1, l2;

l1 = ndf_normalized_test(arg1, ell); l2 = ndf_normalized_test( arg2, ell); not_l1 = ndf_normalized_test( MakeUnaryCall(ENTITY_NOT, arg1), ell ); not_l2 = ndf_normalized_test( MakeUnaryCall(ENTITY_NOT, arg2), ell );

MAPL( exp_ptr, { expression S1 = EXPRESSION(CAR( exp_ptr )); MAPL( exp_ptr2, { expression T1 = EXPRESSION(CAR( exp_ptr )); ADD_ELEMENT_TO_LIST( ret_list, EXPRESSION, MakeBinaryCall( ENTITY_AND, S1, T1 ) ); }, l2); }, not_l1 );

MAPL( exp_ptr, { expression S1 = EXPRESSION(CAR( exp_ptr )); MAPL( exp_ptr2, { expression T1 = EXPRESSION(CAR( exp_ptr )); ADD_ELEMENT_TO_LIST( ret_list, EXPRESSION, MakeBinaryCall( ENTITY_AND, S1, T1 ) ); }, l2); }, l1 );

MAPL( exp_ptr, { expression S1 = EXPRESSION(CAR( exp_ptr )); MAPL( exp_ptr2, { expression T1 = EXPRESSION(CAR( exp_ptr )); ADD_ELEMENT_TO_LIST( ret_list, EXPRESSION, MakeBinaryCall( ENTITY_AND, S1, T1 ) ); }, not_l2); }, l1 );

return( ret_list ); }

Parameters
expxp
ellll

Definition at line 306 of file utils.c.

307 {
308  list args, ret_list = NIL;
309  entity fun;
310  expression arg1, arg2, exp2, exp3;
311 
312  pips_debug(7, "doing\n");
313  if ( (exp == expression_undefined) ||
315  return NIL;
316  }
317  pips_debug(7, "input exp : %s\n",
319 
322  if(ENDP(args)) return NIL;
323 
324  if (splc_positive_relation_p(exp, ell)) {
325  ADD_ELEMENT_TO_LIST( ret_list, EXPRESSION, exp );
326  return( ret_list );
327  }
328  if (ENTITY_NOT_P( fun )) {
329  arg1 = EXPRESSION(CAR(args));
330  if (splc_positive_relation_p(arg1, ell)) {
331  exp3 = EXPRESSION(CAR( call_arguments(
332  syntax_call(expression_syntax( arg1 )))));
333  exp2 = MakeBinaryCall( ENTITY_GE,
335  int_to_expression(-1),
336  exp3 ),
337  int_to_expression(0) );
338  ADD_ELEMENT_TO_LIST( ret_list, EXPRESSION, exp2 );
339  return( ret_list );
340  }
341  else {
343 
344  MAPL( exp_ptr, {
345  exp3 = EXPRESSION(CAR( exp_ptr ));
346  if (exp2 == expression_undefined)
347  exp2 = sc_opposite_exp_of_conjunction(exp3, ell);
348  else
349  exp2 = MakeBinaryCall(ENTITY_AND,
351  copy_expression( exp2 ) );
352  }, ndf_normalized_test(arg1, ell));
353  ret_list = ndf_normalized_test(exp2, ell);
354  return( ret_list );
355  }
356  }
357 
358  arg1 = EXPRESSION(CAR(args));
359  arg2 = EXPRESSION(CAR(CDR(args)));
360 
361  /* Redon FND propagation : see document. */
362  if (ENTITY_OR_P( fun )) {
363  expression exp3;
364 
365  MAPL( exp_ptr, {
366  exp3 = EXPRESSION(CAR( exp_ptr ));
367  ADD_ELEMENT_TO_LIST( ret_list, EXPRESSION, exp3 );
368  }, ndf_normalized_test(arg1, ell));
369  MAPL( exp_ptr, {
370  exp3 = EXPRESSION(CAR( exp_ptr ));
371  ADD_ELEMENT_TO_LIST( ret_list, EXPRESSION, exp3 );
372  }, ndf_normalized_test(arg2, ell));
373  return( ret_list );
374  }
375 
376  /*
377  %%%%%%%%%%%%%
378  */
379 
380  /* We propagate an Exclusive Normal Disjunctive Form */
381  /* if (ENTITY_OR_P( fun )) {
382  * list not_l1, not_l2, l1, l2;
383  *
384  *l1 = ndf_normalized_test(arg1, ell);
385  *l2 = ndf_normalized_test( arg2, ell);
386  *not_l1 = ndf_normalized_test( MakeUnaryCall(ENTITY_NOT, arg1), ell );
387  *not_l2 = ndf_normalized_test( MakeUnaryCall(ENTITY_NOT, arg2), ell );
388  *
389  * MAPL( exp_ptr, {
390  * expression S1 = EXPRESSION(CAR( exp_ptr ));
391  *MAPL( exp_ptr2, {
392  *expression T1 = EXPRESSION(CAR( exp_ptr ));
393  *ADD_ELEMENT_TO_LIST( ret_list, EXPRESSION,
394  *MakeBinaryCall( ENTITY_AND, S1, T1 ) );
395  *}, l2);
396  *}, not_l1 );
397  *
398  *MAPL( exp_ptr, {
399  *expression S1 = EXPRESSION(CAR( exp_ptr ));
400  * MAPL( exp_ptr2, {
401  * expression T1 = EXPRESSION(CAR( exp_ptr ));
402  * ADD_ELEMENT_TO_LIST( ret_list, EXPRESSION,
403  * MakeBinaryCall( ENTITY_AND, S1, T1 ) );
404  * }, l2);
405  * }, l1 );
406  *
407  * MAPL( exp_ptr, {
408  * expression S1 = EXPRESSION(CAR( exp_ptr ));
409  * MAPL( exp_ptr2, {
410  * expression T1 = EXPRESSION(CAR( exp_ptr ));
411  * ADD_ELEMENT_TO_LIST( ret_list, EXPRESSION,
412  * MakeBinaryCall( ENTITY_AND, S1, T1 ) );
413  * }, not_l2);
414  * }, l1 );
415  *
416  * return( ret_list );
417  *}
418  */
419  else if (ENTITY_AND_P( fun )) {
420  expression exp4, exp5, exp6;
421  list l1, l2;
422 
423  l1 = ndf_normalized_test(arg1, ell);
424  l2 = ndf_normalized_test(arg2, ell);
425  MAPL( exp_ptr, {
426  exp4 = EXPRESSION(CAR( exp_ptr ));
427  MAPL( ep, {
428  exp5 = EXPRESSION(CAR( ep ));
429  exp6 = MakeBinaryCall( ENTITY_AND,
430  exp4, exp5 );
431  ADD_ELEMENT_TO_LIST(ret_list, EXPRESSION, exp6);
432  }, l2 );
433  }, l1 );
434  return( ret_list );
435  }
436  else return NIL;
437 }
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
string expression_to_string(expression e)
Definition: expression.c:77
#define ENTITY_OR_P(e)
#define ENTITY_NOT_P(e)
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
Definition: expression.c:354
#define ENTITY_AND
#define ENTITY_GE
bool splc_positive_relation_p(expression exp, list *ell)
================================================================
Definition: utils.c:282
expression sc_opposite_exp_of_conjunction(expression exp, list *ell)
================================================================
Definition: utils.c:236
list ndf_normalized_test(expression exp, list *ell)
================================================================
Definition: utils.c:306

References ADD_ELEMENT_TO_LIST, call_arguments, call_function, CAR, CDR, copy_expression(), ENDP, ENTITY_AND, ENTITY_AND_P, ENTITY_GE, ENTITY_NOT_P, ENTITY_OR_P, exp, EXPRESSION, expression_syntax, expression_to_string(), expression_undefined, int_to_expression(), is_syntax_call, make_op_exp(), MakeBinaryCall(), MAPL, MINUS_OPERATOR_NAME, ndf_normalized_test(), NIL, pips_debug, sc_opposite_exp_of_conjunction(), splc_positive_relation_p(), syntax_call, and syntax_tag.

Referenced by ndf_normalized_test(), and sc_conditional().

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

◆ normalizable_loop_p()

bool normalizable_loop_p ( loop  l)

bool normalizable_loop_p(loop l) Returns true if "l" has a constant step.

Definition at line 1172 of file utils.c.

1173 {
1174  pips_debug(7, "doing\n");
1176 }

References expression_constant_p(), loop_range, pips_debug, and range_increment.

Referenced by loop_normalize_of_loop().

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

◆ normalizable_loop_p_retrieved()

bool normalizable_loop_p_retrieved ( loop  l)

Code retrieved from revision 14476, transformations/loop_normalize.c.

Code to be retrieved: I suppose you need a constant increment?

Definition at line 1183 of file utils.c.

1184 {
1185  bool ok = false;
1186  entity i = loop_index(l);
1187  range r = loop_range(l);
1188 
1190 
1191  return ok;
1192 }
bool normalizable_and_linear_loop_p(entity, range)
static bool ok

References loop_index, loop_range, normalizable_and_linear_loop_p(), and ok.

+ Here is the call graph for this function:

◆ normalize_test_leaves()

expression normalize_test_leaves ( expression  exp,
list ell 
)

================================================================

expression normalize_test_leaves((expression) exp, (list) *ell) AL 04/93 If exp is linear in structurals and loop-counters, it returns the same expression with linear positive forms

We return expression_undefined if we can not normalize

Parameters
expxp
ellll

Definition at line 445 of file utils.c.

448 {
450  entity fun = call_function(syntax_call( s ));
451  list args = call_arguments(syntax_call( s ));
452  list new_args = NIL;
454  expression e, ne, arg1, arg2, arg3, arg4;
455 
456  if (exp == expression_undefined || args == NIL) return( exp );
457  pips_debug(7, "exp : %s\n",
459  if (syntax_tag( s ) != is_syntax_call) return( ret_exp );
460 
461  if (ENTITY_NOT_P( fun )) {
462  expression exp1 =
463  normalize_test_leaves(EXPRESSION(CAR(args)), ell);
464 
465  /* We return expression_undefined if we can not normalize */
466  if (exp1 == expression_undefined) return(expression_undefined);
467 
468  ret_exp = MakeUnaryCall(ENTITY_NOT, exp1 );
469  pips_debug(7, "returning : %s\n",
470  expression_to_string( ret_exp ) );
471  return( ret_exp );
472  }
473 
474  arg1 = EXPRESSION(CAR(args));
475  arg2 = EXPRESSION(CAR(CDR(args)));
476  arg3 = copy_expression( arg1 );
477  arg4 = copy_expression( arg2 );
478  if (ENTITY_EQUIV_P( fun )) {
479  ret_exp1 = MakeBinaryCall( ENTITY_OR,
480  MakeUnaryCall( ENTITY_NOT, arg1),
481  arg2 );
482  ret_exp2 = MakeBinaryCall( ENTITY_OR,
483  MakeUnaryCall( ENTITY_NOT, arg4),
484  arg3 ) ;
485  exp = MakeBinaryCall( ENTITY_AND, ret_exp1, ret_exp2 );
486  }
487  else if (ENTITY_NON_EQUIV_P( fun )) {
489  MakeUnaryCall( ENTITY_NOT, arg2),
490  arg1 );
492  MakeUnaryCall( ENTITY_NOT, arg3),
493  arg4 ) ;
494  exp = MakeBinaryCall( ENTITY_OR, ret_exp1, ret_exp2);
495  }
496 
497  s = expression_syntax( exp );
498  fun = call_function(syntax_call( s ));
499  args = call_arguments(syntax_call( s ));
500  arg1 = EXPRESSION(CAR(args));
501  arg2 = EXPRESSION(CAR(CDR(args)));
502  arg3 = copy_expression( arg1 );
503  arg4 = copy_expression( arg2 );
505  MAPL( exp_ptr, {
506  e = EXPRESSION(CAR( exp_ptr ));
507  ne = normalize_test_leaves(e, ell);
508  if (ne == expression_undefined) return(ne);
510  copy_expression( ne ));
511  }, args);
512  call_arguments(syntax_call( s )) = new_args;
513  ret_exp = copy_expression( exp );
514  pips_debug(7, "returning : %s\n",
515  expression_to_string( ret_exp ) );
516  return( ret_exp );
517  }
518  else if ( ENTITY_RELATIONAL_OPERATOR_P( fun ) &&
519  (!splc_linear_expression_p(arg1, ell) ||
520  !splc_linear_expression_p(arg2, ell)) ) {
521 
522  pips_debug(7, "returning : %s\n",
523  "expression_undefined" );
524  return( expression_undefined );
525  }
526  if (ENTITY_LESS_THAN_P( fun )) {
527  ret_exp = MakeBinaryCall( ENTITY_GE,
529  make_op_exp(
531  arg2, arg1 ),
532  int_to_expression(1) ),
533  int_to_expression(0) );
534  }
535  else if (ENTITY_LESS_OR_EQUAL_P( fun )) {
536  ret_exp = MakeBinaryCall( ENTITY_GE,
538  arg2, arg1 ),
539  int_to_expression(0) );
540  }
541  else if (ENTITY_GREATER_THAN_P( fun )) {
542  ret_exp = MakeBinaryCall( ENTITY_GE,
544  make_op_exp(
546  arg1, arg2 ),
547  int_to_expression(1) ),
548  int_to_expression(0) );
549  }
550  else if (ENTITY_GREATER_OR_EQUAL_P( fun )) {
551  ret_exp = MakeBinaryCall( (entity) ENTITY_GE,
553  arg1, arg2 ),
554  int_to_expression(0) );
555  }
556  else if (ENTITY_EQUAL_P( fun )) {
557  ret_exp1 = MakeBinaryCall( ENTITY_GE,
559  arg1, arg2 ),
560  int_to_expression(0) );
561  ret_exp2 = MakeBinaryCall( ENTITY_GE,
563  arg4, arg3 ),
564  int_to_expression(0) ) ;
565  ret_exp = MakeBinaryCall( ENTITY_AND, ret_exp1, ret_exp2);
566  }
567  else if (ENTITY_NON_EQUAL_P( fun )) {
568  ret_exp1 = MakeBinaryCall( ENTITY_GE,
571  arg1, arg2 ),
572  int_to_expression(1) ),
573  int_to_expression(0) );
574  ret_exp2 = MakeBinaryCall( ENTITY_GE,
577  arg4, arg3 ),
578  int_to_expression(1) ),
579  int_to_expression(0) );
580  ret_exp = MakeBinaryCall( ENTITY_OR, ret_exp1, ret_exp2);
581  }
582  else ret_exp = expression_undefined;
583 
584  pips_debug(7, "returning : %s\n",
585  ((ret_exp == expression_undefined)?"expression_undefined":\
586  expression_to_string( ret_exp )) );
587  return( ret_exp );
588 }
#define ENTITY_RELATIONAL_OPERATOR_P(e)
#define ENTITY_NON_EQUAL_P(e)
#define ENTITY_EQUAL_P(e)
#define ENTITY_LESS_THAN_P(e)
#define ENTITY_GREATER_THAN_P(e)
#define ENTITY_NON_EQUIV_P(e)
#define ENTITY_LESS_OR_EQUAL_P(e)
#define ENTITY_GREATER_OR_EQUAL_P(e)
#define ENTITY_EQUIV_P(e)
expression MakeUnaryCall(entity f, expression a)
Creates a call expression to a function with one argument.
Definition: expression.c:342
#define ENTITY_OR
#define ENTITY_NOT
#define ENTITY_STRICT_LOGICAL_OPERATOR_P(e)
bool splc_linear_expression_p(expression exp, list *ell)
================================================================
Definition: utils.c:648
expression normalize_test_leaves(expression exp, list *ell)
================================================================
Definition: utils.c:445

References ADD_ELEMENT_TO_LIST, call_arguments, call_function, CAR, CDR, copy_expression(), ENTITY_AND, ENTITY_EQUAL_P, ENTITY_EQUIV_P, ENTITY_GE, ENTITY_GREATER_OR_EQUAL_P, ENTITY_GREATER_THAN_P, ENTITY_LESS_OR_EQUAL_P, ENTITY_LESS_THAN_P, ENTITY_NON_EQUAL_P, ENTITY_NON_EQUIV_P, ENTITY_NOT, ENTITY_NOT_P, ENTITY_OR, ENTITY_RELATIONAL_OPERATOR_P, ENTITY_STRICT_LOGICAL_OPERATOR_P, exp, EXPRESSION, expression_syntax, expression_to_string(), expression_undefined, int_to_expression(), is_syntax_call, make_op_exp(), MakeBinaryCall(), MakeUnaryCall(), MAPL, MINUS_OPERATOR_NAME, NIL, normalize_test_leaves(), pips_debug, splc_linear_expression_p(), syntax_call, and syntax_tag.

Referenced by normalize_test_leaves(), and sc_conditional().

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

◆ print_code_static_control()

bool print_code_static_control ( const string  module_name)

cproto-generated files

prettyprint.c

cproto-generated files

void print_code_static_control((char*) module_name) AL 05/93 Prettyprints a static_control mapping attached to a module_name.

Parameters
module_nameodule_name

Definition at line 87 of file prettyprint.c.

88 {
89  entity module;
90  statement module_stat;
91  text txt = make_text(NIL);
92  bool success;
93 
94  debug_on( "PRINT_STATIC_CONTROL_DEBUG_LEVEL" );
95 
96  ifdebug(1)
97  user_log("\n\n *** PRINTING STATIC CONTROL for %s\n",
98  module_name);
99 
101  module_stat = (statement)
104  db_get_memory_resource( DBR_STATIC_CONTROL, module_name, true);
106 
107 /*
108  filename = strdup(concatenate(db_get_current_workspace_directory(),
109  "/", module_name, ".stco", NULL));
110  fd = safe_fopen(filename, "w");
111 */
112 
113  MERGE_TEXTS(txt, text_module(module, module_stat));
114 
115 /*
116  print_text(fd, txt);
117  safe_fclose(fd, filename);
118  DB_PUT_FILE_RESOURCE(DBR_PRINTED_FILE, strdup(module_name),
119  filename);
120 */
121 
123  DBR_PRINTED_FILE,
125  txt);
126 
128 
129  debug_off();
130 
131  return(success);
132 }
void user_log(const char *format,...)
Definition: message.c:234
text make_text(list a)
Definition: text.c:107
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
bool success
Definition: gpips-local.h:59
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define debug_on(env)
Definition: misc-local.h:157
#define debug_off()
Definition: misc-local.h:160
#define true
Definition: newgen_types.h:81
static char * module
Definition: pips.c:74
void close_prettyprint()
because some prettyprint functions may be used for debug, so the last hook set by somebody may have s...
Definition: misc.c:242
void init_prettyprint(text(*hook)(entity, int, statement))
checks that the prettyprint hook was actually reset...
Definition: misc.c:231
text text_module(entity, statement)
bool make_text_resource(const char *, const char *, const char *, text)
print.c
Definition: print.c:55
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450
return(s1)
#define ifdebug(n)
Definition: sg.c:47
text text_static_control(entity module __attribute__((unused)), int margin __attribute__((unused)), statement stat)
================================================================
Definition: prettyprint.c:139
#define CODE_WITH_STATIC_CONTROLIZE_EXT
Definition: prettyprint.c:78
static statement_mapping Gsc_map
Global variables.
Definition: prettyprint.c:81
#define MERGE_TEXTS(r, t)

References close_prettyprint(), CODE_WITH_STATIC_CONTROLIZE_EXT, db_get_memory_resource(), debug_off, debug_on, Gsc_map, ifdebug, init_prettyprint(), local_name_to_top_level_entity(), make_text(), make_text_resource(), MERGE_TEXTS, module, module_name(), NIL, text_module(), text_static_control(), and user_log().

+ Here is the call graph for this function:

◆ print_structurals()

string print_structurals ( list  l)

================================================================

char* print_structurals( (list) l ) AL 04/93 Prints structural parameters.

Definition at line 732 of file utils.c.

733 {
734  return(strdup( words_to_string(words_entity_list( l )) ));
735 }
char * strdup()
list words_entity_list(list obj)
================================================================
Definition: prettyprint.c:265

References strdup(), words_entity_list(), and words_to_string().

Referenced by get_sp_of_call_p(), in_forward_defined_p(), static_controlize(), static_controlize_statement(), static_controlize_unstructured(), and verify_structural_parameters().

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

◆ sc_conditional()

expression sc_conditional ( expression  exp,
list ell 
)

================================================================

expression sc_conditional( (expression) exp, (list) *ell ) AL 04/93 If exp is linear in structurals and loop-counters, it returns the same expression with a normal disjunctive form.

Parameters
expxp
ellll

Definition at line 596 of file utils.c.

597 {
598  expression e, ret_exp = expression_undefined;
600  list ndf_list;
601 
602  pips_debug(7, "exp : %s\n",
604 
605  if ( syntax_tag(s) != is_syntax_call ) return( ret_exp );
606  e = normalize_test_leaves(exp, ell);
607  ndf_list = ndf_normalized_test(e, ell);
608  if (ndf_list != NIL) {
609  ret_exp = EXPRESSION(CAR( ndf_list ));
610  ndf_list = CDR( ndf_list );
611  MAPL( exp_ptr,{
612  e = EXPRESSION(CAR( exp_ptr ));
613  ret_exp = MakeBinaryCall( ENTITY_OR,
614  copy_expression( ret_exp ), e );
615  }, ndf_list );
616  }
617 
618  pips_debug(7, "returning : %s\n",
619  ((ret_exp == expression_undefined)?"expression_undefined":
620  expression_to_string( ret_exp )) );
621  return( ret_exp );
622 }

References CAR, CDR, copy_expression(), ENTITY_OR, exp, EXPRESSION, expression_syntax, expression_to_string(), expression_undefined, is_syntax_call, MakeBinaryCall(), MAPL, ndf_normalized_test(), NIL, normalize_test_leaves(), pips_debug, and syntax_tag.

Referenced by static_controlize_statement().

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

◆ sc_entity_to_formal_integer_parameters()

list sc_entity_to_formal_integer_parameters ( entity  f)

================================================================

list sc_entity_to_formal_integer_parameters((entity) f) This is a strict copy of entity_to_formal_integer_parameters from semantics/interprocedural.c . This function is copied here to keep locality of local functions to each pass.

FI: Well, but it was modified to handle all integer scalar variables and a bug was added because a COMMON has a RAM storage (OK, this could be discussed). I add a test on type_variable_p()

Definition at line 900 of file utils.c.

902 {
903  list formals_or_ram_integer = NIL;
904  list decl = NIL;
905 
906  pips_assert("sc_entity_to_formal_integer_parameters",entity_module_p(f));
907 
909  MAPL(ce, {entity e = ENTITY(CAR(ce));
910  storage sto = entity_storage(e);
911  type t = entity_type(e);
912 
913  if( type_variable_p(t)
914  && (storage_formal_p(sto) || storage_ram_p(sto))
916  formals_or_ram_integer = CONS(ENTITY, e,
917  formals_or_ram_integer);},
918  decl);
919 
920  return formals_or_ram_integer;
921 }
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
code entity_code(entity e)
Definition: entity.c:1098
bool entity_module_p(entity e)
Definition: entity.c:683
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 storage_formal_p(x)
Definition: ri.h:2522
#define entity_storage(x)
Definition: ri.h:2794
#define code_declarations(x)
Definition: ri.h:784
#define storage_ram_p(x)
Definition: ri.h:2519
#define entity_type(x)
Definition: ri.h:2792
#define type_variable_p(x)
Definition: ri.h:2947

References CAR, code_declarations, CONS, ENTITY, entity_code(), entity_integer_scalar_p(), entity_module_p(), entity_storage, entity_type, f(), MAPL, NIL, pips_assert, storage_formal_p, storage_ram_p, and type_variable_p.

Referenced by static_controlize().

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

◆ sc_list_of_entity_dup()

list sc_list_of_entity_dup ( list  l)

================================================================

list sc_list_of_entity_dup( (list) l ) AL 04/93 Duplicates a list of entities.

Definition at line 761 of file utils.c.

762 {
763  list rl = NIL;
764 
765  pips_debug( 7, "doing\n");
766  if ( l == NIL ) return( NIL );
767  MAPL( ent_ptr, {
768  entity ent = ENTITY(CAR( ent_ptr ));
769  ADD_ELEMENT_TO_LIST( rl, ENTITY, ent );
770  }, l );
771  return( rl );
772 }

References ADD_ELEMENT_TO_LIST, CAR, ENTITY, MAPL, NIL, and pips_debug.

Referenced by static_controlize_call(), static_controlize_statement(), and static_controlize_unstructured().

+ Here is the caller graph for this function:

◆ sc_list_of_exp_dup()

list sc_list_of_exp_dup ( list  l)

================================================================

list sc_list_of_exp_dup( (list) l ) AL 04/93 Duplicates a list of expressions.

Definition at line 741 of file utils.c.

742 {
743  list ret_list = NIL;
744 
745  pips_debug(9, "begin\n");
746  for(; !ENDP( l ); POP( l ) ) {
747  expression exp;
748 
749  exp = EXPRESSION(CAR( l ));
751  }
752 
753  pips_debug(9, "end\n");
754  return( ret_list );
755 }
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59

References ADD_ELEMENT_TO_LIST, CAR, copy_expression(), ENDP, exp, EXPRESSION, NIL, pips_debug, and POP.

Referenced by static_controlize_call(), static_controlize_statement(), and static_controlize_unstructured().

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

◆ sc_list_of_loop_dup()

list sc_list_of_loop_dup ( list  l)

================================================================

list sc_list_of_loop_dup( (list) l ) AL 04/93 Duplicates a list of loops. See Newgen gen_copy_seq()?

Definition at line 778 of file utils.c.

779 {
780  list rl = NIL;
781 
782  pips_debug( 7, "doing\n");
783  if ( l == NIL ) return(NIL);
784  MAPL( loop_ptr, {
785  loop lo = LOOP(CAR( loop_ptr ));
786  ADD_ELEMENT_TO_LIST( rl, LOOP, lo );
787  }, l );
788  return( rl );
789 }

References ADD_ELEMENT_TO_LIST, CAR, LOOP, MAPL, NIL, and pips_debug.

Referenced by static_controlize_statement(), and static_controlize_unstructured().

+ Here is the caller graph for this function:

◆ sc_loop_dup()

loop sc_loop_dup ( loop  l)

================================================================

list sc_loop_dup( (list) l ) AL 04/93 Duplicates a loop with sharing of the loop_body and sharing of the loop locals.

Definition at line 796 of file utils.c.

797 {
798  loop new_loop;
799 
800  pips_debug( 7, "doing\n");
801  new_loop = make_loop(loop_index(l), copy_range(loop_range(l)),
803  loop_locals(l));
804 
805  return(new_loop);
806 }
range copy_range(range p)
RANGE.
Definition: ri.c:2005
loop make_loop(entity a1, range a2, statement a3, entity a4, execution a5, list a6)
Definition: ri.c:1301
#define loop_execution(x)
Definition: ri.h:1648
#define loop_locals(x)
Definition: ri.h:1650

References copy_range(), loop_body, loop_execution, loop_index, loop_label, loop_locals, loop_range, make_loop(), and pips_debug.

+ Here is the call graph for this function:

◆ sc_opposite_exp_of_conjunction()

expression sc_opposite_exp_of_conjunction ( expression  exp,
list ell 
)

================================================================

expression sc_opposite_exp_of_conjunction(expression exp, (list) *ell) AL 08/19/93 Input : exp a conjunction of linear expressions Output : simplified value of NOT( exp )

Parameters
expxp
ellll

Definition at line 236 of file utils.c.

239 {
240  expression ret_exp;
241 
242  pips_debug(9, "begin\n");
243  if ( (exp == expression_undefined) ||
245  ret_exp = expression_undefined;
246  }
247  else if (splc_positive_relation_p(exp, ell)) {
248  expression exp1, exp2;
249  exp1 = EXPRESSION(CAR( call_arguments(
251  exp2 = MakeBinaryCall( ENTITY_GE,
253  int_to_expression(-1), exp1 ),
254  int_to_expression(0) );
255  ret_exp = exp2;
256  }
257  else if(ENTITY_AND_P(call_function(
259  list args = NIL;
260  expression r_exp, l_exp;
261 
263  l_exp = EXPRESSION(CAR( args ));
264  r_exp = EXPRESSION(CAR(CDR( args )));
265  ret_exp = MakeBinaryCall( ENTITY_OR,
266  sc_opposite_exp_of_conjunction(l_exp, ell),
267  sc_opposite_exp_of_conjunction(r_exp, ell));
268 
269  }
270  else ret_exp = expression_undefined;
271 
272  pips_debug(9, "end\n");
273  return( ret_exp );
274 }

References call_arguments, call_function, CAR, CDR, ENTITY_AND_P, ENTITY_GE, ENTITY_OR, exp, EXPRESSION, expression_syntax, expression_undefined, int_to_expression(), is_syntax_call, make_op_exp(), MakeBinaryCall(), MINUS_OPERATOR_NAME, NIL, pips_debug, sc_opposite_exp_of_conjunction(), splc_positive_relation_p(), syntax_call, and syntax_tag.

Referenced by ndf_normalized_test(), and sc_opposite_exp_of_conjunction().

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

◆ sp_feautrier_expression_p()

bool sp_feautrier_expression_p ( expression  exp)

================================================================

bool sp_feautrier_expression_p( (expression) exp) Returns true if exp quasi affine form.

Parameters
expxp

Definition at line 995 of file utils.c.

996 {
997  bool b = false;
999 
1000  pips_debug(7, "exp : %s \n",
1001  ((exp == expression_undefined)?"expression_undefined":
1002  expression_to_string( exp ) ));
1003 
1004  if (sp_linear_expression_p( exp )) return( true );
1005  if ( syntax_tag( s ) == is_syntax_call ) {
1006  call c;
1007  list args;
1008  expression exp1, exp2;
1009 
1010  c = syntax_call( s );
1011  if (ENTITY_DIVIDE_P(call_function( c ))) {
1012  args = call_arguments( c );
1013  exp1 = EXPRESSION(CAR( args ));
1014  exp2 = EXPRESSION(CAR( CDR(args) ));
1015  b = sp_feautrier_expression_p( exp1 )
1016  && expression_constant_p( exp2 );
1017  }
1018  }
1019  pips_debug(7, "returning : %s\n",
1020  (b?"TRUE":"FALSE") );
1021  return( b );
1022 }
#define ENTITY_DIVIDE_P(e)
bool sp_feautrier_expression_p(expression exp)
================================================================
Definition: utils.c:995
bool sp_linear_expression_p(expression exp)
================================================================
Definition: utils.c:928

References call_arguments, call_function, CAR, CDR, ENTITY_DIVIDE_P, exp, EXPRESSION, expression_constant_p(), expression_syntax, expression_to_string(), expression_undefined, is_syntax_call, pips_debug, sp_feautrier_expression_p(), sp_linear_expression_p(), syntax_call, and syntax_tag.

Referenced by sp_feautrier_expression_p(), sp_feautrier_scalar_assign_call(), and static_controlize_statement().

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

◆ sp_feautrier_scalar_assign_call()

entity sp_feautrier_scalar_assign_call ( call  c)

================================================================

entity sp_feautrier_scalar_assign_call( (call) c ) Returns the left-hand-side entity if it is an assignement of a linear combinaison of structural parameters.

Definition at line 1029 of file utils.c.

1030 {
1031  entity ent, ret_ent = entity_undefined;
1032  expression rhs;
1033 
1034  pips_debug(7, "doing\n");
1035  if ((ent = scalar_assign_call(c)) != entity_undefined) {
1036  rhs = EXPRESSION(CAR(CDR(call_arguments(c))));
1037  if (sp_feautrier_expression_p( rhs )) ret_ent = ent;
1038  }
1039  pips_debug(7,
1040  "returning : %s \n",
1041  ((ret_ent == entity_undefined)?"entity_undefined":
1042  entity_name( ret_ent )) );
1043  return( ret_ent );
1044 }
entity scalar_assign_call(call c)
entity scalar_assign_call((call) c) Detects if the call is an assignement and if the value assigned i...
#define entity_name(x)
Definition: ri.h:2790

References call_arguments, CAR, CDR, entity_name, entity_undefined, EXPRESSION, pips_debug, scalar_assign_call(), and sp_feautrier_expression_p().

Referenced by get_reference_assignments(), and get_sp_of_call_p().

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

◆ sp_linear_expression_p()

bool sp_linear_expression_p ( expression  exp)

================================================================

bool sp_linear_expression_p( (expression) exp) Returns true if the expression is a linear combinaison of structural parameters.

Parameters
expxp

Definition at line 928 of file utils.c.

929 {
930  Pvecteur vect;
931  bool ONLY_SP;
932 
933  pips_debug(7, "exp : %s\n", expression_to_string(exp));
934 
936  ONLY_SP = false;
937  else
938  {
940  ONLY_SP = true;
941 
942  for(; !VECTEUR_NUL_P(vect) && ONLY_SP ; vect = vect->succ)
943  {
944  entity var = (entity) vect->var;
945 
946  if( ! term_cst(vect) )
947  if( ! (ENTITY_SP_P(var)) )
948  ONLY_SP = false;
949  }
950  }
952  pips_debug(7,
953  " result : %s\n", (ONLY_SP?"TRUE":"FALSE") );
954  return(ONLY_SP);
955 }
void unnormalize_expression(void *st)
void unnormalize_expression(expression exp): puts all the normalized field of expressions in "st" to ...
Definition: normalize.c:452
#define NORMALIZE_EXPRESSION(e)
#define normalized_tag(x)
Definition: ri.h:1778
#define expression_normalized(x)
Definition: ri.h:1249
#define normalized_linear(x)
Definition: ri.h:1781
@ is_normalized_complex
Definition: ri.h:1761
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92
struct Svecteur * Pvecteur
#define VECTEUR_NUL_P(v)
#define term_cst(varval)

References ENTITY_SP_P, exp, expression_normalized, expression_to_string(), is_normalized_complex, NORMALIZE_EXPRESSION, normalized_linear, normalized_tag, pips_debug, Svecteur::succ, term_cst, unnormalize_expression(), Svecteur::var, and VECTEUR_NUL_P.

Referenced by sp_feautrier_expression_p().

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

◆ splc_feautrier_expression_p()

bool splc_feautrier_expression_p ( expression  exp,
list ell 
)

================================================================

bool splc_feautrier_expression_p( (expression) exp ) Returns true if exp quasi affine form in structural parameters and in surrounding loop-counters.

Parameters
expxp
ellll

Definition at line 962 of file utils.c.

963 {
964  bool b = false;
966 
967  pips_debug(7, "exp : %s \n",
968  ((exp == expression_undefined)?"expression_undefined":
970 
971  if (splc_linear_expression_p(exp, ell)) return( true );
972  if ( syntax_tag( s ) == is_syntax_call ) {
973  call c;
974  list args;
975  expression exp1, exp2;
976 
977  c = syntax_call( s );
978  if (ENTITY_DIVIDE_P(call_function( c ))) {
979  args = call_arguments( c );
980  exp1 = EXPRESSION(CAR( args ));
981  exp2 = EXPRESSION(CAR( CDR(args) ));
982  b = splc_feautrier_expression_p(exp1, ell)
983  && expression_constant_p( exp2 );
984  }
985  }
986  pips_debug(7, "returning : %s\n",
987  (b?"TRUE":"FALSE") );
988  return( b );
989 }
bool splc_feautrier_expression_p(expression exp, list *ell)
================================================================
Definition: utils.c:962

References call_arguments, call_function, CAR, CDR, ENTITY_DIVIDE_P, exp, EXPRESSION, expression_constant_p(), expression_syntax, expression_to_string(), expression_undefined, is_syntax_call, pips_debug, splc_feautrier_expression_p(), splc_linear_expression_p(), syntax_call, and syntax_tag.

Referenced by splc_feautrier_expression_p(), and static_controlize_loop().

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

◆ splc_linear_access_to_arrays_p()

bool splc_linear_access_to_arrays_p ( list  l,
list ell 
)

================================================================

bool splc_linear_access_to_arrays_p((list) l, (list) *ell) AL 04/93 Returns true if all expressions exp are structural parameters and loop counters linear functions.

Parameters
ellll

Definition at line 700 of file utils.c.

701 {
702  bool bo, ret_bo = true;
703  expression exp;
704  syntax s;
705  tag t;
706 
707  pips_debug(7, "doing\n");
708  if (l == NIL) return(true);
709  MAPL( exp_ptr, {
710  exp = EXPRESSION(CAR( exp_ptr ));
711  s = expression_syntax( exp );
712  t = syntax_tag( s );
713  if (t == is_syntax_call)
714  bo =
716  ell);
717  else if (t == is_syntax_reference)
718  bo =
720  ell);
721  else bo = false;
722  ret_bo = ret_bo && bo;
723  }, l );
724 
725  return( ret_bo );
726 }
int tag
TAG.
Definition: newgen_types.h:92
bool splc_linear_expression_list_p(list l, list *ell)
================================================================
Definition: utils.c:682
bool splc_linear_access_to_arrays_p(list l, list *ell)
================================================================
Definition: utils.c:700

References call_arguments, CAR, exp, EXPRESSION, expression_syntax, is_syntax_call, is_syntax_reference, MAPL, NIL, pips_debug, reference_indices, splc_linear_access_to_arrays_p(), splc_linear_expression_list_p(), syntax_call, syntax_reference, and syntax_tag.

Referenced by splc_linear_access_to_arrays_p(), and static_controlize_call().

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

◆ splc_linear_expression_list_p()

bool splc_linear_expression_list_p ( list  l,
list ell 
)

================================================================

bool splc_linear_expression_list_p((list) l) AL 04/93 Returns true if all expressions exp are structural parameters and loop counters linear functions.

Parameters
ellll

Definition at line 682 of file utils.c.

683 {
684  bool bo = true;
685  expression exp;
686 
687  pips_debug( 7, "doing \n");
688  MAPL( exp_ptr, {
689  exp = EXPRESSION(CAR( exp_ptr ));
690  bo = bo && splc_linear_expression_p(exp, ell);
691  }, l );
692  return( bo );
693 }

References CAR, exp, EXPRESSION, MAPL, pips_debug, and splc_linear_expression_p().

Referenced by splc_linear_access_to_arrays_p().

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

◆ splc_linear_expression_p()

bool splc_linear_expression_p ( expression  exp,
list ell 
)

================================================================

bool splc_linear_expression_p((expression) exp) AL 04/93 Returns true if exp is linear in structural parameters and loop counters.

Parameters
expxp
ellll

Definition at line 648 of file utils.c.

649 {
650  Pvecteur vect;
651  bool ONLY_SPLC;
652 
653  pips_debug(7, "exp : %s\n", expression_to_string(exp));
654 
656  ONLY_SPLC = false;
657  else
658  {
660  ONLY_SPLC = true;
661 
662  for(; !VECTEUR_NUL_P(vect) && ONLY_SPLC ; vect = vect->succ)
663  {
664  entity var = (entity) vect->var;
665  bool assigned_by_array = entity_assigned_by_array_p(var);
666  if( ! term_cst(vect) )
667  if(!(ENTITY_SP_P(var) || (gen_find_eq(var,loops_to_indices(*ell)) != chunk_undefined)) || assigned_by_array == true)
668  ONLY_SPLC = false;
669  }
670  }
672  pips_debug(7, " result : %s\n", (ONLY_SPLC?"TRUE":"FALSE") );
673  return(ONLY_SPLC);
674 }
#define entity_assigned_by_array_p(ent)
Definition: utils.c:86
list loops_to_indices(list l)
================================================================
Definition: utils.c:630

References chunk_undefined, entity_assigned_by_array_p, ENTITY_SP_P, exp, expression_normalized, expression_to_string(), gen_find_eq(), is_normalized_complex, loops_to_indices(), NORMALIZE_EXPRESSION, normalized_linear, normalized_tag, pips_debug, Svecteur::succ, term_cst, unnormalize_expression(), Svecteur::var, and VECTEUR_NUL_P.

Referenced by normalize_test_leaves(), splc_feautrier_expression_p(), splc_linear_expression_list_p(), and splc_positive_relation_p().

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

◆ splc_positive_relation_p()

bool splc_positive_relation_p ( expression  exp,
list ell 
)

================================================================

bool splc_positive_relation_p((expression) exp, list *ell) AL 04/93 Returns true if exp is an affine form of structural parameters and of loop-counters.

Parameters
expxp
ellll

Definition at line 282 of file utils.c.

285 {
287  call c;
288  list args;
289 
290  pips_debug(7, "exp : %s\n",
292  if (syntax_tag(s) != is_syntax_call) return( false );
293  c = syntax_call( s );
294  if (!ENTITY_GREATER_OR_EQUAL_P(call_function( c ))) return( false );
295  args = call_arguments( c );
296  return(splc_linear_expression_p(EXPRESSION(CAR(args)), ell) &&
298 }
bool expression_equal_integer_p(expression exp, int i)
================================================================
Definition: expression.c:1977

References call_arguments, call_function, CAR, CDR, ENTITY_GREATER_OR_EQUAL_P, exp, EXPRESSION, expression_equal_integer_p(), expression_syntax, expression_to_string(), is_syntax_call, pips_debug, splc_linear_expression_p(), syntax_call, and syntax_tag.

Referenced by ndf_normalized_test(), and sc_opposite_exp_of_conjunction().

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

◆ static_controlize()

bool static_controlize ( string  mod_name)

=================================================================

void static_controlize((char*) mod_name) AL 05/93 Computes the static_control attached to module-name : mod_name.

HAS TO BE REMOVED AS SOON AS POSSIBLE: as the IOs are not treated as they would, all the instructions containing IOs are put inside comments. AP, oct 9th 1995

Normalization of all loops

Modification: loop_normalize_of_statement is used instead of

loop_normalize_of_unstructured since we cannot ensure that

mod_inst is an unstructured –11th Dec 1995, DB

oop_normalize_of_statement(mod_stat, Gforward_substitute_table, &Genclosing_loops, &Genclosing_tests, &Gscalar_written_forward, &Gcount_nlc);

The code has been modified, so the orderings are recomputed.

We compute the static control infos for each instruction.

Same remark as before –DB

Parameters
mod_nameod_name

Definition at line 495 of file static_controlize.c.

496 {
498  instruction mod_inst;
499  entity ent;
500  list formal_integers;
501  static_control sc;
502 
503  debug_on("STATIC_CONTROLIZE_DEBUG_LEVEL");
504 
505  ifdebug(2)
506  user_log("\n\n *** STATIC CONTROLIZE CODE for %s\n", mod_name);
507 
508  /*
509  * Set the current language
510  */
511  entity module = module_name_to_entity(mod_name);
512 
513 
515  if(value_code_p(mv)) {
516  code c = value_code(mv);
518  }
519 
520  Gcount_nsp = 0;
521  Gcount_nub = 0;
529 
530  ent = local_name_to_top_level_entity(mod_name);
532  formal_integers = sc_entity_to_formal_integer_parameters( ent );
533  pips_debug(7, "\n formal integers : %s \n",
534  print_structurals( formal_integers ));
535 
536  mod_stat = (statement) db_get_memory_resource(DBR_CODE, mod_name, true);
537 
538  mod_inst = statement_instruction( mod_stat );
539 
540  /* HAS TO BE REMOVED AS SOON AS POSSIBLE: as the IOs are not
541  treated as they would, all the instructions containing IOs are
542  put inside comments. AP, oct 9th 1995 */
544  /* Normalization of all loops */
545  /* Modification: loop_normalize_of_statement is used instead of */
546  /* loop_normalize_of_unstructured since we cannot ensure that */
547  /* mod_inst is an unstructured --11th Dec 1995, DB */
548 
549  /***
550  D.K desactivate the normalization of loops to preserve the
551  original code
552  */
553 
554  /*loop_normalize_of_statement(mod_stat,
555  Gforward_substitute_table,
556  &Genclosing_loops,
557  &Genclosing_tests,
558  &Gscalar_written_forward,
559  &Gcount_nlc);
560  */
561 
562 
563 
564 
565  /* The code has been modified, so the orderings are recomputed. */
567  verify_structural_parameters(formal_integers,
569 
572 
573  /* We compute the static control infos for each instruction. */
574  /* Same remark as before --DB */
575 
577  pips_assert("controlized statement mod_stat is consistent",
579  pips_assert("static_control sc is consistent",
581 
583 
585 
586  DB_PUT_MEMORY_RESOURCE(DBR_CODE, strdup(mod_name), (char*) mod_stat);
587  DB_PUT_MEMORY_RESOURCE(DBR_STATIC_CONTROL, strdup(mod_name),
588  (char*) Gstatic_control_map);
589 
590  ifdebug(2)
591  user_log("\n\n *** STATIC CONTROLIZE CODE done\n");
592 
594 
595  debug_off();
596  // Reset of the assigned_var list after the phase is complete
598  assigned_var = NIL;
599 
600  return(true);
601 }
bool static_control_consistent_p(static_control p)
Definition: paf_ri.c:628
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
if(!(yy_init))
Definition: genread_lex.c:1029
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
#define DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
void hash_warn_on_redefinition(void)
these function set the variable should_i_warn_on_redefinition to the value true or false
Definition: hash.c:183
static statement mod_stat
We want to keep track of the current statement inside the recurse.
Definition: impact_check.c:41
void set_prettyprint_language_from_property(enum language_utype native)
set the prettyprint language according to the property PRETTYPRINT_LANGUAGE @description If the prope...
Definition: language.c:103
#define SET_STATEMENT_MAPPING(map, stat, val)
Definition: newgen-local.h:47
#define MAKE_STATEMENT_MAPPING()
Definition: newgen-local.h:43
@ hash_pointer
Definition: newgen_hash.h:32
struct cons * list
Definition: newgen_types.h:106
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
#define value_code_p(x)
Definition: ri.h:3065
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
#define value_code(x)
Definition: ri.h:3067
#define CODE(x)
CODE.
Definition: ri.h:751
#define code_language(x)
Definition: ri.h:792
#define language_tag(x)
Definition: ri.h:1590
#define entity_initial(x)
Definition: ri.h:2796
int Gcount_nsp
================================================================
int Gcount_nub
static list Genclosing_tests
static list Gscalar_written_forward
list assigned_var
=================================================================
statement_mapping Gstatic_control_map
static list Genclosing_loops
static bool io_filter(statement st)
======================================================================
static_control static_controlize_statement(statement s)
static hash_table Gforward_substitute_table
list Gstructure_parameters
Global Variables
string print_structurals(list)
================================================================
Definition: utils.c:732
void verify_structural_parameters(list, list *)
================================================================
Definition: utils.c:873
int stco_renumber_code(statement, int)
================================================================
Definition: utils.c:137
list sc_entity_to_formal_integer_parameters(entity)
================================================================
Definition: utils.c:900

References assigned_var, code_language, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, entity_initial, Gcount_nsp, Gcount_nub, gen_free_list(), gen_null(), gen_recurse, Genclosing_loops, Genclosing_tests, Gforward_substitute_table, Gscalar_written_forward, Gstatic_control_map, Gstructure_parameters, hash_pointer, hash_table_make(), hash_warn_on_redefinition(), ifdebug, io_filter(), language_tag, local_name_to_top_level_entity(), MAKE_STATEMENT_MAPPING, mod_stat, module, module_name_to_entity(), module_reorder(), NIL, pips_assert, pips_debug, print_structurals(), reset_current_module_entity(), sc_entity_to_formal_integer_parameters(), set_current_module_entity(), set_prettyprint_language_from_property(), SET_STATEMENT_MAPPING, statement_consistent_p(), statement_domain, statement_instruction, static_control_consistent_p(), static_controlize_statement(), stco_renumber_code(), strdup(), user_log(), value_code, value_code_p, and verify_structural_parameters().

+ Here is the call graph for this function:

◆ static_controlize_call()

static_control static_controlize_call ( call  c)

================================================================

static_control static_controlize_call( (call) c ) AL 05/93 It computes now just a static-control assignement if it is an ASSIGN statement.

_list_of_loop_dup( Genclosing_loops ),

_list_of_loop_dup( Genclosing_loops ),

Definition at line 95 of file static_controlize.c.

96 {
97  static_control sc;
98 
99  pips_debug( 3, "begin CALL\n");
100  pips_debug( 7,
101  "call : %s\n", entity_local_name( call_function(c) ) );
102  entity e = call_function(c);
103  tag tt;
104  if ((tt = value_intrinsic_p(entity_initial(e))))
105  {
106  sc = make_static_control(false,
108  /* _list_of_loop_dup(
109  Genclosing_loops ),*/
114  }
115  else
116  {
119 
120  sc = make_static_control(b,
122  /* _list_of_loop_dup(
123  Genclosing_loops ),*/
126  }
127  pips_debug( 3, "end CALL\n");
128  return sc;
129 }
static_control make_static_control(bool a1, list a2, list a3, list a4)
Definition: paf_ri.c:655
list copy_loops(list ll)
Duplicate a loop list.
Definition: loop.c:826
#define static_control_yes(x)
Definition: paf_ri.h:753
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
Definition: entity.c:453
#define value_intrinsic_p(x)
Definition: ri.h:3074
list sc_list_of_exp_dup(list)
================================================================
Definition: utils.c:741
list sc_list_of_entity_dup(list)
================================================================
Definition: utils.c:761
bool splc_linear_access_to_arrays_p(list, list *)
================================================================
Definition: utils.c:700

References call_arguments, call_function, copy_loops(), entity_initial, entity_local_name(), Genclosing_loops, Genclosing_tests, Gstructure_parameters, make_static_control(), pips_debug, sc_list_of_entity_dup(), sc_list_of_exp_dup(), splc_linear_access_to_arrays_p(), static_control_yes, and value_intrinsic_p.

Referenced by static_controlize_statement().

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

◆ static_controlize_forloop()

static_control static_controlize_forloop ( forloop  fl)

=================================================================

static_control static_controlize_forloop( (forloop) fl ) It computes the forloop's static_control.

Parameters
fll

Definition at line 165 of file static_controlize.c.

166 {
167  static_control sc;
168 
169  pips_debug(3, "begin FORLOOP\n");
170 
171 
173  static_control_yes( sc ) = false;
174 
176 
177  pips_debug(3, "end FORLOOP\n");
178  return( sc );
179 }
#define forloop_body(x)
Definition: ri.h:1372

References forloop_body, Gstatic_control_map, pips_debug, SET_STATEMENT_MAPPING, static_control_yes, and static_controlize_statement().

Referenced by static_controlize_statement().

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

◆ static_controlize_loop()

static_control static_controlize_loop ( loop  l)

=================================================================

static_control static_controlize_loop( (loop) l ) It computes the loop's static_control.

Definition at line 135 of file static_controlize.c.

136 {
137  static_control sc;
138  expression low, up;
139 
140  pips_debug(3, "begin LOOP\n");
141 
142  low = range_lower( loop_range( l ) );
143  up = range_upper( loop_range( l ) );
146  if ( !constant_step_loop_p(l)
149  static_control_yes( sc ) = false;
150  }
153 
154  pips_debug(3, "end LOOP\n");
155  return( sc );
156 }
bool constant_step_loop_p(loop l)
Test if a loop has a constant step loop.
Definition: loop.c:733
bool splc_feautrier_expression_p(expression, list *)
================================================================
Definition: utils.c:962

References ADD_ELEMENT_TO_LIST, constant_step_loop_p(), gen_remove(), Genclosing_loops, Gstatic_control_map, LOOP, loop_body, loop_range, pips_debug, range_lower, range_upper, SET_STATEMENT_MAPPING, splc_feautrier_expression_p(), static_control_yes, and static_controlize_statement().

Referenced by static_controlize_statement().

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

◆ static_controlize_statement()

static_control static_controlize_statement ( statement  s)

We put condition under a normal disjunctive form

ontinue_statement_p(s) ||

Definition at line 209 of file static_controlize.c.

210 {
211  // Update of the list containing the variables assigned directly or indirectly by an array
213 
214  bool is_static = true, static_test = false;
216  static_control sc, sc1, sc2;
217  expression exp, exp1, exp2;
218 
219  pips_debug(3, "begin STATEMENT\n");
220  pips_debug(7, "statement_ordering = %zd \n", statement_ordering(s));
221 
222  switch(instruction_tag(inst))
223  {
224  case is_instruction_block :
225  {
226  FOREACH(STATEMENT, local_stmt, instruction_block(inst)) {
227  sc1 = static_controlize_statement( local_stmt );
228  SET_STATEMENT_MAPPING( Gstatic_control_map, local_stmt, sc1);
229  //printf("s=%p, sc=%p\n", local_stmt, sc1);
230  is_static = ( is_static && static_control_yes( sc1 ));
231  }
232  break;
233  }
234  case is_instruction_test :
235  {
236  test t = instruction_test(inst);
239 
240  /* We put condition under a normal disjunctive form */
243  //DK, don't change the structure of conditions
244  //test_condition( t ) = exp ;
245  static_test = true;
246  }
250  gen_remove( &Genclosing_tests, (void*) test_condition( t ));
251 
253  if ( (exp2 = sc_conditional(exp1, &Genclosing_loops)) ==
255  exp2 = exp1;
256  }
260  gen_remove( &Genclosing_tests, (void *) exp2 );
261  is_static = ( static_control_yes( sc1 )
262  && static_control_yes( sc2 )
263  && static_test );
264  break;
265  }
266  case is_instruction_loop :
267  {
268  loop the_loop = instruction_loop( inst );
271  sc1 = static_controlize_loop( the_loop );
272  is_static = static_control_yes( sc1 );
273  break;
274  }
276  {
277  forloop forl = instruction_forloop( inst );
280  sc1 = static_controlize_forloop( forl );
281  is_static = static_control_yes( sc1 );
282  break;
283  }
285  {
286  whileloop whilel = instruction_whileloop( inst );
289  sc1 = static_controlize_whileloop( whilel );
290  is_static = static_control_yes( sc1 );
291  break;
292  }
293  case is_instruction_call :
294  {
295  if (!(/*continue_statement_p(s) ||*/ declaration_statement_p(s)))
296  {
297  call the_call = instruction_call( inst);
299  is_static = static_control_yes(static_controlize_call( the_call ));
300  }
301  else
302  is_static = false;
303  if (!get_bool_property("STATIC_CONTROLIZE_ACROSS_USER_CALLS"))
304  {
307  is_static = false;
308  }
309  break;
310  }
311 
312  case is_instruction_goto :
313  {
314  pips_internal_error("No goto in code ressource\n");
315  is_static = false;
316  break;
317  }
319  {
320  is_static = true;
321  break;
322  }
324  {
325  unstructured local_un = instruction_unstructured( inst );
326  is_static =
328  break;
329  }
330  default :
331  {
332  pips_internal_error("Ill. instruction tag");
333  }
334  }
335  //if (!(continue_statement_p(s) || declaration_statement_p(s)))
336  sc = make_static_control(is_static,
340 
341  pips_debug(7,
342  " Returning static_control : \n bool : %s \n params : %s \n loops : %zd \n tests : %zd \n ",
343  ((is_static)?"TRUE":"FALSE"),
347  pips_debug(3, "end STATEMENT\n");
348 
349  return sc;
350 
351 }
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
size_t gen_length(const list l)
Definition: list.c:150
bool statement_contains_user_call_p(statement)
Definition: statement.c:3939
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
Definition: statement.c:224
bool io_intrinsic_p(entity e)
rue is a statement s is an io intrinsic
Definition: entity.c:1655
#define statement_ordering(x)
Definition: ri.h:2454
@ is_instruction_whileloop
Definition: ri.h:1472
@ is_instruction_expression
Definition: ri.h:1478
@ is_instruction_forloop
Definition: ri.h:1477
#define instruction_forloop(x)
Definition: ri.h:1538
#define instruction_whileloop(x)
Definition: ri.h:1523
static_control static_controlize_unstructured(unstructured u)
=================================================================
static_control static_controlize_whileloop(whileloop wl)
=================================================================
static_control static_controlize_forloop(forloop fl)
=================================================================
static_control static_controlize_call(call c)
================================================================
static_control static_controlize_loop(loop l)
=================================================================
bool get_reference_assignments(statement, list *)
Allows the static_controlize phase to keep and update a list containing all the variables of the prog...
Definition: utils.c:1300
expression sc_conditional(expression, list *)
================================================================
Definition: utils.c:596
bool sp_feautrier_expression_p(expression)
================================================================
Definition: utils.c:995
list sc_list_of_loop_dup(list)
================================================================
Definition: utils.c:778

References ADD_ELEMENT_TO_LIST, assigned_var, call_function, copy_expression(), declaration_statement_p(), ENTITY_NOT, exp, EXPRESSION, expression_undefined, FOREACH, forward_substitute_in_anyloop(), forward_substitute_in_call(), forward_substitute_in_exp(), gen_length(), gen_remove(), Genclosing_loops, Genclosing_tests, get_bool_property(), get_reference_assignments(), Gforward_substitute_table, Gstatic_control_map, Gstructure_parameters, instruction_block, instruction_call, instruction_forloop, instruction_loop, instruction_tag, instruction_test, instruction_unstructured, instruction_whileloop, io_intrinsic_p(), is_instruction_block, is_instruction_call, is_instruction_expression, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, make_static_control(), MakeUnaryCall(), pips_debug, pips_internal_error, print_structurals(), sc_conditional(), sc_list_of_entity_dup(), sc_list_of_exp_dup(), sc_list_of_loop_dup(), SET_STATEMENT_MAPPING, sp_feautrier_expression_p(), STATEMENT, statement_contains_user_call_p(), statement_instruction, statement_ordering, static_control_yes, static_controlize_call(), static_controlize_forloop(), static_controlize_loop(), static_controlize_unstructured(), static_controlize_whileloop(), test_condition, test_false, and test_true.

Referenced by static_controlize(), static_controlize_forloop(), static_controlize_loop(), static_controlize_unstructured(), and static_controlize_whileloop().

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

◆ static_controlize_unstructured()

static_control static_controlize_unstructured ( unstructured  u)

=================================================================

static_control static_controlize_unstructered((unstructured) u) AL 05/93 Computes an unstructured's static_control

Definition at line 358 of file static_controlize.c.

360 {
361  bool is_static = true;
362  list blocs = NIL;
364 
365  pips_debug(3, "begin UNSTRUCTURED\n");
367  blocs = gen_nreverse( blocs ) ;
368 
369  FOREACH(CONTROL, ctl, blocs) {
372  pips_assert("stmt is consistent", statement_consistent_p(stmt));
374  //fprintf(stdout, "stmt=%p, sharing=%p\n", stmt, sc);
375  is_static = is_static && static_control_yes( sc );
376  }
377 
378  gen_free_list(blocs);
379  ret_sc = make_static_control( is_static,
383 
384  pips_debug(7,
385 "\n Returning static_control : \n bool : %s \n params : %s \n loops : %zd \n tests : %zd \n ",
386  ((is_static)?"TRUE":"FALSE"),
390 
391  pips_debug(3, "end UNSTRUCTURED\n");
392  return( ret_sc );
393 }
#define static_control_undefined
Definition: paf_ri.h:727

References CONTROL, control_map_get_blocs(), control_statement, FOREACH, gen_free_list(), gen_length(), gen_nreverse(), Genclosing_loops, Genclosing_tests, Gstatic_control_map, Gstructure_parameters, make_static_control(), NIL, pips_assert, pips_debug, print_structurals(), sc_list_of_entity_dup(), sc_list_of_exp_dup(), sc_list_of_loop_dup(), SET_STATEMENT_MAPPING, statement_consistent_p(), static_control_undefined, static_control_yes, static_controlize_statement(), and unstructured_control.

Referenced by static_controlize_statement().

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

◆ static_controlize_whileloop()

static_control static_controlize_whileloop ( whileloop  wl)

=================================================================

static_control static_controlize_whileloop( (whileloop) l ) It computes the whileloop's static_control.

Parameters
wll

Definition at line 185 of file static_controlize.c.

186 {
187  static_control sc;
188 
189  pips_debug(3, "begin WHILELOOP\n");
190 
191 
193  static_control_yes( sc ) = false;
194 
196 
197  pips_debug(3, "end WHILELOOP\n");
198  return( sc );
199 }
#define whileloop_body(x)
Definition: ri.h:3162

References Gstatic_control_map, pips_debug, SET_STATEMENT_MAPPING, static_control_yes, static_controlize_statement(), and whileloop_body.

Referenced by static_controlize_statement().

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

◆ stco_renumber_code()

int stco_renumber_code ( statement  in_st,
int  in_ct 
)

================================================================

int stco_renumber_code( (statement) in_st, (int) in_ct ) AL 25/10/93 Input : A statement in_st and a begin count number in_ct. Output : Renumber statement_number in an textual order and return the last number attributed.

I've removed many renumbering since it is done by a deeper call to stco_renumber_code() and renumbering sequences kill an assert in the prettyprinter...

Renumber all the statement but the sequence:

Parameters
in_stn_st
in_ctn_ct

Definition at line 137 of file utils.c.

139 {
140  int count;
141  instruction inst;
142 
143  pips_debug(7, "begin\n");
144  count = in_ct;
145  inst = statement_instruction( in_st );
146 
147  /* Renumber all the statement but the sequence: */
149  statement_number(in_st) = count++;
150 
151  switch(instruction_tag(inst)) {
152  case is_instruction_block : {
153  MAPL( stmt_ptr, {
154  statement st = STATEMENT(CAR( stmt_ptr ));
155  /*
156  statement_number( st ) = count++;
157  */
158  count = stco_renumber_code( st, count );
159  }, instruction_block( inst ) );
160  break;
161  }
162  case is_instruction_test : {
163  test t = instruction_test(inst);
164  statement tt, tf;
165 
166  tt = test_true( t );
167  tf = test_false( t );
168  /*
169  statement_number( tt ) = count++;
170  statement_number( tf ) = count++;
171  */
172  count = stco_renumber_code( tt, count );
173  count = stco_renumber_code( tf, count );
174  break;
175  }
176  case is_instruction_loop : {
177  statement lb = loop_body( instruction_loop( inst ) );
178  /*
179  statement_number( lb ) = count++;
180  */
181  count = stco_renumber_code( lb, count );
182  break;
183  }
185  {
186  break;
187  }
189  {
190  break;
191  }
192  case is_instruction_call : {
193  break;
194  }
195  case is_instruction_goto : {
196  statement gs = instruction_goto( inst );
197  /*
198  statement_number( gs ) = count++;
199  */
200  count = stco_renumber_code( gs, count );
201  break;
202  }
204  {
205  break;
206  }
208  list blocs = NIL;
210 
212  blocs = gen_nreverse( blocs ) ;
213  MAPL( ctl_ptr, {
215  CONTROL(CAR( ctl_ptr )));
216  /*
217  statement_number( stmt ) = count++;
218  */
220  }, blocs);
221  gen_free_list(blocs);
222  break;
223  }
224  default : pips_internal_error("Ill. instruction tag");
225  }
226 
227  pips_debug(7, "return count : %d\n", count);
228  return( count );
229 }
static int count
Definition: SDG.c:519
#define instruction_goto(x)
Definition: ri.h:1526
#define statement_number(x)
Definition: ri.h:2452
int stco_renumber_code(statement in_st, int in_ct)
================================================================
Definition: utils.c:137

References CAR, CONTROL, control_map_get_blocs(), control_statement, count, gen_free_list(), gen_nreverse(), instruction_block, instruction_goto, instruction_loop, instruction_tag, instruction_test, instruction_unstructured, is_instruction_block, is_instruction_call, is_instruction_expression, is_instruction_forloop, is_instruction_goto, is_instruction_loop, is_instruction_test, is_instruction_unstructured, is_instruction_whileloop, loop_body, MAPL, NIL, pips_debug, pips_internal_error, STATEMENT, statement_instruction, statement_number, stco_renumber_code(), test_false, test_true, and unstructured_control.

Referenced by static_controlize(), and stco_renumber_code().

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

◆ stco_same_loops()

list stco_same_loops ( statement_mapping  in_map,
statement  in_s,
statement  in_s2 
)

utils.c

utils.c

list stco_same_loops( in_map, in_s, in_s2 ) AL 25/10/93 Input : A static_control mapping on statements and 2 statements. Output : A list of loops common to in_s and in_s2.

Parameters
in_mapn_map
in_sn_s
in_s2n_s2

Definition at line 98 of file utils.c.

101 {
102  list l, l2, ret_l = NIL;
103  static_control sc, sc2;
104 
105  pips_debug(7,"begin\n");
106  sc = (static_control) GET_STATEMENT_MAPPING( in_map, in_s );
107  sc2= (static_control) GET_STATEMENT_MAPPING( in_map, in_s2 );
108  l = static_control_loops( sc );
109  l2 = static_control_loops( sc2 );
110  for(; !ENDP(l); POP(l)) {
111  list l3 = l2;
112  loop lo = LOOP(CAR( l ));
113  int in = statement_ordering(loop_body( lo ));
114  for(; !ENDP(l3); POP(l3) ) {
115  loop ll = LOOP(CAR( l3 ));
116  int in2 = statement_ordering(loop_body( ll ));
117  if( in == in2 ) ADD_ELEMENT_TO_LIST(ret_l, LOOP, ll);
118  }
119  }
120  pips_debug(7, "end \n");
121 
122  return( ret_l );
123 }
#define GET_STATEMENT_MAPPING(map, stat)
Definition: newgen-local.h:49
#define static_control_loops(x)
Definition: paf_ri.h:757
struct _newgen_struct_static_control_ * static_control
Definition: paf_ri.h:184

References ADD_ELEMENT_TO_LIST, CAR, ENDP, GET_STATEMENT_MAPPING, LOOP, loop_body, NIL, pips_debug, POP, statement_ordering, and static_control_loops.

Referenced by stco_common_loops_of_statements().

+ Here is the caller graph for this function:

◆ store_sc_text_line()

text store_sc_text_line ( static_control  sc)

================================================================

text store_sc_text_line((static_control) sc) AL 05/93 Stores a static_control prettyprinted.

pips_assert("store_text_line", sefs_list != NIL);

Parameters
scc

Definition at line 152 of file prettyprint.c.

154 {
155  text sc_text = make_text(NIL);
156  char *t = NULL;
157  string comment;
158 
159  /* pips_assert("store_text_line", sefs_list != NIL); */
161  comment = "//";
162  else
163  comment = "C";
164 
165 
166  t = concatenate(comment,"\t\t< is static >",
167  (static_control_yes(sc)?" TRUE":" FALSE"), "\n", NULL);
168  ADD_SENTENCE_TO_TEXT( sc_text,
170  t = concatenate(comment,"\t\t< parameter >",
172  "\n", NULL);
173  ADD_SENTENCE_TO_TEXT( sc_text,
175  t = concatenate(comment,"\t\t< loops >",
177  NULL);
178  ADD_SENTENCE_TO_TEXT( sc_text,
180  t = concatenate(comment,"\t\t< tests >",
182  NULL);
183  ADD_SENTENCE_TO_TEXT( sc_text,
185 
186  return ( sc_text );
187 }
sentence make_sentence(enum sentence_utype tag, void *val)
Definition: text.c:59
static void comment(string_buffer code, spoc_hardware_type hw, dagvtx v, int stage, int side, bool flip)
Definition: freia_spoc.c:52
enum language_utype get_prettyprint_language_tag()
Definition: language.c:67
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
#define static_control_params(x)
Definition: paf_ri.h:755
#define static_control_tests(x)
Definition: paf_ri.h:759
@ is_language_c
Definition: ri.h:1567
cons * words_test_list(list obj)
================================================================
Definition: prettyprint.c:195
cons * words_loop_list(list obj)
================================================================
Definition: prettyprint.c:226
#define ADD_SENTENCE_TO_TEXT(t, p)
@ is_sentence_formatted
Definition: text.h:57

References ADD_SENTENCE_TO_TEXT, comment(), concatenate(), get_prettyprint_language_tag(), is_language_c, is_sentence_formatted, make_sentence(), make_text(), NIL, static_control_loops, static_control_params, static_control_tests, static_control_yes, strdup(), words_entity_list(), words_loop_list(), words_test_list(), and words_to_string().

Referenced by text_static_control().

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

◆ text_static_control()

text text_static_control ( entity  ,
int  ,
statement   
)

◆ verify_structural_parameters()

void verify_structural_parameters ( list  the_list,
list swfl 
)

================================================================

void verify_structural_parameters( (list) l ) AL 04/93 Updates the global variable Gstructure_parameters. 'l' is a list of entities, which are structural-parameters candidates. An entity will be a structural parameter if it is a candidate and if it is not written forward.

Parameters
the_listhe_list
swflwfl

Definition at line 873 of file utils.c.

874 {
875  pips_debug(7,"doing\n");
876  MAPL( el_ptr,
877  {
878  entity ent = ENTITY(CAR( el_ptr ));
879  if ( gen_find_eq( ent, *swfl )
880  == chunk_undefined )
882  ENTITY,
883  ent );
884  },
885  the_list);
886  pips_debug(7, "list of structurals : %s\n",
888 }

References ADD_ELEMENT_TO_LIST, CAR, chunk_undefined, ENTITY, gen_find_eq(), Gstructure_parameters, MAPL, pips_debug, and print_structurals().

Referenced by static_controlize().

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

◆ words_entity_list()

list words_entity_list ( list  obj)

================================================================

cons *words_entity_list((list) obj) AL 05/93 Returns a list of strings from a list of entities.

FI: Should be moved in ri-util/entity.c or entities.c when it exists

Parameters
objbj

Definition at line 265 of file prettyprint.c.

266 {
267  list the_list = NIL;
268  pips_debug(7, "doing \n");
269  the_list = CHAIN_SWORD(the_list, " ");
270  FOREACH(ENTITY, ent, obj)
271  {
272  string s = strdup(concatenate(entity_local_name(ent), ", ", NULL));
273  ADD_ELEMENT_TO_LIST( the_list, STRING, s );
274  }
275  return the_list;
276 }
#define STRING(x)
Definition: genC.h:87
#define CHAIN_SWORD(l, s)

References ADD_ELEMENT_TO_LIST, CHAIN_SWORD, concatenate(), ENTITY, entity_local_name(), FOREACH, NIL, pips_debug, strdup(), and STRING.

Referenced by print_structurals(), and store_sc_text_line().

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

◆ words_loop_list()

cons* words_loop_list ( list  obj)

================================================================

cons *words_loop_list((list) obj) AL 05/93 Returns a list of strings from a list of loops.

Parameters
objbj

Definition at line 226 of file prettyprint.c.

228 {
229  cons* ret_cons = NIL;
230  string before_string = strdup(" ");
231  string blank_string;
233  blank_string = strdup("// ");
234  else
235  blank_string = strdup("C ");
236 
237 
238  pips_debug(7, "doing \n");
239  FOREACH(LOOP, l, obj) {
240  cons* pc = NIL;
241  entity ind = loop_index( l );
242  expression low = range_lower(loop_range( l ));
243  expression up = range_upper(loop_range( l ));
244  pc = CHAIN_SWORD(pc, strdup( before_string ));
245  pc = gen_nconc(pc, Words_Expression(low));
246  pc = CHAIN_SWORD(pc," <= ");
247  pc = CHAIN_SWORD(pc, entity_local_name(ind));
248  pc = CHAIN_SWORD(pc," <= ");
249  pc = gen_nconc(pc, Words_Expression(up));
250  pc = CHAIN_SWORD(pc,"\n") ;
251  ret_cons = gen_nconc(ret_cons, gen_copy_seq(pc));
252  before_string = blank_string;
253  }
254 
255  if( ret_cons == NIL ) ret_cons = CHAIN_SWORD(ret_cons, "\n");
256  return( ret_cons );
257 }
list gen_copy_seq(list l)
Copy a list structure.
Definition: list.c:501
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
list Words_Expression(expression obj)
of string
Definition: misc.c:2616

References CHAIN_SWORD, entity_local_name(), FOREACH, gen_copy_seq(), gen_nconc(), get_prettyprint_language_tag(), is_language_c, LOOP, loop_index, loop_range, NIL, pips_debug, range_lower, range_upper, strdup(), and Words_Expression().

Referenced by store_sc_text_line().

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

◆ words_test_list()

cons* words_test_list ( list  obj)

================================================================

cons *words_test_list((list) obj) AL 05/93 Makes a list of strings from a list of test expressions.

Parameters
objbj

Definition at line 195 of file prettyprint.c.

197 {
198  cons* ret_cons = NIL;
199  string before_string = strdup(" ");
200  string blank_string;
202  blank_string = strdup("// ");
203  else
204  blank_string = strdup("C ");
205 
206  pips_debug(7, "doing \n");
207  MAPL( exp_ptr, {
208  cons* pc = NIL;
209  expression exp = EXPRESSION(CAR(exp_ptr));
210 
211  pc = CHAIN_SWORD(pc, strdup( before_string ));
212  pc = gen_nconc(pc, Words_Expression(exp));
213  pc = CHAIN_SWORD(pc,"\n") ;
214  ret_cons = gen_nconc(ret_cons, gen_copy_seq(pc));
215  before_string = blank_string;
216  }, obj);
217 
218  if( ret_cons == NIL ) ret_cons = CHAIN_SWORD(ret_cons, "\n");
219  return( ret_cons );
220 }

References CAR, CHAIN_SWORD, exp, EXPRESSION, gen_copy_seq(), gen_nconc(), get_prettyprint_language_tag(), is_language_c, MAPL, NIL, pips_debug, strdup(), and Words_Expression().

Referenced by store_sc_text_line().

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

Variable Documentation

◆ assigned_var

list assigned_var
extern

=================================================================

static_control static_controlize_statement((statement) s) AL 05/93 Computes s's static_control

Definition at line 207 of file static_controlize.c.

◆ Gcount_nlc

int Gcount_nlc
extern

◆ Gcount_nsp

int Gcount_nsp
extern

================================================================

Definition at line 158 of file misc_paf_utils.c.

◆ Gcount_nub

int Gcount_nub
extern

Definition at line 160 of file misc_paf_utils.c.

◆ Gstatic_control_map

◆ Gstructure_parameters

list Gstructure_parameters
extern