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

Go to the source code of this file.

Macros

#define MODULE_SEP   ':'
 Warning! Do not modify this file that is automatically generated! More...
 
#define MODULE_SEP_CHAR   MODULE_SEP
 
#define MODULE_SEP_STRING   ":"
 
#define LABEL_PREFIX   "@"
 
#define MAIN_PREFIX   "%"
 
#define MAIN_PREFIX_CHAR   '%'
 
#define COMMON_PREFIX   "~"
 
#define BLOCKDATA_PREFIX   "&"
 
#define F95MODULE_PREFIX   "\xa4"
 
#define FILE_SEP_CHAR   '!'
 
#define FILE_SEP   FILE_SEP_CHAR
 
#define FILE_SEP_STRING   "!"
 
#define MODULE_NAME_CHARS
 
#define BLOCK_SEP_STRING   "`"
 Scope separator. More...
 
#define BLOCK_SEP_CHAR   '`'
 
#define MEMBER_SEP_STRING   "^"
 
#define MEMBER_SEP_CHAR   '^'
 
#define STRUCT_PREFIX   "#"
 
#define STRUCT_PREFIX_CHAR   '#'
 
#define UNION_PREFIX   "'" /**Conflict with C character constants */
 
#define UNION_PREFIX_CHAR   '\''
 
#define ENUM_PREFIX   "?"
 
#define ENUM_PREFIX_CHAR   '?'
 
#define TYPEDEF_PREFIX   "$"
 
#define TYPEDEF_PREFIX_CHAR   '$'
 
#define F95_USE_LOCAL_NAME   "*USE*"
 constant names More...
 
#define BLANK_COMMON_LOCAL_NAME   "*BLANK*"
 
#define DYNAMIC_AREA_LOCAL_NAME   "*DYNAMIC*"
 
#define STATIC_AREA_LOCAL_NAME   "*STATIC*"
 
#define HEAP_AREA_LOCAL_NAME   "*HEAP*"
 
#define STACK_AREA_LOCAL_NAME   "*STACK*"
 
#define ALLOCATABLE_AREA_LOCAL_NAME   "*ALLOCATABLE*"
 
#define FORMAL_AREA_LOCAL_NAME   "*FORMAL*"
 
#define POINTER_DUMMY_TARGETS_AREA_LOCAL_NAME   "*POINTER_DUMMY_TARGETS*"
 
#define ALL_MEMORY_ENTITY_NAME   "TOP-LEVEL:*MEMORY*"
 The set of all memory areas. More...
 
#define DUMMY_ENUM_PREFIX   "_PIPS_ENUM_"
 For enum and struct and union without names (see c_syntax/cyacc.y) More...
 
#define DUMMY_STRUCT_PREFIX   "_PIPS_STRUCT_"
 
#define DUMMY_UNION_PREFIX   "_PIPS_UNION_"
 
#define DUMMY_ABSTRACT_PREFIX   "_PIPS_ABSTRACT_"
 
#define DUMMY_MEMBER_PREFIX   "_PIPS_MEMBER_" /**For bit fields */
 
#define DUMMY_PARAMETER_PREFIX   "DUMMY-PARAMETER-"
 For dmmmy parameters in functions declarations. More...
 
#define EMPTY_LABEL_NAME   LABEL_PREFIX
 Its value is "@", the label prefix followed by nothing. More...
 
#define LIST_DIRECTED_FORMAT_NAME   "LIST-DIRECTED"
 
#define TOP_LEVEL_MODULE_NAME   "TOP-LEVEL"
 Module containing the global variables in Fortran and C. More...
 
#define POINTS_TO_MODULE_NAME   "*POINTS-TO-MODULE*"
 Module containing stub variables used to initialize intraprocedural points-to in C. More...
 
#define RETURN_LABEL_NAME   "00000"
 
#define MAXIMAL_MODULE_NAME_SIZE   100
 In C, the module name may include file names, the compilation unit name and the user name of the function. More...
 
#define C_PRAGMA_HEADER_STRING   "#pragma"
 Constants for pragma management. More...
 
#define FORTRAN_PRAGMA_HEADER_STRING   "!$"
 
#define FORTRAN_OMP_CONTINUATION_STRING   "\n!$omp& "
 

Functions

bool compilation_unit_p (const char *)
 cproto-generated files More...
 
bool module_name_p (string)
 Check if the given name is the name of a plain module and not of a compilation unit. More...
 
bool main_module_global_name_p (const char *)
 Argument "name" is a global name. More...
 
bool main_module_name_p (const char *)
 Argument "name" is a local name (not a user name) More...
 
bool static_module_name_p (const char *)
 Check if the given name is a static module name. More...
 
const char * global_name_to_user_name (const char *)
 functions on strings for entity names More...
 
const char * local_name (const char *)
 Does not take care of block scopes and returns a pointer. More...
 
string make_entity_fullname (const char *, const char *)
 END_EOLE. More...
 
bool empty_string_p (const char *)
 
bool blank_string_p (const char *)
 
bool return_local_label_name_p (const char *)
 
bool empty_label_p (const char *)
 
bool empty_global_label_p (const char *)
 
bool return_label_p (const char *)
 
const char * module_name (const char *)
 Return the module part of an entity name. More...
 
string string_codefilename (const char *)
 file_names.c More...
 
string string_par_codefilename (const char *)
 
string string_fortranfilename (const char *)
 
bool string_fortran_filename_p (const char *)
 
string string_par_fortranfilename (const char *)
 
string string_pp_fortranfilename (const char *)
 
string string_predicat_fortranfilename (const char *)
 
string string_entitiesfilename (const char *)
 
void set_script_directory_name (string)
 
string get_script_directory_name (void)
 

Macro Definition Documentation

◆ ALL_MEMORY_ENTITY_NAME

