25 #include "pips_config.h"
56 #define min(a,b) (((a)<(b))?(a):(b))
57 #define max(a,b) (((a)>(b))?(a):(b))
88 le = (*fortran_effects_backward_translation_op)(
callee, real_args, l_sum_eff,
97 c_address_of_actual_argument_to_may_summary_effects(
expression arg1,
105 (arg1, &l_real_arg_eff,
true);
119 if(!
ENDP(last_ind)) {
127 bool field_p =
false;
137 (*effect_change_ith_dimension_expression_func)
138 (real_arg_eff, n_exp,
183 pips_debug(6,
"actual argument %s, with type %s, and type depth %d\n",
187 if (real_arg_t_d == 0)
189 pips_debug(6,
"actual argument is a constant expression -> NIL\n");
218 l_res = c_address_of_actual_argument_to_may_summary_effects(arg1, act);
228 pips_debug(5,
"general call, reference or subscript case \n");
230 (real_arg, &l_real_arg_eff,
true);
293 (*effects_precondition_composition_op)(l_res,
context,
false);
299 pips_debug(6,
"end, resulting effects are :\n");
300 (*effects_prettyprint_func)(l_res);
306 static void remove_current_element_from_effect_list(
list * l_begin,
list *l_current,
list l_prec)
308 if (*l_begin == *l_current)
310 *l_current =
CDR(*l_current);
313 *l_begin = *l_current;
317 CDR(l_prec) =
CDR(*l_current);
320 *l_current =
CDR(l_prec);
324 static void skip_current_element_from_effect_list(
list *l_current,
list * l_prec)
326 *l_prec = *l_current;
327 *l_current =
CDR(*l_current);
353 bool param_varargs_p =
false;
365 (*effects_prettyprint_func)(l_sum_eff);
371 (*effects_translation_init_func)(
callee, real_args,
true);
378 while(!
ENDP(l_current))
398 effect n_eff = (*effect_dup_func)(eff);
399 (*effect_descriptor_interprocedural_translation_op)(n_eff);
409 (*effect_descriptor_interprocedural_translation_op)(n_effect);
423 effect n_eff = (*effect_dup_func)(eff);
427 (*effect_descriptor_interprocedural_translation_op)(n_eff);
431 remove_current_element_from_effect_list(&l_begin, &l_current, l_prec);
434 skip_current_element_from_effect_list(&l_current, &l_prec);
440 pips_debug(5,
"translated global effects :\n");
441 (*effects_prettyprint_func)(l_eff);
443 (*effects_prettyprint_func)(l_begin);
448 for (ra = real_args, arg_num = 1; !
ENDP(ra); ra =
CDR(ra), arg_num++)
453 bool spurious_real_arg_p =
false;
457 if (!param_varargs_p)
459 if(
ENDP(formal_args)) {
463 spurious_real_arg_p =
true;
480 else if (!spurious_real_arg_p)
482 list l_eff_on_current_formal =
NIL;
486 pips_debug(5,
"corresponding formal argument :%s\n",
495 while(!
ENDP(l_current))
503 bool exact_p =
false;
513 pips_debug(5,
"effect on the value of the formal parameter -> skipped\n");
521 remove_current_element_from_effect_list(&l_begin, &l_current, l_prec);
524 skip_current_element_from_effect_list(&l_current, &l_prec);
530 pips_debug(5,
"effects on current formal argument:\n");
531 (*effects_prettyprint_func)(l_eff_on_current_formal);
551 if (!
ENDP( l_eff_on_current_formal))
562 (l_eff_on_current_formal, real_arg,
context));
568 "incompatible with type of formal parameter, "
569 "\"%s\", for precise interprocedural effect "
574 bool write_p =
false;
581 tag t = write_p ? (read_p ?
'x' :
'w') :
'r';
623 (*effects_translation_end_func)();
628 (*effects_prettyprint_func)(l_eff);
642 list r_args = real_args;
650 (*effects_prettyprint_func)(l_eff);
656 (*effects_translation_init_func)(
callee, real_args,
false);
678 effect eff_tmp = (*effect_dup_func)(eff);
682 (*effect_descriptor_interprocedural_translation_op)(eff_tmp);
692 for (arg_num = 1; !
ENDP(r_args); r_args =
CDR(r_args), arg_num++)
719 (*effects_translation_end_func)();
762 el = (*fortran_effects_forward_translation_op)(
callee, real_args,
771 static void effect_translate_fields(
effect eff)
776 if (!
ENDP(l_indices))
783 while(!
ENDP(l_indices))
802 if (!
ENDP(l_indices))
807 pips_debug(8,
"pointer case, poping one dimension\n");
829 pips_debug(8,
"struct, union or enum case\n");
831 pips_assert(
"current index must be a field entity",
842 while(!found && !
ENDP(l_current_fields))
844 current_field =
ENTITY(
CAR(l_current_fields));
857 POP(l_current_fields);
879 pips_debug(8,
"source name: %s, target name %s\n",
880 source_cu_name, target_cu_name);
890 effect_translate_fields(eff);
void free_expression(expression p)
bool entity_stub_sink_p(entity e)
test if an entity is a stub sink for a formal parameter e.g.
void const char const char const int
string compilation_unit_of_module(const char *)
The output is undefined if the module is referenced but not defined in the workspace,...
int dummy
A dummy file, to prevent empty libraries from breaking builds.
effect substitute_stubs_in_convex_array_region(effect, bool, set)
#define pips_debug_effects(level, message, l_eff)
#define pips_debug_effect(level, message, eff)
for debug
list generic_proper_effects_of_complex_address_expression(expression, list *, int)
bool effects_private_current_context_empty_p(void)
void effects_to_may_effects(list)
transformer effects_private_current_context_head(void)
list generic_c_effects_forward_translation(entity, list, list, transformer)
list(* c_effects_on_formal_parameter_backward_translation_func)(list, expression, transformer)
list generic_effects_forward_translation(entity, list, list, transformer)
list generic_fortran_effects_backward_translation(entity, list, list, transformer)
interprocedural.c
list generic_effects_backward_translation(entity, list, list, transformer)
bool effects_private_current_context_stack_initialized_p(void)
list generic_proper_effects_of_c_function_call_argument(expression)
list effect_to_effects_with_given_tag(effect, tag)
list backward_translation_of_points_to_formal_context_effect(entity, list, effect, set)
list generic_c_effects_backward_translation(entity, list, list, transformer)
list c_actual_argument_to_may_summary_effects(expression, tag)
list generic_effect_generate_all_accessible_paths_effects_with_level(effect, type, tag, bool, int, bool)
set safe_user_call_to_points_to_interprocedural_binding_set(entity, list)
void effects_translate_fields_compilation_unit(list, string, string)
list(* c_effects_on_actual_parameter_forward_translation_func)(entity, expression, entity, list, transformer)
#define effect_any_reference(e)
FI: cannot be used as a left hand side.
#define effect_write_p(eff)
#define effect_read_p(eff)
#define effect_scalar_p(eff) entity_scalar_p(effect_entity(eff))
bool effect_reference_dereferencing_p(reference, bool *)
entity effect_entity(effect)
cproto-generated files
type points_to_expression_to_concrete_type(expression)
The type returned is stored in a hash-table.
bool anywhere_effect_p(effect)
Is it an anywhere effect? ANYMMODULE:ANYWHERE
bool types_compatible_for_effects_interprocedural_translation_p(type, type)
tests if the actual argument type and the formal argument type are compatible with the current state ...
#define descriptor_convex_p(x)
#define effect_descriptor(x)
entity get_current_module_entity(void)
Get the entity of the current module.
#define ENDP(l)
Test if a list is empty.
#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
list gen_last(list l)
Return the last element of a 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 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
#define same_string_p(s1, s2)
#define set_undefined_p(s)
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
void print_expressions(list le)
string expression_to_string(expression e)
string type_to_full_string_definition(type)
type.c
#define ENTITY_ASSIGN_P(e)
#define ENTITY_ADDRESS_OF_P(e)
bool dynamic_area_p(entity aire)
bool stack_area_p(entity aire)
bool heap_area_p(entity aire)
const char * entity_user_name(entity e)
Since entity_local_name may contain PIPS special characters such as prefixes (label,...
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_array_p(entity e)
Is e a variable with an array type?
bool same_entity_p(entity e1, entity e2)
predicates on entities
bool entity_field_p(entity e)
e is the field of a structure
bool parameter_passing_by_reference_p(entity f)
entity find_ith_formal_parameter(entity the_fnct, int rank)
This function gives back the ith formal parameter, which is found in the declarations of a call or a ...
expression make_unbounded_expression()
bool expression_reference_p(expression e)
Test if an expression is a reference.
bool unbounded_expression_p(expression e)
reference expression_reference(expression e)
Short cut, meaningful only if expression_reference_p(e) holds.
int effect_type_depth(type)
Number of steps to access the lowest leave of type t.
type expression_to_type(expression)
For an array declared as int a[10][20], the type returned for a[i] is int [20].
bool global_variable_p(entity)
Is v a global variable such as "int i;".
type entity_basic_concrete_type(entity)
retrieves or computes and then returns the basic concrete type of an entity
bool formal_parameter_p(entity)
bool ith_parameter_p(entity, entity, int)
returns true if v is the ith formal parameter of function f
string type_to_string(const type)
type.c
#define dummy_identifier(x)
#define transformer_undefined
#define transformer_undefined_p(x)
#define parameter_dummy(x)
#define parameter_type(x)
#define reference_variable(x)
#define SIZEOFEXPRESSION(x)
SIZEOFEXPRESSION.
#define sizeofexpression_expression(x)
#define type_functional(x)
#define entity_storage(x)
@ is_syntax_sizeofexpression
#define EXPRESSION(x)
EXPRESSION.
#define cast_expression(x)
#define dummy_unknown_p(x)
#define functional_parameters(x)
#define PARAMETER(x)
PARAMETER.
#define reference_indices(x)
#define type_varargs_p(x)
#define variable_dimensions(x)
#define call_arguments(x)
#define expression_syntax(x)
#define variable_basic(x)
#define semantics_user_warning
FI: I do not understand why the type is duplicated at the set level.
The structure used to build lists in NewGen.
#define exp
Avoid some warnings from "gcc -Wshadow".