PIPS
|
#include "genC.h"
#include "linear.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "effects-util.h"
#include "misc.h"
#include "pipsdbm.h"
#include "resources.h"
#include "control.h"
#include "properties.h"
#include "expressions.h"
Go to the source code of this file.
Data Structures | |
struct | entity_used_in_calls_p |
struct | rfr_param |
struct | dssrhp |
Variables | |
static entity | THE_I = entity_undefined |
static void(* | complex_translation )(list *, list) =NULL |
pl | l |
Definition at line 412 of file simplify.c.
References gen_append(), and pl.
Referenced by set_translation_mode().
pl | l |
Definition at line 416 of file simplify.c.
References gen_append(), and pl.
Referenced by set_translation_mode().
|
static |
Definition at line 604 of file simplify.c.
References basic_of_expression(), basic_pointer_p, binary_call_lhs, binary_call_rhs, call_function, entity_intrinsic(), ENTITY_MINUS_C_P, ENTITY_PLUS_C_P, free_basic(), MINUS_OPERATOR_NAME, and PLUS_OPERATOR_NAME.
Referenced by simplify_c_operator().
|
static |
perform constant string dereferencing evaluation
Definition at line 626 of file simplify.c.
References buf, call_arguments, call_function, CAR, ENTITY_DEREFERENCING_P, exp, EXPRESSION, expression_call(), expression_call_p(), expression_string_constant(), expression_string_constant_p(), expression_syntax, free(), free_expression(), MakeCharacterConstantExpression(), strdup(), syntax_undefined, and update_expression_syntax().
Referenced by do_simplify_constant_address_expression_in_decl(), and simplify_constant_address_expressions().
|
static |
forward processing through declarations
Definition at line 647 of file simplify.c.
References declaration_statement_p(), do_simplify_constant_address_expression(), ENTITY, entity_initial, expression_domain, FOREACH, gen_recurse, gen_true(), and statement_declarations.
Referenced by simplify_constant_address_expressions().
|
static |
Definition at line 57 of file simplify.c.
References gen_recurse, gen_true(), simplify_subscript(), statement_consistent_p(), and subscript_domain.
Referenced by simplify_subscripts().
we copied the field storage, that is rom, recompute a ram storage
then take car of initial value if any
hook: handle returns as a special case
Definition at line 256 of file simplify.c.
References add_variable_to_area(), basic_derived, basic_overloaded_p, basic_pointer, call_arguments, CAR, CONS, copy_expression(), do_split_structure_return_hook(), DYNAMIC_AREA_LOCAL_NAME, ENDP, ENTITY, entity_basic(), entity_initial, entity_intrinsic(), entity_name, entity_scalar_p(), entity_storage, entity_to_expression(), entity_type, entity_used_in_calls(), entity_variable_p, EXPRESSION, expression_call(), expression_undefined, expression_undefined_p, f(), FIELD_OPERATOR_NAME, FindEntity(), FOREACH, formal_parameter_p(), free(), free_storage(), free_value(), gen_nreverse(), get_current_module_entity(), get_current_module_name(), init, insert_statement(), instruction_to_statement(), make_call_instruction(), make_entity_copy_with_new_name(), make_expression(), make_expression_list, make_ram(), make_sizeofexpression_expression(), make_storage_ram(), make_syntax_sizeofexpression(), make_value_expression(), make_value_unknown(), MakeBinaryCall(), MEMBER_SEP_CHAR, MEMCPY_FUNCTION_NAME, NIL, normalized_undefined, POINT_TO_OPERATOR_NAME, POP, replace_field_by_reference(), strdup(), type_pointer_on_struct_variable_p(), type_struct, type_struct_variable_p(), type_variable, ultimate_type(), value_expression, value_expression_p, and variable_basic.
Referenced by do_split_structure_parameter(), and do_split_structures().
|
static |
Definition at line 357 of file simplify.c.
References AddEntityToCurrentModule(), do_split_structure(), ENTITY, FOREACH, gen_free_list(), and get_current_module_statement().
Referenced by split_structures().
also add a 'set all' operation at end ob block
Definition at line 239 of file simplify.c.
References do_split_structure_return_hook_walker(), formal_parameter_p(), gen_context_recurse, gen_length(), gen_true2(), get_current_module_statement(), insert_statement(), instruction_to_statement(), make_fields_assignment_instruction(), pips_assert, and statement_domain.
Referenced by do_split_structure().
we return the same reference as the initial variable, update fields accordingly
Definition at line 215 of file simplify.c.
References call_arguments, CAR, EXPRESSION, expression_call(), expression_reference(), expression_reference_p(), dssrhp::fields, insert_statement(), instruction_call, instruction_call_p, instruction_expression, instruction_to_statement(), make_fields_assignment_instruction(), dssrhp::new_vars, reference_variable, return_statement_p(), same_entity_p(), statement_instruction, and dssrhp::var.
Referenced by do_split_structure_return_hook().
|
static |
Definition at line 339 of file simplify.c.
References AddLocalEntityToDeclarations(), do_split_structure(), ENTITY, FOREACH, gen_free_list(), gen_nconc(), get_current_module_entity(), NIL, statement_block_p, and statement_declarations.
Referenced by split_structures().
Definition at line 118 of file simplify.c.
References call_domain, entity_used_in_calls_walker(), gen_context_recurse, gen_true2(), get_current_module_statement(), and entity_used_in_calls_p::used.
Referenced by do_split_structure().
|
static |
SG: as a special extension, we allow return call for it is handled elsewhere
Definition at line 94 of file simplify.c.
References call_arguments, call_function, entity_used_in_calls_p::e, ENTITY_C_RETURN_P, ENTITY_FIELD_P, ENTITY_POINT_TO_P, ENTITY_RETURN_P, exp, EXPRESSION, expression_reference(), expression_reference_p(), FOREACH, gen_recurse_stop(), reference_variable, same_entity_p(), and entity_used_in_calls_p::used.
Referenced by entity_used_in_calls().
|
static |
look for an & in the expression
Definition at line 24 of file simplify.c.
References call_domain, exp, gen_context_recurse, gen_null2(), and has_address_of_operator_walker_p().
Referenced by simplify_subscript().
Definition at line 18 of file simplify.c.
References call_function, and ENTITY_ADDRESS_OF_P.
Referenced by has_address_of_operator_p().
|
static |
this makes e.f
his makes udpated value of the fields
Definition at line 174 of file simplify.c.
References CAR, CONS, ENTITY, entity_intrinsic(), entity_scalar_p(), entity_to_expression(), entity_type, f(), FIELD_OPERATOR_NAME, FOREACH, gen_nreverse(), instruction_to_statement(), make_assign_statement(), make_call_instruction(), make_expression(), make_expression_list, make_instruction_sequence(), make_sequence(), make_sizeofexpression_expression(), make_syntax_sizeofexpression(), MakeBinaryCall(), MEMCPY_FUNCTION_NAME, NIL, normalized_undefined, POINT_TO_OPERATOR_NAME, POP, STATEMENT, and type_struct_variable_p().
Referenced by do_split_structure_return_hook(), and do_split_structure_return_hook_walker().
expression make_float_constant_expression | ( | float | ) |
Definition at line 161 of file simplify.c.
References call_domain, gen_context_recurse, gen_true2(), get_current_module_statement(), and replace_field_by_reference_walker().
Referenced by do_split_structure().
Definition at line 132 of file simplify.c.
References binary_call_lhs, binary_call_rhs, call_arguments, call_function, ENTITY_FIELD_P, entity_intrinsic(), ENTITY_POINT_TO_P, entity_to_expression(), expression_reference(), expression_reference_p(), rfr_param::field, free_call(), gen_full_free_list(), gen_get_recurse_ancestor(), INSTANCE_OF, is_syntax_reference, make_expression_list, make_reference(), rfr_param::new, NIL, reference_variable, same_entity_p(), rfr_param::structure, syntax_reference, syntax_tag, and UNARY_PLUS_OPERATOR_NAME.
Referenced by replace_field_by_reference().
|
static |
Definition at line 407 of file simplify.c.
References entity_undefined, and THE_I.
Referenced by simplify_complex().
|
static |
Definition at line 429 of file simplify.c.
References complex_translation.
Referenced by simplify_complex().
|
static |
Definition at line 400 of file simplify.c.
References AddEntityToCurrentModule(), DEFAULT_COMPLEX_TYPE_SIZE, entity_initial, float_to_expression(), free_value(), get_current_module_entity(), make_basic_complex(), make_new_scalar_variable_with_prefix(), make_value_expression(), MakeComplexConstantExpression(), and THE_I.
Referenced by simplify_complex().
|
static |
Definition at line 422 of file simplify.c.
References complex_translation, complex_translation_array_of_structs(), complex_translation_struct_of_array(), and get_bool_property().
Referenced by simplify_complex().
void simplify_c_operator | ( | statement | s | ) |
replace PLUS_C_OPERATOR_NAME by PLUS_OPERATOR_NAME when relevant
Definition at line 621 of file simplify.c.
References call_domain, do_simplify_c_operator(), gen_recurse, and gen_true().
Referenced by reduction_propagation().
bool simplify_complex | ( | const char * | module_name | ) |
split complexes into an array with first element <> real part and second element <> imaginary part
prelude
change call to complex intrinsics
change other complex references
and all their declarations
validate
ostlude
module_name | odule_name |
Definition at line 578 of file simplify.c.
References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, get_current_module_entity(), get_current_module_statement(), module_name(), module_name_to_entity(), module_reorder(), reset_current_module_entity(), reset_current_module_statement(), reset_the_i(), reset_translation_mode(), set_current_module_entity(), set_current_module_statement(), set_the_i(), set_translation_mode(), simplify_complex_declaration(), and simplify_complex_statements().
|
static |
Definition at line 451 of file simplify.c.
References code_declarations, code_decls_text, dummy_identifier, dummy_identifier_p, ENTITY, entity_code(), entity_declarations, entity_initial, FOREACH, free(), module_functional_parameters, PARAMETER, parameter_dummy, simplify_complex_entity(), strdup(), and value_code.
Referenced by simplify_complex().
|
static |
adds a dimension to all entity whose basic is complex , and change their basic to float
Definition at line 433 of file simplify.c.
References basic_complex, basic_complex_p, complex_translation, CONS, DIMENSION, entity_basic(), entity_type, entity_variable_p, free_basic(), int_to_expression(), intptr_t, make_basic_float(), make_dimension(), NIL, type_variable, variable_basic, and variable_dimensions.
Referenced by simplify_complex_declaration().
|
static |
replace |.| by sqrt(re^2+im^2)
replace REAL(.) by .[0]
ok let's do something
replace the call by a reference
replace AIMAG(.) by .[1]
ok let's do something
replace the call by a reference
more to come
Definition at line 489 of file simplify.c.
References AIMAG_CONVERSION_NAME, b1, basic_complex_p, basic_of_expression(), binary_call_lhs, binary_call_rhs, call_arguments, call_function, CAR, complex_translation, copy_expression(), CreateIntrinsic(), ENDP, ENTITY_CABS_P, ENTITY_FIVE_OPERATION_P, EXPRESSION, expression_call(), expression_call_p(), expression_normalized, expression_reference(), expression_reference_p(), expression_syntax, expression_undefined, free_basic(), free_normalized(), free_syntax(), gen_free_list(), gen_recurse_stop(), int_to_expression(), make_expression_list, make_syntax_reference(), MakeBinaryCall(), MakeUnaryCall(), normalized_undefined, pips_user_warning, PLUS_OPERATOR_NAME, REAL_GENERIC_CONVERSION_NAME, reference_indices, reference_undefined, same_entity_p(), split_complex_expression(), SQRT_OPERATOR_NAME, and syntax_reference.
Referenced by simplify_complex_statements().
|
static |
do the job
Definition at line 571 of file simplify.c.
References expression_domain, gen_null(), gen_recurse, and simplify_complex_expression().
Referenced by simplify_complex().
bool simplify_constant_address_expressions | ( | const char * | module_name | ) |
transforms *"aer" into 'a' do not take care of "aer"[2] but could be extended to
module_name | odule_name |
Definition at line 657 of file simplify.c.
References db_get_memory_resource(), do_simplify_constant_address_expression(), do_simplify_constant_address_expression_in_decl(), expression_domain, gen_multi_recurse(), gen_true(), get_current_module_statement(), module_name(), module_name_to_entity(), reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), set_current_module_statement(), and statement_domain.
|
static |
the walker
do nothing if an address-of is involved - over cautious indeed
create atomized_expression
create replacement reference
do the replacement
ree stuffs a bit less carefully than I should
we must do this now and not before
Definition at line 32 of file simplify.c.
References AddEntityToCurrentModule(), basic_of_expression(), entity_to_expression(), expression_domain, expression_syntax, gen_get_ancestor(), get_current_module_entity(), has_address_of_operator_p(), insert_statement(), make_assign_statement(), make_new_scalar_variable(), make_reference(), make_syntax_reference(), statement_domain, subscript_array, subscript_indices, syntax_undefined, and update_expression_syntax().
Referenced by do_simplify_subscripts().
bool simplify_subscripts | ( | const char * | module_name | ) |
atomize subscript expressions so that thay can be reprsetned as references
prelude
do the job
validate
ostlude
module_name | odule_name |
Definition at line 64 of file simplify.c.
References db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, do_simplify_subscripts(), get_current_module_statement(), module_name(), module_name_to_entity(), module_reorder(), reset_current_module_entity(), reset_current_module_statement(), set_current_module_entity(), and set_current_module_statement().
|
static |
Definition at line 467 of file simplify.c.
References complex_translation, CreateIntrinsic(), entity_to_expression(), expression_reference(), gen_full_copy_list(), int_to_expression(), make_expression_list, make_reference(), MakeBinaryCall(), MULTIPLY_OPERATOR_NAME, PLUS_OPERATOR_NAME, reference_indices, reference_to_expression(), reference_variable, and THE_I.
Referenced by simplify_complex_expression().
bool split_structures | ( | const char * | module_name | ) |
prelude
do the job for declared structures
now do the job for parameter structures
change useless subscripts
validate
ostlude
module_name | odule_name |
Definition at line 365 of file simplify.c.
References cleanup_subscripts(), db_get_memory_resource(), DB_PUT_MEMORY_RESOURCE, do_split_structure_parameter(), do_split_structures(), ENTITY, entity_declarations, FOREACH, formal_parameter_p(), gen_recurse, gen_true(), get_current_module_entity(), get_current_module_statement(), module_name(), 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.
Definition at line 411 of file simplify.c.
Referenced by reset_translation_mode(), set_translation_mode(), simplify_complex_entity(), simplify_complex_expression(), and split_complex_expression().
|
static |
Definition at line 399 of file simplify.c.
Referenced by reset_the_i(), set_the_i(), and split_complex_expression().