aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2013-11-08 17:46:16 -0500
committerDiego Novillo <dnovillo@gcc.gnu.org>2013-11-08 17:46:16 -0500
commit862d0b359fb98790d5fad654eecf471228d8bb77 (patch)
tree956d82c4131695b3b703c5ba7a83a02ad61d5928 /gcc/tree.c
parentf0e56cd667259c3bc4234cb75c5137136af7b25d (diff)
downloadgcc-862d0b359fb98790d5fad654eecf471228d8bb77.zip
gcc-862d0b359fb98790d5fad654eecf471228d8bb77.tar.gz
gcc-862d0b359fb98790d5fad654eecf471228d8bb77.tar.bz2
Re-factor tree.h - Part 1.
This is the first patch in a series of patches to cleanup tree.h to reduce the exposure it has all over the compiler. In this patch, I'm moving functions that are used once into the files that use them, and make them private to that file. These functions were declared extern in tree.h and called from exactly one place. The patch does not move EVERY function. This usually happens when the function uses private state from its original file, and moving that private state would mean moving other functions that made no sense to move. Additionally, the patch removes functions that were never used. In subsequent patches, I will be moving out of tree.h extern definitions that should be grouped in other files (e.g., all functions defined in some FOO.c will be moved to the corresponding FOO.h). This will allow me to remove the inclusion of tree.h from some files. * attribs.c (lookup_scoped_attribute_spec): Make static. (get_attribute_namespace): Likewise. * builtins.c (more_const_call_expr_args_p): Move from tree.h. (validate_arglist): Move earlier in the file. Make static. (expand_stack_restore): Move from stmt.c (expand_stack_save): Move from stmt.c (rewrite_call_expr_array): Move earlier in the file. (rewrite_call_expr_valist): Likewise. * cfgexpand.c: Include hard-reg-set.h before tree.h Include recog.h. Include output.h. (expand_asm_loc): Move from stmt.c. (n_occurrences): Move from stmt.c. (check_operand_nalternatives): Move from stmt.c. (tree_conflicts_with_clobbers_p): Move from stmt.c. (expand_asm_operands): Move from stmt.c (expand_asm_stmt): Move from stmt.c (expand_computed_goto): Move from stmt.c (expand_goto): Move from stmt.c (expand_null_return_1): Move from stmt.c (expand_null_return): Move from stmt.c (expand_value_return): Move from stmt.c (expand_return): Move from stmt.c (expand_main_function): Move from function.c (stack_protect_prologue): Move from function.c * cgraphclones.c (build_function_type_skip_args): Move from tree.c. (build_function_decl_skip_args): Move from tree.c. * explow.c (tree_expr_size): Move from tree.c. * expr.c (addr_expr_of_non_mem_decl_p): Remove. (fields_length): Move from tree.c. * fold-const.c (size_low_cst): Move from tree.c. (tree_expr_nonzero_warnv_p): Make static. Move earlier in the file. (tree_expr_nonzero_p): Make static. Move earlier in the file. (fold_build3_initializer_loc): Remove. (tree_invalid_nonnegative_warnv_p): Make static. * function.c (expand_main_function): Move to cfgexpand.c. (stack_protect_prologue): Move to cfgexpand.c. (set_insn_locations): Move earlier in the file. * gimple-fold.c: Include langhooks.h. (truth_type_for): Move from tree.c. * print-tree.c (print_vec_tree): Remove. * stmt.c (expand_computed_goto): Move to cfgexpand.c. (expand_goto): Move to cfgexpand.c. (n_occurrences): Move to cfgexpand.c. (expand_asm_loc): Move to cfgexpand.c (tree_conflicts_with_clobbers_p): Move to cfgexpand.c. (expand_asm_operands): Move to cfgexpand.c. (expand_asm_stmt): Move to cfgexpand.c. (check_operand_nalternatives): Move to cfgexpand.c (expand_null_return): Move to cfgexpand.c. (expand_value_return): Move to cfgexpand.c. (expand_null_return_1): Move to cfgexpand.c. (expand_return): Move to cfgexpand.c. (expand_stack_save): Move to builtins.c. (expand_stack_restore): Move to builtins.c * symtab.c: Include output.h. (decl_assembler_name_hash): Move from tree.c. (decl_assembler_name_equal): Move from tree.c. * trans-mem.c (is_tm_safe_or_pure): Move from tree.h. * tree-eh.c (in_array_bounds_p): Move from tree.c. (range_in_array_bounds_p): Move from tree.c. * tree-object-size.c (fini_object_sizes): Make static. * tree-ssa-dom.c (iterative_hash_exprs_commutative): Move from tree.h. * tree-vrp.c (ssa_name_nonnegative_p): Remove. * tree.c (decl_assembler_name_equal): Move to symtab.c. (tree_expr_size): Move to explow.c. (decl_assembler_name_hash): Move to symtab.c. (real_twop): Remove. (tree_expr_size): Move to explow.c. (stabilize_reference_1): Move earlier in the file. Make static. (omp_remove_redundant_declare_simd_attrs): Remove. (simple_cst_list_equal): Move earlier in the file. Make static. (size_low_cst): Move to fold-const.c. (build_type_no_quals): Remove. (build_function_type_skip_args): Move to cgraphclones.c. (build_function_decl_skip_args): Move to cgraphclones.c. (in_array_bounds_p): Move to tree-eh.c. (range_in_array_bounds_p): Move to tree-eh.c. (truth_type_for): Move to gimple-fold.c. (list_equal_p): remove. * tree.h (decl_assembler_name_equal): Remove. (decl_assembler_name_hash): Remove. (truth_type_for): Remove. (build_type_no_quals): Remove. (build_function_decl_skip_args): Remove. (in_array_bounds_p): Remove. (range_in_array_bounds_p): Remove. (size_low_cst): Remove. (omp_remove_redundant_declare_simd_attrs): Remove. (tree_expr_size): Remove. (fields_length): Remove. (stabilize_reference_1): Remove. (expand_goto): Remove. (expand_stack_save): Remove. (expand_stack_restore): Remove. (expand_return): Remove. (fold_build3_initializer_loc): Remove. (tree_expr_nonzero_p): Remove. (tree_invalid_nonnegative_warnv_p): Remove. (tree_expr_nonzero_warnv_p): Remove. (fold_builtin_snprintf_chk): Remove. (validate_arglist): Remove. (iterative_hash_exprs_commutative): Move to tree-ssa-dom.c. (simple_cst_list_equal): Remove. (real_twop): Remove. (expand_main_function): Remove. (stack_protect_prologue): Remove. (print_vec_tree): Remove. (lookup_scoped_attribute_spec): Remove. (get_attribute_namespace): Remove. (expand_computed_goto): Remove. (expand_asm_stmt): Remove. (list_equal_p): Remove. (ssa_name_nonnegative_p): Remove. (fini_object_sizes): Remove. (addr_expr_of_non_mem_decl_p): Remove. (is_tm_safe_or_pure): Move to trans-mem.c. (more_const_call_expr_args_p): Remove. (save_vtable_map_decl): Remove. From-SVN: r204606
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c594
1 files changed, 94 insertions, 500 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 21b790a..686a680 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -588,82 +588,6 @@ decl_assembler_name (tree decl)
return DECL_WITH_VIS_CHECK (decl)->decl_with_vis.assembler_name;
}
-/* Compare ASMNAME with the DECL_ASSEMBLER_NAME of DECL. */
-
-bool
-decl_assembler_name_equal (tree decl, const_tree asmname)
-{
- tree decl_asmname = DECL_ASSEMBLER_NAME (decl);
- const char *decl_str;
- const char *asmname_str;
- bool test = false;
-
- if (decl_asmname == asmname)
- return true;
-
- decl_str = IDENTIFIER_POINTER (decl_asmname);
- asmname_str = IDENTIFIER_POINTER (asmname);
-
-
- /* 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. */
- if (decl_str[0] == '*')
- {
- size_t ulp_len = strlen (user_label_prefix);
-
- decl_str ++;
-
- if (ulp_len == 0)
- test = true;
- else if (strncmp (decl_str, user_label_prefix, ulp_len) == 0)
- decl_str += ulp_len, test=true;
- else
- decl_str --;
- }
- if (asmname_str[0] == '*')
- {
- size_t ulp_len = strlen (user_label_prefix);
-
- asmname_str ++;
-
- if (ulp_len == 0)
- test = true;
- else if (strncmp (asmname_str, user_label_prefix, ulp_len) == 0)
- asmname_str += ulp_len, test=true;
- else
- asmname_str --;
- }
-
- if (!test)
- return false;
- return strcmp (decl_str, asmname_str) == 0;
-}
-
-/* Hash asmnames ignoring the user specified marks. */
-
-hashval_t
-decl_assembler_name_hash (const_tree asmname)
-{
- if (IDENTIFIER_POINTER (asmname)[0] == '*')
- {
- const char *decl_str = IDENTIFIER_POINTER (asmname) + 1;
- size_t ulp_len = strlen (user_label_prefix);
-
- if (ulp_len == 0)
- ;
- else if (strncmp (decl_str, user_label_prefix, ulp_len) == 0)
- decl_str += ulp_len;
-
- return htab_hash_string (decl_str);
- }
-
- return htab_hash_string (IDENTIFIER_POINTER (asmname));
-}
-
/* 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. */
@@ -2386,35 +2310,6 @@ real_onep (const_tree expr)
}
}
-/* Return 1 if EXPR is the real constant two. Trailing zeroes matter
- for decimal float constants, so don't return 1 for them. */
-
-int
-real_twop (const_tree expr)
-{
- STRIP_NOPS (expr);
-
- switch (TREE_CODE (expr))
- {
- case REAL_CST:
- return REAL_VALUES_EQUAL (TREE_REAL_CST (expr), dconst2)
- && !(DECIMAL_FLOAT_MODE_P (TYPE_MODE (TREE_TYPE (expr))));
- case COMPLEX_CST:
- return real_twop (TREE_REALPART (expr))
- && real_zerop (TREE_IMAGPART (expr));
- case VECTOR_CST:
- {
- unsigned i;
- for (i = 0; i < VECTOR_CST_NELTS (expr); ++i)
- if (!real_twop (VECTOR_CST_ELT (expr, i)))
- return false;
- return true;
- }
- default:
- return false;
- }
-}
-
/* Return 1 if EXPR is the real constant minus one. Trailing zeroes
matter for decimal float constants, so don't return 1 for them. */
@@ -2552,21 +2447,6 @@ list_length (const_tree t)
return len;
}
-/* Returns the number of FIELD_DECLs in TYPE. */
-
-int
-fields_length (const_tree type)
-{
- tree t = TYPE_FIELDS (type);
- int count = 0;
-
- for (; t; t = DECL_CHAIN (t))
- if (TREE_CODE (t) == FIELD_DECL)
- ++count;
-
- return count;
-}
-
/* Returns the first FIELD_DECL in the TYPE_FIELDS of the RECORD_TYPE or
UNION_TYPE TYPE, or NULL_TREE if none. */
@@ -2787,18 +2667,6 @@ max_int_size_in_bytes (const_tree type)
return size;
}
-
-/* Returns a tree for the size of EXP in bytes. */
-
-tree
-tree_expr_size (const_tree exp)
-{
- if (DECL_P (exp)
- && DECL_SIZE_UNIT (exp) != 0)
- return DECL_SIZE_UNIT (exp);
- else
- return size_in_bytes (TREE_TYPE (exp));
-}
/* Return the bit position of FIELD, in bits from the start of the record.
This is a tree of type bitsizetype. */
@@ -3902,6 +3770,88 @@ substitute_placeholder_in_expr (tree exp, tree obj)
return new_tree;
}
+
+/* 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. */
+
+static tree
+stabilize_reference_1 (tree e)
+{
+ tree result;
+ enum tree_code code = TREE_CODE (e);
+
+ /* 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 (tree_invariant_p (e))
+ return e;
+
+ switch (TREE_CODE_CLASS (code))
+ {
+ case tcc_exceptional:
+ case tcc_type:
+ case tcc_declaration:
+ case tcc_comparison:
+ case tcc_statement:
+ case tcc_expression:
+ case tcc_reference:
+ case tcc_vl_exp:
+ /* 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. */
+ if (TREE_SIDE_EFFECTS (e))
+ return save_expr (e);
+ return e;
+
+ case tcc_constant:
+ /* Constants need no processing. In fact, we should never reach
+ here. */
+ return e;
+
+ case tcc_binary:
+ /* 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. */
+ if (code == TRUNC_DIV_EXPR || code == TRUNC_MOD_EXPR
+ || code == FLOOR_DIV_EXPR || code == FLOOR_MOD_EXPR
+ || code == CEIL_DIV_EXPR || code == CEIL_MOD_EXPR
+ || code == ROUND_DIV_EXPR || code == ROUND_MOD_EXPR)
+ return save_expr (e);
+ /* Recursively stabilize each operand. */
+ result = build_nt (code, stabilize_reference_1 (TREE_OPERAND (e, 0)),
+ stabilize_reference_1 (TREE_OPERAND (e, 1)));
+ break;
+
+ case tcc_unary:
+ /* Recursively stabilize each operand. */
+ result = build_nt (code, stabilize_reference_1 (TREE_OPERAND (e, 0)));
+ break;
+
+ default:
+ gcc_unreachable ();
+ }
+
+ TREE_TYPE (result) = TREE_TYPE (e);
+ TREE_READONLY (result) = TREE_READONLY (e);
+ TREE_SIDE_EFFECTS (result) = TREE_SIDE_EFFECTS (e);
+ TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (e);
+
+ return result;
+}
+
/* 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,
@@ -3983,87 +3933,6 @@ stabilize_reference (tree ref)
return result;
}
-
-/* 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. */
-
-tree
-stabilize_reference_1 (tree e)
-{
- tree result;
- enum tree_code code = TREE_CODE (e);
-
- /* 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 (tree_invariant_p (e))
- return e;
-
- switch (TREE_CODE_CLASS (code))
- {
- case tcc_exceptional:
- case tcc_type:
- case tcc_declaration:
- case tcc_comparison:
- case tcc_statement:
- case tcc_expression:
- case tcc_reference:
- case tcc_vl_exp:
- /* 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. */
- if (TREE_SIDE_EFFECTS (e))
- return save_expr (e);
- return e;
-
- case tcc_constant:
- /* Constants need no processing. In fact, we should never reach
- here. */
- return e;
-
- case tcc_binary:
- /* 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. */
- if (code == TRUNC_DIV_EXPR || code == TRUNC_MOD_EXPR
- || code == FLOOR_DIV_EXPR || code == FLOOR_MOD_EXPR
- || code == CEIL_DIV_EXPR || code == CEIL_MOD_EXPR
- || code == ROUND_DIV_EXPR || code == ROUND_MOD_EXPR)
- return save_expr (e);
- /* Recursively stabilize each operand. */
- result = build_nt (code, stabilize_reference_1 (TREE_OPERAND (e, 0)),
- stabilize_reference_1 (TREE_OPERAND (e, 1)));
- break;
-
- case tcc_unary:
- /* Recursively stabilize each operand. */
- result = build_nt (code, stabilize_reference_1 (TREE_OPERAND (e, 0)));
- break;
-
- default:
- gcc_unreachable ();
- }
-
- TREE_TYPE (result) = TREE_TYPE (e);
- TREE_READONLY (result) = TREE_READONLY (e);
- TREE_SIDE_EFFECTS (result) = TREE_SIDE_EFFECTS (e);
- TREE_THIS_VOLATILE (result) = TREE_THIS_VOLATILE (e);
-
- return result;
-}
/* Low-level constructors for expressions. */
@@ -4758,43 +4627,22 @@ omp_declare_simd_clauses_equal (tree clauses1, tree clauses2)
return true;
}
-/* Remove duplicate "omp declare simd" attributes. */
+/* Compare two constructor-element-type constants. Return 1 if the lists
+ are known to be equal; otherwise return 0. */
-void
-omp_remove_redundant_declare_simd_attrs (tree fndecl)
+static bool
+simple_cst_list_equal (const_tree l1, const_tree l2)
{
- tree attr, end_attr = NULL_TREE, last_attr = NULL_TREE;
- for (attr = lookup_attribute ("omp declare simd", DECL_ATTRIBUTES (fndecl));
- attr;
- attr = lookup_attribute ("omp declare simd", TREE_CHAIN (attr)))
+ while (l1 != NULL_TREE && l2 != NULL_TREE)
{
- tree *pc;
- for (pc = &TREE_CHAIN (attr); *pc && *pc != end_attr; )
- {
- if (is_attribute_p ("omp declare simd", TREE_PURPOSE (*pc)))
- {
- last_attr = TREE_CHAIN (*pc);
- if (TREE_VALUE (attr) == NULL_TREE)
- {
- if (TREE_VALUE (*pc) == NULL_TREE)
- {
- *pc = TREE_CHAIN (*pc);
- continue;
- }
- }
- else if (TREE_VALUE (*pc) != NULL_TREE
- && omp_declare_simd_clauses_equal
- (TREE_VALUE (TREE_VALUE (*pc)),
- TREE_VALUE (TREE_VALUE (attr))))
- {
- *pc = TREE_CHAIN (*pc);
- continue;
- }
- }
- pc = &TREE_CHAIN (*pc);
- }
- end_attr = last_attr;
+ if (simple_cst_equal (TREE_VALUE (l1), TREE_VALUE (l2)) != 1)
+ return false;
+
+ l1 = TREE_CHAIN (l1);
+ l2 = TREE_CHAIN (l2);
}
+
+ return l1 == l2;
}
/* Compare two attributes for their value identity. Return true if the
@@ -7129,17 +6977,6 @@ tree_low_cst (const_tree t, int pos)
return TREE_INT_CST_LOW (t);
}
-/* Return the HOST_WIDE_INT least significant bits of T, a sizetype
- kind INTEGER_CST. This makes sure to properly sign-extend the
- constant. */
-
-HOST_WIDE_INT
-size_low_cst (const_tree t)
-{
- double_int d = tree_to_double_int (t);
- return d.sext (TYPE_PRECISION (TREE_TYPE (t))).low;
-}
-
/* Return the most significant (sign) bit of T. */
int
@@ -7201,24 +7038,6 @@ tree_int_cst_min_precision (tree value, bool unsignedp)
return tree_floor_log2 (value) + 1 + !unsignedp;
}
-/* Compare two constructor-element-type constants. Return 1 if the lists
- are known to be equal; otherwise return 0. */
-
-int
-simple_cst_list_equal (const_tree l1, const_tree l2)
-{
- while (l1 != NULL_TREE && l2 != NULL_TREE)
- {
- if (simple_cst_equal (TREE_VALUE (l1), TREE_VALUE (l2)) != 1)
- return 0;
-
- l1 = TREE_CHAIN (l1);
- l2 = TREE_CHAIN (l2);
- }
-
- return l1 == l2;
-}
-
/* 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.
@@ -7644,29 +7463,6 @@ iterative_hash_expr (const_tree t, 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. */
-
-hashval_t
-iterative_hash_exprs_commutative (const_tree t1,
- const_tree t2, hashval_t val)
-{
- hashval_t one = iterative_hash_expr (t1, 0);
- hashval_t two = iterative_hash_expr (t2, 0);
- hashval_t t;
-
- if (one > two)
- t = one, one = two, two = t;
- val = iterative_hash_hashval_t (one, val);
- val = iterative_hash_hashval_t (two, val);
-
- return val;
-}
-
/* Constructors for pointer, array and function types.
(RECORD_TYPE, UNION_TYPE and ENUMERAL_TYPE nodes are
constructed by language-dependent code, not here.) */
@@ -7808,30 +7604,6 @@ build_reference_type (tree to_type)
return build_reference_type_for_mode (to_type, pointer_mode, false);
}
-/* Build a type that is compatible with t but has no cv quals anywhere
- in its type, thus
-
- const char *const *const * -> char ***. */
-
-tree
-build_type_no_quals (tree t)
-{
- switch (TREE_CODE (t))
- {
- case POINTER_TYPE:
- return build_pointer_type_for_mode (build_type_no_quals (TREE_TYPE (t)),
- TYPE_MODE (t),
- TYPE_REF_CAN_ALIAS_ALL (t));
- case REFERENCE_TYPE:
- return
- build_reference_type_for_mode (build_type_no_quals (TREE_TYPE (t)),
- TYPE_MODE (t),
- TYPE_REF_CAN_ALIAS_ALL (t));
- default:
- return TYPE_MAIN_VARIANT (t);
- }
-}
-
#define MAX_INT_CACHED_PREC \
(HOST_BITS_PER_WIDE_INT > 64 ? HOST_BITS_PER_WIDE_INT : 64)
static GTY(()) tree nonstandard_integer_type_cache[2 * MAX_INT_CACHED_PREC + 2];
@@ -8207,111 +7979,6 @@ build_function_type (tree value_type, tree arg_types)
return t;
}
-/* Build variant of function type ORIG_TYPE skipping ARGS_TO_SKIP and the
- return value if SKIP_RETURN is true. */
-
-static tree
-build_function_type_skip_args (tree orig_type, bitmap args_to_skip,
- bool skip_return)
-{
- tree new_type = NULL;
- tree args, new_args = NULL, t;
- tree new_reversed;
- int i = 0;
-
- for (args = TYPE_ARG_TYPES (orig_type); args && args != void_list_node;
- args = TREE_CHAIN (args), i++)
- if (!args_to_skip || !bitmap_bit_p (args_to_skip, i))
- new_args = tree_cons (NULL_TREE, TREE_VALUE (args), new_args);
-
- new_reversed = nreverse (new_args);
- if (args)
- {
- if (new_reversed)
- TREE_CHAIN (new_args) = void_list_node;
- else
- new_reversed = void_list_node;
- }
-
- /* 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. */
- if (TREE_CODE (orig_type) != METHOD_TYPE
- || !args_to_skip
- || !bitmap_bit_p (args_to_skip, 0))
- {
- new_type = build_distinct_type_copy (orig_type);
- TYPE_ARG_TYPES (new_type) = new_reversed;
- }
- else
- {
- new_type
- = build_distinct_type_copy (build_function_type (TREE_TYPE (orig_type),
- new_reversed));
- TYPE_CONTEXT (new_type) = TYPE_CONTEXT (orig_type);
- }
-
- if (skip_return)
- TREE_TYPE (new_type) = void_type_node;
-
- /* 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. */
- t = TYPE_MAIN_VARIANT (orig_type);
- if (t != orig_type)
- {
- t = build_function_type_skip_args (t, args_to_skip, skip_return);
- TYPE_MAIN_VARIANT (new_type) = t;
- TYPE_NEXT_VARIANT (new_type) = TYPE_NEXT_VARIANT (t);
- TYPE_NEXT_VARIANT (t) = new_type;
- }
- else
- {
- TYPE_MAIN_VARIANT (new_type) = new_type;
- TYPE_NEXT_VARIANT (new_type) = NULL;
- }
-
- return new_type;
-}
-
-/* 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). */
-
-tree
-build_function_decl_skip_args (tree orig_decl, bitmap args_to_skip,
- bool skip_return)
-{
- tree new_decl = copy_node (orig_decl);
- tree new_type;
-
- new_type = TREE_TYPE (orig_decl);
- if (prototype_p (new_type)
- || (skip_return && !VOID_TYPE_P (TREE_TYPE (new_type))))
- new_type
- = build_function_type_skip_args (new_type, args_to_skip, skip_return);
- TREE_TYPE (new_decl) = new_type;
-
- /* For declarations setting DECL_VINDEX (i.e. methods)
- we expect first argument to be THIS pointer. */
- if (args_to_skip && bitmap_bit_p (args_to_skip, 0))
- DECL_VINDEX (new_decl) = NULL_TREE;
-
- /* When signature changes, we need to clear builtin info. */
- if (DECL_BUILT_IN (new_decl)
- && args_to_skip
- && !bitmap_empty_p (args_to_skip))
- {
- DECL_BUILT_IN_CLASS (new_decl) = NOT_BUILT_IN;
- DECL_FUNCTION_CODE (new_decl) = (enum built_in_function) 0;
- }
- return new_decl;
-}
-
/* 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. */
@@ -10781,68 +10448,6 @@ build_call_vec (tree return_type, tree fn, vec<tree, va_gc> *args)
return ret;
}
-
-/* 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. */
-
-bool
-in_array_bounds_p (tree ref)
-{
- tree idx = TREE_OPERAND (ref, 1);
- tree min, max;
-
- if (TREE_CODE (idx) != INTEGER_CST)
- return false;
-
- min = array_ref_low_bound (ref);
- max = array_ref_up_bound (ref);
- if (!min
- || !max
- || TREE_CODE (min) != INTEGER_CST
- || TREE_CODE (max) != INTEGER_CST)
- return false;
-
- if (tree_int_cst_lt (idx, min)
- || tree_int_cst_lt (max, idx))
- return false;
-
- return true;
-}
-
-/* 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. */
-
-bool
-range_in_array_bounds_p (tree ref)
-{
- tree domain_type = TYPE_DOMAIN (TREE_TYPE (ref));
- tree range_min, range_max, min, max;
-
- range_min = TYPE_MIN_VALUE (domain_type);
- range_max = TYPE_MAX_VALUE (domain_type);
- if (!range_min
- || !range_max
- || TREE_CODE (range_min) != INTEGER_CST
- || TREE_CODE (range_max) != INTEGER_CST)
- return false;
-
- min = array_ref_low_bound (ref);
- max = array_ref_up_bound (ref);
- if (!min
- || !max
- || TREE_CODE (min) != INTEGER_CST
- || TREE_CODE (max) != INTEGER_CST)
- return false;
-
- if (tree_int_cst_lt (range_min, min)
- || tree_int_cst_lt (max, range_max))
- return false;
-
- return true;
-}
-
/* Return true if T (assumed to be a DECL) must be assigned a memory
location. */
@@ -11910,17 +11515,6 @@ block_ultimate_origin (const_tree block)
}
}
-/* Return true if T1 and T2 are equivalent lists. */
-
-bool
-list_equal_p (const_tree t1, const_tree t2)
-{
- for (; t1 && t2; t1 = TREE_CHAIN (t1) , t2 = TREE_CHAIN (t2))
- if (TREE_VALUE (t1) != TREE_VALUE (t2))
- return false;
- return !t1 && !t2;
-}
-
/* 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. */