PIPS
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "effects-util.h"
#include "text-util.h"
#include "database.h"
#include "misc.h"
#include "pipsdbm.h"
#include "resources.h"
#include "control.h"
#include "arithmetique.h"
#include "reductions.h"
#include "effects-generic.h"
#include "effects-simple.h"
#include "properties.h"
#include "sac.h"
Go to the source code of this file.
Functions | |
static void | patch_constant_size (syntax s, bool *patch_all) |
statement | simd_atomize_this_expression (entity(*create)(entity, basic), expression e) |
returns the assignment statement if moved, or NULL if not. More... | |
static void | get_type_max_width (call ca, int *maxWidth) |
This function computes the maximum width of all the variables used in a call. More... | |
static void | change_basic_if_needed (statement stat) |
This function aims at changing the basic size of the left expression of the newly created assign statement. More... | |
static void | simd_insert_statement (statement cs, statement stat) |
This function insert stat before orginal_statement in the code. More... | |
static entity | sac_make_new_variable (entity module, basic b) |
static void | simd_do_atomize (expression ce, statement cs) |
static bool | reference_filter (expression exp, __attribute__((unused)) statement cs) |
static void | atomize_call_statement (statement cs) |
This function is called for each call statement and atomize it. More... | |
static void | atomize_statements (statement cs) |
This function is called for all statements in the code. More... | |
bool | simd_atomizer (char *mod_name) |
static bool | do_expression_reduction (statement s, reduction r, expression e) |
static bool | do_reduction_atomization (statement s) |
bool | reduction_atomization (const char *module_name) |
Variables | |
static statement | orginal_statement = NULL |
An atomizer that uses the one made by Fabien Coelho for HPFC, and is in fact just a hacked version of the one made by Ronan Keryell... More... | |
static expression | current_lhs = expression_undefined |
|
static |
This function is called for each call statement and atomize it.
Definition at line 322 of file atomizer.c.
References binary_call_lhs, binary_call_rhs, call_arguments, call_function, CAR, current_lhs, ENTITY_ASSIGN_P, EXPRESSION, expression_call(), expression_call_p(), expression_domain, expression_reference_p(), FOREACH, gen_context_recurse, get_bool_property(), instruction_call, orginal_statement, reference_filter(), simd_do_atomize(), and statement_instruction.
Referenced by atomize_statements().
|
static |
This function is called for all statements in the code.
Definition at line 352 of file atomizer.c.
References atomize_call_statement(), instruction_call_p, and statement_instruction.
Referenced by simd_atomizer().
|
static |
This function aims at changing the basic size of the left expression of the newly created assign statement.
Definition at line 193 of file atomizer.c.
References basic_type_size(), call_arguments, call_function, CAR, CDR, ENTITY_ASSIGN_P, EXPRESSION, expression_basic(), expression_call_p(), expression_syntax, get_type_max_width(), MIN, statement_call(), statement_call_p(), and syntax_call.
Referenced by simd_insert_statement().
|
static |
Definition at line 389 of file atomizer.c.
References binary_call_lhs, binary_call_rhs, call_function, CAR, copy_expression(), copy_reductions(), copy_reference(), copy_syntax(), expression_call(), expression_call_p(), expression_reference(), expression_reference_p(), expression_syntax, insert_statement(), load_cumulated_reductions(), make_assign_statement(), MakeBinaryCall(), reduction_op, reduction_operator_entity(), reduction_reference, reference_equal_p(), reference_to_expression(), same_entity_p(), STATEMENT, statement_block(), store_cumulated_reductions(), and update_expression_syntax().
Referenced by do_reduction_atomization().
the reduction must be of the pattern red = red op exp1 op exp2
Definition at line 429 of file atomizer.c.
References binary_call_lhs, binary_call_rhs, call_function, copy_expression(), copy_reference(), do_expression_reduction(), ENDP, ENTITY_ASSIGN_P, expression_reference(), expression_reference_p(), expression_syntax, FOREACH, load_cumulated_reductions(), MakeBinaryCall(), REDUCTION, reduction_op, reduction_operator_entity(), reduction_reference, reductions_list, reference_equal_p(), reference_to_expression(), statement_call(), statement_call_p(), and update_expression_syntax().
Referenced by reduction_atomization().
This function computes the maximum width of all the variables used in a call.
Definition at line 138 of file atomizer.c.
References basic_of_expression(), basic_of_reference(), basic_type_size(), binary_call_rhs, call_arguments, call_constant_p, call_function, cast_type, DEFAULT_INTEGER_TYPE_SIZE, ENTITY_FIELD_P, ENTITY_POINT_TO_P, EXPRESSION, expression_syntax, FOREACH, free_basic(), is_syntax_call, is_syntax_cast, is_syntax_reference, is_syntax_sizeofexpression, is_syntax_subscript, MAX, pips_internal_error, subscript_array, syntax_call, syntax_cast, syntax_reference, syntax_subscript, syntax_tag, and type_memory_size().
Referenced by change_basic_if_needed().
Definition at line 62 of file atomizer.c.
References basic_int, basic_int_p, call_function, DEFAULT_INTEGER_TYPE_SIZE, entity_constant_p, entity_type, functional_result, is_syntax_call, is_syntax_reference, syntax_call, syntax_tag, type_functional, type_variable, and variable_basic.
Referenced by simd_atomize_this_expression().
bool reduction_atomization | ( | const char * | module_name | ) |
prelude
do the job
postlude
module_name | odule_name |
Definition at line 459 of file atomizer.c.
References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, do_reduction_atomization(), gen_null(), gen_recurse, get_current_module_name(), get_current_module_statement(), module_name(), module_name_to_entity(), module_reorder(), reset_cumulated_reductions(), reset_current_module_entity(), reset_current_module_statement(), set_cumulated_reductions(), set_current_module_entity(), set_current_module_statement(), and statement_domain.
|
static |
Definition at line 298 of file atomizer.c.
References call_function, ENTITY_FIELD_P, ENTITY_POINT_TO_P, exp, EXPRESSION, expression_call(), expression_call_p(), expression_linear_p(), expression_reference(), expression_reference_p(), FOREACH, gen_recurse_stop(), get_bool_property(), NORMALIZE_EXPRESSION, and reference_indices.
Referenced by atomize_call_statement().
Definition at line 267 of file atomizer.c.
References AddLocalEntityToDeclarations(), copy_basic(), get_current_module_statement(), make_new_scalar_variable(), and module.
Referenced by simd_do_atomize().
statement simd_atomize_this_expression | ( | entity(*)(entity, basic) | create, |
expression | e | ||
) |
returns the assignment statement if moved, or NULL if not.
atomizer.c
it does not make sense to atomize a range...
SG: in case of expression similar to (a+2), if a is a short (or a char ...), the user may expect the result is a short too the C syntax expect 2 is an int set the property to false if you want to override this behavior
force all integer to char, then compute the basic validate only if we can guess the size from something not a constant integer
Definition at line 87 of file atomizer.c.
References AddEntityToCurrentModule(), basic_of_expression(), basic_overloaded_p, basic_undefined, basic_undefined_p, copy_expression(), entity_to_expression(), expression_syntax, free_basic(), free_expression(), gen_context_recurse, gen_true2(), get_bool_property(), get_current_module_entity(), make_assign_statement(), make_expression(), make_reference(), make_syntax_reference(), NIL, normalize_all_expressions_of(), normalized_undefined, patch_constant_size(), syntax_domain, and syntax_range_p.
Referenced by atomize_condition(), and simd_do_atomize().
bool simd_atomizer | ( | char * | mod_name | ) |
get the resources
Now do the job
Reorder the module, because new statements have been added
update/release resources
mod_name | od_name |
Definition at line 361 of file atomizer.c.
References atomize_statements(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, debug_off, debug_on, gen_recurse, gen_true(), module_name_to_entity(), module_reorder(), reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), and statement_domain.
|
static |
If the current call is not an assign call, let's atomize the current argument sg: also try to be smart and make reduction appear if any
Definition at line 275 of file atomizer.c.
References expression_syntax, FUNC_TO_ATOMIZE_P, sac_make_new_variable(), simd_atomize_this_expression(), simd_insert_statement(), statement_undefined, syntax_call, and syntax_call_p.
Referenced by atomize_call_statement().
This function insert stat before orginal_statement in the code.
Definition at line 227 of file atomizer.c.
References change_basic_if_needed(), CONS, empty_comments, empty_extensions(), entity_empty_label(), gen_insert_before(), instruction_block, instruction_sequence_p, make_instruction_block(), make_statement(), make_synchronization_none(), NIL, orginal_statement, STATEMENT, statement_comments, statement_declarations, statement_extensions, statement_instruction, statement_label, statement_number, STATEMENT_NUMBER_UNDEFINED, statement_ordering, and STATEMENT_ORDERING_UNDEFINED.
Referenced by simd_do_atomize().
|
static |
Definition at line 83 of file atomizer.c.
Referenced by atomize_call_statement().
|
static |
An atomizer that uses the one made by Fabien Coelho for HPFC, and is in fact just a hacked version of the one made by Ronan Keryell...
Definition at line 58 of file atomizer.c.
Referenced by atomize_call_statement(), and simd_insert_statement().