PIPS
simplify.c
Go to the documentation of this file.
1 #ifdef HAVE_CONFIG_H
2  #include "pips_config.h"
3 #endif
4 
5 #include "genC.h"
6 #include "linear.h"
7 #include "ri.h"
8 #include "effects.h"
9 #include "ri-util.h"
10 #include "effects-util.h"
11 #include "misc.h"
12 #include "pipsdbm.h"
13 #include "resources.h"
14 #include "control.h"
15 #include "properties.h"
16 #include "expressions.h"
17 
18 static bool has_address_of_operator_walker_p(call c,bool *panswer)
19 {
20  return !(*panswer|=ENTITY_ADDRESS_OF_P(call_function(c)));
21 }
22 
23 /* look for an & in the expression*/
25 {
26  bool answer = false;
28  return answer;
29 }
30 
31 /* the walker*/
33 {
34  statement parent_statement = (statement)gen_get_ancestor(statement_domain,ss);
35  expression ss_array = subscript_array(ss);
36  /* do nothing if an address-of is involved - over cautious indeed */
37  if( !has_address_of_operator_p(ss_array) )
38  {
39  /* create atomized_expression */
40  basic exp_basic = basic_of_expression(ss_array);
42  AddEntityToCurrentModule(new_entity);
43  statement new_statement = make_assign_statement(entity_to_expression(new_entity),ss_array);
44 
45  /* create replacement reference */
46  reference new_ref= make_reference(new_entity,subscript_indices(ss));
47  /* do the replacement */
48  expression parent_expression = (expression) gen_get_ancestor(expression_domain,ss);
49  /*free stuffs a bit less carefully than I should*/
50  expression_syntax(parent_expression)=syntax_undefined;
51  update_expression_syntax(parent_expression,make_syntax_reference(new_ref));
52  /* we must do this now and not before */
53  insert_statement(parent_statement,new_statement,true);
54  }
55 }
56 
58  gen_recurse(s,
61 }
62 
63 /* atomize subscript expressions so that thay can be reprsetned as references*/
65 {
66  /* prelude */
69 
70  /* do the job */
72 
73  /* validate */
76 
77  /*postlude*/
80  return true;
81 }
82 
83 /**************************************************************
84  * SPLIT_STRUCTURES
85  */
86 
87 
88 typedef struct {
90  bool used;
92 
93 static
95 {
96  entity op = call_function(c);
97  if(!ENTITY_FIELD_P(op)&&!ENTITY_POINT_TO_P(op))
98  {
100  {
102  {
103  p->used=true;
104  }
105  }
106  /* SG: as a special extension, we allow return call
107  * for it is handled elsewhere*/
108  if(p->used) {
110  p->used=false;
111  else
112  gen_recurse_stop(0);
113  }
114  }
115 }
116 
117 static
119 {
120  entity_used_in_calls_p p = { e, false};
122  return p.used;
123 }
124 
125 typedef struct {
128  entity new;
129 } rfr_param;
130 
131 static void
133 {
134  entity op = call_function(c);
135  if(ENTITY_POINT_TO_P(op) || ENTITY_FIELD_P(op))
136  {
137  expression lhs = binary_call_lhs(c);
138  expression rhs = binary_call_rhs(c);
141  {
142  gen_chunk *ancestor = gen_get_recurse_ancestor(c);
143  if(INSTANCE_OF(syntax,ancestor))
144  {
145  free_call(c);
146  syntax s = (syntax)ancestor;
149  }
150  else
151  {
155  }
156  }
157  }
158 }
159 
160 static void
162 {
163  rfr_param p = { structure, field,new };
165 }
166 
167 typedef struct {
171 } dssrhp;
172 
173 static
175 {
176  list fields_update = NIL;
177  FOREACH(ENTITY,nv,new_vars)
178  {
179  entity f = ENTITY(CAR(fields));
180  fields_update=CONS(STATEMENT,
181  entity_scalar_p(nv) ?
187  )
188  ,/* this makes e.f */
189  entity_to_expression(nv)/*this makes udpated value of the fields */
190  ):
199  ),
204  )
205  )
206  ),
207  fields_update
208  );
209  POP(fields);
210  }
211  return make_instruction_sequence(make_sequence(gen_nreverse(fields_update)));
212 }
213 
214 static void
216 {
217  if(return_statement_p(s))
218  {
220  expression returned =
223  instruction_call(i):
225  )));
226  /* we return the same reference as the initial variable, update fields accordingly */
227  if(expression_reference_p(returned) &&
229  {
231  insert_statement(s,instruction_to_statement(fields_update),true);
232 
233  }
234 
235  }
236 }
237 
238 static
239 void do_split_structure_return_hook(entity var,list fields, list new_vars)
240 {
241  pips_assert("as many new vars as fields\n",gen_length(fields)==gen_length(new_vars));
242  dssrhp p = { var, fields, new_vars };
245  /* also add a 'set all' operation at end ob block */
246  if(formal_parameter_p(var))
247  {
248  instruction fields_update = make_fields_assignment_instruction(var,fields,new_vars);
250  }
251 
252 }
253 
254 
255 static
257 {
258  list added = NIL;
259  if(entity_variable_p(e) )
260  {
264  {
265  list fields = type_struct_variable_p(t)?
270  NIL;
271  FOREACH(ENTITY,f,fields)
272  {
274  string new_name = strdup(entity_name(f));
275  for(string found = strchr(new_name,MEMBER_SEP_CHAR);found;found = strchr(new_name,MEMBER_SEP_CHAR))
276  *found='_';
277  entity new = make_entity_copy_with_new_name(f,new_name,false);
278  free(new_name);
279  /* we copied the field storage, that is rom, recompute a ram storage */
282  entity_storage(new) =
285  (basic_overloaded_p(entity_basic(new))?0:add_variable_to_area(dyn_area,new)),
286  NIL));
287  /* then take car of initial value if any */
288  if(formal_parameter_p(e))
289  {
290  if(entity_scalar_p(new))
291  entity_initial(new)=
297  )
298  );
299  else
310  )
311  )
312  ),
313  true
314  );
315  }
316  else
321  added=CONS(ENTITY,new,added);
322  if(!ENDP(inits)) POP(inits);
323  }
324  added=gen_nreverse(added);
326  {
329  }
330  /* hook: handle returns as a special case */
331  do_split_structure_return_hook(e,fields,added);
332  }
333  }
334  return added;
335 }
336 
337 
338 static
340 {
341  if(statement_block_p(s))
342  {
343  list added = NIL;
345  {
346  list new = do_split_structure(e,s);
347  added=gen_nconc(added,new);
348  }
349  FOREACH(ENTITY,e,added)
351  gen_free_list(added);
352  }
353 
354 }
355 
356 static
358 {
360  FOREACH(ENTITY,e,added)
362  gen_free_list(added);
363 }
364 
365 bool split_structures(const char* module_name)
366 {
367  /* prelude */
370 
371  /* do the job for declared structures */
374  /* now do the job for parameter structures */
376  if(formal_parameter_p(e))
378 
379  /* change useless subscripts */
381 
382  /* validate */
385 
386  /*postlude*/
389  return true;
390 }
391 
392 
393 
394 /**************************************************************
395  * SIMPLIFY_COMPLEX
396  */
398 
400 static void set_the_i() {
405 }
406 
407 static void reset_the_i() {
409 }
410 
411 static void (*complex_translation)(list*,list)=NULL;
413 {
414  gen_append(*pl,l);
415 }
417 {
418  gen_append(l,*pl);
419  *pl=l;
420 }
421 
422 static void set_translation_mode()
423 {
424  if(get_bool_property("SIMPLIFY_COMPLEX_USE_ARRAY_OF_STRUCTS"))
426  else
428 }
430 
431 
432 /* adds a dimension to all entity whose basic is complex , and change their basic to float */
434 {
436  {
440  CONS(DIMENSION,
443  NIL),
444  NIL)
445  );
446  intptr_t old_basic = basic_complex(variable_basic(v));
448  variable_basic(v)=make_basic_float(old_basic);
449  }
450 }
452 {
458  {
459  dummy d = parameter_dummy(p);
460  if(dummy_identifier_p(d))
462  }
465 }
466 
468 {
470  list ri = reference_indices(r);
471 
472  list ri0 = gen_full_copy_list(ri);
474  list ri1 = gen_full_copy_list(ri);
476 
484  )
485  );
486  return new;
487 }
488 
490 {
491  basic b = basic_of_expression(e);
492  if(expression_call_p(e))
493  {
494  call c = expression_call(e);
495  entity op = call_function(c);
497  /* replace |.| by sqrt(re^2+im^2) */
498  if(ENTITY_CABS_P(op))
499  {
506  )
507  );
508  }
509  /* replace REAL(.) by .[0] */
511  {
512  if(expression_reference_p(arg)) /* ok let's do something */
513  {
516  /* replace the call by a reference */
522  }
523  else
524  pips_user_warning("case unhandled, this would require an atomization in fortran i guess\n");
525  }
526  /* replace AIMAG(.) by .[1] */
528  {
529  if(expression_reference_p(arg)) /* ok let's do something */
530  {
533  /* replace the call by a reference */
539  }
540  else
541  pips_user_warning("case unhandled, this would require an atomization in fortran i guess\n");
542  }
543  else if(basic_complex_p(b) && ENTITY_FIVE_OPERATION_P(op) )
544  {
545  expression e0 = binary_call_lhs(c),
546  e1 = binary_call_rhs(c);
547  basic b0 = basic_of_expression(e0),
550  {
551  *e0=*split_complex_expression(e0);
552  gen_recurse_stop(e0);
553  }
555  {
556  *e1=*split_complex_expression(e1);
557  gen_recurse_stop(e1);
558  }
559  free_basic(b0);
560  free_basic(b1);
561 
562  }
563  }
564  free_basic(b);
565  /* more to come */
566  return true;
567 
568 }
569 
570 
572 {
573  /* do the job */
575 }
576 
577 /* split complexes into an array with first element <> real part and second element <> imaginary part */
578 bool simplify_complex(const char* module_name)
579 {
580  /* prelude */
583  set_the_i();
585 
586  /* change call to complex intrinsics */
587  /* change other complex references*/
589  /* and all their declarations */
591 
592  /* validate */
595 
596  /*postlude*/
598  reset_the_i();
601  return true;
602 }
603 
605 {
606  entity op =call_function(c);
607  if(ENTITY_PLUS_C_P(op)||ENTITY_MINUS_C_P(op)) {
608  expression lhs = binary_call_lhs(c);
609  expression rhs = binary_call_rhs(c);
610  basic blhs = basic_of_expression(lhs);
611  basic brhs = basic_of_expression(rhs);
612  if(!basic_pointer_p(blhs) && ! basic_pointer_p(brhs))
615  free_basic(blhs);
616  free_basic(brhs);
617  }
618 }
619 
620 /* replace PLUS_C_OPERATOR_NAME by PLUS_OPERATOR_NAME when relevant */
623 }
624 
625 /* perform constant string dereferencing evaluation */
627  if(expression_call_p(exp)) {
629  entity operator = call_function(c);
630  list args = call_arguments(c);
631  if(ENTITY_DEREFERENCING_P(operator)) {
632  expression arg = EXPRESSION(CAR(args));
634  char * string_constant = expression_string_constant(arg);
635  char buf[] = { '\'', *string_constant, '\'', 0 };
636  expression character_constant = MakeCharacterConstantExpression(strdup(buf));
637  update_expression_syntax(exp,expression_syntax(character_constant));
638  expression_syntax(character_constant)=syntax_undefined;
639  free(string_constant);
640  free_expression(character_constant);
641  }
642  }
643  }
644 }
645 
646 /* forward processing through declarations */
648  if(declaration_statement_p(st)) {
651  }
652 }
653 
654 /* transforms *"aer" into 'a'
655  * do not take care of "aer"[2] but could be extended to
656  */
660 
664  0
665  );
668  return true;
669 }
void free_normalized(normalized p)
Definition: ri.c:1407
basic make_basic_complex(intptr_t _field_)
Definition: ri.c:170
value make_value_unknown(void)
Definition: ri.c:2847
value make_value_expression(expression _field_)
Definition: ri.c:2850
sizeofexpression make_sizeofexpression_expression(expression _field_)
Definition: ri.c:2180
expression make_expression(syntax a1, normalized a2)
Definition: ri.c:886
syntax make_syntax_sizeofexpression(sizeofexpression _field_)
Definition: ri.c:2506
ram make_ram(entity a1, entity a2, intptr_t a3, list a4)
Definition: ri.c:1999
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
reference make_reference(entity a1, list a2)
Definition: ri.c:2083
bool statement_consistent_p(statement p)
Definition: ri.c:2195
basic make_basic_float(intptr_t _field_)
Definition: ri.c:161
dimension make_dimension(expression a1, expression a2, list a3)
Definition: ri.c:565
instruction make_instruction_sequence(sequence _field_)
Definition: ri.c:1169
void free_expression(expression p)
Definition: ri.c:853
void free_storage(storage p)
Definition: ri.c:2231
void free_syntax(syntax p)
Definition: ri.c:2445
void free_call(call p)
Definition: ri.c:236
void free_basic(basic p)
Definition: ri.c:107
storage make_storage_ram(ram _field_)
Definition: ri.c:2279
sequence make_sequence(list a)
Definition: ri.c:2125
void free_value(value p)
Definition: ri.c:2787
syntax make_syntax_reference(reference _field_)
Definition: ri.c:2494
struct _newgen_struct_expression_ * expression
Definition: alias_private.h:21
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
expression MakeCharacterConstantExpression(string s)
END_EOLE.
Definition: constant.c:573
expression MakeComplexConstantExpression(expression r, expression i)
Definition: constant.c:397
int dummy
A dummy file, to prevent empty libraries from breaking builds.
Definition: dummy.c:41
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
void cleanup_subscripts(void *)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
Definition: genC.h:285
#define gen_recurse(start, domain_number, flt, rwt)
Definition: genC.h:283
void gen_full_free_list(list l)
Definition: genClib.c:1023
void free(void *)
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
Definition: statement.c:597
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
const char * get_current_module_name(void)
Get the name of the current module.
Definition: static.c:121
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
statement get_current_module_statement(void)
Get the current module statement.
Definition: static.c:208
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
void gen_recurse_stop(void *obj)
Tells the recursion not to go in this object.
Definition: genClib.c:3251
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
Definition: genClib.c:3428
gen_chunk * gen_get_ancestor(int, const void *)
return the first ancestor object found of the given type.
Definition: genClib.c:3560
gen_chunk * gen_get_recurse_ancestor(const void *)
Get the first ancestor object encountered during the recursion for the given object.
Definition: genClib.c:3546
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
Definition: genClib.c:2758
bool gen_true2(__attribute__((unused)) gen_chunk *u1, __attribute__((unused)) void *u2)
Definition: genClib.c:2785
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
Definition: genClib.c:2752
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
Definition: genClib.c:2780
instruction make_call_instruction(entity e, list l)
Build an instruction that call a function entity with an argument list.
Definition: instruction.c:51
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
list gen_nreverse(list cp)
reverse a list in place
Definition: list.c:304
#define POP(l)
Modify a list pointer to point on the next element of the list.
Definition: newgen_list.h:59
#define NIL
The empty list (nil in Lisp)
Definition: newgen_list.h:47
size_t gen_length(const list l)
Definition: list.c:150
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
Definition: newgen_list.h:150
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
Definition: list.c:344
#define CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
void gen_free_list(list l)
free the spine of the list
Definition: list.c:327
#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
list gen_append(list l1, const list l2)
Definition: list.c:471
list gen_full_copy_list(list l)
Copy a list structure with element copy.
Definition: list.c:535
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 DB_PUT_MEMORY_RESOURCE(res_name, own_name, res_val)
conform to old interface.
Definition: pipsdbm-local.h:66
statement make_assign_statement(expression, expression)
Definition: statement.c:583
bool return_statement_p(statement)
Test if a statement is a C or Fortran "return".
Definition: statement.c:172
void insert_statement(statement, statement, bool)
This is the normal entry point.
Definition: statement.c:2570
bool declaration_statement_p(statement)
Had to be optimized according to Beatrice Creusillet.
Definition: statement.c:224
#define pips_user_warning
Definition: misc-local.h:146
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define DYNAMIC_AREA_LOCAL_NAME
Definition: naming-local.h:69
#define MEMBER_SEP_CHAR
Definition: naming-local.h:54
struct cons * list
Definition: newgen_types.h:106
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
Definition: properties.c:783
bool module_reorder(statement body)
Reorder a module and recompute order to statement if any.
Definition: reorder.c:244
#define make_expression_list(stats...)
#define binary_call_rhs(c)
#define ENTITY_FIVE_OPERATION_P(e)
#define MINUS_OPERATOR_NAME
#define ENTITY_DEREFERENCING_P(e)
#define POINT_TO_OPERATOR_NAME
Definition: ri-util-local.h:92
#define PLUS_OPERATOR_NAME
#define ENTITY_POINT_TO_P(e)
#define statement_block_p(stat)
#define INSTANCE_OF(type, value)
polymorhism thanks to newgen !
#define FIELD_OPERATOR_NAME
Definition: ri-util-local.h:91
#define DEFAULT_COMPLEX_TYPE_SIZE
#define MEMCPY_FUNCTION_NAME
include <string.h>
#define ENTITY_CABS_P(e)
#define entity_declarations(e)
MISC: newgen shorthands.
#define ENTITY_PLUS_C_P(e)
#define entity_variable_p(e)
An entity_variable_p(e) may hide a typedef and hence a functional type.
#define ENTITY_FIELD_P(e)
C data structure and pointer management.
#define SQRT_OPERATOR_NAME
#define ENTITY_MINUS_C_P(e)
#define binary_call_lhs(c)
#define UNARY_PLUS_OPERATOR_NAME
#define ENTITY_C_RETURN_P(e)
#define AIMAG_CONVERSION_NAME
#define ENTITY_ADDRESS_OF_P(e)
#define REAL_GENERIC_CONVERSION_NAME
#define module_functional_parameters(func)
#define MULTIPLY_OPERATOR_NAME
#define ENTITY_RETURN_P(e)
entity FindEntity(const char *package, const char *name)
Retrieve an entity from its package/module name and its local name.
Definition: entity.c:1503
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321
code entity_code(entity e)
Definition: entity.c:1098
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
basic entity_basic(entity e)
return the basic associated to entity e if it's a function/variable/constant basic_undefined otherwis...
Definition: entity.c:1380
static int init
Maximal value set for Fortran 77.
Definition: entity.c:320
entity CreateIntrinsic(string name)
this function does not create an intrinsic function because they must all be created beforehand by th...
Definition: entity.c:1311
entity entity_intrinsic(const char *name)
FI: I do not understand this function name (see next one!).
Definition: entity.c:1292
entity make_entity_copy_with_new_name(entity e, string global_new_name, bool move_initialization_p)
Create a copy of an entity, with (almost) identical type, storage and initial value if move_initializ...
Definition: entity.c:2463
expression reference_to_expression(reference r)
Definition: expression.c:196
bool expression_call_p(expression e)
Definition: expression.c:415
expression float_to_expression(float c)
Definition: expression.c:1229
expression entity_to_expression(entity e)
if v is a constant, returns a constant call.
Definition: expression.c:165
bool expression_string_constant_p(expression exp)
Definition: expression.c:2398
expression MakeBinaryCall(entity f, expression eg, expression ed)
Creates a call expression to a function with 2 arguments.
Definition: expression.c:354
call expression_call(expression e)
Definition: expression.c:445
void update_expression_syntax(expression e, syntax s)
frees expression syntax of e and replace it by the new syntax s
Definition: expression.c:3564
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 MakeUnaryCall(entity f, expression a)
Creates a call expression to a function with one argument.
Definition: expression.c:342
bool expression_reference_p(expression e)
Test if an expression is a reference.
Definition: expression.c:528
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
Definition: expression.c:1832
char * expression_string_constant(expression exp)
returns a newly allocated string!
Definition: expression.c:2409
basic basic_of_expression(expression)
basic basic_of_expression(expression exp): Makes a basic of the same basic as the expression "exp".
Definition: type.c:1383
type ultimate_type(type)
Definition: type.c:3466
void AddLocalEntityToDeclarations(entity, entity, statement)
Add the variable entity e to the list of variables of the function module.
Definition: variable.c:233
bool entity_scalar_p(entity)
The concrete type of e is a scalar type.
Definition: variable.c:1113
entity make_new_scalar_variable(entity, basic)
Definition: variable.c:741
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
Definition: variable.c:260
bool formal_parameter_p(entity)
Definition: variable.c:1489
entity make_new_scalar_variable_with_prefix(const char *, entity, basic)
Create a new scalar variable of type b in the given module.
Definition: variable.c:592
int add_variable_to_area(entity, entity)
Definition: variable.c:1376
bool type_struct_variable_p(type)
Definition: type.c:3867
bool type_pointer_on_struct_variable_p(type)
Definition: type.c:2960
#define dummy_identifier(x)
Definition: ri.h:1033
#define type_struct(x)
Definition: ri.h:2964
#define basic_pointer(x)
Definition: ri.h:637
#define normalized_undefined
Definition: ri.h:1745
#define expression_domain
newgen_execution_domain_defined
Definition: ri.h:154
#define parameter_dummy(x)
Definition: ri.h:1823
#define basic_complex_p(x)
Definition: ri.h:626
#define syntax_reference(x)
Definition: ri.h:2730
#define syntax_tag(x)
Definition: ri.h:2727
#define reference_undefined
Definition: ri.h:2302
#define call_function(x)
Definition: ri.h:709
#define reference_variable(x)
Definition: ri.h:2326
#define basic_derived(x)
Definition: ri.h:640
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define subscript_domain
newgen_storage_domain_defined
Definition: ri.h:378
#define type_variable(x)
Definition: ri.h:2949
#define basic_pointer_p(x)
Definition: ri.h:635
#define entity_storage(x)
Definition: ri.h:2794
#define statement_domain
newgen_sizeofexpression_domain_defined
Definition: ri.h:362
#define code_declarations(x)
Definition: ri.h:784
@ is_syntax_reference
Definition: ri.h:2691
#define call_domain
newgen_callees_domain_defined
Definition: ri.h:58
#define basic_overloaded_p(x)
Definition: ri.h:623
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define subscript_indices(x)
Definition: ri.h:2563
#define entity_undefined
Definition: ri.h:2761
#define expression_undefined
Definition: ri.h:1223
#define entity_name(x)
Definition: ri.h:2790
#define expression_normalized(x)
Definition: ri.h:1249
struct _newgen_struct_syntax_ * syntax
Definition: ri.h:407
#define PARAMETER(x)
PARAMETER.
Definition: ri.h:1788
#define reference_indices(x)
Definition: ri.h:2328
#define value_code(x)
Definition: ri.h:3067
#define instruction_call_p(x)
Definition: ri.h:1527
#define instruction_expression(x)
Definition: ri.h:1541
#define expression_undefined_p(x)
Definition: ri.h:1224
#define subscript_array(x)
Definition: ri.h:2561
#define variable_dimensions(x)
Definition: ri.h:3122
#define code_decls_text(x)
Definition: ri.h:786
#define statement_declarations(x)
Definition: ri.h:2460
#define statement_instruction(x)
Definition: ri.h:2458
#define syntax_undefined
Definition: ri.h:2676
#define instruction_call(x)
Definition: ri.h:1529
#define basic_complex(x)
Definition: ri.h:628
#define call_arguments(x)
Definition: ri.h:711
#define entity_type(x)
Definition: ri.h:2792
#define value_expression_p(x)
Definition: ri.h:3080
#define expression_syntax(x)
Definition: ri.h:1247
#define dummy_identifier_p(x)
Definition: ri.h:1031
#define value_expression(x)
Definition: ri.h:3082
#define variable_basic(x)
Definition: ri.h:3120
#define STATEMENT(x)
STATEMENT.
Definition: ri.h:2413
#define entity_initial(x)
Definition: ri.h:2796
Value b1
booleen indiquant quel membre est en cours d'analyse
Definition: sc_gram.c:105
char * strdup()
static void reset_translation_mode()
Definition: simplify.c:429
static void do_split_structure_return_hook_walker(statement s, dssrhp *p)
Definition: simplify.c:215
static list do_split_structure(entity e, statement s)
Definition: simplify.c:256
static void do_simplify_constant_address_expression(expression exp)
perform constant string dereferencing evaluation
Definition: simplify.c:626
static void simplify_complex_entity(entity c)
adds a dimension to all entity whose basic is complex , and change their basic to float
Definition: simplify.c:433
bool simplify_constant_address_expressions(const char *module_name)
transforms *"aer" into 'a' do not take care of "aer"[2] but could be extended to
Definition: simplify.c:657
bool simplify_complex(const char *module_name)
split complexes into an array with first element <> real part and second element <> imaginary part
Definition: simplify.c:578
static void do_simplify_subscripts(statement s)
Definition: simplify.c:57
static void replace_field_by_reference_walker(call c, rfr_param *p)
Definition: simplify.c:132
static void entity_used_in_calls_walker(call c, entity_used_in_calls_p *p)
Definition: simplify.c:94
static void do_simplify_constant_address_expression_in_decl(statement st)
forward processing through declarations
Definition: simplify.c:647
static instruction make_fields_assignment_instruction(entity var, list fields, list new_vars)
Definition: simplify.c:174
static void set_translation_mode()
Definition: simplify.c:422
static entity THE_I
Definition: simplify.c:399
bool split_structures(const char *module_name)
Definition: simplify.c:365
static void(* complex_translation)(list *, list)
Definition: simplify.c:411
static bool has_address_of_operator_p(expression exp)
look for an & in the expression
Definition: simplify.c:24
static void reset_the_i()
Definition: simplify.c:407
bool simplify_subscripts(const char *module_name)
atomize subscript expressions so that thay can be reprsetned as references
Definition: simplify.c:64
static void do_split_structure_return_hook(entity var, list fields, list new_vars)
Definition: simplify.c:239
expression make_float_constant_expression(float)
static void simplify_complex_statements(statement s)
Definition: simplify.c:571
static void do_split_structures(statement s)
Definition: simplify.c:339
void complex_translation_array_of_structs(list *pl, list l)
Definition: simplify.c:412
static bool simplify_complex_expression(expression e)
Definition: simplify.c:489
static bool has_address_of_operator_walker_p(call c, bool *panswer)
Definition: simplify.c:18
static bool entity_used_in_calls(entity e)
Definition: simplify.c:118
static void do_simplify_c_operator(call c)
Definition: simplify.c:604
static void simplify_subscript(subscript ss)
the walker
Definition: simplify.c:32
void complex_translation_struct_of_array(list *pl, list l)
Definition: simplify.c:416
static void do_split_structure_parameter(entity e)
Definition: simplify.c:357
void simplify_c_operator(statement s)
replace PLUS_C_OPERATOR_NAME by PLUS_OPERATOR_NAME when relevant
Definition: simplify.c:621
static expression split_complex_expression(expression e)
Definition: simplify.c:467
static void simplify_complex_declaration(entity e)
Definition: simplify.c:451
static void replace_field_by_reference(entity structure, entity field, entity new)
Definition: simplify.c:161
static void set_the_i()
Definition: simplify.c:400
static char buf[BSZ]
Definition: split_file.c:157
#define intptr_t
Definition: stdint.in.h:294
The structure used to build lists in NewGen.
Definition: newgen_list.h:41
list fields
Definition: simplify.c:169
entity var
Definition: simplify.c:168
list new_vars
Definition: simplify.c:170
entity field
Definition: simplify.c:127
entity structure
Definition: simplify.c:126
entity new
Definition: simplify.c:128
A gen_chunk is used to store every object.
Definition: genC.h:58
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207