PIPS
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "dg.h"
#include "graph.h"
#include "ri-util.h"
#include "prettyprint.h"
#include "effects-util.h"
#include "text-util.h"
#include "database.h"
#include "misc.h"
#include "pipsdbm.h"
#include "resources.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "properties.h"
#include "expressions-local.h"
#include "expressions.h"
#include "ricedg.h"
Go to the source code of this file.
Data Structures | |
struct | t_substitution |
structure to hold a substitution to be performed forward. More... | |
struct | s_p_s |
Typedefs | |
typedef dg_arc_label | arc_label |
typedef dg_vertex_label | vertex_label |
typedef struct t_substitution * | p_substitution |
Functions | |
static p_substitution | make_substitution (statement source, reference ref, expression val) |
newgen-looking make/free More... | |
static void | free_substitution (p_substitution subs) |
static bool | no_write_effects_on_var (entity var, list le) |
static bool | functionnal_on_effects (reference ref, list le) |
static bool | functionnal_on (reference ref, statement s) |
returns whether there is other write proper effect than on var or if some variable conflicting with var is read... More... | |
static p_substitution | substitution_candidate (statement s, bool only_scalar) |
Whether it is a candidate of a substitution operation. More... | |
static bool | cool_enough_for_a_last_substitution (statement s) |
x = a(i) ; a(j) = x ; More... | |
static bool | other_cool_enough_for_a_last_substitution (statement s, reference ref) |
s = r ; s = s + w ; // read THEN write... More... | |
static void | perform_substitution_in_expression (expression e, p_substitution subs) |
do perform the substitution var -> val everywhere in s More... | |
static bool | call_flt (call c, p_substitution subs) |
static void | perform_substitution (p_substitution subs, void *s) |
static void | perform_substitution_in_assign (p_substitution subs, statement s) |
static bool | some_conflicts_between (hash_table successors, statement s1, statement s2, p_substitution sub) |
whether there are some conflicts between s1 and s2 according to successor table successors More... | |
static bool | do_substitute (statement anext, struct s_p_s *param) |
static bool | fs_filter (statement stat, graph dg) |
top-down forward substitution of reference in SEQUENCE only. More... | |
bool | forward_substitute (const char *module_name) |
interface to pipsmake. More... | |
typedef dg_arc_label arc_label |
Definition at line 60 of file forward_substitution.c.
typedef struct t_substitution * p_substitution |
typedef dg_vertex_label vertex_label |
Definition at line 61 of file forward_substitution.c.
|
static |
Definition at line 302 of file forward_substitution.c.
References ASSIGN_OPERATOR_NAME, binary_call_lhs, call_function, entity_intrinsic(), entity_undefined_p, expression_reference(), expression_reference_p(), gen_recurse_stop(), t_substitution::ref, reference_equal_p(), same_entity_p(), and update_operator_to_regular_operator().
Referenced by perform_substitution().
x = a(i) ; a(j) = x ;
we can substitute x but it cannot be continued. just a hack for this very case at the time. maybe englobing parallel loops or dependence information could be use for a better decision? I'll think about it on request only.
Definition at line 220 of file forward_substitution.c.
References free_substitution(), ok, substitution_candidate(), and x.
Referenced by do_substitute().
for some special case the substitution is performed. in some cases effects should be updated?
now STOP propagation!
Definition at line 389 of file forward_substitution.c.
References cool_enough_for_a_last_substitution(), gen_recurse_stop(), ifdebug, other_cool_enough_for_a_last_substitution(), perform_substitution(), perform_substitution_in_assign(), pips_debug, print_statement(), some_conflicts_between(), and statement_block_p.
Referenced by fs_filter().
bool forward_substitute | ( | const char * | module_name | ) |
interface to pipsmake.
should have proper and cumulated effects...
set require resources.
do the job here:
return result and clean.
module_name | odule_name |
Definition at line 470 of file forward_substitution.c.
References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, dg, fs_filter(), gen_context_recurse, gen_null2(), get_current_module_statement(), local_name_to_top_level_entity(), module_name(), reset_cumulated_rw_effects(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_proper_rw_effects(), set_cumulated_rw_effects(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), set_proper_rw_effects(), and statement_domain.
|
static |
Definition at line 126 of file forward_substitution.c.
References free(), free_expression(), and t_substitution::val.
Referenced by cool_enough_for_a_last_substitution(), and fs_filter().
top-down forward substitution of reference in SEQUENCE only.
scan following statements and substitute while no conflicts.
Definition at line 423 of file forward_substitution.c.
References assignment_statement_p(), CAR, CDR, dg, do_substitute(), ENDP, FOREACH, free_substitution(), gen_context_recurse, gen_null2(), get_bool_property(), hash_table_free(), ifdebug, make_instruction_block(), NIL, pips_debug, POP, print_statement(), STATEMENT, statement_block(), statement_block_p, statement_domain, statements_to_successors(), s_p_s::subs, substitution_candidate(), successors(), and update_statement_instruction().
Referenced by forward_substitute().
returns whether there is other write proper effect than on var or if some variable conflicting with var is read...
(?) proper_effects must be available.
Definition at line 158 of file forward_substitution.c.
References effects_consistent_p(), effects_effects, functionnal_on_effects(), ifdebug, load_proper_rw_effects(), pips_assert, and ref.
Referenced by substitution_candidate().
le | of effect |
Definition at line 143 of file forward_substitution.c.
References action_kind_store_p, EFFECT, effect_action_kind(), effect_read_p, effect_variable, effect_write_p, entities_may_conflict_p(), FOREACH, ref, and reference_variable.
Referenced by functionnal_on().
|
static |
newgen-looking make/free
Definition at line 96 of file forward_substitution.c.
References basic_equal_p(), basic_of_expression(), basic_of_reference(), basic_to_generic_conversion(), basic_undefined_p, copy_expression(), entity_undefined_p, free(), free_basic(), MakeUnaryCall(), malloc(), pips_assert, pips_user_warning, t_substitution::ref, ref, t_substitution::source, and t_substitution::val.
Referenced by substitution_candidate().
Definition at line 134 of file forward_substitution.c.
References action_kind_store_p, EFFECT, effect_action_kind(), effect_variable, effect_write_p, entities_may_conflict_p(), and FOREACH.
Referenced by other_cool_enough_for_a_last_substitution().
s = r ; s = s + w ; // read THEN write...
it is an assignment
Definition at line 231 of file forward_substitution.c.
References call_arguments, call_function, CAR, CDR, ENTITY_ASSIGN_P, entity_scalar_p(), EXPRESSION, expression_syntax, gen_full_free_list(), gen_length(), instruction_call, instruction_call_p, no_write_effects_on_var(), pips_assert, proper_effects_of_expression(), ref, reference_variable, statement_instruction, syntax_reference, and syntax_reference_p.
Referenced by do_substitute().
|
static |
s | substitution to perform where to do this |
Definition at line 316 of file forward_substitution.c.
References call_domain, call_flt(), expression_domain, gen_context_multi_recurse(), gen_null(), gen_true(), perform_substitution_in_expression(), and unnormalize_expression().
Referenced by do_substitute(), and perform_substitution_in_assign().
|
static |
special case
Definition at line 328 of file forward_substitution.c.
References binary_call_lhs, binary_call_rhs, EXPRESSION, expression_reference(), FOREACH, perform_substitution(), pips_assert, reference_indices, statement_call(), and statement_call_p().
Referenced by do_substitute().
|
static |
do perform the substitution var -> val everywhere in s
FI->FC: the syntax may be freed but not always the reference it contains because it can also be used in effects. The bug showed on transformations/Validation/fs01.f, fs02.f, fs04.f. I do not know why the effects are still used after the statement has been updated (?). The bug can be avoided by closing and opening the workspace which generates independent references in statements and in effects. Is there a link with the notion of cell = reference+preference?
Definition at line 265 of file forward_substitution.c.
References copy_syntax(), expression_syntax, expression_to_string(), ifdebug, pips_debug, print_reference(), t_substitution::ref, reference_equal_p(), reference_to_string(), syntax_reference, syntax_reference_p, syntax_undefined, update_expression_syntax(), and t_substitution::val.
Referenced by perform_substitution().
|
static |
whether there are some conflicts between s1 and s2 according to successor table successors
if there is a write-* conflict, we cannot do much
this case is safe
Definition at line 343 of file forward_substitution.c.
References action_kind_store_p, CONFLICT, conflict_sink, conflict_source, dg_arc_label_conflicts, effect_action_kind(), effect_any_reference, effect_write_p, ENDP, FOREACH, hash_get(), ifdebug, pips_assert, pips_debug, print_reference(), print_statement(), reference_indices, s1, statement_in_statement_p(), SUCCESSOR, successor_arc_label, successor_vertex, successors(), and vertex_to_statement().
Referenced by do_substitute().
|
static |
Whether it is a candidate of a substitution operation.
that is: (1) it is a call (2) it is an assignment call (3) the assigned variable is a scalar (sg: no longer true !) (4) there are no side effects in the expression
Note: a substitution candidate might be one after substitutions... but not before? So effects should be recomputed? or updated? eg: x = 1; x = x + 1;
of expression
CALL
ASSIGN
NO SIDE EFFECTS
Definition at line 179 of file forward_substitution.c.
References call_arguments, call_function, CAR, CDR, ENTITY_ASSIGN_P, EXPRESSION, expression_syntax, functionnal_on(), gen_length(), instruction_call, instruction_call_p, make_substitution(), pips_assert, ref, statement_instruction, syntax_reference, and syntax_reference_p.
Referenced by cool_enough_for_a_last_substitution(), and fs_filter().