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

Go to the source code of this file.

Data Structures

struct  nest_context_t
 Warning! Do not modify this file that is automatically generated! More...
 

Macros

#define spear_error(...)    spear_log_func(CURRENT_FUNCTION, __FILE__, __LINE__, spear_error_log, __VA_ARGS__)
 
#define spear_warning(...)    spear_log_func(CURRENT_FUNCTION, __FILE__, __LINE__, spear_warning_log, __VA_ARGS__)
 

Typedefs

typedef struct nest_context_tnest_context_p
 

Functions

void spear_log_func (const char *, const char *, const int, pips_log_t tag, statement, const string, const string,...)
 cproto-generated files More...
 
bool print_claire_code_with_explicit_motif (const char *)
 claire_prettyprinter.c More...
 
bool print_claire_code (const char *)
 
bool print_xml_code_with_explicit_motif (const char *)
 xml_prettyprinter.c More...
 
bool print_xml_code (const char *)
 Initiates xml pretty print modules. More...
 
char * str_sub (const char *, int, int)
 
char * pointer_to_initial_name (char *, char *)
 
bool eval_linear_expression (expression, transformer, int *, int *, int *)
 
bool print_xml_application_with_points_to (const char *)
 
bool print_xml_application (const char *)
 
bool print_xml_application_main (const char *)
 
bool print_xml_application_main_with_points_to (const char *)
 

Macro Definition Documentation

◆ spear_error

#define spear_error (   ...)     spear_log_func(CURRENT_FUNCTION, __FILE__, __LINE__, spear_error_log, __VA_ARGS__)

Definition at line 26 of file modeling.h.

◆ spear_warning

#define spear_warning (   ...)     spear_log_func(CURRENT_FUNCTION, __FILE__, __LINE__, spear_warning_log, __VA_ARGS__)

Definition at line 29 of file modeling.h.

Typedef Documentation

◆ nest_context_p

typedef struct nest_context_t * nest_context_p

Function Documentation

◆ eval_linear_expression()

bool eval_linear_expression ( expression  exp,
transformer  ps,
int val,
int min,
int max 
)

printf("Eval expression :\n"); print_expression(exp); Psysteme prec = sc_dup((Psysteme) predicate_system(transformer_relation(ps))); printf("In context :\n"); sc_print(prec, (get_variable_name_t) entity_local_name);

Parameters
expxp
pss
valal
minin
maxax

Definition at line 3469 of file xml_prettyprinter.c.