#define ALL_MEMORY_ENTITY_NAME   "TOP-LEVEL:*MEMORY*"

The set of all memory areas.

FI: this macro is now obsolete and should be removed when a new version of alias-classes is introduced. Too bad ri-util/effects.c is going to depend on alias-classes

Definition at line 91 of file naming.h.

◆ ALLOCATABLE_AREA_LOCAL_NAME

#define ALLOCATABLE_AREA_LOCAL_NAME   "*ALLOCATABLE*"

Definition at line 81 of file naming.h.

◆ BLANK_COMMON_LOCAL_NAME

#define BLANK_COMMON_LOCAL_NAME   "*BLANK*"

Definition at line 76 of file naming.h.

◆ BLOCK_SEP_CHAR

#define BLOCK_SEP_CHAR   '`'

Definition at line 59 of file naming.h.

◆ BLOCK_SEP_STRING

#define BLOCK_SEP_STRING   "`"

Scope separator.

Definition at line 58 of file naming.h.

◆ BLOCKDATA_PREFIX

#define BLOCKDATA_PREFIX   "&"

Definition at line 43 of file naming.h.

◆ C_PRAGMA_HEADER_STRING

#define C_PRAGMA_HEADER_STRING   "#pragma"

Constants for pragma management.

Definition at line 123 of file naming.h.

◆ COMMON_PREFIX

#define COMMON_PREFIX   "~"

Definition at line 42 of file naming.h.

◆ DUMMY_ABSTRACT_PREFIX

#define DUMMY_ABSTRACT_PREFIX   "_PIPS_ABSTRACT_"

Definition at line 97 of file naming.h.

◆ DUMMY_ENUM_PREFIX

#define DUMMY_ENUM_PREFIX   "_PIPS_ENUM_"

For enum and struct and union without names (see c_syntax/cyacc.y)

Definition at line 94 of file naming.h.

◆ DUMMY_MEMBER_PREFIX

#define DUMMY_MEMBER_PREFIX   "_PIPS_MEMBER_" /**For bit fields */

Definition at line 98 of file naming.h.

◆ DUMMY_PARAMETER_PREFIX

#define DUMMY_PARAMETER_PREFIX   "DUMMY-PARAMETER-"

For dmmmy parameters in functions declarations.

Definition at line 101 of file naming.h.

◆ DUMMY_STRUCT_PREFIX

#define DUMMY_STRUCT_PREFIX   "_PIPS_STRUCT_"

Definition at line 95 of file naming.h.

◆ DUMMY_UNION_PREFIX

#define DUMMY_UNION_PREFIX   "_PIPS_UNION_"

Definition at line 96 of file naming.h.

◆ DYNAMIC_AREA_LOCAL_NAME

#define DYNAMIC_AREA_LOCAL_NAME   "*DYNAMIC*"

Definition at line 77 of file naming.h.

◆ EMPTY_LABEL_NAME

#define EMPTY_LABEL_NAME   LABEL_PREFIX

Its value is "@", the label prefix followed by nothing.

Definition at line 104 of file naming.h.

◆ ENUM_PREFIX

#define ENUM_PREFIX   "?"

Definition at line 68 of file naming.h.

◆ ENUM_PREFIX_CHAR

#define ENUM_PREFIX_CHAR   '?'

Definition at line 69 of file naming.h.

◆ F95_USE_LOCAL_NAME

#define F95_USE_LOCAL_NAME   "*USE*"

constant names

Definition at line 75 of file naming.h.

◆ F95MODULE_PREFIX

#define F95MODULE_PREFIX   "\xa4"

Definition at line 44 of file naming.h.

◆ FILE_SEP

#define FILE_SEP   FILE_SEP_CHAR

Definition at line 47 of file naming.h.

◆ FILE_SEP_CHAR

#define FILE_SEP_CHAR   '!'

Definition at line 46 of file naming.h.

◆ FILE_SEP_STRING

#define FILE_SEP_STRING   "!"

Definition at line 49 of file naming.h.

◆ FORMAL_AREA_LOCAL_NAME

#define FORMAL_AREA_LOCAL_NAME   "*FORMAL*"

Definition at line 84 of file naming.h.

◆ FORTRAN_OMP_CONTINUATION_STRING

#define FORTRAN_OMP_CONTINUATION_STRING   "\n!$omp& "

Definition at line 125 of file naming.h.

◆ FORTRAN_PRAGMA_HEADER_STRING

#define FORTRAN_PRAGMA_HEADER_STRING   "!$"

Definition at line 124 of file naming.h.

◆ HEAP_AREA_LOCAL_NAME

#define HEAP_AREA_LOCAL_NAME   "*HEAP*"

Definition at line 79 of file naming.h.

◆ LABEL_PREFIX

#define LABEL_PREFIX   "@"

Definition at line 39 of file naming.h.

◆ LIST_DIRECTED_FORMAT_NAME

#define LIST_DIRECTED_FORMAT_NAME   "LIST-DIRECTED"

Definition at line 105 of file naming.h.

◆ MAIN_PREFIX

#define MAIN_PREFIX   "%"

Definition at line 40 of file naming.h.

◆ MAIN_PREFIX_CHAR

#define MAIN_PREFIX_CHAR   '%'

Definition at line 41 of file naming.h.

◆ MAXIMAL_MODULE_NAME_SIZE

#define MAXIMAL_MODULE_NAME_SIZE   100

In C, the module name may include file names, the compilation unit name and the user name of the function.

It goes well beyond the 36 of Fortan (check the standard).

Definition at line 120 of file naming.h.

◆ MEMBER_SEP_CHAR

#define MEMBER_SEP_CHAR   '^'

Definition at line 62 of file naming.h.

◆ MEMBER_SEP_STRING

#define MEMBER_SEP_STRING   "^"

