PIPS
|
#include <stdio.h>
#include "linear.h"
#include "genC.h"
#include "ri.h"
#include "misc.h"
#include "properties.h"
#include "ri-util.h"
Go to the source code of this file.
Macros | |
#define | BCTYPES_TABLE_INIT_SIZE 10 |
basic_concrete_types More... | |
Variables | |
static hash_table | entity_types_to_bctypes = hash_table_undefined |
static set | supporting_types = set_undefined |
Compute the list of entities implied in the definition of a type. More... | |
layouts are independent ?
a1 | 1 |
a2 | 2 |
Definition at line 733 of file type.c.
References area_size, and area_undefined.
Referenced by generic_type_equal_p().
is "et" the type of an element of an array of type "at"?
at | t |
et | t |
Definition at line 684 of file type.c.
References array_type_p(), basic_equal_p(), type_variable, type_variable_p, and variable_basic.
Referenced by expression_to_points_to_sources().
Definition at line 3109 of file type.c.
References basic_derived_p, NIL, type_variable, type_variable_p, variable_basic, and variable_dimensions.
Referenced by array_of_struct_type_p().
Definition at line 3025 of file type.c.
References basic_pointer_p, NIL, type_variable, type_variable_p, variable_basic, and variable_dimensions.
Referenced by any_source_to_sinks(), assignment_to_points_to(), declaration_statement_to_points_to(), dereferencing_to_points_to(), expression_to_points_to(), freed_list_to_points_to(), generic_points_to_cell_to_useful_pointer_cells(), generic_stub_source_to_sinks(), new_recursive_filter_formal_context_according_to_actual_context(), points_to_set_block_projection(), points_to_translation_of_formal_parameters(), points_to_translation_of_struct_formal_parameter(), recursive_cell_to_pointer_cells(), reference_dereferencing_to_points_to(), reference_to_points_to_sinks(), struct_assignment_to_points_to(), struct_variable_to_pointer_locations(), struct_variable_to_pointer_subscripts(), subscripted_reference_to_points_to(), and variable_to_pointer_locations().
Definition at line 3133 of file type.c.
References array_of_derived_type_p(), basic_derived, entity_type, type_struct_p, type_variable, and variable_basic.
Referenced by any_source_to_sinks(), assignment_to_points_to(), declaration_statement_to_points_to(), dereferencing_to_points_to(), freed_list_to_points_to(), generic_points_to_cell_to_useful_pointer_cells(), new_recursive_filter_formal_context_according_to_actual_context(), points_to_set_block_projection(), points_to_translation_of_formal_parameters(), points_to_translation_of_struct_formal_parameter(), recursive_cell_to_pointer_cells(), reference_add_field_dimension(), struct_assignment_to_points_to(), struct_variable_to_pointer_locations(), struct_variable_to_pointer_subscripts(), and variable_to_pointer_locations().
Assume that a pointer to type x is equal to a 1-D array of x.
And do not forget the PIPS "string" exception. Constants strings are given type void->string instead of char[n] or char *.
Convert t1
Convert t2
t1 | 1 |
t2 | 2 |
Definition at line 658 of file type.c.
References array_pointer_type_equal_p(), free_type(), make_scalar_char_pointer_type(), string_type_p(), and type_equal_p().
Referenced by adapt_reference_to_type(), expression_to_points_to_cells(), filter_formal_context_according_to_actual_context(), new_filter_formal_context_according_to_actual_context(), points_to_translation_mapping_is_typed_p(), and points_to_translation_of_formal_parameters().
assume that a pointer to type x is equal to a 1-D array of x
Reduce the number of dimensions and try again
t1 | 1 |
t2 | 2 |
Definition at line 609 of file type.c.
References array_pointer_type_equal_p(), array_type_p(), array_type_projection(), array_type_to_sub_array_type(), free_type(), pointer_type_p(), type_equal_up_to_qualifiers_p(), type_to_pointed_type(), and type_void_p.
Referenced by adapt_reference_to_type(), array_pointer_string_type_equal_p(), array_pointer_type_equal_p(), check_type_of_points_to_cells(), concrete_array_pointer_type_equal_p(), create_scalar_stub_sink_cell(), create_stub_entity(), declaration_statement_to_points_to(), expression_to_points_to_sources(), find_points_to_subscript_for_type(), offset_cell(), points_to_cell_types_compatibility(), points_to_reference_to_typed_index(), process_casted_sinks(), and process_casted_sources().
Definition at line 2947 of file type.c.
References gen_length(), int, type_variable, type_variable_p, and variable_dimensions.
Referenced by memory_dereferencing_p(), new_array_elements_backward_substitution_in_transformer(), new_array_elements_forward_substitution_in_transformer(), normalize_subscript_expression(), and recursive_store_independent_points_to_reference_p().
Definition at line 2942 of file type.c.
References NIL, type_variable, type_variable_p, and variable_dimensions.
Referenced by analyzed_entity_p(), analyzed_struct_type_p(), anywhere_source_to_sinks(), array_bounded_p(), array_element_type_p(), array_location_entity_of_module_p(), array_pointer_type_equal_p(), array_type_to_pointer_type(), array_type_to_sub_array_type(), binary_arithmetic_operator_to_post_pv(), binary_intrinsic_call_to_points_to_sinks(), C_type_to_pointed_type(), cell_must_point_to_nowhere_sink_in_set_p(), cell_points_to_non_null_sink_in_set_p(), cell_points_to_nowhere_sink_in_set_p(), cell_points_to_null_sink_in_set_p(), check_rhs_value_types(), check_type_of_points_to_cells(), compute_points_to_binded_set(), compute_points_to_gen_set(), create_advanced_stub_points_to(), create_scalar_stub_sink_cell(), declaration_statement_to_points_to(), dereferencing_subscript_to_points_to(), dereferencing_to_sinks(), do_array_to_pointer_type(), do_array_to_pointer_walk_call_and_patch(), do_brace_expression_to_statements(), do_gpu_qualify_pointers(), do_linearize_array_manage_callers(), do_linearize_prepatch_subscript(), do_linearize_prepatch_type(), entity_array_p(), entity_flow_or_context_sentitive_heap_location(), expression_to_points_to_cells(), expression_to_points_to_sinks_with_offset(), filter_formal_context_according_to_actual_context(), fixed_length_array_type_p(), formal_points_to_parameter(), formal_source_to_sinks(), generic_c_words_simplified_entity(), generic_points_to_cells_translation(), generic_reference_to_transformer(), generic_stub_source_to_sinks(), generic_substitute_formal_array_elements_in_transformer(), global_source_to_sinks(), initialization_list_to_statements(), internal_pointer_assignment_to_points_to(), intrinsic_call_to_type(), memory_dereferencing_p(), new_filter_formal_context_according_to_actual_context(), normalize_subscript_expression(), offset_cell(), outliner_patch_parameters(), perform_array_element_substitutions_in_transformer(), pointer_formal_parameter_to_stub_points_to(), pointer_source_to_sinks(), points_to_array_reference_p(), points_to_cell_types_compatibility(), points_to_cells_parameters(), points_to_expression_to_pointed_type(), points_to_function_projection(), points_to_translation_of_formal_parameters(), process_casted_sinks(), process_casted_sources(), recursive_cell_to_pointer_cells(), recursive_store_independent_points_to_reference_p(), reference_dereferencing_to_points_to(), reference_to_points_to_sinks(), source_to_sinks(), struct_assignment_to_points_to(), struct_variable_to_pointer_locations(), subscript_to_points_to_sinks(), substitute_struct_stub_in_transformer(), variable_length_array_type_p(), and words_points_to_reference().
T is assumed to be an array type.
Get rid of the last dimension and allocate the new type.
Definition at line 596 of file type.c.
References copy_basic(), gen_full_copy_list(), gen_last(), gen_list_and_not(), make_type_variable(), make_variable(), NIL, type_variable, variable_basic, and variable_dimensions.
Referenced by array_pointer_type_equal_p().
returns the type of the elements of an array type, as a newly allocated type.
It is not clear if it should fail when the argument is not an array type, or if an undefined type should be returned.
The qualifiers are dropped.
Definition at line 5700 of file type.c.
References copy_basic(), make_type_variable(), make_variable(), NIL, pips_internal_error, type_undefined, type_variable, type_variable_p, and variable_basic.
Referenced by analyzed_array_p(), analyzed_array_type_p(), check_rhs_value_types(), compute_points_to_binded_set(), expression_to_points_to_cells(), generic_substitute_formal_array_elements_in_transformer(), memory_dereferencing_p(), perform_array_element_substitutions_in_transformer(), points_to_cell_types_compatibility(), points_to_translation_of_struct_formal_parameter(), process_casted_sinks(), and recursive_store_independent_points_to_reference_p().
Allocate a new type that is the type of an array constant.
For instance, int t[10] gives type int * to t, int t[10][20] gives type int (*)[20]
Definition at line 5739 of file type.c.
References array_type_p(), array_type_to_sub_array_type(), pips_internal_error, type_to_pointer_type(), and type_undefined.
Allocate a new type, the sub-array type of "t".
It "t" is "int[10][20][30]", the sub-array type is "int[20][30]".
No sharing is created between argument "t" and result "et"
Definition at line 5718 of file type.c.
References array_type_p(), copy_basic(), gen_full_copy_list(), make_type_variable(), make_variable(), NIL, pips_internal_error, POP, type_undefined, type_variable, variable_basic, and variable_dimensions.
Referenced by array_pointer_type_equal_p(), array_type_to_pointer_type(), check_type_of_points_to_cells(), and intrinsic_call_to_type().
BEGIN_EOLE.
The expression can denote a function, because a function is equivalent to a pointer towards a function
FI: we might as well return a pointer to a function
the basic type is reached. Should I add pips_assert("basic reached, it should be the last index\n", ENDP(CAR(l_ind)))?
Definition at line 1209 of file type.c.
References basic_pointer, basic_pointer_p, copy_basic(), ENDP, free_basic(), indices, pips_internal_error, pips_user_error, POP, type_functional_p, type_variable, type_variable_p, type_void_p, ultimate_type(), and variable_basic.
Referenced by basic_of_any_reference(), and some_basic_of_any_expression().
returns true when the input type successors may be pointers
the input type is supposed to be a basic_concrete_type
If the basic is a pointer type, return true;
witch
bct | ct |
Definition at line 3699 of file type.c.
References basic_concrete_type_leads_to_pointer_p(), basic_derived, basic_derived_p, basic_pointer_p, basic_typedef_p, CAR, ENDP, ENTITY, entity_basic_concrete_type(), entity_type, is_type_variable, is_type_void, pips_internal_error, POP, type_fields(), type_tag, type_variable, and variable_basic.
Referenced by assignment_to_post_pv(), basic_concrete_type_leads_to_pointer_p(), declaration_to_post_pv(), and sequence_to_post_pv().
b1 | 1 |
b2 | 2 |
Definition at line 927 of file type.c.
References b1, b2, generic_basic_equal_p(), and hash_table_undefined.
Referenced by _expression_similar_p(), add_declaration_to_declaration_statement_p(), array_element_type_p(), basic_concrete_types_compatible_for_effects_interprocedural_translation_p(), compare_basic_p(), convert_constant(), create_scalar_stub_sink_cell(), entity_flow_or_context_sentitive_heap_location(), fortran_user_call_to_transformer(), fortran_user_function_call_to_transformer(), is_constant_of_basic(), is_varibale_array_element_specifier(), make_substitution(), points_to_cell_types_compatibility(), same_basic_and_scalar_p(), simd_check_argType(), simplification_conversion(), simplify_expression(), store_initial_value(), struct_assignment_to_points_to(), type_loop_range(), type_this_entity_if_needed(), typing_arguments(), typing_arguments_of_user_function(), typing_of_assign(), and typing_power_operator().
FI: I do not believe this is correct for all intrinsics!
Type checking problem for ? : with gcc...
NN: More cases are added for C. To be refined
bit is a lesser type
Are they really comparable?
How can we compare two pointer types? Equality? Comparison of the pointed types?
pips_internal_error("Comparison of two pointer types not implemented");
SG checks for equality, he doesn't understand the meaning of having a float as the basic maximum of two float* and cowardly refuses to fix the code
FI: not convincing. As in other places, assuming this is meaningful, it would be better to use a basic comparator, basic_greater_p(), which could return 1, -1 or 0 or ??? and deal with non comparable type.
How do you compare a structure or a union to another type? The only case which seems to make sense is equality.
fb1 | b1 |
fb2 | b2 |
Definition at line 1816 of file type.c.
References b1, b2, basic_bit, basic_bit_p, basic_complex_p, basic_derived, basic_derived_p, basic_float_p, basic_int_p, basic_logical, basic_logical_p, basic_maximum(), basic_overloaded_p, basic_pointer, basic_pointer_p, basic_string_p, basic_tag, basic_typedef_p, basic_ultimate(), basic_undefined, copy_basic(), entity_enum_p(), free_basic(), is_basic_bit, is_basic_complex, is_basic_derived, is_basic_float, is_basic_int, is_basic_logical, is_basic_overloaded, is_basic_pointer, is_basic_string, is_basic_typedef, make_basic(), pips_debug, pips_internal_error, s1, SizeOfElements(), type_equal_p(), type_variable, type_variable_p, type_void_p, UU, UUINT, and variable_basic.
Referenced by _expression_similar_p(), basic_maximum(), basic_of_expressions(), basic_of_intrinsic(), basic_union(), do_group_basics_maximum_reduce(), intrinsic_call_to_type(), and ppt_math().
basic basic_of_any_expression | ( | expression | exp, |
bool | apply_p | ||
) |
exp | xp |
apply_p | pply_p |
Definition at line 1364 of file type.c.
References exp, and some_basic_of_any_expression().
Referenced by basic_of_expression(), and some_basic_of_any_expression().
Retrieves the basic of a reference in a newly allocated basic object.
r | reference we want the basic of |
When called from the parser, the entity type may not yet be stored in the field type. This happens when simplify_C_expression is called for initialization expressions which are grouped in one statement.
BC : if the variable has dimensions, then it's an array name which is converted into a pointer itself. And each dimension is converted into a pointer on the next one. (except in a few cases which should be handled in basic_of_call) to be verified or done
A reference to a function returns a pointer to a function of the very same time
apply_p | pply_p |
ultimate_p | ltimate_p |
Definition at line 1395 of file type.c.
References basic_and_indices_to_basic(), basic_undefined, copy_basic(), copy_type(), ENDP, entity_type, functional_result, make_basic_pointer(), make_type_variable(), make_variable(), NIL, pips_internal_error, POP, reference_indices, reference_variable, type_functional, type_functional_p, type_tag, type_to_string(), type_undefined_p, type_variable, type_variable_p, ultimate_type(), variable_basic, and variable_dimensions.
Referenced by basic_of_reference(), and some_basic_of_any_expression().
basic basic_of_call(call c): returns the basic of the result given by the call "c".
If ultimate_p is true, replaced typdef'ed types by their definitions recursively. If not, preserve typedef'ed types.
WARNING: a new basic is allocated
b = make_basic(is_basic_overloaded, UU);
Never go there...
apply_p | pply_p |
ultimate_p | ltimate_p |
Definition at line 1469 of file type.c.
References basic_of_constant(), basic_of_external(), basic_of_intrinsic(), basic_undefined, call_function, copy_basic(), entity_initial, entity_name, is_value_code, is_value_constant, is_value_intrinsic, is_value_symbolic, is_value_unknown, pips_debug, pips_internal_error, and value_tag.
Referenced by c_user_function_call_to_transformer(), commutative_call_p(), fortran_user_function_call_to_transformer(), some_basic_of_any_expression(), and type_this_call().
basic basic_of_constant(call c): returns the basic of the call to a constant.
WARNING: returns a pointer towards an existing data structure
Definition at line 1763 of file type.c.
References call_function, debug(), entity_type, functional_result, is_type_functional, is_type_variable, pips_internal_error, type_functional, type_tag, type_variable, and variable_basic.
Referenced by basic_of_call(), and call_to_type().
basic basic_of_expression | ( | expression | exp | ) |
basic basic_of_expression(expression exp): Makes a basic of the same basic as the expression "exp".
Indeed, "exp" will be assigned to a temporary variable, which will have the same declaration as "exp".
Does not work if the expression is a reference to a functional entity, as may be the case in a Fortran call or a C functional pointer initialization. For C, a pointer to a functional should be/is returned.
WARNING: a new basic object is allocated
PREFER (???) expression_basic
exp | xp |
Definition at line 1383 of file type.c.
References basic_of_any_expression(), and exp.
Referenced by _expression_similar_p(), add_formal_to_actual_bindings(), any_expression_to_transformer(), any_user_call_site_to_transformer(), assign_tmp_to_exp(), atomize_this_expression(), atomizer_of_external(), basic_of_expressions(), basic_of_intrinsic(), basic_union(), condition_to_transformer(), consecutive_expression_p(), do_atomize_call(), do_convert_to_standard_operators(), do_linearize_expression_is_pointer(), do_linearize_pointer_is_expression(), do_loop_expansion(), do_loop_nest_unswitching(), do_simplify_c_operator(), fortran_user_call_to_transformer(), get_optimal_opcode(), get_type_max_width(), integer_expression_p(), inv_call_flt(), logical_binary_function_to_transformer(), make_substitution(), MakeComplexConstantExpression(), MemberIdentifierToExpression(), outliner_extract_loop_bound(), partial_eval_minus_c_operator(), partial_eval_plus_c_operator(), precondition_minmax_of_expression(), reorder_pointer_expression(), simd_atomize_this_expression(), simd_fill_curArgType_call(), simplify_C_expression(), simplify_complex_expression(), simplify_expression(), simplify_subscript(), SizeOfArray(), some_basic_of_any_expression(), split_update_call(), store_initial_value(), transformer_add_any_relation_information(), update_functional_type_with_actual_arguments(), and words_infix_binary_op().
expressions | xpressions |
skip_overloaded | kip_overloaded |
Definition at line 2040 of file type.c.
References basic_maximum(), basic_of_expression(), basic_overloaded_p, basic_undefined, CAR, CDR, ENDP, exp, EXPRESSION, FOREACH, free_basic(), and out.
Referenced by get_vect_name_from_data(), and make_loadsave_statement().
basic basic_of_external(call c): returns the basic of the result given by the call to an external function.
WARNING: returns a pointer
support calling a function pointer :)
pips_debug(7, "Returned type is %s\n", basic_to_string(b));
Definition at line 1509 of file type.c.
References basic_pointer, basic_pointer_p, basic_undefined, call_function, entity_name, entity_type, f(), functional_result, pips_debug, pips_internal_error, pips_user_error, type_functional, type_functional_p, type_to_string(), type_undefined, type_variable, type_variable_p, type_void_p, ultimate_type(), and variable_basic.
Referenced by basic_of_call(), and call_to_type().
basic basic_of_intrinsic(call c): returns the basic of the result given by call to an intrinsic function.
This basic must be computed with the basic of the arguments of the intrinsic for overloaded operators. It should be able to accommodate more than two arguments as for generic min and max operators. ultimate_p controls the behavior when typedef'ed types are encountered: should they be replaced by their definitions or not?
WARNING: returns a newly allocated basic object
pips_debug(7, "Intrinsic call to intrinsic \"s" with a priori result type "s"
",
module_local_name(f),
basic_to_string(rb));
I don't know the type since there is no arguments ! Bug encountered with a FMT=* in a PRINT. RK, 21/02/1994 :
leave it overloaded
Too bad, this may happen in the parser
consider int a[12][13] is of type int (*)[13]
Too bad for "void"... SG: should not happen because dereferencing a void* is a mistake
consider int a[12][13] is of type int (*)[13]
This can also be a user error, but if the function is called from the parser, a CParserError() should be called: how to guess what to do?
pips_debug(8, "Point to case, e1 = ");
print_expression(e1);
pips_debug(8, " and e2 = ");
print_expression(e1);
pips_debug(8, "\n");
}
We should reconstruct a struct type or an array type...
returns the type of the left hand side
The value returned is the value of the last expression in the list.
The value returned is the value of the first expression in the list after the condition. The second expression is assumed to have the same value because the code is assumed correct.
This must be a pointer difference. Else, the parser would have used ENTITY_MINUS (see simplify_C_expression()).
logical variables can be used as integer arguments
pips_debug(7, "Intrinsic call to intrinsic \"s" with a posteriori result type "s"
",
module_local_name(f),
basic_to_string(rb));
apply_p | pply_p |
ultimate_p | ltimate_p |
Definition at line 1555 of file type.c.
References arithmetic_intrinsic_p(), basic_logical_p, basic_maximum(), basic_of_expression(), basic_overloaded_p, basic_pointer, basic_pointer_p, basic_undefined, basic_undefined_p, call_arguments, call_function, call_to_type(), CAR, CDR, copy_basic(), copy_type(), DEFAULT_INTEGER_TYPE_SIZE, ENDP, ENTITY_ADDRESS_OF_P, ENTITY_ASSIGN_P, ENTITY_BRACE_INTRINSIC_P, ENTITY_COMMA_P, ENTITY_CONDITIONAL_P, ENTITY_DEREFERENCING_P, ENTITY_FIELD_P, ENTITY_MINUS_C_P, ENTITY_POINT_TO_P, entity_type, EXPRESSION, f(), FOREACH, free_basic(), free_type(), functional_result, gen_full_copy_list(), gen_last(), gen_length(), is_basic_pointer, is_type_variable, make_basic(), make_basic_int(), make_basic_overloaded(), make_basic_pointer(), make_type(), make_type_variable(), make_variable(), NIL, pips_assert, pips_internal_error, some_basic_of_any_expression(), type_consistent_p(), type_functional, type_functional_p, type_undefined, type_undefined_p, type_variable, type_variable_p, type_void_p, ultimate_type(), variable_basic, variable_dimensions, and variable_qualifiers.
Referenced by basic_of_call().
Retrieves the basic of a reference in a newly allocated basic object.
r | reference we want the basic of |
Definition at line 1459 of file type.c.
References basic_of_any_reference().
Referenced by build_new_ref(), distance_between_expression(), generate_prelude(), generate_scalar_variables(), generate_scalar_variables_from_list(), get_sizeofexpression_for_region(), get_type_max_width(), make_reduction_vector_entity(), make_substitution(), match_expression(), my_build_new_ref(), process_true_call_stat(), rename_statement_reductions(), and variables_width_filter().
sel | el |
vt | t |
Definition at line 4211 of file type.c.
References basic_bit, basic_bit_p, basic_complex_p, basic_derived, basic_derived_p, basic_float_p, basic_int_p, basic_logical_p, basic_overloaded_p, basic_pointer, basic_pointer_p, basic_string_p, basic_tag, basic_typedef, basic_typedef_p, CONS, ENTITY, entity_type, fprintf(), gen_nconc(), ifdebug, NIL, pips_debug, pips_internal_error, print_entities(), recursive_type_supporting_entities(), and symbolic_supporting_entities().
Referenced by variable_type_supporting_entities().
pips_debug(8, "Begin: ");
print_references(srl);
fprintf(stderr, "\n");
}
pips_debug(8, "End: ");
print_references(srl);
fprintf(stderr, "\n");
}
srl | rl |
Definition at line 4519 of file type.c.
References basic_bit, basic_bit_p, basic_complex_p, basic_derived, basic_derived_p, basic_float_p, basic_int_p, basic_logical_p, basic_overloaded_p, basic_pointer, basic_pointer_p, basic_string_p, basic_tag, basic_typedef, basic_typedef_p, entity_type, pips_internal_error, recursive_type_supporting_references(), and symbolic_supporting_references().
Referenced by variable_type_supporting_references().
Definition at line 5071 of file type.c.
References basic_bit_p, basic_complex_p, basic_derived, basic_derived_p, basic_float_p, basic_int_p, basic_logical_p, basic_overloaded_p, basic_pointer, basic_pointer_p, basic_string_p, basic_tag, basic_typedef, basic_typedef_p, CONS, ENTITY, entity_type, fprintf(), ifdebug, pips_debug, pips_internal_error, print_entities(), recursive_type_supporting_entities(), and recursive_type_supporting_types().
Referenced by variable_type_supporting_types().
returns the corresponding generic conversion entity, if any.
otherwise returns entity_undefined.
what about INTEGER*{2,4,8} ?
Definition at line 2758 of file type.c.
References basic_complex, basic_float, basic_tag, CMPLX_GENERIC_CONVERSION_NAME, DBLE_GENERIC_CONVERSION_NAME, DCMPLX_GENERIC_CONVERSION_NAME, entity_intrinsic(), entity_undefined, INT_GENERIC_CONVERSION_NAME, is_basic_complex, is_basic_float, is_basic_int, and REAL_GENERIC_CONVERSION_NAME.
Referenced by make_substitution().
Safer than the other implementation? bool pointer_type_p(type t) { bool is_pointer = false;.
if (!type_undefined_p(t) && type_variable_p(t)) { basic b = variable_basic(type_variable(t)); if (!basic_undefined_p(b) && basic_pointer_p(b)) { is_pointer = true; } } return is_pointer; } Here is the set of mapping functions, from the RI to C language types Returns true if t is one of the following types : void, char, short, int, long, float, double, signed, unsigned, and there is no array dimensions, of course
Definition at line 2912 of file type.c.
References basic_bit_p, basic_complex_p, basic_float_p, basic_int_p, basic_logical_p, basic_overloaded_p, basic_string_p, NIL, type_unknown_p, type_variable, type_variable_p, type_void_p, variable_basic, and variable_dimensions.
Referenced by generic_c_words_simplified_entity().
See also SizeOfElements()
pips_internal_error("undefined for type string");
Definition at line 1074 of file type.c.
References basic_complex, basic_float, basic_int, basic_logical, basic_tag, DEFAULT_POINTER_TYPE_SIZE, is_basic_complex, is_basic_float, is_basic_int, is_basic_logical, is_basic_overloaded, is_basic_pointer, is_basic_string, pips_internal_error, and string_type_size().
Referenced by change_basic_if_needed(), DeclareVariable(), get_c_full_name(), get_type_max_width(), loadstore_type_conversion_string(), MakeAtom(), MakeComplexConstant(), MakeComplexConstantExpression(), and match_expression().
get the ultimate basic from a basic typedef
Definition at line 1806 of file type.c.
References basic_typedef, basic_typedef_p, entity_type, pips_assert, type_variable, type_variable_p, ultimate_type(), and variable_basic.
Referenced by basic_maximum(), and make_new_scalar_variable_with_prefix().
basic basic_union | ( | expression | exp1, |
expression | exp2 | ||
) |
basic basic_union(expression exp1 exp2): returns the basic of the expression which has the most global basic.
Then, between "int" and "float", the most global is "float".
Note: there are two different "float" : DOUBLE PRECISION and REAL.
WARNING: a new basic data structure is allocated (because you cannot always find a proper data structure to return simply a pointer
exp1 | xp1 |
exp2 | xp2 |
Definition at line 1792 of file type.c.
References b1, b2, basic_maximum(), basic_of_expression(), and free_basic().
Definition at line 2843 of file type.c.
References basic_bit_p, basic_undefined_p, type_undefined_p, type_variable, type_variable_p, and variable_basic.
Referenced by generic_c_words_simplified_entity(), make_standard_integer_type(), make_standard_long_integer_type(), and UpdateDerivedEntity().
Returns OK for "char[]" as well as for "char *".
And do not forget "string" for PIPS internal representation.
Does not take care of typedef. Use compute_basic_concrete_type() first is necessary.
Definition at line 3011 of file type.c.
References basic_pointer_p, basic_string_p, CAR, DIMENSION, ENDP, gen_length(), type_variable, type_variable_p, unbounded_dimension_p(), variable_basic, and variable_dimensions.
Referenced by formal_source_to_sinks(), intrinsic_call_to_points_to(), list_assignment_to_points_to(), points_to_cell_types_compatibility(), points_to_reference_to_typed_index(), reduce_cell_to_pointer_type(), and source_to_sinks().
returns a copy of t if t is not a pointer type, and the pointed type if t is a pointer type or.
Type definitions are replaced. If t is undefined, returns a type_undefined.
A new type is always allocated.
Definition at line 5288 of file type.c.
References array_type_p(), basic_pointer, CAR, copy_basic(), copy_type(), DIMENSION, gen_length(), make_type_variable(), make_variable(), NIL, pointer_type_p(), type_undefined, type_undefined_p, type_variable, ultimate_type(), unbounded_dimension_p(), variable_basic, and variable_dimensions.
Referenced by create_stub_points_to(), and points_to_reference_to_typed_index().
returns the type necessary to generate or check a call to an object of type t.
Does not allocate a new type. Previous function could be implemented with this one.
Definition at line 3791 of file type.c.
References basic_pointer, basic_pointer_p, basic_typedef, basic_typedef_p, call_compatible_type(), entity_type, pips_assert, type_consistent_p(), type_functional_p, type_variable, type_variable_p, and variable_basic.
Referenced by call_compatible_type(), check_C_function_type(), words_genuine_regular_call(), and words_regular_call().
end of basic_concrete_types
Is an object of type t compatible with a call?
Definition at line 3764 of file type.c.
References basic_pointer, basic_pointer_p, basic_typedef, basic_typedef_p, call_compatible_type_p(), entity_type, type_functional_p, type_variable, type_variable_p, and variable_basic.
Referenced by call_compatible_type_p(), check_C_function_type(), and MakeFunctionExpression().
The function called can have a functional type, or a typedef type or a pointer type to a functional type.
FI: I'm not sure this is correctly implemented. I do not know if a new type is always allocated. I do not understand the semantics if ultimate is turned off.
assertion will fail anyway
must be a functional type
ultimate_p | ltimate_p |
Definition at line 3824 of file type.c.
References basic_pointer, basic_pointer_p, basic_typedef, basic_typedef_p, call_function, copy_type(), entity_type, f(), free_type(), pips_assert, pips_internal_error, type_functional_p, type_undefined, type_variable, type_variable_p, ultimate_type(), and variable_basic.
Referenced by MemberIdentifierToExpression(), and simplify_C_expression().
b = make_basic(is_basic_overloaded, UU);
Never go there...
Definition at line 2313 of file type.c.
References basic_of_constant(), basic_of_external(), call_function, copy_basic(), entity_initial, entity_name, intrinsic_call_to_type(), is_type_variable, is_value_code, is_value_constant, is_value_intrinsic, is_value_symbolic, is_value_unknown, make_type(), make_variable(), NIL, pips_debug, pips_internal_error, type_undefined, and value_tag.
Referenced by basic_of_intrinsic(), and expression_to_type().
Beware of typedefs.
Beware of string_type_p()... Strictly speaking, string_type_p() should not be taken into acount.
Definition at line 5787 of file type.c.
References char_star_type_p(), f(), functional_result, string_type_p(), type_functional, and type_functional_p.
Referenced by check_type_of_points_to_cells(), expression_to_points_to_cells(), expression_to_points_to_sources(), new_recursive_filter_formal_context_according_to_actual_context(), offset_cell(), points_to_translation_mapping_is_typed_p(), and points_to_with_stripped_sink().
Beware of typedefs.
Definition at line 5774 of file type.c.
References char_type_p(), pointer_type_p(), and type_to_pointed_type().
Referenced by char_star_constant_function_type_p(), declaration_statement_to_points_to(), expression_to_points_to_cells(), expression_to_points_to_sources(), and intrinsic_call_to_points_to().
return true whether ‘t’ is a char or an unsigned char
see words_basic()
Definition at line 2877 of file type.c.
References basic_int, basic_int_p, basic_undefined_p, type_undefined_p, type_variable, type_variable_p, and variable_basic.
Referenced by char_star_type_p(), check_type_of_points_to_cells(), points_to_translation_mapping_is_typed_p(), points_to_with_stripped_sink(), and SizeOfArray().
Check that an effective parameter list is compatible with a function type.
Or improve the function type when it is not precise as with "extern int f()". This is (a bit/partially) redundant with undeclared function detection since undeclared functions are declared "extern int f()".
Use parms to improve the type of f, probably declared f() with no type information.
Should be very similar to call_to_functional_type().
text txt = c_text_entity(get_current_module_entity(), f, 0, NIL);
print_text(stderr, txt);
}
Must be a typedef or a pointer to a function. No need to refine the type
text txt = c_text_entity(get_current_module_entity(), f, 0, NIL);
pips_debug(8, "Type not updated for function \"s"
", entity_user_name(f));
print_text(stderr, txt);
}
Take care of the void case
Take care of the varargs case
Check type compatibility: find function in flint? type_equal_p() requires lots of extensions to handle C types. And you would probably need type conversion to concrete type.
args | rgs |
Definition at line 4716 of file type.c.
References call_compatible_type(), call_compatible_type_p(), CAR, CONS, DEFAULT_INTEGER_TYPE_SIZE, ENDP, entity_type, entity_user_name(), EXPRESSION, expression_to_user_type(), f(), functional_parameters, functional_result, gen_last(), gen_length(), gen_nconc(), make_basic_int(), make_dummy_unknown(), make_mode_value(), make_parameter(), make_type_variable(), make_variable(), MAP, NIL, ok, PARAMETER, parameter_type, pips_assert, pips_user_warning, pl, type_functional, type_functional_p, type_unknown_p, type_varargs_p, and type_void_p.
Referenced by MakeFunctionExpression().
Used to implement the next two functions.
Take care of typedefs
Definition at line 933 of file type.c.
References b1, b2, basic_equal_p(), basic_tag, basic_typedef, basic_typedef_p, basic_undefined, basic_undefined_p, entity_type, type_variable, type_variable_p, ultimate_type(), and variable_basic.
Referenced by compatible_basic_p(), and same_basic_p().
check if two basics are similar.
That is if they are equal modulo typedefs and modulo the precision. For instance, "int" and "unsigned int" and "long int" are all considered compatible.
b1 | 1 |
b2 | 2 |
Definition at line 978 of file type.c.
References b1, b2, and compare_basic_p().
Referenced by c_user_function_call_to_transformer().
computes a new type which is the basic concrete type of the input type (this new type is not stored in the entity_types_to_bctypes table).
t | is a type |
pips_debug(8, "Begin with type \"s"
",
words_to_string(words_type(t, NIL, false)));
pips_debug(9, "of basic \"s"and number of dimensions d.
",
basic_to_string(bt),
(int) gen_length(lt));
pips_debug(8, "Ends with type \"s"
",
words_to_string(words_type(nt, NIL, false)));
{
if(type_variable_p(nt))
{
variable nvt = type_variable(nt);
basic nbt = variable_basic(nvt);
list nlt = variable_dimensions(nvt);
pips_debug(9, "of basic \"s"and number of dimensions d.
",
basic_to_string(nbt),
(int) gen_length(nlt));
}
}
pips_assert("nt is not a typedef", type_variable_p(nt)? !basic_typedef_p(variable_basic(type_variable(nt))) : true);
Definition at line 3556 of file type.c.
References basic_pointer, basic_pointer_p, basic_typedef, basic_typedef_p, compute_basic_concrete_type(), copy_basic(), copy_type(), debug_off, debug_on, dimensions_to_normalized_dimensions(), ENDP, entity_type, free_type(), gen_full_copy_list(), gen_nconc(), is_type_variable, make_basic_derived(), make_basic_pointer(), make_type_variable(), make_variable(), pips_debug, type_enum_p, type_struct_p, type_tag, type_to_string(), type_union_p, type_variable, type_variable_p, type_void_p, variable_basic, variable_dimensions, and variable_qualifiers.
Referenced by adapt_reference_to_type(), analyzed_type_p(), any_source_to_sinks(), any_user_call_site_to_transformer(), anywhere_source_to_sinks(), assignment_to_points_to(), c_return_to_transformer(), cast_to_points_to_sinks(), check_rhs_value_types(), check_type_of_points_to_cells(), compute_basic_concrete_type(), concrete_array_pointer_type_equal_p(), concrete_type_equal_p(), declaration_statement_to_points_to(), derived_formal_parameter_to_stub_points_to(), entity_basic_concrete_type(), entity_flow_or_context_sentitive_heap_location(), eval_linear_expression(), expression_to_concrete_type(), expression_to_points_to_cells(), expression_to_points_to_sources(), expression_to_transformer(), external_call_to_post_pv(), formal_source_to_sinks(), freed_list_to_points_to(), generic_function_to_return_value(), generic_substitute_formal_array_elements_in_transformer(), have_null_value_in_pointer_expression_p(), module_to_value_mappings(), offset_cell(), pointer_expression_to_transformer(), points_to_cell_to_concrete_type(), points_to_cell_types_compatibility(), points_to_expression_to_concrete_type(), points_to_expression_to_pointed_type(), points_to_function_projection(), points_to_reference_to_concrete_type(), points_to_source_to_translations(), points_to_translation_of_struct_formal_parameter(), process_casted_sinks(), reference_add_field_dimension(), sizeofexpression_to_points_to_sinks(), struct_initialization_to_points_to(), struct_reference_assignment_or_equality_to_transformer(), substitute_stubs_in_transformer(), types_compatible_for_effects_interprocedural_translation_p(), user_call_to_points_to_sinks(), and words_points_to_reference().
Same as above, but resolve typedefs first.
t1 | 1 |
t2 | 2 |
Definition at line 700 of file type.c.
References array_pointer_type_equal_p(), and compute_basic_concrete_type().
Referenced by type_compatible_with_points_to_cell_p().
Expand typedefs before the type comparison.
t1 | 1 |
t2 | 2 |
Definition at line 571 of file type.c.
References compute_basic_concrete_type(), free_type(), generic_type_equal_p(), and hash_table_undefined.
list constant_expression_supporting_entities | ( | list | sel, |
set | vt, | ||
expression | e | ||
) |
C version.
sel | el |
vt | t |
Definition at line 4181 of file type.c.
References generic_constant_expression_supporting_entities().
Referenced by enum_supporting_entities(), and variable_type_supporting_entities().
list constant_expression_supporting_references | ( | list | srl, |
expression | e | ||
) |
Only applicable to C expressions.
pips_debug(8, "Begin: ");
print_references(srl);
fprintf(stderr, "\n");
}
We need to know if we are dealing with C or Fortran code.
In C, f cannot be declared directly, we need its enum
But in Fortran, we are done
FI: suggested kludge: use a Fortran incompatible type for enum member. But currently they are four byte signed integer (c89) and this Fortran INTEGER type :-(
Could be guarded so as not to be added twice. Guard might be useless with because types are visited only once.
Forward the inner expression
do nothing for the time being...
pips_debug(8, "End: ");
print_references(srl);
fprintf(stderr, "\n");
}
srl | rl |
Definition at line 4451 of file type.c.
References call_arguments, call_function, cast_expression, CONS, constant_expression_supporting_references(), enum_supporting_references(), EXPRESSION, expression_syntax, f(), find_enum_of_member(), gen_nconc(), MAP, NIL, REFERENCE, reference_indices, symbolic_constant_entity_p(), syntax_call, syntax_call_p, syntax_cast, syntax_cast_p, syntax_reference, and syntax_reference_p.
Referenced by constant_expression_supporting_references(), enum_supporting_references(), symbolic_supporting_references(), and variable_type_supporting_references().
Are all types necessary to define fully type "t" listed in list "pdl"?
This function is used by the prettyprinter to decide if a derived type can be fully defined or if its definition should wait.
pdl | dl |
Definition at line 4361 of file type.c.
References ENTITY, FOREACH, gen_in_list_p(), NIL, type_supporting_entities(), and typedef_entity_p().
Referenced by c_text_related_entities(), and generic_c_words_simplified_entity().
Definition at line 3246 of file type.c.
References basic_complex_p, basic_int, DEFAULT_COMPLEX_TYPE_SIZE, ENDP, type_undefined_p, type_variable, type_variable_p, variable_basic, variable_dimensions, and variable_qualifiers.
Definition at line 5907 of file type.c.
References basic_derived, basic_derived_p, basic_typedef, basic_typedef_p, dependence_of_dependent_type(), ENTITY, entity_type, FOREACH, NIL, type_struct, type_struct_p, type_union, and type_union_p.
Referenced by dependence_of_dependent_type().
similar to dependent_type_p but return a list of reference on which the type depend.
/param t type to analyze /return list of reference on which the type t depend so this list only contains elements as: i,x,n, a[0], a[1], ... and not n+m, 2*n, ... the reference present in this list as to be freed by the caller with gen_full_free_list for instance
Definition at line 5942 of file type.c.
References dependence_of_dependent_basic(), DIMENSION, dimension_lower, dimension_upper, FOREACH, gen_append(), gen_context_recurse, gen_free_list(), gen_true2(), NIL, reference_dependence_variable_check_and_add(), reference_domain, type_variable, type_variable_p, variable_basic, and variable_dimensions.
Referenced by dependence_of_dependent_basic().
Definition at line 5872 of file type.c.
References basic_derived, basic_derived_p, basic_typedef, basic_typedef_p, dependent_type_p(), ENTITY, entity_type, FOREACH, NIL, type_struct, type_struct_p, type_union, and type_union_p.
Referenced by dependent_type_p().
A type is dependent in many ways according to definitions given in Wikipedia.
Dependent types lead to many issues both theoretical and practical. The semantics of predicate type_equal_p() should be precised.
Here, for practical purposes, we need to know if the storage space required to store a value of a C type is constant and known at compile-time, or if it depends on the environment and the store and must be computed at run-time.
By this definition, functional types are always constant because functions are stored as pointer to functions in C. So in C as in Fortran, only varying dimensions can lead to dependent types. Such variables are called variable-length array (VLA). So this function might be called vla_type_p().
Some VLA are easy to implement and very convenient for the programmer. They have been included very early in Fortran extensions. Hence they have been handled in PIPS for a very long time and are allocated in the STACK_AREA, the DYNAMIC_AREA and Fortran commons being reserved for non variable-length variables.
They were introduced in C99 but relegated to conditional feature in C11 (I kind of remember, due to Microsoft lobbying). Because declarations can be placed anywhere in post C99 code, the implementation of VLA maybe costly. The dimensions must be evaluated and then alignment and packing are performed in situ by the gcc implementation, as well as stack management. For non-VLA variables, gcc seems to perform a pass similar to the flatten code pass or to the clone_statement() function and move all declarations at the begining of the current function (alpha-renaming). So the frame allocation is performed statically, apparently using more space than necessary because variables with disjoint scopes are allocated simultaneously. These implementation issues have been explored by Nelson Lossing.
This predicate is used by passes to check that declarations can be moved/rescheduled (flatten_code, loop_unroll, full_loop_unroll...).
Definition at line 5849 of file type.c.
References dependent_basic_p(), DIMENSION, dimension_lower, dimension_upper, extended_expression_constant_p(), FOREACH, type_variable, type_variable_p, variable_basic, and variable_dimensions.
Referenced by dependent_basic_p(), flatten_code(), and unroll().
t | is the entity_type of a basic_derived |
Definition at line 5354 of file type.c.
References is_type_enum, is_type_struct, is_type_union, NIL, pips_assert, type_enum, type_enum_p, type_struct, type_struct_p, type_tag, type_union, and type_union_p.
Referenced by derived_type_to_fields(), effect_indices_first_pointer_dimension_rank(), and generic_type_equal_p().
Returns true if t is of type struct, union or enum.
Need to distinguish with the case struct/union/enum in type in RI, these are the definitions of the struct/union/enum themselve, not a variable of this type.
Example : struct foo var;
Note: arrays of struct are not considered derived types
Definition at line 3104 of file type.c.
References basic_derived_p, NIL, type_variable, type_variable_p, variable_basic, and variable_dimensions.
Referenced by any_user_call_site_to_transformer(), c_text_entities(), ensure_comment_consistency(), enum_type_p(), generic_c_words_simplified_entity(), struct_type_p(), and union_type_p().
t | is a type of kind "variable" with a basic of kind "derived" |
Definition at line 5381 of file type.c.
References basic_derived, basic_derived_p, derived_type_fields(), entity_type, NIL, pips_internal_error, type_variable, and variable_basic.
Referenced by any_source_to_sinks(), and struct_variable_to_fields().
Definition at line 1159 of file type.c.
References copy_expression(), dimension_lower, dimension_qualifiers, dimension_upper, gen_full_copy_list(), and make_dimension().
Referenced by ldimensions_dup().
same values
d1 | 1 |
d2 | 2 |
Definition at line 747 of file type.c.
References dimension_lower, dimension_upper, and expression_equal_p().
Referenced by dimensions_equal_p(), and generic_variable_equal_p().
dims1 | ims1 |
dims2 | ims2 |
Definition at line 754 of file type.c.
References dimension_equal_p(), and gen_equals().
Referenced by generic_variable_equal_p().
evaluate constant expressions appearing in dimensions of list dl
Related function: constant_reference_to_normalized_constant_reference()
dl | l |
Definition at line 3528 of file type.c.
References CONS, DIMENSION, dimension_lower, dimension_qualifiers, dimension_upper, FOREACH, gen_full_copy_list(), gen_nreverse(), make_dimension(), NIL, and normalize_integer_constant_expression().
Referenced by compute_basic_concrete_type().
Definition at line 4985 of file type.c.
References basic_derived, basic_pointer, basic_tag, basic_typedef, effect_type_depth(), entity_type, is_basic_bit, is_basic_complex, is_basic_derived, is_basic_float, is_basic_int, is_basic_logical, is_basic_overloaded, is_basic_pointer, is_basic_string, is_basic_typedef, pips_internal_error, and type_depth().
Referenced by effect_type_depth().
Number of steps to access the lowest leave of type t.
Number of dimensions for an array. One for a struct or an union field, plus its dimension. The difference with type_depth is that it does not stop recursing when encountering a pointer, and that a pointer is considered as having dimension 1. (BC)
This is equivalent to type_depth when property POINTS_TO_STRICT_POINTER_TYPES is set to false (FI).
Definition at line 4948 of file type.c.
References effect_basic_depth(), ENTITY, entity_type, FOREACH, gen_length(), type_depth(), type_enum_p, type_struct, type_struct_p, type_union, type_union_p, type_varargs_p, type_variable, type_variable_p, type_void_p, variable_basic, and variable_dimensions.
Referenced by effect_basic_depth().
retrieves or computes and then returns the basic concrete type of an entity
e | is the input entity |
@beware don't free this type, it will be freed by pipsmake when resetting the table.
Definition at line 3677 of file type.c.
References compute_basic_concrete_type(), debug_off, debug_on, entity_type, entity_types_to_bctypes, hash_get(), hash_put(), hash_table_undefined_p, pips_assert, and type_undefined_p.
Referenced by abstract_locations_max(), add_inter_or_intraprocedural_field_entities(), add_intraprocedural_value_entities(), add_type_information(), analyzable_scalar_entity_p(), analyzed_array_p(), analyzed_basic_p(), analyzed_entity_p(), analyzed_struct_p(), analyzed_struct_type_p(), any_source_to_sinks(), any_user_call_site_to_transformer(), array_location_entity_of_module_p(), assign_rhs_to_reflhs_to_transformer(), basic_concrete_type_leads_to_pointer_p(), basic_concrete_types_compatible_for_effects_interprocedural_translation_p(), binary_intrinsic_call_to_points_to_sinks(), c_convex_effects_on_actual_parameter_forward_translation(), c_return_to_transformer(), cell_reference_to_type(), complete_points_to_reference_with_fixed_subscripts(), compute_points_to_binded_set(), compute_points_to_gen_set(), create_stub_entity(), declaration_statement_to_points_to(), declaration_to_post_pv(), dereferencing_subscript_to_points_to(), dereferencing_to_points_to(), dimensions_to_transformer(), effect_indices_first_pointer_dimension_rank(), effect_reference_first_pointer_dimension_rank(), entities_maymust_conflict_p(), entity_non_pointer_scalar_p(), expression_to_points_to(), FILE_star_effect_reference_p(), formal_source_to_sinks(), generic_function_to_return_value(), generic_make_entity_copy_with_new_name(), generic_points_to_cell_to_useful_pointer_cells(), generic_points_to_cells_translation(), generic_reference_to_transformer(), generic_substitute_formal_array_elements_in_transformer(), global_source_to_sinks(), memory_dereferencing_p(), module_initial_parameter_pv(), module_to_value_mappings(), new_recursive_filter_formal_context_according_to_actual_context(), offset_cell(), perform_array_element_substitutions_in_transformer(), pointer_reference_to_expression(), pointer_source_to_sinks(), points_to_array_reference_p(), points_to_array_reference_to_type(), points_to_cells_parameters(), points_to_function_projection(), points_to_set_block_projection(), points_to_translation_of_formal_parameters(), points_to_translation_of_struct_formal_parameter(), r_cell_reference_to_type(), recursive_cell_to_pointer_cells(), recursive_store_independent_points_to_reference_p(), reference_add_field_dimension(), reference_complete_with_zero_subscripts(), reference_condition_to_points_to(), reference_dereferencing_to_points_to(), reference_to_complexity(), reference_to_points_to(), reference_to_points_to_sinks(), reference_to_points_to_translations(), reference_to_type(), sequence_to_post_pv(), source_to_sinks(), split_initializations_in_statement(), store_independent_effect_p(), store_independent_points_to_reference_p(), struct_assignment_to_points_to(), struct_variable_to_fields(), substitute_struct_stub_in_transformer(), substitute_stubs_in_transformer(), substitute_stubs_in_transformer_with_translation_binding(), transformer_apply_field_assignments_or_equalities(), transformer_apply_unknown_field_assignments_or_equalities(), user_call_to_points_to(), user_call_to_points_to_sinks(), variable_to_abstract_location(), variable_to_pointer_locations(), and words_points_to_reference().
void entity_basic_concrete_types_init | ( | void | ) |
Definition at line 3507 of file type.c.
References BCTYPES_TABLE_INIT_SIZE, entity_types_to_bctypes, hash_pointer, hash_table_make(), hash_table_undefined_p, and pips_assert.
Referenced by set_current_phase_context().
void entity_basic_concrete_types_reset | ( | void | ) |
First, free all basic concrete types
Definition at line 3513 of file type.c.
References entity_types_to_bctypes, free_type(), HASH_FOREACH, hash_table_free(), and hash_table_undefined.
Referenced by reset_current_phase_context().
sel | el |
vt | t |
Definition at line 4025 of file type.c.
References CAR, constant_expression_supporting_entities(), ENDP, ENTITY, entity_initial, entity_type, fprintf(), ifdebug, list_undefined, pips_assert, pips_debug, POP, print_entities(), symbolic_expression, type_enum, type_enum_p, value_symbolic, and value_symbolic_p.
Referenced by generic_constant_expression_supporting_entities().
pips_debug(8, "Begin: ");
print_references(srl);
fprintf(stderr, "\n");
}
pips_debug(8, "End: ");
print_references(srl);
fprintf(stderr, "\n");
}
srl | rl |
Definition at line 4415 of file type.c.
References CAR, constant_expression_supporting_references(), ENDP, ENTITY, entity_initial, entity_type, list_undefined, pips_assert, POP, symbolic_expression, type_enum, type_enum_p, value_symbolic, and value_symbolic_p.
Referenced by constant_expression_supporting_references().
Returns true if t is of type derived and if the derived type is a enum.
Example : enum foo var;
FI: Could be unified with the prevous two functions, struct_type_p() and union_type_p()
Note: different from type_enum_p
Definition at line 3172 of file type.c.
References basic_derived, derived_type_p(), entity_type, type_enum_p, type_variable, and variable_basic.
Referenced by rename_variable_type().
basic expression_basic | ( | expression | expr | ) |
should be int
How to void a memory leak? Where can we find a basic int? A static variable?
expr | xpr |
Definition at line 1115 of file type.c.
References basic_undefined, call_function, cast_type, entity_basic(), expression_basic(), expression_syntax, is_basic_int, is_syntax_call, is_syntax_cast, is_syntax_range, is_syntax_reference, is_syntax_sizeofexpression, make_basic(), pips_assert, pips_internal_error, range_lower, reference_variable, syntax_call, syntax_cast, syntax_range, syntax_reference, syntax_tag, type_variable, type_variable_p, ultimate_type(), and variable_basic.
Referenced by can_terapixify_expression_p(), change_basic_if_needed(), expression_basic(), suggest_basic_for_expression(), and words_nullary_op_c().
type expression_to_concrete_type | ( | expression | e | ) |
A new type is allocated.
Definition at line 3751 of file type.c.
References compute_basic_concrete_type(), and expression_to_type().
Referenced by normalize_subscript_expression().
type expression_to_type | ( | expression | exp | ) |
For an array declared as int a[10][20], the type returned for a[i] is int [20].
gcc claims it is int (*)[10], that is a pointer to an array of 10 elements.
exp | is an expression |
does not cover references to functions ...
Could be more elaborated with array types for array expressions
pips_debug(6, "begins with expression :");
print_expression(exp);
fprintf(stderr, "\n");
}
Well, let's assume range are well formed...
current type
current basic
current dimensions
Warning : qualifiers are set to NIL, because I do not see the need for something else for the moment. BC.
Never go there...
pips_debug(9, "returns with %s\n", words_to_string(words_type(t, NIL, false)));
exp | xp |
Definition at line 2486 of file type.c.
References abort, application_function, basic_pointer, basic_pointer_p, call_to_type(), CAR, cast_type, CDR, copy_basic(), copy_type(), debug_off, debug_on, DEFAULT_POINTER_TYPE_SIZE, ENDP, exp, expression_syntax, expression_to_type(), gen_full_copy_list(), is_syntax_application, is_syntax_call, is_syntax_cast, is_syntax_range, is_syntax_reference, is_syntax_sizeofexpression, is_syntax_subscript, is_syntax_va_arg, is_type_variable, make_basic_int(), make_type(), make_type_variable(), make_variable(), NIL, pips_assert, pips_debug, pips_internal_error, POP, range_lower, reference_to_type(), SIZEOFEXPRESSION, sizeofexpression_type, subscript_array, subscript_indices, syntax_application, syntax_call, syntax_cast, syntax_range, syntax_reference, syntax_subscript, syntax_tag, syntax_va_arg, type_tag, type_undefined, type_variable, type_variable_p, type_void_p, variable_basic, and variable_dimensions.
Referenced by any_user_call_site_to_transformer(), application_to_points_to_sinks(), assignment_to_post_pv(), binary_arithmetic_operator_to_post_pv(), c_convex_effects_on_actual_parameter_forward_translation(), c_convex_effects_on_formal_parameter_backward_translation(), declaration_statement_to_points_to(), dereferencing_subscript_to_points_to(), do_linearize_array_manage_callers(), equal_condition_to_points_to(), eval_linear_expression(), EvalSizeofexpression(), expression_pointer_p(), expression_to_concrete_type(), expression_to_points_to_cells(), expression_to_points_to_sinks_with_offset(), expression_to_transformer(), expression_to_type(), expression_to_uncasted_type(), extended_expression_constant_p(), generic_abs_to_transformer(), generic_substitute_formal_array_elements_in_transformer(), integer_expression_and_precondition_to_integer_interval(), integer_expression_to_transformer(), intrinsic_call_to_points_to(), intrinsic_call_to_type(), malloc_arg_to_type(), MemberIdentifierToExpression(), non_equal_condition_to_points_to(), NormalizeCast(), null_equal_condition_to_points_to(), null_non_equal_condition_to_points_to(), order_condition_to_points_to(), pointer_expression_to_transformer(), points_to_expression_to_type(), points_to_reference_update_final_subscripts(), ppt_math(), rename_op(), struct_reference_assignment_or_equality_to_transformer(), transformer_add_condition_information_updown(), unary_arithmetic_operator_to_post_pv(), and update_operator_to_post_pv().
type expression_to_uncasted_type | ( | expression | exp | ) |
If the expression is casted, return its type before cast.
pips_debug(6, "begins with expression :");
print_expression(exp);
pips_debug(6, "\n");
}
exp | xp |
Definition at line 2620 of file type.c.
References cast_expression, exp, expression_syntax, expression_to_type(), expression_to_uncasted_type(), syntax_cast, syntax_cast_p, and type_undefined.
Referenced by expression_to_uncasted_type().
type expression_to_user_type | ( | expression | e | ) |
Preserve typedef'ed types when possible.
does not cover references to functions ...
Could be more elaborated with array types for array expressions
Definition at line 2645 of file type.c.
References is_type_variable, make_type(), make_variable(), NIL, some_basic_of_any_expression(), and type_undefined.
Referenced by callnodeclfilter(), check_C_function_type(), and freia_create_helper_function().
Definition at line 3046 of file type.c.
References basic_derived, basic_derived_p, basic_pointer, basic_pointer_p, entity_name, type_variable, type_variable_p, and variable_basic.
To deal with fields declared in different C files.
It is assumed that f and fl belong to the same derived type, be it a struct, a union or an enum.
fl | l |
Definition at line 5401 of file type.c.
References ENTITY, entity_is_argument_p(), entity_undefined, entity_user_name(), f(), FOREACH, and same_string_p.
Referenced by reference_add_field_dimension().
This function returns the ith dimension of a list of dimensions.
dims | ims |
Definition at line 5621 of file type.c.
References CAR, DIMENSION, dimension_undefined, ENDP, pips_assert, and POP.
Referenced by array_size_stride(), assumed_size_array_p(), bottom_up_abc_base_reference_implied_do(), bottom_up_abc_reference(), pointer_type_array_p(), same_dimension_p(), size_of_actual_array(), size_of_dummy_array(), subscript_value(), subscript_value_stride(), top_down_abc_dimension(), and xml_Pattern_Paving().
Definition at line 1180 of file type.c.
References CAR, CDR, DIMENSION, entity_type, pips_internal_error, type_variable, type_variable_p, and variable_dimensions.
Referenced by array_ranges_to_template_ranges(), complementary_range(), compute_receive_content(), create_init_common_param_for_arrays(), create_parameters_h(), expr_compute_local_index(), generate_one_message(), make_guard_expression(), processor_number(), same_alignment_p(), template_cell_local_mapping(), and template_ranges_to_processors_ranges().
Definition at line 2987 of file type.c.
References array_type_p(), and variable_length_array_type_p().
Referenced by do_linearize_array_manage_callers().
Definition at line 3263 of file type.c.
References basic_float_p, type_undefined_p, type_variable, type_variable_p, and variable_basic.
Referenced by EvalConstant(), float_constant_p(), MakeParameter(), and simplify_float_constraint().
list fortran_constant_expression_supporting_entities | ( | list | sel, |
expression | e | ||
) |
Fortran version.
sel | el |
Definition at line 4187 of file type.c.
References generic_constant_expression_supporting_entities(), set_free(), set_make(), and set_pointer.
Referenced by fortran_type_supporting_entities().
pips_debug(8, "Begin: ");
print_references(srl);
fprintf(stderr, "\n");
}
In Fortran, dependencies are due to the dimension expressions.
pips_debug(8, "End: ");
print_references(srl);
fprintf(stderr, "\n");
}
srl | rl |
Definition at line 4593 of file type.c.
References DIMENSION, dimension_lower, dimension_upper, FOREACH, fortran_constant_expression_supporting_entities(), pips_internal_error, type_functional_p, type_tag, type_variable, type_variable_p, type_void_p, and variable_dimensions.
Referenced by check_fortran_declaration_dependencies().
bool functional_equal_p | ( | functional | f1, |
functional | f2 | ||
) |
f1 | 1 |
f2 | 2 |
Definition at line 1011 of file type.c.
References f2(), and generic_functional_equal_p().
list functional_type_supporting_entities | ( | list | sel, |
functional | f | ||
) |
sel | el |
Definition at line 4014 of file type.c.
References f(), recursive_functional_type_supporting_entities(), set_free(), set_make(), and set_pointer.
Referenced by compilation_unit_text().
list functional_type_supporting_references | ( | list | srl, |
functional | f | ||
) |
pips_debug(8, "Begin: ");
print_references(srl);
fprintf(stderr, "\n");
}
pips_debug(8, "End: ");
print_references(srl);
fprintf(stderr, "\n");
}
srl | rl |
Definition at line 4390 of file type.c.
References f(), functional_parameters, functional_result, MAP, PARAMETER, parameter_type, and recursive_type_supporting_references().
Referenced by recursive_type_supporting_references().
list functional_type_supporting_types | ( | functional | f | ) |
FI: I'm not sure this function is of any use.
Definition at line 5059 of file type.c.
References f(), NIL, recursive_functional_type_supporting_types(), set_free(), set_make(), and set_pointer.
Definition at line 4886 of file type.c.
References basic_derived, basic_pointer, basic_tag, basic_typedef, entity_type, generic_type_depth(), is_basic_bit, is_basic_complex, is_basic_derived, is_basic_float, is_basic_int, is_basic_logical, is_basic_overloaded, is_basic_pointer, is_basic_string, is_basic_typedef, pips_internal_error, and set_undefined_p.
Referenced by generic_type_depth().
bool generic_basic_equal_p | ( | basic | b1, |
basic | b2, | ||
bool | strict_p, | ||
bool | qualifier_p, | ||
hash_table | structural_table | ||
) |
assertion: b1 and b2 are defined and have the same tag (see previous tests)
FI: there are two definition of equality, one more strict via the expression, and one more practical via the constant. But the constant is not always defined. And the Newgen declaration of symbolic looks wrong with "float:int"...
Do we want string types to be equal only if lengths are equal? I do not think so
could be a star or an expression; a value_equal_p() is needed!
just to avoid a warning
b1 | 1 |
b2 | 2 |
strict_p | trict_p |
qualifier_p | ualifier_p |
structural_table | tructural_table |
Definition at line 824 of file type.c.
References b1, b2, basic_bit, basic_complex, basic_derived, basic_float, basic_int, basic_logical, basic_pointer, basic_tag, basic_typedef, basic_undefined, entity_type, entity_user_name(), expression_equal_p(), generic_type_equal_p(), is_basic_bit, is_basic_complex, is_basic_derived, is_basic_float, is_basic_int, is_basic_logical, is_basic_overloaded, is_basic_pointer, is_basic_string, is_basic_typedef, pips_internal_error, s1, same_basic_p(), same_entity_p(), same_string_p, and symbolic_expression.
Referenced by basic_equal_p(), and generic_variable_equal_p().
list generic_constant_expression_supporting_entities | ( | list | sel, |
set | vt, | ||
expression | e, | ||
bool | language_c_p | ||
) |
In C, f cannot be declared directly, we need its enum
In Fortran, symbolic constant are declared directly, but the may depend on other symbolic constants
Could be guarded so as not to be added twice. Guard might be useless with because types are visited only once.
do nothing
sel | el |
vt | t |
language_c_p | anguage_c_p |
Definition at line 4058 of file type.c.
References application_arguments, application_function, call_arguments, call_function, cast_expression, cast_type, CONS, ENTITY, entity_initial, enum_supporting_entities(), EXPRESSION, expression_syntax, f(), find_enum_of_member(), FOREACH, fprintf(), gen_nconc(), generic_constant_expression_supporting_entities(), generic_symbolic_supporting_entities(), ifdebug, language_c_p, NIL, pips_debug, print_entities(), range_increment, range_lower, range_upper, recursive_type_supporting_entities(), reference_indices, reference_variable, SIZEOFEXPRESSION, sizeofexpression_expression, sizeofexpression_type, sizeofexpression_type_p, subscript_array, subscript_indices, symbolic_constant_entity_p(), syntax_application, syntax_application_p, syntax_call, syntax_call_p, syntax_cast, syntax_cast_p, syntax_range, syntax_range_p, syntax_reference, syntax_reference_p, syntax_sizeofexpression, syntax_sizeofexpression_p, syntax_subscript, syntax_subscript_p, syntax_va_arg, syntax_va_arg_p, and value_symbolic.
Referenced by constant_expression_supporting_entities(), fortran_constant_expression_supporting_entities(), generic_constant_expression_supporting_entities(), and generic_symbolic_supporting_entities().
|
static |
This function is only used for structural type equality.
FI: we might want the fields to have the same user name.
Definition at line 419 of file type.c.
References CAR, ENDP, ENTITY, entity_type, gen_length(), generic_type_equal_p(), and POP.
Referenced by generic_type_equal_p().
In case you are not protected against recursivity, check field names only.
FI: we only use the field names.
Definition at line 435 of file type.c.
References CAR, ENDP, ENTITY, entity_user_name(), gen_length(), and POP.
Referenced by generic_type_equal_p().
bool generic_functional_equal_p | ( | functional | f1, |
functional | f2, | ||
bool | strict_p, | ||
bool | qualifier_p, | ||
hash_table | structural_table | ||
) |
f1 | 1 |
f2 | 2 |
strict_p | trict_p |
qualifier_p | ualifier_p |
structural_table | tructural_table |
Definition at line 983 of file type.c.
References CAR, ENDP, f2(), functional_parameters, functional_result, functional_undefined, gen_length(), generic_parameter_equal_p(), generic_type_equal_p(), PARAMETER, and POP.
Referenced by functional_equal_p(), and generic_type_equal_p().
bool generic_parameter_equal_p | ( | parameter | p1, |
parameter | p2, | ||
bool | strict_p, | ||
bool | qualifier_p, | ||
hash_table | structural_table | ||
) |
p1 | 1 |
p2 | 2 |
strict_p | trict_p |
qualifier_p | ualifier_p |
structural_table | tructural_table |
Definition at line 1016 of file type.c.
References generic_type_equal_p(), mode_equal_p(), parameter_mode, parameter_type, and parameter_undefined.
Referenced by generic_functional_equal_p(), and parameter_equal_p().
sel | el |
vt | t |
language_c_p | anguage_c_p |
Definition at line 4198 of file type.c.
References generic_constant_expression_supporting_entities(), language_c_p, and symbolic_expression.
Referenced by generic_constant_expression_supporting_entities(), and symbolic_supporting_entities().
Definition at line 4794 of file type.c.
References ENTITY, entity_type, FOREACH, gen_length(), generic_basic_depth(), set_add_element(), set_belong_p(), set_undefined_p, type_enum_p, type_struct, type_struct_p, type_union, type_union_p, type_varargs_p, type_variable, type_variable_p, type_void_p, variable_basic, and variable_dimensions.
Referenced by generic_basic_depth(), maximal_type_depth(), and type_depth().
|
static |
Warning: the lengths of string basics are not checked!!! string_type_size() could be used but it is probably not very robust.
typedef int foo[n+n];
typedef int fii[2*n];
type_equal_p(foo, fii)==undefined, because it depends on their respective stores. FI: I do not know what's implemented, see variable_equal_p(). the unknown type is not handled in a satisfactory way: in some sense, it should be declared equal to any other type but the undefined type; currently unknown is equal to unknown, and different from other types.
undefined types could also be seen in a different way, as really undefined values; so if t1 or t2 is undefined, the procedure should abort; but type_undefined is considered equal to type_undefined.
Francois Irigoin, 10 March 1992 If strict_p, a typedef type is not equal to its definition (default value).
If qualifier_p, qualifiers must be equal (default value).
If structural_table is defined, the concrete types must be equal (to be refined? similar to strict_p? See also the equality of concrete types below)
This function should be static and used only indirectly via type_equal_p(), etc.
For a structural type equality, type pairs already visited are assumed equal. The walk can only prove they are not equal.
Fortunately, we do not have to remove the pairs when we go up in the recursion across types. The hash_table can be freed by the caller that has allocated it.
assertion: t1 and t2 are defined and have the same tag
just to avoid a warning
Definition at line 483 of file type.c.
References area_equal_p(), derived_type_fields(), generic_field_list_equal_p(), generic_field_list_names_equal_p(), generic_functional_equal_p(), generic_variable_equal_p(), hash_get(), hash_put(), hash_table_undefined_p, is_type_area, is_type_enum, is_type_functional, is_type_statement, is_type_struct, is_type_union, is_type_unknown, is_type_variable, is_type_void, pips_internal_error, type_area, type_functional, type_tag, type_undefined, and type_variable.
Referenced by concrete_type_equal_p(), generic_basic_equal_p(), generic_field_list_equal_p(), generic_functional_equal_p(), generic_parameter_equal_p(), type_equal_p(), type_equal_up_to_qualifiers_p(), type_equal_up_to_typedefs_and_qualifiers_p(), type_structurally_equal_p(), and ultimate_type_equal_p().
bool generic_variable_equal_p | ( | variable | v1, |
variable | v2, | ||
bool | strict_p, | ||
bool | qualifier_p, | ||
hash_table | structural_table | ||
) |
must check basic, dimension and qualifiers
The decomposed condition is much easier to debug than the global predicate.
dimensions should be checked, but it's hard: the only Fortran requirement is that the space allocated in the callers is bigger than the space used in the callee; stars represent any strictly positive integer; we do not know if v1 is the caller type or the callee type; I do not know what should be done; FI
FI: I return false because the exact test should never be useful in the parser; 1 February 1994
FC: I need this in the prettyprinter...
v1 | 1 |
v2 | 2 |
strict_p | trict_p |
qualifier_p | ualifier_p |
structural_table | tructural_table |
Definition at line 762 of file type.c.
References CAR, DIMENSION, dimension_equal_p(), dimensions_equal_p(), gen_length(), generic_basic_equal_p(), NIL, POP, qualifiers_equal_p(), variable_basic, variable_dimensions, variable_qualifiers, and variable_undefined.
Referenced by generic_type_equal_p(), and variable_equal_p().
Definition at line 3298 of file type.c.
References basic_int_p, type_undefined_p, type_variable, type_variable_p, and variable_basic.
Referenced by declaration_statement_to_points_to(), eval_linear_expression(), and generic_abs_to_transformer().
END_EOLE.
This type must be computed with the basic of the arguments of the intrinsic for overloaded operators. It should be able to accomodate more than two arguments as for generic min and max operators.
the result
pips_debug(9, "Intrinsic call to intrinsic \"s" with a priori result type "s"
",
module_local_name(f),
words_to_string(words_type(rt, NIL, false)));
I don't know the type since there is no arguments ! Bug encountered with a FMT=* in a PRINT. RK, 21/02/1994 :
leave it overloaded
isn't expression_to_type expected to return a bct? well, there are cases (casts) which are not clear on this point... BC.
isn't it dangerous?, an ultimate_type can be an entity type!
{
pips_debug(8, "Point to case, e1 = ");
print_expression(e1);
pips_debug(8, " and e2 = ");
print_expression(e2);
pips_debug(8, "\n");
}
We should reconstruct a struct type or an array type...
returns the type of the left hand side
The value returned is the value of the last expression in the list.
let us assume that the two last arguments have the same type : basic_maximum does not preserve types enough (see Effects/lhs01.c, expression *(i>2?&i:&j) ). BC.
pips_user_warning("Non matching pointed types in pointer arithmetic expression %s - %s\n",
expression_to_string(exp1), expression_to_string(exp2));
current type of expression is type of first argument, except if it is an array, e.g. "fifi+3" after declaration "int fifi[3];"
we need to check the variable dimensions
re-use an existing function. we do not take into account variable dimensions here. It may not be correct. but it's not worse than the previously existing version of expression_to_type
current type is still valid
pips_debug(9, "Intrinsic call to intrinsic \"s" "
"with a posteriori result type \"s"
",
module_local_name(f),
words_to_string(words_type(t, NIL, false)));
Definition at line 2080 of file type.c.
References array_type_p(), array_type_to_sub_array_type(), basic_maximum(), basic_overloaded_p, basic_pointer, basic_pointer_p, basic_string_p, call_arguments, call_function, CAR, cons::cdr, CDR, copy_type(), DEFAULT_CHARACTER_TYPE_SIZE, DEFAULT_POINTER_TYPE_SIZE, ENDP, ENTITY_ADDRESS_OF_P, ENTITY_ASSIGN_P, ENTITY_BRACE_INTRINSIC_P, ENTITY_COMMA_P, ENTITY_CONDITIONAL_P, ENTITY_DEREFERENCING_P, ENTITY_FIELD_P, ENTITY_MINUS_C_P, ENTITY_POINT_TO_P, entity_type, EXPRESSION, expression_to_type(), f(), FOREACH, free_type(), functional_result, gen_full_copy_list(), gen_full_free_list(), gen_last(), gen_length(), is_basic_pointer, is_type_variable, make_basic(), make_basic_int(), make_basic_overloaded(), make_type(), make_type_variable(), make_variable(), NIL, pips_assert, pips_debug, pips_internal_error, pips_user_warning, pointed_type(), pointer_type_p(), type_consistent_p(), type_equal_p(), type_functional, type_to_pointer_type(), type_undefined, type_variable, type_variable_p, type_void_p, ultimate_type(), variable_basic, and variable_dimensions.
Referenced by call_to_type().
bool is_inferior_basic(basic1, basic2) return true if basic1 is less complex than basic2 ex: int is less complex than float*4, float*4 is less complex than float*8, ...
b1 | 1 |
b2 | 2 |
Definition at line 2687 of file type.c.
References b1, b2, basic_complex, basic_complex_p, basic_float, basic_float_p, basic_int, basic_int_p, basic_logical_p, basic_overloaded_p, basic_string_p, basic_undefined, and pips_internal_error.
Referenced by arguments_to_complexity(), basic_union_arguments(), indices_to_complexity(), intrinsic_cost(), and typing_power_operator().
Definition at line 1166 of file type.c.
References CAR, CONS, DIMENSION, dimension_dup(), gen_nreverse(), MAPL, and NIL.
Referenced by type_variable_dup().
Definition at line 2865 of file type.c.
References basic_logical_p, basic_undefined_p, type_undefined_p, type_variable, type_variable_p, and variable_basic.
Referenced by logical_constant_p().
Definition at line 2831 of file type.c.
References basic_int, basic_int_p, DEFAULT_LONG_INTEGER_TYPE_SIZE, type_variable, type_variable_p, and variable_basic.
Referenced by make_standard_long_integer_type().
Two options: a string of n characters or an array of n char, i.e. int.
Definition at line 5213 of file type.c.
References make_basic_string(), make_constant_int(), make_type_variable(), make_value_constant(), make_variable(), and NIL.
Referenced by init_c_implicit_variables().
type make_scalar_char_pointer_type | ( | void | ) |
Allocate a char * pointer type.
Definition at line 5227 of file type.c.
References DEFAULT_CHARACTER_TYPE_SIZE, make_basic_pointer(), make_scalar_integer_type(), make_type_variable(), make_variable(), and NIL.
Referenced by array_pointer_string_type_equal_p().
Definition at line 719 of file type.c.
References is_basic_complex, is_type_variable, make_basic(), make_type(), make_variable(), NIL, and UUINT.
Definition at line 712 of file type.c.
References is_basic_int, is_type_variable, make_basic(), make_type(), make_variable(), NIL, and UUINT.
Referenced by create_stub_points_to(), CreateAbstractStateVariable(), make_scalar_char_pointer_type(), UpdateEntity(), and UpdateType().
type make_scalar_overloaded_type | ( | void | ) |
Definition at line 726 of file type.c.
References is_type_variable, make_basic_overloaded(), make_type(), make_variable(), and NIL.
Referenced by points_to_cells_minimal_upper_bound(), process_casted_sinks(), and process_casted_sources().
If it is int i:5, keep the bit basic type
size | ize |
Definition at line 3196 of file type.c.
References basic_int, bit_type_p(), make_basic_int(), make_type_variable(), make_variable(), NIL, pips_debug, signed_type_p(), type_undefined, type_variable, unsigned_type_p(), user_warning, and variable_basic.
long
long long
If it is long int i:5, keep the bit basic type
Definition at line 3309 of file type.c.
References basic_int, bit_type_p(), DEFAULT_INTEGER_TYPE_SIZE, DEFAULT_LONG_INTEGER_TYPE_SIZE, DEFAULT_LONG_LONG_INTEGER_TYPE_SIZE, long_type_p(), make_basic_int(), make_type_variable(), make_variable(), NIL, pips_debug, signed_type_p(), type_undefined, type_variable, unsigned_type_p(), user_warning, and variable_basic.
Minimal information to build a d-dimensional array type.
Definition at line 5752 of file type.c.
References CONS, DIMENSION, int_to_expression(), make_dimension(), make_unbounded_expression(), and NIL.
Referenced by create_stub_points_to().
For Fortran.
size | ize |
Definition at line 251 of file type.c.
References make_basic(), make_dummy_unknown(), make_mode_reference(), make_parameter(), MakeTypeArray(), NIL, and UUINT.
Referenced by MakeComplexParameter(), MakeDoublecomplexParameter(), MakeDoubleprecisionParameter(), MakeIntegerParameter(), MakeLogicalParameter(), MakeLongDoublecomplexParameter(), MakeLongIntegerParameter(), MakeLongLongIntegerParameter(), MakeOverloadedParameter(), MakePointerParameter(), MakeQuadprecisionParameter(), MakeRealParameter(), and MakeUnsignedIntegerParameter().
size | ize |
Definition at line 337 of file type.c.
References make_basic(), MakeTypeArray(), NIL, and UUINT.
Referenced by MakeComplexResult(), MakeDoublecomplexResult(), MakeDoubleprecisionResult(), MakeIntegerResult(), MakeLogicalResult(), MakeLongDoublecomplexResult(), MakeLongIntegerResult(), MakeLongLongIntegerResult(), MakeOverloadedResult(), MakeQuadprecisionResult(), MakeRealResult(), and MakeUnsignedIntegerResult().
END_EOLE.
the_tag | he_tag |
Definition at line 128 of file type.c.
References basic_undefined, is_basic_complex, is_basic_float, is_basic_int, is_basic_logical, is_basic_overloaded, is_basic_string, make_basic(), pips_internal_error, string_undefined, UU, and UUINT.
Referenced by add_one_bound_argument(), complexity_sigma(), create_integer_parameter_for_new_module(), create_new_integer_scalar_common_variable(), create_private_integer_variable_for_new_module(), DeclarePointer(), extract_lattice(), find_or_create_scalar_entity(), find_or_create_typed_entity(), generate_copy_loop_nest(), generate_optimized_code_for_loop_nest(), loop_flt(), loop_to_complexity(), mpi_initialize(), mpi_make_ctx(), and st_compute_ith_local_index().
basic MakeBasicOverloaded | ( | void | ) |
bool same_type_name_p(const type t0, const type t1) {
string s0 = string_of_type(t0), s1 =string_of_type(t1); bool same = same_string_p(s0,s1); free(s0); free(s1); return same; } generation of types
Definition at line 77 of file type.c.
References is_basic_overloaded, make_basic(), and NIL.
parameter MakeCharacterParameter | ( | void | ) |
Definition at line 239 of file type.c.
References DEFAULT_CHARACTER_TYPE_SIZE, is_basic_string, is_constant_int, is_mode_reference, is_value_constant, make_basic(), make_constant(), make_dummy_unknown(), make_mode(), make_parameter(), make_value(), MakeTypeArray(), NIL, UU, and UUINT.
Referenced by assign_substring_type(), character_to_character_type(), character_to_integer_type(), character_to_logical_type(), logical_to_logical_type(), and substring_type().
type MakeCharacterResult | ( | void | ) |
Definition at line 328 of file type.c.
References DEFAULT_CHARACTER_TYPE_SIZE, is_basic_string, is_constant_int, is_value_constant, make_basic(), make_constant(), make_value(), MakeTypeArray(), NIL, and UUINT.
Referenced by assign_substring_type(), char_pointer_to_double_type(), character_to_character_type(), and substring_type().
parameter MakeComplexParameter | ( | void | ) |
Definition at line 224 of file type.c.
References DEFAULT_COMPLEX_TYPE_SIZE, is_basic_complex, and MakeAnyScalarParameter().
Referenced by complex_to_complex_type(), and complex_to_real_type().
type MakeComplexResult | ( | void | ) |
Definition at line 311 of file type.c.
References DEFAULT_COMPLEX_TYPE_SIZE, is_basic_complex, and MakeAnyScalarResult().
Referenced by complex_to_complex_type(), and overloaded_to_complex_type().
parameter MakeDoublecomplexParameter | ( | void | ) |
Definition at line 229 of file type.c.
References DEFAULT_DOUBLECOMPLEX_TYPE_SIZE, is_basic_complex, and MakeAnyScalarParameter().
Referenced by doublecomplex_to_double_type(), and doublecomplex_to_doublecomplex_type().
type MakeDoublecomplexResult | ( | void | ) |
Definition at line 316 of file type.c.
References DEFAULT_DOUBLECOMPLEX_TYPE_SIZE, is_basic_complex, and MakeAnyScalarResult().
Referenced by doublecomplex_to_doublecomplex_type(), and overloaded_to_doublecomplex_type().
parameter MakeDoubleprecisionParameter | ( | void | ) |
Definition at line 209 of file type.c.
References DEFAULT_DOUBLEPRECISION_TYPE_SIZE, is_basic_float, and MakeAnyScalarParameter().
Referenced by double_to_double_type(), double_to_integer_type(), double_to_longinteger_type(), double_to_longlonginteger_type(), longinteger_to_longinteger_type(), and longlonginteger_to_longlonginteger_type().
type MakeDoubleprecisionResult | ( | void | ) |
Definition at line 296 of file type.c.
References DEFAULT_DOUBLEPRECISION_TYPE_SIZE, is_basic_float, and MakeAnyScalarResult().
Referenced by atomic_function_of_operation(), char_pointer_to_double_type(), double_to_double_type(), doublecomplex_to_double_type(), overloaded_to_double_type(), and real_to_double_type().
parameter MakeIntegerParameter | ( | void | ) |
Definition at line 184 of file type.c.
References DEFAULT_INTEGER_TYPE_SIZE, is_basic_int, and MakeAnyScalarParameter().
Referenced by assign_substring_type(), integer_to_integer_type(), integer_to_logical_type(), integer_to_overloaded_type(), integer_to_real_type(), integer_to_void_type(), and substring_type().
type MakeIntegerResult | ( | void | ) |
Definition at line 276 of file type.c.
References DEFAULT_INTEGER_TYPE_SIZE, is_basic_int, and MakeAnyScalarResult().
Referenced by atomic_function_of_operation(), character_to_integer_type(), double_to_integer_type(), integer_to_integer_type(), longdouble_to_integer_type(), MakeEntityFunction(), MakeFunctionExpression(), MakeRunTimeSupportFunction(), overloaded_to_integer_type(), real_to_integer_type(), void_to_integer_type(), and void_to_void_to_int_pointer_type().
parameter MakeLogicalParameter | ( | void | ) |
Definition at line 219 of file type.c.
References DEFAULT_LOGICAL_TYPE_SIZE, is_basic_logical, and MakeAnyScalarParameter().
type MakeLogicalResult | ( | void | ) |
Definition at line 306 of file type.c.
References DEFAULT_LOGICAL_TYPE_SIZE, is_basic_logical, and MakeAnyScalarResult().
Referenced by character_to_logical_type(), integer_to_logical_type(), logical_to_logical_type(), and overloaded_to_logical_type().
parameter MakeLongDoublecomplexParameter | ( | void | ) |
MB.
Definition at line 234 of file type.c.
References DEFAULT_LONGDOUBLECOMPLEX_TYPE_SIZE, is_basic_complex, and MakeAnyScalarParameter().
Referenced by longdoublecomplex_to_longdouble_type(), and longdoublecomplex_to_longdoublecomplex_type().
type MakeLongDoublecomplexResult | ( | void | ) |
MB.
Definition at line 322 of file type.c.
References DEFAULT_LONGDOUBLECOMPLEX_TYPE_SIZE, is_basic_complex, and MakeAnyScalarResult().
Referenced by longdoublecomplex_to_longdoublecomplex_type().
parameter MakeLongIntegerParameter | ( | void | ) |
Definition at line 189 of file type.c.
References DEFAULT_LONG_INTEGER_TYPE_SIZE, is_basic_int, and MakeAnyScalarParameter().
Referenced by longinteger_to_overloaded_type().
type MakeLongIntegerResult | ( | void | ) |
MB.
Definition at line 281 of file type.c.
References DEFAULT_LONG_INTEGER_TYPE_SIZE, is_basic_int, and MakeAnyScalarResult().
Referenced by atomic_function_of_operation(), double_to_longinteger_type(), longdouble_to_longinteger_type(), longinteger_to_longinteger_type(), and real_to_longinteger_type().
parameter MakeLongLongIntegerParameter | ( | void | ) |
MB.
Definition at line 199 of file type.c.
References DEFAULT_LONG_LONG_INTEGER_TYPE_SIZE, is_basic_int, and MakeAnyScalarParameter().
Referenced by longlonginteger_to_overloaded_type().
type MakeLongLongIntegerResult | ( | void | ) |
MB.
Definition at line 286 of file type.c.
References DEFAULT_LONG_LONG_INTEGER_TYPE_SIZE, is_basic_int, and MakeAnyScalarResult().
Referenced by double_to_longlonginteger_type(), longdouble_to_longlonginteger_type(), longlonginteger_to_longlonginteger_type(), and real_to_longlonginteger_type().
mode MakeModeReference | ( | void | ) |
Definition at line 82 of file type.c.
References is_mode_reference, make_mode(), and NIL.
Referenced by update_functional_type_with_actual_arguments(), and UpdateFunctionalType().
mode MakeModeValue | ( | void | ) |
Definition at line 87 of file type.c.
References is_mode_value, make_mode(), and NIL.
parameter MakeOverloadedParameter | ( | void | ) |
Definition at line 167 of file type.c.
References is_basic_overloaded, and MakeAnyScalarParameter().
Referenced by default_intrinsic_type(), overloaded_to_complex_type(), overloaded_to_double_type(), overloaded_to_doublecomplex_type(), overloaded_to_integer_type(), overloaded_to_logical_type(), overloaded_to_longdouble_type(), overloaded_to_real_type(), and overloaded_to_void_type().
type MakeOverloadedResult | ( | void | ) |
this function creates a default fortran operator result, i.e.
a zero dimension variable with an overloaded basic type.
Definition at line 261 of file type.c.
References is_basic_overloaded, and MakeAnyScalarResult().
Referenced by __attribute__(), default_intrinsic_type(), gfc2pips_code2instruction_(), integer_to_overloaded_type(), longinteger_to_overloaded_type(), longlonginteger_to_overloaded_type(), MakeRunTimeSupportFunction(), and pointer_to_overloaded_type().
parameter MakePointerParameter | ( | void | ) |
Definition at line 173 of file type.c.
References DEFAULT_POINTER_TYPE_SIZE, is_basic_pointer, MakeAnyScalarParameter(), and pips_internal_error.
Referenced by pointer_to_overloaded_type().
parameter MakeQuadprecisionParameter | ( | void | ) |
MB.
Definition at line 214 of file type.c.
References DEFAULT_QUADPRECISION_TYPE_SIZE, is_basic_float, and MakeAnyScalarParameter().
Referenced by longdouble_to_integer_type(), longdouble_to_longdouble_type(), longdouble_to_longinteger_type(), and longdouble_to_longlonginteger_type().
type MakeQuadprecisionResult | ( | void | ) |
MB.
Definition at line 301 of file type.c.
References DEFAULT_QUADPRECISION_TYPE_SIZE, is_basic_float, and MakeAnyScalarResult().
Referenced by longdouble_to_longdouble_type(), longdoublecomplex_to_longdouble_type(), and overloaded_to_longdouble_type().
parameter MakeRealParameter | ( | void | ) |
Definition at line 204 of file type.c.
References DEFAULT_REAL_TYPE_SIZE, is_basic_float, and MakeAnyScalarParameter().
Referenced by real_to_double_type(), real_to_integer_type(), real_to_longinteger_type(), real_to_longlonginteger_type(), and real_to_real_type().
type MakeRealResult | ( | void | ) |
Definition at line 291 of file type.c.
References DEFAULT_REAL_TYPE_SIZE, is_basic_float, and MakeAnyScalarResult().
Referenced by atomic_function_of_operation(), complex_to_real_type(), integer_to_real_type(), overloaded_to_real_type(), and real_to_real_type().
functions on types
ld | d |
Definition at line 162 of file type.c.
References is_type_variable, make_type(), make_variable(), and NIL.
Referenced by CreateLogicalUnits(), MakeAnyScalarParameter(), MakeAnyScalarResult(), MakeCharacterParameter(), MakeCharacterResult(), and MakeVoidPointerResult().
type MakeTypeOverloaded | ( | void | ) |
Definition at line 107 of file type.c.
References make_basic_overloaded(), MakeTypeVariable(), and NIL.
Referenced by create_scalar_stub_sink_cell(), and type_to_array_type().
type MakeTypeStatement | ( | void | ) |
Definition at line 92 of file type.c.
References is_type_statement, make_type(), and NIL.
Referenced by bootstrap(), make_label(), MakeCLabel(), and MakeLabel().
type MakeTypeUnknown | ( | void | ) |
Definition at line 97 of file type.c.
References is_type_unknown, make_type(), and NIL.
Referenced by gfc2pips_symbol2type(), max_type(), and opgen_may_type().
BEGIN_EOLE.
ld | d |
Definition at line 116 of file type.c.
References is_type_variable, make_type(), make_variable(), and NIL.
Referenced by cast_STEP_ARG(), create_named_entity(), create_private_integer_variable_for_new_module(), creer_nom_entite(), creer_nom_var(), DeclarePointer(), DeclareVariable(), edge_cost_polynome(), GetFullyDefinedReturnCodeVariable(), gfc2pips_symbol2type(), ImplicitType(), make_array_entity(), make_C_or_Fortran_constant_entity(), make_emulated_shared_variable(), make_new_local_variables(), make_scalar_entity(), make_scalar_integer_entity(), make_stderr_variable(), MakeFormalParameter(), MakeFortranType(), MakeTypeOverloaded(), module_to_wp65_modules(), mpi_initialize(), mpi_type_mpi_comm(), mpi_type_mpi_request(), mpi_type_mpi_status(), step_local_RT_Integer(), step_parameter(), task_time_polynome(), and type_variable_dup().
type MakeTypeVoid | ( | void | ) |
Definition at line 102 of file type.c.
References is_type_void, make_type(), and NIL.
Referenced by MakeCallInst().
parameter MakeUnsignedIntegerParameter | ( | void | ) |
Definition at line 194 of file type.c.
References DEFAULT_INTEGER_TYPE_SIZE, DEFAULT_UNSIGNED_TYPE_SIZE, is_basic_int, and MakeAnyScalarParameter().
Referenced by unsigned_integer_to_void_pointer_type().
type MakeUnsignedIntegerResult | ( | void | ) |
Definition at line 265 of file type.c.
References DEFAULT_INTEGER_TYPE_SIZE, DEFAULT_UNSIGNED_TYPE_SIZE, is_basic_int, and MakeAnyScalarResult().
parameter MakeVoidPointerParameter | ( | void | ) |
Definition at line 178 of file type.c.
References make_dummy_unknown(), make_mode_value(), make_parameter(), make_type_void(), NIL, and type_to_pointer_type().
type MakeVoidPointerResult | ( | void | ) |
Definition at line 271 of file type.c.
References make_basic_pointer(), make_type_void(), MakeTypeArray(), and NIL.
Referenced by unsigned_integer_to_void_pointer_type().
Number of steps to access the lowest leave of type t without a recursive test.
Number of dimensions for an array. One for a struct or an union field, plus its own dimension(s). Recursive data structures do not end up with MAX_INT as type depth. So
A pointer to a scalar may be a pointer to an array, unless property POINTS_TO_STRICT_POINTER_TYPES is set to true.
The name of the function should be non_recursive_maximal_type_depth(). It returns the maximum number of subscript expressions usable in a points-to cell reference.
Concrete types are not used. The depth of named types is supposedly calculated.
Definition at line 4856 of file type.c.
References depth, generic_type_depth(), set_free(), set_make(), and set_pointer.
Referenced by xml_Type_Entity().
m1 | 1 |
m2 | 2 |
Definition at line 1035 of file type.c.
References mode_tag, and mode_undefined.
Referenced by generic_parameter_equal_p().
Recursive number of fields in a data structure...
union and probably enum are not taken into account.
FI: I guess enum should be added
Definition at line 3893 of file type.c.
References basic_derived, basic_derived_p, CAR, ENDP, ENTITY, entity_type, list_undefined, number_of_fields(), pips_internal_error, POP, type_struct, type_struct_p, type_variable, type_variable_p, ultimate_type(), and variable_basic.
Referenced by number_of_fields(), and number_of_items().
Same as above, but arrays in struct are taken into account.
Definition at line 3925 of file type.c.
References basic_derived, basic_derived_p, CAR, ENDP, ENTITY, entity_type, list_undefined, number_of_fields(), number_of_items(), NumberOfElements(), ok, pips_internal_error, POP, type_struct, type_struct_p, type_variable, type_variable_p, ultimate_type(), variable_basic, and variable_dimensions.
Referenced by number_of_items(), and SizeOfArray().
lparams | params |
Definition at line 5236 of file type.c.
References FOREACH, lparams, overloaded_type_p(), PARAMETER, and parameter_type.
Referenced by generic_c_words_simplified_entity().
Returns true if t is a variable type with a basic overloaded.
And false elsewhere. See MakeTypeOverloaded().
Definition at line 2666 of file type.c.
References basic_overloaded_p, type_variable, type_variable_p, and variable_basic.
Referenced by add_any_variable_to_area(), add_implicit_interprocedural_write_effects(), anywhere_source_to_sinks(), check_type_of_points_to_cells(), create_scalar_stub_sink_cell(), declaration_statement_to_points_to(), entities_maymust_conflict_p(), filter_formal_context_according_to_actual_context(), list_assignment_to_points_to(), MemberIdentifierToExpression(), negative_expression_p(), new_filter_formal_context_according_to_actual_context(), new_recursive_filter_formal_context_according_to_actual_context(), overloaded_parameters_p(), points_to_cell_types_compatibility(), points_to_source_to_translations(), points_to_translation_mapping_is_typed_p(), positive_expression_p(), process_casted_sinks(), recursive_filter_formal_context_according_to_actual_context(), reference_add_field_dimension(), source_to_sinks(), TypeFunctionalEntity(), and UpdateType().
p1 | 1 |
p2 | 2 |
Definition at line 1030 of file type.c.
References generic_parameter_equal_p().
returns the type pointed by the input type if it is a pointer or an array of pointers
Definition at line 3035 of file type.c.
References basic_pointer, basic_pointer_p, type_undefined, type_variable, type_variable_p, and variable_basic.
Referenced by convert_pointer_to_array(), do_array_to_pointer_walk_call_and_patch(), do_linearize_prepatch_subscript(), effects_to_dma(), intrinsic_call_to_type(), and module_initial_parameter_pv().
Check for scalar pointers.
Definition at line 2993 of file type.c.
References basic_pointer_p, NIL, type_variable, type_variable_p, variable_basic, and variable_dimensions.
Referenced by add_conflicts(), any_source_to_sinks(), anywhere_source_to_sinks(), array_pointer_type_equal_p(), assignment_to_points_to(), assignment_to_post_pv(), binary_arithmetic_operator_to_post_pv(), c_convex_effects_on_formal_parameter_backward_translation(), C_type_to_pointed_type(), call_to_points_to(), cast_to_points_to_sinks(), cell_must_point_to_nowhere_sink_in_set_p(), cell_points_to_non_null_sink_in_set_p(), cell_points_to_nowhere_sink_in_set_p(), cell_points_to_null_sink_in_set_p(), char_star_type_p(), check_rhs_value_types(), check_type_of_points_to_cells(), compute_points_to_binded_set(), declaration_statement_to_points_to(), dereferencing_to_points_to(), dereferencing_to_sinks(), do_array_to_pointer_type(), do_check_isolate_statement_preconditions_on_call(), do_gpu_qualify_pointers(), do_linearize_array_manage_callers(), do_linearize_prepatch_type(), effect_interference(), effect_scalar_p(), effect_to_store_independent(), entity_flow_or_context_sentitive_heap_location(), entity_scalar_p(), equal_condition_to_points_to(), expression_pointer_p(), expression_to_points_to(), expression_to_points_to_cells(), expression_to_points_to_sinks_with_offset(), expression_to_points_to_sources(), external_call_to_post_pv(), freed_list_to_points_to(), gen_may_constant_paths(), gen_must_constant_paths(), generic_c_words_simplified_entity(), generic_points_to_cell_to_useful_pointer_cells(), generic_stub_source_to_sinks(), intrinsic_call_condition_to_points_to(), intrinsic_call_to_points_to(), intrinsic_call_to_type(), memory_dereferencing_p(), new_recursive_filter_formal_context_according_to_actual_context(), non_equal_condition_to_points_to(), normalize_subscript_expression(), null_equal_condition_to_points_to(), null_non_equal_condition_to_points_to(), order_condition_to_points_to(), perform_array_element_substitutions_in_transformer(), points_to_cell_types_compatibility(), points_to_cells_parameters(), points_to_expression_to_pointed_type(), points_to_function_projection(), points_to_reference_update_final_subscripts(), points_to_set_block_projection(), points_to_translation_of_formal_parameters(), points_to_translation_of_struct_formal_parameter(), points_to_with_stripped_sink(), process_casted_sources(), recursive_cell_to_pointer_cells(), recursive_store_independent_points_to_reference_p(), reduce_cell_to_pointer_type(), reference_condition_to_points_to(), reference_dereferencing_to_points_to(), reference_to_points_to(), reference_to_points_to_sinks(), safe_intrinsic_to_post_pv(), set_entity_initial(), sizeofexpression_to_points_to_sinks(), store_independent_effect_p(), store_independent_reference_p(), struct_assignment_to_points_to(), struct_variable_to_pointer_locations(), struct_variable_to_pointer_subscripts(), subscript_to_points_to_sinks(), subscripted_reference_to_points_to(), TestCoupleOfReferences(), type_to_final_pointed_type(), type_to_pointed_type(), type_void_star_p(), unary_arithmetic_operator_to_post_pv(), update_operator_to_post_pv(), UpdateDerivedEntity(), UpdateEntity(), variable_initial_expression(), and variable_to_pointer_locations().
FI: there are different notions of "ultimate" types in C.
We may need to reduce a type to basic concrete types, removing all typedefs wherever they are. This is done by type_to_basic_concrete_type, see below.
We may also need to know if the type is compatible with a function call: we need to chase down the pointers as well as the typedefs. See call_compatible_type_p().
Finally, we may need to know how much memory should be allocated to hold an object of this type. This is what was needed first, hence the semantics of the function below.
Shoud this function be extended to return a type_undefined whe nthe argument is type_undefined or simply core dump to signal an issue as soon as possible? The second alternative is chosen. What type should be used to perform memory allocation? No allocation of a new type.
pips_debug(9, "and basic \"s"
", basic_to_string(bt));
without this test, we would erase the dimension ...
what should we do ? allocate a new type ... but this breaks the semantic of the function we still create a leak for this case, which does not appear to often a warning is printed out, so that we don't forget it
if(type_variable_p(nt)) {
variable nvt = type_variable(nt);
basic nbt = variable_basic(nvt);
pips_debug(9, "and basic \"s"
", basic_to_string(nbt));
}
}
Definition at line 3370 of file type.c.
References basic_typedef, basic_typedef_p, copy_type(), ENDP, entity_type, free_type(), gen_full_copy_list(), gen_nconc(), ifdebug, pips_assert, pips_debug, type_consistent_p(), type_to_string(), type_undefined, type_undefined_p, type_variable, type_variable_p, ultimate_type(), variable_basic, and variable_dimensions.
Referenced by ultimate_array_type(), and ultimate_type().
q1 | 1 |
q2 | 2 |
Definition at line 5420 of file type.c.
References qualifier_tag.
Referenced by insert_qualifier(), and qualifiers_equal_p().
Definition at line 5427 of file type.c.
References is_qualifier_auto, is_qualifier_const, is_qualifier_register, is_qualifier_restrict, is_qualifier_volatile, pips_internal_error, qualifier_tag, and string_undefined.
Referenced by insert_qualifier().
Check that a qualifier list contains the const qualifier.
ql | l |
Definition at line 5453 of file type.c.
References FOREACH, QUALIFIER, and qualifier_const_p.
Referenced by generic_c_words_simplified_entity(), and type_with_const_qualifier_p().
dims1 | ims1 |
dims2 | ims2 |
Definition at line 758 of file type.c.
References gen_equals(), and qualifier_equal_p().
Referenced by add_declaration_to_declaration_statement_p(), and generic_variable_equal_p().
Check that a qualifier list contains the restrict qualifier.
ql | l |
Definition at line 5466 of file type.c.
References FOREACH, QUALIFIER, and qualifier_restrict_p.
Referenced by generic_c_words_simplified_entity().
list recursive_functional_type_supporting_entities | ( | list | sel, |
set | vt, | ||
functional | f | ||
) |
sel | el |
vt | t |
Definition at line 3977 of file type.c.
References CONS, dummy_identifier, dummy_identifier_p, ENTITY, entity_user_name(), f(), FOREACH, fprintf(), functional_parameters, functional_result, gen_free_list(), gen_nreverse(), ifdebug, NIL, PARAMETER, parameter_dummy, parameter_type, params, pips_debug, print_entities(), recursive_type_supporting_entities(), set_add_element(), set_belong_p(), set_make(), and set_string.
Referenced by functional_type_supporting_entities(), and recursive_type_supporting_entities().
|
static |
Definition at line 5036 of file type.c.
References f(), FOREACH, fprintf(), functional_parameters, functional_result, ifdebug, PARAMETER, parameter_type, pips_debug, print_entities(), and recursive_type_supporting_types().
Referenced by functional_type_supporting_types(), and recursive_type_supporting_types().
varargs do not depend on any other entities
This could be considered a pips_internal_error(), at least when the internal representation is built.
This is weird, but labels also are declared
sel | el |
vt | t |
Definition at line 4283 of file type.c.
References ENTITY, entity_type, FOREACH, fprintf(), ifdebug, pips_debug, pips_internal_error, print_entities(), recursive_functional_type_supporting_entities(), recursive_type_supporting_entities(), set_add_element(), set_belong_p(), type_enum, type_enum_p, type_functional, type_functional_p, type_statement_p, type_struct, type_struct_p, type_tag, type_union, type_union_p, type_unknown_p, type_varargs, type_varargs_p, type_variable, type_variable_p, type_void_p, and variable_type_supporting_entities().
Referenced by basic_supporting_entities(), basic_supporting_types(), generic_constant_expression_supporting_entities(), recursive_functional_type_supporting_entities(), recursive_type_supporting_entities(), and type_supporting_entities().
Compute the list of references implied in the definition of a type.
This is not Fortran compatible as enum members and symbolic constant appear the same but cannot be dealt with in the same way.
This list is empty for basic types such as int or char. But it increases rapidly with typedef, struct, union, bit and dimensions which can use enum elements in sizing expressions.
The supporting entities are gathered in an updated list, sel, supporting reference list.
gen_recurse() does not follow thru entities because they are tabulated and persistant.
What should be done with the tyoe unknown? Return a empty list or generate a pips_internal_error()?
Do not recurse if this type has already been visited.
pips_debug(8, "Begin: ");
print_references(srl);
fprintf(stderr, "\n");
}
No references are involved in C...
pips_debug(8, "End: ");
print_references(srl);
fprintf(stderr, "\n");
}
Definition at line 4638 of file type.c.
References ENTITY, entity_type, functional_type_supporting_references(), MAP, pips_internal_error, set_add_element(), set_belong_p(), supporting_types, type_enum, type_enum_p, type_functional, type_functional_p, type_struct, type_struct_p, type_tag, type_union, type_union_p, type_unknown_p, type_varargs, type_varargs_p, type_variable, type_variable_p, type_void_p, and variable_type_supporting_references().
Referenced by basic_supporting_references(), functional_type_supporting_references(), and type_supporting_references().
Compute the list of types implied in the definition of a type.
This list is empty for basic types such as int or char. But it increases rapidly with typedef, struct and union. We assume that expressions in enum, bit and dimensions are not relevant.
The relationship between stl, the supporting type list, and the set vt, already visited types, herited from type_supporting_entities() is not clear. It might be better to simply return vt...
varargs case is self contained: no supporting type is required.
Hopefully, a dummy type declaration cannot be put among enum members declarations.
This could be considered a pips_internal_error(), at least when the internal representation is built.
This is weird, but labels also are declared
Definition at line 5137 of file type.c.
References ENTITY, entity_type, FOREACH, fprintf(), ifdebug, pips_debug, pips_internal_error, print_entities(), recursive_functional_type_supporting_types(), set_add_element(), set_belong_p(), type_enum_p, type_functional, type_functional_p, type_statement_p, type_struct, type_struct_p, type_tag, type_union, type_union_p, type_unknown_p, type_varargs, type_varargs_p, type_variable, type_variable_p, type_void_p, and variable_type_supporting_types().
Referenced by basic_supporting_types(), recursive_functional_type_supporting_types(), and type_supporting_types().
|
static |
Add the dependence reference only if not already here:
Definition at line 5898 of file type.c.
References CONS, const_variable_p(), copy_reference(), gen_chunk_identity(), gen_chunk_undefined_p, gen_find(), ref, REFERENCE, reference_equal_p(), and reference_variable.
Referenced by dependence_of_dependent_type().
pips_debug(9, "input entity type %s\n",
words_to_string(words_type(entity_type(reference_variable(ref)),
NIL, false)));
pips_debug(9, "reference case \n");
pips_debug(9, "exp_type %s\n", words_to_string(words_type(exp_type, NIL, false)));
current type
current basic
current dimensions
pips_debug(7, "new iteration : current type : %s\n",
words_to_string(words_type(ct, NIL, false)));
pips_debug(7, "current list of indices: \n");
print_expressions(l_inds);
}
Warning : qualifiers are set to NIL, because I do not see the need for something else for the moment. BC.
pips_debug(9, "t at the end of reference case %s\n", words_to_string(words_type(t, NIL, false)));
A reference to a function returns a pointer to a function of the very same time
pips_debug(9, "returns with %s\n", words_to_string(words_type(t, NIL, false)));
ref | ef |
Definition at line 2354 of file type.c.
References basic_derived, basic_derived_p, basic_pointer, basic_pointer_p, CAR, constant_int, copy_basic(), copy_type(), ENDP, ENTITY, entity_basic_concrete_type(), entity_name, entity_type, EvalExpression(), EXPRESSION, expression_reference_p(), expression_syntax, f(), gen_full_copy_list(), gen_nth(), is_basic_pointer, is_type_variable, make_basic(), make_type(), make_type_variable(), make_variable(), NIL, pips_assert, pips_debug, pips_internal_error, POP, ref, reference_indices, reference_variable, syntax_reference, type_functional_p, type_struct, type_tag, type_to_string(), type_undefined, type_variable, type_variable_p, value_constant, value_constant_p, variable_basic, and variable_dimensions.
Referenced by do_brace_expression_to_statements(), expression_to_type(), and substitute_stubs_in_transformer().
Definition at line 59 of file type.c.
References type_to_string(), and type_undefined_p.
Referenced by points_to_with_stripped_sink(), and UpdateParenEntity().
check if two basics are similar.
That is if they are equal modulo typedefs.
b1 | 1 |
b2 | 2 |
Definition at line 969 of file type.c.
References b1, b2, and compare_basic_p().
Referenced by add_formal_to_actual_bindings(), and generic_basic_equal_p().
Type equality and equivalence.
Issues mostly due to C:
Issues dur to PIPS internal representation:
constant string like all constants are functions; for instance, a char * pointer can be assigned a functional void->string...
These issues lead to the concepts of "ultimate" type and of "basic concrete" type, and to the development of many different type "equality" functions. same_type_p(): similar to type_equals but bypasses typedefs
FI Warning: current version only compares ultimate_types but check the various typedef that follows.
typedef int foo;
type_equal_p(int, foo)==true, because foo is simply a renaming for int, but note that type_int_p(entity_type(foo)) returns false. Hence, type_int_p(t1) and type_equal_p(t1,t2) does not imply type_int_p(t2), which may lead to funny bugs.
typedef struct a { int x; int y; } a_t;
typedef struct b { int x; int y; } b_t;
type_equal_p(a_t, b_t)==false, because the underlying structures have different names and because the C type system does not use structural equivalence.
typedef struct { int x; int y; } c_t;
typedef struct { int x; int y; } d_t;
type_EQUAL_P(c_t, d_t)==FALSE because structures (or unions or enums) with implicit names receive each a unique name.
t1 | 1 |
t2 | 2 |
Definition at line 409 of file type.c.
References type_equal_p(), and ultimate_type().
The qualifiers do not matter && ENDP(variable_qualifiers(v))
unsigned are as OK as signed
Definition at line 3276 of file type.c.
References basic_int_p, ENDP, type_undefined_p, type_variable, type_variable_p, variable_basic, and variable_dimensions.
Referenced by check_rhs_value_types(), EvalConstant(), expression_to_points_to_sinks_with_offset(), for_to_do_loop_conversion(), loop_to_enter_transformer(), and MakeParameter().
Definition at line 2955 of file type.c.
References NIL, type_variable, type_variable_p, and variable_dimensions.
Referenced by array_formal_parameter_to_stub_points_to(), global_source_to_sinks(), points_to_cell_types_compatibility(), points_to_translation_of_formal_parameters(), and reference_to_points_to_sinks().
Definition at line 2800 of file type.c.
References basic_int, basic_int_p, DEFAULT_SIGNED_TYPE_SIZE, type_variable, type_variable_p, and variable_basic.
Referenced by make_standard_integer_type(), and make_standard_long_integer_type().
basic_int, basic_float, basic_logical, basic_complex are all int's
so we duplicate them the same manner: with basic_int.
Definition at line 2735 of file type.c.
References basic_complex_p, basic_float_p, basic_int, basic_int_p, basic_logical_p, basic_overloaded_p, basic_string, basic_string_p, basic_tag, fprintf(), is_basic_overloaded, make_basic(), user_warning, UU, UUINT, and value_tag.
Referenced by arguments_to_complexity(), indices_to_complexity(), intrinsic_cost(), and reference_to_complexity().
basic some_basic_of_any_expression | ( | expression | exp, |
bool | apply_p, | ||
bool | ultimate_p | ||
) |
basic basic_of_any_expression(expression exp, bool apply_p): Makes a basic of the same basic as the expression "exp" if "apply_p" is FALSE.
If "apply_p" is true and if the expression returns a function, then return the resulting type of the function.
WARNING: a new basic object is allocated
PREFER (???) expression_basic
print_expression(exp);
pips_debug(6, "\n");
Well, let's assume range are well formed...
This happens with the assert macro... but could happen anywhere as in (void) printf(...);
FI: I cannot think of anything better...
SG: following code fragment seems wrong to me { sizeofexpression se = syntax_sizeofexpression(sy); if (sizeofexpression_type_p(se)) { type t = sizeofexpression_type(se); if (type_tag(t) != is_type_variable) pips_internal_error("Bad reference type tag %d",type_tag(t)); b = copy_basic(variable_basic(type_variable(t))); } else { b = some_basic_of_any_expression(sizeofexpression_expression(se), apply_p, ultimate_p); }
depending on the depth of the subscript, we should change the basic
the second argument is the type of the returned object
Never go there...
pips_debug(6, "returns with %s\n", basic_to_string(b));
exp | xp |
apply_p | pply_p |
ultimate_p | ltimate_p |
Definition at line 1258 of file type.c.
References application_function, basic_and_indices_to_basic(), basic_of_any_expression(), basic_of_any_reference(), basic_of_call(), basic_of_expression(), basic_undefined, bool_to_string(), CAR, cast_type, CDR, copy_basic(), DEFAULT_INTEGER_TYPE_SIZE, exp, expression_syntax, ifdebug, is_basic_overloaded, is_syntax_application, is_syntax_call, is_syntax_cast, is_syntax_range, is_syntax_reference, is_syntax_sizeofexpression, is_syntax_subscript, is_syntax_va_arg, is_type_variable, make_basic(), make_basic_int(), pips_debug, pips_internal_error, range_lower, SIZEOFEXPRESSION, sizeofexpression_expression, sizeofexpression_type, sizeofexpression_type_p, some_basic_of_any_expression(), subscript_array, subscript_indices, syntax_application, syntax_call, syntax_cast, syntax_range, syntax_reference, syntax_subscript, syntax_tag, syntax_va_arg, type_tag, type_variable, type_variable_p, type_void_p, ultimate_type(), UUINT, and variable_basic.
Referenced by basic_of_any_expression(), basic_of_intrinsic(), expression_to_user_type(), make_temporary_scalar_entity(), and some_basic_of_any_expression().
Used to encode the long keyword in the parser.
Used to detect long double type in parser
Definition at line 3227 of file type.c.
References basic_int, basic_int_p, DEFAULT_INTEGER_TYPE_SIZE, DEFAULT_LONG_INTEGER_TYPE_SIZE, DEFAULT_LONG_LONG_INTEGER_TYPE_SIZE, ENDP, type_undefined_p, type_variable, type_variable_p, variable_basic, variable_dimensions, and variable_qualifiers.
Definition at line 2854 of file type.c.
References basic_string_p, basic_undefined_p, type_undefined_p, type_variable, type_variable_p, and variable_basic.
Referenced by array_pointer_string_type_equal_p(), call_to_points_to_sinks(), char_star_constant_function_type_p(), constant_string_type_to_string_type(), declaration_statement_to_points_to(), expression_to_points_to_cells(), expression_to_points_to_sources(), generic_c_words_simplified_entity(), and points_to_cell_types_compatibility().
The size may be unknown as in CHARACTER*(*)
No way to check it really was a '*'?
Definition at line 1047 of file type.c.
References basic_string, constant_int, constant_int_p, constant_undefined, is_value_constant, is_value_unknown, pips_internal_error, value_constant, and value_tag.
Referenced by basic_type_size(), constant_to_transformer(), SizeOfArray(), and string_expression_to_transformer().
Returns true if t is of type derived and if the derived type is a struct.
Example : struct foo var;
Note: different trom type_struct_p
Definition at line 3121 of file type.c.
References basic_derived, derived_type_p(), entity_type, type_struct_p, type_variable, and variable_basic.
Referenced by add_inter_or_intraprocedural_field_entities(), analyzed_array_p(), analyzed_array_type_p(), analyzed_entity_p(), analyzed_struct_p(), analyzed_struct_type_p(), any_source_to_sinks(), any_user_call_site_to_transformer(), anywhere_source_to_sinks(), assign_rhs_to_reflhs_to_transformer(), assignment_to_points_to(), c_return_to_transformer(), compute_points_to_binded_set(), declaration_statement_to_points_to(), dereferencing_to_points_to(), dereferencing_to_sinks(), freed_list_to_points_to(), generic_points_to_cell_to_useful_pointer_cells(), generic_stub_source_to_sinks(), generic_substitute_formal_array_elements_in_transformer(), intrinsic_call_to_points_to(), memory_dereferencing_p(), module_to_value_mappings(), new_recursive_filter_formal_context_according_to_actual_context(), offset_cell(), perform_array_element_substitutions_in_transformer(), points_to_cells_parameters(), points_to_function_projection(), points_to_set_block_projection(), points_to_translation_of_formal_parameters(), points_to_translation_of_struct_formal_parameter(), recursive_cell_to_pointer_cells(), recursive_store_independent_points_to_reference_p(), reference_add_field_dimension(), reference_to_points_to_sinks(), rename_variable_type(), split_initializations_in_statement(), strict_constant_path_p(), struct_assignment_to_points_to(), struct_variable_to_pointer_locations(), struct_variable_to_pointer_subscripts(), subscript_to_points_to_sinks(), transformer_apply_unknown_field_assignments_or_equalities(), and variable_to_pointer_locations().
lt | t |
Definition at line 5798 of file type.c.
References basic_derived, basic_derived_p, entity_type, pips_assert, type_struct, type_variable, type_variable_p, and variable_basic.
Referenced by add_inter_or_intraprocedural_field_entities(), analyzed_struct_type_p(), do_brace_expression_to_statements(), generic_points_to_cell_to_useful_pointer_cells(), module_to_value_mappings(), new_recursive_filter_formal_context_according_to_actual_context(), perform_array_element_substitutions_in_transformer(), points_to_translation_of_formal_parameters(), points_to_translation_of_struct_formal_parameter(), substitute_struct_stub_in_transformer(), transformer_apply_field_assignments_or_equalities(), and transformer_apply_unknown_field_assignments_or_equalities().
|
static |
returns the type associated to se.
If se can be evaluated as n, returns the type of the nth field in the field list. If se is a reference to a field f in fl, returns the type of f.
if se is an not a statically evaluable integer expression and not a field reference, returns type_undefined.
If n is greater then the number of elements in fl, returns type_undefined.
If f is not in fl, returns type_undefined.
It might be easier for callers to raise a pips_internal_error() when the result is undefined...
Does not allocate a new type.
Must be a reference to a field
Must be an integer expression
Definition at line 5514 of file type.c.
References CAR, ENTITY, entity_type, expression_integer_value(), expression_reference(), expression_reference_p(), f(), gen_in_list_p(), gen_nthcdr(), intptr_t, ok, pips_internal_error, reference_variable, type_undefined, and type_undefined_p.
Referenced by subscripted_type_to_type().
type subscripted_type_to_type | ( | type | t, |
expression | se | ||
) |
Returns the type of an object of type t subscripted by expression se.
For instance if t is a struct, the type returned is the type corresponding to the se field.
It is much more difficult for arrays...
Do we assume that t is a ultimate type?
A new type is allocated.
scalar case
enum cannot be subscripted
Other basics are incompatible with subscripts
array case
se | e |
Definition at line 5562 of file type.c.
References basic_derived, basic_derived_p, basic_pointer_p, CDR, copy_type(), ENDP, entity_type, gen_full_copy_list(), gen_full_free_list(), list_undefined, pips_internal_error, subscripted_field_list_to_type(), type_enum_p, type_struct, type_struct_p, type_to_pointed_type(), type_to_pointer_type(), type_undefined, type_union, type_union_p, type_variable, type_variable_p, variable_basic, and variable_dimensions.
Referenced by memory_dereferencing_p().
C version.
sel | el |
vt | t |
Definition at line 4206 of file type.c.
References generic_symbolic_supporting_entities().
Referenced by basic_supporting_entities().
srl | rl |
Definition at line 4512 of file type.c.
References constant_expression_supporting_references(), and symbolic_expression.
Referenced by basic_supporting_references().
Number of steps to access the lowest leave of type t without dereferencing.
Number of dimensions for an array. One for a struct or an union field, plus its own dimension(s). This does not take into account longer memory access paths due to pointers. Hence, recursive data structures do not end up with MAX_INT as type depth.
A pointer to a scalar may be a pointer to an array, unless property POINTS_TO_STRICT_POINTER_TYPES is set to true.
Concrete types are not used. The depth of named types is supposedly calculated.
This is the maximum number of subscripts used in a store independent reference, a.k.a. a constant memory access path, with a variable of type t.
Definition at line 4880 of file type.c.
References depth, generic_type_depth(), and set_undefined.
Referenced by c_convex_effects_on_formal_parameter_backward_translation(), cells_to_read_or_write_effects(), consistent_points_to_arc_p(), count_element_references_to_v_p(), effect_basic_depth(), effect_scalar_p(), effect_type_depth(), entity_atomic_reference_p(), and expression_to_points_to().
t1 | 1 |
t2 | 2 |
Definition at line 547 of file type.c.
References generic_type_equal_p(), and hash_table_undefined.
Referenced by _expression_similar_p(), abstract_locations_max(), add_implicit_interprocedural_write_effects(), add_or_kill_equivalenced_variables(), any_user_call_site_to_transformer(), array_pointer_string_type_equal_p(), basic_maximum(), cast_equal_p(), DeclareVariable(), do_linearize_array_manage_callers(), entities_maymust_conflict_p(), entity_all_module_xxx_locations_typed(), entity_all_xxx_locations_typed(), entity_flow_or_context_sentitive_heap_location(), integer_expression_to_transformer(), intrinsic_call_to_type(), make_local_value_entity(), max_type(), multiple_pointer_assignment_to_post_pv(), new_recursive_filter_formal_context_according_to_actual_context(), NormalizeCast(), opkill_may_constant_path(), opkill_may_type(), opkill_must_constant_path(), outliner_file(), pointer_expression_to_transformer(), points_to_source_to_translations(), points_to_translation_of_formal_parameters(), precondition_intra_to_inter(), recursive_filter_formal_context_according_to_actual_context(), references_may_conflict_p(), retype_formal_parameters(), same_analyzable_type_scalar_entity_list_p(), same_type_p(), sizeofexpression_equal_p(), struct_reference_assignment_or_equality_to_transformer(), substitute_stubs_in_transformer_with_translation_binding(), translate_global_value(), type_compatible_super_cell(), TypeFunctionalEntity(), update_functional_type_with_actual_arguments(), UpdateType(), and variable_references_may_conflict_p().
t1 | 1 |
t2 | 2 |
Definition at line 552 of file type.c.
References generic_type_equal_p(), and hash_table_undefined.
Referenced by array_pointer_type_equal_p().
t1 | 1 |
t2 | 2 |
Definition at line 557 of file type.c.
References generic_type_equal_p(), and hash_table_undefined.
Referenced by points_to_cell_types_compatibility().
Definition at line 3073 of file type.c.
References is_type_enum, is_type_struct, is_type_union, NIL, pips_internal_error, type_enum, type_struct, type_tag, and type_union.
Referenced by basic_concrete_type_leads_to_pointer_p(), and basic_concrete_types_compatible_for_effects_interprocedural_translation_p().
Definition at line 2930 of file type.c.
References basic_bit_p, basic_complex_p, basic_float_p, basic_int_p, basic_logical_p, basic_overloaded_p, basic_string_p, type_unknown_p, type_variable, type_variable_p, type_void_p, and variable_basic.
Referenced by assignment_to_post_pv(), declaration_to_post_pv(), and sequence_to_post_pv().
Definition at line 2960 of file type.c.
References basic_pointer, basic_pointer_p, type_struct_variable_p(), type_variable, ultimate_type(), and variable_basic.
Referenced by do_check_isolate_statement_preconditions_on_call(), and do_split_structure().
Definition at line 3867 of file type.c.
References basic_derived, basic_derived_p, entity_struct_p(), type_variable, type_variable_p, ultimate_type(), and variable_basic.
Referenced by do_brace_expression_to_statements(), do_split_structure(), get_sizeofexpression_for_region(), make_fields_assignment_instruction(), semantics_usable_points_to_reference_p(), substitute_struct_stub_in_transformer(), substitute_stubs_in_transformer(), type_pointer_on_struct_variable_p(), and variable_references_may_conflict_p().
Type t1 and t2 are equal if their basic concrete components are equal.
1-D arrays and pointers are compatible if build on the same type.
Qualifiers are ignored.
t1 | 1 |
t2 | 2 |
Definition at line 586 of file type.c.
References generic_type_equal_p(), hash_pointer, hash_table_free(), and hash_table_make().
Referenced by check_type_of_points_to_cells(), declaration_statement_to_points_to(), filter_formal_context_according_to_actual_context(), new_filter_formal_context_according_to_actual_context(), reference_to_points_to_sinks(), and same_field_entity_p().
keep track of already visited types
sel | el |
Definition at line 4347 of file type.c.
References recursive_type_supporting_entities(), set_free(), set_make(), and set_pointer.
Referenced by AddEntityToModuleCompilationUnit(), declarable_type_p(), ensure_comment_consistency(), entity_used_in_declarations_p(), and stub_text().
To avoid multiple recursion through the same type
srl | rl |
Definition at line 4700 of file type.c.
References recursive_type_supporting_references(), set_free(), set_make(), set_pointer, and supporting_types.
Referenced by declaration_supporting_references().
Return the list of types used to define type t.
The goal is to find out if a dummy data structure (struct, union or enum) is used within another one and hence does not need to be printed out by the prettyprinter.
keep track of already visited types
Definition at line 5203 of file type.c.
References NIL, recursive_type_supporting_types(), set_free(), set_make(), and set_pointer.
Referenced by outliner_independent_recursively(), and type_used_in_type_declarations_p().
convert a type "t" into a newly allocated array type "at" whose elements are of type "t", unless "t" is void.
Then an array of overloaded elements is generated. The new dimension is unbounded.
This useful when dealing with pointers that are not precisely typed. In C you have often to assume they point towards an array since pointer arithmetic is OK by default.
The behavior of this function is not well defined when typedef are used... t should be a concrete type.
You cannot added a second unbounded dimension in C...
So you should change the element type...
But this is not compatible with points-to references. We can add 0 subscripts as much as we want for unbounded dimensions, but we cannot change *p into p[0]... This is linked to effects-util and points-to analysis, and should probably not be here in library ri-util
Definition at line 5653 of file type.c.
References CONS, copy_type(), DIMENSION, int_to_expression(), make_dimension(), make_unbounded_expression(), MakeTypeOverloaded(), NIL, type_undefined, type_variable, type_void_p, and variable_dimensions.
Referenced by create_advanced_stub_points_to(), create_stub_points_to(), and global_source_to_sinks().
returns t if t is not a pointer type, and the first indirectly pointed type that is not a pointer if t is a pointer type.
Type definitions are replaced.
Definition at line 5336 of file type.c.
References pointer_type_p(), type_to_pointed_type(), type_undefined, type_undefined_p, and ultimate_type().
Referenced by filtered_declaration_list().
returns t if t is not a pointer type, and the pointed type if t is a pointer type.
Type definitions are replaced. If t is undefined, returns a type_undefined.
Definition at line 5265 of file type.c.
References basic_pointer, pointer_type_p(), type_undefined, type_undefined_p, type_variable, ultimate_type(), and variable_basic.
Referenced by anywhere_source_to_sinks(), array_pointer_type_equal_p(), call_to_points_to(), cell_to_nowhere_sink(), char_star_type_p(), check_rhs_value_types(), check_type_of_points_to_cells(), create_stub_points_to(), dereferencing_subscript_to_points_to(), derived_formal_parameter_to_stub_points_to(), entity_flow_or_context_sentitive_heap_location(), expression_to_points_to_cells(), expression_to_points_to_sources(), formal_source_to_sinks(), freed_list_to_points_to(), generic_stub_source_to_sinks(), global_source_to_sinks(), MakeIoFileArray(), normalize_subscript_expression(), offset_cell(), perform_array_element_substitutions_in_transformer(), pointer_formal_parameter_to_stub_points_to(), points_to_cell_types_compatibility(), points_to_expression_to_pointed_type(), points_to_translation_mapping_is_typed_p(), points_to_with_stripped_sink(), process_casted_sinks(), sizeofexpression_to_points_to_sinks(), source_to_sinks(), struct_assignment_to_points_to(), struct_initialization_to_points_to(), subscripted_type_to_type(), type_to_final_pointed_type(), type_void_star_p(), typedef_formal_parameter_to_stub_points_to(), and user_call_to_points_to_sinks().
allocate a new type "pt" which includes directly "t".
Definition at line 5253 of file type.c.
References make_basic_pointer(), make_type_variable(), make_variable(), NIL, pips_assert, and type_consistent_p().
Referenced by array_type_to_pointer_type(), entity_null_locations(), intrinsic_call_to_type(), MakeVoidPointerParameter(), r_cell_reference_to_type(), subscripted_type_to_type(), and void_to_void_to_int_pointer_type().
returns t if t is not a functoional type, and the returned type if t is a functional type.
Type definitions are replaced. If t is undefined, returns a type_undefined.
Definition at line 5316 of file type.c.
References functional_result, type_functional, type_functional_p, type_undefined, type_undefined_p, and ultimate_type().
Referenced by call_to_points_to_sinks().
type.c
Definition at line 51 of file type.c.
References pips_assert, string_undefined, type_tag, and type_tag_as_string().
Referenced by add_or_kill_equivalenced_variables(), analyzed_basic_p(), basic_concrete_types_compatible_for_effects_interprocedural_translation_p(), basic_of_any_reference(), basic_of_external(), binary_arithmetic_operator_to_post_pv(), c_convex_effects_on_formal_parameter_backward_translation(), cell_reference_to_type(), CheckLeftHandSide(), compute_basic_concrete_type(), declaration_to_post_pv(), do_linearize_type(), dump_functional(), effect_indices_first_pointer_dimension_rank(), entity_all_module_xxx_locations_typed(), fprint_any_environment(), fprint_functional(), get_symbol_table(), MakeResultType(), module_initial_parameter_pv(), private_ultimate_type(), r_cell_reference_to_type(), reference_to_type(), safe_type_to_string(), translate_global_value(), type_this_call(), type_this_instruction(), and type_to_sizeof_value().
Definition at line 3877 of file type.c.
References basic_derived, basic_derived_p, entity_union_p(), type_variable, type_variable_p, ultimate_type(), and variable_basic.
Referenced by variable_references_may_conflict_p().
Definition at line 5765 of file type.c.
References pointer_type_p(), type_to_pointed_type(), and type_void_p.
Referenced by check_rhs_value_types(), and declaration_statement_to_points_to().
Is there a const qualifier associated to type t.
FI: this should be extended in case const can be carried by a typedef, but this first version should be enough for Molka.
Definition at line 5483 of file type.c.
References qualifiers_const_p(), type_variable, type_variable_p, and variable_qualifiers.
Referenced by safe_assigned_expression_to_transformer().
Returns true if t is a typedefED type.
Example : Myint i;
Definition at line 3189 of file type.c.
References basic_typedef_p, NIL, type_variable, type_variable_p, variable_basic, and variable_dimensions.
Referenced by generic_c_words_simplified_entity(), and rename_variable_type().
Definition at line 3471 of file type.c.
References private_ultimate_type().
Referenced by effects_to_dma().
Definition at line 3466 of file type.c.
References private_ultimate_type().
Referenced by add_any_variable_to_area(), add_conflicts(), add_implicit_interprocedural_write_effects(), add_index_bound_conditions(), add_reference_information(), any_expression_to_transformer(), any_scalar_assign_to_transformer_list(), any_scalar_assign_to_transformer_without_effect(), any_user_call_site_to_transformer(), anywhere_source_to_sinks(), array_bounded_p(), basic_and_indices_to_basic(), basic_of_any_reference(), basic_of_external(), basic_of_intrinsic(), basic_ultimate(), c_convex_effects_on_actual_parameter_forward_translation(), C_loop_range(), c_reference(), c_text_entities(), C_type_to_pointed_type(), call_to_functional_type(), call_to_post_pv(), call_to_transformer(), can_terapixify_expression_p(), CCompilationUnitMemoryAllocations(), check_declaration_uniqueness_p(), compare_basic_p(), count_element_references_to_v_p(), CreateReturnEntity(), declarations_to_dimensions(), derived_formal_parameter_to_stub_points_to(), do_array_to_pointer_walk_call_and_patch(), do_check_isolate_statement_preconditions_on_call(), do_group_constants_terapix(), do_group_count_elements_reduce(), do_linearize_array_reference(), do_linearize_prepatch_subscript(), do_linearize_prepatch_type(), do_linearize_type(), do_loop_unroll_with_prologue(), do_split_structure(), effect_interference(), effect_to_store_independent(), entity_array_p(), entity_atomic_reference_p(), entity_enum_variable_p(), entity_integer_scalar_p(), entity_memory_size(), entity_pointer_p(), entity_scalar_p(), entity_variable_length_array_p(), expression_basic(), expression_pointer_p(), extended_expression_constant_p(), fix_loop_index_sign(), for_to_do_loop_conversion(), freia_data2d_field(), freia_image_variable_p(), generic_stub_source_to_sinks(), get_symbol_table(), initialization_list_to_statements(), integer_scalar_entity_p(), intrinsic_call_to_type(), loadstore_type_conversion_string(), make_new_scalar_variable_with_prefix(), MakeFunctionExpression(), MemberIdentifierToExpression(), memory_dereferencing_p(), normalize_microcode(), number_of_fields(), number_of_items(), number_of_usable_functional_parameters(), parameter_passing_mode_p(), partial_eval_reference(), positive_expression_p(), private_ultimate_type(), reference_add_field_dimension(), reference_offset(), reference_to_points_to_sinks(), same_type_p(), set_entity_initial(), simplify_C_expression(), SizeOfArray(), some_basic_of_any_expression(), statement_insertion_fix_access_in_callers(), store_independent_reference_p(), struct_variable_to_pointer_locations(), struct_variable_to_pointer_subscripts(), TestCoupleOfReferences(), transformer_add_condition_information_updown(), type_dereferencement_depth(), type_pointer_on_struct_variable_p(), type_struct_variable_p(), type_to_final_pointed_type(), type_to_pointed_type(), type_to_returned_type(), type_union_variable_p(), type_void_or_void_pointer_p(), ultimate_type_equal_p(), UpdateEntity(), UpdateEntity2(), user_call_to_points_to_sinks(), value_passing_summary_transformer(), variable_initial_expression(), variable_to_dimensions(), variables_width_filter(), void_function_p(), and xml_print_parameter().
t1 | 1 |
t2 | 2 |
Definition at line 563 of file type.c.
References generic_type_equal_p(), hash_table_undefined, and ultimate_type().
Returns true if t is of type derived and if the derived type is a union.
Example : union foo var;
Note: different trom type_union_p
Definition at line 3151 of file type.c.
References basic_derived, derived_type_p(), entity_type, type_union_p, type_variable, and variable_basic.
Referenced by rename_variable_type().
Definition at line 2812 of file type.c.
References basic_int, basic_int_p, and DEFAULT_UNSIGNED_TYPE_SIZE.
Referenced by unsigned_type_p().
Predicates on types.
Definition at line 2821 of file type.c.
References type_variable, type_variable_p, unsigned_basic_p(), and variable_basic.
Referenced by add_type_information(), C_loop_range(), fix_loop_index_sign(), make_standard_integer_type(), make_standard_long_integer_type(), and positive_expression_p().
Definition at line 5632 of file type.c.
References DIMENSION, FOREACH, and variable_dimensions.
Referenced by create_scalar_stub_sink_cell(), pointer_reference_to_expression(), reference_dereferencing_to_points_to(), and reference_to_points_to_sinks().
v1 | 1 |
v2 | 2 |
Definition at line 819 of file type.c.
References generic_variable_equal_p(), and hash_table_undefined.
Referenced by register_scalar_communications().
Is this equivalent to dependent_type_p()?
Definition at line 2972 of file type.c.
References array_type_p(), dimension_lower, dimension_upper, extended_expression_constant_p(), FOREACH, type_variable, and variable_dimensions.
Referenced by entity_variable_length_array_p(), extended_expression_constant_p(), and fixed_length_array_type_p().
sel | el |
vt | t |
Definition at line 4254 of file type.c.
References basic_supporting_entities(), constant_expression_supporting_entities(), DIMENSION, dimension_lower, dimension_upper, FOREACH, fprintf(), ifdebug, pips_debug, print_entities(), variable_basic, and variable_dimensions.
Referenced by recursive_type_supporting_entities().
pips_debug(8, "Begin: ");
print_references(srl);
fprintf(stderr, "\n");
}
pips_debug(8, "End: ");
print_references(srl);
fprintf(stderr, "\n");
}
srl | rl |
Definition at line 4562 of file type.c.
References basic_supporting_references(), constant_expression_supporting_references(), DIMENSION, dimension_lower, dimension_upper, MAP, variable_basic, and variable_dimensions.
Referenced by recursive_type_supporting_references().
The dimensions cannot contain a type declaration
Definition at line 5115 of file type.c.
References basic_supporting_types(), fprintf(), ifdebug, pips_debug, print_entities(), and variable_basic.
Referenced by recursive_type_supporting_types().
|
static |
Definition at line 3496 of file type.c.
Referenced by entity_basic_concrete_type(), entity_basic_concrete_types_init(), and entity_basic_concrete_types_reset().
|
static |
Compute the list of entities implied in the definition of a type.
This list is empty for basic types such as int or char. But it increases rapidly with typedef, struct, union, bit and dimensions which can use enum elements in sizing expressions.
The supporting entities are gathered in an updated list, sel, supporting entity list. If entity a depends on entity b, b must appear first in the list. Each entity should appear only once but first we keep all occurences to make sure the partial order between.entities is respected.
Definition at line 3975 of file type.c.
Referenced by recursive_type_supporting_references(), and type_supporting_references().