PIPS
|
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "boolean.h"
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "database.h"
#include "misc.h"
#include "text.h"
#include "text-util.h"
#include "ri-util.h"
#include "workspace-util.h"
#include "effects-util.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "pipsdbm.h"
#include "resources.h"
#include "control.h"
#include "conversion.h"
#include "properties.h"
#include "transformations.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
#include "ray_dte.h"
#include "sommet.h"
#include "sg.h"
#include "sc.h"
#include "polyedre.h"
#include "matrix.h"
#include "phrase.h"
#include "graph.h"
#include "paf_ri.h"
#include "constants.h"
#include "paf-util.h"
#include "static_controlize.h"
#include "pocc-interface.h"
#include "preprocessor.h"
#include "effects-convex.h"
#include "callgraph.h"
#include "accel-util.h"
#include "c_syntax.h"
#include "syntax.h"
#include "semantics.h"
#include "regions_to_loops.h"
Go to the source code of this file.
Functions | |
static void | filter_regions (list *l) |
tatic_control More... | |
statement | make_write_loopbody (entity v, expression exp, list vl) |
Makes the body of a "write" loop. More... | |
statement | make_read_loopbody (entity v, entity readVar, list vl) |
Makes the body of a "read" loop. More... | |
static statement | Psysteme_to_loop_nest (entity v, list vl, Pbase b, Psysteme p, bool isRead, entity readVar, expression exp, list l_var) |
Builds a loop from a Psysteme. More... | |
statement | region_to_loop_nest (region r, bool isRead, entity readVar, expression exp) |
Returns the entity corresponding to the global name. More... | |
expression | make_addition (expression e1, expression e2) |
Makes an addition expression from two expressions. More... | |
void | replace_indices_region (region r, list *dadd, int indNum, entity module) |
This function is in charge of replacing the PHI entity of the region by generated indices. More... | |
statement | make_sequence_from_statement_list (list l) |
Make a sequence from a statement list The equivalent of this function was already made somewhere else. More... | |
bool | regions_to_loops (char *module_name) |
This phase replaces the body of a function by automatically generated loops where the read and write statements are representative of the original function. More... | |
|
static |
tatic_control
Pips includes
Types arc_label and vertex_label must be defined although they are not used Filter the region list by removing irrelevant regions
Definition at line 77 of file regions_to_loops.c.
References descriptor_none_p, effect_any_reference, effect_descriptor, effect_region_p, FOREACH, gen_copy_seq(), gen_remove(), indices, NIL, and reference_indices.
Referenced by regions_to_loops().
expression make_addition | ( | expression | e1, |
expression | e2 | ||
) |
Makes an addition expression from two expressions.
e1 | 1 |
e2 | 2 |
Definition at line 175 of file regions_to_loops.c.
References CONS, EXPRESSION, gen_find_entity(), make_call_expression(), and NIL.
Referenced by regions_to_loops().
Makes the body of a "read" loop.
An assign statement is made using the variables generated and the array.
readVar | eadVar |
vl | l |
Definition at line 106 of file regions_to_loops.c.
References entity_to_expression(), gen_full_copy_list(), make_assign_statement(), make_reference(), pips_assert, reference_to_expression(), and statement_consistent_p().
Referenced by Psysteme_to_loop_nest().
Make a sequence from a statement list The equivalent of this function was already made somewhere else.
However when the list only has one element it returns that element instead of making a sequence of one element containing that element. This function always makes a sequence
Definition at line 243 of file regions_to_loops.c.
References CAR, gen_length(), make_block_statement(), make_block_with_stmt_if_not_already(), NIL, STATEMENT, and statement_undefined.
Referenced by regions_to_loops().
statement make_write_loopbody | ( | entity | v, |
expression | exp, | ||
list | vl | ||
) |
Makes the body of a "write" loop.
Warning! Do not modify this file that is automatically generated!
An assign statement is made using the array and the expression built using read variables. This allows to avoid dead code elimination.
exp | xp |
vl | l |
Definition at line 96 of file regions_to_loops.c.
References exp, gen_full_copy_list(), make_assign_statement(), make_reference(), pips_assert, reference_to_expression(), and statement_consistent_p().
Referenced by Psysteme_to_loop_nest().
|
static |
Builds a loop from a Psysteme.
The same function is called whether it is a read or a write region, therefore the body changes. Please refer to the documentation of algorithm_row_echelon_generic and systeme_to_loop_nest for more details. Depending on whether it is a read or a write region, readVar is entity_undefined or exp is expression_undefined.
Definition at line 120 of file regions_to_loops.c.
References algorithm_row_echelon_generic(), DIVIDE_OPERATOR_NAME, entity_intrinsic(), exp, make_read_loopbody(), make_write_loopbody(), pips_assert, statement_consistent_p(), and systeme_to_loop_nest().
Referenced by region_to_loop_nest().
statement region_to_loop_nest | ( | region | r, |
bool | isRead, | ||
entity | readVar, | ||
expression | exp | ||
) |
Returns the entity corresponding to the global name.
static entity global_name_to_entity( const char* package, const char* name ) { return gen_find_tabulated(concatenate(package, MODULE_SEP_STRING, name, NULL), entity_domain); } Takes a region, its type (R/W), a read variable OR an expression (one of them is undefined). Returns a loop statement The scalar case has been made just in case, due to the filter, there should be no scalar variables left in the region list
Definition at line 142 of file regions_to_loops.c.
References append_comments_to_statement(), base, base_add_variable(), BASE_NULLE, base_to_list(), effect_any_reference, ENDP, entity_type, exp, expression_syntax, FOREACH, make_nop_statement, pips_assert, pips_internal_error, Psysteme_to_loop_nest(), ref, reference_indices, reference_variable, region_system, statement_consistent_p(), statement_undefined, syntax_reference, type_variable, type_variable_p, and variable_dimensions.
Referenced by regions_to_loops().
bool regions_to_loops | ( | char * | module_name | ) |
This phase replaces the body of a function by automatically generated loops where the read and write statements are representative of the original function.
If the regions are not computable then the function is not modified.
module_name | odule_name |
Definition at line 261 of file regions_to_loops.c.
References add_declaration_statement(), CONS, db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, effects_to_list(), ENTITY, entity_to_expression(), entity_undefined, expression_undefined, filter_regions(), FOREACH, free_statement(), gen_car(), gen_full_copy_list(), gen_length(), gen_nconc(), gen_nreverse(), generic_effects_reset_all_methods(), get_current_module_entity(), int, local_name_to_top_level_entity(), make_addition(), make_integer_constant_entity(), make_new_module_variable(), make_sequence_from_statement_list(), module, module_name(), module_reorder(), NIL, pips_assert, POP, region_to_loop_nest(), regions_read_regions(), regions_write_regions(), replace_indices_region(), reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_out_summary_effects_list(), reset_out_summary_regions_list(), set_current_module_entity(), set_current_module_statement(), set_methods_for_convex_effects(), set_ordering_to_statement(), STATEMENT, statement_consistent_p(), and statement_sequence_p().
This function is in charge of replacing the PHI entity of the region by generated indices.
PHI values has no correspondance in the code. Therefore we have to create actual indices and replace them in the region in order for the rest to be build using the right entities.
Definition at line 184 of file regions_to_loops.c.
References base_to_list(), CONS, current_offset_of_area(), dynamic_area, DYNAMIC_AREA_LOCAL_NAME, effect_any_reference, ENDP, ENTITY, entity_name, entity_storage, entity_to_expression(), exp, EXPRESSION, expression_syntax, FindEntity(), FOREACH, gen_copy_seq(), gen_full_copy_list(), gen_length(), gen_nreverse(), gen_remove_once(), make_entity_copy_with_new_name(), make_ram(), make_storage_ram(), module, module_local_name(), NIL, pips_assert, ref, reference_indices, reference_variable, region_consistent_p(), region_system, sc_list_variables_rename(), and syntax_reference.
Referenced by regions_to_loops().