Definition at line 61 of file naming.h.

◆ MODULE_NAME_CHARS

#define MODULE_NAME_CHARS
Value:
( "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \
"0123456789" \
"abcdefghijklmnopqrstuvwxyz" \
FILE_SEP_STRING MODULE_SEP_STRING "|_#-." )
#define MODULE_SEP_STRING
Definition: naming.h:38

Definition at line 51 of file naming.h.

◆ MODULE_SEP

#define MODULE_SEP   ':'

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

Modify src/Libs/naming/naming-local.h instead, to add your own modifications. header file built by cproto naming-local.h special characters to build entity names of various kinds

Definition at line 35 of file naming.h.

◆ MODULE_SEP_CHAR

#define MODULE_SEP_CHAR   MODULE_SEP

Definition at line 36 of file naming.h.

◆ MODULE_SEP_STRING

#define MODULE_SEP_STRING   ":"

Definition at line 38 of file naming.h.

◆ POINTER_DUMMY_TARGETS_AREA_LOCAL_NAME

#define POINTER_DUMMY_TARGETS_AREA_LOCAL_NAME   "*POINTER_DUMMY_TARGETS*"

Definition at line 85 of file naming.h.

◆ POINTS_TO_MODULE_NAME

#define POINTS_TO_MODULE_NAME   "*POINTS-TO-MODULE*"

Module containing stub variables used to initialize intraprocedural points-to in C.

Definition at line 112 of file naming.h.

◆ RETURN_LABEL_NAME

#define RETURN_LABEL_NAME   "00000"

Definition at line 114 of file naming.h.

◆ STACK_AREA_LOCAL_NAME

#define STACK_AREA_LOCAL_NAME   "*STACK*"

Definition at line 80 of file naming.h.

◆ STATIC_AREA_LOCAL_NAME

#define STATIC_AREA_LOCAL_NAME   "*STATIC*"

Definition at line 78 of file naming.h.

◆ STRUCT_PREFIX

#define STRUCT_PREFIX   "#"

Definition at line 64 of file naming.h.

◆ STRUCT_PREFIX_CHAR

#define STRUCT_PREFIX_CHAR   '#'

Definition at line 65 of file naming.h.

◆ TOP_LEVEL_MODULE_NAME

#define TOP_LEVEL_MODULE_NAME   "TOP-LEVEL"

Module containing the global variables in Fortran and C.

Definition at line 109 of file naming.h.

◆ TYPEDEF_PREFIX

#define TYPEDEF_PREFIX   "$"

Definition at line 70 of file naming.h.

◆ TYPEDEF_PREFIX_CHAR

#define TYPEDEF_PREFIX_CHAR   '$'

Definition at line 71 of file naming.h.

◆ UNION_PREFIX

#define UNION_PREFIX   "'" /**Conflict with C character constants */

Definition at line 66 of file naming.h.

◆ UNION_PREFIX_CHAR

#define UNION_PREFIX_CHAR   '\''

Definition at line 67 of file naming.h.

Function Documentation

◆ blank_string_p()

bool blank_string_p ( const char *  s)

Definition at line 245 of file entity_names.c.

245  {
246  extern int isspace(int);
247  while(*s&&isspace(*s++));
248  return !*s;
249 }

◆ compilation_unit_p()

bool compilation_unit_p ( const char *  module_name)

cproto-generated files

entity_names.c

cproto-generated files

A lot of string-based functions are used to know what an entity is according to its name.

The purpose of this file (library?) is to keep together these basic string functions for entity names, with no dependence on ri.newgen.

Different kinds of names:

  • module name
  • compilation unit name: "file!"
  • static module name: "file!foo"

At execution time, this encoding leads to over using string functions. This was studied by HPC Project and Beatrice Creusillet. She suggested to add a new field to entities, which would carry this information. Check if the given name is a compilation unit internal name.

Should be called "compilation_unit_name_p()" to avoid ambiguity about the argument.

A module name is a compilation unit if and only if its last character is FILE_SEP

Parameters
module_nameodule_name

Definition at line 56 of file entity_names.c.

56  {
57  /* A module name is a compilation unit if and only if its last character is
58  FILE_SEP */
59  unsigned int len = strlen(module_name);
60  if (len > 0) {
61  if (module_name[len - 1] == FILE_SEP) {
62  return true;
63  }
64  }
65  return false;
66 }
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
#define FILE_SEP
Definition: naming-local.h:39

References FILE_SEP, and module_name().

Referenced by actual_c_parser(), build_real_resources(), compilation_unit_entity_p(), controlizer(), db_get_module_list_initial_order(), db_get_module_or_function_list(), ensure_comment_consistency(), entity_more_or_less_minimal_name(), initial_points_to(), MakeCompilationUnitEntity(), module_name_p(), new_controlizer(), open_module_if_unique(), set_current_function(), set_entity_initial(), static_global_variable_p(), static_module_name_p(), step_compile_generated_module(), UpdateEntity(), and UpdateFunctionEntity().

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

◆ empty_global_label_p()

bool empty_global_label_p ( const char *  gln)
Parameters
glnln

Definition at line 264 of file entity_names.c.

265 {
266  // gln must be a global label name
267  const char* lln = local_name(gln);
268 
269  return empty_label_p(lln);
270 }
bool empty_label_p(const char *s)
Definition: entity_names.c:256
const char * local_name(const char *s)
Does not take care of block scopes and returns a pointer.
Definition: entity_names.c:221

References empty_label_p(), and local_name().

Referenced by create_statements_of_label(), get_label_control(), init_label(), loop_to_complexity(), make_conditional_control(), set_control_to_label(), text_trail(), and update_used_labels().

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

◆ empty_label_p()

bool empty_label_p ( const char *  s)

Definition at line 256 of file entity_names.c.

257 {
258  // s must be a local label name
259  pips_assert("no separator", strchr(s, MODULE_SEP) == NULL);
260  // return(empty_local_label_name_p(local_name(s)+sizeof(LABEL_PREFIX)-1)) ;
261  return (strcmp(s, EMPTY_LABEL_NAME) == 0);
262 }
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
#define MODULE_SEP
special characters to build entity names of various kinds
Definition: naming-local.h:27
#define EMPTY_LABEL_NAME
Its value is "@", the label prefix followed by nothing.
Definition: naming-local.h:96

References EMPTY_LABEL_NAME, MODULE_SEP, and pips_assert.

Referenced by empty_global_label_p(), entity_empty_label_p(), and label_name_conflict_with_labels().

+ Here is the caller graph for this function:

◆ empty_string_p()

◆ get_script_directory_name()

string get_script_directory_name ( void  )

Definition at line 110 of file file_names.c.

111 {
112  return script_directory_name;
113 }
static string script_directory_name
Keep track of the script directory.
Definition: file_names.c:103

References script_directory_name.

◆ global_name_to_user_name()

const char* global_name_to_user_name ( const char *  global_name)

functions on strings for entity names

BEGIN_EOLE

  • please do not remove this line Lines between BEGIN_EOLE and END_EOLE tags are automatically included in the EOLE project (JZ - 11/98) Does take care of block scopes

First, take care of constrant strings and characters, wich may contain any of the PIPS special characters and strings. And do not forget Fortran format

Then all possible prefixes first

Clash with the address-of C operator

Then F95 module separator

Then block seperators

Then module separator

Then file separator

Take care of the special case of static functions, leaving compilation unit names untouched

Parameters
global_namelobal_name

Definition at line 136 of file entity_names.c.

137 {
138  const char* user_name = string_undefined;
139  char lc = global_name[strlen(global_name)-1];
140  const char* p;
141 
142  /* First, take care of constrant strings and characters, wich may
143  contain any of the PIPS special characters and strings.
144  And do not forget Fortran format */
145 
146  if(lc=='"' || lc=='\'') {
147  user_name = strchr(global_name, lc);
148  }
149  else if(lc==')') {
150  user_name = strchr(global_name, '(');
151  }
152  else {
153 
154  /* Then all possible prefixes first */
155 
156  if (strstr(global_name,STRUCT_PREFIX) != NULL)
157  user_name = strstr(global_name,STRUCT_PREFIX) + 1;
158  else if (strstr(global_name,UNION_PREFIX) != NULL) {
159  user_name = strstr(global_name,UNION_PREFIX) + 1;
160  }
161  else if (strstr(global_name,ENUM_PREFIX) != NULL)
162  user_name = strstr(global_name,ENUM_PREFIX) + 1;
163  else if (strstr(global_name,TYPEDEF_PREFIX) != NULL)
164  user_name = strstr(global_name,TYPEDEF_PREFIX) + 1;
165 
166  else if (strstr(global_name,MEMBER_SEP_STRING) != NULL)
167  user_name = strstr(global_name,MEMBER_SEP_STRING) + 1;
168 
169  else if (strstr(global_name,LABEL_PREFIX) != NULL)
170  user_name = strstr(global_name,LABEL_PREFIX) + 1;
171  else if (strstr(global_name,COMMON_PREFIX) != NULL)
172  user_name = strstr(global_name,COMMON_PREFIX) + 1;
173  else if (strstr(global_name,BLOCKDATA_PREFIX) != NULL) {
174  /* Clash with the address-of C operator */
175  user_name = strstr(global_name,BLOCKDATA_PREFIX)+1;
176  //string s = strstr(global_name,BLOCKDATA_PREFIX);
177  //
178  //if(strlen(s)>1)
179  // user_name = s + 1);
180  //else
181  //user_name = s;
182  }
183  else if (strstr(global_name,MAIN_PREFIX) != NULL) {
184  string s = strstr(global_name,MAIN_PREFIX) + 1;
185  pips_debug(8, "name = %s \n", s);
186  user_name = s;
187  }
188  /* Then F95 module separator */
189  else if (strstr(global_name,F95MODULE_PREFIX) != NULL)
190  user_name = strstr(global_name,F95MODULE_PREFIX) + 1;
191 
192  /* Then block seperators */
193  else if (strstr(global_name,BLOCK_SEP_STRING) != NULL)
194  user_name = strrchr(global_name,BLOCK_SEP_CHAR) + 1;
195 
196  /* Then module separator */
197  else if (strstr(global_name,MODULE_SEP_STRING) != NULL)
198  user_name = strstr(global_name,MODULE_SEP_STRING) + 1;
199 
200 
201  /* Then file separator */
202  else if (strstr(global_name,FILE_SEP_STRING) != NULL)
203  user_name = strstr(global_name,FILE_SEP_STRING) + 1;
204  else {
205  pips_internal_error("no seperator ?");
206  user_name = NULL;
207  }
208 
209  /* Take care of the special case of static functions, leaving
210  compilation unit names untouched */
211  if ((p=strstr(user_name,FILE_SEP_STRING)) != NULL && *(p+1)!='\0')
212  user_name = p + 1;
213  }
214 
215  pips_debug(9, "global name = \"%s\", user_name = \"%s\"\n",
216  global_name, user_name);
217  return user_name;
218 }
#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 COMMON_PREFIX
Definition: naming-local.h:34
#define LABEL_PREFIX
Definition: naming-local.h:31
#define BLOCK_SEP_CHAR
Definition: naming-local.h:51
#define F95MODULE_PREFIX
Definition: naming-local.h:36
#define FILE_SEP_STRING
Definition: naming-local.h:41
#define TYPEDEF_PREFIX
Definition: naming-local.h:62
#define MAIN_PREFIX
Definition: naming-local.h:32
#define UNION_PREFIX
Definition: naming-local.h:58
#define ENUM_PREFIX
Definition: naming-local.h:60
#define BLOCKDATA_PREFIX
Definition: naming-local.h:35
#define MODULE_SEP_STRING
Definition: naming-local.h:30
#define MEMBER_SEP_STRING
Definition: naming-local.h:53
#define STRUCT_PREFIX
Definition: naming-local.h:56
#define BLOCK_SEP_STRING
Scope separator.
Definition: naming-local.h:50
#define string_undefined
Definition: newgen_types.h:40

References BLOCK_SEP_CHAR, BLOCK_SEP_STRING, BLOCKDATA_PREFIX, COMMON_PREFIX, ENUM_PREFIX, F95MODULE_PREFIX, FILE_SEP_STRING, LABEL_PREFIX, MAIN_PREFIX, MEMBER_SEP_STRING, MODULE_SEP_STRING, pips_debug, pips_internal_error, string_undefined, STRUCT_PREFIX, TYPEDEF_PREFIX, and UNION_PREFIX.

Referenced by entity_field_to_entity(), entity_user_name(), gfc2pips_namespace(), gpu_ify(), make_new_index_entity(), and unique_entity_name_p().

+ Here is the caller graph for this function:

◆ local_name()

◆ main_module_global_name_p()

bool main_module_global_name_p ( const char *  name)

Argument "name" is a global name.

In C, the main module is always called "main".

In Fortran, the main module can have any declared name and a special prefix is used.

In both cases, they are part of TOP-LEVEL

Look for a C main name

Look for a Fortran main

Parameters
nameame

Definition at line 86 of file entity_names.c.

87 {
88  bool main_p = false;
89  /* Look for a C main name */
91  if(!main_p) {
92  /* Look for a Fortran main */
94  main_p = strncmp(prefix, name, strlen(prefix)) == 0;
95  }
96  return main_p;
97 }
#define TOP_LEVEL_MODULE_NAME
Module containing the global variables in Fortran and C.
Definition: naming-local.h:101
#define same_string_p(s1, s2)
static const char * prefix

References MAIN_PREFIX, MODULE_SEP_STRING, prefix, same_string_p, and TOP_LEVEL_MODULE_NAME.

Referenced by entity_main_module_p().

+ Here is the caller graph for this function:

◆ main_module_name_p()

bool main_module_name_p ( const char *  name)

Argument "name" is a local name (not a user name)

In C, the main module is always called "main".

In Fortran, the main module can have any declared name and a special prefix is used.

In both cases, they are part of TOP-LEVEL

Look for a C main name

Look for a Fortran main

Parameters
nameame

Definition at line 108 of file entity_names.c.

109 {
110  bool main_p = false;
111  /* Look for a C main name */
112  main_p = same_string_p(name, "main");
113  if(!main_p) {
114  /* Look for a Fortran main */
115  main_p = name[0]==MAIN_PREFIX_CHAR;
116  }
117  return main_p;
118 }
#define MAIN_PREFIX_CHAR
Definition: naming-local.h:33

References MAIN_PREFIX_CHAR, and same_string_p.

◆ make_entity_fullname()

string make_entity_fullname ( const char *  module_name,
const char *  local_name 
)

END_EOLE.

Parameters
module_nameodule_name
local_nameocal_name

Definition at line 230 of file entity_names.c.

231 {
232  return(concatenate(module_name,
234  local_name,
235  (char *) 0));
236 }
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183

References concatenate(), local_name(), module_name(), and MODULE_SEP_STRING.

Referenced by add_test(), binary_arithmetic_operator_to_post_pv(), complex_bound_generation(), ecrit_une_var_neg(), local_name_to_variable(), loop_normalize_of_loop(), make_func_op(), make_movements_loop_body_wp65(), make_op_exp(), make_rational_exp(), MakeAssignedOrComputedGotoInst(), predicate_to_expression(), psystem_to_expression(), rational_op_exp(), signed_integer_constant_expression_p(), and xml_TaskParameter().

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

◆ module_name()

const char* module_name ( const char *  s)

Return the module part of an entity name.

OK, this function name is pretty misleading: entity_name_to_entity_module_name().

Maybe, it should be wrapped up in a higher-level function such as entity_to_module_name().

It uses a static buffer and should create trouble with long function names.

No memory allocation is performed, but it's result is transient. It must be strdup'ed by the caller if it is to be preserved.

To eliminate the static buffer and to allocate the returned string would require lots of changes or add lots of memory leaks in PIPS since the callers do not know they must free the result. Maybe we should stack allocate a buffer of size strlen(s), but we would end up returning a pointer to a popped area of the stack...

Definition at line 296 of file entity_names.c.

297 {
298  static char *local = NULL;
299  static size_t local_size = 0;
300 
301  char * sep = strchr(s, MODULE_SEP);
302  size_t len = sep? (size_t) (sep-s): strlen(s);
303 
304  if (local_size < len + 1)
305  {
306  if (local) free(local);
307  local_size = len + 1 > 100? len + 1: 100;
308  local = malloc(local_size);
309  }
310 
311  strncpy(local, s, len);
312  local[len] = '\0';
313 
314  return local;
315 }
void * malloc(YYSIZE_T)
void free(void *)
size_t size_t
Definition: properties.c:413

References free(), malloc(), and MODULE_SEP.

Referenced by actual_c_parser(), actual_symbol_table_dump(), add_alias_lists_callees(), add_classes_callees(), add_common_variables_to_hash_table(), add_control_counters(), add_entity_to_declarations(), add_new_module(), add_new_module_from_text(), alias_check(), alias_classes(), alias_lists(), alias_pairs(), alias_propagation(), aliases_text(), any_complexities(), apply_eole_on_statement(), array_bound_check_bottom_up(), array_bound_check_instrumentation(), array_bound_check_interprocedural(), array_bound_check_top_down(), array_expansion(), atomic_chains(), bdsc_code_instrumentation(), bootstrap_kernels(), bootstrap_stubs(), c_initializer(), c_parser(), callgraph(), callgraph_module_name(), chains(), check_call_mode_consistency(), check_tiling_legality(), clean_declarations(), clear_pragma(), clone_variable_with_new_name(), comEngine_distribute(), comEngine_distribute_code(), comEngine_generate_HRECode(), common_subexpression_elimination(), comp_regions(), compilation_unit_of_module(), compilation_unit_p(), compilation_unit_parser(), complementary_sections(), computation_intensity(), constant_memory_access_path_to_location_name(), continuation_conditions(), controlizer(), copy_value_of_write(), copy_value_of_write_with_cumulated_regions(), create_HRE_module(), create_integer_parameter_for_new_module(), create_parameter_for_new_module(), create_state_variable(), creer_nom_entite(), creer_nom_var(), csplit_copy(), cumulated_reductions(), davinci_dump_expressions(), db_get_in_simple_pv(), db_get_initial_simple_pv(), db_get_out_simple_pv(), db_get_simple_pv(), db_put_in_simple_pv(), db_put_initial_simple_pv(), db_put_out_simple_pv(), db_put_simple_pv(), delay_communications(), delay_communications_inter(), delay_communications_intra(), delay_load_communications(), delay_load_communications_inter(), delay_load_communications_intra(), delay_store_communications(), delay_store_communications_inter(), delay_store_communications_intra(), do_inlining(), do_unfolding(), dowhile_to_while(), dsc_code_parallelization(), eliminate_original_variables(), entity_module_name(), entity_to_callees(), epips_execute_and_display_something(), epips_select_module(), epips_sequential_view(), expression_substitution(), external_value_name(), fast_interprocedural_points_to_analysis(), fetch_callees_complexities(), fetch_complexity_parameters(), filter_proper_effects(), find_code_status(), find_label_entity(), find_or_create_scalar_entity(), find_or_create_typed_entity(), find_statement_from_label_name(), FindOrCreateCurrentEntity(), flag_as_stub(), flag_kernel(), flag_loops(), flatten_code(), flinter(), for_loop_to_do_loop(), for_loop_to_while_loop(), fortran_initializer(), forward_substitute(), fp_complexities(), fsm_generation(), fsm_merge_states(), fsm_split_state(), fsmize_statement(), full_fsm_generation(), full_spaghettify(), full_spaghettify_module(), full_spaghettify_statement(), gen_multi_recurse_explorer(), generate_starpu_pragma(), generate_two_addresses_code(), generate_variable_with_unique_name_to_module(), generic_initializer(), generic_make_entity_copy_with_new_name(), generic_module_initial_pointer_values(), generic_module_name_to_transformers(), generic_module_pointer_values(), generic_points_to_analysis(), generic_print_code_gen_kill_pv(), generic_print_code_pv(), generic_print_icfg(), generic_print_icfg_filtered(), generic_print_icfg_precise(), generic_print_xml_application(), generic_program_pointer_values(), get_any_comp_regions_text(), get_callees_of(), get_callers_of(), get_continuation_condition_text(), get_loop_execution_parallel(), get_semantic_text(), get_text_comp_regions(), get_text_complexities(), get_text_preconditions(), get_text_total_preconditions(), get_text_transformers(), get_view_file(), GetFullyDefinedReturnCodeVariable(), gfc2pips_symbol2entity(), global_parallelization(), gpips_execute_and_display_something(), gpips_execute_and_display_something_from_alias(), gpu_loop_nest_annotate(), gpu_memory(), gpu_promote_sequential(), gpu_qualify_pointers(), group_constants(), hbdsc_parallelization(), hpfcompile(), HRE_distribute(), icm(), ikernel_load_store(), impact_check(), in_alias_pairs(), in_out_regions_chains(), init_convex_in_out_regions(), init_convex_inout_prettyprint(), init_convex_rw_prettyprint(), init_convex_rw_regions(), init_convex_summary_in_out_regions(), init_convex_summary_rw_regions(), init_points_to_analysis(), init_use_preconditions(), init_use_proper_effects(), initial_simple_pointer_values(), initializer(), inlining(), inlining_simple(), instruction_selection(), interactive_loop_transformation(), internal_print_icfg(), interprocedural_points_to_analysis(), interprocedural_summary_precondition(), interprocedural_summary_precondition_with_points_to(), intraprocedural_points_to_analysis(), intraprocedural_summary_precondition(), invariant_code_motion(), isolate_statement(), kernel_data_mapping(), kernel_load_store(), kernel_load_store_engine(), kernel_load_store_generator(), kernelize(), linearize_array(), linearize_array_fortran(), linearize_array_generic(), live_in_summary_paths_engine(), live_out_region_engine(), live_out_summary_paths_engine(), live_paths_engine(), load_body_effects(), loop_expansion(), loop_expansion_init(), loop_hyperplane(), loop_nest_unswitching(), loop_pragma(), loop_tiling(), main(), make_array_communication_module(), make_array_entity(), make_begin_variable(), make_body_from_forloop(), make_body_from_loop(), make_body_from_whileloop(), make_derived_entity(), make_end_variable(), make_entity_fullname(), make_fsm_from_statement(), make_fsm_transitions_statement(), make_if_false_from_test(), make_if_true_from_test(), make_increment_variable(), make_index_variable(), make_label(), make_new_array_variable_with_prefix(), make_new_derived_entity_with_prefix(), make_new_label(), make_new_scalar_variable_with_prefix(), make_return_statement(), make_scalar_communication_module(), make_scalar_communication_modules(), make_scalar_entity(), make_scalar_integer_entity(), make_transition_statement(), make_unstructured_from_forloop(), make_unstructured_from_loop(), make_unstructured_from_test(), make_unstructured_from_whileloop(), make_variable_from_name_and_entity(), missing_file_initializer(), module_loops(), module_name_to_callees(), module_name_to_input_file_name(), module_name_to_preconditions(), module_name_to_total_preconditions(), module_name_to_transformers(), module_name_to_transformers_in_context(), module_to_all_declarations(), module_to_value_mappings(), mpi_conversion(), mpi_make_ctx(), mpi_task_generation(), new_controlizer(), new_label_local_name(), normalize_microcode(), old__gpu_ify(), old_array_bound_check_instrumentation(), old_summary_precondition(), omp_loop_parallel_threshold_set(), omp_merge_pragma(), open_module(), openmp_task_generation(), optimize_expressions(), ordinary_summary_precondition(), out_alias_pairs(), outline(), outliner_independent(), outliner_independent_recursively(), parallel_loop_tiling(), parsed_symbol_table(), partial_eval(), phrase_comEngine_distributor(), phrase_distributor(), phrase_distributor_control_code(), phrase_distributor_init(), phrase_remove_dependences(), pocc_prettyprinter(), pragma_outliner(), preconditions_inter_fast(), preconditions_inter_full(), preconditions_inter_full_with_points_to(), preconditions_intra(), preconditions_intra_fast(), prepend_comment(), prgm_mapping(), print_alias_classes(), print_alias_lists(), print_aliases(), print_any_reductions(), print_array_dfg(), print_bdt(), print_c_code(), print_call_graph(), print_call_graph_with_complexities(), print_call_graph_with_preconditions(), print_call_graph_with_total_preconditions(), print_call_graph_with_transformers(), print_code_comp_regions(), print_code_complementary_sections(), print_code_complexities(), print_code_continuation_conditions(), print_code_cumulated_reductions(), print_code_or_source_comp(), print_code_points_to(), print_code_points_to_list(), print_code_preconditions(), print_code_proper_reductions(), print_code_semantics(), print_code_simple_gen_kill_pointer_values(), print_code_simple_pointer_values(), print_code_smalltalk(), print_code_static_control(), print_code_total_preconditions(), print_code_transformers(), print_code_with_comp_regions(), print_continuation_conditions(), print_crough(), print_decorated_call_graph(), print_icfg(), print_icfg_with_control(), print_icfg_with_loops(), print_in_alias_pairs(), print_interface(), print_loopnest_dependence_cone(), print_loops(), print_module_icfg(), print_module_name_to_toposorts(), print_out_alias_pairs(), print_parallelizedHPF_code(), print_plc(), print_sesam_tasks_buffers_header(), print_source_comp_regions(), print_source_complexities(), print_source_continuation_conditions(), print_source_preconditions(), print_source_total_preconditions(), print_source_transformers(), print_xml_application(), print_xml_application_main(), print_xml_application_main_with_points_to(), print_xml_application_with_points_to(), print_xml_code(), print_xml_code_with_explicit_motif(), proper_reductions(), redeclaration_enter_statement(), reduction_atomization(), redundant_load_store_elimination(), refine_transformers(), refine_transformers_with_points_to(), region_chains(), regions_to_loops(), remove_common_variables_from_hash_table(), rename_operator(), reset_convex_in_out_regions(), reset_convex_prettyprint(), reset_convex_rw_regions(), reset_convex_summary_in_out_regions(), reset_convex_summary_rw_regions(), rstream_interface(), run_inlining(), safe_apply_outside_the_notifyer(), safescale_distributor(), safescale_distributor_init(), safescale_module_analysis(), scalopify(), scalopragma(), select_a_module_by_default(), select_module_from_status_menu_callback(), sequence_dependence_graph(), sesam_buffers_processing(), sesam_servers_processing(), sesamify(), set_control_to_label(), set_effects(), set_loop_execution_parallel(), set_resources_for_module(), simd_operator_mappings(), simd_treematcher(), simdizer_auto_tile(), simdizer_init(), simple_pointer_values(), simple_xpath_test(), simplify_complex(), simplify_constant_address_expressions(), simplify_subscripts(), solve_hardware_constraints(), spaghettify(), spaghettify_forloop(), spaghettify_loop(), spaghettify_statement(), spaghettify_test(), spaghettify_whileloop(), spire_distributed_unstructured_to_structured(), spire_shared_unstructured_to_structured(), split_initializations(), split_structures(), split_update_operator(), statement_flatten_declarations(), statement_insertion(), statement_insertion_fix_access_in_callers(), step_analyse(), step_analyse_CHAINS_DG(), step_analyse_init(), step_analysed_module_p(), step_compile(), step_compile_analysed_module(), step_compile_generated_module(), step_directives_init(), step_directives_save(), step_install(), step_parser(), store_new_module(), string_to_callees(), string_to_entity(), summary_complementary_sections(), summary_complexity(), summary_precondition(), summary_reductions(), summary_total_postcondition(), summary_total_precondition(), summary_transformer(), symbol_table(), symbolic_tiling(), task_mapping(), taskify(), terapix_remove_divide(), terapix_warmup(), text_summary_complexity(), total_preconditions_inter(), total_preconditions_intra(), transformers_inter_fast(), transformers_inter_full(), transformers_inter_full_with_points_to(), transformers_intra_fast(), transformers_intra_full(), unfolding(), unfolding_simple(), uniform_complexities(), used_before_set(), variable_replication(), wpips_execute_and_display_something(), wpips_execute_and_display_something_from_alias(), wrap_call_argument(), wrap_kernel_argument(), xml_Application(), xml_Boxes(), xml_Task(), and xml_tasks().

+ Here is the call graph for this function:

◆ module_name_p()

bool module_name_p ( string  name)

Check if the given name is the name of a plain module and not of a compilation unit.

Argument "name" is supposed to be an internal name.

Parameters
nameame

Definition at line 73 of file entity_names.c.

73  {
74  return (!compilation_unit_p(name) && strstr(name, MODULE_SEP_STRING) == NULL);
75 }
bool compilation_unit_p(const char *module_name)
The names of PIPS entities carry information about their nature.
Definition: entity_names.c:56

References compilation_unit_p(), and MODULE_SEP_STRING.

+ Here is the call graph for this function:

◆ return_label_p()

bool return_label_p ( const char *  s)

Definition at line 272 of file entity_names.c.

273 {
274  return(return_local_label_name_p(local_name(s)+sizeof(LABEL_PREFIX)-1)) ;
275 }
bool return_local_label_name_p(const char *s)
Definition: entity_names.c:251

References LABEL_PREFIX, local_name(), and return_local_label_name_p().

Referenced by compact_list(), and entity_return_label_p().

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

◆ return_local_label_name_p()

bool return_local_label_name_p ( const char *  s)

Definition at line 251 of file entity_names.c.

252 {
253  return(strcmp(s, RETURN_LABEL_NAME) == 0);
254 }
#define RETURN_LABEL_NAME
Definition: naming-local.h:106

References RETURN_LABEL_NAME.

Referenced by return_label_p().

+ Here is the caller graph for this function:

◆ set_script_directory_name()

void set_script_directory_name ( string  dn)
Parameters
dnn

Definition at line 105 of file file_names.c.

106 {
108 }
char * strdup()

References script_directory_name, and strdup().

Referenced by parse_arguments().

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

◆ static_module_name_p()

bool static_module_name_p ( const char *  name)

Check if the given name is a static module name.

An entity is a static module if its name contains the FILE_SEP_STRING but the last one is not the last character of the name string

FI: I doubt this is true. Maybe if you're sure name is the name of a module?

Parameters
nameame

Definition at line 122 of file entity_names.c.

123 {
124  /* An entity is a static module if its name contains the FILE_SEP_STRING
125  but the last one is not the last character of the name string */
126  /* FI: I doubt this is true. Maybe if you're sure name is the name of a module? */
127  return (!compilation_unit_p(name) && strstr(name, FILE_SEP_STRING) != NULL);
128 }

References compilation_unit_p(), and FILE_SEP_STRING.

Referenced by CleanUpEntity(), local_name_to_top_level_entity(), module_entity_to_compilation_unit_entity(), static_module_p(), and string_to_callees().

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

◆ string_codefilename()

string string_codefilename ( const char *  s)

file_names.c

file_names.c

Definition at line 37 of file file_names.c.

38 {
40  s, SEQUENTIAL_CODE_EXT, NULL));
41 }

