PIPS
varwidth.c
Go to the documentation of this file.
1 /*
2 
3  $Id: varwidth.c 23495 2018-10-24 09:19:47Z coelho $
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 #ifdef HAVE_CONFIG_H
25  #include "pips_config.h"
26 #endif
27 #include "stdlib.h"
28 
29 #include "genC.h"
30 #include "linear.h"
31 #include "ri.h"
32 #include "effects.h"
33 
34 #include "resources.h"
35 
36 #include "ri-util.h"
37 #include "effects-util.h"
38 
39 #include "sac.h"
40 
41 
42 
43 static bool variables_width_filter(reference r,int *g_varwidth)
44 {
46  if (type_variable_p(ut))
47  {
49 
50  /* do NOT forget to multiply the size by 8, to get it in
51  * bits instead of bytes....
52  */
53  int width;
54  switch(basic_tag(b))
55  {
56  case is_basic_int:
57  width = SizeOfElements(b);
58  break;
59 
60  case is_basic_float:
61  width = SizeOfElements(b);
62  break;
63 
64  /*case is_basic_logical:
65  width = 8*basic_logical(b);
66  break;*/
67 
68  case is_basic_pointer:
69  default:
70  free(b);
71  return true; /* don't know what to do with this... keep searching */
72  }
73  free(b);
74  width*=8;
75 
76  if (width > *g_varwidth)
77  *g_varwidth = width;
78 
79  return false; /* do not search recursively */
80  }
81  else
82  return true; /* keep searching recursievly*/
83 }
84 
86 {
87  int g_varwidth = 0;
88 
90 
91  return g_varwidth;
92 }
#define gen_context_recurse(start, ctxt, domain_number, flt, rwt)
Definition: genC.h:285
void free(void *)
void gen_null2(__attribute__((unused)) void *u1, __attribute__((unused)) void *u2)
idem with 2 args, to please overpeaky compiler checks
Definition: genClib.c:2758
type ultimate_type(type)
Definition: type.c:3466
_int SizeOfElements(basic)
This function returns the length in bytes of the Fortran or C type represented by a basic,...
Definition: size.c:297
basic basic_of_reference(reference)
Retrieves the basic of a reference in a newly allocated basic object.
Definition: type.c:1459
@ is_basic_float
Definition: ri.h:572
@ is_basic_pointer
Definition: ri.h:578
@ is_basic_int
Definition: ri.h:571
#define reference_variable(x)
Definition: ri.h:2326
#define basic_tag(x)
Definition: ri.h:613
#define reference_domain
newgen_range_domain_defined
Definition: ri.h:338
#define entity_type(x)
Definition: ri.h:2792
#define type_variable_p(x)
Definition: ri.h:2947
static bool variables_width_filter(reference r, int *g_varwidth)
Definition: varwidth.c:43
int effective_variables_width(instruction i)
varwidth.c
Definition: varwidth.c:85