25 #include "pips_config.h"
35 #include "resources.h"
41 #define src(name, suf) \
42 strdup(concatenate(WORKSPACE_SRC_SPACE "/", name, suf, NULL))
125 for (i=1, n=1; i<=len; i++,
POP(lp))
209 for(i=1; i<=len; i++)
220 for(dim=1; dim<=ndim; dim++)
225 (le,
module, arg,
false, dim, next++);
227 (le,
module, arg,
true, dim, next++);
253 debug_on(
"PRETTYPRINT_DEBUG_LEVEL");
272 debug(3,
"init_host_and_node_entities",
312 debug_on(
"PRETTYPRINT_DEBUG_LEVEL");
313 pips_debug(3,
"new declarations - node_module:\n");
319 pips_debug(3,
"new declarations - host_module:\n");
334 fprintf(
f,
"!\n! File %s\n! This file has been automatically generated "
335 "by the HPF compiler\n!\n",
base);
372 " include \"hpfc_commons.h\"\n"
373 " include \"hpfc_includes.h\"\n"
399 debug_on(
"PRETTYPRINT_DEBUG_LEVEL");
414 #define full_name(dir, name) concatenate(dir, "/", name, NULL)
419 FILE *host_file, *node_file, *parm_file, *init_file;
420 string host_name, node_name, parm_name, init_name, dir_name;
421 entity node_common, host_common;
452 fprintf(stderr,
"-----------------\n");
471 string file_name, h_name, dir_name, fs, ft;
495 string file_name, hn_name, dir_name, fs, ft;
521 FILE *host_file, *node_file, *parm_file, *init_file;
523 string host_name, node_name, parm_name, init_name, dir_name;
550 fprintf(stderr,
"Result of HPFC for module %s:\n",
552 fprintf(stderr,
"-----------------\n");
569 FILE *comm_file, *init_file;
570 string comm,
init, dir_name;
587 fprintf(stderr,
"Results of HPFC for the program\n");
588 fprintf(stderr,
"-----------------\n");
646 error_reset_c_stmt_stack();
695 for (v=vin; v; v=v->
succ)
796 pips_debug(3,
"considering reference to %s[%zd]\n",
803 pips_debug(3,
"considering on dim. %d:\n", dim);
902 fprintf(stderr,
"[debug_ref_rwt] reference to %s\n",
static void node(FILE *out, string name)
Build for module name a node and link to its successors.
static string current_module
void free_normalized(normalized p)
execution make_execution(enum execution_utype tag, void *val)
normalized make_normalized(enum normalized_utype tag, void *val)
parameter make_parameter(type a1, mode a2, dummy a3)
loop make_loop(entity a1, range a2, statement a3, entity a4, execution a5, list a6)
language make_language_fortran(void)
type make_type_variable(variable _field_)
mode make_mode_reference(void)
basic copy_basic(basic p)
BASIC.
storage make_storage(enum storage_utype tag, void *val)
expression copy_expression(expression p)
EXPRESSION.
reference make_reference(entity a1, list a2)
variable make_variable(basic a1, list a2, list a3)
void free_storage(storage p)
syntax make_syntax(enum syntax_utype tag, void *val)
dummy make_dummy_unknown(void)
bool entity_consistent_p(entity p)
range make_range(expression a1, expression a2, expression a3)
formal make_formal(entity a1, intptr_t a2)
bdt base
Current expression.
entity host_module
HPFC - Fabien Coelho, May 1993 and later...
#define newgen_Pvecteur(p)
void hpfc_print_file(string file_name)
void hpfc_print_common(FILE *file, entity module, entity common)
void reset_prettyprinter_common_hook(void)
text text_declaration(entity module)
exported for hpfc.
effects load_cumulated_references(statement)
statement_effects get_rw_effects(void)
list proper_effects_of_expression(expression)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_write_p(eff)
#define effect_variable(e)
For COMPATIBILITY purpose only - DO NOT USE anymore.
bool store_effect_p(effect)
#define STATEMENT_EFFECTS_MAP(k, v, c, f)
#define effects_effects(x)
const char * module_name(const char *s)
Return the module part of an entity name.
void atomize_as_required(statement, bool(*)(reference, expression), bool(*)(call, expression), bool(*)(test, expression), bool(*)(range, expression), bool(*)(whileloop, expression), entity(*)(entity, basic))
void safe_copy(char *source, char *target)
FILE * safe_fopen(const char *filename, const char *what)
int safe_fclose(FILE *stream, const char *filename)
char * pips_basename(char *fullpath, char *suffix)
#define gen_recurse(start, domain_number, flt, rwt)
statement instruction_to_statement(instruction)
Build a statement from a give instruction.
entity get_current_module_entity(void)
Get the entity of the current module.
void gen_multi_recurse(void *o,...)
Multi recursion visitor function.
void gen_null(__attribute__((unused)) void *unused)
Ignore the argument.
bool gen_false2(__attribute__((unused)) gen_chunk *u1, __attribute__((unused)) void *u2)
bool gen_true(__attribute__((unused)) gen_chunk *unused)
Return true and ignore the argument.
#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)
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
bool gen_in_list_p(const void *vo, const list lx)
tell whether vo belongs to lx
#define FOREACH(_fe_CASTER, _fe_item, _fe_list)
Apply/map an instruction block on all the elements of a list.
void * gen_find_eq(const void *item, const list seq)
#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_insert_after(const void *no, const void *o, list l)
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
void store_new_node_variable(entity new, entity old)
void store_new_host_node_variable(entity neh, entity nen, entity old)
void store_new_host_variable(entity new, entity old)
void AddEntityToHostAndNodeModules(entity e)
AddEntityToHostAndNodeModules.
void AddCommonToHostAndNodeModules(entity common)
bool ith_dim_distributed_p(entity array, int i, int *pprocdim)
whether a dimension is distributed or not.
bool ref_to_dist_array_p(void *obj)
this file describe a few functions usefull to the compiler to manage the hpfc data structures.
bool ith_dim_overlapable_p(entity array, int i)
void make_host_and_node_modules(entity module)
compile.c
#define src(name, suf)
HPFC by Fabien Coelho, May 1993 and later...
void NormalizeCodeForHpfc(statement s)
#define full_name(dir, name)
static void drop_distributed_arguments(entity module)
kind of a quick hack to remove distributed arguments for the host
static bool vect_in_p(Pvecteur vin, Pvecteur vref)
returns if vin is in vref
static void extract_distributed_non_constant_terms(statement s)
transformation: DOALL I,J ...
void NormalizeCommonVariables(entity module, statement stat)
void put_generated_resources_for_common(entity common)
void debug_print_referenced_entities(void *obj)
static entity create_bound_entity(entity module, entity array, bool upper, int dim, int number)
static bool invariant_expression_p(expression e, list loe, list le)
true if no written effect on any variables of e in loe
void hpfc_print_code(FILE *file, entity module, statement stat)
void update_common_references_in_regions()
void init_host_and_node_entities()
both host and node modules are initialized with the same declarations than the compiled module,...
static void add_bound_arguments(entity module)
for the node
static bool expression_simple_nondist_p(expression e)
drivers for atomize_as_required in transformations
static bool loop_flt(loop l)
void put_generated_resources_for_program(_UNUSED_ string program_name)
static bool expression_flt(expression e)
static bool hpfc_decision(reference r, expression e)
break expression e in reference r if ...
static bool test_atomization(test t, _UNUSED_ expression e)
void hpfc_compile_error_handler()
void compile_a_special_io_function(entity module)
just copied for the host
entity hpfc_new_variable(entity module, basic b)
void put_generated_resources_for_module(_UNUSED_ statement stat, statement host_stat, statement node_stat)
static string hpfc_head_hook(entity m)
to be used by the prettyprinter at the head of a file.
FILE * hpfc_fopen(string name)
static entity subs_v
substitute all occurences of expression e in statement s by variable v
void hpfcompile(const char *module_name)
Compiler call, obsole.
static void substitute_and_create(statement s, entity v, expression e)
static void debug_ref_rwt(reference r)
static void update_loop_rewrite(loop l)
static list add_one_bound_argument(list lp, entity module, entity array, bool upper, int dim, int formal_number)
void compile_a_pure_function(entity module)
simply copied for both host and node...
void hpfc_fclose(FILE *f, string name)
static string hpfc_common_hook(entity module, entity common)
to be used by the prettyprinter when dealing with a common.
void update_common_references_in_obj(void *obj)
static void update_common_rewrite(reference r)
To manage the common entities, I decided arbitrarilly that all commons will have to be declared exact...
static const char * old_name(entity module, entity obj)
old name of obj while in module now.
void NewDeclarationsOfDistributedArrays()
this procedure generate the new declarations of every distributed arrays of the program,...
#define HOST_SUFFIX
File suffixes.
#define GLOBAL_PARAMETERS_H
file names to be generated
#define NO_FILE
fake resources...
#define DEBUG_STAT(D, W, S)
#define update_functional_as_model(e, model)
#define HOST_NAME
Constants.
void add_a_common(entity c)
HPFC module by Fabien COELHO.
void store_entity_update_common(entity, entity)
entity load_entity_update_common(entity)
entity load_old_node(entity)
entity load_new_node(entity)
void create_init_common_param_for_arrays(FILE *, entity)
void create_parameters_h(FILE *, entity)
create_parameters_h
entity argument_bound_entity(entity, entity, bool, int)
void create_init_common_param(FILE *)
create_init_common_param (templates and modules)
void create_common_parameters_h(FILE *)
inits.c
bool bound_new_node_p(entity)
entity load_new_host(entity)
entity load_old_host(entity)
bool array_distributed_p(entity)
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
#define pips_internal_error
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
#define MODULE_SEP_STRING
#define message_assert(msg, ex)
string concatenate(const char *,...)
Return the concatenation of the given strings.
#define GENERIC_CURRENT_MAPPING(name, result, type)
#define DEFINE_LOCAL_STACK(name, type)
void * gen_find_tabulated(const char *, int)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
void normalize_all_expressions_of(void *obj)
#define db_get_file_resource
string db_get_current_workspace_directory(void)
void print_expression(expression e)
no file descriptor is passed to make is easier to use in a debugging stage.
void reset_prettyprinter_head_hook()
void set_prettyprinter_head_hook(string(*f)(entity))
text text_module(entity, statement)
void set_prettyprinter_common_hook(string(*)(entity, entity))
declarations2.c
static const char * prefix
#define entity_declarations(e)
MISC: newgen shorthands.
#define loop_to_instruction
bool entity_special_area_p(entity e)
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...
code entity_code(entity e)
entity AddEntityToModule(entity e, entity module)
!!! caution, it may not be a module, but a common...
entity make_empty_subroutine(const char *name, language l)
bool entity_main_module_p(entity e)
bool entity_function_p(entity e)
entity entity_empty_label(void)
static int init
Maximal value set for Fortran 77.
const char * module_local_name(entity e)
Returns the module local user name.
bool entity_in_common_p(entity e)
bool expression_linear_p(expression e)
returns if e is already normalized and linear.
bool expression_integer_constant_p(expression e)
bool expression_equal_p(expression e1, expression e2)
Syntactic equality e1==e2.
expression int_to_expression(_int i)
transform an int into an expression and generate the corresponding entity if necessary; it is not cle...
bool expression_reference_p(expression e)
Test if an expression is a reference.
basic MakeBasic(int)
END_EOLE.
entity make_new_scalar_variable(entity, basic)
void AddEntityToDeclarations(entity, entity)
END_EOLE.
void AddEntityToCurrentModule(entity)
Add a variable entity to the current module declarations.
int NumberOfDimension(entity)
entity find_or_create_scalar_entity(const char *, const char *, tag)
Looks for an entity which should be a scalar of the specified basic.
entity find_ith_parameter(entity, int)
#define type_functional_p(x)
#define normalized_linear_(x)
#define expression_domain
newgen_execution_domain_defined
#define loop_execution(x)
#define syntax_reference(x)
#define reference_variable(x)
#define loop_domain
newgen_language_domain_defined
#define type_functional(x)
#define entity_storage(x)
#define statement_domain
newgen_sizeofexpression_domain_defined
#define code_declarations(x)
#define storage_formal(x)
#define EXPRESSION(x)
EXPRESSION.
#define entity_undefined_p(x)
#define reference_domain
newgen_range_domain_defined
#define execution_sequential_p(x)
#define value_symbolic_p(x)
#define expression_normalized(x)
#define functional_parameters(x)
#define PARAMETER(x)
PARAMETER.
#define reference_indices(x)
#define statement_instruction(x)
#define normalized_linear(x)
#define expression_syntax(x)
#define type_variable_p(x)
#define entity_domain
newgen_syntax_domain_defined
#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.
void print_text(FILE *fd, text t)
struct Svecteur * Pvecteur
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2)
Pvecteur vect_substract(Pvecteur v1, Pvecteur v2): allocation d'un vecteur v dont la valeur est la di...
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...