References concatenate(), MODULE_SEP_STRING, and TOP_LEVEL_MODULE_NAME.

Referenced by module_codefilename().

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

◆ string_entitiesfilename()

string string_entitiesfilename ( const char *  s)

Definition at line 87 of file file_names.c.

88 {
90  s, ENTITIES_EXT, NULL));
91 }

References concatenate(), MODULE_SEP_STRING, and TOP_LEVEL_MODULE_NAME.

Referenced by module_entitiesfilename().

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

◆ string_fortran_filename_p()

bool string_fortran_filename_p ( const char *  s)

Definition at line 55 of file file_names.c.

56 {
57  int fnl = strlen(s);
58  int sl = sizeof(SEQUENTIAL_FORTRAN_EXT)-1;
59  bool is_fortran = false;
60 
61  if(fnl<=sl)
62  is_fortran = false;
63  else
64  is_fortran = strcmp(SEQUENTIAL_FORTRAN_EXT, s+(fnl-sl))==0;
65 
66  return is_fortran;
67 }

◆ string_fortranfilename()

string string_fortranfilename ( const char *  s)

Definition at line 49 of file file_names.c.

50 {
52  s, SEQUENTIAL_FORTRAN_EXT, NULL));
53 }

References concatenate(), MODULE_SEP_STRING, and TOP_LEVEL_MODULE_NAME.

