GCC Middle and Back End API Reference
|
Data Structures | |
struct | type_hash |
struct | free_lang_data_d |
int _obstack_allocated_p | ( | struct obstack * | h, |
void * | obj | ||
) |
obstack.[ch] explicitly declined to prototype this.
|
static |
Add type or decl T to one of the list of tree nodes that need their language data removed. The lists are held inside FLD.
References find_decls_types(), gimple_phi_arg_def_ptr(), gimple_phi_num_args(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), and si.
int allocate_decl_uid | ( | void | ) |
Allocate and return a new UID from the DECL_UID namespace.
Referenced by make_node_stat().
tree array_type_nelts | ( | ) |
Return, as a tree node, the number of elements for TYPE (which is an ARRAY_TYPE) minus one. This counts only elements of the top array.
If they did it with unspecified bounds, then we should have already given an error about it before we got here.
TYPE_MAX_VALUE may not be set if the array has unknown length.
void assign_assembler_name_if_neeeded | ( | ) |
If T needs an assembler name, have one created for it.
When setting DECL_ASSEMBLER_NAME, the C++ mangler may emit diagnostics that use input_location to show locus information. The problem here is that, at this point, input_location is generally anchored to the end of the file (since the parser is long gone), so we don't have a good position to pin it to. To alleviate this problem, this uses the location of T's declaration. Examples of this are testsuite/g++.dg/template/cond2.C and testsuite/g++.dg/template/pr35240.C.
References attribute_list_contained(), attribute_value_equal(), copy_node(), get_attribute_name(), list_length(), and lookup_ident_attribute().
bool associative_tree_code | ( | ) |
Return true if CODE represents an associative tree code. Otherwise return false.
|
static |
|
static |
Compute a hash code for a list of attributes (chain of TREE_LIST nodes with names in the TREE_PURPOSE slots and args in the TREE_VALUE slots), by adding the hash codes of the individual attributes.
??? Do we want to add in TREE_VALUE too?
int attribute_list_contained | ( | ) |
Given two lists of attributes, return true if list L2 is completely contained within L1.
??? This would be faster if attribute names were stored in a canonicalized form. Otherwise, if L1 uses `foo' and L2 uses `__foo__', the long method must be used to show these elements are equivalent (which they are).
??? It's not clear that attributes with arguments will always be handled correctly.
First check the obvious, maybe the lists are identical.
Maybe the lists are similar.
Maybe the lists are equal.
This CONST_CAST is okay because lookup_attribute does not modify its argument and the return value is assigned to a const_tree.
References tree_int_cst_sgn().
Referenced by assign_assembler_name_if_neeeded().
int attribute_list_equal | ( | ) |
Given two lists of attributes, return true if list l2 is equivalent to l1.
References simple_cst_equal(), tcc_binary, tcc_comparison, tcc_expression, tcc_reference, tcc_statement, and tcc_unary.
Referenced by build_qualified_type(), and build_simple_mem_ref_loc().
|
static |
@verbatim
Compare two attributes for their value identity. Return true if the attribute values are known to be equal; otherwise return false.
References BUILT_IN_FRONTEND, and cgraph_get_node().
Referenced by assign_assembler_name_if_neeeded(), and build_decl_attribute_variant().
bool auto_var_in_fn_p | ( | ) |
Return true if VAR is an automatic variable defined in function FN.
References get_tree_code_name(), internal_error(), and trim_filename().
Referenced by remap_type().
tree bit_position | ( | ) |
Return the bit position of FIELD, in bits from the start of the record. This is a tree of type bitsizetype.
Referenced by add_loc_list(), count_type_elements(), fortran_common(), and tree_cons_stat().
bool block_may_fallthru | ( | ) |
Try to determine if we can fall out of the bottom of BLOCK. This guess need not be 100% accurate; simply be conservative and return true if we don't know. This is used only to avoid stupidly generating extra code. If we're wrong, we'll just delete the extra code later.
This CONST_CAST is okay because expr_last returns its argument unmodified and we assign it to a const_tree.
Easy cases. If the last statement of the block implies control transfer, then we can't fall through.
If SWITCH_LABELS is set, this is lowered, and represents a branch to a selected label and hence can not fall through. Otherwise SWITCH_BODY is set, and the switch can fall through.
The finally clause is always executed after the try clause, so if it does not fall through, then the try-finally will not fall through. Otherwise, if the try clause does not fall through, then when the finally clause falls through it will resume execution wherever the try clause was going. So the whole try-finally will only fall through if both the try clause and the finally clause fall through.
FALLTHRU
Functions that do not return do not fall through.
location_t* block_nonartificial_location | ( | ) |
If BLOCK is inlined from an __attribute__((__artificial__)) routine, return pointer to location from where it has been called.
If AO is an artificial inline, point RET to the call site locus at which it has been inlined and continue the loop, in case AO's caller is also an artificial inline.
tree block_ultimate_origin | ( | ) |
Determine the "ultimate origin" of a block. The block may be an inlined instance of an inlined instance of a block which is local to an inline function, so we have to trace all of the way back through the origin chain to find out what sort of node actually served as the original seed for the given block.
output_inline_function sets BLOCK_ABSTRACT_ORIGIN for all the nodes in the function to point to themselves; ignore that if we're trying to output the abstract instance of this function.
The block's abstract origin chain may not be the *ultimate* origin of the block. It could lead to a DECL that has an abstract origin set. If so, we want that DECL's abstract origin (which is what DECL_ORIGIN will give us if it has one). Note that DECL's abstract origins are supposed to be the most distant ancestor (or so decl_ultimate_origin claims), so we don't need to loop following the DECL origins.
References using_eh_for_cleanups_flag.
tree build0_stat | ( | ) |
Build an expression of code CODE, data type TYPE, and operands as specified. Expressions and reference nodes can be created this way. Constants, decls, types and misc nodes cannot be. We define 5 non-variadic functions, from 0 to 4 arguments. This is enough for all extant tree codes.
tree build1_stat | ( | ) |
All of these have side-effects, no matter what their operands are.
Whether a dereference is readonly has nothing to do with whether its operand is readonly.
References get_addr_base_and_unit_offset(), is_gimple_min_invariant(), and is_gimple_reg().
tree build2_stat | ( | ) |
When sizetype precision doesn't match that of pointers we need to be able to build explicit extensions or truncations of the offset argument.
Below, we automatically set TREE_SIDE_EFFECTS and TREE_READONLY for the result based on those same flags for the arguments. But if the arguments aren't really even `tree' expressions, we shouldn't be trying to do this.
Expressions without side effects may be constant if their arguments are as well.
References layout_decl(), make_node_stat(), and type().
As a special exception, if COND_EXPR has NULL branches, we assume that it is a gimple statement and always consider it to have side effects.
References lang_hooks::name, and vec_safe_push().
tree build4_stat | ( | enum tree_code | code, |
tree | tt, | ||
tree | arg0, | ||
tree | arg1, | ||
tree | arg2, | ||
tree arg3 | MEM_STAT_DECL | ||
) |
Referenced by tree_operand_length().
tree build5_stat | ( | enum tree_code | code, |
tree | tt, | ||
tree | arg0, | ||
tree | arg1, | ||
tree | arg2, | ||
tree | arg3, | ||
tree arg4 | MEM_STAT_DECL | ||
) |
Referenced by tree_operand_check().
tree build_aligned_type | ( | ) |
Create a variant of type T with alignment ALIGN.
tree build_all_ones_cst | ( | ) |
Return an integer of type TYPE containing all 1's in as much precision as it contains, or a complex or vector whose subparts are such integers.
tree build_array_type | ( | ) |
Wrapper around build_array_type_1 with SHARED set to true.
References build_complex_type().
Referenced by coverage_end_function(), coverage_obj_init(), expand_builtin_prefetch(), expand_builtin_va_copy(), and lookup_tramp_for_decl().
|
static |
Construct, lay out and return the type of arrays of elements with ELT_TYPE and number of elements specified by the range of values of INDEX_TYPE. If SHARED is true, reuse such a type that has already been constructed.
If the element type is incomplete at this point we get marked for structural equality. Do not record these types in the canonical type hashtable.
tree build_array_type_nelts | ( | ) |
Return a representation of ELT_TYPE[NELTS], using indices of type sizetype.
tree build_block | ( | ) |
BLOCK nodes are used to represent the structure of binding contours and declarations, once those contours have been exited and their contents compiled. This information is used for outputting debugging info.
|
static |
Helper function for build_call_* functions; build a CALL_EXPR with indicated RETURN_TYPE, FN, and NARGS, but do not initialize any of the argument slots.
References tsi_end_p(), tsi_next(), tsi_start(), and tsi_stmt_ptr().
tree build_call_array_loc | ( | location_t | loc, |
tree | return_type, | ||
tree | fn, | ||
int | nargs, | ||
const tree * | args | ||
) |
Build a CALL_EXPR of class tcc_vl_exp with the indicated RETURN_TYPE and FN and a null static chain slot. NARGS is the number of call arguments which are specified as a tree array ARGS.
Referenced by maybe_with_size_expr().
tree build_call_nary | ( | ) |
Build a CALL_EXPR of class tcc_vl_exp with the indicated RETURN_TYPE and FN and a null static chain slot. NARGS is the number of call arguments which are specified as "..." arguments.
tree build_call_valist | ( | ) |
Build a CALL_EXPR of class tcc_vl_exp with the indicated RETURN_TYPE and FN and a null static chain slot. NARGS is the number of call arguments which are specified as a va_list ARGS.
tree build_call_vec | ( | ) |
Like build_call_array, but takes a vec.
tree build_case_label | ( | ) |
Create a CASE_LABEL_EXPR tree node and return it.
References integer_all_onesp().
Referenced by preprocess_case_label_vec_for_gimple().
void build_common_builtin_nodes | ( | void | ) |
Call this function after instantiating all builtins that the language front end cares about. This will build the rest of the builtins that are relied upon by the tree optimizers and the middle-end.
If we're checking the stack, `alloca' can throw.
If there's a possibility that we might use the ARM EABI, build the alternate __cxa_end_cleanup node used to resume from C++ and Java.
The exception object and filter values from the runtime. The argument must be zero before exception lowering, i.e. from the front end. After exception lowering, it will be the region number for the exception landing pad. These functions are PURE instead of CONST to prevent them from being hoisted past the exception edge that will initialize its value in the landing pad.
Only use TM_PURE if we we have TM language support.
Complex multiplication and division. These are handled as builtins rather than optabs because emit_library_call_value doesn't support complex. Further, we can do slightly better with folding these beasties if the real and complex parts of the arguments are separate.
void build_common_tree_nodes | ( | ) |
Create nodes for all integer types (and error_mark_node) using the sizes of C datatypes. SIGNED_CHAR specifies whether char is signed, SHORT_DOUBLE specifies whether double should be of the same precision as float.
Define both `signed char' and `unsigned char'.
Define `char', which is like either `signed char' or `unsigned char' but not the same as either.
TODO: This isn't correct, but as logic depends at the moment on host's instead of target's wide-integer. If there is a target not supporting TImode, but has an 128-bit integer-scalar register, this target check needs to be adjusted.
Define a boolean type. This type only represents boolean values but may be larger than char depending on the value of BOOL_TYPE_SIZE. Front ends which want to override this size (i.e. Java) can redefine boolean_type_node before calling build_common_tree_nodes_2.
Define what type to use for size_t.
Fill in the rest of the sized types. Reuse existing type nodes when possible.
Define these next since types below may used them.
We are not going to have real types in C with less than byte alignment, so we might as well not have any types that claim to have it.
Fixed size integer types.
Decimal float types.
Make fixed-point nodes based on sat/non-sat and signed/unsigned.
Make fixed-point type nodes based on four different widths.
Make fixed-point mode nodes based on sat/non-sat and signed/unsigned.
Fixed-point type and mode nodes.
Many back-ends define record types without setting TYPE_NAME. If we copied the record type here, we'd keep the original record type without a name. This breaks name mangling. So, don't copy record types and let c_common_nodes_and_builtins() declare the type to be __builtin_va_list.
tree build_complex | ( | ) |
Return a newly constructed COMPLEX_CST node whose value is specified by the real and imaginary parts REAL and IMAG. Both REAL and IMAG should be constant nodes. TYPE, if specified, will be the type of the COMPLEX_CST; otherwise a new type will be made.
Referenced by build_one_cst(), build_string(), and fold_negate_expr().
tree build_complex_type | ( | ) |
Create a complex type whose components are COMPONENT_TYPE.
Make a node of the sort we want.
If we already have such a type, use the old one.
We need to create a name, since complex is a fundamental type.
Referenced by build_array_type().
tree build_constructor | ( | ) |
Return a new CONSTRUCTOR node whose type is TYPE and whose values are in the vec pointed to by VALS.
Mostly ctors will have elts that don't have side-effects, so the usual case is to scan all the elements. Hence a single loop for both const and side effects, rather than one loop each (with early outs).
References FIXED_VALUE_TYPE, memcpy(), and type().
Referenced by build_one_cst(), build_stack_save_restore(), build_vector_from_val(), and coverage_obj_init().
tree build_constructor_from_list | ( | ) |
Return a new CONSTRUCTOR node whose type is TYPE and whose values are in a list pointed to by VALS.
tree build_constructor_single | ( | ) |
Build a CONSTRUCTOR node made of a single initializer, with the specified INDEX and VALUE.
tree build_constructor_va | ( | ) |
Return a new CONSTRUCTOR node whose type is TYPE. NELTS is the number of elements, provided as index/value pairs.
tree build_decl_attribute_variant | ( | ) |
Return a declaration like DDECL except that its DECL_ATTRIBUTES is ATTRIBUTE.
References attribute_value_equal(), get_attribute_name(), lookup_attribute(), and lookup_attribute_spec().
Create a DECL_... node of code CODE, name NAME and data type TYPE. We do NOT enter this node in any sort of symbol table. LOC is the location of the decl. layout_decl is used to set up the decl's storage layout. Other slots are initialized to 0 or null pointers.
if (type == error_mark_node) type = integer_type_node;
That is not done, deliberately, so that having error_mark_node as the type can suppress useless errors in the use of this variable.
tree build_distinct_type_copy | ( | ) |
Create a new distinct copy of TYPE. The new type is made its own MAIN_VARIANT. If TYPE requires structural equality checks, the resulting type requires structural equality checks; otherwise, its TYPE_CANONICAL points to itself.
Set the canonical type either to a new equivalence class, or propagate the need for structural equality checks.
Make it its own variant.
Note that it is now possible for TYPE_MIN_VALUE to be a value whose TREE_TYPE is not t. This can also happen in the Ada frontend when using subtypes.
Referenced by ipa_get_vector_of_formal_parms().
tree build_empty_stmt | ( | ) |
Build an empty statement at location LOC.
tree build_fixed | ( | ) |
Return a new FIXED_CST node whose type is TYPE and value is F.
tree build_fn_decl | ( | ) |
Builds and returns function declaration with NAME and TYPE.
References is_attribute_p(), and lookup_attribute().
Referenced by gimple_init_edge_profiler().
Build variant of function decl ORIG_DECL skipping ARGS_TO_SKIP and the return value if SKIP_RETURN is true. Arguments from DECL_ARGUMENTS list can't be removed now, since they are linked by TREE_CHAIN directly. The caller is responsible for eliminating them when they are being duplicated (i.e. copy_arguments_for_versioning).
For declarations setting DECL_VINDEX (i.e. methods) we expect first argument to be THIS pointer.
When signature changes, we need to clear builtin info.
References tree_low_cst(), lang_hooks_for_types::type_for_size, and lang_hooks::types.
tree build_function_type | ( | ) |
Construct, lay out and return the type of functions returning type VALUE_TYPE given arguments of types ARG_TYPES. ARG_TYPES is a chain of TREE_LIST nodes whose TREE_VALUEs are data type nodes for the arguments of the function. If such a type has already been constructed, reuse it.
Make a node of the sort we want.
If we already have such a type, use the old one.
Set up the canonical type.
Referenced by tree_class_check_failed().
tree build_function_type_array | ( | ) |
Build a function type. RETURN_TYPE is the type returned by the function. The function takes N named arguments, the types of which are provided in ARG_TYPES.
|
static |
Build a function type. RETURN_TYPE is the type returned by the function; VAARGS indicates whether the function takes varargs. The function takes N named arguments, the types of which are provided in ARG_TYPES.
References double_int::low.
Referenced by build_range_type().
tree build_function_type_list | ( | ) |
Build a function type. The RETURN_TYPE is the type returned by the function. If additional arguments are provided, they are additional argument types. The list of argument types must always be terminated by NULL_TREE.
Referenced by default_stack_protect_guard(), gimple_init_edge_profiler(), and tree_range_check_failed().
|
static |
Build a function type. The RETURN_TYPE is the type returned by the function. If VAARGS is set, no void_type_node is appended to the the list. ARGP must be always be terminated be a NULL_TREE.
References double_int::is_negative(), and tree_to_double_int().
Referenced by build_range_type_1().
|
static |
Build variant of function type ORIG_TYPE skipping ARGS_TO_SKIP and the return value if SKIP_RETURN is true.
Use copy_node to preserve as much as possible from original type (debug info, attribute lists etc.) Exception is METHOD_TYPEs must have THIS argument. When we are asked to remove it, we need to build new FUNCTION_TYPE instead.
This is a new type, not a copy of an old type. Need to reassociate variants. We can handle everything except the main variant lazily.
tree build_index_type | ( | ) |
Create a type of integers to be the TYPE_DOMAIN of an ARRAY_TYPE. MAXVAL should be the maximum value in the domain (one less than the length of the array). The maximum value that MAXVAL can have is INT_MAX for a HOST_WIDE_INT. We don't enforce this limit, that is up to caller (e.g. language front end). The limit exists because the result is a signed type and we don't handle sizes that use more than one HOST_WIDE_INT.
Referenced by build_one_array(), coverage_end_function(), coverage_obj_init(), expand_builtin_va_copy(), and lookup_tramp_for_decl().
tree build_int_cst | ( | ) |
Create an INT_CST node with a LOW value sign extended to TYPE.
Support legacy code.
Referenced by add_rshift(), adjust_simduid_builtins(), analyze_ziv_subscript(), build_call_expr(), build_one_cst(), build_string(), check_bool_pattern(), compare_range_with_value(), compute_antic(), copy_value_range(), coverage_counter_alloc(), debug_ddrs(), determine_base_object(), emit_case_decision_tree(), expand_builtin_prefetch(), expand_omp_sections(), expand_transaction(), find_loop_location(), finish_builtin_struct(), fold_builtin_4(), fold_builtin_exponent(), fold_builtin_n(), fold_builtin_sprintf_chk_1(), fold_builtin_strncpy(), fold_mathfn_compare(), gather_stats_on_scev_database_1(), get_expr_id(), get_frame_arg(), get_ssa_def_if_simple_copy(), get_tm_region_blocks(), handle_pointer_plus(), ifcombine_ifandif(), instrument_builtin_call(), instrument_derefs(), inverse(), ipa_tm_diagnose_tm_safe(), lower_send_clauses(), make_fancy_name(), make_pass_tm_init(), maybe_emit_sprintf_chk_warning(), number_of_iterations_cond(), rewrite_call_expr(), simple_operand_p(), tree_to_aff_combination(), type_for_widest_vector_mode(), vect_create_cond_for_alias_checks(), vect_do_peeling_for_loop_bound(), vect_get_mask_element(), vect_permute_store_chain(), vect_slp_analyze_bb(), and vrp_meet_1().
tree build_int_cst_type | ( | ) |
Create an INT_CST node with a LOW value sign extended to TYPE.
Referenced by build_vector_type_for_mode(), and fold_builtin_strcspn().
tree build_int_cst_wide | ( | ) |
Create an INT_CST node of TYPE and value HI:LOW. The returned node is always shared. For small integers we use a per-type vector cache, for larger ones we use a single hash table.
Fallthru.
Cache NULL pointer and zero bounds.
Cache false or true.
Cache 0..N
Cache -1..N
Look for it in the type's vector of small shared ints.
Make sure no one is clobbering the shared constant.
Create a new shared int.
Use the cache of larger shared ints.
Insert this one into the hash table.
Make a new node for next time round.
Referenced by copy_tree_body_r(), initializer_constant_valid_p_1(), and remap_gimple_op_r().
tree build_invariant_address | ( | ) |
Return an invariant ADDR_EXPR of type TYPE taking the address of BASE offsetted by OFFSET units.
tree build_low_bits_mask | ( | ) |
Builds an integer constant in TYPE such that lowest BITS bits are ones and the rest are zeros.
Sign extended all-ones mask.
tree build_method_type | ( | ) |
Construct, lay out and return the type of methods belonging to class BASETYPE and whose arguments and values are described by TYPE. If that type exists already, reuse it. TYPE must be a FUNCTION_TYPE node.
Build a METHOD_TYPE for a member of BASETYPE. The RETTYPE (a TYPE) and ARGTYPES (a TREE_LIST) are the return type and arguments types for the method. An implicit additional parameter (of type pointer-to-BASETYPE) is added to the ARGTYPES.
Make a node of the sort we want.
The actual arglist for this function includes a "hidden" argument which is "this". Put it into the list of argument types.
If we already have such a type, use the old one.
Set up the canonical type.
References double_int::mask(), mpz_set_double_int(), and tree_to_double_int().
tree build_minus_one_cst | ( | ) |
Return a constant of arithmetic type TYPE which is the opposite of the multiplicative identity of the set TYPE.
We can only generate 1 for accum types.
Referenced by build_string().
tree build_nonshared_array_type | ( | ) |
Wrapper around build_array_type_1 with SHARED set to false.
tree build_nonshared_range_type | ( | ) |
Wrapper around build_range_type_1 with SHARED set to false.
tree build_nonstandard_integer_type | ( | unsigned HOST_WIDE_INT | precision, |
int | unsignedp | ||
) |
Builds a signed or unsigned integer type of precision PRECISION. Used for C bitfields whose precision does not match that of built-in target types.
tree build_nt | ( | ) |
Similar except don't specify the TREE_TYPE and leave the TREE_SIDE_EFFECTS as 0. It is permissible for arguments to be null, or even garbage if their values do not matter.
tree build_nt_call_vec | ( | ) |
Similar to build_nt, but for creating a CALL_EXPR object with a tree vec.
tree build_offset_type | ( | ) |
Construct, lay out and return the type of offsets to a value of type TYPE, within an object of type BASETYPE. If a suitable offset type exists already, reuse it.
Make a node of the sort we want.
If we already have such a type, use the old one.
tree build_omp_clause | ( | ) |
Build an OpenMP clause with code CODE. LOC is the location of the clause.
Referenced by convert_tramp_reference_stmt(), and note_nonlocal_vla_type().
tree build_one_cst | ( | ) |
Return a constant of arithmetic type TYPE which is the multiplicative identity of the set TYPE.
We can only generate 1 for accum types.
References build_complex(), build_constructor(), build_fixed(), build_int_cst(), build_real(), build_vector_from_val(), build_zero_cst(), dconst0, and FCONST0.
Referenced by find_loop_location().
tree build_opaque_vector_type | ( | ) |
Similarly, but builds a variant type with TYPE_VECTOR_OPAQUE set.
We always build the non-opaque variant before the opaque one, so if it already exists, it is TYPE_NEXT_VARIANT of this one.
Othewise build a variant type and make sure to queue it after the non-opaque type.
tree build_optimization_node | ( | ) |
Build an OPTIMIZATION_NODE based on the options in OPTS.
Use the cache of optimization nodes.
Insert this one into the hash table.
Make a new node for next time round.
tree build_pointer_type | ( | ) |
By default build pointers in ptr_mode.
Referenced by assign_parms(), expand_builtin_va_copy(), gimple_init_edge_profiler(), gimplify_return_expr(), lookup_field_for_decl(), reverse_op(), and ubsan_source_location_type().
Constructors for pointer, array and function types. (RECORD_TYPE, UNION_TYPE and ENUMERAL_TYPE nodes are constructed by language-dependent code, not here.)
Construct, lay out and return the type of pointers to TO_TYPE with mode MODE. If CAN_ALIAS_ALL is TRUE, indicate this type can reference all of memory. If such a type has already been constructed, reuse it.
If the pointed-to type has the may_alias attribute set, force a TYPE_REF_CAN_ALIAS_ALL pointer to be generated.
In some cases, languages will have things that aren't a POINTER_TYPE (such as a RECORD_TYPE for fat pointers in Ada) as TYPE_POINTER_TO. In that case, return that type without regard to the rest of our operands. ??? This is a kludge, but consistent with the way this function has always operated and there doesn't seem to be a good way to avoid this at the moment.
First, if we already have a type for pointers to TO_TYPE and it's the proper mode, use it.
Lay out the type. This function has many callers that are concerned with expression-construction, and this simplifies them all.
Referenced by expand_omp_atomic_load(), make_or_reuse_fract_type(), and simple_cst_equal().
tree build_qualified_type | ( | ) |
Like get_qualified_type, but creates the type if it does not exist. This function never returns NULL_TREE.
See if we already have the appropriate qualified variant.
If not, build it.
Propagate structural equality.
Build the underlying canonical type, since it is different from TYPE.
T is its own canonical type.
References attribute_list_equal(), type_hash::hash, and type_hash::type.
Referenced by coverage_obj_init(), expand_value_return(), and gimplify_switch_expr().
tree build_range_type | ( | ) |
Wrapper around build_range_type_1 with SHARED set to true.
References build_function_type_array_1().
Referenced by expand_builtin_prefetch().
|
static |
Create a range of some discrete type TYPE (an INTEGER_TYPE, ENUMERAL_TYPE or BOOLEAN_TYPE) with low bound LOWVAL and high bound HIGHVAL. If SHARED is true, reuse such a type that has already been constructed.
Since we cannot reliably merge this type, we need to compare it using structural equality checks.
References build_function_type_list_1().
Referenced by commutative_tree_code().
tree build_real | ( | ) |
Return a new REAL_CST node whose type is TYPE and value is D.
??? Used to check for overflow here via CHECK_FLOAT_TYPE. Consider doing it via real_convert now.
tree build_real_from_int_cst | ( | ) |
Given a tree representing an integer constant I, return a tree representing the same value as a floating-point constant of type TYPE.
Referenced by chrec_evaluate().
tree build_reference_type | ( | ) |
Build the node for the type of references-to-TO_TYPE by default in ptr_mode.
Same as build_pointer_type_for_mode, but for REFERENCE_TYPE.
If the pointed-to type has the may_alias attribute set, force a TYPE_REF_CAN_ALIAS_ALL pointer to be generated.
In some cases, languages will have things that aren't a REFERENCE_TYPE (such as a RECORD_TYPE for fat pointers in Ada) as TYPE_REFERENCE_TO. In that case, return that type without regard to the rest of our operands. ??? This is a kludge, but consistent with the way this function has always operated and there doesn't seem to be a good way to avoid this at the moment.
First, if we already have a type for pointers to TO_TYPE and it's the proper mode, use it.
tree build_simple_mem_ref_loc | ( | ) |
Build a simple MEM_REF tree with the sematics of a plain INDIRECT_REF on the pointer PTR.
For convenience allow addresses that collapse to a simple base and offset.
References attribute_list_equal(), and warning().
Referenced by default_pch_valid_p().
tree build_string | ( | ) |
Return a newly constructed STRING_CST node whose value is the LEN characters at STR. Note that for a C string literal, LEN should include the trailing NUL. The TREE_TYPE is not initialized.
Do not waste bytes provided by padding of struct tree_string.
References build_complex(), build_fixed(), build_int_cst(), build_minus_one_cst(), build_real(), build_vector_from_val(), dconstm1, and fixed_from_double_int().
Referenced by expand_builtin_va_copy().
tree build_target_option_node | ( | ) |
Build a TARGET_OPTION_NODE based on the options in OPTS.
Use the cache of optimization nodes.
Insert this one into the hash table.
Make a new node for next time round.
tree build_translation_unit_decl | ( | ) |
Builds a new translation-unit decl with name NAME, queues it in the global list of translation-unit decls and returns it.
tree build_tree_list_stat | ( | ) |
Return a newly created TREE_LIST node whose purpose and value fields are PARM and VALUE.
Referenced by list_length().
tree build_tree_list_vec_stat | ( | ) |
Build a chain of TREE_LIST nodes from a vector.
References size_in_bytes().
tree build_type_attribute_qual_variant | ( | ) |
Return a type like TTYPE except that its TYPE_ATTRIBUTE is ATTRIBUTE and its qualifiers are QUALS. Record such modified types already made so we don't make duplicates.
Building a distinct copy of a tagged type is inappropriate; it causes breakage in code that expects there to be a one-to-one relationship between a struct and its fields. build_duplicate_type is another solution (as used in handle_transparent_union_attribute), but that doesn't play well with the stronger C++ type identity model.
If the target-dependent attributes make NTYPE different from its canonical type, we will need to use structural equality checks for this type.
tree build_type_attribute_variant | ( | ) |
Return a type like TTYPE except that its TYPE_ATTRIBUTE is ATTRIBUTE. Record such modified types already made so we don't make duplicates.
tree build_type_no_quals | ( | ) |
Build a type that is compatible with t but has no cv quals anywhere in its type, thus const char *const *const * -> char ***.
References NOT_BUILT_IN.
tree build_varargs_function_type_array | ( | ) |
Build a variable argument function type. RETURN_TYPE is the type returned by the function. The function takes N named arguments, the types of which are provided in ARG_TYPES.
tree build_varargs_function_type_list | ( | ) |
Build a variable argument function type. The RETURN_TYPE is the type returned by the function. If additional arguments are provided, they are additional argument types. The list of argument types must always be terminated by NULL_TREE.
References double_int::is_negative(), and double_int::ugt().
tree build_variant_type_copy | ( | ) |
Create a new variant of TYPE, equivalent but distinct. This is so the caller can modify it. TYPE_CANONICAL for the return type will be equivalent to TYPE_CANONICAL of TYPE, indicating that the types are considered equal by the language itself (or that both types require structural equality checks).
Since we're building a variant, assume that it is a non-semantic variant. This also propagates TYPE_STRUCTURAL_EQUALITY_P.
Add the new type to the chain of variants of TYPE.
Referenced by default_store_bounds_for_arg(), and tree_check_failed().
tree build_vector_from_ctor | ( | ) |
Return a new VECTOR_CST node whose type is TYPE and whose values are extracted from V, a vector of CONSTRUCTOR_ELT.
Referenced by optimize_compound_literals_in_ctor().
tree build_vector_from_val | ( | ) |
Build a vector of type VECTYPE where all the elements are SCs.
Verify that the vector type is suitable for SC. Note that there is some inconsistency in the type-system with respect to restrict qualifications of pointers. Vector types always have a main-variant element type and the qualification is applied to the vector-type. So TREE_TYPE (vector-type) does not return a properly qualified vector element-type.
References build_constructor(), list_length(), and vec_alloc().
Referenced by build_one_cst(), build_string(), and vect_init_vector_1().
tree build_vector_stat | ( | ) |
Return a new VECTOR_CST node whose type is TYPE and whose values are in a list pointed to by VALS.
Iterate through elements and check for overflow.
Don't crash if we get an address constant.
tree build_vector_type | ( | ) |
Similarly, but takes the inner type and number of units, which must be a power of two.
tree build_vector_type_for_mode | ( | ) |
Returns a vector tree node given a mode (integer, vector, or BLKmode) and the inner type.
Check that there are no leftover bits.
References build_int_cst_type(), and HOST_BITS_PER_WIDE_INT.
tree build_vl_exp_stat | ( | ) |
Build a tcc_vl_exp object with code CODE and room for LEN operands. LEN includes the implicit operand count in TREE_OPERAND 0, and so must be >= 1. Except for the CODE and operand count field, other storage for the object is initialized to zeros.
Can't use TREE_OPERAND to store the length because if checking is enabled, it will try to check the length before we store it. :-P
tree build_zero_cst | ( | ) |
Build 0 constant of type TYPE. This is used by constructor folding and thus the constant should be represented in memory by zero(es).
Referenced by build_one_cst(), lower_gimple_return(), and vn_reference_lookup_or_insert_for_pieces().
tree byte_position | ( | ) |
Return the byte position of FIELD, in bytes from the start of the record. This is a tree of type sizetype.
Referenced by ctor_to_vec().
void cache_integer_cst | ( | ) |
Fallthru.
Cache NULL pointer.
Cache false or true.
Cache 0..N
Cache -1..N
Look for it in the type's vector of small shared ints.
Use the cache of larger shared ints.
If there is already an entry for the number verify it's the same.
Otherwise insert this one into the hash table.
tree chain_index | ( | ) |
Returns element number IDX (zero-origin) of chain CHAIN, or NULL_TREE.
int chain_member | ( | ) |
Return nonzero if ELEM is part of the chain CHAIN.
References make_node_stat().
tree chainon | ( | ) |
Concatenate two chains of nodes (chained through TREE_CHAIN) by modifying the last node in chain 1 to point to chain 2. This is the Lisp primitive `nconc'.
Referenced by decl_attributes(), get_formal_tmp_var(), and iterative_hash_exprs_commutative().
|
static |
Returns true iff CAND is equivalent to BASE with ALIGN.
Apparently this is needed for Objective-C.
Check alignment.
References debug_args_for_decl, and decl_debug_args_lookup().
bool check_qualified_type | ( | ) |
Returns true iff CAND is equivalent to BASE with TYPE_QUALS.
Apparently this is needed for Objective-C.
Check alignment.
References debug_args_for_decl.
|
static |
|
static |
Return nonzero if the value represented by *X (an OPTIMIZATION or TARGET_OPTION tree node) is the same as that given by *Y, which is the same.
|
static |
|
static |
These are the hash table functions for the hash table of OPTIMIZATION_NODEq nodes.
Return the hash code code X, an OPTIMIZATION_NODE or TARGET_OPTION code.
assume most opt flags are just 0/1, some are 2-3, and a few might be something else.
void clean_symbol_name | ( | ) |
P is a string that will be used in a symbol. Mask out any characters that are not valid in that context.
Referenced by remove_suffix().
bool commutative_ternary_tree_code | ( | ) |
Return true if CODE represents a ternary tree code for which the first two operands are commutative. Otherwise return false.
bool commutative_tree_code | ( | ) |
Return true if CODE represents a commutative tree code. Otherwise return false.
References build_range_type_1().
Referenced by find_use_stmt(), and vn_reference_lookup().
int comp_type_attributes | ( | ) |
Return 0 if the attributes for two types are incompatible, 1 if they are compatible, and 2 if they are nearly compatible (which causes a warning to be generated).
We don't need to compare trees again, as we did this already in first loop.
All types - affecting identity - are equal, so there is no need to call target hook for comparison.
As some type combinations - like default calling-convention - might be compatible, we have to call the target hook to get the final result.
References cgraph_get_node(), cgraph_release_function_body(), cgraph_node::clones, symtab_node_base::definition, lang_hooks::free_lang_data, free_lang_data_in_one_sizepos(), gimple_has_body_p(), and release_function_body().
int compare_tree_int | ( | ) |
Compare the value of T, an INTEGER_CST, with U, an unsigned integer value. Return -1, 0, or 1 if the value of T is less than, equal to, or greater than U, respectively.
References nonstandard_integer_type_cache.
Referenced by assemble_thunks_and_aliases(), assign_parms(), constant_pointer_difference(), expand_expr_real_1(), fold_builtin_exponent(), fold_builtin_strcspn(), initialize_argument_information(), and nonnull_arg_p().
bool contains_bitfld_component_ref_p | ( | ) |
Return true if REF has a COMPONENT_REF with a bit-field field declaration somewhere in it.
bool contains_placeholder_p | ( | ) |
Return true if EXP contains a PLACEHOLDER_EXPR, i.e. if it represents a size or offset that depends on a field within a record.
Don't look at any PLACEHOLDER_EXPRs that might be in index or bit position computations since they will be converted into a WITH_RECORD_EXPR involving the reference, which will assume here will be valid.
Ignoring the first operand isn't quite right, but works best.
The save_expr function never wraps anything containing a PLACEHOLDER_EXPR.
References push_without_duplicates(), refs, tcc_binary, tcc_comparison, tcc_constant, tcc_declaration, tcc_exceptional, tcc_expression, tcc_reference, tcc_unary, and tcc_vl_exp.
tree copy_list | ( | ) |
Return a copy of a chain of nodes, chained through the TREE_CHAIN field. For example, this can copy a list made of TREE_LIST nodes.
Referenced by decl_attributes().
tree copy_node_stat | ( | ) |
Return a new node with the same contents as NODE except that its TREE_CHAIN, if it has one, is zero and it has a fresh uid.
DECL_DEBUG_EXPR is copied explicitely by callers.
The following is so that the debug code for the copy is different from the original type. The two statements usually duplicate each other (because they clear fields of the same union), but the optimizer should catch that.
Do not copy the values cache.
unsigned crc32_byte | ( | ) |
Generate a crc32 of a byte.
Referenced by coverage_compute_profile_id().
unsigned crc32_string | ( | ) |
Generate a crc32 of a string.
References targetm.
unsigned crc32_unsigned | ( | ) |
Generate a crc32 of a 32-bit unsigned.
|
static |
Generate a crc32 of a byte.
tree create_artificial_label | ( | ) |
Create a nameless artificial label and put it in the current function context. The label has a location of LOC. Returns the newly created label.
Referenced by do_return_redirection(), examine_assign_tm(), factor_computed_gotos(), find_goto_replacement(), frob_into_branch_around(), gen_def_assigns(), gimplify_vla_decl(), honor_protect_cleanup_actions(), and lower_gimple_return().
bool cst_and_fits_in_hwi | ( | ) |
Checks that X is integer constant that can be expressed in (unsigned) HOST_WIDE_INT without loss of precision.
References sc.
Referenced by is_miss_rate_acceptable(), and release_mem_refs().
Return the values of the elements of a CONSTRUCTOR as a vector of trees.
References byte_position(), and tree_low_cst().
bool decl_address_invariant_p | ( | ) |
Return whether OP is a DECL whose address is function-invariant.
The conditions below are slightly less strict than the one in staticp.
Referenced by is_gimple_ip_invariant().
bool decl_address_ip_invariant_p | ( | ) |
Return whether OP is a DECL whose address is interprocedural-invariant.
The conditions below are slightly less strict than the one in staticp.
References tree_invariant_p().
tree decl_assembler_name | ( | ) |
The name of the object as the assembler will see it (but before any translations made by ASM_OUTPUT_LABELREF). Often this is the same as DECL_NAME. It is an IDENTIFIER_NODE.
References strlen(), and user_label_prefix.
bool decl_assembler_name_equal | ( | ) |
Compare ASMNAME with the DECL_ASSEMBLER_NAME of DECL.
If the target assembler name was set by the user, things are trickier. We have a leading '*' to begin with. After that, it's arguable what is the correct thing to do with -fleading-underscore. Arguably, we've historically been doing the wrong thing in assemble_alias by always printing the leading underscore. Since we're not changing that, make sure user_label_prefix follows the '*' before matching.
Referenced by hash_node_by_assembler_name().
hashval_t decl_assembler_name_hash | ( | ) |
Hash asmnames ignoring the user specified marks.
References tcc_declaration, and gdbhooks::TYPE_DECL.
Referenced by eq_node().
Insert a mapping FROM->empty vector of debug arguments in the value expression hashtable.
Referenced by ipa_modify_call_arguments().
Lookup a vector of debug arguments for FROM, and return it if we find one.
Referenced by check_aligned_type().
void decl_debug_expr_insert | ( | ) |
Insert a mapping FROM->TO in the debug expression hashtable.
References simple_cst_equal().
tree decl_debug_expr_lookup | ( | ) |
Lookup a debug expression for FROM, and return it if we find one.
void decl_fini_priority_insert | ( | ) |
Set the finalization priority for DECL to PRIORITY.
priority_type decl_fini_priority_lookup | ( | ) |
Return the finalization priority for DECL.
tree decl_function_context | ( | ) |
Return the innermost context enclosing DECL that is a FUNCTION_DECL, or zero if none.
C++ virtual functions use DECL_CONTEXT for the class of the vtable where we look up the function at runtime. Such functions always take a first argument of type 'pointer to real context'. C++ should really be fixed to use DECL_CONTEXT for the real context, and use something else for the "virtual context".
Referenced by add_abstract_origin_attribute(), add_type_attribute(), canonicalize_component_ref(), get_frame_field(), and sdbout_block().
void decl_init_priority_insert | ( | ) |
Set the initialization priority for DECL to PRIORITY.
priority_type decl_init_priority_lookup | ( | ) |
Return the initialization priority for DECL.
|
staticread |
Return the initialization and finalization priority information for DECL. If there is no previous priority information, a freshly allocated structure is returned.
tree decl_type_context | ( | ) |
Return the innermost context enclosing DECL that is a RECORD_TYPE, UNION_TYPE or QUAL_UNION_TYPE, or zero if none. TYPE_DECLs and FUNCTION_DECLs are transparent to this function.
void decl_value_expr_insert | ( | ) |
Insert a mapping FROM->TO in the value expression hashtable.
tree decl_value_expr_lookup | ( | ) |
Lookup a value expression for FROM, and return it if we find one.
|
static |
For languages with One Definition Rule, work out if decls are actually the same even if the tree representation differs. This handles only decls appearing in TYPE_NAME and TYPE_CONTEXT. That is NAMESPACE_DECL, TYPE_DECL, RECORD_TYPE and IDENTIFIER_NODE.
bool double_int_fits_to_tree_p | ( | ) |
Returns true if CST fits into range of TYPE. Signedness of CST is assumed to be the same as the signedness of TYPE.
Referenced by affine_fn_univar(), and fold_builtin_strcspn().
tree double_int_to_tree | ( | ) |
Constructs tree in type TYPE from with value given by CST. Signedness of CST is assumed to be the same as the signedness of TYPE.
References double_int::ext(), and type().
Referenced by affine_fn_univar(), backtrace_base_for_ref(), compute_object_offset(), create_mul_ssa_cand(), derive_constant_upper_bound_assign(), finish_builtin_struct(), move_pointer_to_base(), ncd_for_two_cands(), reconstruct_complex_type(), replace_ref(), and try_move_mult_to_index().
void dump_tree_statistics | ( | void | ) |
Print debugging information about tree nodes generated during the compile, and any language-specific information.
References targetm.
unsigned int element_precision | ( | ) |
Return the precision of the type, or for a complex or vector type the precision of the type of its elements.
tree excess_precision_type | ( | ) |
If TYPE is a real or complex floating-point type and the target does not directly support arithmetic on TYPE then return the wider type to be used for arithmetic on TYPE. Otherwise, return NULL_TREE.
unsigned int expr_align | ( | ) |
Return the strictest alignment, in bits, that T is known to have.
If we have conversions, we know that the alignment of the object must meet each of the alignments of the types.
These don't change the alignment of an object.
The best we can do is say that the alignment is the least aligned of the two arms.
FIXME: LABEL_DECL and CONST_DECL never have DECL_ALIGN set meaningfully, it's always 1.
Otherwise take the alignment from that of the type.
int fields_length | ( | ) |
Returns the number of FIELD_DECLs in TYPE.
Referenced by count_type_elements().
|
static |
Find decls and types in T.
Referenced by add_tree_to_fld_list(), and save_debug_info_for_decl().
|
static |
Find decls and types referenced in EH region R and store them in FLD->DECLS and FLD->TYPES.
The types referenced in each catch must first be changed to the EH types used at runtime. This removes references to FE types in the region.
References get_attribute_name().
|
static |
Find decls and types referenced in cgraph node N and store them in FLD->DECLS and FLD->TYPES. Unlike pass_referenced_vars, this will look for *every* kind of DECL and TYPE node reachable from N, including those embedded inside types and decls (i.e,, TYPE_DECLs, NAMESPACE_DECLs, etc).
Traverse locals.
Traverse EH regions in FN.
Traverse every statement in FN.
References get_attribute_name(), and gdbhooks::IDENTIFIER_NODE.
|
static |
Find decls and types referenced in varpool node N and store them in FLD->DECLS and FLD->TYPES. Unlike pass_referenced_vars, this will look for *every* kind of DECL and TYPE node reachable from N, including those embedded inside types and decls (i.e,, TYPE_DECLs, NAMESPACE_DECLs, etc).
|
static |
Operand callback helper for free_lang_data_in_node. *TP is the subtree operand being considered.
Language specific nodes will be removed, so there is no need to gather anything under them.
Note that walk_tree does not traverse every possible field in decls, so we have to do our own traversals here.
We are going to remove everything under DECL_INITIAL for TYPE_DECLs. No point walking them.
Note that walk_tree does not traverse every possible field in types, so we have to do our own traversals here.
Do not walk TYPE_NEXT_PTR_TO or TYPE_NEXT_REF_TO. We do not stream them and thus do not and want not to reach unused pointer types this way.
Do not walk TYPE_NEXT_VARIANT. We do not stream it and thus do not and want not to reach unused variants this way.
We adjust BLOCK TYPE_CONTEXTs to the innermost non-BLOCK one. So push that instead.
Do not walk TYPE_CANONICAL. We do not stream it and thus do not and want not to reach unused types this way.
The Java FE overloads BINFO_VIRTUALS for its own purpose.
Push all TYPE_FIELDS - there can be interleaving interesting and non-interesting things.
void find_placeholder_in_expr | ( | ) |
Given a tree EXP, find all occurrences of references to fields in a PLACEHOLDER_EXPR and place them in vector REFS without duplicates. Also record VAR_DECLs and CONST_DECLs. Note that we assume here that EXP contains only arithmetic expressions or CALL_EXPRs with PLACEHOLDER_EXPRs occurring only in their argument list.
We handle TREE_LIST and COMPONENT_REF separately.
Variables allocated to static storage can stay.
This is the pattern built in ada/make_aligning_type.
Fall through...
References maybe_inline_call_in_expr().
|
static |
Subprogram of following function. Called by walk_tree. Return *TP if it is an automatic variable or parameter of the function passed in as DATA.
References get_tree_code_name(), internal_error(), and trim_filename().
tree first_field | ( | ) |
Returns the first FIELD_DECL in the TYPE_FIELDS of the RECORD_TYPE or UNION_TYPE TYPE, or NULL_TREE if none.
Referenced by initialize_argument_information(), and instantiate_decls().
int fixed_zerop | ( | ) |
Return 1 if EXPR is the fixed-point constant zero.
References dconst1, real_onep(), and real_zerop().
|
inlinestatic |
Push tree node T into FLD->WORKLIST.
tree force_fit_type_double | ( | tree | type, |
double_int | cst, | ||
int | overflowable, | ||
bool | overflowed | ||
) |
We force the double_int CST to the range of the type TYPE by sign or zero extending it. OVERFLOWABLE indicates if we are interested in overflow of the value, when >0 we are only interested in signed overflow, for <0 we are interested in any overflow. OVERFLOWED indicates whether overflow has already occurred. CONST_OVERFLOWED indicates whether constant overflow has already occurred. We force T's value to be within range of T's type (by setting to 0 or 1 all the bits outside the type's range). We set TREE_OVERFLOWED if, OVERFLOWED is nonzero, or OVERFLOWABLE is >0 and signed overflow occurs or OVERFLOWABLE is <0 and any overflow occurs We return a new tree node for the extended double_int. The node is shared if no overflow flags are set.
If we need to set overflow flags, return a new unshared node.
Else build a shared node.
Referenced by native_interpret_vector(), and tree_unary_nonnegative_warnv_p().
|
static |
Free resources that are used by FE but are not needed once they are done.
If we are the LTO frontend we have freed lang-specific data already.
Allocate and assign alias sets to the standard integer types while the slots are still in the way the frontends generated them.
Traverse the IL resetting language specific information for operands, expressions, etc.
Create gimple variants for common types.
Reset some langhooks. Do not reset types_compatible_p, it may still be used indirectly via the get_alias_set langhook.
We do not want the default decl_assembler_name implementation, rather if we have fixed everything we want a wrapper around it asserting that all non-local symbols already got their assembler name and only produce assembler names for local symbols. Or rather make sure we never call decl_assembler_name on local symbols and devise a separate, middle-end private scheme for it.
Reset diagnostic machinery.
|
static |
Reset all the fields in a binfo node BINFO. We only keep BINFO_VTABLE, which is used by gimple_fold_obj_type_ref.
|
static |
Free language specific information for every operand and expression in every node of the call graph. This process operates in three stages: 1- Every callgraph node and varpool node is traversed looking for decls and types embedded in them. This is a more exhaustive search than that done by find_referenced_vars, because it will also collect individual fields, decls embedded in types, etc. 2- All the decls found are sent to free_lang_data_in_decl. 3- All the types found are sent to free_lang_data_in_type. The ordering between decls and types is important because free_lang_data_in_decl sets assembler names, which includes mangling. So types cannot be freed up until assembler names have been set up.
Initialize sets and arrays to store referenced decls and types.
Find decls and types in the body of every function in the callgraph.
Find decls and types in every varpool symbol.
Set the assembler name on every decl found. We need to do this now because free_lang_data_in_decl will invalidate data needed for mangling. This breaks mangling on interdependent decls.
Traverse every decl found freeing its language data.
Traverse every type found freeing its language data.
References merge_attributes().
|
static |
Reset all language specific information still present in symbol DECL.
Give the FE a chance to remove its own data first.
If DECL has a gimple body, then the context for its arguments must be DECL. Otherwise, it doesn't really matter, as we will not be emitting any code for DECL. In general, there may be other instances of DECL created by the front end and since PARM_DECLs are generally shared, their DECL_CONTEXT changes as the replicas of DECL are created. The only time where DECL_CONTEXT is important is for the FUNCTION_DECLs that have a gimple body (since the PARM_DECL will be used in the function's body).
DECL_SAVED_TREE holds the GENERIC representation for DECL. At this point, it is not needed anymore.
Clear the abstract origin if it refers to a method. Otherwise dwarf2out.c will ICE as we clear TYPE_METHODS and thus the origin will not be output correctly.
Sometimes the C++ frontend doesn't manage to transform a temporary DECL_VINDEX referring to itself into a vtable slot number as it should. Happens with functions that are copied and then forgotten about. Just clear it, it won't matter anymore.
Strip builtins from the translation-unit BLOCK. We still have targets without builtin_decl_explicit support and also builtins are shared nodes and thus we can't use TREE_CHAIN in multiple lists.
|
inlinestatic |
Reset the expression *EXPR_P, a size or position. ??? We could reset all non-constant sizes or positions. But it's cheap enough to not do so and refrain from adding workarounds to dwarf2out.c. We need to reset self-referential sizes or positions because they cannot be gimplified and thus can contain a CALL_EXPR after the gimplification is finished, which will run afoul of LTO streaming. And they need to be reset to something essentially dummy but not constant, so as to preserve the properties of the object they are attached to.
Referenced by comp_type_attributes().
|
static |
Reset all language specific information still present in TYPE.
Give the FE a chance to remove its own data first.
Remove the const and volatile qualifiers from arguments. The C++ front end removes them, but the C front end does not, leading to false ODR violation errors when merging two instances of the same function signature compiled by different front ends.
Remove members that are not actually FIELD_DECLs from the field list of an aggregate. These occur in C++.
Note that TYPE_FIELDS can be shared across distinct TREE_TYPEs. Therefore, if the first field of TYPE_FIELDS is to be removed, we cannot set its TREE_CHAIN to NULL. Otherwise, we would not be able to find all the other fields in the other instances of this TREE_TYPE. This was causing an ICE in testsuite/g++.dg/lto/20080915.C.
For non-aggregate types, clear out the language slot (which overloads TYPE_BINFO).
References free_lang_data_d::decls, free_lang_data_d::pset, free_lang_data_d::types, and free_lang_data_d::worklist.
tree get_binfo_at_offset | ( | ) |
Try to find a base info of BINFO that would have its field decl at offset OFFSET within the BINFO type and which is of EXPECTED_TYPE. If it can be found, return, otherwise return NULL_TREE.
Offset 0 indicates the primary base, whose vtable contents are represented in the binfo for the derived class.
Referenced by ipa_set_jf_arith_pass_through().
tree get_callee_fndecl | ( | ) |
CALL is a CALL_EXPR. Return the declaration for the function called, or NULL_TREE if the called function cannot be determined.
It's invalid to call this function with anything but a CALL_EXPR.
The first operand to the CALL is the address of the function called.
If this is a readonly function pointer, extract its initial value.
If the address is just `&f' for some function `f', then we know that `f' is being called.
We couldn't figure out what was being called.
Referenced by delete_unreachable_blocks_update_callgraph(), expand_builtin_memset_args(), expand_builtin_sincos(), instantiate_decls(), maybe_with_size_expr(), and round_trampoline_addr().
tree get_containing_scope | ( | ) |
Given a DECL or TYPE, return the scope in which it was declared, or NULL_TREE if there is no containing scope.
|
static |
Translate all the types in LIST with the corresponding runtime types.
tree get_file_function_name | ( | ) |
Generate a name for a special-purpose function. The generated name may need to be unique across the whole link. Changes to this function may also require corresponding changes to xstrdup_mask_random. TYPE is some string to identify the purpose of this function to the linker or collect2; it must start with an uppercase letter, one of: I - for constructors D - for destructors N - for C++ anonymous namespaces F - for DWARF unwind frame information.
If we already have a name we know to be unique, just use that.
If the target is handling the constructors/destructors, they will be local to this file and the name is only necessary for debugging purposes. We also assign sub_I and sub_D sufixes to constructors called from the global static constructors. These are always local.
Just use the file's basename, because the full pathname might be quite long.
Otherwise, the name must be unique across the entire link. We don't have anything that we know to be unique to this translation unit, so use what we do have and throw in some randomness.
Set up the name of the file-level functions we may need. Use a global object (which is already required to be unique over the program) rather than the file name (which imposes extra constraints).
const char* get_name | ( | ) |
Given a tree, try to return a useful variable name that we can use to prefix a temporary that is being assigned the value of the tree. I.E. given <temp> = &A, return A.
Referenced by assign_parms(), gimplify_return_expr(), separate_decls_in_region_name(), and translate_clast_guard().
tree get_narrower | ( | ) |
Return OP or a simpler expression for a narrower value which can be sign-extended or zero-extended to give back OP. Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended or 0 if the value should be sign-extended.
Truncations are many-one so cannot be removed.
See what's inside this conversion. If we decide to strip it, we will set WIN.
An extension: the outermost one can be stripped, but remember whether it is zero or sign extension.
Otherwise, if a sign extension has been stripped, only sign extensions can now be stripped; if a zero extension has been stripped, only zero-extensions.
A change in nominal type can always be stripped, but we must preserve the unsignedness.
Keep trying to narrow, but don't assign op to win if it would turn an integral type into something else.
Since type_for_size always gives an integer type.
Ensure field is laid out already.
We can get this structure field in a narrower type that fits it, but the resulting extension to its nominal type (a fullword type) must satisfy the same conditions as for other extensions. Do this only for fields that are aligned (not bit-fields), because when bit-field insns will be used there is no advantage in doing this.
tree get_qualified_type | ( | ) |
Return a version of the TYPE, qualified as indicated by the TYPE_QUALS, if one exists. If no qualified version exists yet, return NULL_TREE.
Search the chain of variants to see if there is already one there just like the one we need to have. If so, use that existing one. We must preserve the TYPE_NAME, since there is code that depends on this.
const char* get_tree_code_name | ( | ) |
Wrapper for tree_code_name to ensure that tree code is valid
Referenced by auto_var_in_fn_p(), bitmap_set_equal(), dump_gimple_debug(), and find_var_from_fn().
void get_type_static_bounds | ( | ) |
Stores bounds of an integer TYPE in MIN and MAX. If TYPE has non-constant bounds or is a POINTER_TYPE, the maximum and/or minimum values that can be represented (assuming two's-complement arithmetic) within the bit precision of the type are returned instead.
tree get_unwidened | ( | ) |
Return OP, stripped of any conversions to wider types as much as is safe. Converting the value back to OP's type makes a value equivalent to OP. If FOR_TYPE is nonzero, we return a value which, if converted to type FOR_TYPE, would be equivalent to converting OP to type FOR_TYPE. OP must have integer, real or enumeral type. Pointers are not allowed! There are some cases where the obvious value we could return would regenerate to OP if converted to OP's type, but would not extend like OP to wider types. If FOR_TYPE indicates such extension is contemplated, we eschew such values. For example, if OP is (unsigned short)(signed char)-1, we avoid returning (signed char)-1 if FOR_TYPE is int, even though extending that to an unsigned short would regenerate OP, since the result of extending (signed char)-1 to (int) is different from (int) OP.
Set UNS initially if converting OP to FOR_TYPE is a zero-extension.
TYPE_PRECISION on vector types has different meaning (TYPE_VECTOR_SUBPARTS) and casts from vectors are view conversions, so avoid them here.
Truncations are many-one so cannot be removed. Unless we are later going to truncate down even farther.
See what's inside this conversion. If we decide to strip it, we will set WIN.
If we have not stripped any zero-extensions (uns is 0), we can strip any kind of extension. If we have previously stripped a zero-extension, only zero-extensions can safely be stripped. Any extension can be stripped if the bits it would produce are all going to be discarded later by truncating to FOR_TYPE.
TYPE_UNSIGNED says whether this is a zero-extension. Let's avoid computing it if it does not affect WIN and if UNS will not be needed again.
If we finally reach a constant see if it fits in for_type and in that case convert it.
Referenced by gimplify_switch_expr().
Handle a "dllimport" or "dllexport" attribute; arguments as in struct attribute_spec.handler.
These attributes may apply to structure and union types being created, but otherwise should pass to the declaration involved.
Report error on dllimport ambiguities seen now before they cause any damage.
Honor any target-specific overrides.
Like MS, treat definition of dllimported variables and non-inlined functions on declaration as syntax errors.
`extern' needn't be specified with dllimport. Specify `extern' now and hope for the best. Sigh.
Also, implicitly give dllimport'd variables declared within a function global scope, unless declared static.
An exported function, even if inline, must be emitted.
Report error if symbol is not accessible at global scope.
A dllexport'd entity must have default visibility so that other program units (shared libraries or the main executable) can see it. A dllimport'd entity must have default visibility so that the linker knows that undefined references within this program unit can be resolved by the dynamic linker.
int host_integerp | ( | ) |
Return 1 if T is an INTEGER_CST that can be manipulated efficiently on the host. If POS is zero, the value can be represented in a single HOST_WIDE_INT. If POS is nonzero, the value must be non-negative and can be represented in a single unsigned HOST_WIDE_INT.
Referenced by add_bit_offset_attribute(), add_data_member_location_attribute(), add_location_or_const_value_attribute(), alloc_cand_and_find_basis(), ao_ref_base_alias_set(), bit_value_unop(), constant_pointer_difference(), count_type_elements(), delegitimize_mem_from_attrs(), expand_builtin_object_size(), fold_builtin_exponent(), fold_builtin_fputs(), fold_builtin_logarithm(), fold_builtin_strncat_chk(), fold_builtin_strspn(), fold_mathfn_compare(), fortran_common(), generate_subtree_copies(), get_base_value(), gimple_get_virt_method_for_binfo(), insert_vi_for_tree(), instrument_builtin_call(), nreverse(), plus_stmt_object_size(), type_for_widest_vector_mode(), type_hash_eq(), type_like_member_ptr_p(), and unloop_loops().
bool in_array_bounds_p | ( | ) |
Returns true if it is possible to prove that the index of an array access REF (an ARRAY_REF expression) falls into the array bounds.
void init_ttree | ( | void | ) |
Init tree.c.
Initialize the hash table of types.
Initialize the tree_contains_struct array.
|
static |
Initialize tree_contains_struct to describe the hierarchy of tree nodes.
Mark the TS structure itself.
Mark all the structures that TS is derived from.
Basic consistency checks for attributes used in fold.
bool initializer_zerop | ( | ) |
Given an initializer INIT, return TRUE if INIT is zero or some aggregate of zeros. Otherwise return FALSE.
??? Note that this is not correct for C4X float formats. There, a bit pattern of all zeros is 1.0; 0.0 is encoded with the most negative exponent.
We need to loop through all elements to handle cases like "\0" and "\0foobar".
Referenced by assemble_string(), count_type_elements(), gimplify_modify_expr_to_memset(), and handle_pointer_plus().
HOST_WIDE_INT int_bit_position | ( | ) |
Likewise, but return as an integer. It must be representable in that way (since it could be a signed value, we don't have the option of returning -1 like int_size_in_byte can.
Referenced by count_type_elements(), fortran_common(), output_constant(), and tree_block().
HOST_WIDE_INT int_byte_position | ( | ) |
Likewise, but return as an integer. It must be representable in that way (since it could be a signed value, we don't have the option of returning -1 like int_size_in_byte can.
|
static |
|
static |
Return nonzero if the value represented by *X (an INTEGER_CST tree node) is the same as that given by *Y, which is the same.
References HOST_WIDE_INT.
|
static |
|
static |
These are the hash table functions for the hash table of INTEGER_CST nodes of a sizetype.
Return the hash code code X, an INTEGER_CST.
HOST_WIDE_INT int_cst_value | ( | ) |
Return value of a constant X and sign-extend it.
Make sure the sign-extended value will fit in a HOST_WIDE_INT.
Referenced by analyze_overlapping_iterations(), ao_ref_base_alias_set(), dir_from_dist(), get_expr_id(), initialize_matrix_A(), is_miss_rate_acceptable(), lambda_vector_equal(), output_one_line_info_table(), release_mem_refs(), and vect_do_peeling_for_loop_bound().
bool int_fits_type_p | ( | ) |
Returns true if integer constant C has a value that is permissible for type TYPE (an INTEGER_TYPE).
If at least one bound of the type is a constant integer, we can check ourselves and maybe make a decision. If no such decision is possible, but this type is a subtype, try checking against that. Otherwise, use double_int_fits_to_tree_p, which checks against the precision. Compute the status for each possibly constant bound, and return if we see one does not match. Use ok_for_xxx_bound for this purpose, assigning -1 for "unknown if constant fits", 0 for "constant known *not* to fit" and 1 for "constant known to fit".
Check if c >= type_low_bound.
Check if c <= type_high_bound.
If the constant fits both bounds, the result is known.
Perform some generic filtering which may allow making a decision even if the bounds are not constant. First, negative integers never fit in unsigned types,
Second, narrower types always fit in wider ones.
Third, unsigned integers with top bit set never fit signed types.
If we haven't been able to decide at this point, there nothing more we can check ourselves here. Look at the base type if we have one and it has the same precision.
Or to double_int_fits_to_tree_p, if nothing else.
Referenced by make_pass_optimize_bswap(), and widening_mult_conversion_strippable_p().
HOST_WIDE_INT int_size_in_bytes | ( | ) |
Return the size of TYPE (in bytes) as a wide integer or return -1 if the size can vary or is larger than an integer.
If the result would appear negative, it's too big to represent.
Referenced by add_data_member_location_attribute(), addr_expr_of_non_mem_decl_p(), anti_adjust_stack_and_probe(), call_expr_flags(), decode_addr_const(), get_integer_term(), gimplify_init_ctor_eval(), go_output_typedef(), initialize_argument_information(), initializer_constant_valid_p_1(), inline_forbidden_p_stmt(), insert_float(), insert_int(), internal_arg_pointer_based_exp(), resolve_operand_name_1(), and set_cfun().
int integer_all_onesp | ( | ) |
Return 1 if EXPR is an integer containing all 1's in as much precision as it contains, or a complex or vector whose subparts are such integers.
Can not handle precisions greater than twice the host int size.
Shifting by the host word size is undefined according to the ANSI standard, so we must handle this as a special case.
Referenced by build_case_label(), fold_builtin_fputs(), and number_of_iterations_exit().
int integer_minus_onep | ( | ) |
Return 1 if EXPR is the integer constant minus one.
int integer_nonzerop | ( | ) |
Return 1 if EXPR is an integer constant other than zero or a complex constant other than zero.
Referenced by component_of(), derive_constant_upper_bound_assign(), fold_stmt_inplace(), instrument_builtin_call(), same_bool_result_p(), scale_dominated_blocks_in_loop(), and tree_unswitch_single_loop().
int integer_onep | ( | ) |
Return 1 if EXPR is the integer constant one or the corresponding complex constant.
Referenced by and_var_with_comparison_1(), create_bb(), create_mul_ssa_cand(), final_range_test_p(), forward_propagate_addr_expr(), number_of_iterations_exit(), or_var_with_comparison(), or_var_with_comparison_1(), test_for_singularity(), tree_predict_by_opcode(), valid_mem_ref_p(), and value_inside_range().
int integer_pow2p | ( | ) |
Return 1 if EXPR is an integer constant that is a power of 2 (i.e., has only one bit on).
First clear all bits that are beyond the type's precision in case we've been sign extended.
Referenced by fold_mathfn_compare(), scev_initialize(), and unextend().
int integer_zerop | ( | ) |
Return 1 if EXPR is the integer constant zero or a complex constant of zero.
Referenced by adjust_last_stmt(), affine_function_equal_p(), allow_ip_end_pos_p(), and_var_with_comparison_1(), asan_mem_ref_new(), associate_equivalences_with_edges(), check_for_plus_in_loops_1(), check_forbidden_calls(), chrec_fold_plus(), component_of(), create_bb(), debug_rli(), distribute_real_division(), expand_expr_real_1(), extract_muldiv(), final_range_test_p(), find_induction_variables(), finish_builtin_struct(), fold_builtin_4(), fold_mathfn_compare(), fold_mult_zconjz(), fold_stmt_inplace(), get_addr_base_and_unit_offset_1(), get_ancestor_addr_info(), handle_pointer_plus(), instrument_derefs(), lower_send_clauses(), make_invariant_chain(), maybe_emit_chk_warning(), number_of_iterations_exit(), number_of_iterations_lt_to_ne(), or_var_with_comparison(), or_var_with_comparison_1(), register_edge_assert_for_1(), same_bool_result_p(), sign_bit_p(), test_for_singularity(), tree_predict_by_opcode(), tree_ssa_strip_useless_type_conversions(), tree_to_aff_combination(), tree_unswitch_single_loop(), unextend(), value_inside_range(), vect_create_cond_for_alias_checks(), vect_get_new_vect_var(), vrp_bitmap_equal_p(), and vrp_initialize().
bool is_typedef_decl | ( | ) |
Returns true if X is a typedef decl.
hashval_t iterative_hash_expr | ( | ) |
Generate a hash value for an expression. This can be used iteratively by passing a previous result as the VAL argument. This function is intended to produce the same hash for expressions which would compare equal using operand_equal_p.
Alas, constants aren't shared, so we can't rely on pointer identity.
We can just compare by pointer.
The node itself doesn't matter.
A list of expressions, for a CALL_EXPR or as the elements of a VECTOR_CST.
When referring to a built-in FUNCTION_DECL, use the __builtin__ form. Otherwise nodes that compare equal according to operand_equal_p might get different hash codes. However, don't do this for machine specific or front end builtins, since the function code is overloaded in those cases.
FALL THROUGH
DECL's have a unique ID
Don't hash the type, that can lead to having nodes which compare equal according to operand_equal_p, but which have different hash codes.
Make sure to include signness in the hash computation.
It's a commutative expression. We want to hash it the same however it appears. We do this by first hashing both operands and then rehashing based on the order of their independent hashes.
Referenced by tree_int_cst_sgn(), tree_low_cst(), vn_reference_lookup(), and vn_reference_op_compute_hash().
hashval_t iterative_hash_exprs_commutative | ( | const_tree | t1, |
const_tree | t2, | ||
hashval_t | val | ||
) |
Generate a hash value for a pair of expressions. This can be used iteratively by passing a previous result as the VAL argument. The same hash value is always returned for a given pair of expressions, regardless of the order in which they are presented. This is useful in hashing the operands of commutative functions.
References chainon(), and nreverse().
hashval_t iterative_hash_hashval_t | ( | ) |
Produce good hash value combining VAL and VAL2.
the golden ratio; an arbitrary value.
References get_attribute_name(), lookup_attribute(), and lookup_attribute_spec().
Referenced by hash_type_name(), possible_polymorphic_call_targets_1(), value_id_constant_p(), vn_reference_lookup(), and vn_reference_op_compute_hash().
hashval_t iterative_hash_host_wide_int | ( | ) |
Produce good hash value combining VAL and VAL2.
Avoid warnings about shifting of more than the width of the type on hosts that won't execute this path.
tree lhd_gcc_personality | ( | void | ) |
Return the GCC personality function decl.
bool list_equal_p | ( | ) |
Return true if T1 and T2 are equivalent lists.
int list_length | ( | ) |
Return the length of a chain of nodes chained through TREE_CHAIN. We expect a null pointer to mark the end of the chain. This is the Lisp primitive `length'.
References build_tree_list_stat().
Referenced by assign_assembler_name_if_neeeded(), build_vector_from_val(), reverse_op(), and tree_conflicts_with_clobbers_p().
|
static |
A subroutine of build_common_builtin_nodes. Define a builtin function.
Referenced by tree_class_check_failed(), and tree_range_check_failed().
|
static |
A variant of lookup_attribute() that can be used with an identifier as the first argument, and where the identifier can be either 'text' or '__text__'. Given an attribute ATTR_IDENTIFIER, and a list of attributes LIST, return a pointer to the attribute's list element if the attribute is part of the list, or NULL_TREE if not found. If the attribute appears more than once, this only returns the first occurrence; the TREE_CHAIN of the return value should be passed back in if further occurrences are wanted. ATTR_IDENTIFIER must be an identifier but can be in the form 'text' or '__text__'.
Identifiers can be compared directly for equality.
If they are not equal, they may still be one in the form 'text' while the other one is in the form '__text__'. TODO: If we were storing attributes in normalized 'text' form, then this could all go away and we could take full advantage of the fact that we're comparing identifiers. :-)
References TYPE_QUAL_CONST, TYPE_QUAL_RESTRICT, and TYPE_QUAL_VOLATILE.
Referenced by assign_assembler_name_if_neeeded(), and print_value_expr_statistics().
tree lower_bound_in_type | ( | ) |
Returns the smallest value obtainable by casting something in INNER type to OUTER type.
If OUTER type is unsigned, we can definitely cast 0 to OUTER type and obtain 0.
If we are widening something of an unsigned type, OUTER type contains all values of INNER type. In particular, both INNER and OUTER types have zero in common.
If we are widening a signed type to another signed type, we want to obtain -2^^(iprec-1). If we are keeping the precision or narrowing to a signed type, we want to obtain -2^(oprec-1).
Referenced by can_unroll_loop_p(), and sese_dom_walker::~sese_dom_walker().
tree make_node_stat | ( | ) |
Return a newly allocated node of code CODE. For decl and type nodes, some other fields are initialized. The rest of the node is initialized to zero. This function cannot be used for TREE_VEC or OMP_CLAUSE nodes, which is enforced by asserts in tree_code_size. Achoo! I got a code in the node.
Default to no attributes for type, but let target change that.
We have not yet computed the alias set for this type.
All of these have side-effects, no matter what their operands are.
Other classes need no special treatment.
References allocate_decl_uid().
Referenced by build2_stat(), and chain_member().
|
static |
Create or reuse an accum type by SIZE, UNSIGNEDP, and SATP.
|
static |
Create or reuse a fract type by SIZE, UNSIGNEDP, and SATP.
References build_pointer_type_for_mode(), and reconstruct_complex_type().
|
static |
simple_ipa_opt_pass* make_pass_ipa_free_lang_data | ( | ) |
References targetm.
tree make_tree_binfo_stat | ( | ) |
Build a BINFO with LEN language slots.
tree make_tree_vec_stat | ( | ) |
Build a newly constructed TREE_VEC node of length LEN.
tree make_vector_stat | ( | ) |
Build a newly constructed TREE_VEC node of length LEN.
|
static |
Create a new vector type node holding SUBPARTS units of type INNERTYPE, and mapped to the machine mode MODE. Initialize its fields and build the information necessary for debugging output.
We have built a main variant, based on the main variant of the inner type. Use it to build the variant we return.
References targetm.
HOST_WIDE_INT max_int_size_in_bytes | ( | ) |
Return the maximum size of TYPE (in bytes) as a wide integer or return -1 if the size can vary or is larger than an integer.
If this is an array type, check for a possible MAX_SIZE attached.
If we still haven't been able to get a size, see if the language can compute a maximum size.
|
static |
Computes the canonical argument types from the argument type list ARGTYPES. Upon return, *ANY_STRUCTURAL_P will be true iff either it was true on entry to this function, or if any of the ARGTYPES are structural. Upon return, *ANY_NONCANONICAL_P will be true iff either it was true on entry to this function, or if any of the ARGTYPES are non-canonical. Returns a canonical argument list, which may be ARGTYPES when the canonical argument list is unneeded (i.e., *ANY_STRUCTURAL_P is true) or would not differ from ARGTYPES.
Fail gracefully by stating that the type is structural.
If the argument has a default argument, we consider it non-canonical even though the type itself is canonical. That way, different variants of function and method types with default arguments will all point to the variant with no defaults as their canonical type.
Build the canonical list of argument types.
There is a non-canonical type.
The canonical argument types are the same as ARGTYPES.
double_int mem_ref_offset | ( | ) |
Return the constant offset of a MEM_REF or TARGET_MEM_REF tree T.
Referenced by backtrace_base_for_ref(), compute_object_offset(), fold_builtin_logarithm(), get_addr_base_and_unit_offset_1(), and get_address_description().
tree merge_attributes | ( | ) |
Return an attribute list that is the union of a1 and a2.
Either one unset? Take the set one.
One that completely contains the other? Take it.
Pick the longest list, and hang on the other list.
Referenced by free_lang_data_in_cgraph().
tree merge_decl_attributes | ( | ) |
Given decls OLDDECL and NEWDECL, merge their attributes and return the result.
tree merge_dllimport_decl_attributes | ( | ) |
Specialization of merge_decl_attributes for various Windows targets. This handles the following situation: __declspec (dllimport) int foo; int foo; The second instance of `foo' nullifies the dllimport.
What we need to do here is remove from `old' dllimport if it doesn't appear in `new'. dllimport behaves like extern: if a declaration is marked dllimport and a definition appears later, then the object is not dllimport'd. We also remove a `new' dllimport if the old list contains dllexport: dllexport always overrides dllimport, regardless of the order of declaration.
Warn about overriding a symbol that has already been used, e.g.: extern int __attribute__ ((dllimport)) foo; int* bar () {return &foo;} int foo;
If we have used a variable's address with dllimport linkage, keep the old DECL_DLLIMPORT_P flag: the ADDR_EXPR using the decl may already have had TREE_CONSTANT computed. We still remove the attribute so that assembler code refers to '&foo rather than '_imp__foo'.
Let an inline definition silently override the external reference, but otherwise warn about attribute inconsistency.
tree merge_type_attributes | ( | ) |
Given types T1 and T2, merge their attributes and return the result.
|
inlinestatic |
Return true if DECL may need an assembler name to be set.
Only FUNCTION_DECLs and VAR_DECLs are considered.
If DECL already has its assembler name set, it does not need a new one.
Abstract decls do not need an assembler name.
For VAR_DECLs, only static, public and external symbols need an assembler name.
Do not set assembler name on builtins. Allow RTL expansion to decide whether to expand inline or via a regular call.
Functions represented in the callgraph need an assembler name.
Unused and not public functions don't need an assembler name.
bool needs_to_live_in_memory | ( | ) |
Return true if T (assumed to be a DECL) must be assigned a memory location.
tree nreverse | ( | ) |
Reverse the order of elements in the chain T, and return the new head of the chain (old last element).
We shouldn't be using this function to reverse BLOCK chains; we have blocks_nreverse for that.
References host_integerp(), lang_hooks_for_types::max_size, tree_low_cst(), and lang_hooks::types.
Referenced by finalize_task_copyfn(), ipa_print_all_params(), and iterative_hash_exprs_commutative().
tree num_ending_zeros | ( | ) |
Returns number of zeros at the end of binary representation of X. ??? Use ffs if available?
Referenced by number_of_iterations_ne_max().
tree obj_type_ref_class | ( | ) |
REF is OBJ_TYPE_REF, return the class the ref corresponds to.
We look for type THIS points to. ObjC also builds OBJ_TYPE_REF with non-method calls, Their first parameter ID however also corresponds to class type.
Referenced by possible_polymorphic_call_target_p().
void omp_clause_check_failed | ( | const_tree | node, |
const char * | file, | ||
int | line, | ||
const char * | function, | ||
enum omp_clause_code | code | ||
) |
Similar to tree_check_failed but applied to OMP_CLAUSE codes.
void omp_clause_operand_check_failed | ( | int | idx, |
const_tree | t, | ||
const char * | file, | ||
int | line, | ||
const char * | function | ||
) |
Similar to above, except that the check is for the number of operands of an OMP_CLAUSE node.
References targetm.
void omp_clause_range_check_failed | ( | const_tree | node, |
const char * | file, | ||
int | line, | ||
const char * | function, | ||
enum omp_clause_code | c1, | ||
enum omp_clause_code | c2 | ||
) |
Similar to tree_range_check_failed but applied to OMP_CLAUSE codes.
|
static |
Check if "omp declare simd" attribute arguments, CLAUSES1 and CLAUSES2, are the same.
void omp_remove_redundant_declare_simd_attrs | ( | ) |
Remove duplicate "omp declare simd" attributes.
int operand_equal_for_phi_arg_p | ( | ) |
Return nonzero if two operands that are suitable for PHI nodes are necessarily equal. Specifically, both ARG0 and ARG1 must be either SSA_NAME or invariant. Note that this is strictly an optimization. That is, callers of this function can directly call operand_equal_p and get the same result, only slower.
References len.
Referenced by jump_function_from_stmt(), and record_temporary_equivalences().
|
static |
Print out the statistics for the DECL_DEBUG_EXPR hash table.
|
static |
|
static |
Print out the statistics for the DECL_VALUE_EXPR hash table.
References get_attribute_name(), and lookup_ident_attribute().
bool private_is_attribute_p | ( | ) |
The backbone of is_attribute_p(). ATTR_LEN is the string length of ATTR_NAME. Also used internally by remove_attribute().
There is the possibility that ATTR is 'text' and IDENT is '__text__'.
References warning().
tree private_lookup_attribute | ( | ) |
The backbone of lookup_attribute(). ATTR_LEN is the string length of ATTR_NAME, and LIST is not NULL_TREE.
TODO: If we made sure that attributes were stored in the canonical form without '__...__' (ie, as in 'text' as opposed to '__text__') then we could avoid the following case.
|
static |
Set various status flags when building a CALL_EXPR object T.
Calls have side-effects, except those to const or pure functions.
Propagate TREE_READONLY of arguments for const functions.
void protected_set_expr_location | ( | ) |
Like SET_EXPR_LOCATION, but make sure the tree can have a location. LOC is the location to use in tree T.
bool prototype_p | ( | ) |
Return true if TYPE has a prototype.
Referenced by gimple_asm_clobbers_memory_p().
tree purpose_member | ( | ) |
Return first list element whose TREE_PURPOSE is ELEM. Return 0 if ELEM is not in LIST.
|
static |
Push tree EXP onto vector QUEUE if it is not already present.
Referenced by contains_placeholder_p().
bool range_in_array_bounds_p | ( | ) |
Returns true if it is possible to prove that the range of an array access REF (an ARRAY_RANGE_REF expression) falls into the array bounds.
References walk_type_fields().
int real_minus_onep | ( | ) |
Return 1 if EXPR is the real constant minus one. Trailing zeroes matter for decimal float constants, so don't return 1 for them.
int real_onep | ( | ) |
Return 1 if EXPR is the real constant one in real or complex form. Trailing zeroes matter for decimal float constants, so don't return 1 for them.
Referenced by fixed_zerop(), and tree_log2().
int real_twop | ( | ) |
Return 1 if EXPR is the real constant two. Trailing zeroes matter for decimal float constants, so don't return 1 for them.
REAL_VALUE_TYPE real_value_from_int_cst | ( | ) |
Return a new REAL_CST node whose type is TYPE and whose value is the integer value of the INTEGER_CST node I.
Clear all bits of the real value type so that we can later do bitwise comparisons to see if two values are the same.
int real_zerop | ( | ) |
Return 1 if EXPR is the real constant zero. Trailing zeroes matter for decimal float constants, so don't return 1 for them.
Referenced by fixed_zerop(), fold_builtin_constant_p(), and vec_cst_ctor_to_array().
int really_constant_p | ( | ) |
Nonzero if EXP is a constant or a cast of a constant.
This is not quite the same as STRIP_NOPS. It does more.
void recompute_tree_invariant_for_addr_expr | ( | ) |
Low-level constructors for expressions.
A helper function for build1 and constant folders. Set TREE_CONSTANT, and TREE_SIDE_EFFECTS for an ADDR_EXPR.
We started out assuming this address is both invariant and constant, but does not have side effects. Now go down any handled components and see if any of them involve offsets that are either non-constant or non-invariant. Also check for side-effects. ??? Note that this code makes no attempt to deal with the case where taking the address of something causes a copy due to misalignment.
If the first operand doesn't have an ARRAY_TYPE, this is a bogus array reference (probably made temporarily by the G++ front end), so ignore all the operands.
Likewise, just because this is a COMPONENT_REF doesn't mean we have a FIELD_DECL, apparently. The G++ front end can put something else there, at least temporarily.
Now see what's inside. If it's an INDIRECT_REF, copy our properties from the address, since &(*a)->b is a form of addition. If it's a constant, the address is constant too. If it's a decl, its address is constant if the decl is static. Everything else is not constant and, furthermore, taking the address of a volatile variable is not volatile.
Referenced by lower_omp_target(), and remove_exit_barrier().
tree reconstruct_complex_type | ( | ) |
HACK. GROSS. This is absolutely disgusting. I wish there was a better way. If we requested a pointer to a vector, build up the pointers that we stripped off while looking for the inner type. Similarly for return values from functions. The argument TYPE is the top of the chain, and BOTTOM is the new type which we will point to.
The build_method_type_directly() routine prepends 'this' to argument list, so we must compensate by getting rid of it.
References double_int_to_tree(), double_int::high, HOST_WIDE_INT, and double_int::low.
Referenced by make_or_reuse_fract_type().
|
static |
Record interesting allocation statistics for a tree node with CODE and LENGTH.
References b_kind, binfo_kind, constr_kind, id_kind, gdbhooks::IDENTIFIER_NODE, omp_clause_kind, ssa_name_kind, vec_kind, and x_kind.
tree remove_attribute | ( | ) |
Remove any instances of attribute ATTR_NAME in LIST and return the modified list.
TODO: If we were storing attributes in normalized form, here we could use a simple strcmp().
Referenced by process_common_attributes().
|
static |
For languages with One Definition Rule, work out if trees are actually the same even if the tree representation differs. This handles only decls appearing in TYPE_NAME and TYPE_CONTEXT. That is NAMESPACE_DECL, TYPE_DECL, RECORD_TYPE and IDENTIFIER_NODE.
C and C++ FEs differ by using IDENTIFIER_NODE and TYPE_DECL.
|
static |
Save all language fields needed to generate proper debug information for DECL. This saves most fields cleared out by free_lang_data_in_decl.
FIXME. Partial implementation for saving debug info removed.
References symtab_node_base::decl, and find_decls_types().
|
static |
Save all language fields needed to generate proper debug information for TYPE. This saves most fields cleared out by free_lang_data_in_type.
FIXME. Partial implementation for saving debug info removed.
tree save_expr | ( | ) |
Wrap a SAVE_EXPR around EXPR, if appropriate. Do this to any expression which may be used in more than one place, but must be evaluated only once. Normally, expand_expr would reevaluate the expression each time. Calling save_expr produces something that is evaluated and recorded the first time expand_expr is called on it. Subsequent calls to expand_expr just reuse the recorded value. The call to expand_expr that generates code that actually computes the value is the first call *at compile time*. Subsequent calls *at compile time* generate code to use the saved value. This produces correct result provided that *at run time* control always flows through the insns made by the first expand_expr before reaching the other places where the save_expr was evaluated. You, the caller of save_expr, must make sure this is so. Constants, and certain read-only nodes, are returned with no SAVE_EXPR because that is safe. Expressions containing placeholders are not touched; see tree.def for an explanation of what these are used for.
If the tree evaluates to a constant, then we don't want to hide that fact (i.e. this allows further folding, and direct checks for constants). However, a read-only object that has side effects cannot be bypassed. Since it is no problem to reevaluate literals, we just return the literal node.
If INNER contains a PLACEHOLDER_EXPR, we must evaluate it each time, since it means that the size or offset of some field of an object depends on the value within another field. Note that it must not be the case that T contains both a PLACEHOLDER_EXPR and some variable since it would then need to be both evaluated once and evaluated more than once. Front-ends must assure this case cannot happen by surrounding any such subexpressions in their own SAVE_EXPR and forcing evaluation at the proper time.
This expression might be placed ahead of a jump to ensure that the value was computed on both sides of the jump. So make sure it isn't eliminated as dead.
void set_call_expr_flags | ( | ) |
Modify DECL for given flags. TM_PURE attribute is set only on types, so the function will modify DECL's type when ECF_TM_PURE is used.
Looping const or pure is implied by noreturn. There is currently no way to declare looping const or looping pure alone.
|
static |
|
static |
Set the type qualifiers for TYPE to TYPE_QUALS, which is a bitmask of the various TYPE_QUAL values.
tree signed_or_unsigned_type_for | ( | ) |
If TYPE is an integral or pointer type, return an integer type with the same precision which is unsigned iff UNSIGNEDP is true, or itself if TYPE is already an integer type of signedness UNSIGNEDP.
References line_table.
tree signed_type_for | ( | ) |
If TYPE is an integral or pointer type, return an integer type with the same precision which is signed, or itself if TYPE is already a signed integer type.
Referenced by common_affine_function(), and merge_ranges().
int simple_cst_equal | ( | ) |
Return truthvalue of whether T1 is the same tree structure as T2. Return 1 if they are the same. Return 0 if they are understandably different. Return -1 if either contains tree structure not understood by this function.
??? Should we handle also fields here?
Special case: if either target is an unallocated VAR_DECL, it means that it's going to be unified with whatever the TARGET_EXPR is really supposed to initialize, so treat it as being equivalent to anything.
This general rule works for most tree codes. All exceptions should be handled above. If this is a language-specific tree code, we can't trust what might be in the operand, so say we don't know the situation.
References build_pointer_type_for_mode(), layout_type(), and lookup_attribute().
Referenced by attribute_list_equal(), decl_debug_expr_insert(), gimplify_modify_expr_to_memset(), and type_hash_add().
int simple_cst_list_equal | ( | ) |
Compare two constructor-element-type constants. Return 1 if the lists are known to be equal; otherwise return 0.
tree size_in_bytes | ( | ) |
Return the size nominally occupied by an object of type TYPE when it resides in memory. The value is measured in units of bytes, and its data type is that normally used for type sizes (which is the first type created by make_signed_type or make_unsigned_type).
Referenced by build_tree_list_vec_stat(), and default_cxx_guard_type().
HOST_WIDE_INT size_low_cst | ( | ) |
Return the HOST_WIDE_INT least significant bits of T, a sizetype kind INTEGER_CST. This makes sure to properly sign-extend the constant.
tree skip_simple_arithmetic | ( | ) |
Look inside EXPR into any simple arithmetic operations. Return the outermost non-arithmetic or non-invariant node.
We don't care about whether this can be used as an lvalue in this context.
If we have simple operations applied to a SAVE_EXPR or to a SAVE_EXPR and a constant, it will be more efficient to not make another SAVE_EXPR since it will allow better simplification and GCSE will be able to merge the computations if they actually occur.
References type_contains_placeholder_p().
tree skip_simple_constant_arithmetic | ( | ) |
Look inside EXPR into simple arithmetic operations involving constants. Return the outermost non-arithmetic or non-constant node.
tree stabilize_reference | ( | ) |
Stabilize a reference so that we can use it any number of times without causing its operands to be evaluated more than once. Returns the stabilized reference. This works by means of save_expr, so see the caveats in the comments about save_expr. Also allows conversion expressions whose operands are references. Any other kind of expression is returned unchanged.
No action is needed in this case.
We cannot wrap the first expression in a SAVE_EXPR, as then it wouldn't be ignored. This matters when dealing with volatiles.
If arg isn't a kind of lvalue we recognize, make no change. Caller should recognize the error for an invalid lvalue.
tree stabilize_reference_1 | ( | ) |
Subroutine of stabilize_reference; this is called for subtrees of references. Any expression with side-effects must be put in a SAVE_EXPR to ensure that it is only evaluated once. We don't put SAVE_EXPR nodes around everything, because assigning very simple expressions to temporaries causes us to miss good opportunities for optimizations. Among other things, the opportunity to fold in the addition of a constant into an addressing mode often gets lost, e.g. "y[i+1] += x;". In general, we take the approach that we should not make an assignment unless we are forced into it - i.e., that any non-side effect operator should be allowed, and that cse should take care of coalescing multiple utterances of the same expression should that prove fruitful.
We cannot ignore const expressions because it might be a reference to a const array but whose index contains side-effects. But we can ignore things that are actual constant or that already have been handled by this function.
If the expression has side-effects, then encase it in a SAVE_EXPR so that it will only be evaluated once.
The reference (r) and comparison (<) classes could be handled as below, but it is generally faster to only evaluate them once.
Constants need no processing. In fact, we should never reach here.
Division is slow and tends to be compiled with jumps, especially the division by powers of 2 that is often found inside of an array reference. So do it just once.
Recursively stabilize each operand.
Recursively stabilize each operand.
tree staticp | ( | ) |
If arg is static -- a reference to an object in static storage -- then return the object. This is not the same as the C meaning of `static'. If arg isn't static, return NULL.
Nested functions are static, even though taking their address will involve a trampoline as we unnest the nested function and create the trampoline on the tree level.
If the thing being referenced is not a field, then it is something language specific.
If we are referencing a bitfield, we can't evaluate an ADDR_EXPR at compile time and so it isn't a constant.
References tree_invariant_p().
Referenced by array_ref_element_size(), and output_constant_pool().
bool stdarg_p | ( | ) |
Return true if TYPE has a variable argument list.
tree strip_array_types | ( | ) |
Recursively examines the array elements of TYPE, until a non-array element type is found.
tree strip_float_extensions | ( | ) |
Avoid any floating point extensions from EXP.
For floating point constant look up the narrowest type that can hold it properly and handle it like (type)(narrowest_type)constant. This way we can optimize for instance a=a*2.0 where "a" is float but 2.0 is double constant.
Referenced by convert_to_integer(), and convert_to_real().
const_tree strip_invariant_refs | ( | ) |
Strip out all handled components that produce invariant offsets.
bool subrange_type_for_debug_p | ( | ) |
Return true if the debug information for TYPE, a subtype, should be emitted as a subrange type. If so, set LOWVAL to the low bound and HIGHVAL to the high bound, respectively. Sometimes doing so unnecessarily obfuscates the debug info and doesn't reflect the source code.
Subrange types have a base type which is an integral type.
Get the real bounds of the subtype.
If the type and its base type have the same representation and the same name, then the type is not a subrange but a copy of the base type.
Referenced by dbxout_type_methods().
tree substitute_in_expr | ( | ) |
Given a tree EXP, a FIELD_DECL F, and a replacement value R, return a tree with all occurrences of references to F in a PLACEHOLDER_EXPR replaced by R. Also handle VAR_DECLs and CONST_DECLs. Note that we assume here that EXP contains only arithmetic expressions or CALL_EXPRs with PLACEHOLDER_EXPRs occurring only in their argument list.
We handle TREE_LIST and COMPONENT_REF separately.
If this expression is getting a value from a PLACEHOLDER_EXPR and it is the right field, replace it with R.
The field.
If this expression hasn't been completed let, leave it alone.
Fall through...
If we are trying to replace F with a constant, inline back functions which do nothing else than computing a value from the arguments they are passed. This makes it possible to fold partially or entirely the replacement expression.
tree substitute_placeholder_in_expr | ( | ) |
Similar, but look for a PLACEHOLDER_EXPR in EXP and find a replacement for it within OBJ, a tree that is an object or a chain of references.
If this is a PLACEHOLDER_EXPR, see if we find a corresponding type in the chain of OBJ.
If we didn't find it, return the original PLACEHOLDER_EXPR. If it survives until RTL generation, there will be an error.
TREE_LIST is special because we need to look at TREE_VALUE and TREE_CHAIN, not TREE_OPERANDS.
tree tree_block | ( | ) |
References int_bit_position(), and tree_low_cst().
void tree_check_failed | ( | const_tree | node, |
const char * | file, | ||
int | line, | ||
const char * | function, | ||
... | |||
) |
Complain that the tree code of NODE does not match the expected 0 terminated list of trailing codes. The trailing code list can be empty, for a more vague error message. FILE, LINE, and FUNCTION are of the caller.
References build_variant_type_copy(), and targetm.
Referenced by tree_check5().
void tree_class_check_failed | ( | const_tree | node, |
const enum tree_code_class | cl, | ||
const char * | file, | ||
int | line, | ||
const char * | function | ||
) |
Similar to tree_check_failed, except that we check for a class of tree code, given in CL.
References build_function_type(), builtin_decl_explicit_p(), and local_define_builtin().
size_t tree_code_size | ( | ) |
Compute the number of bytes occupied by a tree with code CODE. This function cannot be used for nodes that have variable sizes, including TREE_VEC, STRING_CST, and CALL_EXPR.
tree tree_cons_stat | ( | ) |
Return a newly created TREE_LIST node whose purpose and value fields are PURPOSE and VALUE and whose TREE_CHAIN is CHAIN.
References bit_position(), and tree_low_cst().
void tree_contains_struct_check_failed | ( | const_tree | node, |
const enum tree_node_structure_enum | en, | ||
const char * | file, | ||
int | line, | ||
const char * | function | ||
) |
Similar to tree_class_check_failed, except that we check for whether CODE contains the tree structure identified by EN.
unsigned int tree_decl_map_hash | ( | ) |
Hash a from tree in a tree_decl_map.
tree tree_expr_size | ( | ) |
Returns a tree for the size of EXP in bytes.
int tree_floor_log2 | ( | ) |
Similar, but return the largest integer Y such that 2 ** Y is less than or equal to EXPR.
First clear all bits that are beyond the type's precision in case we've been sign extended. Ignore if type's precision hasn't been set since what we are doing is setting it.
int tree_int_cst_compare | ( | ) |
Returns -1 if T1 < T2, 0 if T1 == T2, and 1 if T1 > T2.
Referenced by compare_names(), get_vr_for_comparison(), gimplify_decl_expr(), and vect_do_peeling_for_loop_bound().
int tree_int_cst_equal | ( | ) |
Nonzero if integer constants T1 and T2 represent the same constant value.
Referenced by compcode_to_comparison(), decode_addr_const(), expand_expr_real_1(), fold_convert_const_fixed_from_int(), get_pointer_alignment(), gimple_val_nonnegative_real_p(), preprocess_case_label_vec_for_gimple(), and update_range_test().
int tree_int_cst_lt | ( | ) |
Nonzero if integer constants T1 and T2 represent values that satisfy <. The precise way of comparison depends on their data type.
Otherwise, both are non-negative, so we compare them as unsigned just in case one of them would overflow a signed type.
Referenced by create_iv(), create_temp_arrays(), expand_builtin_memset_args(), expand_builtin_object_size(), finish_builtin_struct(), fold_builtin_fputs(), and loop_niter_by_eval().
unsigned int tree_int_cst_min_precision | ( | ) |
Return the minimum number of bits needed to represent VALUE in a signed or unsigned type, UNSIGNEDP says which.
If the value is negative, compute its negative minus 1. The latter adjustment is because the absolute value of the largest negative value is one larger than the largest positive value. This is equivalent to a bit-wise negation, so use that operation instead.
Return the number of bits needed, taking into account the fact that we need one more bit for a signed than unsigned type. If value is 0 or -1, the minimum precision is 1 no matter whether unsignedp is true or false.
int tree_int_cst_sgn | ( | ) |
Return an indication of the sign of the integer constant T. The return value is -1 if T < 0, 0 if T == 0, and 1 if T > 0. Note that -1 will never be returned if T's type is unsigned.
References iterative_hash_expr().
Referenced by analyze_ziv_subscript(), attribute_list_contained(), compute_object_offset(), fold_builtin_strcspn(), and tree_predict_by_opcode().
int tree_int_cst_sign_bit | ( | ) |
Return the most significant (sign) bit of T.
References builtin_decl_explicit().
Referenced by can_unroll_loop_p().
|
static |
Return true if T is function-invariant (internal function, does not handle arithmetic; that's handled in skip_simple_arithmetic and tree_invariant_p).
Referenced by decl_address_ip_invariant_p(), and staticp().
|
static |
Return true if T is function-invariant.
References tcc_exceptional, and tcc_reference.
|
static |
tree tree_last | ( | ) |
Return the last node in a chain of nodes (chained through TREE_CHAIN).
Referenced by ipa_free_all_structures_after_ipa_cp().
int tree_log2 | ( | ) |
Return the power of two represented by a tree node known to be a power of two.
First clear all bits that are beyond the type's precision in case we've been sign extended.
References real_onep().
Referenced by fold_mathfn_compare(), and update_range_test().
HOST_WIDE_INT tree_low_cst | ( | ) |
Return the HOST_WIDE_INT least significant bits of T if it is an INTEGER_CST and there is no overflow. POS is nonzero if the result must be non-negative. We must be able to satisfy the above conditions.
References iterative_hash_expr().
Referenced by add_data_member_location_attribute(), add_location_or_const_value_attribute(), all_zeros_p(), analyze_caller_dereference_legality(), assemble_string(), bit_value_unop(), build_function_decl_skip_args(), compute_object_offset(), constant_pointer_difference(), count_type_elements(), ctor_to_vec(), fold_builtin_exponent(), fold_builtin_logarithm(), fold_builtin_strcspn(), fold_builtin_strncat_chk(), fortran_common(), gimple_get_virt_method_for_binfo(), init_subtree_with_zero(), initializer_constant_valid_p_1(), instrument_builtin_call(), native_interpret_complex(), nreverse(), number_of_iterations_ne_max(), output_constant(), plus_stmt_object_size(), possible_polymorphic_call_target_p(), tree_block(), tree_cons_stat(), type_like_member_ptr_p(), and unloop_loops().
int tree_map_base_eq | ( | ) |
Return true if the from tree in both tree maps are equal.
References type_hash::hash, and layout_type().
unsigned int tree_map_base_hash | ( | ) |
Hash a from tree in a tree_base_map.
int tree_map_base_marked_p | ( | ) |
Return true if this tree map structure is marked for garbage collection purposes. We simply return true if the from tree is marked, so that this structure goes away when the from tree goes away.
References type_hash::hash.
unsigned int tree_map_hash | ( | ) |
Hash a from tree in a tree_map.
Referenced by merge_weak().
enum tree_node_structure_enum tree_node_structure | ( | ) |
Return which tree structure is used by T.
|
inlinestatic |
Return the tree node structure used by tree code CODE.
tcc_constant cases.
tcc_exceptional cases.
location_t tree_nonartificial_location | ( | ) |
If EXP is inlined from an __attribute__((__artificial__)) function, return the location of the original call expression.
|
inlinestatic |
Return true iff conversion in EXP generates no instruction. Mark it inline so that we fully inline into the stripping functions even though we have two uses of this function.
Use precision rather then machine mode when we can, which gives the correct answer even for submode (bit-field) types.
Otherwise fall back on comparing machine modes (e.g. for aggregate types, floats).
void tree_not_check_failed | ( | const_tree | node, |
const char * | file, | ||
int | line, | ||
const char * | function, | ||
... | |||
) |
Complain that the tree code of NODE does match the expected 0 terminated list of trailing codes. FILE, LINE, and FUNCTION are of the caller.
void tree_not_class_check_failed | ( | const_tree | node, |
const enum tree_code_class | cl, | ||
const char * | file, | ||
int | line, | ||
const char * | function | ||
) |
Similar to tree_check_failed, except that we check that a tree does not have the specified code, given in CL.
void tree_operand_check_failed | ( | int | idx, |
const_tree | exp, | ||
const char * | file, | ||
int | line, | ||
const char * | function | ||
) |
Similar to above, except that the check is for the bounds of the operand vector of an expression node EXP.
Referenced by tree_check5(), tree_not_check3(), and tree_not_check4().
void tree_range_check_failed | ( | const_tree | node, |
const char * | file, | ||
int | line, | ||
const char * | function, | ||
enum tree_code | c1, | ||
enum tree_code | c2 | ||
) |
Similar to tree_check_failed, except that instead of specifying a dozen codes, use the knowledge that they're all sequential.
References build_function_type_list(), builtin_decl_explicit_p(), and local_define_builtin().
void tree_set_block | ( | ) |
|
static |
Return true iff conversion in EXP generates no instruction. Don't consider conversions changing the signedness.
size_t tree_size | ( | ) |
Compute the number of bytes occupied by NODE. This routine only looks at TREE_CODE, except for those nodes that have variable sizes.
Referenced by release_ssa_name().
tree tree_strip_nop_conversions | ( | ) |
Strip conversions from EXP according to tree_nop_conversion and return the resulting expression.
tree tree_strip_sign_nop_conversions | ( | ) |
Strip conversions from EXP according to tree_sign_nop_conversion and return the resulting expression.
void tree_vec_elt_check_failed | ( | int | idx, |
int | len, | ||
const char * | file, | ||
int | line, | ||
const char * | function | ||
) |
Similar to above, except that the check is for the bounds of a TREE_VEC's (dynamically sized) vector.
tree truth_type_for | ( | ) |
If TYPE is a vector type, return a signed integer vector type with the same width and number of subparts. Otherwise return boolean_type_node.
|
static |
Try to determine whether a TRY_CATCH expression can fall through. This is a subroutine of block_may_fallthru.
If the TRY block can fall through, the whole TRY_CATCH can fall through.
We expect to see a sequence of CATCH_EXPR trees, each with a catch expression and a body. The whole TRY_CATCH may fall through iff any of the catch bodies falls through.
The exception filter expression only matters if there is an exception. If the exception does not match EH_FILTER_TYPES, we will execute EH_FILTER_FAILURE, and we will fall through if that falls through. If the exception does match EH_FILTER_TYPES, the stack unwinder will continue up the stack, so we will not fall through. We don't know whether we will throw an exception which matches EH_FILTER_TYPES or not, so we just ignore EH_FILTER_TYPES and assume that we might throw an exception which doesn't match.
This case represents statements to be executed when an exception occurs. Those statements are implicitly followed by a RESX statement to resume execution after the exception. So in this case the TRY_CATCH never falls through.
|
static |
Return true if any part of the structure of TYPE involves a PLACEHOLDER_EXPR directly. This includes size, bounds, qualifiers (for QUAL_UNION_TYPE) and field positions.
If the size contains a placeholder or the parent type (component type in the case of arrays) type involves a placeholder, this type does.
Now do type-specific checks. Note that the last part of the check above greatly limits what we have to do below.
Here we just check the bounds.
We have already checked the component type above, so just check the domain type.
References exp(), tcc_binary, tcc_comparison, tcc_constant, tcc_declaration, tcc_exceptional, tcc_expression, tcc_reference, and tcc_unary.
bool type_contains_placeholder_p | ( | ) |
Wrapper around above function used to cache its result.
If the contains_placeholder_bits field has been initialized, then we know the answer.
Indicate that we've seen this type node, and the answer is false. This is what we want to return if we run into recursion via fields.
Compute the real value.
Store the real value.
Referenced by create_function_info_for(), and skip_simple_arithmetic().
|
static |
Add an entry to the type-hash-table for a type TYPE whose hash code is HASHCODE.
References simple_cst_equal(), and vec_safe_length().
tree type_hash_canon | ( | ) |
Given TYPE, and HASHCODE its hash code, return the canonical object for an identical type if one already exists. Otherwise, return TYPE, and record it as the canonical object. To use this function, first create a type of the sort you want. Then compute its hash code from the fields of the type that make it different from other similar types. Then call this function and use the value.
The hash table only contains main variants, so ensure that's what we're being passed.
See if the type is in the hash table already. If so, return it. Otherwise, add the type.
|
static |
|
static |
These are the Hashtable callback functions.
Returns true iff the types are equivalent.
First test the things that are the same for all types.
Be careful about comparing arrays before and after the element type has been completed; don't compare TYPE_ALIGN unless both types are complete.
... fall through ...
References host_integerp().
|
static |
|
static |
Return the cached hash value.
|
static |
|
static |
Hashing of types so that we don't make duplicates. The entry point is `type_hash_canon'.
Compute a hash code for a list of types (chain of TREE_LIST nodes with types in the TREE_VALUE slots), by adding the hash codes of the individual types.
|
static |
Look in the type hash table for a type isomorphic to TYPE. If one is found, return it. Otherwise return 0.
The TYPE_ALIGN field of a type is set by layout_type(), so we must call that routine before comparing TYPE_ALIGNs.
|
static |
|
static |
See if the data pointed to by the type hash table is marked. We consider it marked if the type is marked or if a debug type number or symbol table entry has been made for the type.
bool type_in_anonymous_namespace_p | ( | ) |
Return true if T is in anonymous namespace.
Referenced by varpool_finalize_decl(), and walk_polymorphic_call_targets().
int type_list_equal | ( | ) |
Given two lists of types (chains of TREE_LIST nodes with types in the TREE_VALUE slots) return 1 if the lists contain the same types in the same order. Also, the TREE_PURPOSEs must match.
Referenced by ttypes_filter_hasher::equal().
int type_num_arguments | ( | ) |
Returns the number of arguments to the FUNCTION_TYPE or METHOD_TYPE given by TYPE. If the argument list accepts variable arguments, then this function counts only the ordinary arguments.
If the function does not take a variable number of arguments, the last element in the list will have type `void'.
bool typedef_variant_p | ( | ) |
Returns true iff TYPE is a type variant created for a typedef.
bool types_same_for_odr | ( | ) |
For languages with One Definition Rule, work out if types are same even if the tree representation differs. This is non-trivial for LTO where minnor differences in the type representation may have prevented type merging to merge two copies of otherwise equivalent type.
Check for anonymous namespaces. Those have !TREE_PUBLIC on the corresponding TYPE_STUB_DECL.
When assembler name of virtual table is available, it is easy to compare types for equivalence.
FIXME: the code comparing type names consider all instantiations of the same template to have same name. This is because we have no access to template parameters. For types with no virtual method tables we thus can return false positives. At the moment we do not need to compare types in other scenarios than devirtualization.
If types are not structuraly same, do not bother to contnue. Match in the remainder of code would mean ODR violation.
When not in LTO the MAIN_VARIANT check should be the same.
Referenced by maybe_record_node(), and walk_tree_without_duplicates_1().
tree uniform_vector_p | ( | ) |
Check if vector VEC consists of all the equal elements and that the number of elements corresponds to the type of VEC. The function returns first element of the vector or NULL_TREE if the vector is not uniform.
tree unsigned_type_for | ( | ) |
If TYPE is an integral or pointer type, return an integer type with the same precision which is unsigned, or itself if TYPE is already an unsigned integer type.
Referenced by case_bit_test_cmp(), native_interpret_complex(), and vect_do_peeling_for_loop_bound().
tree upper_bound_in_type | ( | ) |
Returns the largest value obtainable by casting something in INNER type to OUTER type.
Compute a unique number for every combination.
Determine the exponent to use.
oprec <= iprec, outer: signed, inner: don't care.
oprec <= iprec, outer: unsigned, inner: don't care.
oprec > iprec, outer: signed, inner: signed.
oprec > iprec, outer: signed, inner: unsigned.
oprec > iprec, outer: unsigned, inner: signed.
oprec > iprec, outer: unsigned, inner: unsigned.
Compute 2^^prec - 1.
Referenced by can_unroll_loop_p().
void using_eh_for_cleanups | ( | void | ) |
This routine is called from front ends to indicate eh should be used for cleanups.
bool using_eh_for_cleanups_p | ( | void | ) |
Query whether EH is used for cleanups.
bool valid_constant_size_p | ( | ) |
Return true if SIZE represents a constant size that is in bounds of what the middle-end and the backend accepts (covering not more than half of the address-space).
tree value_member | ( | ) |
Return first list element whose TREE_VALUE is ELEM. Return 0 if ELEM is not in LIST.
bool variably_modified_type_p | ( | ) |
Returns true if T is, contains, or refers to a type with variable size. For METHOD_TYPEs and FUNCTION_TYPEs we exclude the arguments, but not the return type. If FN is nonzero, only return true if a modifier of the type or position of FN is a variable or parameter inside FN. This concept is more general than that of C99 'variably modified types': in C99, a struct type is never variably modified because a VLA may not appear as a structure member. However, in GNU C code like: struct S { int i[f()]; }; is valid, and other languages may define similar constructs.
Test if T is either variable (if FN is zero) or an expression containing a variable in FN. If TYPE isn't gimplified, return true also if gimplify_one_sizepos would gimplify the expression into a local variable.
If TYPE itself has variable size, it is variably modified.
If TYPE is a function type, it is variably modified if the return type is variably modified.
Scalar types are variably modified if their end points aren't constant.
We can't see if any of the fields are variably-modified by the definition we normally use, since that would produce infinite recursion via pointers.
This is variably modified if some field's type is.
Do not call ourselves to avoid infinite recursion. This is variably modified if the element type is.
The current language may have other cases to check, but in general, all other types are not variably modified.
References strlen().
Referenced by add_abstract_origin_attribute(), and walk_all_functions().
bool vec_member | ( | ) |
Return true if ELEM is in V.
bool virtual_method_call_p | ( | ) |
TARGET is a call target of GIMPLE call statement (obtained by gimple_call_fn). Return true if it is OBJ_TYPE_REF representing an virtual call of C++ method. (As opposed to OBJ_TYPE_REF representing objc calls through a cast where middle-end devirtualization machinery can't apply.)
tree walk_tree_1 | ( | tree * | tp, |
walk_tree_fn | func, | ||
void * | data, | ||
struct pointer_set_t * | pset, | ||
walk_tree_lh | lh | ||
) |
Apply FUNC to all the sub-trees of TP in a pre-order traversal. FUNC is called with the DATA and the address of each sub-tree. If FUNC returns a non-NULL value, the traversal is stopped, and the value returned by FUNC is returned. If PSET is non-NULL it is used to record the nodes visited, and to avoid visiting a node more than once.
Skip empty subtrees.
Don't walk the same tree twice, if the user has requested that we avoid doing so.
Call the function.
If we found something, return it.
Even if we didn't, FUNC may have decided that there was nothing interesting below this point in the tree.
But we still need to check our siblings.
None of these have subtrees other than those already walked above.
Walk all elements but the first.
Now walk the first one as a tail call.
Walk the DECL_INITIAL and DECL_SIZE. We don't want to walk into declarations that are just mentioned, rather than declared; they don't really belong to this part of the tree. And, we can see cycles: the initializer for a declaration can refer to the declaration itself.
FALLTHRU
TARGET_EXPRs are peculiar: operands 1 and 3 can be the same. But, we only want to walk once.
If this is a TYPE_DECL, walk into the fields of the type that it's defining. We only want to walk into these fields of a type in this case and not in the general case of a mere reference to the type. The criterion is as follows: if the field can be an expression, it must be walked only here. This should be in keeping with the fields that are directly gimplified in gimplify_type_sizes in order for the mark/copy-if-shared/unmark machinery of the gimplifier to work with variable-sized types. Note that DECLs get walked as part of processing the BIND_EXPR.
Call the function for the type. See if it returns anything or doesn't want us to continue. If we are to continue, walk both the normal fields and those for the declaration case.
But do not walk a pointed-to type since it may itself need to be walked in the declaration case if it isn't anonymous.
If this is a record type, also walk the fields.
We'd like to look at the type of the field, but we can easily get infinite recursion. So assume it's pointed to elsewhere in the tree. Also, ignore things that aren't fields.
Same for scalar types.
FALLTHRU
Walk over all the sub-trees of this operand.
Go through the subtrees. We need to do this in forward order so that the scope of a FOR_EXPR is handled properly.
If this is a type, walk the needed fields in the type.
We didn't find what we were looking for.
tree walk_tree_without_duplicates_1 | ( | tree * | tp, |
walk_tree_fn | func, | ||
void * | data, | ||
walk_tree_lh | lh | ||
) |
Like walk_tree, but does not walk duplicate nodes more than once.
References types_same_for_odr().
|
static |
This is a subroutine of walk_tree that walks field of TYPE that are to be walked whenever a type is seen in the tree. Rest of operands and return value are as for walk_tree.
We have to worry about mutually recursive pointers. These can't be written in C. They can in Ada. It's pathological, but there's an ACATS test (c38102a) that checks it. Deal with this by checking if we're pointing to another pointer, that one points to another pointer, that one does too, and we have no htab. If so, get a hash table. We check three levels deep to avoid the cost of the hash table if we don't need one.
... fall through ...
Fall through.
We never want to walk into default arguments.
Don't follow this nodes's type if a pointer for fear that we'll have infinite recursion. If we have a PSET, then we need not fear.
Referenced by range_in_array_bounds_p().
void warn_deprecated_use | ( | ) |
Warn about a use of an identifier which was marked deprecated.
HOST_WIDEST_INT widest_int_cst_value | ( | ) |
Return value of a constant X and sign-extend it.
Make sure the sign-extended value will fit in a HOST_WIDE_INT.
|
static |
Hash table for optimization flags and target option flags. Use the same hash table for both sets of options. Nodes for building the current optimization and target option nodes. The assumption is most of the time the options created will already be in the hash table, so we avoid allocating and freeing up a node repeatably.
|
static |
|
static |
|
static |
Referenced by check_aligned_type(), and check_qualified_type().
|
static |
General tree->tree mapping structure for use in hash tables.
|
static |
|
static |
|
static |
|
static |
Hash table and temporary node for larger integer const values.
|
static |
Unique id for next debug decl created. Use negative numbers, to catch erroneous uses.
|
static |
Unique id for next decl created.
|
static |
Unique id for next type created.
|
static |
Referenced by compare_tree_int().
const char* const omp_clause_code_name[] |
unsigned const char omp_clause_num_ops[] |
Number of operands for each OpenMP clause.
const char* const tree_code_class_strings[] |
Each tree code class has an associated string representation. These must correspond to the tree_code_class entries.
|
static |
Statistics-gathering stuff.
const unsigned char tree_code_length[] |
|
static |
enum tree_code_class tree_code_type[] |
unsigned char tree_contains_struct[MAX_TREE_CODES][64] |
int tree_node_counts[(int) all_kinds] |
|
static |
Keep in sync with tree.h:enum tree_node_kind.
int tree_node_sizes[(int) all_kinds] |
|
static |
|
static |
Now here is the hash table. When recording a type, it is added to the slot whose index is the hash code. Note that the hash table is used for several kinds of types (function types, array types and array index range types, for now). While all these live in the same table, they are completely independent, and the hash code is computed differently for each of these.
|
static |
True if we are using EH to handle cleanups.
Referenced by block_ultimate_origin().
|
static |