25 #include "pips_config.h"
34 #include "constants.h"
54 #define ADD_WORD_LIST_TO_TEXT(t, l) ADD_WORD_LIST_TO_TEXT_WITH_MARGIN(t, l, 0)
55 #define ADD_WORD_LIST_TO_TEXT_WITH_MARGIN(t, l, m)\
56 if (!ENDP(l)) ADD_SENTENCE_TO_TEXT(t,\
57 make_sentence(is_sentence_unformatted, \
58 make_unformatted(NULL, 0, m, l)));
69 bool allocatable_pass_p,
74 if(allocatable_pass_p) {
130 result = offset1 - offset2;
165 int offset1, offset2;
166 Value size1, offset_end1;
178 pips_debug(1,
"equivalence class before sorting:\n");
187 pips_debug(1,
"equivalence class after sorting:\n");
222 if (offset1 == offset2)
226 if (first) lw =
CHAIN_SWORD(lw,
"EQUIVALENCE"), first =
false;
239 pips_assert(
"the equivalence class has been sorted\n",
247 pips_debug(1,
"second case: there is no overlap\n");
252 if (l1 == l2)
POP(l2);
263 int offset = offset2 - offset1;
276 "offset=%d, dim_max=%d, size_elt_1=%d\n",
279 if (first) lw =
CHAIN_SWORD(lw,
"EQUIVALENCE"), first =
false;
286 pips_assert(
"partial association case not implemented:\n"
287 "offset % size_elt_1 == 0",
293 while (current_dim <= dim_max)
309 "size=%d, rest=%d, offset=%d, lower_bound=%d\n",
314 if (current_dim < dim_max)
347 list equiv_classes =
NIL, l_tmp;
391 pips_debug(1,
"considering equivalence class:\n");
400 found_equiv_class = equiv_class;
438 equiv_classes =
CONS(
LIST, l_tmp, equiv_classes);
447 pips_debug(1,
"final equivalence classes:\n");
459 for(l_tmp = equiv_classes; !
ENDP(l_tmp);
POP(l_tmp))
469 return(t_equiv_class);
594 if (comma) pc =
CHAIN_SWORD(pc, space_p?
", " :
",");
655 pips_assert(
"The static initialization function is called",
698 pips_assert(
"Pseudo-intrinsic REPEAT-VALUE must have two arguments",
796 string dir, file, local;
824 fprintf(
f,
"!!\n!! pips: include file for common %s\n!!\n",
835 "!!\n!! pips: sorry, cannot include common %s\n!!\n",
865 static bool allocatable_pass_p =
false;
866 list allocatable_list = NULL;
871 bool pp_cinc =
same_string_p(how_common,
"include") && !force_common;
879 bool pp_in_type =
false, pp_in_common =
false;
902 indentation_words =
CHAIN_SWORD(indentation_words,
" ");
909 pp_in_type =
true, pp_in_common =
false;
911 pp_in_type =
false, pp_in_common =
true;
914 " unexpected value\n", pp_var_dim);
934 bool in_common = in_ram
958 }
else if (!print_commons && (area_p || (var && in_common && pp_cinc))) {
965 }
else if (external) {
975 pips_debug(7,
"considered as a regular common\n");
983 }
else if (var && !(in_common && pp_cinc)) {
1127 if(allocatable_pass_p) {
1129 "allocatable pass !! This should be impossible...\n");
1190 pp_cinc || !print_commons));
1204 if(!allocatable_pass_p && !
ENDP(allocatable_list)) {
1206 allocatable_pass_p =
true;
1208 allocatable_pass_p =
false;
unformatted make_unformatted(string a1, intptr_t a2, intptr_t a3, list a4)
sentence make_sentence(enum sentence_utype tag, void *val)
struct _newgen_struct_entity_ * entity
#define VALUE_TO_INT(val)
#define value_compare(v1, v2)
#define value_plus(v1, v2)
binary operators on values
void attach_declaration_type_to_words(list l, string declaration_type)
Attach a declaration type to all the words of the given list.
void attach_declaration_size_type_to_words(list l, string declaration_type, int size)
Attach a declaration type with its size to all the words of the given list.
bool vect_constant_p(Pvecteur)
bool vect_constant_p(Pvecteur v): v contains only a constant term, may be zero
static sentence sentence_f95use_declaration(entity e)
Create a sentence for a USE directive.
static sentence sentence_area(entity e, entity module, bool pp_dimensions, list *ppdl)
special management of empty commons added.
static string(* common_hook)(entity, entity)
static string default_common_hook(entity __attribute__((unused)) module, entity common)
We add this function to cope with the declaration When the user declare sth.
static int equivalent_entity_compare(entity *ent1, entity *ent2)
static int equivalent_entity_compare(entity *ent1, entity *ent2) input : two pointers on entities.
static text text_equivalences(entity __attribute__((unused)) module, list ldecl, bool no_commons)
input : the current module, and the list of declarations.
static void equiv_class_debug(list l_equiv)
static list f77_f95_style_management(list prev, string str, bool allocatable_pass_p, bool space_p)
This handle the fact that a Fortran95 declaration use "::" as a separator between type and variable n...
static text __attribute__((unused))
returns the DATA initializations.
#define EQUIV_DEBUG
debugging for equivalences
static text text_entity_declaration(entity module, list ldecl, bool force_common, list *ppdl)
This function compute the list of declaration at the begining of a module.
#define ADD_WORD_LIST_TO_TEXT(t, l)
To deal with declarations above ri-util and pipsdbm and text-util.
text text_initializations(entity m)
static sentence sentence_data_statement(statement is, list *ppdl)
Prettyprint the initializations field of code.
static sentence sentence_data(entity e)
why is it assumed that the constant is an int ???
static text text_equivalence_class(list l_equiv)
static text text_equivalence_class(list l_equiv) input : a list of entities representing an equivale...
void reset_prettyprinter_common_hook(void)
text text_common_declaration(entity common, entity module)
needed for hpfc
static text include(const char *file)
if the common is declared similarly in all routines, generate "include 'COMMON.h'",...
static sentence sentence_external(entity f)
static sentence sentence_symbolic(entity f, list *ppdl)
text text_declaration(entity module)
exported for hpfc.
static text text_area_included(entity common, entity module)
#define ADD_WORD_LIST_TO_TEXT_WITH_MARGIN(t, l, m)
static text text_of_parameters(list lp)
static sentence sentence_basic_declaration(entity e)
FILE * safe_fopen(const char *filename, const char *what)
bool file_exists_p(const char *name)
char * get_string_property(const char *)
int safe_fclose(FILE *stream, const char *filename)
bool get_bool_property(const string)
FC 2015-07-20: yuk, moved out to prevent an include cycle dependency include "properties....
#define ENDP(l)
Test if a list is empty.
list gen_nreverse(list cp)
reverse a list in place
#define POP(l)
Modify a list pointer to point on the next element of the list.
#define NIL
The empty list (nil in Lisp)
list gen_copy_seq(list l)
Copy a list structure.
size_t gen_length(const list l)
#define CONS(_t_, _i_, _l_)
List element cell constructor (insert an element at the beginning of a list)
list gen_nconc(list cp1, list cp2)
physically concatenates CP1 and CP2 but do not duplicates the elements
#define CAR(pcons)
Get the value of the first element of a list.
void gen_free_list(list l)
free the spine of the list
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
#define CDR(pcons)
Get the list less its first element.
#define list_undefined
Undefined list definition :-)
#define MAP(_map_CASTER, _map_item, _map_code, _map_list)
Apply/map an instruction block on all the elements of a list (old fashioned)
void gen_sort_list(list l, gen_cmp_func_t compare)
Sorts a list of gen_chunks in place, to avoid allocations...
bool empty_comments_p(const char *)
struct _newgen_struct_entities_ * entities
bool prettyprint_language_is_fortran95_p()
string db_get_directory_name_for_module(const char *name)
returns the allocated and mkdir'ed directory for module name
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_user_warning
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
#define BLANK_COMMON_LOCAL_NAME
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define same_string_p(s1, s2)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
#define WORKSPACE_SRC_SPACE
bool check_common_inclusion(entity common)
check whether a common declaration can be simply included, that is it is declared with the same names...
list words_declaration(entity e, bool prettyprint_common_variable_dimensions_p, list *ppdl)
some compilers don't like dimensions that are declared twice.
unsigned int get_prettyprint_indentation()
list words_expression(expression obj, list *ppdl)
This one is exported.
void set_prettyprinter_common_hook(string(*)(entity, entity))
declarations2.c
string basic_to_string(basic)
static hash_table pl
properties are stored in this hash table (string -> property) for fast accesses.
#define REPEAT_VALUE_NAME
#define binary_call_rhs(c)
#define NORMALIZE_EXPRESSION(e)
#define STATEMENT_NUMBER_UNDEFINED
default values
#define ENTITY_STATIC_INITIALIZATION_P(e)
Fortran DATA management.
#define binary_call_lhs(c)
#define ENTITY_DATA_LIST_P(e)
entity get_allocatable_data_entity(entity e)
Get the entity inside the struct corresponding to the array, mostly for correct prettyprint.
bool dynamic_area_p(entity aire)
bool pointer_dummy_targets_area_p(entity aire)
bool stack_area_p(entity aire)
bool heap_area_p(entity aire)
bool empty_static_area_p(entity e)
bool static_area_p(entity aire)
bool entity_special_area_p(entity e)
void check_fortran_declaration_dependencies(list ldecl)
Regeneration of declarations from the symbol table.
const char * entity_local_name(entity e)
entity_local_name modified so that it does not core when used in vect_fprint, since someone thought t...
bool entity_f95use_p(entity e)
code entity_code(entity e)
basic entity_basic(entity e)
return the basic associated to entity e if it's a function/variable/constant basic_undefined otherwis...
const char * module_local_name(entity e)
Returns the module local user name.
bool entity_module_p(entity e)
list common_members_of_module(entity common, entity module, bool only_primary)
returns the list of entity to appear in the common declaration.
bool expression_call_p(expression e)
int expression_to_int(expression exp)
================================================================
bool integer_constant_expression_p(expression e)
positive integer constant expression: call to a positive constant or to a sum of positive integer con...
bool formal_label_replacement_p(entity)
int SizeOfIthDimension(entity, int)
this function returns the size of the ith dimension of a variable e.
Value ValueSizeOfArray(entity)
bool variable_in_list_p(entity, list)
_int SizeOfElements(basic)
This function returns the length in bytes of the Fortran or C type represented by a basic,...
int NumberOfDimension(entity)
bool variable_static_p(entity)
true if v appears in a SAVE statement, or in a DATA statement, or is declared static i C.
#define type_functional_p(x)
#define value_undefined_p(x)
#define functional_result(x)
#define storage_formal_p(x)
#define value_constant(x)
#define type_functional(x)
#define value_unknown_p(x)
#define dimension_lower(x)
#define entity_storage(x)
#define code_declarations(x)
#define value_constant_p(x)
#define basic_overloaded_p(x)
#define value_symbolic(x)
#define basic_undefined_p(x)
#define EXPRESSION(x)
EXPRESSION.
#define constant_int_p(x)
#define expression_undefined
#define value_symbolic_p(x)
#define code_initializations(x)
#define sequence_statements(x)
#define instruction_call_p(x)
#define variable_dimensions(x)
#define statement_instruction(x)
#define statement_comments(x)
#define instruction_call(x)
#define call_arguments(x)
#define normalized_linear(x)
#define expression_syntax(x)
#define type_variable_p(x)
#define symbolic_expression(x)
#define variable_basic(x)
#define STATEMENT(x)
STATEMENT.
#define entity_initial(x)
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
The structure used to build lists in NewGen.
#define CHAIN_SWORD(l, s)
#define MERGE_TEXTS(r, t)
#define CHAIN_IWORD(l, i)
#define ADD_SENTENCE_TO_TEXT(t, p)
void print_text(FILE *fd, text t)
#define sentence_undefined
#define SENTENCE(x)
newgen_unformatted_domain_defined
#define unformatted_words(x)
@ is_sentence_unformatted