PIPS
|
#include "defines-local.h"
#include "pipsdbm.h"
#include "workspace-util.h"
#include "prettyprint.h"
#include "resources.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "effects-convex.h"
#include "expressions.h"
Go to the source code of this file.
Macros | |
#define | src(name, suf) strdup(concatenate(WORKSPACE_SRC_SPACE "/", name, suf, NULL)) |
HPFC by Fabien Coelho, May 1993 and later... More... | |
#define | full_name(dir, name) concatenate(dir, "/", name, NULL) |
Functions | |
void | make_host_and_node_modules (entity module) |
compile.c More... | |
static void | drop_distributed_arguments (entity module) |
kind of a quick hack to remove distributed arguments for the host More... | |
static entity | create_bound_entity (entity module, entity array, bool upper, int dim, int number) |
static list | add_one_bound_argument (list lp, entity module, entity array, bool upper, int dim, int formal_number) |
static void | add_bound_arguments (entity module) |
for the node More... | |
void | init_host_and_node_entities () |
both host and node modules are initialized with the same declarations than the compiled module, but the distributed arrays declarations... More... | |
FILE * | hpfc_fopen (string name) |
void | hpfc_fclose (FILE *f, string name) |
static const char * | old_name (entity module, entity obj) |
old name of obj while in module now. More... | |
static string | hpfc_head_hook (entity m) |
to be used by the prettyprinter at the head of a file. More... | |
static string | hpfc_common_hook (entity module, entity common) |
to be used by the prettyprinter when dealing with a common. More... | |
void | hpfc_print_code (FILE *file, entity module, statement stat) |
void | put_generated_resources_for_common (entity common) |
void | compile_a_special_io_function (entity module) |
just copied for the host More... | |
void | compile_a_pure_function (entity module) |
simply copied for both host and node... More... | |
void | put_generated_resources_for_module (_UNUSED_ statement stat, statement host_stat, statement node_stat) |
void | put_generated_resources_for_program (_UNUSED_ string program_name) |
void | hpfcompile (const char *module_name) |
Compiler call, obsole. More... | |
static bool | expression_simple_nondist_p (expression e) |
drivers for atomize_as_required in transformations More... | |
static bool | hpfc_decision (reference r, expression e) |
break expression e in reference r if ... More... | |
entity | hpfc_new_variable (entity module, basic b) |
void | hpfc_compile_error_handler () |
static bool | invariant_expression_p (expression e, list loe, list le) |
true if no written effect on any variables of e in loe More... | |
static bool | vect_in_p (Pvecteur vin, Pvecteur vref) |
returns if vin is in vref More... | |
static bool | expression_flt (expression e) |
static void | substitute_and_create (statement s, entity v, expression e) |
static bool | loop_flt (loop l) |
static void | extract_distributed_non_constant_terms (statement s) |
transformation: DOALL I,J ... More... | |
static bool | test_atomization (test t, _UNUSED_ expression e) |
void | NormalizeCodeForHpfc (statement s) |
static void | update_common_rewrite (reference r) |
To manage the common entities, I decided arbitrarilly that all commons will have to be declared exactly the same way (name and so), so I can safely unify the entities among the modules. More... | |
static void | update_loop_rewrite (loop l) |
static void | debug_ref_rwt (reference r) |
void | debug_print_referenced_entities (void *obj) |
void | update_common_references_in_obj (void *obj) |
void | update_common_references_in_regions () |
void | NormalizeCommonVariables (entity module, statement stat) |
Variables | |
static entity | subs_v |
substitute all occurences of expression e in statement s by variable v More... | |
static expression | subs_e |
static Pvecteur | subs_pv |
#define full_name | ( | dir, | |
name | |||
) | concatenate(dir, "/", name, NULL) |
#define src | ( | name, | |
suf | |||
) | strdup(concatenate(WORKSPACE_SRC_SPACE "/", name, suf, NULL)) |
|
static |
for the node
of parameter
Definition at line 196 of file compile.c.
References add_one_bound_argument(), array_distributed_p(), entity_name, entity_type, f(), find_ith_parameter(), functional_parameters, gen_length(), gen_nconc(), ith_dim_overlapable_p(), load_old_node(), message_assert, module, NIL, NumberOfDimension(), pips_debug, type_functional, and type_functional_p.
Referenced by init_host_and_node_entities().
|
static |
lp | of parameter |
Definition at line 177 of file compile.c.
References array, CONS, create_bound_entity(), is_basic_int, make_dummy_unknown(), make_mode_reference(), make_parameter(), make_type_variable(), make_variable(), MakeBasic(), module, NIL, and PARAMETER.
Referenced by add_bound_arguments().
void compile_a_pure_function | ( | entity | module | ) |
simply copied for both host and node...
module | odule |
Definition at line 493 of file compile.c.
References BOTH_SUFFIX, concatenate(), db_get_current_workspace_directory(), db_get_file_resource, DB_PUT_FILE_RESOURCE, entity_name, file_name, free(), module, module_local_name(), NO_FILE, pips_debug, prefix, safe_copy(), src, and strdup().
Referenced by hpfc_compile().
void compile_a_special_io_function | ( | entity | module | ) |
just copied for the host
module | odule |
Definition at line 469 of file compile.c.
References concatenate(), db_get_current_workspace_directory(), db_get_file_resource, DB_PUT_FILE_RESOURCE, file_name, free(), HOST_SUFFIX, module, module_local_name(), NO_FILE, prefix, safe_copy(), src, and strdup().
Referenced by hpfc_compile().
|
static |
Definition at line 153 of file compile.c.
References AddEntityToDeclarations(), argument_bound_entity(), array, entity_name, entity_storage, entity_type, free_storage(), is_storage_formal, make_formal(), make_storage(), module, pips_assert, pips_debug, and type_variable_p.
Referenced by add_one_bound_argument().
void debug_print_referenced_entities | ( | void * | obj | ) |
obj | bj |
Definition at line 906 of file compile.c.
References debug_ref_rwt(), gen_multi_recurse(), gen_true(), and reference_domain.
Referenced by update_common_references_in_obj().
|
static |
Definition at line 897 of file compile.c.
References entity_in_common_p(), entity_name, fprintf(), and reference_variable.
Referenced by debug_print_referenced_entities().
|
static |
kind of a quick hack to remove distributed arguments for the host
of the host
of parameter
number of next kept parameter
Definition at line 111 of file compile.c.
References array_distributed_p(), CAR, CONS, entity_name, entity_storage, entity_type, entity_undefined_p, f(), find_ith_parameter(), formal_offset, functional_parameters, gen_free_list(), gen_length(), gen_nreverse(), message_assert, module, NIL, PARAMETER, pips_debug, POP, storage_formal, type_functional, and type_functional_p.
Referenced by init_host_and_node_entities().
|
static |
does sg about the linearization of the expression
??? memory leak, but how to deal with effect references?
Definition at line 709 of file compile.c.
References expression_equal_p(), expression_linear_p(), expression_normalized, expression_syntax, free_normalized(), is_normalized_linear, is_syntax_reference, make_normalized(), make_reference(), make_syntax(), newgen_Pvecteur, NIL, normalized_linear, normalized_linear_, subs_e, subs_pv, subs_v, VALUE_ONE, vect_add_elem(), vect_in_p(), vect_new(), vect_rm(), and vect_substract().
Referenced by substitute_and_create().
|
static |
drivers for atomize_as_required in transformations
Definition at line 614 of file compile.c.
References array_distributed_p(), ENDP, expression_reference_p(), expression_syntax, reference_indices, reference_variable, and syntax_reference.
Referenced by hpfc_decision().
|
static |
transformation: DOALL I,J ...
A(I,J,e) -> DOALL E=e,e,1 ,I,J A(I,J,E)
Definition at line 826 of file compile.c.
References DEBUG_STAT, gen_multi_recurse(), gen_null(), loop_domain, loop_flt(), and statement_domain.
Referenced by NormalizeCodeForHpfc().
to be used by the prettyprinter when dealing with a common.
inclusion of the parameters and commons...
old_name(module, common);
Definition at line 381 of file compile.c.
References concatenate(), HINC_SUFFIX, host_module, module, module_local_name(), NINC_SUFFIX, PARM_SUFFIX, and strdup().
Referenced by hpfc_print_code().
void hpfc_compile_error_handler | ( | void | ) |
Definition at line 644 of file compile.c.
Referenced by hpfc_error_handler().
|
static |
break expression e in reference r if ...
Definition at line 625 of file compile.c.
References array_distributed_p(), expression_integer_constant_p(), expression_simple_nondist_p(), and reference_variable.
Referenced by NormalizeCodeForHpfc().
void hpfc_fclose | ( | FILE * | f, |
string | name | ||
) |
name | ame |
Definition at line 341 of file compile.c.
References base, f(), fprintf(), free(), pips_basename(), and safe_fclose().
Referenced by generate_hpf_remapping_file(), put_generated_resources_for_common(), put_generated_resources_for_module(), and put_generated_resources_for_program().
FILE* hpfc_fopen | ( | string | name | ) |
name | ame |
Definition at line 329 of file compile.c.
References base, f(), fprintf(), free(), pips_basename(), and safe_fopen().
Referenced by generate_hpf_remapping_file(), put_generated_resources_for_common(), put_generated_resources_for_module(), and put_generated_resources_for_program().
to be used by the prettyprinter at the head of a file.
inclusion of needed runtime headers. module
Definition at line 366 of file compile.c.
References concatenate(), GLOBAL_PARAMETERS_H, old_name(), PARM_SUFFIX, and strdup().
Referenced by hpfc_print_code().
module | odule |
Definition at line 632 of file compile.c.
References AddEntityToCurrentModule(), copy_basic(), make_new_scalar_variable(), and module.
Referenced by extract_lattice(), generate_copy_loop_nest(), loop_flt(), and NormalizeCodeForHpfc().
file | ile |
module | odule |
stat | tat |
Definition at line 393 of file compile.c.
References debug_off, debug_on, free_text(), hpfc_common_hook(), hpfc_head_hook(), module, print_text(), reset_prettyprinter_common_hook(), reset_prettyprinter_head_hook(), set_prettyprinter_common_hook(), set_prettyprinter_head_hook(), and text_module().
Referenced by put_generated_resources_for_module().
void hpfcompile | ( | const char * | module_name | ) |
Compiler call, obsole.
left here for allowing linking
module_name | odule_name |
Definition at line 601 of file compile.c.
References debug_off, debug_on, module_name(), pips_debug, and pips_internal_error.
void init_host_and_node_entities | ( | void | ) |
both host and node modules are initialized with the same declarations than the compiled module, but the distributed arrays declarations...
which are not declared in the case of the host_module, and the declarations of which are modified in the node_module (call to NewDeclarationsOfDistributedArrays)...
First, the commons are updated
COMMONS
Then, the other entities
parameters are selected. I think they may be either functional of variable (if declared...) FC 15/09/93
VARIABLES
PARAMETERS
Definition at line 246 of file compile.c.
References add_a_common(), add_bound_arguments(), AddCommonToHostAndNodeModules(), AddEntityToDeclarations(), AddEntityToHostAndNodeModules(), current_module, debug(), debug_off, debug_on, drop_distributed_arguments(), ENTITY, entity_consistent_p(), entity_declarations, entity_initial, entity_name, entity_special_area_p(), entity_storage, entity_type, free_text(), get_current_module_entity(), host_module, ifdebug, load_new_host(), load_new_node(), MAP, NewDeclarationsOfDistributedArrays(), node_module, pips_debug, print_text(), storage_rom_p, text_declaration(), type_area_p, type_functional_p, type_variable_p, and value_symbolic_p.
Referenced by compile_module().
|
static |
true if no written effect on any variables of e in loe
of effect
loe | of effect |
le | of entity |
Definition at line 651 of file compile.c.
References EFFECT, effect_variable, effect_write_p, FOREACH, gen_free_list(), gen_in_list_p(), ifdebug, pips_debug, print_expression(), proper_effects_of_expression(), and store_effect_p().
Referenced by loop_flt().
of effect
of entity
Definition at line 772 of file compile.c.
References array_distributed_p(), CONS, EFFECT, effect_any_reference, effect_write_p, effects_effects, ENTITY, entity_name, execution_sequential_p, EXPRESSION, expression_integer_constant_p(), FOREACH, gen_length(), get_current_module_entity(), hpfc_new_variable(), ifdebug, invariant_expression_p(), is_basic_int, ith_dim_distributed_p(), load_cumulated_references(), loop_execution, MakeBasic(), NIL, pips_debug, print_expression(), reference_indices, reference_variable, store_effect_p(), substitute_and_create(), and x.
Referenced by extract_distributed_non_constant_terms().
void make_host_and_node_modules | ( | entity | module | ) |
compile.c
HOST and NODE empty routines...
Arity and result
then the variable corresponding to the function name must be created for those new functions. The overloaded basic is used to be sure that the variable will not be put in the declarations by the enforced coherency. ??? this issue could be managed by the coherency function ?
to allow the update of the call sites.
module | odule |
Definition at line 45 of file compile.c.
References bound_new_node_p(), concatenate(), entity_domain, entity_function_p(), entity_local_name(), entity_main_module_p(), entity_undefined_p, find_or_create_scalar_entity(), free(), gen_find_tabulated(), HOST_NAME, is_basic_overloaded, make_empty_subroutine(), make_language_fortran(), module, MODULE_SEP_STRING, node(), NODE_NAME, pips_assert, store_new_host_node_variable(), store_new_host_variable(), store_new_node_variable(), strdup(), and update_functional_as_model.
Referenced by compile_module().
void NormalizeCodeForHpfc | ( | statement | s | ) |
reference test
function call test
test condition test
range test
whileloop test
Definition at line 848 of file compile.c.
References atomize_as_required(), extract_distributed_non_constant_terms(), gen_false2(), hpfc_decision(), hpfc_new_variable(), normalize_all_expressions_of(), and test_atomization().
Referenced by compile_module().
the new entities for the common variables are created and inserted in the common. The declarations are updated.
the references within the program are updated with the new entities
module | odule |
stat | tat |
Definition at line 940 of file compile.c.
References AddEntityToModule(), area_layout, code_declarations, CONS, ENTITY, entity_code(), entity_in_common_p(), entity_name, entity_storage, entity_type, entity_undefined, gen_find_eq(), gen_free_list(), gen_insert_after(), MAP, module, NIL, pips_debug, ram_section, storage_ram, store_entity_update_common(), type_area, and update_common_references_in_obj().
Referenced by hpfc_directives_handler().
old name of obj while in module now.
obj
obj | module in which obj appears |
Definition at line 354 of file compile.c.
References host_module, load_old_host(), load_old_node(), module, and module_local_name().
Referenced by hpfc_head_hook(), make_new_index_entity(), and make_tile_index_entity_n().
void put_generated_resources_for_common | ( | entity | common | ) |
common | ommon |
Definition at line 417 of file compile.c.
References create_init_common_param_for_arrays(), create_parameters_h(), db_get_current_workspace_directory(), entity_name, fprintf(), free(), full_name, HINC_SUFFIX, host_module, hpfc_fclose(), hpfc_fopen(), hpfc_print_common(), hpfc_print_file(), ifdebug, INIT_SUFFIX, load_new_host(), load_new_node(), module_local_name(), NINC_SUFFIX, node_module, PARM_SUFFIX, prefix, and src.
Referenced by compile_common().
void put_generated_resources_for_module | ( | _UNUSED_ statement | stat, |
statement | host_stat, | ||
statement | node_stat | ||
) |
Definition at line 516 of file compile.c.
References create_init_common_param_for_arrays(), create_parameters_h(), db_get_current_workspace_directory(), DB_PUT_FILE_RESOURCE, fprintf(), full_name, get_current_module_entity(), host_module, HOST_SUFFIX, hpfc_fclose(), hpfc_fopen(), hpfc_print_code(), hpfc_print_file(), ifdebug, INIT_SUFFIX, module, module_local_name(), node_module, NODE_SUFFIX, PARM_SUFFIX, prefix, and src.
Referenced by compile_module().
Definition at line 567 of file compile.c.
References create_common_parameters_h(), create_init_common_param(), db_get_current_workspace_directory(), fprintf(), free(), full_name, GLOBAL_INIT_H, GLOBAL_PARAMETERS_H, hpfc_fclose(), hpfc_fopen(), hpfc_print_file(), ifdebug, init, and src.
Referenced by hpfc_close().
|
static |
the copy is reused!
Definition at line 739 of file compile.c.
References copy_expression(), entity_empty_label(), entity_name, expression_domain, expression_flt(), expression_linear_p(), expression_normalized, gen_null(), gen_recurse, ifdebug, instruction_to_statement(), int_to_expression(), is_execution_parallel, loop_to_instruction, make_execution(), make_loop(), make_range(), NIL, normalized_linear, pips_debug, print_expression(), statement_instruction, subs_e, subs_pv, subs_v, UU, vect_dup(), and vect_rm().
Referenced by loop_flt().
|
static |
Definition at line 841 of file compile.c.
References ref_to_dist_array_p().
Referenced by NormalizeCodeForHpfc().
void update_common_references_in_obj | ( | void * | obj | ) |
obj | bj |
Definition at line 911 of file compile.c.
References debug_print_referenced_entities(), gen_multi_recurse(), gen_true(), ifdebug, loop_domain, reference_domain, update_common_rewrite(), and update_loop_rewrite().
Referenced by NormalizeCommonVariables().
void update_common_references_in_regions | ( | void | ) |
Definition at line 921 of file compile.c.
References EFFECT, effect_any_reference, effects_effects, gen_length(), get_rw_effects(), MAP, pips_debug, STATEMENT_EFFECTS_MAP, and update_common_rewrite().
|
static |
To manage the common entities, I decided arbitrarilly that all commons will have to be declared exactly the same way (name and so), so I can safely unify the entities among the modules.
The rational for this stupid ugly transformation is that it is much easier to manage the common overlaps for instance if they are simply linked to the same entity.
??? very ugly, indeed.
Definition at line 875 of file compile.c.
References entity_name, entity_undefined_p, load_entity_update_common(), pips_debug, and reference_variable.
Referenced by update_common_references_in_obj(), and update_common_references_in_regions().
|
static |
Definition at line 887 of file compile.c.
References entity_undefined_p, load_entity_update_common(), and loop_index.
Referenced by update_common_references_in_obj().
returns if vin is in vref
Definition at line 691 of file compile.c.
References Svecteur::succ, value_ne, vect_coeff(), vecteur_val, vecteur_var, and x.
Referenced by expression_flt().
|
static |
Definition at line 686 of file compile.c.
Referenced by expression_flt(), and substitute_and_create().
|
static |
Definition at line 687 of file compile.c.
Referenced by expression_flt(), and substitute_and_create().
|
static |
substitute all occurences of expression e in statement s by variable v
Definition at line 685 of file compile.c.
Referenced by expression_flt(), and substitute_and_create().