3471 {
3472  bool result=true;
3473  *val = 0;
3474  *min=0;
3475  *max=0;
3476  /* printf("Eval expression :\n");
3477  print_expression(exp);
3478  Psysteme prec = sc_dup((Psysteme) predicate_system(transformer_relation(ps)));
3479  printf("In context :\n");
3480  sc_print(prec, (get_variable_name_t) entity_local_name);
3481  */
3482 
3483  if (!transformer_undefined_p(ps) && transformer_is_rn_p(ps)) {
3484  *min=INT_MIN,*max =INT_MAX;
3485  return(false);
3486  }
3487 
3488  // Should be part of semantics/utils.c FI
3492  if (integer_type_p(et)) {
3494  // DEBUG - printf("Min = %d, Max = %d \n", *min,*max);
3495  }
3496  else result = false;
3497  free_transformer(psr);
3499  if (*max<*min) {
3500  *min=INT_MIN,*max =INT_MAX;
3501  result= false;
3502  }
3503  else if (*max==*min && result) {
3504  *val = *min;
3505  }
3506  return (result);
3507 }
void free_transformer(transformer p)
Definition: ri.c:2616
bool transformer_is_rn_p(transformer t)
Check that transformer t is the canonical representation of the whole afine space defined by its basi...
Definition: basic.c:183
#define min(a, b)
#define max(a, b)
type expression_to_type(expression)
For an array declared as int a[10][20], the type returned for a[i] is int [20].
Definition: type.c:2486
bool integer_type_p(type)
Definition: type.c:3298
type compute_basic_concrete_type(type)
computes a new type which is the basic concrete type of the input type (this new type is not stored i...
Definition: type.c:3556
#define transformer_undefined_p(x)
Definition: ri.h:2848
void integer_expression_and_precondition_to_integer_interval(expression, transformer, int *, int *)
Could be used for bool expressions too? Extended to any kind of expression?
Definition: utils.c:386
transformer transformer_range(transformer tf)
Return the range of relation tf in a newly allocated transformer.
Definition: transformer.c:714
void set_analyzed_types(void)
Definition: value.c:271
void reset_analyzed_types(void)
Definition: value.c:289
#define exp
Avoid some warnings from "gcc -Wshadow".
Definition: vasnprintf.c:207

References compute_basic_concrete_type(), exp, expression_to_type(), free_transformer(), integer_expression_and_precondition_to_integer_interval(), integer_type_p(), max, min, reset_analyzed_types(), set_analyzed_types(), transformer_is_rn_p(), transformer_range(), and transformer_undefined_p.

Referenced by xml_Argument(), xml_AssignArgument(), xml_Bounds(), and xml_Bounds_and_Stride().

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

◆ pointer_to_initial_name()

char* pointer_to_initial_name ( char *  ,
char *   
)

◆ print_claire_code()

bool print_claire_code ( const char *  )

◆ print_claire_code_with_explicit_motif()

bool print_claire_code_with_explicit_motif ( const char *  )

◆ print_xml_application()

bool print_xml_application ( const char *  module_name)
Parameters
module_nameodule_name

Definition at line 6243 of file xml_prettyprinter.c.

6244 {
6245  bool result = generic_print_xml_application(module_name, false);
6246  return result;
6247 }
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
static bool generic_print_xml_application(const char *module_name, bool is_app)

References generic_print_xml_application(), and module_name().

+ Here is the call graph for this function:

◆ print_xml_application_main()

bool print_xml_application_main ( const char *  module_name)
Parameters
module_nameodule_name

Definition at line 6249 of file xml_prettyprinter.c.

6250 {
6251  bool result = generic_print_xml_application(module_name, true);
6252  return result;
6253 }

References generic_print_xml_application(), and module_name().

+ Here is the call graph for this function:

◆ print_xml_application_main_with_points_to()

bool print_xml_application_main_with_points_to ( const char *  module_name)
Parameters
module_nameodule_name

Definition at line 6254 of file xml_prettyprinter.c.

6255 {
6257  db_get_memory_resource(DBR_POINTS_TO, module_name, true) );
6258  bool result = generic_print_xml_application(module_name, true);
6259  reset_pt_to_list();
6260  return result;
6261 }
void set_pt_to_list(statement_points_to)
void reset_pt_to_list(void)
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

References db_get_memory_resource(), generic_print_xml_application(), module_name(), reset_pt_to_list(), and set_pt_to_list().

+ Here is the call graph for this function:

◆ print_xml_application_with_points_to()

bool print_xml_application_with_points_to ( const char *  module_name)
Parameters
module_nameodule_name

Definition at line 6234 of file xml_prettyprinter.c.

6235 {
6237  db_get_memory_resource(DBR_POINTS_TO, module_name, true) );
6238  bool result = generic_print_xml_application(module_name, false);
6239  reset_pt_to_list();
6240  return result;
6241 }

References db_get_memory_resource(), generic_print_xml_application(), module_name(), reset_pt_to_list(), and set_pt_to_list().

+ Here is the call graph for this function:

◆ print_xml_code()

bool print_xml_code ( const char *  module_name)

Initiates xml pretty print modules.

Get the READ and WRITE regions of the module

save to file

Parameters
module_nameodule_name

Definition at line 1888 of file xml_prettyprinter.c.

