PIPS
|
#include <stdio.h>
#include <string.h>
#include <setjmp.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "database.h"
#include "ri-util.h"
#include "effects-util.h"
#include "misc.h"
#include "text.h"
#include "effects-generic.h"
#include "effects-convex.h"
#include "semantics.h"
#include "transformer.h"
#include "pipsdbm.h"
#include "dg.h"
#include "graph.h"
Go to the source code of this file.
Macros | |
#define | BACKWARD true |
#define | FORWARD false |
Typedefs | |
typedef dg_arc_label | arc_label |
Instantiation of the dependence graph: More... | |
typedef dg_vertex_label | vertex_label |
Functions | |
static Pbase | make_base_phi_variables (region reg) |
creation of a Pbase containing just the PHI variables of the region More... | |
static region | restrict_to_phi_constraints (region reg) |
strips from the region all the constraints which do not affect (even transitively) the PHI variables i.e. More... | |
static region | convert_exact_to_exact_may (region reg) |
"convert" EXACT regions to exact representations of MAY-in-the-usual-dataflow-sense regions More... | |
static region | approx_convert_may_to_approx_may (region reg) |
all MAY regions are "converted" to over-approximate representations of MAY-in-the-usual-dataflow-sense regions (some regions may in fact be precise representations of MAY-in-the-usual-dataflow-sense regions after this operation, but we cannot detect which) More... | |
static region | approx_convert (region reg) |
takes EXACT (i.e. More... | |
static bool | stmt_filter (statement s) |
modifies global var current_caller_stmt More... | |
static void | add_parameter_aliases_for_this_call_site (call call_site __attribute__((unused)), transformer context, list real_args) |
static void add_parameter_aliases_for_this_call_site(call call_site, transformer context, list real_args) constructs the alias pairs for the effective parameters (but not for COMMON regions) at this call site and adds them to the list input : parameters: a call site and the calling context global variables: callee,list_regions_callee,list_pairs output : void global vars IN: list_regions_callee and list_pairs modifies : global var list_pairs for each region in list_regions_callee which is a region of a formal parameter (of the callee) and for which the corresponding real parameter is an expression with only one entity, this function performs the backward translation: callee_region -> real_region and adds an alias pair <callee_region,real_region> to list_pairs comment : More... | |
static bool | add_alias_pairs_for_this_call_site (call call_site) |
constructs the alias pairs for this call site and adds them to the list global vars IN: callee, list_regions_callee, current_caller_stmt and list_pairs modifies global var: list_pairs More... | |
static void | add_alias_pairs_for_this_caller (entity caller) |
constructs the alias pairs for this caller and adds them to the list global vars IN: callee, list_regions_callee and list_pairs modifies global vars: list_pairs and current_caller_stmt More... | |
static list | alias_pairs (const char *module_name, list l_reg) |
generic function (i.e. More... | |
bool | in_alias_pairs (const string module_name) |
top-level creation of pairs of aliases of IN regions of the module modifies global vars callee, list_regions_callee, list_pairs and current_caller_stmt More... | |
bool | out_alias_pairs (const char *module_name) |
top-level creation of pairs of aliases of OUT regions of the module modifies global vars callee, list_regions_callee, list_pairs and current_caller_stmt More... | |
Variables | |
static entity | callee |
static list | list_regions_callee = NIL |
static statement | current_caller_stmt = statement_undefined |
static list | list_pairs = NIL |
#define BACKWARD true |
Definition at line 58 of file alias_pairs.c.
#define FORWARD false |
Definition at line 59 of file alias_pairs.c.
typedef dg_arc_label arc_label |
Instantiation of the dependence graph:
Definition at line 53 of file alias_pairs.c.
typedef dg_vertex_label vertex_label |
Definition at line 54 of file alias_pairs.c.
constructs the alias pairs for this call site and adds them to the list global vars IN: callee, list_regions_callee, current_caller_stmt and list_pairs modifies global var: list_pairs
pips_debug(9, "try load_statement_precondition for statement %03d\n", statement_number(current_caller_stmt));
transformer_to_string no longer implemented
pips_debug(9,"got context:\n\t%s\n",transformer_to_string(context));
pips_debug(9,"try call_arguments\n");
pips_debug(9,"try set_interprocedural_translation_context_sc\n"); pips_debug(9,"\tfor callee %s\n",entity_name(callee));
pips_debug(9,"try set_backward_arguments_to_eliminate\n");
add_common_aliases_for_this_call_site();
Definition at line 392 of file alias_pairs.c.
References add_parameter_aliases_for_this_call_site(), call_arguments, call_function, callee, current_caller_stmt, load_statement_precondition(), pips_debug, reset_arguments_to_eliminate(), reset_translation_context_sc(), set_backward_arguments_to_eliminate(), and set_interprocedural_translation_context_sc().
Referenced by add_alias_pairs_for_this_caller().
|
static |
constructs the alias pairs for this caller and adds them to the list global vars IN: callee, list_regions_callee and list_pairs modifies global vars: list_pairs and current_caller_stmt
ATTENTION: we must do ALL this before calling set_interprocedural_translation_context_sc (in add_alias_pairs_for_this_call_site called by the gen_multi_recurse below) !!!
the current module becomes the caller
that's it, but we musn't forget to reset it all again below !
gen_multi_recurse(obj, [domain, filter, rewrite,]* NULL);
recurse from object obj, applies filter_i on encountered domain_i objects, if true, recurses down from the domain_i object, and applies rewrite_i on exit from the object.
Definition at line 441 of file alias_pairs.c.
References add_alias_pairs_for_this_call_site(), call_domain, callee, caller_name, db_get_memory_resource(), free_value_mappings(), gen_multi_recurse(), gen_null(), get_current_module_statement(), get_in_out_regions_properties(), module_local_name(), module_to_value_mappings(), pips_debug, regions_end(), regions_init(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_precondition_map(), reset_proper_rw_effects(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_precondition_map(), set_proper_rw_effects(), statement_domain, and stmt_filter().
Referenced by alias_pairs().
|
static |
static void add_parameter_aliases_for_this_call_site(call call_site, transformer context, list real_args) constructs the alias pairs for the effective parameters (but not for COMMON regions) at this call site and adds them to the list input : parameters: a call site and the calling context global variables: callee,list_regions_callee,list_pairs output : void global vars IN: list_regions_callee and list_pairs modifies : global var list_pairs for each region in list_regions_callee which is a region of a formal parameter (of the callee) and for which the corresponding real parameter is an expression with only one entity, this function performs the backward translation: callee_region -> real_region and adds an alias pair <callee_region,real_region> to list_pairs comment :
let list_regions_callee be the list of the regions on variables of callee let list_pairs be the list of alias pairs for the callee
FOR each expression real_exp IN real_args arg_num = number in the list of the function real arguments FOR each callee_region IN list_regions_callee callee_ent = entity of the region callee_region IF callee_ent is the formal parameter numbered arg_num IF real_exp is an lhs (expression with one entity) real_region = translation of the region callee_region list_pairs = list_pairs + <callee_region,real_region> ENDIF ENDIF ENDFOR ENDFOR
real_args = call_arguments(call_site);
entity callee_ent = region_entity(callee_region);
If the formal parameter corresponds to the real argument then we perform the translation.
If the real argument is a reference to an entity, then we translate the regions of the corresponding formal parameter
the actual parameter must be expressed relative to the store at the point of entry of the caller, so that it can be compared to other regions
convert actual and formal regions to MAY-in-the-usual-dataflow-sense
gave Newgen error formal = approx_convert(callee_region);
Definition at line 270 of file alias_pairs.c.
References approx_convert(), BACKWARD, callee, CAR, CDR, CONS, convex_regions_transformer_compose(), EFFECT, EFFECTS, entity_name, EXPRESSION, expression_syntax, get_current_module_entity(), ifdebug, ith_parameter_p(), list_pairs, list_regions_callee, make_effects(), MAP, NIL, pips_debug, print_inout_regions(), reference_undefined, reference_variable, region, region_dup(), region_entity, region_translation(), syntax_reference, syntax_reference_p, and VALUE_ZERO.
Referenced by add_alias_pairs_for_this_call_site().
generic function (i.e.
used for IN and OUT regions) for constructing the list of alias pairs for this module parameters: module name and list of regions global vars IN: none modifies global vars: callee, list_regions_callee, current_caller_stmt and list_pairs
ATTENTION: we have to do ALL this just to call print_inout_regions for debug !!
that's it, but we musn't forget to reset everything below
we need the callers of the current module
we scan the callers to find the call sites, and fill in the list of alias pairs (list_pairs)
Definition at line 517 of file alias_pairs.c.
References add_alias_pairs_for_this_caller(), callee, callees_callees, caller_name, db_get_memory_resource(), free_value_mappings(), get_current_module_entity(), ifdebug, list_pairs, list_regions_callee, local_name_to_top_level_entity(), MAP, module_name(), module_to_value_mappings(), NIL, pips_debug, print_inout_regions(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_proper_rw_effects(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_proper_rw_effects(), and STRING.
Referenced by in_alias_pairs(), and out_alias_pairs().
takes EXACT (i.e.
precise representations of MUST in the usual dataflow sense) and MAY (i.e. over-approximate representations of MUST regions or either over-approximate or precise representations of MAY-in-the-usual-dataflow-sense) regions and "converts" them to exact or over-approximate representations of MAY-in-the-usual-dataflow-sense) regions by stripping all the constraints which do not affect (even transitively) the PHI variables
Definition at line 191 of file alias_pairs.c.
References approx_convert_may_to_approx_may(), convert_exact_to_exact_may(), effect_approximation_tag, effect_exact_p, effect_may_p, is_approximation_exact, pips_debug, region, and region_scalar_p.
Referenced by add_parameter_aliases_for_this_call_site().
all MAY regions are "converted" to over-approximate representations of MAY-in-the-usual-dataflow-sense regions (some regions may in fact be precise representations of MAY-in-the-usual-dataflow-sense regions after this operation, but we cannot detect which)
Definition at line 166 of file alias_pairs.c.
References effect_approximation_tag, is_approximation_may, pips_debug, region, and restrict_to_phi_constraints().
Referenced by approx_convert().
"convert" EXACT regions to exact representations of MAY-in-the-usual-dataflow-sense regions
Definition at line 145 of file alias_pairs.c.
References effect_approximation_tag, is_approximation_exact, pips_debug, region, and restrict_to_phi_constraints().
Referenced by approx_convert().
top-level creation of pairs of aliases of IN regions of the module modifies global vars callee, list_regions_callee, list_pairs and current_caller_stmt
cproto-generated files
we need the IN summary regions
was (but didn't work) l_reg = (list) db_get_memory_resource(DBR_IN_SUMMARY_REGIONS, module_name, true);
module_name | odule_name |
Definition at line 587 of file alias_pairs.c.
References alias_pairs(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, effects_to_list(), make_effects_classes(), module_name(), pips_debug, and strdup().
Referenced by alias_lists().
creation of a Pbase containing just the PHI variables of the region
Definition at line 70 of file alias_pairs.c.
References base_add_variable(), BASE_NULLE, entity_local_name(), EXPRESSION, expression_syntax, indices, MAP, pips_debug, reference_indices, reference_variable, region_any_reference, syntax_reference, and variable_phi_p.
Referenced by restrict_to_phi_constraints().
bool out_alias_pairs | ( | const char * | module_name | ) |
top-level creation of pairs of aliases of OUT regions of the module modifies global vars callee, list_regions_callee, list_pairs and current_caller_stmt
we need the OUT summary regions
was (but didn't work) l_reg = (list) db_get_memory_resource(DBR_OUT_SUMMARY_REGIONS, module_name, true);
module_name | odule_name |
Definition at line 623 of file alias_pairs.c.
References alias_pairs(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, effects_to_list(), make_effects_classes(), module_name(), pips_debug, and strdup().
Referenced by alias_lists().
strips from the region all the constraints which do not affect (even transitively) the PHI variables i.e.
the function representing the region no longer returns the empty region if a branch condition is not satisfied so the region becomes MAY-in-the-usual-dataflow-sense
Definition at line 106 of file alias_pairs.c.
References ACTION_IN, ACTION_OUT, ifdebug, make_base_phi_variables(), pips_debug, print_region, region, region_dup(), region_system, reset_action_interpretation(), sc_restricted_to_variables_transitive_closure(), and set_action_interpretation().
Referenced by approx_convert_may_to_approx_may(), and convert_exact_to_exact_may().
modifies global var current_caller_stmt
Definition at line 222 of file alias_pairs.c.
References current_caller_stmt, pips_debug, and statement_number.
Referenced by add_alias_pairs_for_this_caller(), and drop_dummy_loops().
|
static |
Definition at line 62 of file alias_pairs.c.
Referenced by add_alias_pairs_for_this_call_site(), add_alias_pairs_for_this_caller(), add_parameter_aliases_for_this_call_site(), alias_pairs(), c_convex_effects_on_actual_parameter_forward_translation(), call_site_to_module_precondition_text(), common_region_translation(), convex_regions_forward_translation(), convex_regions_translation_init(), copy_from_call(), copy_to_call(), do_gpu_qualify_pointers(), fetch_callees_complexities(), inline_expression(), inline_expression_call(), inline_has_inlinable_calls_crawler(), inline_should_inline(), interprocedural_mapping(), live_out_paths_from_caller_to_callee(), live_out_summary_paths_engine(), main_summary_precondition(), ordinary_summary_precondition(), out_regions_from_caller_to_callee(), precondition_intra_to_inter(), set_live_out_summary_engine_context(), summary_precondition(), summary_total_postcondition(), and update_precondition_with_call_site_preconditions().
|
static |
Definition at line 64 of file alias_pairs.c.
Referenced by add_alias_pairs_for_this_call_site(), and stmt_filter().
Definition at line 65 of file alias_pairs.c.
Referenced by add_parameter_aliases_for_this_call_site(), and alias_pairs().
Definition at line 63 of file alias_pairs.c.
Referenced by add_parameter_aliases_for_this_call_site(), and alias_pairs().