Referenced by module_fortranfilename().

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

◆ string_par_codefilename()

string string_par_codefilename ( const char *  s)

Definition at line 43 of file file_names.c.

44 {
46  s, PARALLEL_CODE_EXT, NULL));
47 }

References concatenate(), MODULE_SEP_STRING, and TOP_LEVEL_MODULE_NAME.

Referenced by module_par_codefilename().

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

◆ string_par_fortranfilename()

string string_par_fortranfilename ( const char *  s)

Definition at line 69 of file file_names.c.

70 {
72  s, PARALLEL_FORTRAN_EXT, NULL));
73 }

References concatenate(), MODULE_SEP_STRING, and TOP_LEVEL_MODULE_NAME.

Referenced by module_par_fortranfilename().

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

◆ string_pp_fortranfilename()

string string_pp_fortranfilename ( const char *  s)

Definition at line 75 of file file_names.c.

76 {
78  s, PRETTYPRINT_FORTRAN_EXT, NULL));
79 }

References concatenate(), MODULE_SEP_STRING, and TOP_LEVEL_MODULE_NAME.

Referenced by module_pp_fortranfilename().

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

◆ string_predicat_fortranfilename()

string string_predicat_fortranfilename ( const char *  s)

Definition at line 81 of file file_names.c.

82 {
84  s, PREDICAT_FORTRAN_EXT, NULL));
85 }

References concatenate(), MODULE_SEP_STRING, and TOP_LEVEL_MODULE_NAME.

Referenced by module_predicat_fortranfilename().

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