1889 {
1890  FILE * out;
1891  string ppt;
1893  string xml = db_build_file_resource_name(DBR_XML_PRINTED_FILE,
1894  module_name, ".xml");
1895  string dir = db_get_current_workspace_directory();
1896  string filename = strdup(concatenate(dir, "/", xml, NULL));
1897  statement stat=(statement) db_get_memory_resource(DBR_CODE,
1898  module_name, true);
1899 
1900  init_cost_table();
1901  /* Get the READ and WRITE regions of the module */
1903  db_get_memory_resource(DBR_REGIONS, module_name, true));
1904 
1906  db_get_memory_resource(DBR_COMPLEXITIES, module_name, true));
1907 
1908  if(statement_undefined_p(stat))
1909  {
1910  pips_internal_error("No statement for module %s", module_name);
1911  }
1914 
1915  debug_on("XMLPRETTYPRINTER_DEBUG_LEVEL");
1916  pips_debug(1, "Spec validation before xml prettyprinter for %s\n",
1917  entity_name(module));
1918  if (valid_specification_p(module,stat)){
1919  pips_debug(1, "Spec is valid\n");
1920  pips_debug(1, "Begin XML prettyprinter for %s\n", entity_name(module));
1921  ppt = xml_code(module, stat);
1922  pips_debug(1, "end\n");
1923  debug_off();
1924  /* save to file */
1925  out = safe_fopen(filename, "w");
1926  fprintf(out,"%s",ppt);
1927  safe_fclose(out, filename);
1928  free(ppt);
1929  }
1930 
1931  free(dir);
1932  free(filename);
1933 
1934  DB_PUT_FILE_RESOURCE(DBR_XML_PRINTED_FILE, module_name, xml);
1935 
1939  reset_rw_effects();
1940  return true;
1941 }
static FILE * out
Definition: alias_check.c:128
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void init_cost_table()
Completes the intrinsic cost table with the costs read from the files specified in the "COMPLEXITY_CO...
Definition: comp_util.c:519
void reset_complexity_map(void)
void set_complexity_map(statement_mapping)
void set_rw_effects(statement_effects)
void reset_rw_effects(void)
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
void free(void *)
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
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
Definition: pipsdbm-local.h:85
string db_build_file_resource_name(const char *rname, const char *oname, const char *suffix)
returns an allocated file name for a file resource.
Definition: lowlevel.c:169
#define debug_on(env)
Definition: misc-local.h:157
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define pips_internal_error
Definition: misc-local.h:149
#define debug_off()
Definition: misc-local.h:160
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
static char * module
Definition: pips.c:74
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
entity module_name_to_entity(const char *mn)
This is an alias for local_name_to_top_level_entity.
Definition: entity.c:1479
#define entity_name(x)
Definition: ri.h:2790
#define statement_undefined_p(x)
Definition: ri.h:2420
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
char * strdup()
static bool valid_specification_p(entity module __attribute__((unused)), statement stat __attribute__((unused)))
static string xml_code(entity module, statement stat)
Creates string for xml pretty printer.

References concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug_off, debug_on, entity_name, fprintf(), free(), init_cost_table(), module, module_name(), module_name_to_entity(), out, pips_debug, pips_internal_error, reset_complexity_map(), reset_current_module_entity(), reset_current_module_statement(), reset_rw_effects(), safe_fclose(), safe_fopen(), set_complexity_map(), set_current_module_entity(), set_current_module_statement(), set_rw_effects(), statement_undefined_p, strdup(), valid_specification_p(), and xml_code().

+ Here is the call graph for this function:

◆ print_xml_code_with_explicit_motif()

bool print_xml_code_with_explicit_motif ( const char *  module_name)

xml_prettyprinter.c

xml_prettyprinter.c

save to file

Parameters
module_nameodule_name

Definition at line 1162 of file xml_prettyprinter.c.

