PIPS
size.c
Go to the documentation of this file.
1 /*
2 
3  $Id: size.c 23412 2017-08-09 15:07:09Z irigoin $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of PIPS.
8 
9  PIPS is free software: you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 /* Functions to compute the numer of bytes required to store a
25  variable or an object of a given type in memory; used by memory
26  allocation functions in parsers, when allocation is possible
27  (STATIC and DYNAMIC). If the size is unknown, the variable is
28  allocated in the STACK area. See ri.pdf, section about "area". */
29 #ifdef HAVE_CONFIG_H
30  #include "pips_config.h"
31 #endif
32 #include <stdio.h>
33 #include <string.h>
34 #include <ctype.h>
35 
36 #include "linear.h"
37 
38 #include "genC.h"
39 #include "ri.h"
40 
41 #include "ri-util.h"
42 #include "misc.h"
43 
45 {
46  int niv = 0;
47  list carg = list_undefined;
48 
49  for(carg=args; !ENDP(carg); POP(carg)) {
50  expression e = EXPRESSION(CAR(carg));
51 
52  if(expression_call_p(e)) {
54  entity f = call_function(c);
55  list sargs = call_arguments(c);
56 
58  niv += number_of_initial_values(sargs);
59  }
60  else
61  niv++;
62  }
63  else
64  niv++;
65  }
66 
67  return niv;
68 }
69 
70 /* This function computes the total size of a variable in bytes,
71 ie. the product of the number of elements and the size of each element
72 in byte, when this size is a constant.
73 
74 Arrays cannot be sized by a variable according to Fortran 77 standard,
75 unless they are formal parameters (see SafeSizeOfArray). This
76 restriction is lifted for arrays allocated in the area *STACK*.
77 
78 Arrays can be sized by expressions according to C latest standard (see
79 Validation/C_syntax/array_declarators.c). Then their sizes are not
80 available at compile time and their addresses in stack cannot be
81 computed at compiler time (see CSafeSizeOfArray).
82 
83 Since the size is returned in a signed int, there is a maximum PIPS
84 size for an array.
85 */
86 
87 bool SizeOfArray(entity e, int * s)
88 {
89  type et = entity_type(e);
90  type uet = ultimate_type(et);
91  variable a, ua;
92  bool ok = true;
93  int se = -1;
94  int ne = -1;
95  int mne = -1;
96 
98  a = type_variable(et);
99  ua = type_variable(uet);
100 
101  se = SizeOfElements(variable_basic(ua));
102 
104 
105  if(!ok) {
106  /* Let's try to use the initial value */
107  value ev = entity_initial(e);
108  if(!value_undefined_p(ev)) {
109  if(value_expression_p(ev)) {
110  expression eve = value_expression(ev);
111  //type evet = expression_to_type(eve);
112  basic eveb = basic_of_expression(eve); /* FI: should eveb be freed? */
113 
114  /* Is it an array of characters initialized with a string expression? */
115  if(char_type_p(et) && !basic_undefined_p(eveb) && basic_string_p(eveb)) {
116  ne = string_type_size(eveb);
117  ok = true;
118  }
119  else if(expression_call_p(eve)) {
120  call evec = syntax_call(expression_syntax(eve));
121  entity f = call_function(evec);
122  list args = call_arguments(evec);
123 
124  /* Is it a call to the BRACE_INTRINSIC operator? */
126  /* This is too simple unfortunately: OK, but why? which
127  test case? */
128  /* ne = gen_length(args); */
129  int ni = number_of_initial_values(args);
130  //int nf = number_of_fields(et);
131  int nf = 1;
132 
133  if(type_variable_p(uet)) {
134  variable ev = type_variable(uet);
135  basic eb = variable_basic(ev);
136  if(basic_derived_p(eb)) {
137  entity de = basic_derived(eb);
138  nf = number_of_items(entity_type(de));
139  }
140  }
141  ne = ni/nf;
142  if (nf*ne!=ni) {
143  /* Should be a call to CParserError()... */
144  //pips_user_error("Number of initialization values (%d) incompatible"
145  // " with number of type fields (%d)\n", ni, nf);
146  // let's assume the source code is correct...
147  ne = gen_length(args);
148  }
149  ok = true;
150  }
151  /* Check for other dimensions which must be all declared: the
152  first dimension only can be implicit */
153  /* Already taken care of by "ni" */
154  /*
155  if(ok && gen_length(variable_dimensions(a))>1) {
156  bool sok = false;
157  int sne = -1;
158  sok = NumberOfElements(variable_basic(a), CDR(variable_dimensions(a)), &sne);
159  if(sok) {
160  ne *= sne;
161  }
162  else {
163  ok = false;
164  }
165  }
166  */
167  }
168  }
169  else if(value_constant_p(ev)) {
170  pips_internal_error("Not implemented yet");
171  }
172  }
173  }
174 
175  /* Check for 32 bit signed overflows */
176  mne = se>0 ? INT_MAX/se : INT_MAX;
177 
178  if(ok) {
179  if(mne>=ne)
180  *s = ne*se;
181  else {
182  pips_user_warning("Array size incompatible with 32 bit signed integers\n"
183  "Maximum number of elements: %d, number of elements declared: %d\n",
184  mne, ne);
185  ok = false;
186  }
187  }
188  else {
189  *s = se;
190  }
191 
192  return ok;
193 }
194 
196 {
197  int s = 0;
198 
199  if(!SizeOfArray(a, &s)) {
200  pips_internal_error("Array \"%s\" with illegal varying array size",
201  entity_name(a));
202  }
203  return s;
204 }
205 
207 {
208  variable a;
209  Value longueur, taille_elt;
210 
212  a = type_variable(entity_type(e));
213 
214  taille_elt = (Value) SizeOfElements(variable_basic(a));
216 
217  return(value_mult(taille_elt,longueur));
218 }
219 
220 
221 /* BEGIN_EOLE */ /* - please do not remove this line */
222 /* Lines between BEGIN_EOLE and END_EOLE tags are automatically included
223  in the EOLE project (JZ - 11/98) */
224 
226 {
227  int s;
228 
229  if(!SizeOfArray(a, &s)) {
230  pips_user_warning("Varying size for array \"%s\"\n", entity_name(a));
231  /* should be a pips_user_error() to avoid useless and dangerous
232  results */
233  pips_user_warning("Not yet supported properly by PIPS\n");
234  }
235 
236  return s;
237 }
238 
240 {
241  /* dt is assumed to be a derived type: struct, union, and maybe enum */
242  type t = ultimate_type(entity_type(dt));
243  int s = type_memory_size(t);
244 
245  return s;
246 }
247 
249 {
250  int s = 0;
251 
252  switch(type_tag(t)) {
253  case is_type_statement:
254  case is_type_area:
255  case is_type_functional:
256  case is_type_varargs:
257  case is_type_unknown:
258  case is_type_void:
259  pips_internal_error("arg. with ill. tag %d", type_tag(t));
260  break;
261  case is_type_variable:
262  {
263  /* Seems to be the case for defined types; FI: why are they
264  allocated in RAM while they only exist at compile time ? */
267  s*=dimension_size(dim);
268 
269  } break;
270  case is_type_struct:
271  MAP(ENTITY, v, {s+=CSafeSizeOfArray(v);}, type_struct(t));
272  break;
273  case is_type_union:
274  MAP(ENTITY, v, {s = s>CSafeSizeOfArray(v)? s : CSafeSizeOfArray(v);}, type_union(t));
275  break;
276  case is_type_enum:
277  s = 4; /* How is it implemented? 32 bit integer? */
278  break;
279  default:
280  pips_internal_error("arg. with unknown tag %d", type_tag(t));
281  break;
282  }
283  /* A struct (or a union) may be hidden, with its declaration
284  located in the source code of a library. For instance,
285  "_IO_FILE_plus" in stdio.h. Since it contains at least one byte,
286  let set s to 1? Or let the caller deal with the problem? */
287  // s = s>0? s : 1;
288  return s;
289 }
290 
291 /* This function returns the length in bytes of the Fortran or C type
292  represented by a basic, except for a varying size string (formal
293  parameter).
294 
295  What is the semantics for bitfields? Return its size rounded to a byte
296  number large enough to fit, and not the size in bit. */
298 {
299  int e = -1;
300 
301  switch (basic_tag(b)) {
302  case is_basic_int:
303  {
304  /* Some of these values are target architecture dependent:
305  e == 1 character
306  e == 2 short int
307  e == 4 int
308  e == 6 long int
309  e == 8 long long int
310  They are defined in ri-util-local.h
311  To be consistent with the machine compiling and executing
312  PIPS, we could use a switch(e) and the corresponding sizeof().
313  */
314 
315  e = basic_int(b);
316  e = e % 10;
319  break;
320  }
321  case is_basic_float:
322  e = basic_float(b);
323  break;
324  case is_basic_logical:
325  e = basic_logical(b);
326  break;
327  case is_basic_complex:
328  e = basic_complex(b);
329  /* As for int, e encodes some fine typing information: remove it */
330  e = (e/8)*8;
331  break;
332  case is_basic_string: {
334 
335  /* pips_assert("SizeOfElements", gen_consistent_p(b)); */
336 
339  else if(value_symbolic_p(basic_string(b)))
341  else
342  user_error("SizeOfElements",
343  "Sizing of character variable by illegal value (tag=%d)",
344  basic_tag(b));
345 
346  if(constant_int_p(c))
347  e = constant_int(c);
348  else
349  user_error("SizeOfElements",
350  "Sizing of character variable by non-integer constant");
351  break;
352  }
353  case is_basic_bit: {
355  if(constant_int_p(c))
356  // Get the size in bits:
357  e = constant_int(c);
358  else
359  user_error("SizeOfElements",
360  "Sizing of bit-field is non-integer constant");
361  // Round the size to full byte number:
362  e = (e + 7)/8;
363  }
364  break;
365  case is_basic_pointer:
367  break;
368  case is_basic_derived:
370  break;
371  case is_basic_typedef:
373  break;
374  default:
375  pips_internal_error("Ill. tag %d for basic", basic_tag(b));
376  }
377 
378  /* Size can be zero, i.e. unknown, for an external variable */
379  //pips_assert("e is not zero", e!=0);
380 
381  return e;
382 }
383 
384 /* END_EOLE */
385 
386 
387 /* this function computes the number of elements of a variable. ld is the
388 list of dimensions of the variable */
389 
390 int
392 {
393  int en = 0;
394 
395  if(!NumberOfElements(b, ld, &en)) {
396  pips_internal_error("Probably varying size array");
397  }
398 
399  return en;
400 }
401 
402 bool
403 NumberOfElements(basic b, list ld, int * n)
404 {
405  list pc;
406  int ne = 1;
407  bool ok = true;
408  int sne = 1;
409 
410  /* do we have many elements at the lower typedef levels? */
411  if(basic_typedef_p(b)) {
412  entity e = basic_typedef(b);
413  // Lots of asserts skipped here
415 
417  }
418 
419  /* let's take care of the current level */
420  if(ok) {
421  for (pc = ld; pc != NULL && ok; pc = CDR(pc)) {
423  intptr_t s;
425  free_expression(sod);
426  ne *= s;
427  }
428  }
429 
430  *n = ne*sne;
431  return ok;
432 }
433 
434 Value
436 {
437  list pc;
438  Value ne = VALUE_ONE;
439 
440  for (pc = ld; pc != NULL; pc = CDR(pc)) {
442  }
443 
444  return(ne);
445 }
446 
447 
448 
449 /* this function returns the size of the ith dimension of a variable e. if
450 called for the 0th dimension, it returns the variable element size. */
451 
452 int
454 {
455  list pc = NIL;
456  intptr_t s = 0;
457 
458  if (!type_variable_p(entity_type(e))) {
459  fprintf(stderr, "[SizeOfIthDimension] not a variable\n");
460  abort();
461  }
462 
463  if (i == 0)
465 
467 
468  while (pc != NULL && --i > 0)
469  pc = CDR(pc);
470 
471  if (pc == NULL) {
472  fprintf(stderr, "[SizeOfIthDimension] not enough dimensions\n");
473  abort();
474  }
475 
477  if(!(expression_integer_value(sod, &s))) {
478  fprintf(stderr, "[SizeOfIthDimension] Non constant %dth dimension\n", i);
479  abort();
480  }
481  free_expression(sod);
482 
483  return s;
484 }
485 
486 
487 
488 /* this function computes the size of a dimension. */
489 
490 int
492 {
493  expression sod= SizeOfDimension(d);
494  intptr_t i;
495  if(expression_integer_value(sod,&i))
496  free_expression(sod);
497  else
498  pips_internal_error("dimension is not constant, use SizeOfDimension instead");
499  return i;
500 }
501 
504 {
505  return
509  )
510  ;
511 }
512 
513 static void *do_sizeofdimension_reduction(void *v, const list l)
514 {
516  (expression)v,
518 }
519 
520 /** computes the product of all dimensions in @p dims*/
523 {
525 }
526 
527 
528 /* FI: I do not understand the "Value" cast */
529 
530 Value
532 {
533  Value dl, du;
534  intptr_t l = 0 ;
535  intptr_t u = 0;
536  bool ok;
537 
539  du = (Value) u;
541  dl = (Value) l;
542 
543  if(!ok) {
544  fprintf(stderr, "[ValueSizeOfIthDimension] Non constant dimension\n");
545  abort();
546  }
547 
548  return(value_plus(value_minus(du,dl), VALUE_ONE));
549 }
550 
551 
552 
553 
554 /* this function computes the value of an integer constant expression
555  * and returns it to the calling function. it aborts if the expression is
556  * not constant.
557  *
558  * See expression_integer_value() to check before aborting
559  */
560 
561 int
563 {
564  value v;
565  constant c;
566  int i = -1;
567 
568  v = EvalExpression(e);
569 
570  if (value_constant_p(v)) {
571  c = value_constant(v);
572  if (constant_int_p(c)) {
573  i = constant_int(c);
574  }
575  else {
576  pips_internal_error("integer constant expected");
577  }
578  }
579  else {
580  pips_internal_error("constant expected\n");
581  }
582 
583  free_value(v);
584  return i;
585 }
586 
587 // FI: should be at least NumberOfDimensions, with an s
589 {
590  type t = entity_type(e);
591  int nd;
592  cons *pc;
593 
595 
597  nd = 0;
598 
599  while (! ENDP(pc)) {
600  nd += 1;
601  pc = CDR(pc);
602  }
603 
604  return(nd);
605 }
606 
607 
608 /* a hash table to map entities to their numbers of elements
609  *
610  * This table is critical to compute use-def chains at an acceptable
611  * speed because the computation of a variable allocated space
612  * is very slow. Declaration are preserved in PIPS and constant
613  * expressions must be evaluated.
614  *
615  * Note: the current implementation is not safe. The hash table
616  * may be kept from module to module (which should be OK) and
617  * from workspace to workspace, which is not.
618  *
619  * This is an unusual object because it's life time is the
620  * workspace life time and not the module analysis life time.
621  * This hash table acts as a cache of the symbol table.
622  */
624 
626 {
628  pips_internal_error("hash table should have been deallocated");
629  /* hash_table_clear(entity_to_size); */
630  }
631 
633 }
634 
636 {
638  pips_internal_error("hash table should have been allocated");
639  }
640  else {
643  }
644 }
645 
646 /* In case of error handling, PIPS may try to reset this table twice */
648 {
652  }
653 }
654 
655 int
657 {
658  /* Storage size is expressed in bytes */
659  int l;
660  char * s;
661 
663  user_warning("storage_space_of_variable",
664  "hash table should have been allocated\n");
666  }
667  s = hash_get(entity_to_size, (char *) v);
668  l = (_int) s;
669  if (s == HASH_UNDEFINED_VALUE) {
670  if(!SizeOfArray(v, &l)) {
671  fprintf(stderr, "[storage_space_of_variable] Non constant array size\n");
672  abort();
673  }
674  hash_put(entity_to_size, (char *) v, (char *) (_int) l);
675  }
676 
677  return l;
678 }
679 
680 #define INTERVAL_INTERSECTION(a,b,c,d) (!((b) <= (c) || (d) <= (a)))
681 
682 /*
683  this function returns true if e1 and e2 MAY have some memory locations
684  in common
685 
686  This function used to be called entities_may_conflict_p() but abstract
687  locations are new entities which require a generalization.
688 */
690 {
691  bool intersect_p = false;
692  storage s1, s2;
693  ram r1 = ram_undefined, r2 = ram_undefined;
694  int o1, o2, l1, l2;
695  entity f1, f2, a1, a2;
696 
697  if(same_entity_p(e1, e2)) return true;
698 
699  s1 = entity_storage(e1);
700  s2 = entity_storage(e2);
701 
702  if (! (storage_ram_p(s1) && storage_ram_p(s2))) {
703  // Conflicts may exist beween array elements when an array is
704  // a formal parameter
705  if( ! (storage_formal_p(s1) && storage_formal_p(s2)) ) {
706  return false;
707  }
708  else {
709  formal f1 = storage_formal(s1);
710  formal f2 = storage_formal(s2);
711  entity e1 = formal_function(f1);
712  entity e2 = formal_function(f2);
713  if(e1==e2) {
714  int o1 = formal_offset(f1);
715  int o2 = formal_offset(f2);
716  return o1==o2;
717  }
718  return false;
719  }
720  }
721 
722  r1 = storage_ram(s1);
723  r2 = storage_ram(s2);
724 
725  a1 = ram_section(r1);
726  a2 = ram_section(r2);
727 
728  if(a1!=a2) return false;
729 
730  /* Can we have and check static aliasing in a1? */
731  if(stack_area_p(a1))
732  return false;
733 
734  if(heap_area_p(a1))
735  return false;
736 
737  // FI: we create aliasing in C between an array and its elements
738  // This is used to analyse the value of array elements
739  if (false && c_module_p(get_current_module_entity()))
740  return false;
741 
742  /* Let's assume we are dealing with Fortran code, but another test
743  should be added about the current module language. No test on
744  dynamic aliasing since we are dealing here with direct read and
745  write effects. */
746  o1 = ram_offset(r1);
747  o2 = ram_offset(r2);
748 
749  if(o1==o2) return true;
750 
751  f1 = ram_function(r1);
752  f2 = ram_function(r2);
753 
754  if(f1==f2 && (ENDP(ram_shared(r1)) || ENDP(ram_shared(r2))))
755  return false;
756 
757  l1 = storage_space_of_variable(e1);
758  l1 = l1+o1-1;
759 
760 
761  l2 = storage_space_of_variable(e2);
762  l2 = l2+o2-1;
763 
764  /* return(r1 != ram_undefined && r2 != ram_undefined &&
765  f1 == f2 && a1 == a2 &&
766  INTERVAL_INTERSECTION(o1, l1, o2, l2)); */
767 
768  /* FI: it's too late to check if r1 and r2 are defined:
769  * you already have core dumped!
770  * also, f1 and f2 are not relevant since location are governed
771  * by area a1 and a2
772  */
773 
774  intersect_p = ( a1 == a2 && INTERVAL_INTERSECTION(o1, l1, o2, l2));
775 
776  return intersect_p;
777 }
778 
expression copy_expression(expression p)
EXPRESSION.
Definition: ri.c:850
void free_expression(expression p)
Definition: ri.c:853
void free_value(value p)
Definition: ri.c:2787
#define value_minus(v1, v2)
int Value
#define value_plus(v1, v2)
binary operators on values
#define VALUE_ONE
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...
entity get_current_module_entity(void)
Get the entity of the current module.
Definition: static.c:85
#define ENDP(l)
Test if a list is empty.
Definition: newgen_list.h:66
#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 CAR(pcons)
Get the value of the first element of a list.
Definition: newgen_list.h:92
#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 CDR(pcons)
Get the list less its first element.
Definition: newgen_list.h:111
void * gen_reduce(void *r, void *(*fp)(void *, const list), const list l)
Definition: list.c:180
#define list_undefined
Undefined list definition :-)
Definition: newgen_list.h:69
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
Definition: newgen_list.h:226
hash_table hash_table_make(hash_key_type key_type, size_t size)
Definition: hash.c:294
void * hash_get(const hash_table htp, const void *key)
this function retrieves in the hash table pointed to by htp the couple whose key is equal to key.
Definition: hash.c:449
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
void hash_table_free(hash_table htp)
this function deletes a hash table that is no longer useful.
Definition: hash.c:327
#define pips_user_warning
Definition: misc-local.h:146
#define pips_internal_error
Definition: misc-local.h:149
#define user_error(fn,...)
Definition: misc-local.h:265
#define user_warning(fn,...)
Definition: misc-local.h:262
#define abort()
Definition: misc-local.h:53
#define assert(ex)
Definition: newgen_assert.h:41
@ hash_pointer
Definition: newgen_hash.h:32
#define HASH_UNDEFINED_VALUE
value returned by hash_get() when the key is not found; could also be called HASH_KEY_NOT_FOUND,...
Definition: newgen_hash.h:56
#define hash_table_undefined
Value of an undefined hash_table.
Definition: newgen_hash.h:49
intptr_t _int
_INT
Definition: newgen_types.h:53
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
int f2(int off1, int off2, int w, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:1
#define MINUS_OPERATOR_NAME
#define PLUS_OPERATOR_NAME
#define DEFAULT_INTEGER_TYPE_SIZE
#define ENTITY_BRACE_INTRINSIC_P(e)
C initialization expression.
#define DEFAULT_LONG_INTEGER_TYPE_SIZE
#define DEFAULT_POINTER_TYPE_SIZE
#define MULTIPLY_OPERATOR_NAME
bool stack_area_p(entity aire)
Definition: area.c:104
bool heap_area_p(entity aire)
Definition: area.c:86
bool same_entity_p(entity e1, entity e2)
predicates on entities
Definition: entity.c:1321
bool c_module_p(entity m)
Test if a module "m" is written in C.
Definition: entity.c:2777
value EvalExpression(expression e)
Evaluate statically an expression.
Definition: eval.c:108
bool expression_integer_value(expression e, intptr_t *pval)
Definition: eval.c:792
bool expression_call_p(expression e)
Definition: expression.c:415
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
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
int number_of_items(type)
Same as above, but arrays in struct are taken into account.
Definition: type.c:3925
int string_type_size(basic)
Definition: type.c:1047
bool char_type_p(type)
return true whether ‘t’ is a char or an unsigned char
Definition: type.c:2877
#define formal_offset(x)
Definition: ri.h:1408
#define value_undefined_p(x)
Definition: ri.h:3017
@ is_basic_derived
Definition: ri.h:579
@ is_basic_string
Definition: ri.h:576
@ is_basic_float
Definition: ri.h:572
@ is_basic_bit
Definition: ri.h:577
@ is_basic_pointer
Definition: ri.h:578
@ is_basic_int
Definition: ri.h:571
@ is_basic_logical
Definition: ri.h:573
@ is_basic_typedef
Definition: ri.h:580
@ is_basic_complex
Definition: ri.h:575
#define type_struct(x)
Definition: ri.h:2964
#define storage_formal_p(x)
Definition: ri.h:2522
#define value_constant(x)
Definition: ri.h:3073
#define call_function(x)
Definition: ri.h:709
#define basic_derived(x)
Definition: ri.h:640
#define basic_typedef_p(x)
Definition: ri.h:641
#define basic_int(x)
Definition: ri.h:616
#define type_tag(x)
Definition: ri.h:2940
#define ENTITY(x)
ENTITY.
Definition: ri.h:2755
#define symbolic_constant(x)
Definition: ri.h:2599
#define constant_int(x)
Definition: ri.h:850
#define ram_undefined
Definition: ri.h:2221
#define dimension_lower(x)
Definition: ri.h:980
#define basic_tag(x)
Definition: ri.h:613
#define type_variable(x)
Definition: ri.h:2949
#define basic_derived_p(x)
Definition: ri.h:638
#define entity_storage(x)
Definition: ri.h:2794
#define storage_ram_p(x)
Definition: ri.h:2519
#define value_constant_p(x)
Definition: ri.h:3071
#define ram_section(x)
Definition: ri.h:2249
#define storage_formal(x)
Definition: ri.h:2524
#define value_symbolic(x)
Definition: ri.h:3070
#define basic_undefined_p(x)
Definition: ri.h:557
#define EXPRESSION(x)
EXPRESSION.
Definition: ri.h:1217
#define basic_typedef(x)
Definition: ri.h:643
#define constant_int_p(x)
Definition: ri.h:848
#define basic_logical(x)
Definition: ri.h:622
#define value_symbolic_p(x)
Definition: ri.h:3068
#define entity_name(x)
Definition: ri.h:2790
#define formal_function(x)
Definition: ri.h:1406
#define dimension_upper(x)
Definition: ri.h:982
#define syntax_call(x)
Definition: ri.h:2736
#define basic_float(x)
Definition: ri.h:619
#define basic_bit(x)
Definition: ri.h:634
#define variable_dimensions(x)
Definition: ri.h:3122
#define storage_ram(x)
Definition: ri.h:2521
#define basic_complex(x)
Definition: ri.h:628
#define ram_function(x)
Definition: ri.h:2247
#define call_arguments(x)
Definition: ri.h:711
@ is_type_varargs
Definition: ri.h:2902
@ is_type_void
Definition: ri.h:2904
@ is_type_enum
Definition: ri.h:2907
@ is_type_statement
Definition: ri.h:2898
@ is_type_functional
Definition: ri.h:2901
@ is_type_variable
Definition: ri.h:2900
@ is_type_union
Definition: ri.h:2906
@ is_type_area
Definition: ri.h:2899
@ is_type_unknown
Definition: ri.h:2903
@ is_type_struct
Definition: ri.h:2905
#define basic_string_p(x)
Definition: ri.h:629
#define entity_type(x)
Definition: ri.h:2792
#define ram_shared(x)
Definition: ri.h:2253
#define value_expression_p(x)
Definition: ri.h:3080
#define expression_syntax(x)
Definition: ri.h:1247
#define type_variable_p(x)
Definition: ri.h:2947
#define value_expression(x)
Definition: ri.h:3082
#define constant_undefined
Definition: ri.h:802
#define type_union(x)
Definition: ri.h:2967
#define variable_basic(x)
Definition: ri.h:3120
#define basic_string(x)
Definition: ri.h:631
#define ram_offset(x)
Definition: ri.h:2251
#define entity_initial(x)
Definition: ri.h:2796
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
s1
Definition: set.c:247
void safe_reset_entity_to_size()
In case of error handling, PIPS may try to reset this table twice.
Definition: size.c:647
_int SizeOfElements(basic b)
This function returns the length in bytes of the Fortran or C type represented by a basic,...
Definition: size.c:297
int storage_space_of_variable(entity v)
Definition: size.c:656
static hash_table entity_to_size
a hash table to map entities to their numbers of elements
Definition: size.c:623
Value ValueSizeOfDimension(dimension d)
FI: I do not understand the "Value" cast.
Definition: size.c:531
#define INTERVAL_INTERSECTION(a, b, c, d)
Definition: size.c:680
expression SizeOfDimension(dimension d)
Definition: size.c:503
int element_number(basic b, list ld)
END_EOLE.
Definition: size.c:391
int number_of_initial_values(list args)
Functions to compute the numer of bytes required to store a variable or an object of a given type in ...
Definition: size.c:44
int ExpressionToInt(expression e)
this function computes the value of an integer constant expression and returns it to the calling func...
Definition: size.c:562
expression SizeOfDimensions(list dims)
computes the product of all dimensions in dims
Definition: size.c:522
static void * do_sizeofdimension_reduction(void *v, const list l)
Definition: size.c:513
int entity_memory_size(entity dt)
Definition: size.c:239
bool NumberOfElements(basic b, list ld, int *n)
Definition: size.c:403
int CSafeSizeOfArray(entity a)
BEGIN_EOLE.
Definition: size.c:225
bool variable_entities_may_conflict_p(entity e1, entity e2)
Definition: size.c:689
void set_entity_to_size()
Definition: size.c:625
int NumberOfDimension(entity e)
Definition: size.c:588
void reset_entity_to_size()
Definition: size.c:635
int array_size(entity a)
Definition: size.c:195
bool SizeOfArray(entity e, int *s)
This function computes the total size of a variable in bytes, ie.
Definition: size.c:87
Value ValueSizeOfArray(entity e)
Definition: size.c:206
Value ValueNumberOfElements(list ld)
Definition: size.c:435
int dimension_size(dimension d)
this function computes the size of a dimension.
Definition: size.c:491
int type_memory_size(type t)
Definition: size.c:248
int SizeOfIthDimension(entity e, int i)
this function returns the size of the ith dimension of a variable e.
Definition: size.c:453
static bool ok
#define intptr_t
Definition: stdint.in.h:294
The structure used to build lists in NewGen.
Definition: newgen_list.h:41