1163 {
1164  FILE * out;
1165  string ppt, xml, dir, filename;
1166  entity module;
1167  statement stat;
1170  xml = db_build_file_resource_name(DBR_XML_PRINTED_FILE, module_name, ".xml");
1171 
1175  filename = strdup(concatenate(dir, "/", xml, NULL));
1176  stat = (statement) db_get_memory_resource(DBR_CODE, module_name, true);
1177 
1178  if(statement_undefined_p(stat))
1179  {
1180  pips_internal_error("No statement for module %s", module_name);
1181  }
1184 
1185  debug_on("XMLPRETTYPRINTER_DEBUG_LEVEL");
1186  pips_debug(1, "Begin Claire prettyprinter for %s\n", entity_name(module));
1187  ppt = xml_code_string(module, stat);
1188  pips_debug(1, "end\n");
1189  debug_off();
1190 
1191  /* save to file */
1192  out = safe_fopen(filename, "w");
1193  fprintf(out, "%s", ppt);
1194  safe_fclose(out, filename);
1195 
1196  free(ppt);
1197  free(dir);
1198  free(filename);
1199 
1200  DB_PUT_FILE_RESOURCE(DBR_XML_PRINTED_FILE, module_name, xml);
1201 
1204 
1205  return true;
1206 }
gen_array_t gen_array_make(size_t size)
declarations...
Definition: array.c:40
static string xml_code_string(entity module, statement stat)
Creates string for xml pretty printer.
static gen_array_t array_names
static const char * global_module_name
static gen_array_t array_dims

References array_dims, array_names, concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug_off, debug_on, entity_name, fprintf(), free(), gen_array_make(), global_module_name, module, module_name(), module_name_to_entity(), out, pips_debug, pips_internal_error, reset_current_module_entity(), reset_current_module_statement(), safe_fclose(), safe_fopen(), set_current_module_entity(), set_current_module_statement(), statement_undefined_p, strdup(), and xml_code_string().

+ Here is the call graph for this function:

◆ spear_log_func()

void spear_log_func ( const char *  pips_func,
const char *  pips_file,
const int  pips_line,
pips_log_t  tag,
statement  stat,
const string  hint,
const string  format,
  ... 
)

cproto-generated files

utils.c

cproto-generated files

this function is not expected to be called directly, but it should be redirected here from a macro "spear_error(stat, hing, fmt, ...)"

Parameters
pips_funcips_func
pips_fileips_file
pips_lineips_line
stattat
hintint
formatormat

Definition at line 102 of file utils.c.

113 {
114  va_list args;
115  va_start(args, format);
116  spear_log_alist(pips_func, pips_file, pips_line, tag,
117  stat, hint, format, &args);
118  va_end(args);
119 }
static void spear_log_alist(const char *pips_func, const char *pips_file, const int pips_line, pips_log_t tag, statement stat, const string hint, const string format, va_list *args)
internal alist-level processing for spear warning & error logging
Definition: utils.c:53
int tag
TAG.
Definition: newgen_types.h:92

References spear_log_alist().

+ Here is the call graph for this function:

◆ str_sub()

char* str_sub ( const char *  s,
int  start,
int  end 
)
Parameters
starttart
endnd

Definition at line 2673 of file xml_prettyprinter.c.

2674 {
2675  char *new_s = NULL;
2676  if (s != NULL && start <= end)
2677  {
2678  new_s = malloc (sizeof (*new_s) * (end - start + 2));
2679  if (new_s != NULL) {
2680  int i;
2681  for (i = start; i <= end; i++) {
2682  new_s[i-start] = s[i];
2683  }
2684  new_s[i-start] = '\0';
2685  }
2686  }
2687  return new_s;
2688 }
static char start[1024]
The name of the variable from which to start counting domain numbers.
Definition: genLisp.c:55
void * malloc(YYSIZE_T)
char end
Definition: gtk_status.c:82

References end, malloc(), and start.

Referenced by pointer_to_initial_name().

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