From 8115f0afdaff380da01d555b0584cd0fceb789b8 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 29 Jun 2009 12:20:39 +0000 Subject: 2009-06-29 Richard Guenther PR middle-end/38212 * alias.c (find_base_decl): Remove. (get_deref_alias_set_1): Remove restrict handling. * c-common.c (c_apply_type_quals_to_decl): Do not set DECL_POINTER_ALIAS_SET. * gimplify.c (find_single_pointer_decl_1): Remove. (find_single_pointer_decl): Likewise. (internal_get_tmp_var): Remove restrict handling. (gimple_regimplify_operands): Likewise. * omp-low.c (expand_omp_atomic_pipeline): Do not set DECL_POINTER_ALIAS_SET. Use ref-all pointers. * print-tree.c (print_node): Do not print DECL_POINTER_ALIAS_SET. * tree.c (restrict_base_for_decl): Remove. (init_ttree): Do not allocate it. (make_node_stat): Do not set DECL_POINTER_ALIAS_SET. Set LABEL_DECL_UID for label decls. (copy_node_stat): Do not copy restrict information. (decl_restrict_base_lookup): Remove. (decl_restrict_base_insert): Likewise. (print_restrict_base_statistics): Likewise. (dump_tree_statistics): Do not call print_restrict_base_statistics. * tree.h (DECL_POINTER_ALIAS_SET): Remove. (DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise. (struct tree_decl_common): Rename pointer_alias_set to label_decl_uid. (LABEL_DECL_UID): Adjust. (DECL_BASED_ON_RESTRICT_P): Remove. (DECL_GET_RESTRICT_BASE): Likewise. (SET_DECL_RESTRICT_BASE): Likewise. (struct tree_decl_with_vis): Remove based_on_restrict_p flag. * config/i386/i386.c (ix86_gimplify_va_arg): Use ref-all pointers instead of DECL_POINTER_ALIAS_SET. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. * config/s390/s390.c (s390_gimplify_va_arg): Likewise. * config/spu/spu.c (spu_gimplify_va_arg_expr): Likewise. * gcc.c-torture/execute/pr38212.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149047 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 59 ++--------------------------------------------------------- 1 file changed, 2 insertions(+), 57 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index ffdd8888ea3..a42f3695275 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -194,9 +194,6 @@ static GTY ((if_marked ("tree_priority_map_marked_p"), param_is (struct tree_priority_map))) htab_t init_priority_for_decl; -static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) - htab_t restrict_base_for_decl; - static void set_type_quals (tree, int); static int type_hash_eq (const void *, const void *); static hashval_t type_hash_hash (const void *); @@ -273,8 +270,6 @@ init_ttree (void) tree_map_eq, 0); init_priority_for_decl = htab_create_ggc (512, tree_priority_map_hash, tree_priority_map_eq, 0); - restrict_base_for_decl = htab_create_ggc (256, tree_map_hash, - tree_map_eq, 0); int_cst_hash_table = htab_create_ggc (1024, int_cst_hash_hash, int_cst_hash_eq, NULL); @@ -658,11 +653,11 @@ make_node_stat (enum tree_code code MEM_STAT_DECL) } else DECL_ALIGN (t) = 1; - /* We have not yet computed the alias set for this declaration. */ - DECL_POINTER_ALIAS_SET (t) = -1; } DECL_SOURCE_LOCATION (t) = input_location; DECL_UID (t) = next_decl_uid++; + if (TREE_CODE (t) == LABEL_DECL) + LABEL_DECL_UID (t) = -1; break; @@ -748,11 +743,6 @@ copy_node_stat (tree node MEM_STAT_DECL) SET_DECL_INIT_PRIORITY (t, DECL_INIT_PRIORITY (node)); DECL_HAS_INIT_PRIORITY_P (t) = 1; } - if (TREE_CODE (node) == VAR_DECL && DECL_BASED_ON_RESTRICT_P (node)) - { - SET_DECL_RESTRICT_BASE (t, DECL_GET_RESTRICT_BASE (node)); - DECL_BASED_ON_RESTRICT_P (t) = 1; - } } else if (TREE_CODE_CLASS (code) == tcc_type) { @@ -4523,36 +4513,6 @@ decl_fini_priority_insert (tree decl, priority_type priority) h->fini = priority; } -/* Look up a restrict qualified base decl for FROM. */ - -tree -decl_restrict_base_lookup (tree from) -{ - struct tree_map *h; - struct tree_map in; - - in.base.from = from; - h = (struct tree_map *) htab_find_with_hash (restrict_base_for_decl, &in, - htab_hash_pointer (from)); - return h ? h->to : NULL_TREE; -} - -/* Record the restrict qualified base TO for FROM. */ - -void -decl_restrict_base_insert (tree from, tree to) -{ - struct tree_map *h; - void **loc; - - h = GGC_NEW (struct tree_map); - h->hash = htab_hash_pointer (from); - h->base.from = from; - h->to = to; - loc = htab_find_slot_with_hash (restrict_base_for_decl, h, h->hash, INSERT); - *(struct tree_map **) loc = h; -} - /* Print out the statistics for the DECL_DEBUG_EXPR hash table. */ static void @@ -4575,20 +4535,6 @@ print_value_expr_statistics (void) htab_collisions (value_expr_for_decl)); } -/* Print out statistics for the RESTRICT_BASE_FOR_DECL hash table, but - don't print anything if the table is empty. */ - -static void -print_restrict_base_statistics (void) -{ - if (htab_elements (restrict_base_for_decl) != 0) - fprintf (stderr, - "RESTRICT_BASE hash: size %ld, %ld elements, %f collisions\n", - (long) htab_size (restrict_base_for_decl), - (long) htab_elements (restrict_base_for_decl), - htab_collisions (restrict_base_for_decl)); -} - /* Lookup a debug expression for FROM, and return it if we find one. */ tree @@ -7100,7 +7046,6 @@ dump_tree_statistics (void) print_type_hash_statistics (); print_debug_expr_statistics (); print_value_expr_statistics (); - print_restrict_base_statistics (); lang_hooks.print_statistics (); } -- cgit v1.2.1 From e0ca1cb51d9b2ab809ab53276a9922bc90b892b1 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Mon, 29 Jun 2009 18:02:41 +0000 Subject: * tree.c (process_call_operands): Propagate TREE_READONLY from the operands. (PROCESS_ARG): Do not clear TREE_READONLY if CONSTANT_CLASS_P. (build3_stat): Propagate TREE_READONLY for COND_EXPR. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149060 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 58 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 32 insertions(+), 26 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index a42f3695275..c4ed82bc878 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2479,28 +2479,28 @@ static void process_call_operands (tree t) { bool side_effects = TREE_SIDE_EFFECTS (t); - int i; + bool read_only = false; + int i = call_expr_flags (t); + + /* Calls have side-effects, except those to const or pure functions. */ + if ((i & ECF_LOOPING_CONST_OR_PURE) || !(i & (ECF_CONST | ECF_PURE))) + side_effects = true; + /* Propagate TREE_READONLY of arguments for const functions. */ + if (i & ECF_CONST) + read_only = true; - if (!side_effects) + if (!side_effects || read_only) for (i = 1; i < TREE_OPERAND_LENGTH (t); i++) { tree op = TREE_OPERAND (t, i); if (op && TREE_SIDE_EFFECTS (op)) - { - side_effects = true; - break; - } + side_effects = true; + if (op && !TREE_READONLY (op) && !CONSTANT_CLASS_P (op)) + read_only = false; } - if (!side_effects) - { - /* Calls have side-effects, except those to const or pure functions. */ - i = call_expr_flags (t); - if ((i & ECF_LOOPING_CONST_OR_PURE) || !(i & (ECF_CONST | ECF_PURE))) - side_effects = true; - } - TREE_SIDE_EFFECTS (t) = side_effects; + TREE_READONLY (t) = read_only; } /* Return 1 if EXP contains a PLACEHOLDER_EXPR; i.e., if it represents a size @@ -3346,18 +3346,19 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL) return t; } -#define PROCESS_ARG(N) \ - do { \ - TREE_OPERAND (t, N) = arg##N; \ - if (arg##N &&!TYPE_P (arg##N)) \ - { \ - if (TREE_SIDE_EFFECTS (arg##N)) \ - side_effects = 1; \ - if (!TREE_READONLY (arg##N)) \ - read_only = 0; \ - if (!TREE_CONSTANT (arg##N)) \ - constant = 0; \ - } \ +#define PROCESS_ARG(N) \ + do { \ + TREE_OPERAND (t, N) = arg##N; \ + if (arg##N &&!TYPE_P (arg##N)) \ + { \ + if (TREE_SIDE_EFFECTS (arg##N)) \ + side_effects = 1; \ + if (!TREE_READONLY (arg##N) \ + && !CONSTANT_CLASS_P (arg##N)) \ + read_only = 0; \ + if (!TREE_CONSTANT (arg##N)) \ + constant = 0; \ + } \ } while (0) tree @@ -3424,6 +3425,8 @@ build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1, t = make_node_stat (code PASS_MEM_STAT); TREE_TYPE (t) = tt; + read_only = 1; + /* 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. */ @@ -3439,6 +3442,9 @@ build3_stat (enum tree_code code, tree tt, tree arg0, tree arg1, PROCESS_ARG(1); PROCESS_ARG(2); + if (code == COND_EXPR) + TREE_READONLY (t) = read_only; + TREE_SIDE_EFFECTS (t) = side_effects; TREE_THIS_VOLATILE (t) = (TREE_CODE_CLASS (code) == tcc_reference -- cgit v1.2.1 From 4189e6771feda58eeb5859eb78adaeb1ce9729e1 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Tue, 30 Jun 2009 17:26:32 +0000 Subject: * cgraphunit.c (cgraph_finalize_compilation_unit): Call finalize_size_functions before further processing. * stor-layout.c: Include cgraph.h, tree-inline.h and tree-dump.h. (variable_size): Call self_referential_size on size expressions that contain a PLACEHOLDER_EXPR. (size_functions): New static variable. (copy_self_referential_tree_r): New static function. (self_referential_size): Likewise. (finalize_size_functions): New global function. * tree.c: Include tree-inline.h. (push_without_duplicates): New static function. (find_placeholder_in_expr): New global function. (substitute_in_expr) : Return the replacement object on equality. : Likewise. : If the replacement object is a constant, try to inline the call in the expression. * tree.h (finalize_size_functions): Declare. (find_placeholder_in_expr): Likewise. (FIND_PLACEHOLDER_IN_EXPR): New macro. (substitute_placeholder_in_expr): Update comment. * tree-inline.c (remap_decl): Do not unshare trees if do_not_unshare is true. (copy_tree_body_r): Likewise. (copy_tree_body): New static function. (maybe_inline_call_in_expr): New global function. * tree-inline.h (struct copy_body_data): Add do_not_unshare field. (maybe_inline_call_in_expr): Declare. * Makefile.in (tree.o): Depend on TREE_INLINE_H. (stor-layout.o): Depend on CGRAPH_H, TREE_INLINE_H, TREE_DUMP_H and GIMPLE_H. ada/ * gcc-interface/decl.c: Include tree-inline.h. (annotate_value) : Try to inline the call in the expression. * gcc-interface/utils.c (max_size) : Likewise. * gcc-interface/utils2.c: Include tree-inline. (known_alignment) : Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149112 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 118 insertions(+), 5 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index c4ed82bc878..ad81827052a 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -45,6 +45,7 @@ along with GCC; see the file COPYING3. If not see #include "output.h" #include "target.h" #include "langhooks.h" +#include "tree-inline.h" #include "tree-iterator.h" #include "basic-block.h" #include "tree-flow.h" @@ -2678,11 +2679,102 @@ type_contains_placeholder_p (tree type) return result; } +/* Push tree EXP onto vector QUEUE if it is not already present. */ + +static void +push_without_duplicates (tree exp, VEC (tree, heap) **queue) +{ + unsigned int i; + tree iter; + + for (i = 0; VEC_iterate (tree, *queue, i, iter); i++) + if (simple_cst_equal (iter, exp) == 1) + break; + + if (!iter) + VEC_safe_push (tree, heap, *queue, exp); +} + +/* Given a tree EXP, find all occurences 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. */ + +void +find_placeholder_in_expr (tree exp, VEC (tree, heap) **refs) +{ + enum tree_code code = TREE_CODE (exp); + tree inner; + int i; + + /* We handle TREE_LIST and COMPONENT_REF separately. */ + if (code == TREE_LIST) + { + FIND_PLACEHOLDER_IN_EXPR (TREE_CHAIN (exp), refs); + FIND_PLACEHOLDER_IN_EXPR (TREE_VALUE (exp), refs); + } + else if (code == COMPONENT_REF) + { + for (inner = TREE_OPERAND (exp, 0); + REFERENCE_CLASS_P (inner); + inner = TREE_OPERAND (inner, 0)) + ; + + if (TREE_CODE (inner) == PLACEHOLDER_EXPR) + push_without_duplicates (exp, refs); + else + FIND_PLACEHOLDER_IN_EXPR (TREE_OPERAND (exp, 0), refs); + } + else + switch (TREE_CODE_CLASS (code)) + { + case tcc_constant: + break; + + case tcc_declaration: + /* Variables allocated to static storage can stay. */ + if (!TREE_STATIC (exp)) + push_without_duplicates (exp, refs); + break; + + case tcc_expression: + /* This is the pattern built in ada/make_aligning_type. */ + if (code == ADDR_EXPR + && TREE_CODE (TREE_OPERAND (exp, 0)) == PLACEHOLDER_EXPR) + { + push_without_duplicates (exp, refs); + break; + } + + /* Fall through... */ + + case tcc_exceptional: + case tcc_unary: + case tcc_binary: + case tcc_comparison: + case tcc_reference: + for (i = 0; i < TREE_CODE_LENGTH (code); i++) + FIND_PLACEHOLDER_IN_EXPR (TREE_OPERAND (exp, i), refs); + break; + + case tcc_vl_exp: + for (i = 1; i < TREE_OPERAND_LENGTH (exp); i++) + FIND_PLACEHOLDER_IN_EXPR (TREE_OPERAND (exp, i), refs); + break; + + default: + gcc_unreachable (); + } +} + /* 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. Note that we assume here that EXP - contains only arithmetic expressions or a CALL_EXPR with a - PLACEHOLDER_EXPR occurring only in its arglist. */ + 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. */ tree substitute_in_expr (tree exp, tree f, tree r) @@ -2733,14 +2825,24 @@ substitute_in_expr (tree exp, tree f, tree r) switch (TREE_CODE_CLASS (code)) { case tcc_constant: - case tcc_declaration: return exp; + case tcc_declaration: + if (exp == f) + return r; + else + return exp; + + case tcc_expression: + if (exp == f) + return r; + + /* Fall through... */ + case tcc_exceptional: case tcc_unary: case tcc_binary: case tcc_comparison: - case tcc_expression: case tcc_reference: switch (TREE_CODE_LENGTH (code)) { @@ -2803,6 +2905,17 @@ substitute_in_expr (tree exp, tree f, tree r) new_tree = NULL_TREE; + /* 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. */ + if (CONSTANT_CLASS_P (r) && code == CALL_EXPR) + { + tree t = maybe_inline_call_in_expr (exp); + if (t) + return SUBSTITUTE_IN_EXPR (t, f, r); + } + for (i = 1; i < TREE_OPERAND_LENGTH (exp); i++) { tree op = TREE_OPERAND (exp, i); -- cgit v1.2.1 From 8dfbefd865bd7aed76b7d1f885e3b8d590e62c5a Mon Sep 17 00:00:00 2001 From: dnovillo Date: Mon, 6 Jul 2009 17:06:26 +0000 Subject: * tree.c: Include debug.h. (initialize_tree_contains_struct): New. (init_ttree): Call it. (tree_node_structure_for_code): Factor out of ... (tree_node_structure): ... here. * treestruct.def (TS_PHI_NODE): Remove. (TS_GIMPLE_STATEMENT): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149290 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 378 ++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 261 insertions(+), 117 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index ad81827052a..2718667665b 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -254,7 +254,263 @@ const char * const omp_clause_code_name[] = "collapse", "untied" }; - + + +/* Return the tree node structure used by tree code CODE. */ + +static inline enum tree_node_structure_enum +tree_node_structure_for_code (enum tree_code code) +{ + switch (TREE_CODE_CLASS (code)) + { + case tcc_declaration: + { + switch (code) + { + case FIELD_DECL: + return TS_FIELD_DECL; + case PARM_DECL: + return TS_PARM_DECL; + case VAR_DECL: + return TS_VAR_DECL; + case LABEL_DECL: + return TS_LABEL_DECL; + case RESULT_DECL: + return TS_RESULT_DECL; + case CONST_DECL: + return TS_CONST_DECL; + case TYPE_DECL: + return TS_TYPE_DECL; + case FUNCTION_DECL: + return TS_FUNCTION_DECL; + default: + return TS_DECL_NON_COMMON; + } + } + case tcc_type: + return TS_TYPE; + case tcc_reference: + case tcc_comparison: + case tcc_unary: + case tcc_binary: + case tcc_expression: + case tcc_statement: + case tcc_vl_exp: + return TS_EXP; + default: /* tcc_constant and tcc_exceptional */ + break; + } + switch (code) + { + /* tcc_constant cases. */ + case INTEGER_CST: return TS_INT_CST; + case REAL_CST: return TS_REAL_CST; + case FIXED_CST: return TS_FIXED_CST; + case COMPLEX_CST: return TS_COMPLEX; + case VECTOR_CST: return TS_VECTOR; + case STRING_CST: return TS_STRING; + /* tcc_exceptional cases. */ + case ERROR_MARK: return TS_COMMON; + case IDENTIFIER_NODE: return TS_IDENTIFIER; + case TREE_LIST: return TS_LIST; + case TREE_VEC: return TS_VEC; + case SSA_NAME: return TS_SSA_NAME; + case PLACEHOLDER_EXPR: return TS_COMMON; + case STATEMENT_LIST: return TS_STATEMENT_LIST; + case BLOCK: return TS_BLOCK; + case CONSTRUCTOR: return TS_CONSTRUCTOR; + case TREE_BINFO: return TS_BINFO; + case OMP_CLAUSE: return TS_OMP_CLAUSE; + case OPTIMIZATION_NODE: return TS_OPTIMIZATION; + case TARGET_OPTION_NODE: return TS_TARGET_OPTION; + + default: + gcc_unreachable (); + } +} + + +/* Initialize tree_contains_struct to describe the hierarchy of tree + nodes. */ + +static void +initialize_tree_contains_struct (void) +{ + unsigned i; + +#define MARK_TS_BASE(C) \ + do { \ + tree_contains_struct[C][TS_BASE] = 1; \ + } while (0) + +#define MARK_TS_COMMON(C) \ + do { \ + MARK_TS_BASE (C); \ + tree_contains_struct[C][TS_COMMON] = 1; \ + } while (0) + +#define MARK_TS_DECL_MINIMAL(C) \ + do { \ + MARK_TS_COMMON (C); \ + tree_contains_struct[C][TS_DECL_MINIMAL] = 1; \ + } while (0) + +#define MARK_TS_DECL_COMMON(C) \ + do { \ + MARK_TS_DECL_MINIMAL (C); \ + tree_contains_struct[C][TS_DECL_COMMON] = 1; \ + } while (0) + +#define MARK_TS_DECL_WRTL(C) \ + do { \ + MARK_TS_DECL_COMMON (C); \ + tree_contains_struct[C][TS_DECL_WRTL] = 1; \ + } while (0) + +#define MARK_TS_DECL_WITH_VIS(C) \ + do { \ + MARK_TS_DECL_WRTL (C); \ + tree_contains_struct[C][TS_DECL_WITH_VIS] = 1; \ + } while (0) + +#define MARK_TS_DECL_NON_COMMON(C) \ + do { \ + MARK_TS_DECL_WITH_VIS (C); \ + tree_contains_struct[C][TS_DECL_NON_COMMON] = 1; \ + } while (0) + + for (i = ERROR_MARK; i < LAST_AND_UNUSED_TREE_CODE; i++) + { + enum tree_code code; + enum tree_node_structure_enum ts_code; + + code = (enum tree_code) i; + ts_code = tree_node_structure_for_code (code); + + /* Mark the TS structure itself. */ + tree_contains_struct[code][ts_code] = 1; + + /* Mark all the structures that TS is derived from. */ + switch (ts_code) + { + case TS_COMMON: + MARK_TS_BASE (code); + break; + + case TS_INT_CST: + case TS_REAL_CST: + case TS_FIXED_CST: + case TS_VECTOR: + case TS_STRING: + case TS_COMPLEX: + case TS_IDENTIFIER: + case TS_DECL_MINIMAL: + case TS_TYPE: + case TS_LIST: + case TS_VEC: + case TS_EXP: + case TS_SSA_NAME: + case TS_BLOCK: + case TS_BINFO: + case TS_STATEMENT_LIST: + case TS_CONSTRUCTOR: + case TS_OMP_CLAUSE: + case TS_OPTIMIZATION: + case TS_TARGET_OPTION: + MARK_TS_COMMON (code); + break; + + case TS_DECL_COMMON: + MARK_TS_DECL_MINIMAL (code); + break; + + case TS_DECL_WRTL: + MARK_TS_DECL_COMMON (code); + break; + + case TS_DECL_NON_COMMON: + MARK_TS_DECL_WITH_VIS (code); + break; + + case TS_DECL_WITH_VIS: + case TS_PARM_DECL: + case TS_LABEL_DECL: + case TS_RESULT_DECL: + case TS_CONST_DECL: + MARK_TS_DECL_WRTL (code); + break; + + case TS_FIELD_DECL: + MARK_TS_DECL_COMMON (code); + break; + + case TS_VAR_DECL: + MARK_TS_DECL_WITH_VIS (code); + break; + + case TS_TYPE_DECL: + case TS_FUNCTION_DECL: + MARK_TS_DECL_NON_COMMON (code); + break; + + default: + gcc_unreachable (); + } + } + + /* Basic consistency checks for attributes used in fold. */ + gcc_assert (tree_contains_struct[FUNCTION_DECL][TS_DECL_NON_COMMON]); + gcc_assert (tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_NON_COMMON]); + gcc_assert (tree_contains_struct[TYPE_DECL][TS_DECL_NON_COMMON]); + gcc_assert (tree_contains_struct[CONST_DECL][TS_DECL_COMMON]); + gcc_assert (tree_contains_struct[VAR_DECL][TS_DECL_COMMON]); + gcc_assert (tree_contains_struct[PARM_DECL][TS_DECL_COMMON]); + gcc_assert (tree_contains_struct[RESULT_DECL][TS_DECL_COMMON]); + gcc_assert (tree_contains_struct[FUNCTION_DECL][TS_DECL_COMMON]); + gcc_assert (tree_contains_struct[TYPE_DECL][TS_DECL_COMMON]); + gcc_assert (tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_COMMON]); + gcc_assert (tree_contains_struct[LABEL_DECL][TS_DECL_COMMON]); + gcc_assert (tree_contains_struct[FIELD_DECL][TS_DECL_COMMON]); + gcc_assert (tree_contains_struct[CONST_DECL][TS_DECL_WRTL]); + gcc_assert (tree_contains_struct[VAR_DECL][TS_DECL_WRTL]); + gcc_assert (tree_contains_struct[PARM_DECL][TS_DECL_WRTL]); + gcc_assert (tree_contains_struct[RESULT_DECL][TS_DECL_WRTL]); + gcc_assert (tree_contains_struct[FUNCTION_DECL][TS_DECL_WRTL]); + gcc_assert (tree_contains_struct[LABEL_DECL][TS_DECL_WRTL]); + gcc_assert (tree_contains_struct[CONST_DECL][TS_DECL_MINIMAL]); + gcc_assert (tree_contains_struct[VAR_DECL][TS_DECL_MINIMAL]); + gcc_assert (tree_contains_struct[PARM_DECL][TS_DECL_MINIMAL]); + gcc_assert (tree_contains_struct[RESULT_DECL][TS_DECL_MINIMAL]); + gcc_assert (tree_contains_struct[FUNCTION_DECL][TS_DECL_MINIMAL]); + gcc_assert (tree_contains_struct[TYPE_DECL][TS_DECL_MINIMAL]); + gcc_assert (tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_MINIMAL]); + gcc_assert (tree_contains_struct[LABEL_DECL][TS_DECL_MINIMAL]); + gcc_assert (tree_contains_struct[FIELD_DECL][TS_DECL_MINIMAL]); + gcc_assert (tree_contains_struct[VAR_DECL][TS_DECL_WITH_VIS]); + gcc_assert (tree_contains_struct[FUNCTION_DECL][TS_DECL_WITH_VIS]); + gcc_assert (tree_contains_struct[TYPE_DECL][TS_DECL_WITH_VIS]); + gcc_assert (tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_WITH_VIS]); + gcc_assert (tree_contains_struct[VAR_DECL][TS_VAR_DECL]); + gcc_assert (tree_contains_struct[FIELD_DECL][TS_FIELD_DECL]); + gcc_assert (tree_contains_struct[PARM_DECL][TS_PARM_DECL]); + gcc_assert (tree_contains_struct[LABEL_DECL][TS_LABEL_DECL]); + gcc_assert (tree_contains_struct[RESULT_DECL][TS_RESULT_DECL]); + gcc_assert (tree_contains_struct[CONST_DECL][TS_CONST_DECL]); + gcc_assert (tree_contains_struct[TYPE_DECL][TS_TYPE_DECL]); + gcc_assert (tree_contains_struct[FUNCTION_DECL][TS_FUNCTION_DECL]); + gcc_assert (tree_contains_struct[IMPORTED_DECL][TS_DECL_MINIMAL]); + gcc_assert (tree_contains_struct[IMPORTED_DECL][TS_DECL_COMMON]); + +#undef MARK_TS_BASE +#undef MARK_TS_COMMON +#undef MARK_TS_DECL_MINIMAL +#undef MARK_TS_DECL_COMMON +#undef MARK_TS_DECL_WRTL +#undef MARK_TS_DECL_WITH_VIS +#undef MARK_TS_DECL_NON_COMMON +} + + /* Init tree.c. */ void @@ -283,55 +539,8 @@ init_ttree (void) cl_optimization_node = make_node (OPTIMIZATION_NODE); cl_target_option_node = make_node (TARGET_OPTION_NODE); - tree_contains_struct[FUNCTION_DECL][TS_DECL_NON_COMMON] = 1; - tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_NON_COMMON] = 1; - tree_contains_struct[TYPE_DECL][TS_DECL_NON_COMMON] = 1; - - - tree_contains_struct[CONST_DECL][TS_DECL_COMMON] = 1; - tree_contains_struct[VAR_DECL][TS_DECL_COMMON] = 1; - tree_contains_struct[PARM_DECL][TS_DECL_COMMON] = 1; - tree_contains_struct[RESULT_DECL][TS_DECL_COMMON] = 1; - tree_contains_struct[FUNCTION_DECL][TS_DECL_COMMON] = 1; - tree_contains_struct[TYPE_DECL][TS_DECL_COMMON] = 1; - tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_COMMON] = 1; - tree_contains_struct[LABEL_DECL][TS_DECL_COMMON] = 1; - tree_contains_struct[FIELD_DECL][TS_DECL_COMMON] = 1; - - - tree_contains_struct[CONST_DECL][TS_DECL_WRTL] = 1; - tree_contains_struct[VAR_DECL][TS_DECL_WRTL] = 1; - tree_contains_struct[PARM_DECL][TS_DECL_WRTL] = 1; - tree_contains_struct[RESULT_DECL][TS_DECL_WRTL] = 1; - tree_contains_struct[FUNCTION_DECL][TS_DECL_WRTL] = 1; - tree_contains_struct[LABEL_DECL][TS_DECL_WRTL] = 1; - - tree_contains_struct[CONST_DECL][TS_DECL_MINIMAL] = 1; - tree_contains_struct[VAR_DECL][TS_DECL_MINIMAL] = 1; - tree_contains_struct[PARM_DECL][TS_DECL_MINIMAL] = 1; - tree_contains_struct[RESULT_DECL][TS_DECL_MINIMAL] = 1; - tree_contains_struct[FUNCTION_DECL][TS_DECL_MINIMAL] = 1; - tree_contains_struct[TYPE_DECL][TS_DECL_MINIMAL] = 1; - tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_MINIMAL] = 1; - tree_contains_struct[LABEL_DECL][TS_DECL_MINIMAL] = 1; - tree_contains_struct[FIELD_DECL][TS_DECL_MINIMAL] = 1; - - tree_contains_struct[VAR_DECL][TS_DECL_WITH_VIS] = 1; - tree_contains_struct[FUNCTION_DECL][TS_DECL_WITH_VIS] = 1; - tree_contains_struct[TYPE_DECL][TS_DECL_WITH_VIS] = 1; - tree_contains_struct[TRANSLATION_UNIT_DECL][TS_DECL_WITH_VIS] = 1; - - tree_contains_struct[VAR_DECL][TS_VAR_DECL] = 1; - tree_contains_struct[FIELD_DECL][TS_FIELD_DECL] = 1; - tree_contains_struct[PARM_DECL][TS_PARM_DECL] = 1; - tree_contains_struct[LABEL_DECL][TS_LABEL_DECL] = 1; - tree_contains_struct[RESULT_DECL][TS_RESULT_DECL] = 1; - tree_contains_struct[CONST_DECL][TS_CONST_DECL] = 1; - tree_contains_struct[TYPE_DECL][TS_TYPE_DECL] = 1; - tree_contains_struct[FUNCTION_DECL][TS_FUNCTION_DECL] = 1; - tree_contains_struct[IMPORTED_DECL][TS_DECL_MINIMAL] = 1; - tree_contains_struct[IMPORTED_DECL][TS_DECL_COMMON] = 1; - + /* Initialize the tree_contains_struct array. */ + initialize_tree_contains_struct (); lang_hooks.init_ts (); } @@ -2399,79 +2608,14 @@ skip_simple_arithmetic (tree expr) return inner; } + /* Return which tree structure is used by T. */ enum tree_node_structure_enum tree_node_structure (const_tree t) { const enum tree_code code = TREE_CODE (t); - - switch (TREE_CODE_CLASS (code)) - { - case tcc_declaration: - { - switch (code) - { - case FIELD_DECL: - return TS_FIELD_DECL; - case PARM_DECL: - return TS_PARM_DECL; - case VAR_DECL: - return TS_VAR_DECL; - case LABEL_DECL: - return TS_LABEL_DECL; - case RESULT_DECL: - return TS_RESULT_DECL; - case CONST_DECL: - return TS_CONST_DECL; - case TYPE_DECL: - return TS_TYPE_DECL; - case FUNCTION_DECL: - return TS_FUNCTION_DECL; - default: - return TS_DECL_NON_COMMON; - } - } - case tcc_type: - return TS_TYPE; - case tcc_reference: - case tcc_comparison: - case tcc_unary: - case tcc_binary: - case tcc_expression: - case tcc_statement: - case tcc_vl_exp: - return TS_EXP; - default: /* tcc_constant and tcc_exceptional */ - break; - } - switch (code) - { - /* tcc_constant cases. */ - case INTEGER_CST: return TS_INT_CST; - case REAL_CST: return TS_REAL_CST; - case FIXED_CST: return TS_FIXED_CST; - case COMPLEX_CST: return TS_COMPLEX; - case VECTOR_CST: return TS_VECTOR; - case STRING_CST: return TS_STRING; - /* tcc_exceptional cases. */ - case ERROR_MARK: return TS_COMMON; - case IDENTIFIER_NODE: return TS_IDENTIFIER; - case TREE_LIST: return TS_LIST; - case TREE_VEC: return TS_VEC; - case SSA_NAME: return TS_SSA_NAME; - case PLACEHOLDER_EXPR: return TS_COMMON; - case STATEMENT_LIST: return TS_STATEMENT_LIST; - case BLOCK: return TS_BLOCK; - case CONSTRUCTOR: return TS_CONSTRUCTOR; - case TREE_BINFO: return TS_BINFO; - case OMP_CLAUSE: return TS_OMP_CLAUSE; - case OPTIMIZATION_NODE: return TS_OPTIMIZATION; - case TARGET_OPTION_NODE: return TS_TARGET_OPTION; - - default: - gcc_unreachable (); - } + return tree_node_structure_for_code (code); } /* Set various status flags when building a CALL_EXPR object T. */ -- cgit v1.2.1 From 1cf1742e4834f67465fd29068ec87ac427940a6c Mon Sep 17 00:00:00 2001 From: manu Date: Tue, 7 Jul 2009 21:52:01 +0000 Subject: =?UTF-8?q?2009-07-07=20=20Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez=20?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * tree.c (set_expr_locus): Remove. * tree.h (EXPR_LOCUS,SET_EXPR_LOCUS,set_expr_locus): Remove. * c-typeck.c (c_finish_stmt_expr): Replace EXPR_LOCUS by EXPR_LOCATION. * gimplify.c (internal_get_tmp_var): Likewise. (gimplify_call_expr): Likewise. (gimplify_one_sizepos): Likewise. objc/ * objc-act.c (next_sjlj_build_catch_list): Replace EXPR_LOCUS by EXPR_LOCATION. cp/ * semantics.c (finalize_nrv_r): Replace EXPR_LOCUS by EXPR_LOCATION. ada/ * gcc-interface/trans.c (gnat_gimplify_expr): Replace EXPR_LOCUS by EXPR_LOCATION. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149350 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 2718667665b..7c5f154ad38 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3940,18 +3940,6 @@ expand_location (source_location loc) } -/* Source location accessor functions. */ - - -void -set_expr_locus (tree node, source_location *loc) -{ - if (loc == NULL) - EXPR_CHECK (node)->exp.locus = UNKNOWN_LOCATION; - else - EXPR_CHECK (node)->exp.locus = *loc; -} - /* Like SET_EXPR_LOCATION, but make sure the tree can have a location. LOC is the location to use in tree T. */ -- cgit v1.2.1 From 389dd41bd043170e7dc7660304f14a5f16af3562 Mon Sep 17 00:00:00 2001 From: manu Date: Thu, 16 Jul 2009 22:29:52 +0000 Subject: =?UTF-8?q?2009-07-17=20=20Aldy=20Hernandez=20=20=20=09=20=20=20=20Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez=20=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR 40435 * tree-complex.c, tree-loop-distribution.c, tree.c, tree.h, builtins.c, fold-const.c, omp-low.c, cgraphunit.c, tree-ssa-ccp.c, tree-ssa-dom.c, gimple-low.c, expr.c, tree-ssa-ifcombine.c, c-decl.c, stor-layout.c, tree-if-conv.c, c-typeck.c, gimplify.c, calls.c, tree-sra.c, tree-mudflap.c, tree-ssa-copy.c, tree-ssa-forwprop.c, c-convert.c, c-omp.c, varasm.c, tree-inline.c, c-common.c, c-common.h, gimple.c, tree-switch-conversion.c, gimple.h, tree-cfg.c, c-parser.c, convert.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. objc/ * objc-act.c: Add location argument to all calls to build_fold_addr_expr. testsuite/ * gcc.dg/pr36902.c: Add column info. * g++.dg/gcov/gcov-2.C: Change count for definition. cp/ * typeck.c, init.c, class.c, method.c, rtti.c, except.c, error.c, tree.c, cp-gimplify.c, cxx-pretty-print.c, pt.c, semantics.c, call.c, cvt.c, mangle.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. fortran/ * trans-expr.c, trans-array.c, trans-openmp.c, trans-stmt.c, trans.c, trans-io.c, trans-decl.c, trans-intrinsic.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149722 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 7c5f154ad38..b32e209e83e 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -8537,7 +8537,8 @@ build_call_valist (tree return_type, tree fn, int nargs, va_list args) which are specified as a tree array ARGS. */ tree -build_call_array (tree return_type, tree fn, int nargs, const tree *args) +build_call_array_loc (location_t loc, tree return_type, tree fn, + int nargs, const tree *args) { tree t; int i; @@ -8549,6 +8550,7 @@ build_call_array (tree return_type, tree fn, int nargs, const tree *args) for (i = 0; i < nargs; i++) CALL_EXPR_ARG (t, i) = args[i]; process_call_operands (t); + SET_EXPR_LOCATION (t, loc); return t; } -- cgit v1.2.1 From f6d257e759ae8bd931f07a25a7eda15b25b84c77 Mon Sep 17 00:00:00 2001 From: jakub Date: Mon, 20 Jul 2009 14:38:46 +0000 Subject: PR tree-optimization/40792 * tree.c (build_function_type_skip_args): Remove bogus assert. * gcc.dg/pr40792.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149822 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 1 - 1 file changed, 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index b32e209e83e..44178aff65c 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -6299,7 +6299,6 @@ build_function_type_skip_args (tree orig_type, bitmap args_to_skip) else new_reversed = void_list_node; } - gcc_assert (new_reversed); /* Use copy_node to preserve as much as possible from original type (debug info, attribute lists etc.) -- cgit v1.2.1 From 2ed8de558d0b7fbcde24bc8c188395c56138aca3 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 3 Aug 2009 10:30:46 +0000 Subject: 2009-08-03 Richard Guenther * tree.c (make_vector_type): Build a main variant first, get the canonical one and then build the variant. * tree-ssa.c (useless_type_conversion_p_1): Handle fixed-point types. (useless_type_conversion_p): Conversions to pointers to incomplete record types are useless. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150370 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 44178aff65c..58994b12898 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -7686,21 +7686,10 @@ make_vector_type (tree innertype, int nunits, enum machine_mode mode) tree t; hashval_t hashcode = 0; - /* Build a main variant, based on the main variant of the inner type, then - use it to build the variant we return. */ - if ((TYPE_ATTRIBUTES (innertype) || TYPE_QUALS (innertype)) - && TYPE_MAIN_VARIANT (innertype) != innertype) - return build_type_attribute_qual_variant ( - make_vector_type (TYPE_MAIN_VARIANT (innertype), nunits, mode), - TYPE_ATTRIBUTES (innertype), - TYPE_QUALS (innertype)); - t = make_node (VECTOR_TYPE); TREE_TYPE (t) = TYPE_MAIN_VARIANT (innertype); SET_TYPE_VECTOR_SUBPARTS (t, nunits); SET_TYPE_MODE (t, mode); - TYPE_READONLY (t) = TYPE_READONLY (innertype); - TYPE_VOLATILE (t) = TYPE_VOLATILE (innertype); if (TYPE_STRUCTURAL_EQUALITY_P (innertype)) SET_TYPE_STRUCTURAL_EQUALITY (t); @@ -7730,9 +7719,20 @@ make_vector_type (tree innertype, int nunits, enum machine_mode mode) } hashcode = iterative_hash_host_wide_int (VECTOR_TYPE, hashcode); + hashcode = iterative_hash_host_wide_int (nunits, hashcode); hashcode = iterative_hash_host_wide_int (mode, hashcode); - hashcode = iterative_hash_object (TYPE_HASH (innertype), hashcode); - return type_hash_canon (hashcode, t); + hashcode = iterative_hash_object (TYPE_HASH (TREE_TYPE (t)), hashcode); + t = type_hash_canon (hashcode, t); + + /* We have built a main variant, based on the main variant of the + inner type. Use it to build the variant we return. */ + if ((TYPE_ATTRIBUTES (innertype) || TYPE_QUALS (innertype)) + && TREE_TYPE (t) != innertype) + return build_type_attribute_qual_variant (t, + TYPE_ATTRIBUTES (innertype), + TYPE_QUALS (innertype)); + + return t; } static tree -- cgit v1.2.1 From 591f01a88746408467315ee4cc759664f729820e Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 6 Aug 2009 11:29:13 +0000 Subject: 2009-08-06 Richard Guenther PR tree-optimization/40964 * tree.c (iterative_hash_host_wide_int): Export. * tree.h (iterative_hash_host_wide_int): Declare. * tree-ssa-structalias.c (heapvar_map): New struct. (heapvar_map_eq): New function. (heapvar_map_hash): Likewise. (heapvar_lookup): Adjust. (heapvar_insert): Likewise. (make_constraint_from_heapvar): Allow multiple heap variables per decl at different offsets. (init_alias_heapvars): Adjust. * gcc.c-torture/compile/pr40964.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150517 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 58994b12898..60416d342c7 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3988,7 +3988,7 @@ iterative_hash_hashval_t (hashval_t val, hashval_t val2) } /* Produce good hash value combining VAL and VAL2. */ -static inline hashval_t +hashval_t iterative_hash_host_wide_int (HOST_WIDE_INT val, hashval_t val2) { if (sizeof (HOST_WIDE_INT) == sizeof (hashval_t)) -- cgit v1.2.1 From 92ddcd9701b4dd0fde3d3c640cdb6a1f49c0f7a2 Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 1 Sep 2009 08:41:53 +0000 Subject: 2009-09-01 Richard Guenther * tree.c (tree_expr_size): New function. * tree.h (tree_expr_size): Declare. * rtlanal.c (rtx_addr_can_trap_p_1): Adjust comment. * builtins.c (fold_builtin_memory_op): Use tree_expr_size. * langhooks.c (lhd_expr_size): Remove. * langhooks.h (struct lang_hooks): Remove expr_size. * explow.c (expr_size): Use tree_expr_size. (int_expr_size): Likewise. * langhooks-def.h (lhd_expr_size): Remove. (LANG_HOOKS_EXPR_SIZE): Likewise. (LANG_HOOKS_INITIALIZER): Adjust. cp/ * cp-objcp-common.c (cp_expr_size): Use tree_expr_size. * cp-objcp-common.h (LANG_HOOKS_EXPR_SIZE): Do not define. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151261 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 60416d342c7..66ac70288b3 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2194,6 +2194,18 @@ 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. */ -- cgit v1.2.1 From 34e5cced0545b23499caed535a6566a4026b9558 Mon Sep 17 00:00:00 2001 From: dnovillo Date: Thu, 3 Sep 2009 04:07:12 +0000 Subject: 2009-09-01 Diego Novillo * c-lang.c (lang_hooks): Remove const qualifier. java/ChangeLog * lang.c (lang_hooks): Remove const qualifier. objc/ChangeLog * objc-lang.c (lang_hooks): Remove const qualifier. objcp/ChangeLog * objcp-lang.c (lang_hooks): Remove const qualifier. ada/ChangeLog * gcc-interface/misc.c (lang_hooks): Remove const qualifier. fortran/ChangeLog * f95-lang.c (lang_hooks): Remove const qualifier. cp/ChangeLog * cp-lang.c (lang_hooks): Remove const qualifier. 2009-09-01 Diego Novillo * cgraph.c (cgraph_node_for_decl): New. * cgraph.h (cgraph_node_for_decl): Declare. * tree.c (host_integerp): Return 0 if T is NULL. 2009-09-01 Diego Novillo * tree.h (struct alias_pair): Move from varasm.c. (alias_pairs): Likewise. (TYPE_MAXVAL): Define. (TYPE_MINVAL): Define. (iterative_hash_host_wide_int): Declare. (remove_unreachable_alias_pairs): Declare. * tree-pass.h (pass_ipa_free_lang_data): Declare. * diagnostic.c (default_diagnostic_starter): Make extern. (default_diagnostic_finalizer): Make extern. * diagnostic.h (default_diagnostic_starter): Declare. (default_diagnostic_finalizer): Declare. (default_tree_printer): Declare. * toplev.c (default_tree_printer): Make extern. 2009-09-01 Richard Guenther Diego Novillo * cgraph.c (cgraph_add_new_function): Remove gimplification. * cgraphunit.c (cgraph_expand_function): Do not emit associated thunks from here. (cgraph_emit_thunks): New. (cgraph_optimize): Call it. Return if any IPA pass finds an error. * varasm.c (finish_aliases_1): Ignore errorneous aliases used by thunks. 2009-09-01 Simon Baldwin Rafael Espindola Richard Guenther Doug Kwan Diego Novillo * tree.c: Include tree-pass.h, langhooks-def.h, diagnostic.h, cgraph.h, timevar.h, except.h and debug.h. (free_lang_data_in_type): New. (need_assembler_name_p): New. (free_lang_data_in_block): New. (free_lang_data_in_decl): New. (struct free_lang_data_d): New. (add_tree_to_fld_list): New. (find_decls_types_r): New. (get_eh_types_for_runtime): New. (find_decls_types_in_eh_region): New. (find_decls_types_in_node): New. (find_decls_types_in_var): New. (free_lang_data_in_cgraph): New. (free_lang_data): New. (gate_free_lang_data): New. (pass_ipa_free_lang_data): New. 2009-09-01 Diego Novillo * timevar.def (TV_IPA_FREE_LANG_DATA): Define. * langhooks.h (struct lang_hooks): Add field free_lang_data. (lang_hooks): Remove const qualifier. * ipa.c (cgraph_remove_unreachable_nodes): Call remove_unreachable_alias_pairs. * except.c (add_type_for_runtime): Check if TYPE has already been converted. (lookup_type_for_runtime): Likewise. (check_handled): Handle converted types. * varasm.c (remove_unreachable_alias_pairs): New. * gimple.c: Include demangle.h. (gimple_decl_printable_name): New. (gimple_fold_obj_type_ref): New. * gimple.h (gimple_decl_printable_name): Declare. (gimple_fold_obj_type_ref): Declare. * passes.c (init_optimization_passes): Add pass pass_ipa_free_lang_data. * langhooks-def.h (LANG_HOOKS_FREE_LANG_DATA): Define. (LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_FREE_LANG_DATA. testsuite/ChangeLog 2009-09-01 Diego Novillo * gcc.dg/gomp/combined-1.c: Adjust expected pattern. * g++.dg/tree-prof/inline_mismatch_args.C: Likewise. * g++.dg/warn/unit-1.C: Likewise. * g++.dg/ipa/iinline-1.C: Likewise. * g++.dg/template/cond2.C: Adjust expected line location for the error. * g++.dg/template/pr35240.C: Likewise. cp/ChangeLog 2009-09-01 Doug Kwan * tree.c (cp_fix_function_decl_p): New. (cp_free_lang_data): New. 2009-09-01 Diego Novillo * Make-lang.in (decl2.o): Add dependency on $(POINTER_SET_H). * decl2.c: Include pointer-set.h. (collect_candidates_for_java_method_aliases): New. (cp_write_global_declarations): Call it. Add local variable CANDIDATES. If set, call build_java_method_aliases. (build_java_method_aliases): Add argument CANDIDATES. Use it to determine if FNDECL should get a hidden alias. * cp-objcp-common.h (LANG_HOOKS_FREE_LANG_DATA): Define. * cp-tree.h (cp_free_lang_data): Declare. 2009-09-03 Richard Guenther * method.c (use_thunk): Use cgraph_finalize_function to hand off thunks to the cgraph. * semantics.c (emit_associated_thunks): Do not emit thunks for really extern functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151360 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 793 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 793 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 66ac70288b3..1db7d0a86c3 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -52,6 +52,13 @@ along with GCC; see the file COPYING3. If not see #include "params.h" #include "pointer-set.h" #include "fixed-value.h" +#include "tree-pass.h" +#include "langhooks-def.h" +#include "diagnostic.h" +#include "cgraph.h" +#include "timevar.h" +#include "except.h" +#include "debug.h" /* Tree code classes. */ @@ -4124,6 +4131,789 @@ build_type_attribute_variant (tree ttype, tree attribute) TYPE_QUALS (ttype)); } +/* Reset all language specific information still present in TYPE. */ + +static void +free_lang_data_in_type (tree type) +{ + gcc_assert (TYPE_P (type)); + + /* Fill in the alias-set. We need to at least track zeroness here + for correctness. */ + if (lang_hooks.get_alias_set (type) == 0) + TYPE_ALIAS_SET (type) = 0; + + /* Give the FE a chance to remove its own data first. */ + lang_hooks.free_lang_data (type); + + TREE_LANG_FLAG_0 (type) = 0; + TREE_LANG_FLAG_1 (type) = 0; + TREE_LANG_FLAG_2 (type) = 0; + TREE_LANG_FLAG_3 (type) = 0; + TREE_LANG_FLAG_4 (type) = 0; + TREE_LANG_FLAG_5 (type) = 0; + TREE_LANG_FLAG_6 (type) = 0; + + if (TREE_CODE (type) == FUNCTION_TYPE) + { + /* 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. */ + tree p; + + for (p = TYPE_ARG_TYPES (type); p; p = TREE_CHAIN (p)) + { + tree arg_type = TREE_VALUE (p); + + if (TYPE_READONLY (arg_type) || TYPE_VOLATILE (arg_type)) + { + int quals = TYPE_QUALS (arg_type) + & ~TYPE_QUAL_CONST + & ~TYPE_QUAL_VOLATILE; + TREE_VALUE (p) = build_qualified_type (arg_type, quals); + free_lang_data_in_type (TREE_VALUE (p)); + } + } + } + + /* Remove members that are not actually FIELD_DECLs from the field + list of an aggregate. These occur in C++. */ + if (TREE_CODE (type) == RECORD_TYPE + || TREE_CODE (type) == UNION_TYPE + || TREE_CODE (type) == QUAL_UNION_TYPE) + { + tree prev, member; + + /* 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. */ + prev = NULL_TREE; + member = TYPE_FIELDS (type); + while (member) + { + if (TREE_CODE (member) == FIELD_DECL) + { + if (prev) + TREE_CHAIN (prev) = member; + else + TYPE_FIELDS (type) = member; + prev = member; + } + + member = TREE_CHAIN (member); + } + + if (prev) + TREE_CHAIN (prev) = NULL_TREE; + else + TYPE_FIELDS (type) = NULL_TREE; + + TYPE_METHODS (type) = NULL_TREE; + if (TYPE_BINFO (type)) + { + tree binfo = TYPE_BINFO (type); + + if (BINFO_VIRTUALS (binfo)) + { + /* If the virtual function table for BINFO contains + entries, these may be useful for folding OBJ_TYPE_REF + expressions (see gimple_fold_obj_type_ref). In that + case, we only clear the unused fields in the BINFO + structure. */ + BINFO_OFFSET (binfo) = NULL_TREE; + BINFO_VTABLE (binfo) = NULL_TREE; + BINFO_VPTR_FIELD (binfo) = NULL_TREE; + BINFO_BASE_ACCESSES (binfo) = NULL; + BINFO_INHERITANCE_CHAIN (binfo) = NULL_TREE; + BINFO_SUBVTT_INDEX (binfo) = NULL_TREE; + BINFO_VPTR_FIELD (binfo) = NULL_TREE; + } + else + { + /* Otherwise, get rid of the whole binfo data. */ + TYPE_BINFO (type) = NULL_TREE; + } + } + } + else + { + /* For non-aggregate types, clear out the language slot (which + overloads TYPE_BINFO). */ + TYPE_LANG_SLOT_1 (type) = NULL_TREE; + } + + TYPE_CONTEXT (type) = NULL_TREE; + TYPE_STUB_DECL (type) = NULL_TREE; + + /* Remove type variants other than the main variant. This is both + wasteful and it may introduce infinite loops when the types are + read from disk and merged (since the variant will be the same + type as the main variant, traversing type variants will get into + an infinite loop). */ + if (TYPE_MAIN_VARIANT (type)) + TYPE_NEXT_VARIANT (TYPE_MAIN_VARIANT (type)) = NULL_TREE; + + TYPE_NEXT_VARIANT (type) = NULL_TREE; +} + + +/* Return true if DECL may need an assembler name to be set. */ + +static inline bool +need_assembler_name_p (tree decl) +{ + /* Only FUNCTION_DECLs and VAR_DECLs are considered. */ + if (TREE_CODE (decl) != FUNCTION_DECL + && TREE_CODE (decl) != VAR_DECL) + return false; + + /* If DECL already has its assembler name set, it does not need a + new one. */ + if (!HAS_DECL_ASSEMBLER_NAME_P (decl) + || DECL_ASSEMBLER_NAME_SET_P (decl)) + return false; + + /* For VAR_DECLs, only static, public and external symbols need an + assembler name. */ + if (TREE_CODE (decl) == VAR_DECL + && !TREE_STATIC (decl) + && !TREE_PUBLIC (decl) + && !DECL_EXTERNAL (decl)) + return false; + + /* Do not set assembler name on builtins. Allow RTL expansion to + decide whether to expand inline or via a regular call. */ + if (TREE_CODE (decl) == FUNCTION_DECL + && DECL_BUILT_IN (decl) + && DECL_BUILT_IN_CLASS (decl) != BUILT_IN_FRONTEND) + return false; + + /* For FUNCTION_DECLs, only used functions and functions + represented in the callgraph need an assembler name. */ + if (TREE_CODE (decl) == FUNCTION_DECL + && cgraph_node_for_decl (decl) == NULL + && !TREE_USED (decl)) + return false; + + return true; +} + + +/* Remove all the non-variable decls from BLOCK. LOCALS is the set of + variables in DECL_STRUCT_FUNCTION (FN)->local_decls. Every decl + in BLOCK that is not in LOCALS is removed. */ + +static void +free_lang_data_in_block (tree fn, tree block, struct pointer_set_t *locals) +{ + tree *tp, t; + + tp = &BLOCK_VARS (block); + while (*tp) + { + if (!pointer_set_contains (locals, *tp)) + *tp = TREE_CHAIN (*tp); + else + tp = &TREE_CHAIN (*tp); + } + + for (t = BLOCK_SUBBLOCKS (block); t; t = BLOCK_CHAIN (t)) + free_lang_data_in_block (fn, t, locals); +} + + +/* Reset all language specific information still present in symbol + DECL. */ + +static void +free_lang_data_in_decl (tree decl) +{ + gcc_assert (DECL_P (decl)); + + /* Give the FE a chance to remove its own data first. */ + lang_hooks.free_lang_data (decl); + + TREE_LANG_FLAG_0 (decl) = 0; + TREE_LANG_FLAG_1 (decl) = 0; + TREE_LANG_FLAG_2 (decl) = 0; + TREE_LANG_FLAG_3 (decl) = 0; + TREE_LANG_FLAG_4 (decl) = 0; + TREE_LANG_FLAG_5 (decl) = 0; + TREE_LANG_FLAG_6 (decl) = 0; + + /* Identifiers need not have a type. */ + if (DECL_NAME (decl)) + TREE_TYPE (DECL_NAME (decl)) = NULL_TREE; + + if (TREE_CODE (decl) == CONST_DECL) + DECL_CONTEXT (decl) = NULL_TREE; + + /* Ignore any intervening types, because we are going to clear their + TYPE_CONTEXT fields. */ + if (TREE_CODE (decl) != FIELD_DECL) + DECL_CONTEXT (decl) = decl_function_context (decl); + + if (DECL_CONTEXT (decl) + && TREE_CODE (DECL_CONTEXT (decl)) == NAMESPACE_DECL) + DECL_CONTEXT (decl) = NULL_TREE; + + if (TREE_CODE (decl) == VAR_DECL) + { + tree context = DECL_CONTEXT (decl); + + if (context) + { + enum tree_code code = TREE_CODE (context); + if (code == FUNCTION_DECL && DECL_ABSTRACT (context)) + { + /* Do not clear the decl context here, that will promote + all vars to global ones. */ + DECL_INITIAL (decl) = NULL_TREE; + } + + if (TREE_STATIC (decl)) + DECL_CONTEXT (decl) = NULL_TREE; + } + } + + if (TREE_CODE (decl) == PARM_DECL + || TREE_CODE (decl) == FIELD_DECL + || TREE_CODE (decl) == RESULT_DECL) + { + tree unit_size = DECL_SIZE_UNIT (decl); + tree size = DECL_SIZE (decl); + if ((unit_size && TREE_CODE (unit_size) != INTEGER_CST) + || (size && TREE_CODE (size) != INTEGER_CST)) + { + DECL_SIZE_UNIT (decl) = NULL_TREE; + DECL_SIZE (decl) = NULL_TREE; + } + + if (TREE_CODE (decl) == FIELD_DECL + && DECL_FIELD_OFFSET (decl) + && TREE_CODE (DECL_FIELD_OFFSET (decl)) != INTEGER_CST) + DECL_FIELD_OFFSET (decl) = NULL_TREE; + } + else if (TREE_CODE (decl) == FUNCTION_DECL) + { + if (gimple_has_body_p (decl)) + { + tree t; + struct pointer_set_t *locals; + + /* 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). */ + for (t = DECL_ARGUMENTS (decl); t; t = TREE_CHAIN (t)) + DECL_CONTEXT (t) = decl; + + /* Collect all the symbols declared in DECL. */ + locals = pointer_set_create (); + t = DECL_STRUCT_FUNCTION (decl)->local_decls; + for (; t; t = TREE_CHAIN (t)) + { + pointer_set_insert (locals, TREE_VALUE (t)); + + /* All the local symbols should have DECL as their + context. */ + DECL_CONTEXT (TREE_VALUE (t)) = decl; + } + + /* Get rid of any decl not in local_decls. */ + free_lang_data_in_block (decl, DECL_INITIAL (decl), locals); + + pointer_set_destroy (locals); + } + + /* DECL_SAVED_TREE holds the GENERIC representation for DECL. + At this point, it is not needed anymore. */ + DECL_SAVED_TREE (decl) = NULL_TREE; + } + else if (TREE_CODE (decl) == VAR_DECL) + { + tree expr = DECL_DEBUG_EXPR (decl); + if (expr + && TREE_CODE (expr) == VAR_DECL + && !TREE_STATIC (expr) && !DECL_EXTERNAL (expr)) + SET_DECL_DEBUG_EXPR (decl, NULL_TREE); + + if (DECL_EXTERNAL (decl)) + DECL_INITIAL (decl) = NULL_TREE; + } + else if (TREE_CODE (decl) == TYPE_DECL) + { + DECL_INITIAL (decl) = NULL_TREE; + + /* DECL_CONTEXT is overloaded as DECL_FIELD_CONTEXT for + FIELD_DECLs, which should be preserved. Otherwise, + we shouldn't be concerned with source-level lexical + nesting beyond this point. */ + DECL_CONTEXT (decl) = NULL_TREE; + } +} + + +/* Data used when collecting DECLs and TYPEs for language data removal. */ + +struct free_lang_data_d +{ + /* Set of traversed objects. Used to avoid duplicate visits. */ + struct pointer_set_t *pset; + + /* Array of symbols to process with free_lang_data_in_decl. */ + VEC(tree,heap) *decls; + + /* Array of types to process with free_lang_data_in_type. */ + VEC(tree,heap) *types; +}; + + +/* Save all language fields needed to generate proper debug information + for DECL. This saves most fields cleared out by free_lang_data_in_decl. */ + +static void +save_debug_info_for_decl (tree t) +{ + /*struct saved_debug_info_d *sdi;*/ + + gcc_assert (debug_info_level > DINFO_LEVEL_TERSE && t && DECL_P (t)); + + /* FIXME. Partial implementation for saving debug info removed. */ +} + + +/* Save all language fields needed to generate proper debug information + for TYPE. This saves most fields cleared out by free_lang_data_in_type. */ + +static void +save_debug_info_for_type (tree t) +{ + /*struct saved_debug_info_d *sdi;*/ + + gcc_assert (debug_info_level > DINFO_LEVEL_TERSE && t && TYPE_P (t)); + + /* FIXME. Partial implementation for saving debug info removed. */ +} + + +/* 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. */ + +static void +add_tree_to_fld_list (tree t, struct free_lang_data_d *fld) +{ + if (DECL_P (t)) + { + VEC_safe_push (tree, heap, fld->decls, t); + if (debug_info_level > DINFO_LEVEL_TERSE) + save_debug_info_for_decl (t); + } + else if (TYPE_P (t)) + { + VEC_safe_push (tree, heap, fld->types, t); + if (debug_info_level > DINFO_LEVEL_TERSE) + save_debug_info_for_type (t); + } + else + gcc_unreachable (); +} + + +/* Operand callback helper for free_lang_data_in_node. *TP is the + subtree operand being considered. */ + +static tree +find_decls_types_r (tree *tp, int *ws ATTRIBUTE_UNUSED, void *data) +{ + tree t = *tp; + struct free_lang_data_d *fld = (struct free_lang_data_d *) data; + + if (DECL_P (t)) + { + /* Note that walk_tree does not traverse every possible field in + decls, so we have to do our own traversals here. */ + add_tree_to_fld_list (t, fld); + + walk_tree (&DECL_NAME (t), find_decls_types_r, fld, fld->pset); + walk_tree (&DECL_CONTEXT (t), find_decls_types_r, fld, fld->pset); + walk_tree (&DECL_SIZE (t), find_decls_types_r, fld, fld->pset); + walk_tree (&DECL_SIZE_UNIT (t), find_decls_types_r, fld, fld->pset); + walk_tree (&DECL_INITIAL (t), find_decls_types_r, fld, fld->pset); + walk_tree (&DECL_ATTRIBUTES (t), find_decls_types_r, fld, fld->pset); + walk_tree (&DECL_ABSTRACT_ORIGIN (t), find_decls_types_r, fld, fld->pset); + + if (TREE_CODE (t) == FUNCTION_DECL) + { + walk_tree (&DECL_ARGUMENTS (t), find_decls_types_r, fld, fld->pset); + walk_tree (&DECL_RESULT (t), find_decls_types_r, fld, fld->pset); + } + else if (TREE_CODE (t) == TYPE_DECL) + { + walk_tree (&DECL_ARGUMENT_FLD (t), find_decls_types_r, fld, + fld->pset); + walk_tree (&DECL_VINDEX (t), find_decls_types_r, fld, fld->pset); + } + else if (TREE_CODE (t) == FIELD_DECL) + { + walk_tree (&DECL_FIELD_OFFSET (t), find_decls_types_r, fld, + fld->pset); + walk_tree (&DECL_BIT_FIELD_TYPE (t), find_decls_types_r, fld, + fld->pset); + walk_tree (&DECL_QUALIFIER (t), find_decls_types_r, fld, fld->pset); + walk_tree (&DECL_FIELD_BIT_OFFSET (t), find_decls_types_r, fld, + fld->pset); + walk_tree (&DECL_FCONTEXT (t), find_decls_types_r, fld, fld->pset); + } + else if (TREE_CODE (t) == VAR_DECL) + { + walk_tree (&DECL_SECTION_NAME (t), find_decls_types_r, fld, + fld->pset); + walk_tree (&DECL_COMDAT_GROUP (t), find_decls_types_r, fld, + fld->pset); + } + } + else if (TYPE_P (t)) + { + /* Note that walk_tree does not traverse every possible field in + types, so we have to do our own traversals here. */ + add_tree_to_fld_list (t, fld); + + walk_tree (&TYPE_CACHED_VALUES (t), find_decls_types_r, fld, fld->pset); + walk_tree (&TYPE_SIZE (t), find_decls_types_r, fld, fld->pset); + walk_tree (&TYPE_SIZE_UNIT (t), find_decls_types_r, fld, fld->pset); + walk_tree (&TYPE_ATTRIBUTES (t), find_decls_types_r, fld, fld->pset); + walk_tree (&TYPE_POINTER_TO (t), find_decls_types_r, fld, fld->pset); + walk_tree (&TYPE_REFERENCE_TO (t), find_decls_types_r, fld, fld->pset); + walk_tree (&TYPE_NAME (t), find_decls_types_r, fld, fld->pset); + walk_tree (&TYPE_MINVAL (t), find_decls_types_r, fld, fld->pset); + walk_tree (&TYPE_MAXVAL (t), find_decls_types_r, fld, fld->pset); + walk_tree (&TYPE_NEXT_VARIANT (t), find_decls_types_r, fld, fld->pset); + walk_tree (&TYPE_MAIN_VARIANT (t), find_decls_types_r, fld, fld->pset); + walk_tree (&TYPE_CONTEXT (t), find_decls_types_r, fld, fld->pset); + walk_tree (&TYPE_CANONICAL (t), find_decls_types_r, fld, fld->pset); + } + + if (TREE_TYPE (t)) + walk_tree (&TREE_TYPE (t), find_decls_types_r, fld, fld->pset); + + /* Do not recurse into TREE_CHAIN to avoid blowing up the stack. */ + for (tp = &TREE_CHAIN (t); *tp; tp = &TREE_CHAIN (*tp)) + { + tree saved_chain = TREE_CHAIN (*tp); + TREE_CHAIN (*tp) = NULL_TREE; + walk_tree (tp, find_decls_types_r, fld, fld->pset); + TREE_CHAIN (*tp) = saved_chain; + } + + return NULL_TREE; +} + + +/* Translate all the types in LIST with the corresponding runtime + types. */ + +static tree +get_eh_types_for_runtime (tree list) +{ + tree head, prev; + + if (list == NULL_TREE) + return NULL_TREE; + + head = build_tree_list (0, lookup_type_for_runtime (TREE_VALUE (list))); + prev = head; + list = TREE_CHAIN (list); + while (list) + { + tree n = build_tree_list (0, lookup_type_for_runtime (TREE_VALUE (list))); + TREE_CHAIN (prev) = n; + prev = TREE_CHAIN (prev); + list = TREE_CHAIN (list); + } + + return head; +} + + +/* Find decls and types referenced in EH region R and store them in + FLD->DECLS and FLD->TYPES. */ + +static void +find_decls_types_in_eh_region (eh_region r, struct free_lang_data_d *fld) +{ + if (r == NULL) + return; + + /* The types referenced in R must first be changed to the EH types + used at runtime. This removes references to FE types in the + region. */ + if (r->type == ERT_CATCH) + { + tree list = r->u.eh_catch.type_list; + r->u.eh_catch.type_list = get_eh_types_for_runtime (list); + walk_tree (&r->u.eh_catch.type_list, find_decls_types_r, fld, fld->pset); + } + else if (r->type == ERT_ALLOWED_EXCEPTIONS) + { + tree list = r->u.allowed.type_list; + r->u.allowed.type_list = get_eh_types_for_runtime (list); + walk_tree (&r->u.allowed.type_list, find_decls_types_r, fld, fld->pset); + } +} + + +/* 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). */ + +static void +find_decls_types_in_node (struct cgraph_node *n, struct free_lang_data_d *fld) +{ + basic_block bb; + struct function *fn; + tree t; + + walk_tree (&n->decl, find_decls_types_r, fld, fld->pset); + + if (!gimple_has_body_p (n->decl)) + return; + + gcc_assert (current_function_decl == NULL_TREE && cfun == NULL); + + fn = DECL_STRUCT_FUNCTION (n->decl); + + /* Traverse locals. */ + for (t = fn->local_decls; t; t = TREE_CHAIN (t)) + { + tree *tp = &TREE_VALUE (t); + tree saved_chain = TREE_CHAIN (*tp); + TREE_CHAIN (*tp) = NULL_TREE; + walk_tree (tp, find_decls_types_r, fld, fld->pset); + TREE_CHAIN (*tp) = saved_chain; + } + + /* Traverse EH regions in FN. */ + if (fn->eh->region_array) + { + unsigned i; + eh_region r; + + for (i = 0; VEC_iterate (eh_region, fn->eh->region_array, i, r); i++) + find_decls_types_in_eh_region (r, fld); + } + + /* Traverse every statement in FN. */ + FOR_EACH_BB_FN (bb, fn) + { + gimple_stmt_iterator si; + unsigned i; + + for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si)) + { + gimple phi = gsi_stmt (si); + + for (i = 0; i < gimple_phi_num_args (phi); i++) + { + tree *arg_p = gimple_phi_arg_def_ptr (phi, i); + walk_tree (arg_p, find_decls_types_r, fld, fld->pset); + } + } + + for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) + { + gimple stmt = gsi_stmt (si); + + for (i = 0; i < gimple_num_ops (stmt); i++) + { + tree *arg_p = gimple_op_ptr (stmt, i); + walk_tree (arg_p, find_decls_types_r, fld, fld->pset); + } + } + } +} + + +/* 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 void +find_decls_types_in_var (struct varpool_node *v, struct free_lang_data_d *fld) +{ + walk_tree (&v->decl, find_decls_types_r, fld, fld->pset); +} + + +/* 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. */ + +static void +free_lang_data_in_cgraph (void) +{ + struct cgraph_node *n; + struct varpool_node *v; + struct free_lang_data_d fld; + tree t; + unsigned i; + alias_pair *p; + + /* Initialize sets and arrays to store referenced decls and types. */ + fld.pset = pointer_set_create (); + fld.decls = VEC_alloc (tree, heap, 100); + fld.types = VEC_alloc (tree, heap, 100); + + /* Find decls and types in the body of every function in the callgraph. */ + for (n = cgraph_nodes; n; n = n->next) + find_decls_types_in_node (n, &fld); + + for (i = 0; VEC_iterate (alias_pair, alias_pairs, i, p); i++) + walk_tree (&p->decl, find_decls_types_r, &fld, fld.pset); + + /* Find decls and types in every varpool symbol. */ + for (v = varpool_nodes_queue; v; v = v->next_needed) + find_decls_types_in_var (v, &fld); + + /* 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. */ + for (i = 0; VEC_iterate (tree, fld.decls, i, t); i++) + if (need_assembler_name_p (t)) + { + /* 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. */ + location_t saved_location = input_location; + input_location = DECL_SOURCE_LOCATION (t); + + decl_assembler_name (t); + + input_location = saved_location; + } + + /* Traverse every decl found freeing its language data. */ + for (i = 0; VEC_iterate (tree, fld.decls, i, t); i++) + free_lang_data_in_decl (t); + + /* Traverse every type found freeing its language data. */ + for (i = 0; VEC_iterate (tree, fld.types, i, t); i++) + free_lang_data_in_type (t); + + pointer_set_destroy (fld.pset); + VEC_free (tree, heap, fld.decls); + VEC_free (tree, heap, fld.types); +} + + +/* Free resources that are used by FE but are not needed once they are done. */ + +static unsigned +free_lang_data (void) +{ + /* Traverse the IL resetting language specific information for + operands, expressions, etc. */ + free_lang_data_in_cgraph (); + + /* Create gimple variants for common types. */ + ptrdiff_type_node = integer_type_node; + fileptr_type_node = ptr_type_node; + if (TREE_CODE (boolean_type_node) != BOOLEAN_TYPE + || (TYPE_MODE (boolean_type_node) + != mode_for_size (BOOL_TYPE_SIZE, MODE_INT, 0)) + || TYPE_PRECISION (boolean_type_node) != 1 + || !TYPE_UNSIGNED (boolean_type_node)) + { + boolean_type_node = make_unsigned_type (BOOL_TYPE_SIZE); + TREE_SET_CODE (boolean_type_node, BOOLEAN_TYPE); + TYPE_MAX_VALUE (boolean_type_node) = build_int_cst (boolean_type_node, 1); + TYPE_PRECISION (boolean_type_node) = 1; + boolean_false_node = TYPE_MIN_VALUE (boolean_type_node); + boolean_true_node = TYPE_MAX_VALUE (boolean_type_node); + } + + /* Reset some langhooks. */ + lang_hooks.callgraph.analyze_expr = NULL; + lang_hooks.types_compatible_p = NULL; + lang_hooks.dwarf_name = lhd_dwarf_name; + lang_hooks.decl_printable_name = gimple_decl_printable_name; + lang_hooks.set_decl_assembler_name = lhd_set_decl_assembler_name; + lang_hooks.fold_obj_type_ref = gimple_fold_obj_type_ref; + + /* Reset diagnostic machinery. */ + diagnostic_starter (global_dc) = default_diagnostic_starter; + diagnostic_finalizer (global_dc) = default_diagnostic_finalizer; + diagnostic_format_decoder (global_dc) = default_tree_printer; + + return 0; +} + + +/* Gate function for free_lang_data. */ + +static bool +gate_free_lang_data (void) +{ + /* FIXME. Remove after save_debug_info is working. */ + return !flag_gtoggle && debug_info_level <= DINFO_LEVEL_TERSE; +} + + +struct simple_ipa_opt_pass pass_ipa_free_lang_data = +{ + { + SIMPLE_IPA_PASS, + NULL, /* name */ + gate_free_lang_data, /* gate */ + free_lang_data, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_IPA_FREE_LANG_DATA, /* tv_id */ + 0, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + 0, /* todo_flags_start */ + 0 /* todo_flags_finish */ + } +}; + /* Return nonzero if IDENT is a valid name for attribute ATTR, or zero if not. @@ -5292,6 +6082,9 @@ tree_int_cst_compare (const_tree t1, const_tree t2) int host_integerp (const_tree t, int pos) { + if (t == NULL_TREE) + return 0; + return (TREE_CODE (t) == INTEGER_CST && ((TREE_INT_CST_HIGH (t) == 0 && (HOST_WIDE_INT) TREE_INT_CST_LOW (t) >= 0) -- cgit v1.2.1 From c8de116dd87b9f7a0e0c2cb5713356d9a83069f7 Mon Sep 17 00:00:00 2001 From: rguenth Date: Sun, 6 Sep 2009 16:49:48 +0000 Subject: 2009-09-06 Richard Guenther PR middle-end/41144 * tree.c (build_array_type): Do not record types marked with structural equality in the canonical type hashtable. * g++.dg/torture/pr41144.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151461 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 1db7d0a86c3..a036439cc3f 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -6906,44 +6906,29 @@ build_array_type (tree elt_type, tree index_type) t = make_node (ARRAY_TYPE); TREE_TYPE (t) = elt_type; TYPE_DOMAIN (t) = index_type; - - if (index_type == 0) - { - tree save = t; - hashcode = iterative_hash_object (TYPE_HASH (elt_type), hashcode); - t = type_hash_canon (hashcode, t); - if (save == t) - layout_type (t); - - if (TYPE_CANONICAL (t) == t) - { - if (TYPE_STRUCTURAL_EQUALITY_P (elt_type)) - SET_TYPE_STRUCTURAL_EQUALITY (t); - else if (TYPE_CANONICAL (elt_type) != elt_type) - TYPE_CANONICAL (t) - = build_array_type (TYPE_CANONICAL (elt_type), index_type); - } + layout_type (t); - return t; - } + /* 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. */ + if (TYPE_STRUCTURAL_EQUALITY_P (t)) + return t; hashcode = iterative_hash_object (TYPE_HASH (elt_type), hashcode); - hashcode = iterative_hash_object (TYPE_HASH (index_type), hashcode); + if (index_type) + hashcode = iterative_hash_object (TYPE_HASH (index_type), hashcode); t = type_hash_canon (hashcode, t); - if (!COMPLETE_TYPE_P (t)) - layout_type (t); - if (TYPE_CANONICAL (t) == t) { if (TYPE_STRUCTURAL_EQUALITY_P (elt_type) - || TYPE_STRUCTURAL_EQUALITY_P (index_type)) + || (index_type && TYPE_STRUCTURAL_EQUALITY_P (index_type))) SET_TYPE_STRUCTURAL_EQUALITY (t); else if (TYPE_CANONICAL (elt_type) != elt_type - || TYPE_CANONICAL (index_type) != index_type) + || (index_type && TYPE_CANONICAL (index_type) != index_type)) TYPE_CANONICAL (t) = build_array_type (TYPE_CANONICAL (elt_type), - TYPE_CANONICAL (index_type)); + index_type ? TYPE_CANONICAL (index_type) : NULL); } return t; -- cgit v1.2.1 From f4a9ca14121de19969490f6540653d9c8269c65e Mon Sep 17 00:00:00 2001 From: jason Date: Tue, 8 Sep 2009 19:26:06 +0000 Subject: * tree.c (tree_find_value): Remove. * tree.h: Remove prototype. * varasm.c (assemble_external): Use value_member instead. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151534 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index a036439cc3f..010aeff2f57 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2003,18 +2003,6 @@ tree_last (tree chain) return chain; } -/* Return the node in a chain of nodes whose value is x, NULL if not found. */ - -tree -tree_find_value (tree chain, tree x) -{ - tree list; - for (list = chain; list; list = TREE_CHAIN (list)) - if (TREE_VALUE (list) == x) - return list; - return NULL; -} - /* Reverse the order of elements in the chain T, and return the new head of the chain (old last element). */ -- cgit v1.2.1 From ca1de3a62d14399000f480cd55dec6c1d79c463f Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 9 Sep 2009 09:30:26 +0000 Subject: 2009-09-09 Richard Guenther * tree.c (free_lang_data_in_type): Do not free the type variant chains. (free_lang_data): Merge char_type_node with its properly signed variant. (pass_ipa_free): Collect after freeing language specific data. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151558 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 010aeff2f57..17009c6b8e4 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4238,16 +4238,6 @@ free_lang_data_in_type (tree type) TYPE_CONTEXT (type) = NULL_TREE; TYPE_STUB_DECL (type) = NULL_TREE; - - /* Remove type variants other than the main variant. This is both - wasteful and it may introduce infinite loops when the types are - read from disk and merged (since the variant will be the same - type as the main variant, traversing type variants will get into - an infinite loop). */ - if (TYPE_MAIN_VARIANT (type)) - TYPE_NEXT_VARIANT (TYPE_MAIN_VARIANT (type)) = NULL_TREE; - - TYPE_NEXT_VARIANT (type) = NULL_TREE; } @@ -4856,6 +4846,12 @@ free_lang_data (void) boolean_true_node = TYPE_MAX_VALUE (boolean_type_node); } + /* Unify char_type_node with its properly signed variant. */ + if (TYPE_UNSIGNED (char_type_node)) + unsigned_char_type_node = char_type_node; + else + signed_char_type_node = char_type_node; + /* Reset some langhooks. */ lang_hooks.callgraph.analyze_expr = NULL; lang_hooks.types_compatible_p = NULL; @@ -4898,7 +4894,7 @@ struct simple_ipa_opt_pass pass_ipa_free_lang_data = 0, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ - 0 /* todo_flags_finish */ + TODO_ggc_collect /* todo_flags_finish */ } }; -- cgit v1.2.1 From 969443c44523194ff4a6759420190e16ff130563 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 10 Sep 2009 08:52:36 +0000 Subject: 2009-09-10 Richard Guenther PR middle-end/41254 * tree.c (struct free_lang_data_d): Add worklist member. (find_decls_types_r): Push onto the worklist instead of recursing. Handle TREE_BINFOs properly. (find_decls_types): New function wrapped around find_decls_types_r to process the worklist. (find_decls_types_in_eh_region): Use it. (find_decls_types_in_node): Likewise. (find_decls_types_in_var): Likewise. (free_lang_data_in_cgraph): Likewise. Free the worklist. * tree.h (RECORD_OR_UNION_TYPE_P): New. (AGGREGATE_TYPE_P): Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151590 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 147 +++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 84 insertions(+), 63 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 17009c6b8e4..2f0e03c8e22 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4447,6 +4447,9 @@ free_lang_data_in_decl (tree decl) struct free_lang_data_d { + /* Worklist to avoid excessive recursion. */ + VEC(tree,heap) *worklist; + /* Set of traversed objects. Used to avoid duplicate visits. */ struct pointer_set_t *pset; @@ -4508,6 +4511,9 @@ add_tree_to_fld_list (tree t, struct free_lang_data_d *fld) gcc_unreachable (); } +#define PUSH(t) \ + if (t && !pointer_set_contains (fld->pset, t)) \ + VEC_safe_push (tree, heap, fld->worklist, (t)) /* Operand callback helper for free_lang_data_in_node. *TP is the subtree operand being considered. */ @@ -4518,49 +4524,49 @@ find_decls_types_r (tree *tp, int *ws ATTRIBUTE_UNUSED, void *data) tree t = *tp; struct free_lang_data_d *fld = (struct free_lang_data_d *) data; + if (TREE_CODE (t) == TREE_LIST) + return NULL_TREE; + if (DECL_P (t)) { /* Note that walk_tree does not traverse every possible field in decls, so we have to do our own traversals here. */ add_tree_to_fld_list (t, fld); - walk_tree (&DECL_NAME (t), find_decls_types_r, fld, fld->pset); - walk_tree (&DECL_CONTEXT (t), find_decls_types_r, fld, fld->pset); - walk_tree (&DECL_SIZE (t), find_decls_types_r, fld, fld->pset); - walk_tree (&DECL_SIZE_UNIT (t), find_decls_types_r, fld, fld->pset); - walk_tree (&DECL_INITIAL (t), find_decls_types_r, fld, fld->pset); - walk_tree (&DECL_ATTRIBUTES (t), find_decls_types_r, fld, fld->pset); - walk_tree (&DECL_ABSTRACT_ORIGIN (t), find_decls_types_r, fld, fld->pset); + PUSH (DECL_NAME (t)); + PUSH (DECL_CONTEXT (t)); + PUSH (DECL_SIZE (t)); + PUSH (DECL_SIZE_UNIT (t)); + PUSH (DECL_INITIAL(t)); + PUSH (DECL_ATTRIBUTES (t)); + PUSH (DECL_ABSTRACT_ORIGIN (t)); if (TREE_CODE (t) == FUNCTION_DECL) { - walk_tree (&DECL_ARGUMENTS (t), find_decls_types_r, fld, fld->pset); - walk_tree (&DECL_RESULT (t), find_decls_types_r, fld, fld->pset); + PUSH (DECL_ARGUMENTS (t)); + PUSH (DECL_RESULT (t)); } else if (TREE_CODE (t) == TYPE_DECL) { - walk_tree (&DECL_ARGUMENT_FLD (t), find_decls_types_r, fld, - fld->pset); - walk_tree (&DECL_VINDEX (t), find_decls_types_r, fld, fld->pset); + PUSH (DECL_ARGUMENT_FLD (t)); + PUSH (DECL_VINDEX (t)); } else if (TREE_CODE (t) == FIELD_DECL) { - walk_tree (&DECL_FIELD_OFFSET (t), find_decls_types_r, fld, - fld->pset); - walk_tree (&DECL_BIT_FIELD_TYPE (t), find_decls_types_r, fld, - fld->pset); - walk_tree (&DECL_QUALIFIER (t), find_decls_types_r, fld, fld->pset); - walk_tree (&DECL_FIELD_BIT_OFFSET (t), find_decls_types_r, fld, - fld->pset); - walk_tree (&DECL_FCONTEXT (t), find_decls_types_r, fld, fld->pset); + PUSH (DECL_FIELD_OFFSET (t)); + PUSH (DECL_BIT_FIELD_TYPE (t)); + PUSH (DECL_QUALIFIER (t)); + PUSH (DECL_FIELD_BIT_OFFSET (t)); + PUSH (DECL_FCONTEXT (t)); } else if (TREE_CODE (t) == VAR_DECL) { - walk_tree (&DECL_SECTION_NAME (t), find_decls_types_r, fld, - fld->pset); - walk_tree (&DECL_COMDAT_GROUP (t), find_decls_types_r, fld, - fld->pset); + PUSH (DECL_SECTION_NAME (t)); + PUSH (DECL_COMDAT_GROUP (t)); } + + PUSH (TREE_CHAIN (t)); + *ws = 0; } else if (TYPE_P (t)) { @@ -4568,36 +4574,55 @@ find_decls_types_r (tree *tp, int *ws ATTRIBUTE_UNUSED, void *data) types, so we have to do our own traversals here. */ add_tree_to_fld_list (t, fld); - walk_tree (&TYPE_CACHED_VALUES (t), find_decls_types_r, fld, fld->pset); - walk_tree (&TYPE_SIZE (t), find_decls_types_r, fld, fld->pset); - walk_tree (&TYPE_SIZE_UNIT (t), find_decls_types_r, fld, fld->pset); - walk_tree (&TYPE_ATTRIBUTES (t), find_decls_types_r, fld, fld->pset); - walk_tree (&TYPE_POINTER_TO (t), find_decls_types_r, fld, fld->pset); - walk_tree (&TYPE_REFERENCE_TO (t), find_decls_types_r, fld, fld->pset); - walk_tree (&TYPE_NAME (t), find_decls_types_r, fld, fld->pset); - walk_tree (&TYPE_MINVAL (t), find_decls_types_r, fld, fld->pset); - walk_tree (&TYPE_MAXVAL (t), find_decls_types_r, fld, fld->pset); - walk_tree (&TYPE_NEXT_VARIANT (t), find_decls_types_r, fld, fld->pset); - walk_tree (&TYPE_MAIN_VARIANT (t), find_decls_types_r, fld, fld->pset); - walk_tree (&TYPE_CONTEXT (t), find_decls_types_r, fld, fld->pset); - walk_tree (&TYPE_CANONICAL (t), find_decls_types_r, fld, fld->pset); - } - - if (TREE_TYPE (t)) - walk_tree (&TREE_TYPE (t), find_decls_types_r, fld, fld->pset); + PUSH (TYPE_CACHED_VALUES (t)); + PUSH (TYPE_SIZE (t)); + PUSH (TYPE_SIZE_UNIT (t)); + PUSH (TYPE_ATTRIBUTES (t)); + PUSH (TYPE_POINTER_TO (t)); + PUSH (TYPE_REFERENCE_TO (t)); + PUSH (TYPE_NAME (t)); + PUSH (TYPE_MINVAL (t)); + PUSH (TYPE_MAXVAL (t)); + PUSH (TYPE_MAIN_VARIANT (t)); + PUSH (TYPE_NEXT_VARIANT (t)); + PUSH (TYPE_CONTEXT (t)); + PUSH (TYPE_CANONICAL (t)); + + if (RECORD_OR_UNION_TYPE_P (t) + && TYPE_BINFO (t)) + { + unsigned i; + tree tem; + for (i = 0; VEC_iterate (tree, BINFO_BASE_BINFOS (TYPE_BINFO (t)), + i, tem); ++i) + PUSH (TREE_TYPE (tem)); + } - /* Do not recurse into TREE_CHAIN to avoid blowing up the stack. */ - for (tp = &TREE_CHAIN (t); *tp; tp = &TREE_CHAIN (*tp)) - { - tree saved_chain = TREE_CHAIN (*tp); - TREE_CHAIN (*tp) = NULL_TREE; - walk_tree (tp, find_decls_types_r, fld, fld->pset); - TREE_CHAIN (*tp) = saved_chain; + PUSH (TREE_CHAIN (t)); + *ws = 0; } + PUSH (TREE_TYPE (t)); + return NULL_TREE; } +#undef PUSH + +/* Find decls and types in T. */ + +static void +find_decls_types (tree t, struct free_lang_data_d *fld) +{ + while (1) + { + if (!pointer_set_contains (fld->pset, t)) + walk_tree (&t, find_decls_types_r, fld, fld->pset); + if (VEC_empty (tree, fld->worklist)) + break; + t = VEC_pop (tree, fld->worklist); + } +} /* Translate all the types in LIST with the corresponding runtime types. */ @@ -4641,13 +4666,13 @@ find_decls_types_in_eh_region (eh_region r, struct free_lang_data_d *fld) { tree list = r->u.eh_catch.type_list; r->u.eh_catch.type_list = get_eh_types_for_runtime (list); - walk_tree (&r->u.eh_catch.type_list, find_decls_types_r, fld, fld->pset); + find_decls_types (r->u.eh_catch.type_list, fld); } else if (r->type == ERT_ALLOWED_EXCEPTIONS) { tree list = r->u.allowed.type_list; r->u.allowed.type_list = get_eh_types_for_runtime (list); - walk_tree (&r->u.allowed.type_list, find_decls_types_r, fld, fld->pset); + find_decls_types (r->u.allowed.type_list, fld); } } @@ -4665,7 +4690,7 @@ find_decls_types_in_node (struct cgraph_node *n, struct free_lang_data_d *fld) struct function *fn; tree t; - walk_tree (&n->decl, find_decls_types_r, fld, fld->pset); + find_decls_types (n->decl, fld); if (!gimple_has_body_p (n->decl)) return; @@ -4676,13 +4701,7 @@ find_decls_types_in_node (struct cgraph_node *n, struct free_lang_data_d *fld) /* Traverse locals. */ for (t = fn->local_decls; t; t = TREE_CHAIN (t)) - { - tree *tp = &TREE_VALUE (t); - tree saved_chain = TREE_CHAIN (*tp); - TREE_CHAIN (*tp) = NULL_TREE; - walk_tree (tp, find_decls_types_r, fld, fld->pset); - TREE_CHAIN (*tp) = saved_chain; - } + find_decls_types (TREE_VALUE (t), fld); /* Traverse EH regions in FN. */ if (fn->eh->region_array) @@ -4707,7 +4726,7 @@ find_decls_types_in_node (struct cgraph_node *n, struct free_lang_data_d *fld) for (i = 0; i < gimple_phi_num_args (phi); i++) { tree *arg_p = gimple_phi_arg_def_ptr (phi, i); - walk_tree (arg_p, find_decls_types_r, fld, fld->pset); + find_decls_types (*arg_p, fld); } } @@ -4717,8 +4736,8 @@ find_decls_types_in_node (struct cgraph_node *n, struct free_lang_data_d *fld) for (i = 0; i < gimple_num_ops (stmt); i++) { - tree *arg_p = gimple_op_ptr (stmt, i); - walk_tree (arg_p, find_decls_types_r, fld, fld->pset); + tree arg = gimple_op (stmt, i); + find_decls_types (arg, fld); } } } @@ -4734,7 +4753,7 @@ find_decls_types_in_node (struct cgraph_node *n, struct free_lang_data_d *fld) static void find_decls_types_in_var (struct varpool_node *v, struct free_lang_data_d *fld) { - walk_tree (&v->decl, find_decls_types_r, fld, fld->pset); + find_decls_types (v->decl, fld); } @@ -4767,6 +4786,7 @@ free_lang_data_in_cgraph (void) /* Initialize sets and arrays to store referenced decls and types. */ fld.pset = pointer_set_create (); + fld.worklist = NULL; fld.decls = VEC_alloc (tree, heap, 100); fld.types = VEC_alloc (tree, heap, 100); @@ -4775,7 +4795,7 @@ free_lang_data_in_cgraph (void) find_decls_types_in_node (n, &fld); for (i = 0; VEC_iterate (alias_pair, alias_pairs, i, p); i++) - walk_tree (&p->decl, find_decls_types_r, &fld, fld.pset); + find_decls_types (p->decl, &fld); /* Find decls and types in every varpool symbol. */ for (v = varpool_nodes_queue; v; v = v->next_needed) @@ -4815,6 +4835,7 @@ free_lang_data_in_cgraph (void) free_lang_data_in_type (t); pointer_set_destroy (fld.pset); + VEC_free (tree, heap, fld.worklist); VEC_free (tree, heap, fld.decls); VEC_free (tree, heap, fld.types); } -- cgit v1.2.1 From 7616de9318924405c384cf6a2d451abbb42f521c Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 10 Sep 2009 21:40:06 +0000 Subject: * tree.c (chain_index): New fn. * tree.h: Declare it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151618 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 2f0e03c8e22..27ab46cdd93 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1905,6 +1905,17 @@ purpose_member (const_tree elem, tree list) return NULL_TREE; } +/* Returns element number IDX (zero-origin) of chain CHAIN, or + NULL_TREE. */ + +tree +chain_index (int idx, tree chain) +{ + for (; chain && idx > 0; --idx) + chain = TREE_CHAIN (chain); + return chain; +} + /* Return nonzero if ELEM is part of the chain CHAIN. */ int -- cgit v1.2.1 From 58d82cd04d30e16e38e5fcac6d2d120fa55d64ed Mon Sep 17 00:00:00 2001 From: rguenth Date: Sun, 13 Sep 2009 19:40:33 +0000 Subject: 2009-09-13 Richard Guenther Rafael Avila de Espindola * langhooks-def.h (LANG_HOOKS_EH_RUNTIME_TYPE): Define. (LANG_HOOKS_EH_PERSONALITY): Likewise. (LANG_HOOKS_INITIALIZER): Adjust. (lhd_pass_through_t): Declare. * langhooks.h (struct lang_hooks): Add eh_runtime_type and eh_personality. * langhooks.c (lhd_pass_through_t): New function. * dwarf2out.c (output_call_frame_info, dwarf2out_do_cfi_startproc, dwarf2out_begin_prologue): Use personality from current_function_decl. * expr.h (get_personality_function): Declare. * expr.c (get_personality_function): New function. (build_personality_function): Likewise. * libfuncs.h (libfunc_index): Remove LTI_eh_personality. (eh_personality_libfunc): Remove. * optabs.c (build_libfunc_function): New function split out from ... (init_one_libfunc): ... here. * tree.h (DECL_FUNCTION_PERSONALITY): New. (tree_function_decl): Add personality. (lhd_gcc_personality): Declare. (build_personality_function): Likewise. * tree.c (gcc_eh_personality_decl): New. (lhd_gcc_personality): New function. * except.h (lang_eh_runtime_type): Remove. (enum eh_personality_kind): New. (build_personality_function): Declare. (function_needs_eh_personality): Declare. * except.c (lang_eh_runtime_type): Remove. (function_needs_eh_personality): New function. (add_type_for_runtime): Call lang_hooks.type_for_runtime instead. (sjlj_emit_function_enter, output_function_exception_table): Use personality from current_function_decl. * tree-eh.c (lower_eh_constructs): Set DECL_FUNCTION_PERSONALITY. * tree-inline.c (tree_can_inline_p): Do not inline across different EH personalities. (expand_call_inline): Likewise. Adjust the callers EH personality. (tree_function_versioning): Copy DECL_FUNCTION_PERSONALITY. * cgraph.c (cgraph_add_new_function): Set DECL_FUNCTION_PERSONALITY. * Makefile.in (cgraph.o): Add $(EXCEPT_H) dependency. (c-parser.o): Likewise * c-tree.h (c_eh_initialized_p): Remove. (c_maybe_initialize_eh): Likewise. * c-decl.c (finish_decl): Don't call c_maybe_initialize_eh. (finish_decl): Don't call c_maybe_initialize_eh. (c_eh_initialized_p): Remove. (c_maybe_initialize_eh): Likewise. * c-parser.c (c_parser_omp_construct): Likewise. (c_parse_file): Initialize exception handling. objc/ * objc-act.c (objc_eh_runtime_type): Export. (objc_init_exceptions): Remove. Move warning code ... (objc_begin_try_stmt): ... here (objc_build_throw_stmt): ... and here. (objc_eh_personality_decl): New. (objc_eh_personality): New function. * objc-act.h (objc_eh_runtime_type): Declare. (objc_eh_personality): Likewise. * objc-lang.c (LANG_HOOKS_EH_RUNTIME_TYPE): Define. (LANG_HOOKS_EH_PERSONALITY): Likewise. cp/ * except.c (init_exception_processing): Do not set lang_eh_runtime_type. (choose_personality_routine): Do not set eh_personality_decl, set pragma_java_exceptions. * cp-lang.c (LANG_HOOKS_EH_RUNTIME_TYPE): Define. (LANG_HOOKS_EH_PERSONALITY): Likewise. (cp_eh_personality_decl): New. (cp_eh_personality): Likewise. * Make-lang.in (cp-lang.o): Add $(EXPR_H) and $(EXCEPT_H) dependencies. java/ * decl.c (do_nothing): Remove. (java_init_decl_processing): Do not set lang_eh_runtime_type. * Make-lang.in (lang.o): Add $(EXCEPT_H) dependency. * lang.c (java_eh_personality): New. (java_eh_personality_decl): Likewise. (LANG_HOOKS_EH_PERSONALITY): Define. ada/ * gcc-interface/misc.c (gnat_init_gcc_eh): Do not set lang_eh_runtime_type. (LANG_HOOKS_EH_PERSONALITY): Define. (gnat_eh_personality_decl): New. (gnat_eh_personality): Likewise. * Make-lang.in (misc.o): Add gt-ada-misc.h dependency. * config-lang.in (gtfiles): Add misc.c. fortran/ * f95-lang.c (gfc_maybe_initialize_eh): Do not init eh_personality_libfunc. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151676 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 27ab46cdd93..98a683dea9d 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -10566,5 +10566,20 @@ tree_strip_sign_nop_conversions (tree exp) return exp; } +static GTY(()) tree gcc_eh_personality_decl; + +/* Return the GCC personality function decl. */ + +tree +lhd_gcc_personality (void) +{ + if (!gcc_eh_personality_decl) + gcc_eh_personality_decl + = build_personality_function (USING_SJLJ_EXCEPTIONS + ? "__gcc_personality_sj0" + : "__gcc_personality_v0"); + + return gcc_eh_personality_decl; +} #include "gt-tree.h" -- cgit v1.2.1 From e38def9ca7953bb5611d08ce8617249516ba5a99 Mon Sep 17 00:00:00 2001 From: rth Date: Mon, 14 Sep 2009 19:18:58 +0000 Subject: Squash commit of EH in gimple git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151696 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 118 ++++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 81 insertions(+), 37 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 98a683dea9d..d2243e5d1bd 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4667,23 +4667,36 @@ get_eh_types_for_runtime (tree list) static void find_decls_types_in_eh_region (eh_region r, struct free_lang_data_d *fld) { - if (r == NULL) - return; - - /* The types referenced in R must first be changed to the EH types - used at runtime. This removes references to FE types in the - region. */ - if (r->type == ERT_CATCH) + switch (r->type) { - tree list = r->u.eh_catch.type_list; - r->u.eh_catch.type_list = get_eh_types_for_runtime (list); - find_decls_types (r->u.eh_catch.type_list, fld); - } - else if (r->type == ERT_ALLOWED_EXCEPTIONS) - { - tree list = r->u.allowed.type_list; - r->u.allowed.type_list = get_eh_types_for_runtime (list); - find_decls_types (r->u.allowed.type_list, fld); + case ERT_CLEANUP: + break; + + case ERT_TRY: + { + eh_catch c; + + /* 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. */ + for (c = r->u.eh_try.first_catch; c ; c = c->next_catch) + { + c->type_list = get_eh_types_for_runtime (c->type_list); + walk_tree (&c->type_list, find_decls_types_r, fld, fld->pset); + } + } + break; + + case ERT_ALLOWED_EXCEPTIONS: + r->u.allowed.type_list + = get_eh_types_for_runtime (r->u.allowed.type_list); + walk_tree (&r->u.allowed.type_list, find_decls_types_r, fld, fld->pset); + break; + + case ERT_MUST_NOT_THROW: + walk_tree (&r->u.must_not_throw.failure_decl, + find_decls_types_r, fld, fld->pset); + break; } } @@ -4715,14 +4728,11 @@ find_decls_types_in_node (struct cgraph_node *n, struct free_lang_data_d *fld) find_decls_types (TREE_VALUE (t), fld); /* Traverse EH regions in FN. */ - if (fn->eh->region_array) - { - unsigned i; - eh_region r; - - for (i = 0; VEC_iterate (eh_region, fn->eh->region_array, i, r); i++) - find_decls_types_in_eh_region (r, fld); - } + { + eh_region r; + FOR_ALL_EH_REGION_FN (r, fn) + find_decls_types_in_eh_region (r, fld); + } /* Traverse every statement in FN. */ FOR_EACH_BB_FN (bb, fn) @@ -8880,12 +8890,15 @@ local_define_builtin (const char *name, tree type, enum built_in_function code, /* 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. */ + are relied upon by the tree optimizers and the middle-end. + + ENABLE_CXA_END_CLEANUP should be true for C++ and Java, where the ARM + EABI requires a slightly different implementation of _Unwind_Resume. */ void -build_common_builtin_nodes (void) +build_common_builtin_nodes (bool enable_cxa_end_cleanup) { - tree tmp, ftype; + tree tmp, tmp2, ftype; if (built_in_decls[BUILT_IN_MEMCPY] == NULL || built_in_decls[BUILT_IN_MEMMOVE] == NULL) @@ -8990,6 +9003,47 @@ build_common_builtin_nodes (void) local_define_builtin ("__builtin_profile_func_exit", ftype, BUILT_IN_PROFILE_FUNC_EXIT, "profile_func_exit", 0); + if (enable_cxa_end_cleanup && targetm.arm_eabi_unwinder) + { + ftype = build_function_type (void_type_node, void_list_node); + local_define_builtin ("__builtin_unwind_resume", ftype, + BUILT_IN_UNWIND_RESUME, + "__cxa_end_cleanup", ECF_NORETURN); + } + else + { + tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); + ftype = build_function_type (void_type_node, tmp); + local_define_builtin ("__builtin_unwind_resume", ftype, + BUILT_IN_UNWIND_RESUME, + (USING_SJLJ_EXCEPTIONS + ? "_Unwind_SjLj_Resume" : "_Unwind_Resume"), + ECF_NORETURN); + } + + /* 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. */ + tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node); + ftype = build_function_type (ptr_type_node, tmp); + local_define_builtin ("__builtin_eh_pointer", ftype, BUILT_IN_EH_POINTER, + "__builtin_eh_pointer", ECF_PURE | ECF_NOTHROW); + + tmp2 = lang_hooks.types.type_for_mode (targetm.eh_return_filter_mode (), 0); + ftype = build_function_type (tmp2, tmp); + local_define_builtin ("__builtin_eh_filter", ftype, BUILT_IN_EH_FILTER, + "__builtin_eh_filter", ECF_PURE | ECF_NOTHROW); + + tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node); + tmp = tree_cons (NULL_TREE, integer_type_node, tmp); + ftype = build_function_type (void_type_node, tmp); + local_define_builtin ("__builtin_eh_copy_values", ftype, + BUILT_IN_EH_COPY_VALUES, + "__builtin_eh_copy_values", ECF_NOTHROW); + /* 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 @@ -9151,16 +9205,6 @@ build_opaque_vector_type (tree innertype, int nunits) } -/* Build RESX_EXPR with given REGION_NUMBER. */ -tree -build_resx (int region_number) -{ - tree t; - t = build1 (RESX_EXPR, void_type_node, - build_int_cst (NULL_TREE, region_number)); - return t; -} - /* Given an initializer INIT, return TRUE if INIT is zero or some aggregate of zeros. Otherwise return FALSE. */ bool -- cgit v1.2.1 From e1f1071ca8bd74cc6fa80e5cc024360ced018d9a Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 17 Sep 2009 11:11:58 +0000 Subject: PR middle-end/41347 * tree.c (build_type_attribute_qual_variant): Export. * tree.h (build_type_attribute_qual_variant): Declare. * tree-inline.c (remap_type_1): Use it to build variants with the original qualifiers and attributes. testsuite/ * gfortran.dg/pr41347.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151799 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index d2243e5d1bd..846dd983ea7 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4034,7 +4034,7 @@ iterative_hash_host_wide_int (HOST_WIDE_INT val, hashval_t val2) Record such modified types already made so we don't make duplicates. */ -static tree +tree build_type_attribute_qual_variant (tree ttype, tree attribute, int quals) { if (! attribute_list_equal (TYPE_ATTRIBUTES (ttype), attribute)) -- cgit v1.2.1 From 471eff3649c0d9383213b2dfef646d0496d43e28 Mon Sep 17 00:00:00 2001 From: rth Date: Mon, 28 Sep 2009 16:44:32 +0000 Subject: * except.h (struct eh_region_d): Add use_cxa_end_cleanup. * except.c (gen_eh_region): Set it. (duplicate_eh_regions_1): Copy it. * tree-eh.c (lower_resx): Use it to determine which function to call to resume. * langhooks.h (struct lang_hooks): Add eh_use_cxa_end_cleanup. * langhooks-def.h (LANG_HOOKS_EH_USE_CXA_END_CLEANUP): New. * builtins.def (BUILT_IN_CXA_END_CLEANUP): New. * tree.c (build_common_builtin_nodes): Remove parameter. Build BUILT_IN_CXA_END_CLEANUP if necessary. * tree.h (build_common_builtin_nodes): Update decl. * c-common.c (c_define_builtins): Update call to build_common_builtin_nodes. gcc/ada/ * gcc-interface/utils.c (gnat_install_builtins): Update call to build_common_builtin_nodes. gcc/cp/ * cp-objcp-common.h (LANG_HOOKS_EH_USE_CXA_END_CLEANUP): New. gcc/fortran/ * f95-lang.c (gfc_init_builtin_functions): Update call to build_common_builtin_nodes. gcc/java/ * builtins.c (initialize_builtins): Update call to build_common_builtin_nodes. * lang.c (LANG_HOOKS_EH_USE_CXA_END_CLEANUP): New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152241 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 846dd983ea7..315df903b30 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -8890,13 +8890,10 @@ local_define_builtin (const char *name, tree type, enum built_in_function code, /* 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. - - ENABLE_CXA_END_CLEANUP should be true for C++ and Java, where the ARM - EABI requires a slightly different implementation of _Unwind_Resume. */ + are relied upon by the tree optimizers and the middle-end. */ void -build_common_builtin_nodes (bool enable_cxa_end_cleanup) +build_common_builtin_nodes (void) { tree tmp, tmp2, ftype; @@ -9003,23 +9000,23 @@ build_common_builtin_nodes (bool enable_cxa_end_cleanup) local_define_builtin ("__builtin_profile_func_exit", ftype, BUILT_IN_PROFILE_FUNC_EXIT, "profile_func_exit", 0); - if (enable_cxa_end_cleanup && targetm.arm_eabi_unwinder) + /* 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. */ + if (targetm.arm_eabi_unwinder) { ftype = build_function_type (void_type_node, void_list_node); - local_define_builtin ("__builtin_unwind_resume", ftype, - BUILT_IN_UNWIND_RESUME, + local_define_builtin ("__builtin_cxa_end_cleanup", ftype, + BUILT_IN_CXA_END_CLEANUP, "__cxa_end_cleanup", ECF_NORETURN); } - else - { - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - ftype = build_function_type (void_type_node, tmp); - local_define_builtin ("__builtin_unwind_resume", ftype, - BUILT_IN_UNWIND_RESUME, - (USING_SJLJ_EXCEPTIONS - ? "_Unwind_SjLj_Resume" : "_Unwind_Resume"), - ECF_NORETURN); - } + + tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); + ftype = build_function_type (void_type_node, tmp); + local_define_builtin ("__builtin_unwind_resume", ftype, + BUILT_IN_UNWIND_RESUME, + (USING_SJLJ_EXCEPTIONS + ? "_Unwind_SjLj_Resume" : "_Unwind_Resume"), + ECF_NORETURN); /* The exception object and filter values from the runtime. The argument must be zero before exception lowering, i.e. from the front end. After -- cgit v1.2.1 From 7bfefa9d2c82e804ef4e59772f4060ac325bf99a Mon Sep 17 00:00:00 2001 From: dnovillo Date: Sat, 3 Oct 2009 21:10:11 +0000 Subject: Merge lto branch into trunk. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152434 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 224 +++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 135 insertions(+), 89 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 315df903b30..77ba3f8498c 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4130,6 +4130,31 @@ build_type_attribute_variant (tree ttype, tree attribute) TYPE_QUALS (ttype)); } + +/* Reset all the fields in a binfo node BINFO. We only keep + BINFO_VIRTUALS, which is used by gimple_fold_obj_type_ref. */ + +static void +free_lang_data_in_binfo (tree binfo) +{ + unsigned i; + tree t; + + gcc_assert (TREE_CODE (binfo) == TREE_BINFO); + + BINFO_OFFSET (binfo) = NULL_TREE; + BINFO_VTABLE (binfo) = NULL_TREE; + BINFO_VPTR_FIELD (binfo) = NULL_TREE; + BINFO_BASE_ACCESSES (binfo) = NULL; + BINFO_INHERITANCE_CHAIN (binfo) = NULL_TREE; + BINFO_SUBVTT_INDEX (binfo) = NULL_TREE; + BINFO_VPTR_FIELD (binfo) = NULL_TREE; + + for (i = 0; VEC_iterate (tree, BINFO_BASE_BINFOS (binfo), i, t); i++) + free_lang_data_in_binfo (t); +} + + /* Reset all language specific information still present in TYPE. */ static void @@ -4179,9 +4204,7 @@ free_lang_data_in_type (tree type) /* Remove members that are not actually FIELD_DECLs from the field list of an aggregate. These occur in C++. */ - if (TREE_CODE (type) == RECORD_TYPE - || TREE_CODE (type) == UNION_TYPE - || TREE_CODE (type) == QUAL_UNION_TYPE) + if (RECORD_OR_UNION_TYPE_P (type)) { tree prev, member; @@ -4215,30 +4238,7 @@ free_lang_data_in_type (tree type) TYPE_METHODS (type) = NULL_TREE; if (TYPE_BINFO (type)) - { - tree binfo = TYPE_BINFO (type); - - if (BINFO_VIRTUALS (binfo)) - { - /* If the virtual function table for BINFO contains - entries, these may be useful for folding OBJ_TYPE_REF - expressions (see gimple_fold_obj_type_ref). In that - case, we only clear the unused fields in the BINFO - structure. */ - BINFO_OFFSET (binfo) = NULL_TREE; - BINFO_VTABLE (binfo) = NULL_TREE; - BINFO_VPTR_FIELD (binfo) = NULL_TREE; - BINFO_BASE_ACCESSES (binfo) = NULL; - BINFO_INHERITANCE_CHAIN (binfo) = NULL_TREE; - BINFO_SUBVTT_INDEX (binfo) = NULL_TREE; - BINFO_VPTR_FIELD (binfo) = NULL_TREE; - } - else - { - /* Otherwise, get rid of the whole binfo data. */ - TYPE_BINFO (type) = NULL_TREE; - } - } + free_lang_data_in_binfo (TYPE_BINFO (type)); } else { @@ -4276,19 +4276,22 @@ need_assembler_name_p (tree decl) && !DECL_EXTERNAL (decl)) return false; - /* Do not set assembler name on builtins. Allow RTL expansion to - decide whether to expand inline or via a regular call. */ - if (TREE_CODE (decl) == FUNCTION_DECL - && DECL_BUILT_IN (decl) - && DECL_BUILT_IN_CLASS (decl) != BUILT_IN_FRONTEND) - return false; + if (TREE_CODE (decl) == FUNCTION_DECL) + { + /* Do not set assembler name on builtins. Allow RTL expansion to + decide whether to expand inline or via a regular call. */ + if (DECL_BUILT_IN (decl) + && DECL_BUILT_IN_CLASS (decl) != BUILT_IN_FRONTEND) + return false; - /* For FUNCTION_DECLs, only used functions and functions - represented in the callgraph need an assembler name. */ - if (TREE_CODE (decl) == FUNCTION_DECL - && cgraph_node_for_decl (decl) == NULL - && !TREE_USED (decl)) - return false; + /* Functions represented in the callgraph need an assembler name. */ + if (cgraph_node_for_decl (decl) != NULL) + return true; + + /* Unused and not public functions don't need an assembler name. */ + if (!TREE_USED (decl) && !TREE_PUBLIC (decl)) + return false; + } return true; } @@ -4340,9 +4343,6 @@ free_lang_data_in_decl (tree decl) if (DECL_NAME (decl)) TREE_TYPE (DECL_NAME (decl)) = NULL_TREE; - if (TREE_CODE (decl) == CONST_DECL) - DECL_CONTEXT (decl) = NULL_TREE; - /* Ignore any intervening types, because we are going to clear their TYPE_CONTEXT fields. */ if (TREE_CODE (decl) != FIELD_DECL) @@ -4522,15 +4522,21 @@ add_tree_to_fld_list (tree t, struct free_lang_data_d *fld) gcc_unreachable (); } -#define PUSH(t) \ - if (t && !pointer_set_contains (fld->pset, t)) \ - VEC_safe_push (tree, heap, fld->worklist, (t)) +/* Push tree node T into FLD->WORKLIST. */ + +static inline void +fld_worklist_push (tree t, struct free_lang_data_d *fld) +{ + if (t && !is_lang_specific (t) && !pointer_set_contains (fld->pset, t)) + VEC_safe_push (tree, heap, fld->worklist, (t)); +} + /* Operand callback helper for free_lang_data_in_node. *TP is the subtree operand being considered. */ static tree -find_decls_types_r (tree *tp, int *ws ATTRIBUTE_UNUSED, void *data) +find_decls_types_r (tree *tp, int *ws, void *data) { tree t = *tp; struct free_lang_data_d *fld = (struct free_lang_data_d *) data; @@ -4538,45 +4544,59 @@ find_decls_types_r (tree *tp, int *ws ATTRIBUTE_UNUSED, void *data) if (TREE_CODE (t) == TREE_LIST) return NULL_TREE; + /* Language specific nodes will be removed, so there is no need + to gather anything under them. */ + if (is_lang_specific (t)) + { + *ws = 0; + return NULL_TREE; + } + if (DECL_P (t)) { /* Note that walk_tree does not traverse every possible field in decls, so we have to do our own traversals here. */ add_tree_to_fld_list (t, fld); - PUSH (DECL_NAME (t)); - PUSH (DECL_CONTEXT (t)); - PUSH (DECL_SIZE (t)); - PUSH (DECL_SIZE_UNIT (t)); - PUSH (DECL_INITIAL(t)); - PUSH (DECL_ATTRIBUTES (t)); - PUSH (DECL_ABSTRACT_ORIGIN (t)); + fld_worklist_push (DECL_NAME (t), fld); + fld_worklist_push (DECL_CONTEXT (t), fld); + fld_worklist_push (DECL_SIZE (t), fld); + fld_worklist_push (DECL_SIZE_UNIT (t), fld); + + /* We are going to remove everything under DECL_INITIAL for + TYPE_DECLs. No point walking them. */ + if (TREE_CODE (t) != TYPE_DECL) + fld_worklist_push (DECL_INITIAL (t), fld); + + fld_worklist_push (DECL_ATTRIBUTES (t), fld); + fld_worklist_push (DECL_ABSTRACT_ORIGIN (t), fld); if (TREE_CODE (t) == FUNCTION_DECL) { - PUSH (DECL_ARGUMENTS (t)); - PUSH (DECL_RESULT (t)); + fld_worklist_push (DECL_ARGUMENTS (t), fld); + fld_worklist_push (DECL_RESULT (t), fld); } else if (TREE_CODE (t) == TYPE_DECL) { - PUSH (DECL_ARGUMENT_FLD (t)); - PUSH (DECL_VINDEX (t)); + fld_worklist_push (DECL_ARGUMENT_FLD (t), fld); + fld_worklist_push (DECL_VINDEX (t), fld); } else if (TREE_CODE (t) == FIELD_DECL) { - PUSH (DECL_FIELD_OFFSET (t)); - PUSH (DECL_BIT_FIELD_TYPE (t)); - PUSH (DECL_QUALIFIER (t)); - PUSH (DECL_FIELD_BIT_OFFSET (t)); - PUSH (DECL_FCONTEXT (t)); + fld_worklist_push (DECL_FIELD_OFFSET (t), fld); + fld_worklist_push (DECL_BIT_FIELD_TYPE (t), fld); + fld_worklist_push (DECL_QUALIFIER (t), fld); + fld_worklist_push (DECL_FIELD_BIT_OFFSET (t), fld); + fld_worklist_push (DECL_FCONTEXT (t), fld); } else if (TREE_CODE (t) == VAR_DECL) { - PUSH (DECL_SECTION_NAME (t)); - PUSH (DECL_COMDAT_GROUP (t)); + fld_worklist_push (DECL_SECTION_NAME (t), fld); + fld_worklist_push (DECL_COMDAT_GROUP (t), fld); } - PUSH (TREE_CHAIN (t)); + if (TREE_CODE (t) != FIELD_DECL) + fld_worklist_push (TREE_CHAIN (t), fld); *ws = 0; } else if (TYPE_P (t)) @@ -4585,40 +4605,59 @@ find_decls_types_r (tree *tp, int *ws ATTRIBUTE_UNUSED, void *data) types, so we have to do our own traversals here. */ add_tree_to_fld_list (t, fld); - PUSH (TYPE_CACHED_VALUES (t)); - PUSH (TYPE_SIZE (t)); - PUSH (TYPE_SIZE_UNIT (t)); - PUSH (TYPE_ATTRIBUTES (t)); - PUSH (TYPE_POINTER_TO (t)); - PUSH (TYPE_REFERENCE_TO (t)); - PUSH (TYPE_NAME (t)); - PUSH (TYPE_MINVAL (t)); - PUSH (TYPE_MAXVAL (t)); - PUSH (TYPE_MAIN_VARIANT (t)); - PUSH (TYPE_NEXT_VARIANT (t)); - PUSH (TYPE_CONTEXT (t)); - PUSH (TYPE_CANONICAL (t)); - - if (RECORD_OR_UNION_TYPE_P (t) - && TYPE_BINFO (t)) + if (!RECORD_OR_UNION_TYPE_P (t)) + fld_worklist_push (TYPE_CACHED_VALUES (t), fld); + fld_worklist_push (TYPE_SIZE (t), fld); + fld_worklist_push (TYPE_SIZE_UNIT (t), fld); + fld_worklist_push (TYPE_ATTRIBUTES (t), fld); + fld_worklist_push (TYPE_POINTER_TO (t), fld); + fld_worklist_push (TYPE_REFERENCE_TO (t), fld); + fld_worklist_push (TYPE_NAME (t), fld); + fld_worklist_push (TYPE_MINVAL (t), fld); + if (!RECORD_OR_UNION_TYPE_P (t)) + fld_worklist_push (TYPE_MAXVAL (t), fld); + fld_worklist_push (TYPE_MAIN_VARIANT (t), fld); + fld_worklist_push (TYPE_NEXT_VARIANT (t), fld); + fld_worklist_push (TYPE_CONTEXT (t), fld); + fld_worklist_push (TYPE_CANONICAL (t), fld); + + if (RECORD_OR_UNION_TYPE_P (t) && TYPE_BINFO (t)) { unsigned i; tree tem; for (i = 0; VEC_iterate (tree, BINFO_BASE_BINFOS (TYPE_BINFO (t)), i, tem); ++i) - PUSH (TREE_TYPE (tem)); + fld_worklist_push (TREE_TYPE (tem), fld); + tem = BINFO_VIRTUALS (TYPE_BINFO (t)); + while (tem) + { + fld_worklist_push (TREE_VALUE (tem), fld); + tem = TREE_CHAIN (tem); + } + } + if (RECORD_OR_UNION_TYPE_P (t)) + { + tree tem; + /* Push all TYPE_FIELDS - there can be interleaving interesting + and non-interesting things. */ + tem = TYPE_FIELDS (t); + while (tem) + { + if (TREE_CODE (tem) == FIELD_DECL) + fld_worklist_push (tem, fld); + tem = TREE_CHAIN (tem); + } } - PUSH (TREE_CHAIN (t)); + fld_worklist_push (TREE_CHAIN (t), fld); *ws = 0; } - PUSH (TREE_TYPE (t)); + fld_worklist_push (TREE_TYPE (t), fld); return NULL_TREE; } -#undef PUSH /* Find decls and types in T. */ @@ -4907,6 +4946,13 @@ free_lang_data (void) diagnostic_finalizer (global_dc) = default_diagnostic_finalizer; diagnostic_format_decoder (global_dc) = default_tree_printer; + /* FIXME. We remove sufficient language data that the debug + info writer gets completely confused. Disable debug information + for now. */ + debug_info_level = DINFO_LEVEL_NONE; + write_symbols = NO_DEBUG; + debug_hooks = &do_nothing_debug_hooks; + return 0; } @@ -4917,7 +4963,9 @@ static bool gate_free_lang_data (void) { /* FIXME. Remove after save_debug_info is working. */ - return !flag_gtoggle && debug_info_level <= DINFO_LEVEL_TERSE; + return (flag_generate_lto + || (!in_lto_p + && !flag_gtoggle && debug_info_level <= DINFO_LEVEL_TERSE)); } @@ -10110,9 +10158,7 @@ walk_tree_1 (tree *tp, walk_tree_fn func, void *data, return result; /* If this is a record type, also walk the fields. */ - if (TREE_CODE (*type_p) == RECORD_TYPE - || TREE_CODE (*type_p) == UNION_TYPE - || TREE_CODE (*type_p) == QUAL_UNION_TYPE) + if (RECORD_OR_UNION_TYPE_P (*type_p)) { tree field; -- cgit v1.2.1 From c90b5d400f562a31cf58dc58a8f330252133ac15 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 8 Oct 2009 16:03:11 +0000 Subject: PR middle-end/41573 * builtins.c (fold_builtin_isascii): Use fold_build2. (fold_builtin_isdigit): Ditto. * except.c (duplicate_eh_regions_1): Tolerate NULL labels. * tree-cfg.c (struct rus_data, remove_useless_stmts_warn_notreached, remove_useless_stmts_cond, remove_useless_stmts_tf, remove_useless_stmts_tc, remove_useless_stmts_bind, remove_useless_stmts_goto, remove_useless_stmts_label, remove_useless_stmts_1, remove_useless_stmts, pass_remove_useless_stmts): Remove. * tree-pass.h (pass_remove_useless_stmts): Don't declare. * passes.c (init_optimization_passes): Don't add pass_remove_useless_stmts. * tree-eh.c (lower_eh_constructs_2): Handle empty cleanups. * tree.c (free_lang_data_in_decl): Don't clear DECL_INITIAL of static constants. * lto-symtab.c (lto_symtab_register_decl): Accepts DECL_INITIAL for static constants. * lto-streamer-out.c (output_gimple_stmt): Handle GIMPLE_NOP. * lto-streamer-in.c (input_gimple_stmt): Handle GIMPLE_NOP. testsuite/ * gcc.dg/tree-ssa/foldstring-1.c: Use fre dump. * gcc.dg/tree-ssa/useless-1.c: Use gimple dump. * gcc.dg/pr41573.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152563 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 77ba3f8498c..4c3f52bd7b7 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4438,7 +4438,8 @@ free_lang_data_in_decl (tree decl) && !TREE_STATIC (expr) && !DECL_EXTERNAL (expr)) SET_DECL_DEBUG_EXPR (decl, NULL_TREE); - if (DECL_EXTERNAL (decl)) + if (DECL_EXTERNAL (decl) + && (!TREE_STATIC (decl) || !TREE_READONLY (decl))) DECL_INITIAL (decl) = NULL_TREE; } else if (TREE_CODE (decl) == TYPE_DECL) -- cgit v1.2.1 From 688ff29b2a2ea29629307f2a0d444059391dee7b Mon Sep 17 00:00:00 2001 From: aoliva Date: Mon, 12 Oct 2009 18:58:38 +0000 Subject: gcc/ChangeLog: PR debug/41343 PR debug/41447 PR debug/41264 PR debug/41338 * tree.def (DEBUG_EXPR_DECL): New. * rtl.def (DEBUG_EXPR): New. * gengtype.c (adjust_field_rtx_def): Handle it. * tree-ssa.c (propagate_var_def_into_debug_stmts): Rename to... (insert_debug_temp_for_var_def): ... this. Drop support for moving. Take iterator for def stmt; insert debug stmt before it. Scan early for use count and kind in debug stmts. (propagate_defs_into_debug_stmts): Rename to... (insert_debug_temps_for_defs): ... this. Likewise. * tree.h (DEBUG_TEMP_UID): New. * tree.c (next_debug_decl_uid): New. (make_node_stat): Count debug decls separately. (copy_node_stat): Likewise. * cfgexpand.c (expand_debug_expr): Handle DEBUG_EXPR_DECL. * var-tracking.c (dv_is_decl_p): Recognize it. (VALUE_RECURSED_INTO): Apply to DEBUG_EXPRs too. (track_expr_p): Track expanded DEBUG_EXPR_DECLs. (vt_expand_loc_callback): Expand DEBUG_EXPRs. (emit_note_insn_var_location): Don't emit notes for DEBUG_EXPR_DECLs. * cselib.c (rtx_equal_for_cselib_p): Handle DEBUG_EXPR. (cselib_hash_rtx): Likewise. (cselib_expand_value_rtx_1): Use callback for DEBUG_EXPR. * tree-ssa-operands.c (get_expr_operands): Skip DEBUG_EXPR_DECLs in debug bind stmts. * emit-rtl.c (verify_rtx_sharing): Handle DEBUG_EXPR and VALUE. (copy_rtx_if_shared_1, reset_used_flags, set_used_flags): Likewise. * rtl.c (copy_rtx): Likewise. (rtx_equal_p_cb, rtx_equal_p): Handle DEBUG_EXPR. * print-rtl.c (print_rtx): Likewise. * sched-vis.c (print_value): Likewise. (print_insn): Handle DEBUG_EXPR_DECL. * tree-dump.c (dequeue_and_dump): Likewise. * tree-pretty-print.c (dump_decl_name, dump_generic_node): Likewise. * gimple-iterator (gsi_replace): Check for same lhs. (gsi_remove): Insert debug temps. * tree-ssa-loop-im.c (rewrite_reciprocal): Replace with same lhs. (move_computations_stmt): Drop explicit propagation into debug stmts. (rewrite_bittest): Likewise. Use gsi_remove for propagation. * tree-ssa-reassoc.c (rewrite_expr_tree, linearize_expr): Likewise. * tree-ssa-sink.c (statement_sink_location): Likewise. * tree-ssa-forwprop (forward_propagate_addr_expr): Likewise. * tree-ssanames.c (release_ssa_name): Adjust for rename. * tree-flow.h: Likewise. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Don't mark debug temps without values. (eliminate_unnecessary_stmts): Don't discard just-inserted debug stmts. gcc/testsuite/ChangeLog: PR debug/41343 PR debug/41447 PR debug/41264 PR debug/41338 * gcc.dg/guality/pr41447-1.c: New. * gcc.dg/debug/pr41264-1.c: New. * gcc.dg/debug/pr41343-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152681 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 4c3f52bd7b7..9e463c04872 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -152,6 +152,9 @@ static const char * const tree_node_kind_names[] = { static GTY(()) int next_decl_uid; /* Unique id for next type created. */ static GTY(()) int next_type_uid = 1; +/* Unique id for next debug decl created. Use negative numbers, + to catch erroneous uses. */ +static GTY(()) int next_debug_decl_uid; /* Since we cannot rehash a type after it is in the table, we have to keep the hash code. */ @@ -872,7 +875,10 @@ make_node_stat (enum tree_code code MEM_STAT_DECL) DECL_ALIGN (t) = 1; } DECL_SOURCE_LOCATION (t) = input_location; - DECL_UID (t) = next_decl_uid++; + if (TREE_CODE (t) == DEBUG_EXPR_DECL) + DECL_UID (t) = --next_debug_decl_uid; + else + DECL_UID (t) = next_decl_uid++; if (TREE_CODE (t) == LABEL_DECL) LABEL_DECL_UID (t) = -1; @@ -948,7 +954,10 @@ copy_node_stat (tree node MEM_STAT_DECL) if (TREE_CODE_CLASS (code) == tcc_declaration) { - DECL_UID (t) = next_decl_uid++; + if (code == DEBUG_EXPR_DECL) + DECL_UID (t) = --next_debug_decl_uid; + else + DECL_UID (t) = next_decl_uid++; if ((TREE_CODE (node) == PARM_DECL || TREE_CODE (node) == VAR_DECL) && DECL_HAS_VALUE_EXPR_P (node)) { -- cgit v1.2.1 From 0f499ee4e53fbc984d25c192db0309b21601456a Mon Sep 17 00:00:00 2001 From: aoliva Date: Wed, 14 Oct 2009 05:01:24 +0000 Subject: PR debug/41343 PR debug/41447 PR debug/41264 PR debug/41338 * tree.c (tree_node_structure_for_code): DEBUG_EXPR_DECL uses decl with rtl. (tree_code_size): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152749 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 9e463c04872..e0a5aea05e1 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -287,6 +287,8 @@ tree_node_structure_for_code (enum tree_code code) return TS_LABEL_DECL; case RESULT_DECL: return TS_RESULT_DECL; + case DEBUG_EXPR_DECL: + return TS_DECL_WRTL; case CONST_DECL: return TS_CONST_DECL; case TYPE_DECL: @@ -670,6 +672,8 @@ tree_code_size (enum tree_code code) return sizeof (struct tree_type_decl); case FUNCTION_DECL: return sizeof (struct tree_function_decl); + case DEBUG_EXPR_DECL: + return sizeof (struct tree_decl_with_rtl); default: return sizeof (struct tree_decl_non_common); } -- cgit v1.2.1 From af4d2883043b329ee34322d616b88eb0e2b42fa5 Mon Sep 17 00:00:00 2001 From: jakub Date: Wed, 14 Oct 2009 10:04:22 +0000 Subject: PR preprocessor/41543 * input.h (BUILTINS_LOCATION): Change to 1 from 2. Assert BUILTINS_LOCATION < RESERVED_LOCATION_COUNT. * tree.c: Include intl.h. (expand_location): Handle BUILTINS_LOCATION. * Makefile.in (tree.o): Depend on intl.h. * include/line-map.h (RESERVED_LOCATION_COUNT): Define. * line-map.c (linemap_init): Initialize highest_location and highest_line to RESERVED_LOCATION_COUNT-1 instead of 0. * gcc.dg/debug/dwarf2/pr41543.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152761 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index e0a5aea05e1..b58767a1590 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -59,6 +59,7 @@ along with GCC; see the file COPYING3. If not see #include "timevar.h" #include "except.h" #include "debug.h" +#include "intl.h" /* Tree code classes. */ @@ -3952,9 +3953,9 @@ expanded_location expand_location (source_location loc) { expanded_location xloc; - if (loc == 0) + if (loc <= BUILTINS_LOCATION) { - xloc.file = NULL; + xloc.file = loc == UNKNOWN_LOCATION ? NULL : _(""); xloc.line = 0; xloc.column = 0; xloc.sysp = 0; -- cgit v1.2.1 From 3561575153cf13b100bbcd13302c6f98eccf154a Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 15 Oct 2009 08:53:35 +0000 Subject: 2009-10-15 Richard Guenther * tree.c (free_lang_data_in_decl): Free DECL_FCONTEXT. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152841 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index b58767a1590..5da346c52f8 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4402,6 +4402,10 @@ free_lang_data_in_decl (tree decl) && DECL_FIELD_OFFSET (decl) && TREE_CODE (DECL_FIELD_OFFSET (decl)) != INTEGER_CST) DECL_FIELD_OFFSET (decl) = NULL_TREE; + + /* DECL_FCONTEXT is only used for debug info generation. */ + if (TREE_CODE (decl) == FIELD_DECL) + DECL_FCONTEXT (decl) = NULL_TREE; } else if (TREE_CODE (decl) == FUNCTION_DECL) { -- cgit v1.2.1 From 06323ab0db08237b431a03f6e82b6f6a512f651e Mon Sep 17 00:00:00 2001 From: rguenth Date: Sun, 25 Oct 2009 12:03:07 +0000 Subject: 2009-10-25 Richard Guenther PR middle-end/41814 * tree.c (find_decls_types_r): Deal with Java overloading BINFO_VIRTUALS for its own purpose. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153539 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 5da346c52f8..264e3cef04a 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4648,11 +4648,15 @@ find_decls_types_r (tree *tp, int *ws, void *data) i, tem); ++i) fld_worklist_push (TREE_TYPE (tem), fld); tem = BINFO_VIRTUALS (TYPE_BINFO (t)); - while (tem) - { - fld_worklist_push (TREE_VALUE (tem), fld); - tem = TREE_CHAIN (tem); - } + if (tem + /* The Java FE overloads BINFO_VIRTUALS for its own purpose. */ + && TREE_CODE (tem) == TREE_LIST) + do + { + fld_worklist_push (TREE_VALUE (tem), fld); + tem = TREE_CHAIN (tem); + } + while (tem); } if (RECORD_OR_UNION_TYPE_P (t)) { -- cgit v1.2.1 From bd1a81f7e1665d2e33cc824dd05dd7988da9f1a8 Mon Sep 17 00:00:00 2001 From: uweigand Date: Mon, 26 Oct 2009 21:55:59 +0000 Subject: 2009-10-26 Ben Elliston Michael Meissner Ulrich Weigand * doc/extend.texi (Named Address Spaces): New section. * coretypes.h (addr_space_t): New type. (ADDR_SPACE_GENERIC): New define. (ADDR_SPACE_GENERIC_P): New macro. * doc/tm.texi (Named Address Spaces): New section. (TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P): Document. (TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS): Document. (TARGET_ADDR_SPACE_SUBSET_P): Document. (TARGET_ADDR_SPACE_CONVERT): Document. * target.h (struct gcc_target): Add addr_space substructure. * target-def.h (TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P): Define. (TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS): Likewise. (TARGET_ADDR_SPACE_SUBSET_P): Likewise. (TARGET_ADDR_SPACE_CONVERT): Likewise. (TARGET_ADDR_SPACE_HOOKS): Likewise. (TARGET_INITIALIZER): Initialize addr_space hooks. * targhooks.c (default_addr_space_legitimate_address_p): New function. (default_addr_space_legitimize_address): Likewise. (default_addr_space_subset_p): Likewise. (default_addr_space_convert): Likewise. * targhooks.h (default_addr_space_legitimate_address_p): Add prototype. (default_addr_space_legitimize_address): Likewise. (default_addr_space_subset_p): Likewise. (default_addr_space_convert): Likewise. * doc/rtl.texi (MEM_ADDR_SPACE): Document. * rtl.h (mem_attrs): Add ADDRSPACE memory attribute. (MEM_ADDR_SPACE): New macro. * emit-rtl.c (get_mem_attrs): Add ADDRSPACE argument and set address space memory attribute. (mem_attrs_htab_hash): Handle address space memory attribute. (mem_attrs_htab_eq): Likewise. (set_mem_attributes_minus_bitpos): Likewise. (set_mem_alias_set): Likewise. (set_mem_align): Likewise. (set_mem_expr): Likewise. (set_mem_offset): Likewise. (set_mem_size): Likewise. (adjust_address_1): Likewise. (offset_address): Likewise. (widen_memoy_address): Likewise. (get_spill_slot_decl): Likewise. (set_mem_attrs_for_spill): Likewise. (set_mem_addr_space): New function. * emit-rtl.h (set_mem_addr_space): Add prototype. * print-rtl.c (print_rtx): Print address space memory attribute. * expr.c (expand_assignment): Set address space memory attribute of generated MEM RTXes as appropriate. (expand_expr_real_1): Likewise. * cfgexpand.c (expand_debug_expr): Likewise. * tree-ssa-loop-ivopts.c (produce_memory_decl_rtl): Likewise. * tree.h (struct tree_base): Add address_space bitfield. Reduce size of "spare" bitfield. (TYPE_ADDR_SPACE): New macro. (ENCODE_QUAL_ADDR_SPACE): Likewise. (DECODE_QUAL_ADDR_SPACE): Likewise. (CLEAR_QUAL_ADDR_SPACE): Likewise. (KEEP_QUAL_ADDR_SPACE): Likewise. (TYPE_QUALS): Encode type address space. (TYPE_QUALS_NO_ADDR_SPACE): New macro. * tree.c (set_type_quals): Set type address space. (build_array_type): Inherit array address space from element type. * print-tree.c (print_node_brief): Print type address space. (print_node): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * explow.c (memory_address): Rename to ... (memory_address_addr_space): ... this. Add ADDRSPACE argument. Use address-space aware variants of memory address routines. * recog.c (memory_address_p): Rename to ... (memory_address_addr_space_p): ... this. Add ADDSPACE argument. Use address-space aware variants of memory address routines. (offsettable_address_p): Rename to ... (offsettable_address_addr_space_p): ... this. Add ADDRSPACE argument. Use address-space aware variants of memory address routines. * reload.c (strict_memory_address_p): Rename to ... (strict_memory_address_addr_space_p): ... this. Add ADDSPACE argument. Use address-space aware variants of memory address routines. (maybe_memory_address_p): Rename to ... (maybe_memory_address_addr_space_p): ... this. Add ADDSPACE argument. Use address-space aware variants of memory address routines. * expr.h (memory_address_addr_space): Add prototype. (memory_address): Define as macro. * recog.h (memory_address_addr_space_p): Add prototype. (memory_address_p): Define as macro. (offsettable_address_addr_space_p): Add prototype. (offsettable_address_p): Define as macro. (strict_memory_address_addr_space_p): Add prototype. (strict_memory_address_p): Define as macro. * combine.c (find_split_point): Use address-space aware variants of memory address routines. * emit-rtl.c (operand_subword): Likewise. (change_address_1): Likewise. (adjust_address_1): Likewise. (offset_address): Likewise. * expr.c (emit_move_insn): Likewise. (expand_assignment): Likewise. (expand_expr_real_1): Likewise. * recog.c (verify_changes): Likewise. (general_operand): Likewise. (offsettable_memref_p): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * reload.c (get_secondary_mem): Likewise. (find_reloads_toplev): Likewise. (find_reloads_address): Likewise. (find_reloads_subreg_address): Likewise. * reload1.c (reload): Likewise. * rtlhooks.c (gen_lowpart_if_possible): Likewise. * rtl.h (address_cost): Add ADDRSPACE argument. * rtlanal.c (address_cost): Add ADDRSPACE argument. Use address-space aware variant of memory address routines. * loop-invariant.c (create_new_invariant): Update address_cost call. * tree-ssa-loop-ivopts.c (computation_cost): Likewise. * fwprop.c (should_replace_address): Add ADDRSPACE argument. Use address-space aware variant of memory address routines. (propagate_rtx_1): Update call to should_replace_address. * tree-flow.h (multiplier_allowed_in_address_p): Add ADDRSPACE argument. * tree-ssa-loop-ivopts.c (multiplier_allowed_in_address_p): Add ADDRSPACE argument. Use per-address-space instead of global cache. Use address-space aware variant of memory address routines. (get_address_cost): Likewise. (get_computation_cost_at): Update calls. * tree-ssa-address.c (valid_mem_ref_p): Add ADDRSPACE argument. Use address-space aware variant of memory address routines. (create_mem_ref_raw): Update call to valid_mem_ref_p. (most_expensive_mult_to_index): Update call to multiplier_allowed_in_address_p. * dwarf2out.c (modified_type_die): Output DW_AT_address_class attribute to indicate named address spaces. * varasm.c (get_variable_section): DECLs in named address spaces cannot be "common". * reload.c (find_reloads_address): Do not use LEGITIMIZE_RELOAD_ADDRESS for addresses in a non-generic address space. * expr.c (emit_block_move_hints): Do not use libcalls for memory in non-generic address spaces. (clear_storage_hints): Likewise. (expand_assignment): Likewise. * fold-const.c (operand_equal_p): Expressions refering to different address spaces are not equivalent. * rtl.c (rtx_equal_p_cb): MEMs refering to different address spaces are not equivalent. (rtx_equal_p): Likewise. * cse.c (exp_equiv_p): Likewise. * jump.c (rtx_renumbered_equal_p): Likewise. * reload.c (operands_match_p): Likewise. * alias.c (nonoverlapping_memrefs_p): MEMs refering to different address spaces may alias. (true_dependence): Likewise. (canon_true_dependence): Likewise. (write_dependence_p): Likewise. * dse.c (canon_address): Handle named address spaces. * ifcvt.c (noce_try_cmove_arith): Likewise. * tree.def (ADDR_SPACE_CONVERT_EXPR): New tree code. * expr.c (expand_expr_real_2): Expand ADDR_SPACE_CONVERT_EXPR. * convert.c (convert_to_pointer): Generate ADDR_SPACE_CONVERT_EXPR to handle conversions between different address spaces. * fold-const.c (fold_convert_loc): Likewise. (fold_unary_loc): Handle ADDR_SPACE_CONVERT_EXPR. * tree-pretty-print.c (dump_generic_node): Likewise. * gimple-pretty-print.c (dump_unary_rhs): Likewise. * tree-cfg.c (verify_gimple_assign_unary): Likewise. * tree-inline.c (estimate_operator_cost): Likewise. * tree-ssa.c (useless_type_conversion_p): Conversions between pointers to different address spaces are not useless. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153572 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 264e3cef04a..dfc88077e96 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5424,6 +5424,7 @@ set_type_quals (tree type, int type_quals) TYPE_READONLY (type) = (type_quals & TYPE_QUAL_CONST) != 0; TYPE_VOLATILE (type) = (type_quals & TYPE_QUAL_VOLATILE) != 0; TYPE_RESTRICT (type) = (type_quals & TYPE_QUAL_RESTRICT) != 0; + TYPE_ADDR_SPACE (type) = DECODE_QUAL_ADDR_SPACE (type_quals); } /* Returns true iff CAND is equivalent to BASE with TYPE_QUALS. */ @@ -7003,6 +7004,7 @@ build_array_type (tree elt_type, tree index_type) t = make_node (ARRAY_TYPE); TREE_TYPE (t) = elt_type; TYPE_DOMAIN (t) = index_type; + TYPE_ADDR_SPACE (t) = TYPE_ADDR_SPACE (elt_type); layout_type (t); /* If the element type is incomplete at this point we get marked for -- cgit v1.2.1 From 98155838dbd82b97bb7bb16dfcbf98fa2ab27ca9 Mon Sep 17 00:00:00 2001 From: uweigand Date: Mon, 26 Oct 2009 21:57:10 +0000 Subject: 2009-10-26 Ben Elliston Michael Meissner Ulrich Weigand * doc/tm.texi (TARGET_ADDR_SPACE_POINTER_MODE): Document. (TARGET_ADDR_SPACE_ADDRESS_MODE): Likewise. (TARGET_ADDR_SPACE_VALID_POINTER_MODE): Likewise. * target.h (struct target_def): Add pointer_mode, address_mode, and valid_pointer_mode to addr_space substructure. * target-def.h (TARGET_ADDR_SPACE_POINTER_MODE): Define. (TARGET_ADDR_SPACE_ADDRESS_MODE): Likewise. (TARGET_ADDR_SPACE_VALID_POINTER_MODE): Likewise. (TARGET_ADDR_SPACE_HOOKS): Add them. * targhooks.c (target_default_pointer_address_modes_p): New function. * target.h (target_default_pointer_address_modes_p): Add prototype. * targhooks.c (default_addr_space_pointer_mode): New function. (default_addr_space_address_mode): Likewise. (default_addr_space_valid_pointer_mode): Likewise. * targhooks.h (default_addr_space_pointer_mode): Add prototype. (default_addr_space_address_mode): Likewise. (default_addr_space_valid_pointer_mode): Likewise. * output.h (default_valid_pointer_mode): Move to ... * targhooks.h (default_valid_pointer_mode): ... here. * varasm.c (default_valid_pointer_mode): Move to ... * targhooks.c (default_valid_pointer_mode): ... here. * varasm.c (output_constant): Use targetm.addr_space.valid_pointer_mode instead of targetm.valid_pointer_mode. * fold-const.c (fit_double_type): Use int_or_pointer_precision. * tree.c (integer_pow2p): Likewise. (tree_log2): Likewise. (tree_floor_log2): Likewise. (signed_or_unsigned_type_for): Support pointer type of different size. (int_or_pointer_precision): New function. * tree.h (int_or_pointer_precision): Add prototype. * stor-layout.c (layout_type): Set TYPE_PRECISION for offset types. * varasm.c (initializer_constant_valid_p): Use TYPE_PRECISION of incoming pointer type instead of POINTER_SIZE. * tree.c (build_pointer_type): Use appropriate pointer mode instead of ptr_mode. (build_reference_type): Likewise. * expr.c (store_expr): Likewise. (expand_expr_addr_expr): Likewise. * tree-vect-data-refs.c (vect_create_data_ref_ptr): Likewise. * cfgexpand.c (expand_debug_expr): Likewise. * auto-inc-dec.c: Include "target.h". (try_merge): Use appropriate address mode instead of Pmode. (find_inc): Likewise. * combine.c (find_split_point): Likewise. * cselib.c (cselib_record_sets): Likewise. * dse.c (replace_inc_dec): Likewise. (canon_address): Likewise. * var-tracking.c (replace_expr_with_values): Likewise. (count_uses): Likewise. (add_uses): Likewise. (add_stores): Likewise. * emit-rtl.c: Include "target.h". (adjust_address_1): Use appropriate address mode instead of Pmode. (offset_address): Likewise. * explow.c (break_out_memory_refs): Likewise. (memory_address_addr_space): Likewise. (promote_mode): Likewise. * expr.c (move_by_pieces): Likewise. (emit_block_move_via_loop): Likewise. (store_by_pieces): Likewise. (store_by_pieces_1): Likewise. (expand_assignment): Likewise. (store_constructor): Likewise. (expand_expr_addr_expr): Likewise. (expand_expr_real_1): Likewise. * cfgexpand.c (expand_debug_expr): Likewise. * ifcvt.c (noce_try_cmove_arith): Likewise. * regcprop.c (kill_autoinc_value): Likewise. * regmove.c (try_auto_increment): Likewise. * reload.c (find_reloads): Likewise. (find_reloads_address): Likewise. (find_reloads_address_1): Likewise. * sched-deps.c: Include "target.h". (sched_analyze_1): Use appropriate address mode instead of Pmode. (sched_analyze_2): Likewise. * sel-sched-dump.c: Include "target.h". (debug_mem_addr_value): Use appropriate address mode instead of Pmode. * stor-layout.c (layout_type): Likewise. * tree-ssa-loop-ivopts.c (produce_memory_decl_rtl): Likewise. (multiplier_allowed_in_address_p): Likewise. (get_address_cost): Likewise. * varasm.c (make_decl_rtl): Likewise. * expr.c (expand_assignment): Always convert offsets to appropriate address mode. (store_expr): Likewise. (store_constructor): Likewise. (expand_expr_real_1): Likewise. * reload.h (form_sum): Add MODE argument. * reload.c (form_sum): Add MODE argument, use it instead of Pmode. Update recursive calls. (subst_indexed_address): Update calls to form_sum. * tree-flow.h (addr_for_mem_ref): Add ADDRSPACE argument. * tree-ssa-address.c: Include "target.h". (templates): Replace by ... (mem_addr_template_list): ... this new vector. (TEMPL_IDX): Handle address space numbers. (gen_addr_rtx): Add address mode argument, use it instead of Pmode. (addr_for_mem_ref): Add ADDRSPACE argument. Use per-address-space instead of global cache. Update call to gen_addr_rtx. (valid_mem_ref_p): Update call to addr_for_mem_ref. * expr.c (expand_expr_real_1): Update call to addr_for_mem_ref. * rtl.h (convert_memory_address_addr_space): Add prototype. (convert_memory_address): Define as macro. * explow.c (convert_memory_address): Rename to ... (convert_memory_address_addr_space): ... this. Add ADDRSPACE argument. Use appropriate pointer and address modes instead of ptr_mode / Pmode. Update recursive calls. (memory_address_addr_space): Call convert_memory_address_addr_space. * expmed.c (make_tree): Likewise. * expr.c (expand_assignment): Likewise. (expand_expr_addr_expr_1): Likewise. Also, add ADDRSPACE argument. (expand_expr_addr_expr): Likewise. Also, update call. * alias.c (find_base_value): Guard pointer size optimizations. (find_base_term): Likewise. * rtlanal.c (nonzero_bits1): Likewise. (num_sign_bit_copies1): Likewise. * simplify-rtx.c (simplify_unary_operation_1): Likewise. * Makefile.in (tree-ssa-address.o): Add $(TARGET_H) dependency. (emit-rtl.o): Likewise. (auto-inc-dec.o): Likewise. (sched-deps.o): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153573 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 59 insertions(+), 11 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index dfc88077e96..43434150231 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1684,8 +1684,7 @@ integer_pow2p (const_tree expr) if (TREE_CODE (expr) != INTEGER_CST) return 0; - prec = (POINTER_TYPE_P (TREE_TYPE (expr)) - ? POINTER_SIZE : TYPE_PRECISION (TREE_TYPE (expr))); + prec = int_or_pointer_precision (TREE_TYPE (expr)); high = TREE_INT_CST_HIGH (expr); low = TREE_INT_CST_LOW (expr); @@ -1749,9 +1748,7 @@ tree_log2 (const_tree expr) if (TREE_CODE (expr) == COMPLEX_CST) return tree_log2 (TREE_REALPART (expr)); - prec = (POINTER_TYPE_P (TREE_TYPE (expr)) - ? POINTER_SIZE : TYPE_PRECISION (TREE_TYPE (expr))); - + prec = int_or_pointer_precision (TREE_TYPE (expr)); high = TREE_INT_CST_HIGH (expr); low = TREE_INT_CST_LOW (expr); @@ -1787,9 +1784,7 @@ tree_floor_log2 (const_tree expr) if (TREE_CODE (expr) == COMPLEX_CST) return tree_log2 (TREE_REALPART (expr)); - prec = (POINTER_TYPE_P (TREE_TYPE (expr)) - ? POINTER_SIZE : TYPE_PRECISION (TREE_TYPE (expr))); - + prec = int_or_pointer_precision (TREE_TYPE (expr)); high = TREE_INT_CST_HIGH (expr); low = TREE_INT_CST_LOW (expr); @@ -6746,7 +6741,10 @@ build_pointer_type_for_mode (tree to_type, enum machine_mode mode, tree build_pointer_type (tree to_type) { - return build_pointer_type_for_mode (to_type, ptr_mode, false); + addr_space_t as = to_type == error_mark_node? ADDR_SPACE_GENERIC + : TYPE_ADDR_SPACE (to_type); + enum machine_mode pointer_mode = targetm.addr_space.pointer_mode (as); + return build_pointer_type_for_mode (to_type, pointer_mode, false); } /* Same as build_pointer_type_for_mode, but for REFERENCE_TYPE. */ @@ -6810,7 +6808,10 @@ build_reference_type_for_mode (tree to_type, enum machine_mode mode, tree build_reference_type (tree to_type) { - return build_reference_type_for_mode (to_type, ptr_mode, false); + addr_space_t as = to_type == error_mark_node? ADDR_SPACE_GENERIC + : TYPE_ADDR_SPACE (to_type); + enum machine_mode pointer_mode = targetm.addr_space.pointer_mode (as); + 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 @@ -9675,7 +9676,19 @@ signed_or_unsigned_type_for (int unsignedp, tree type) { tree t = type; if (POINTER_TYPE_P (type)) - t = size_type_node; + { + /* If the pointer points to the normal address space, use the + size_type_node. Otherwise use an appropriate size for the pointer + based on the named address space it points to. */ + if (!TYPE_ADDR_SPACE (TREE_TYPE (t))) + t = size_type_node; + + else + { + int prec = int_or_pointer_precision (t); + return lang_hooks.types.type_for_size (prec, unsignedp); + } + } if (!INTEGRAL_TYPE_P (t) || TYPE_UNSIGNED (t) == unsignedp) return t; @@ -10549,6 +10562,41 @@ build_target_option_node (void) return t; } +/* Return the size in bits of an integer or pointer type. TYPE_PRECISION + contains the bits, but in the past it was not set in some cases and there + was special purpose code that checked for POINTER_TYPE_P or OFFSET_TYPE, so + check that it is consitant when assertion checking is used. */ + +unsigned int +int_or_pointer_precision (const_tree type) +{ +#if ENABLE_ASSERT_CHECKING + unsigned int prec; + + if (POINTER_TYPE_P (type)) + { + addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (type)); + prec = GET_MODE_BITSIZE (targetm.addr_space.pointer_mode (as)); + gcc_assert (prec == TYPE_PRECISION (type)); + } + else if (TREE_CODE (type) == OFFSET_TYPE) + { + prec = POINTER_SIZE; + gcc_assert (prec == TYPE_PRECISION (type)); + } + else + { + prec = TYPE_PRECISION (type); + gcc_assert (prec != 0); + } + + return prec; + +#else + return TYPE_PRECISION (type); +#endif +} + /* 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 -- cgit v1.2.1 From 7b7fcfe18ace63ba73e5c326e5a07a34224c3cd6 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 28 Oct 2009 13:52:20 +0000 Subject: 2009-10-28 Richard Guenther * tree.c (free_lang_data_in_type): Do not call get_alias_set. (free_lang_data): Unconditionally compute alias sets for all standard integer types. Bail out if gate bailed out previously. Do not reset the types_compatible_p langhook. (gate_free_lang_data): Remove. (struct pass_ipa_free_lang_data): Enable unconditionally. * gimple.c (gimple_get_alias_set): Use the same alias-set for all pointer types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153659 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 43434150231..60797254fa1 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4171,11 +4171,6 @@ free_lang_data_in_type (tree type) { gcc_assert (TYPE_P (type)); - /* Fill in the alias-set. We need to at least track zeroness here - for correctness. */ - if (lang_hooks.get_alias_set (type) == 0) - TYPE_ALIAS_SET (type) = 0; - /* Give the FE a chance to remove its own data first. */ lang_hooks.free_lang_data (type); @@ -4924,6 +4919,20 @@ free_lang_data_in_cgraph (void) static unsigned free_lang_data (void) { + unsigned i; + + /* Allocate and assign alias sets to the standard integer types + while the slots are still in the way the frontends generated them. */ + for (i = 0; i < itk_none; ++i) + if (integer_types[i]) + TYPE_ALIAS_SET (integer_types[i]) = get_alias_set (integer_types[i]); + + /* FIXME. Remove after save_debug_info is working. */ + if (!(flag_generate_lto + || (!in_lto_p + && !flag_gtoggle && debug_info_level <= DINFO_LEVEL_TERSE))) + return 0; + /* Traverse the IL resetting language specific information for operands, expressions, etc. */ free_lang_data_in_cgraph (); @@ -4951,9 +4960,9 @@ free_lang_data (void) else signed_char_type_node = char_type_node; - /* Reset some langhooks. */ + /* Reset some langhooks. Do not reset types_compatible_p, it may + still be used indirectly via the get_alias_set langhook. */ lang_hooks.callgraph.analyze_expr = NULL; - lang_hooks.types_compatible_p = NULL; lang_hooks.dwarf_name = lhd_dwarf_name; lang_hooks.decl_printable_name = gimple_decl_printable_name; lang_hooks.set_decl_assembler_name = lhd_set_decl_assembler_name; @@ -4975,24 +4984,12 @@ free_lang_data (void) } -/* Gate function for free_lang_data. */ - -static bool -gate_free_lang_data (void) -{ - /* FIXME. Remove after save_debug_info is working. */ - return (flag_generate_lto - || (!in_lto_p - && !flag_gtoggle && debug_info_level <= DINFO_LEVEL_TERSE)); -} - - struct simple_ipa_opt_pass pass_ipa_free_lang_data = { { SIMPLE_IPA_PASS, NULL, /* name */ - gate_free_lang_data, /* gate */ + NULL, /* gate */ free_lang_data, /* execute */ NULL, /* sub */ NULL, /* next */ -- cgit v1.2.1 From 42982f3eb81ef5937a47218569aa656164633a1a Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Tue, 3 Nov 2009 22:49:37 +0000 Subject: PR target/10127 PR ada/20548 * expr.h (STACK_CHECK_PROBE_INTERVAL): Delete. (STACK_CHECK_PROBE_INTERVAL_EXP): New macro. (STACK_CHECK_MOVING_SP): Likewise. * system.h (STACK_CHECK_PROBE_INTERVAL): Poison it. * doc/tm.texi (Stack Checking): Delete STACK_CHECK_PROBE_INTERVAL. Document STACK_CHECK_PROBE_INTERVAL_EXP and STACK_CHECK_MOVING_SP. * doc/md.texi (Standard Pattern Names): Tweak entry of CHECK_STACK. Document PROBE_STACK. * explow.c (anti_adjust_stack_and_probe): New function. (allocate_dynamic_stack_space): Do not directly allocate space if STACK_CHECK_MOVING_SP, instead invoke above function. (emit_stack_probe): Handle probe_stack insn. (PROBE_INTERVAL): New macro. (STACK_GROW_OPTAB): Likewise. (STACK_GROW_OFF): Likewise. (probe_stack_range): Use Pmode and memory_address consistently. Fix loop condition in the small constant case. Rewrite in the general case to be immune to wraparounds. Make sure the address of probes is valid. Try to use [base + disp] addressing mode if possible. * ira.c (setup_eliminable_regset): Set frame_pointer_needed if stack checking is enabled and STACK_CHECK_MOVING_SP. * rtlanal.c (may_trap_p_1) : If stack checking is enabled, return 1 for volatile references to the stack pointer. * tree.c (build_common_builtin_nodes): Do not set ECF_NOTHROW on __builtin_alloca if stack checking is enabled. * unwind-dw2.c (uw_identify_context): Take into account whether the context is that of a signal frame or not. * config/i386/linux.h (STACK_CHECK_MOVING_SP): Define to 1. * config/i386/linux64.h (STACK_CHECK_MOVING_SP): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153877 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 60797254fa1..f3970dd3a55 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9009,7 +9009,8 @@ build_common_builtin_nodes (void) tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); ftype = build_function_type (ptr_type_node, tmp); local_define_builtin ("__builtin_alloca", ftype, BUILT_IN_ALLOCA, - "alloca", ECF_NOTHROW | ECF_MALLOC); + "alloca", + ECF_MALLOC | (flag_stack_check ? 0 : ECF_NOTHROW)); } tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); -- cgit v1.2.1 From 1770a4b65afb87436af705fec62c9d382ef68e6f Mon Sep 17 00:00:00 2001 From: jason Date: Sun, 8 Nov 2009 03:47:44 +0000 Subject: * tree.c (reconstruct_complex_type): Preserve attributes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154007 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index f3970dd3a55..b3863340212 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9214,7 +9214,8 @@ reconstruct_complex_type (tree type, tree bottom) else return bottom; - return build_qualified_type (outer, TYPE_QUALS (type)); + return build_type_attribute_qual_variant (outer, TYPE_ATTRIBUTES (type), + TYPE_QUALS (type)); } /* Returns a vector tree node given a mode (integer, vector, or BLKmode) and -- cgit v1.2.1 From 0c297edc21c4ab6f2129cc25ed52772ad2f79a7b Mon Sep 17 00:00:00 2001 From: amylaar Date: Sun, 8 Nov 2009 21:10:08 +0000 Subject: * cfgrtl.c (pass_free_cfg): Add pass name. * cgraphbuild.c (pass_build_cgraph_edges): Likewise. (pass_rebuild_cgraph_edges, pass_remove_cgraph_callee_edges): Likewise. * dce.c (pass_ud_rtl_dce, pass_fast_rtl_dce): Change pass name. * df-core.c (pass_df_initialize_no_opt): Likewise. * except.c (pass_rtl_eh): Likewise. * function.c (pass_init_function, pass_leaf_regs): Likewise. * gcse.c (pass_rtl_pre): Change pass name. * passes.c (pass_postreload): Add pass name. (make_pass_instance): Don't use duplicate-tracking logic for names starting with '*'. (next_pass_1): Assert that pass has a name. (register_one_dump_file): If there is an space in the name, skip past it. * predict.c (pass_strip_predict_hints): Add pass name. * reg-stack.c (pass_stack_regs): Likewise. * stack-ptr-mod.c (pass_stack_ptr_mod): Likewise. * tree-cfg.c (pass_warn_function_return, pass_warn_function_noreturn): Add pass name. * tree-dfa.c (pass_referenced_vars): Likewise. * tree-optimize.c (pass_cleanup_cfg_post_optimizing): Fix whitespace before comment. (pass_fixup_cfg): Add pass name, fix whitespace before comment. (pass_init_datastructures): Add pass name. * tree-ssa-loop.c (pass_record_bounds): Likewise. * tree-ssa.c (pass_early_warn_uninitialized, pass_late_warn_uninitialized): Likewise. * tree.c (pass_ipa_free_lang_data): Likewise. * doc/passes.texi (pass manager): Document how to disambiguate pass names. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154013 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index b3863340212..3bfb527590e 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4988,7 +4988,7 @@ struct simple_ipa_opt_pass pass_ipa_free_lang_data = { { SIMPLE_IPA_PASS, - NULL, /* name */ + "*free_lang_data", /* name */ NULL, /* gate */ free_lang_data, /* execute */ NULL, /* sub */ -- cgit v1.2.1 From 3808c1b8f13faa146aa233f4d9218cc0dbc11e15 Mon Sep 17 00:00:00 2001 From: jakub Date: Thu, 19 Nov 2009 13:23:23 +0000 Subject: * tree.c (need_assembler_name_p): Use cgraph_get_node instead of cgraph_node_for_decl. * cgraph.h (cgraph_node_for_decl): Remove prototype. * cgraph.c (cgraph_node_for_decl): Remove. (cgraph_get_node): Just return NULL if !cgraph_hash. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154329 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 3bfb527590e..df24eb4ad59 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4289,7 +4289,7 @@ need_assembler_name_p (tree decl) return false; /* Functions represented in the callgraph need an assembler name. */ - if (cgraph_node_for_decl (decl) != NULL) + if (cgraph_get_node (decl) != NULL) return true; /* Unused and not public functions don't need an assembler name. */ -- cgit v1.2.1 From abd3c4756d6834ee72393b3a9d3343aad8d7236f Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 19 Nov 2009 15:45:48 +0000 Subject: 2009-11-19 Richard Guenther * gimple.c (canonicalize_cond_expr_cond): Strip conversions around truth-valued expressions. * tree.c (free_lang_data): Untangle check for LTO frontend. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154332 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index df24eb4ad59..76e23f7b74a 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4921,6 +4921,10 @@ free_lang_data (void) { unsigned i; + /* If we are the LTO frontend we have freed lang-specific data already. */ + if (in_lto_p) + return 0; + /* Allocate and assign alias sets to the standard integer types while the slots are still in the way the frontends generated them. */ for (i = 0; i < itk_none; ++i) @@ -4929,8 +4933,7 @@ free_lang_data (void) /* FIXME. Remove after save_debug_info is working. */ if (!(flag_generate_lto - || (!in_lto_p - && !flag_gtoggle && debug_info_level <= DINFO_LEVEL_TERSE))) + || (!flag_gtoggle && debug_info_level <= DINFO_LEVEL_TERSE))) return 0; /* Traverse the IL resetting language specific information for -- cgit v1.2.1 From 8cee8dc0e0c993d62de992c0b1acdd962232c48d Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 24 Nov 2009 15:37:32 +0000 Subject: * tree.h (union tree_ann_d): Don't declare. (tree_base): Remove ann field. (struct var_ann_d): Declare forward. (tree_result_decl, tree_parm_decl, tree_var_decl): Add ann field. (DECL_VAR_ANN_PTR): New macro. * tree-dfa.c (create_var_ann): Rewrite in terms of above macro, accept only VAR, PARM or RESULT decls. (create_tree_common_ann): Remove. (remove_referenced_var): Use DECL_VAR_ANN_PTR. * tree-eh.c (lookup_expr_eh_lp): Remove. * tree-flow-inline.h (var_ann, get_var_ann): Rewrite in terms of DECL_VAR_ANN_PTR. (ann_type, tree_common_ann, get_tree_common_ann): Remove. * tree-flow.h (enum tree_ann_type): Remove. (struct tree_ann_common_d): Remove. (struct var_ann_d): Remove common field. (union tree_ann_d): Remove. (tree_ann_t, tree_ann_common_t): Remove typedefs. (tree_common_ann, get_tree_common_ann, ann_type, create_tree_common_ann, lookup_expr_eh_lp): Don't declare. * tree-ssa.c (delete_tree_ssa): Use DECL_VAR_ANN_PTR. * tree.c (copy_node_stat): Use DECL_VAR_ANN_PTR. * builtins.c (expand_builtin_memcpy): Use currently_expanding_gimple_stmt instead of tree annotation. (expand_builtin_memset_args): Ditto. * cfgexpand.c (currently_expanding_gimple_stmt): Add global variable. (expand_call_stmt): Don't set tree annotation. (expand_gimple_basic_block): Set currently_expanding_gimple_stmt. * expr.c (expand_expr_real): Don't call lookup_expr_eh_lp. * gimple.h (currently_expanding_gimple_stmt): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154502 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 76e23f7b74a..a40c36ecf73 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -955,7 +955,8 @@ copy_node_stat (tree node MEM_STAT_DECL) TREE_CHAIN (t) = 0; TREE_ASM_WRITTEN (t) = 0; TREE_VISITED (t) = 0; - t->base.ann = 0; + if (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL) + *DECL_VAR_ANN_PTR (t) = 0; if (TREE_CODE_CLASS (code) == tcc_declaration) { -- cgit v1.2.1 From 48e1416a24d50cacbb2a5e06a9ee61dd8cbee313 Mon Sep 17 00:00:00 2001 From: hjl Date: Wed, 25 Nov 2009 10:55:54 +0000 Subject: Remove trailing white spaces. 2009-11-25 H.J. Lu * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154645 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 130 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 65 insertions(+), 65 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index a40c36ecf73..dc4820981ed 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -196,13 +196,13 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (union tree_node))) /* General tree->tree mapping structure for use in hash tables. */ -static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) +static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) htab_t debug_expr_for_decl; -static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) +static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) htab_t value_expr_for_decl; -static GTY ((if_marked ("tree_priority_map_marked_p"), +static GTY ((if_marked ("tree_priority_map_marked_p"), param_is (struct tree_priority_map))) htab_t init_priority_for_decl; @@ -273,7 +273,7 @@ static inline enum tree_node_structure_enum tree_node_structure_for_code (enum tree_code code) { switch (TREE_CODE_CLASS (code)) - { + { case tcc_declaration: { switch (code) @@ -367,7 +367,7 @@ initialize_tree_contains_struct (void) MARK_TS_COMMON (C); \ tree_contains_struct[C][TS_DECL_MINIMAL] = 1; \ } while (0) - + #define MARK_TS_DECL_COMMON(C) \ do { \ MARK_TS_DECL_MINIMAL (C); \ @@ -543,7 +543,7 @@ init_ttree (void) int_cst_hash_table = htab_create_ggc (1024, int_cst_hash_hash, int_cst_hash_eq, NULL); - + int_cst_node = make_node (INTEGER_CST); cl_option_hash_table = htab_create_ggc (64, cl_option_hash_hash, @@ -584,7 +584,7 @@ decl_assembler_name_equal (tree decl, const_tree asmname) 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 @@ -844,7 +844,7 @@ make_node_stat (enum tree_code code MEM_STAT_DECL) break; } break; - + default: gcc_unreachable (); } @@ -986,7 +986,7 @@ copy_node_stat (tree node MEM_STAT_DECL) but the optimizer should catch that. */ TYPE_SYMTAB_POINTER (t) = 0; TYPE_SYMTAB_ADDRESS (t) = 0; - + /* Do not copy the values cache. */ if (TYPE_CACHED_VALUES_P(t)) { @@ -1187,7 +1187,7 @@ build_int_cst_wide (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi) TREE_INT_CST_LOW (t) = low; TREE_INT_CST_HIGH (t) = hi; TREE_TYPE (t) = type; - + TREE_VEC_ELT (TYPE_CACHED_VALUES (type), ix) = t; } } @@ -1456,7 +1456,7 @@ build_string (int len, const char *str) #ifdef GATHER_STATISTICS tree_node_counts[(int) c_kind]++; tree_node_sizes[(int) c_kind] += length; -#endif +#endif s = ggc_alloc_tree (length); @@ -4206,7 +4206,7 @@ free_lang_data_in_type (tree type) } } } - + /* Remove members that are not actually FIELD_DECLs from the field list of an aggregate. These occur in C++. */ if (RECORD_OR_UNION_TYPE_P (type)) @@ -4218,7 +4218,7 @@ free_lang_data_in_type (tree type) 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. */ prev = NULL_TREE; member = TYPE_FIELDS (type); @@ -4454,7 +4454,7 @@ free_lang_data_in_decl (tree decl) else if (TREE_CODE (decl) == TYPE_DECL) { DECL_INITIAL (decl) = NULL_TREE; - + /* DECL_CONTEXT is overloaded as DECL_FIELD_CONTEXT for FIELD_DECLs, which should be preserved. Otherwise, we shouldn't be concerned with source-level lexical @@ -4988,7 +4988,7 @@ free_lang_data (void) } -struct simple_ipa_opt_pass pass_ipa_free_lang_data = +struct simple_ipa_opt_pass pass_ipa_free_lang_data = { { SIMPLE_IPA_PASS, @@ -5023,10 +5023,10 @@ is_attribute_with_length_p (const char *attr, int attr_len, const_tree ident) if (TREE_CODE (ident) != IDENTIFIER_NODE) return 0; - + p = IDENTIFIER_POINTER (ident); ident_len = IDENTIFIER_LENGTH (ident); - + if (ident_len == attr_len && strcmp (attr, p) == 0) return 1; @@ -5208,12 +5208,12 @@ merge_dllimport_decl_attributes (tree old, tree new_tree) 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. */ + of the order of declaration. */ if (!VAR_OR_FUNCTION_DECL_P (new_tree)) delete_dllimport_p = 0; else if (DECL_DLLIMPORT_P (new_tree) && lookup_attribute ("dllexport", DECL_ATTRIBUTES (old))) - { + { DECL_DLLIMPORT_P (new_tree) = 0; warning (OPT_Wattributes, "%q+D already declared with dllexport attribute: " "dllimport ignored", new_tree); @@ -5239,7 +5239,7 @@ merge_dllimport_decl_attributes (tree old, tree new_tree) } /* Let an inline definition silently override the external reference, - but otherwise warn about attribute inconsistency. */ + but otherwise warn about attribute inconsistency. */ else if (TREE_CODE (new_tree) == VAR_DECL || !DECL_DECLARED_INLINE_P (new_tree)) warning (OPT_Wattributes, "%q+D redeclared without dllimport attribute: " @@ -5250,11 +5250,11 @@ merge_dllimport_decl_attributes (tree old, tree new_tree) a = merge_attributes (DECL_ATTRIBUTES (old), DECL_ATTRIBUTES (new_tree)); - if (delete_dllimport_p) + if (delete_dllimport_p) { tree prev, t; - const size_t attr_len = strlen ("dllimport"); - + const size_t attr_len = strlen ("dllimport"); + /* Scan the list for dllimport and delete it. */ for (prev = NULL_TREE, t = a; t; prev = t, t = TREE_CHAIN (t)) { @@ -5335,7 +5335,7 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags, any damage. */ if (is_dllimport) { - /* Honor any target-specific overrides. */ + /* Honor any target-specific overrides. */ if (!targetm.valid_dllimport_attribute_p (node)) *no_add_attrs = true; @@ -5343,7 +5343,7 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags, && DECL_DECLARED_INLINE_P (node)) { warning (OPT_Wattributes, "inline function %q+D declared as " - " dllimport: attribute ignored", node); + " dllimport: attribute ignored", node); *no_add_attrs = true; } /* Like MS, treat definition of dllimported variables and @@ -5400,7 +5400,7 @@ handle_dll_attribute (tree * pnode, tree name, tree args, int flags, if (DECL_VISIBILITY_SPECIFIED (node) && DECL_VISIBILITY (node) != VISIBILITY_DEFAULT) error ("%qE implies default visibility, but %qD has already " - "been declared with a different visibility", + "been declared with a different visibility", name, node); DECL_VISIBILITY (node) = VISIBILITY_DEFAULT; DECL_VISIBILITY_SPECIFIED (node) = 1; @@ -5486,7 +5486,7 @@ build_qualified_type (tree type, int type_quals) else /* T is its own canonical type. */ TYPE_CANONICAL (t) = t; - + } return t; @@ -5501,7 +5501,7 @@ tree build_distinct_type_copy (tree type) { tree t = copy_node (type); - + TYPE_POINTER_TO (t) = 0; TYPE_REFERENCE_TO (t) = 0; @@ -5539,7 +5539,7 @@ build_variant_type_copy (tree type) /* Since we're building a variant, assume that it is a non-semantic variant. This also propagates TYPE_STRUCTURAL_EQUALITY_P. */ TYPE_CANONICAL (t) = TYPE_CANONICAL (type); - + /* Add the new type to the chain of variants of TYPE. */ TYPE_NEXT_VARIANT (t) = TYPE_NEXT_VARIANT (m); TYPE_NEXT_VARIANT (m) = t; @@ -5646,7 +5646,7 @@ decl_init_priority_insert (tree decl, priority_type priority) gcc_assert (VAR_OR_FUNCTION_DECL_P (decl)); h = decl_priority_info (decl); h->init = priority; -} +} /* Set the finalization priority for DECL to PRIORITY. */ @@ -5658,7 +5658,7 @@ decl_fini_priority_insert (tree decl, priority_type priority) gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); h = decl_priority_info (decl); h->fini = priority; -} +} /* Print out the statistics for the DECL_DEBUG_EXPR hash table. */ @@ -5684,7 +5684,7 @@ print_value_expr_statistics (void) /* Lookup a debug expression for FROM, and return it if we find one. */ -tree +tree decl_debug_expr_lookup (tree from) { struct tree_map *h, in; @@ -5711,11 +5711,11 @@ decl_debug_expr_insert (tree from, tree to) h->to = to; loc = htab_find_slot_with_hash (debug_expr_for_decl, h, h->hash, INSERT); *(struct tree_map **) loc = h; -} +} /* Lookup a value expression for FROM, and return it if we find one. */ -tree +tree decl_value_expr_lookup (tree from) { struct tree_map *h, in; @@ -5782,7 +5782,7 @@ type_hash_eq (const void *va, const void *vb) TYPE_ATTRIBUTES (b->type)) || TYPE_ALIGN (a->type) != TYPE_ALIGN (b->type) || TYPE_MODE (a->type) != TYPE_MODE (b->type) - || (TREE_CODE (a->type) != COMPLEX_TYPE + || (TREE_CODE (a->type) != COMPLEX_TYPE && TYPE_NAME (a->type) != TYPE_NAME (b->type))) return 0; @@ -6612,7 +6612,7 @@ iterative_hash_expr (const_tree t, hashval_t val) else { gcc_assert (IS_EXPR_CODE_CLASS (tclass)); - + val = iterative_hash_object (code, val); /* Don't hash the type, that can lead to having nodes which @@ -6793,7 +6793,7 @@ build_reference_type_for_mode (tree to_type, enum machine_mode mode, if (TYPE_STRUCTURAL_EQUALITY_P (to_type)) SET_TYPE_STRUCTURAL_EQUALITY (t); else if (TYPE_CANONICAL (to_type) != to_type) - TYPE_CANONICAL (t) + TYPE_CANONICAL (t) = build_reference_type_for_mode (TYPE_CANONICAL (to_type), mode, can_alias_all); @@ -7027,7 +7027,7 @@ build_array_type (tree elt_type, tree index_type) SET_TYPE_STRUCTURAL_EQUALITY (t); else if (TYPE_CANONICAL (elt_type) != elt_type || (index_type && TYPE_CANONICAL (index_type) != index_type)) - TYPE_CANONICAL (t) + TYPE_CANONICAL (t) = build_array_type (TYPE_CANONICAL (elt_type), index_type ? TYPE_CANONICAL (index_type) : NULL); } @@ -7048,7 +7048,7 @@ strip_array_types (tree type) } /* Computes the canonical argument types from the argument type list - ARGTYPES. + 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 @@ -7062,14 +7062,14 @@ strip_array_types (tree type) canonical argument list is unneeded (i.e., *ANY_STRUCTURAL_P is true) or would not differ from ARGTYPES. */ -static tree -maybe_canonicalize_argtypes(tree argtypes, +static tree +maybe_canonicalize_argtypes(tree argtypes, bool *any_structural_p, bool *any_noncanonical_p) { tree arg; bool any_noncanonical_argtypes_p = false; - + for (arg = argtypes; arg && !(*any_structural_p); arg = TREE_CHAIN (arg)) { if (!TREE_VALUE (arg) || TREE_VALUE (arg) == error_mark_node) @@ -7153,7 +7153,7 @@ build_function_type (tree value_type, tree arg_types) /* Set up the canonical type. */ any_structural_p = TYPE_STRUCTURAL_EQUALITY_P (value_type); any_noncanonical_p = TYPE_CANONICAL (value_type) != value_type; - canon_argtypes = maybe_canonicalize_argtypes (arg_types, + canon_argtypes = maybe_canonicalize_argtypes (arg_types, &any_structural_p, &any_noncanonical_p); if (any_structural_p) @@ -7161,7 +7161,7 @@ build_function_type (tree value_type, tree arg_types) else if (any_noncanonical_p) TYPE_CANONICAL (t) = build_function_type (TYPE_CANONICAL (value_type), canon_argtypes); - + if (!COMPLETE_TYPE_P (t)) layout_type (t); return t; @@ -7227,8 +7227,8 @@ build_function_type_skip_args (tree orig_type, bitmap args_to_skip) return new_type; } -/* Build variant of function type ORIG_TYPE skipping ARGS_TO_SKIP. - +/* Build variant of function type ORIG_TYPE skipping ARGS_TO_SKIP. + Arguments from DECL_ARGUMENTS list can't be removed now, since they are linked by TREE_CHAIN directly. It is caller responsibility to eliminate them when they are being duplicated (i.e. copy_arguments_for_versioning). */ @@ -7366,7 +7366,7 @@ build_method_type_directly (tree basetype, if (any_structural_p) SET_TYPE_STRUCTURAL_EQUALITY (t); else if (any_noncanonical_p) - TYPE_CANONICAL (t) + TYPE_CANONICAL (t) = build_method_type_directly (TYPE_CANONICAL (basetype), TYPE_CANONICAL (rettype), canon_argtypes); @@ -7422,7 +7422,7 @@ build_offset_type (tree basetype, tree type) SET_TYPE_STRUCTURAL_EQUALITY (t); else if (TYPE_CANONICAL (TYPE_MAIN_VARIANT (basetype)) != basetype || TYPE_CANONICAL (type) != type) - TYPE_CANONICAL (t) + TYPE_CANONICAL (t) = build_offset_type (TYPE_CANONICAL (TYPE_MAIN_VARIANT (basetype)), TYPE_CANONICAL (type)); } @@ -7459,7 +7459,7 @@ build_complex_type (tree component_type) if (TYPE_STRUCTURAL_EQUALITY_P (component_type)) SET_TYPE_STRUCTURAL_EQUALITY (t); else if (TYPE_CANONICAL (component_type) != component_type) - TYPE_CANONICAL (t) + TYPE_CANONICAL (t) = build_complex_type (TYPE_CANONICAL (component_type)); } @@ -7888,7 +7888,7 @@ get_type_static_bounds (const_tree type, mpz_t min, mpz_t max) } } - if (!POINTER_TYPE_P (type) && TYPE_MAX_VALUE (type) + if (!POINTER_TYPE_P (type) && TYPE_MAX_VALUE (type) && TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST) mpz_set_double_int (max, tree_to_double_int (TYPE_MAX_VALUE (type)), TYPE_UNSIGNED (type)); @@ -8337,7 +8337,7 @@ tree_check_failed (const_tree node, const char *file, while ((code = va_arg (args, int))) { const char *prefix = length ? " or " : "expected "; - + strcpy (tmp + length, prefix); length += strlen (prefix); strcpy (tmp + length, tree_code_name[code]); @@ -8514,9 +8514,9 @@ static const char *ts_enum_names[] = { whether CODE contains the tree structure identified by EN. */ void -tree_contains_struct_check_failed (const_tree node, +tree_contains_struct_check_failed (const_tree node, const enum tree_node_structure_enum en, - const char *file, int line, + const char *file, int line, const char *function) { internal_error @@ -8586,7 +8586,7 @@ make_vector_type (tree innertype, int nunits, enum machine_mode mode) SET_TYPE_STRUCTURAL_EQUALITY (t); else if (TYPE_CANONICAL (innertype) != innertype || mode != VOIDmode) - TYPE_CANONICAL (t) + TYPE_CANONICAL (t) = make_vector_type (TYPE_CANONICAL (innertype), nunits, VOIDmode); layout_type (t); @@ -8846,7 +8846,7 @@ build_common_tree_nodes_2 (int short_double) /* Decimal float types. */ dfloat32_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (dfloat32_type_node) = DECIMAL32_TYPE_SIZE; + TYPE_PRECISION (dfloat32_type_node) = DECIMAL32_TYPE_SIZE; layout_type (dfloat32_type_node); SET_TYPE_MODE (dfloat32_type_node, SDmode); dfloat32_ptr_type_node = build_pointer_type (dfloat32_type_node); @@ -8858,7 +8858,7 @@ build_common_tree_nodes_2 (int short_double) dfloat64_ptr_type_node = build_pointer_type (dfloat64_type_node); dfloat128_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (dfloat128_type_node) = DECIMAL128_TYPE_SIZE; + TYPE_PRECISION (dfloat128_type_node) = DECIMAL128_TYPE_SIZE; layout_type (dfloat128_type_node); SET_TYPE_MODE (dfloat128_type_node, TDmode); dfloat128_ptr_type_node = build_pointer_type (dfloat128_type_node); @@ -8931,7 +8931,7 @@ build_common_tree_nodes_2 (int short_double) declare the type to be __builtin_va_list. */ if (TREE_CODE (t) != RECORD_TYPE) t = build_variant_type_copy (t); - + va_list_type_node = t; } } @@ -9119,7 +9119,7 @@ build_common_builtin_nodes (void) /* 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 + complex. Further, we can do slightly better with folding these beasties if the real and complex parts of the arguments are separate. */ { int mode; @@ -9176,7 +9176,7 @@ tree reconstruct_complex_type (tree type, tree bottom) { tree inner, outer; - + if (TREE_CODE (type) == POINTER_TYPE) { inner = reconstruct_complex_type (TREE_TYPE (type), bottom); @@ -9204,8 +9204,8 @@ reconstruct_complex_type (tree type, tree bottom) inner = reconstruct_complex_type (TREE_TYPE (type), bottom); /* The build_method_type_directly() routine prepends 'this' to argument list, so we must compensate by getting rid of it. */ - outer - = build_method_type_directly + outer + = build_method_type_directly (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (type))), inner, TREE_CHAIN (TYPE_ARG_TYPES (type))); @@ -9363,7 +9363,7 @@ build_omp_clause (location_t loc, enum omp_clause_code code) tree_node_counts[(int) omp_clause_kind]++; tree_node_sizes[(int) omp_clause_kind] += size; #endif - + return t; } @@ -9695,7 +9695,7 @@ signed_or_unsigned_type_for (int unsignedp, tree type) if (!INTEGRAL_TYPE_P (t) || TYPE_UNSIGNED (t) == unsignedp) return t; - + return lang_hooks.types.type_for_size (TYPE_PRECISION (t), unsignedp); } @@ -9841,7 +9841,7 @@ operand_equal_for_phi_arg_p (const_tree arg0, const_tree arg1) } /* Returns number of zeros at the end of binary representation of X. - + ??? Use ffs if available? */ tree @@ -10179,7 +10179,7 @@ walk_tree_1 (tree *tp, walk_tree_fn func, void *data, 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. */ if (TREE_CODE (DECL_EXPR_DECL (*tp)) == TYPE_DECL) { -- cgit v1.2.1 From f9e8225aa5b1b3267b09494c13e47661af027c39 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 30 Nov 2009 10:49:49 +0000 Subject: 2009-11-30 Richard Guenther * tree.c (free_lang_data): Do not set debug_info_level to none if terse. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154781 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index dc4820981ed..f8fb6ce8770 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4934,7 +4934,7 @@ free_lang_data (void) /* FIXME. Remove after save_debug_info is working. */ if (!(flag_generate_lto - || (!flag_gtoggle && debug_info_level <= DINFO_LEVEL_TERSE))) + || (!flag_gtoggle && debug_info_level == DINFO_LEVEL_NONE))) return 0; /* Traverse the IL resetting language specific information for -- cgit v1.2.1 From aaf45dfea47c5442092b42425f2997f679ad8593 Mon Sep 17 00:00:00 2001 From: uweigand Date: Wed, 2 Dec 2009 13:50:52 +0000 Subject: gcc/ PR middle-end/42224 * tree.h (int_or_pointer_precision): Remove. * tree.c (int_or_pointer_precision): Remove. (integer_pow2p): Use TYPE_PRECISION instead. (tree_log2): Likewise. (tree_floor_log2): Likewise. (signed_or_unsigned_type_for): Likewise. * fold-const.c (fit_double_type): Likewise. * varasm.c (initializer_constant_valid_p): Likewise. gcc/testsuite/ PR middle-end/42224 * gcc.target/s390/pr42224.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154908 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 47 ++++------------------------------------------- 1 file changed, 4 insertions(+), 43 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index f8fb6ce8770..c533fd8c12c 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1685,7 +1685,7 @@ integer_pow2p (const_tree expr) if (TREE_CODE (expr) != INTEGER_CST) return 0; - prec = int_or_pointer_precision (TREE_TYPE (expr)); + prec = TYPE_PRECISION (TREE_TYPE (expr)); high = TREE_INT_CST_HIGH (expr); low = TREE_INT_CST_LOW (expr); @@ -1749,7 +1749,7 @@ tree_log2 (const_tree expr) if (TREE_CODE (expr) == COMPLEX_CST) return tree_log2 (TREE_REALPART (expr)); - prec = int_or_pointer_precision (TREE_TYPE (expr)); + prec = TYPE_PRECISION (TREE_TYPE (expr)); high = TREE_INT_CST_HIGH (expr); low = TREE_INT_CST_LOW (expr); @@ -1785,7 +1785,7 @@ tree_floor_log2 (const_tree expr) if (TREE_CODE (expr) == COMPLEX_CST) return tree_log2 (TREE_REALPART (expr)); - prec = int_or_pointer_precision (TREE_TYPE (expr)); + prec = TYPE_PRECISION (TREE_TYPE (expr)); high = TREE_INT_CST_HIGH (expr); low = TREE_INT_CST_LOW (expr); @@ -9685,12 +9685,8 @@ signed_or_unsigned_type_for (int unsignedp, tree type) based on the named address space it points to. */ if (!TYPE_ADDR_SPACE (TREE_TYPE (t))) t = size_type_node; - else - { - int prec = int_or_pointer_precision (t); - return lang_hooks.types.type_for_size (prec, unsignedp); - } + return lang_hooks.types.type_for_size (TYPE_PRECISION (t), unsignedp); } if (!INTEGRAL_TYPE_P (t) || TYPE_UNSIGNED (t) == unsignedp) @@ -10565,41 +10561,6 @@ build_target_option_node (void) return t; } -/* Return the size in bits of an integer or pointer type. TYPE_PRECISION - contains the bits, but in the past it was not set in some cases and there - was special purpose code that checked for POINTER_TYPE_P or OFFSET_TYPE, so - check that it is consitant when assertion checking is used. */ - -unsigned int -int_or_pointer_precision (const_tree type) -{ -#if ENABLE_ASSERT_CHECKING - unsigned int prec; - - if (POINTER_TYPE_P (type)) - { - addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (type)); - prec = GET_MODE_BITSIZE (targetm.addr_space.pointer_mode (as)); - gcc_assert (prec == TYPE_PRECISION (type)); - } - else if (TREE_CODE (type) == OFFSET_TYPE) - { - prec = POINTER_SIZE; - gcc_assert (prec == TYPE_PRECISION (type)); - } - else - { - prec = TYPE_PRECISION (type); - gcc_assert (prec != 0); - } - - return prec; - -#else - return TYPE_PRECISION (type); -#endif -} - /* 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 -- cgit v1.2.1 From 7b887394fc3b5a750271a988d6492d9527abee89 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 2 Dec 2009 17:13:51 +0000 Subject: 2009-12-02 Richard Guenther PR middle-end/42088 * tree.c (free_lang_data): Disable if not using LTO. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154918 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index c533fd8c12c..35bfd68dfcc 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4923,7 +4923,8 @@ free_lang_data (void) unsigned i; /* If we are the LTO frontend we have freed lang-specific data already. */ - if (in_lto_p) + if (in_lto_p + || !flag_generate_lto) return 0; /* Allocate and assign alias sets to the standard integer types @@ -4932,11 +4933,6 @@ free_lang_data (void) if (integer_types[i]) TYPE_ALIAS_SET (integer_types[i]) = get_alias_set (integer_types[i]); - /* FIXME. Remove after save_debug_info is working. */ - if (!(flag_generate_lto - || (!flag_gtoggle && debug_info_level == DINFO_LEVEL_NONE))) - return 0; - /* Traverse the IL resetting language specific information for operands, expressions, etc. */ free_lang_data_in_cgraph (); -- cgit v1.2.1 From 9e75edb4e4b0803280b08b960123d2bc3231d601 Mon Sep 17 00:00:00 2001 From: rguenth Date: Sat, 12 Dec 2009 01:12:55 +0000 Subject: 2009-12-12 Richard Guenther * tree.c (need_assembler_name_p): Abstract decls do not need an assembler name. * dwarf2out.c (dwarf2out_abstract_function): Preserve DECL_ABSTRACT properly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155189 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 35bfd68dfcc..769b332e244 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4273,6 +4273,10 @@ need_assembler_name_p (tree decl) || DECL_ASSEMBLER_NAME_SET_P (decl)) return false; + /* Abstract decls do not need an assembler name. */ + if (DECL_ABSTRACT (decl)) + return false; + /* For VAR_DECLs, only static, public and external symbols need an assembler name. */ if (TREE_CODE (decl) == VAR_DECL -- cgit v1.2.1 From 08a7e80f016a54ecc82107cab569ae5aa26e6700 Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 15 Dec 2009 16:30:22 +0000 Subject: 2009-12-15 Richard Guenther * tree.c (free_lang_data_in_binfo): Do not free BINFO_OFFSET and BINFO_VPTR_FIELD. (free_lang_data_in_type): Do not free TYPE_STUB_DECL if we generate debug information. (free_lang_data_in_decl): Do not free DECL_SIZE_UNIT, DECL_SIZE, DECL_FIELD_OFFSET and DECL_FCONTEXT. (free_lang_data): Do not disable debuginfo. * lto-streamer-out.c (write_symbol_vec): Deal with non-constant DECL_SIZE. (pack_ts_base_value_fields): Write types with false TREE_ASM_WRITTEN. (lto_output_ts_type_tree_pointers): Stream TYPE_STUB_DECL. * lto-streamer-in.c (lto_input_ts_type_tree_pointers): Stream TYPE_STUB_DECL. * dwarf2out.c (add_pure_or_virtual_attribute): Check for DECL_CONTEXT. (gen_type_die_for_member): Test for TYPE_STUB_DECL. * opts.c (decode_options): Do not disable var-tracking for lto. * doc/invoke.texi (-flto): Document -flto vs. -g experimental status. (-fwhopr): Document experimental status. lto/ * lto.c (lto_fixup_field_decl): Fixup DECL_FIELD_OFFSET. (lto_post_options): Do not disable debuginfo. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155259 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 42 ++++++++++-------------------------------- 1 file changed, 10 insertions(+), 32 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 769b332e244..7fa7649d2f9 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4152,13 +4152,10 @@ free_lang_data_in_binfo (tree binfo) gcc_assert (TREE_CODE (binfo) == TREE_BINFO); - BINFO_OFFSET (binfo) = NULL_TREE; BINFO_VTABLE (binfo) = NULL_TREE; - BINFO_VPTR_FIELD (binfo) = NULL_TREE; BINFO_BASE_ACCESSES (binfo) = NULL; BINFO_INHERITANCE_CHAIN (binfo) = NULL_TREE; BINFO_SUBVTT_INDEX (binfo) = NULL_TREE; - BINFO_VPTR_FIELD (binfo) = NULL_TREE; for (i = 0; VEC_iterate (tree, BINFO_BASE_BINFOS (binfo), i, t); i++) free_lang_data_in_binfo (t); @@ -4253,7 +4250,8 @@ free_lang_data_in_type (tree type) } TYPE_CONTEXT (type) = NULL_TREE; - TYPE_STUB_DECL (type) = NULL_TREE; + if (debug_info_level < DINFO_LEVEL_TERSE) + TYPE_STUB_DECL (type) = NULL_TREE; } @@ -4380,29 +4378,16 @@ free_lang_data_in_decl (tree decl) } } - if (TREE_CODE (decl) == PARM_DECL - || TREE_CODE (decl) == FIELD_DECL - || TREE_CODE (decl) == RESULT_DECL) - { - tree unit_size = DECL_SIZE_UNIT (decl); - tree size = DECL_SIZE (decl); - if ((unit_size && TREE_CODE (unit_size) != INTEGER_CST) - || (size && TREE_CODE (size) != INTEGER_CST)) - { - DECL_SIZE_UNIT (decl) = NULL_TREE; - DECL_SIZE (decl) = NULL_TREE; - } + /* ??? We could free non-constant DECL_SIZE, DECL_SIZE_UNIT + and DECL_FIELD_OFFSET. But it's cheap enough to not do + that and refrain from adding workarounds to dwarf2out.c */ - if (TREE_CODE (decl) == FIELD_DECL - && DECL_FIELD_OFFSET (decl) - && TREE_CODE (DECL_FIELD_OFFSET (decl)) != INTEGER_CST) - DECL_FIELD_OFFSET (decl) = NULL_TREE; + /* DECL_FCONTEXT is only used for debug info generation. */ + if (TREE_CODE (decl) == FIELD_DECL + && debug_info_level < DINFO_LEVEL_TERSE) + DECL_FCONTEXT (decl) = NULL_TREE; - /* DECL_FCONTEXT is only used for debug info generation. */ - if (TREE_CODE (decl) == FIELD_DECL) - DECL_FCONTEXT (decl) = NULL_TREE; - } - else if (TREE_CODE (decl) == FUNCTION_DECL) + if (TREE_CODE (decl) == FUNCTION_DECL) { if (gimple_has_body_p (decl)) { @@ -4977,13 +4962,6 @@ free_lang_data (void) diagnostic_finalizer (global_dc) = default_diagnostic_finalizer; diagnostic_format_decoder (global_dc) = default_tree_printer; - /* FIXME. We remove sufficient language data that the debug - info writer gets completely confused. Disable debug information - for now. */ - debug_info_level = DINFO_LEVEL_NONE; - write_symbols = NO_DEBUG; - debug_hooks = &do_nothing_debug_hooks; - return 0; } -- cgit v1.2.1 From 8df5a43d64487d03b55a5799f17a6c465e019062 Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 21 Jan 2010 05:49:35 +0000 Subject: * tree.h (TYPE_TRANSPARENT_UNION): Replace with ... (TYPE_TRANSPARENT_AGGR): this, for union and record. * calls.c (initialize argument_information): Handle it. * c-common.c (handle_transparent_union_attribute): Use new name. * c-decl.c (finish_struct): Ditto. * c-typeck.c (type_lists_compatible_p): Ditto. (convert_for_assignment): Use new name and also handle record. * function.c (aggregate_value_p): Handle it. (pass_by_reference): Ditto. (assign_parm_data_types): Ditto. * print-tree.c (print_node): Ditto. * lto-streamer-in.c (unpack_ts_type_value_fields): Ditto. * lto-streamer-out.c (pack_ts_type_value_fields): Ditto. * tree.c (first_field): New fn. gcc/cp/ * mangle.c (write_type): Mangle transparent record as member type. * semantics.c (begin_class_definition): Recognize decimal classes and set TYPE_TRANSPARENT_AGGR. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156106 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 7fa7649d2f9..5d44841769f 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1983,6 +1983,18 @@ fields_length (const_tree type) return count; } +/* Returns the first FIELD_DECL in the TYPE_FIELDS of the RECORD_TYPE or + UNION_TYPE TYPE, or NULL_TREE if none. */ + +tree +first_field (const_tree type) +{ + tree t = TYPE_FIELDS (type); + while (t && TREE_CODE (t) != FIELD_DECL) + t = TREE_CHAIN (t); + return t; +} + /* 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'. */ -- cgit v1.2.1 From 4d307e1ff39d0c2f90123ef789d611e2323be76d Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 10 Feb 2010 11:54:14 +0000 Subject: 2010-02-10 Richard Guenther PR c/43007 * tree.c (get_unwidened): Handle constants. * convert.c (convert_to_integer): Handle TRUNC_DIV_EXPR. * gcc.c-torture/execute/20100209-1.c: New testcase. * gcc.dg/fold-div-3.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156653 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 5d44841769f..c51cca7d6f7 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -7623,6 +7623,14 @@ get_unwidened (tree op, tree for_type) } } + /* If we finally reach a constant see if it fits in for_type and + in that case convert it. */ + if (for_type + && TREE_CODE (win) == INTEGER_CST + && TREE_TYPE (win) != for_type + && int_fits_type_p (win, for_type)) + win = fold_convert (for_type, win); + return win; } -- cgit v1.2.1 From 6816d0c461d2fa52bffa30e4a7901091d134ac3c Mon Sep 17 00:00:00 2001 From: jamborm Date: Thu, 11 Mar 2010 22:27:26 +0000 Subject: 2010-03-11 Martin Jambor PR tree-optimization/43257 * tree.c (assign_assembler_name_if_neeeded): New function. (free_lang_data_in_cgraph): Assembler name assignment moved to the above new function. * tree.h (assign_assembler_name_if_neeeded): Declare. * cgraphunit.c (cgraph_analyze_function): Create an assembler name for the function if needed. * testsuite/g++.dg/torture/pr43257.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157393 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 48 ++++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index c51cca7d6f7..86fe2bb3b62 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4831,6 +4831,33 @@ find_decls_types_in_var (struct varpool_node *v, struct free_lang_data_d *fld) find_decls_types (v->decl, fld); } +/* If T needs an assembler name, have one created for it. */ + +void +assign_assembler_name_if_neeeded (tree t) +{ + if (need_assembler_name_p (t)) + { + /* 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. */ + location_t saved_location = input_location; + input_location = DECL_SOURCE_LOCATION (t); + + decl_assembler_name (t); + + input_location = saved_location; + } +} + /* Free language specific information for every operand and expression in every node of the call graph. This process operates in three stages: @@ -4880,26 +4907,7 @@ free_lang_data_in_cgraph (void) now because free_lang_data_in_decl will invalidate data needed for mangling. This breaks mangling on interdependent decls. */ for (i = 0; VEC_iterate (tree, fld.decls, i, t); i++) - if (need_assembler_name_p (t)) - { - /* 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. */ - location_t saved_location = input_location; - input_location = DECL_SOURCE_LOCATION (t); - - decl_assembler_name (t); - - input_location = saved_location; - } + assign_assembler_name_if_neeeded (t); /* Traverse every decl found freeing its language data. */ for (i = 0; VEC_iterate (tree, fld.decls, i, t); i++) -- cgit v1.2.1 From 9c44b3951ca82eceb9be44f16a23fbd8c30240f4 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 1 Apr 2010 16:18:07 +0000 Subject: 2010-04-01 Richard Guenther PR middle-end/43614 * tree-ssa-address.c (copy_mem_ref_info): Copy TREE_SIDE_EFFECTS and TREE_THIS_VOLATILE. (copy_ref_info): Likewise. * tree-ssa-operands.c (get_tmr_operands): Check TREE_THIS_VOLATILE. * tree.c (build6_stat): Ignore side-effects of all but arg5 for TARGET_MEM_REF. Set TREE_THIS_VOLATILE from arg5 of TARGET_MEM_REF. * gcc.c-torture/compile/pr43614.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157913 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 86fe2bb3b62..863b51eda94 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3824,10 +3824,14 @@ build6_stat (enum tree_code code, tree tt, tree arg0, tree arg1, PROCESS_ARG(2); PROCESS_ARG(3); PROCESS_ARG(4); + if (code == TARGET_MEM_REF) + side_effects = 0; PROCESS_ARG(5); TREE_SIDE_EFFECTS (t) = side_effects; - TREE_THIS_VOLATILE (t) = 0; + TREE_THIS_VOLATILE (t) + = (code == TARGET_MEM_REF + && arg5 && TREE_THIS_VOLATILE (arg5)); return t; } -- cgit v1.2.1 From 6d72287b7ad40b4ebac984afcab7c2ee3577aed4 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 7 Apr 2010 10:13:25 +0000 Subject: 2010-04-07 Richard Guenther PR middle-end/42617 * emit-rtl.c (set_mem_attributes_minus_bitpos): Do not discard plain indirect references. * fold-const.c (operand_equal_p): Guard against NULL_TREE type. * tree.c (tree_nop_conversion): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158045 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 863b51eda94..b72e0578260 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -10645,6 +10645,9 @@ tree_nop_conversion (const_tree exp) outer_type = TREE_TYPE (exp); inner_type = TREE_TYPE (TREE_OPERAND (exp, 0)); + if (!inner_type) + return false; + /* Use precision rather then machine mode when we can, which gives the correct answer even for submode (bit-field) types. */ if ((INTEGRAL_TYPE_P (outer_type) -- cgit v1.2.1 From 27a1da0a637e170289281b4b1d8fa0bbcf82e2cd Mon Sep 17 00:00:00 2001 From: jakub Date: Wed, 7 Apr 2010 14:23:35 +0000 Subject: PR debug/43516 * tree.c (MAX_INT_CACHED_PREC): Define. (nonstandard_integer_type_cache): New array. (build_nonstandard_integer_type): Cache results for precision <= MAX_INT_CACHED_PREC. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158062 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index b72e0578260..30bc5be66fe 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1,6 +1,6 @@ /* Language-independent node constructors for parse phase of GNU compiler. Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -6876,6 +6876,10 @@ build_index_type (tree maxval) } } +#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]; + /* 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. */ @@ -6883,8 +6887,19 @@ tree build_nonstandard_integer_type (unsigned HOST_WIDE_INT precision, int unsignedp) { - tree itype = make_node (INTEGER_TYPE); + tree itype, ret; + if (unsignedp) + unsignedp = MAX_INT_CACHED_PREC + 1; + + if (precision <= MAX_INT_CACHED_PREC) + { + itype = nonstandard_integer_type_cache[precision + unsignedp]; + if (itype) + return itype; + } + + itype = make_node (INTEGER_TYPE); TYPE_PRECISION (itype) = precision; if (unsignedp) @@ -6892,10 +6907,13 @@ build_nonstandard_integer_type (unsigned HOST_WIDE_INT precision, else fixup_signed_type (itype); + ret = itype; if (host_integerp (TYPE_MAX_VALUE (itype), 1)) - return type_hash_canon (tree_low_cst (TYPE_MAX_VALUE (itype), 1), itype); + ret = type_hash_canon (tree_low_cst (TYPE_MAX_VALUE (itype), 1), itype); + if (precision <= MAX_INT_CACHED_PREC && lang_hooks.types.hash_types) + nonstandard_integer_type_cache[precision + unsignedp] = ret; - return itype; + return ret; } /* Create a range of some discrete type TYPE (an INTEGER_TYPE, -- cgit v1.2.1 From 4081d362fba108e17784f385774bfae44e2dcee2 Mon Sep 17 00:00:00 2001 From: jakub Date: Wed, 7 Apr 2010 20:27:37 +0000 Subject: * tree-ssa-pre.c (my_rev_post_order_compute): Remove set but not used count variable. * genemit.c (gen_expand, gen_split): Avoid set but not used warnings when operandN variables aren't used in the body of the expander or splitter. * tree-outof-ssa.c (FOR_EACH_ELIM_GRAPH_SUCC, FOR_EACH_ELIM_GRAPH_PRED): Avoid set but not used warnings. * tree-ssa-operands.h (FOR_EACH_SSA_TREE_OPERAND): Likewise. * tree-flow.h (FOR_EACH_IMM_USE_FAST, FOR_EACH_IMM_USE_STMT, FOR_EACH_IMM_USE_ON_STMT): Likewise. * tree.h (FOR_EACH_CONSTRUCTOR_ELT): Likewise. * tree.c (PROCESS_ARG): Likewise. fortran/ * parse.c (parse_derived, parse_enum): Avoid set but not used warning. java/ * expr.c (process_jvm_instruction): Avoid set but not used warning. * builtins.c (compareAndSwapInt_builtin, compareAndSwapLong_builtin, getVolatile_builtin): Likewise. libjava/ * exception.cc (_Jv_Throw): Avoid set but not used warning. * include/java-assert.h (JvAssertMessage, JvAssert): Use argument in sizeof to avoid set but not used warnings. libjava/classpath/ * native/jni/midi-alsa/gnu_javax_sound_midi_alsa_AlsaPortDevice.c (Java_gnu_javax_sound_midi_alsa_AlsaPortDevice_run_1receiver_1thread_1): Avoid set but not used warning. libiberty/ * regex.c (byte_re_match_2_internal): Avoid set but not used warning. gcc/testsuite/ * gcc.dg/builtin-choose-expr.c: Avoid set but not used warnings. * gcc.dg/trunc-1.c: Likewise. * gcc.dg/vla-9.c: Likewise. * gcc.dg/dfp/composite-type.c: Likewise. libffi/ * testsuite/libffi.call/err_bad_abi.c: Remove unused args variable. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158084 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 30bc5be66fe..5da82069131 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3652,9 +3652,9 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL) side_effects = 1; \ if (!TREE_READONLY (arg##N) \ && !CONSTANT_CLASS_P (arg##N)) \ - read_only = 0; \ + (void) (read_only = 0); \ if (!TREE_CONSTANT (arg##N)) \ - constant = 0; \ + (void) (constant = 0); \ } \ } while (0) -- cgit v1.2.1 From 412839221276fd0a251ba61296262b09352c5927 Mon Sep 17 00:00:00 2001 From: aesok Date: Wed, 14 Apr 2010 22:05:32 +0000 Subject: * double-int.h (HOST_BITS_PER_DOUBLE_INT): Define. (double_int_not, double_int_lshift, double_int_rshift): Declare. (double_int_negative_p): Convert to static inline function. * double-int.c (double_int_lshift, double_int_lshift): Add new function. (double_int_negative_p): Remove. * tree.h (lshift_double, rshift_double): * tree.c (build_low_bits_mask): Clean up, use double_int_* functions. * fold-const.c (fold_convert_const_int_from_real, fold_convert_const_int_from_fixed, div_if_zero_remainder): (Ditto.). (lshift_double): Change type of arith argument to bool. (rshift_double): Change type of arith argument to bool. Correct comment. * expmed.c (mask_rtx, lshift_value): (Ditto.). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158360 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 5da82069131..83f1237fd85 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1221,32 +1221,18 @@ build_int_cst_wide (tree type, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi) tree build_low_bits_mask (tree type, unsigned bits) { - unsigned HOST_WIDE_INT low; - HOST_WIDE_INT high; - unsigned HOST_WIDE_INT all_ones = ~(unsigned HOST_WIDE_INT) 0; + double_int mask; gcc_assert (bits <= TYPE_PRECISION (type)); if (bits == TYPE_PRECISION (type) && !TYPE_UNSIGNED (type)) - { - /* Sign extended all-ones mask. */ - low = all_ones; - high = -1; - } - else if (bits <= HOST_BITS_PER_WIDE_INT) - { - low = all_ones >> (HOST_BITS_PER_WIDE_INT - bits); - high = 0; - } + /* Sign extended all-ones mask. */ + mask = double_int_minus_one; else - { - bits -= HOST_BITS_PER_WIDE_INT; - low = all_ones; - high = all_ones >> (HOST_BITS_PER_WIDE_INT - bits); - } + mask = double_int_mask (bits); - return build_int_cst_wide (type, low, high); + return build_int_cst_wide (type, mask.low, mask.high); } /* Checks that X is integer constant that can be expressed in (unsigned) -- cgit v1.2.1 From 1a981e1a975098bd537556d2b36f275f3bc075c7 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 15 Apr 2010 13:16:44 +0000 Subject: 2010-04-15 Richard Guenther * tree-ssa-structalias.c (struct variable_info): Add is_fn_info flag. (new_var_info): Initialize it. (dump_constraints): Support printing last added constraints. (debug_constraints): Adjust. (dump_constraint_graph): Likewise. (make_heapvar_for): Check for NULL cfun. (get_function_part_constraint): New function. (get_fi_for_callee): Likewise. (find_func_aliases): Properly implement IPA PTA constraints. (process_ipa_clobber): New function. (find_func_clobbers): Likewise. (insert_into_field_list_sorted): Remove. (create_function_info_for): Properly allocate vars for IPA mode. Do not use insert_into_field_list_sorted. (create_variable_info_for): Properly generate constraints for global vars in IPA mode. (dump_solution_for_var): Always dump the solution. (set_uids_in_ptset): Initialize DECL_PT_UID if in ipa-mode. (find_what_var_points_to): Adjust. (pt_solution_set): Change. (pt_solution_ior_into): New function. (pt_solution_empty_p): Export. (pt_solution_includes_global): Adjust. (pt_solution_includes_1): Likewise. (pt_solutions_intersect_1): Likewise. (dump_sa_points_to_info): Check some invariants. (solve_constraints): Move constraint dumping ... (compute_points_to_sets): ... here. (ipa_pta_execute): ... and here. (compute_may_aliases): Do not re-compute points-to info locally if IPA info is available. (ipa_escaped_pt): New global var. (ipa_pta_execute): Properly implement IPA PTA. * tree-into-ssa.c (dump_decl_set): Support dumping decls not in referenced-vars. * tree-flow.h (struct gimple_df): Add ipa_pta flag. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Adjust. (dump_points_to_solution): Likewise. * tree-dfa.c (dump_variable): Also dump DECL_PT_UID. * tree-inline.c (remap_ssa_name): Copy IPA points-to solution. (remap_gimple_stmt): Reset call clobber/use information if necessary. (copy_decl_to_var): Copy DECL_PT_UID. (copy_result_decl_to_var): Likewise. * tree.c (make_node_stat): Initialize DECL_PT_UID. (copy_node_stat): Copy it. * tree.h (DECL_PT_UID): New macro. (SET_DECL_PT_UID): Likewise. (DECL_PT_UID_SET_P): Likewise. (struct tree_decl_minimal): Add pt_uid member. * tree-ssa-alias.h (struct pt_solution): Add ipa_escaped flag. (pt_solution_empty_p): Declare. (pt_solution_set): Adjust. (ipa_escaped_pt): Declare. * cfgexpand.c (update_alias_info_with_stack_vars): Adjust. * gimple-pretty-print.c (pp_points_to_solution): New function. (dump_gimple_call): Dump call clobber/use information. * tree-dump.c (dump_option_value_in): Add TDF_ALIAS entry. * tree-pass.h (TDF_ALIAS): New dump option. * tree-pretty-print.c (dump_decl_name): Dump DECL_PT_UID if asked to. * doc/invoke.texi (-fipa-pta): Update documentation. * gcc.dg/ipa/ipa-pta-1.c: New testcase. * gcc.dg/ipa/ipa-pta-2.c: Likewise. * gcc.dg/ipa/ipa-pta-3.c: Likewise. * gcc.dg/ipa/ipa-pta-4.c: Likewise. * gcc.dg/ipa/ipa-pta-5.c: Likewise. * gcc.dg/ipa/ipa-pta-6.c: Likewise. * gcc.dg/ipa/ipa-pta-7.c: Likewise. * gcc.dg/ipa/ipa-pta-8.c: Likewise. * gcc.dg/ipa/ipa-pta-9.c: Likewise. * gcc.dg/ipa/ipa-pta-10.c: Likewise. * gcc.dg/ipa/ipa-pta-11.c: Likewise. * gcc.dg/ipa/ipa-pta-12.c: Likewise. * gcc.dg/ipa/ipa-pta-13.c: Likewise. * gcc.dg/torture/ipa-pta-2.c: Likewise. * gcc.dg/torture/ipa-pta-1.c: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158374 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 83f1237fd85..6ac13186675 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -883,7 +883,10 @@ make_node_stat (enum tree_code code MEM_STAT_DECL) if (TREE_CODE (t) == DEBUG_EXPR_DECL) DECL_UID (t) = --next_debug_decl_uid; else - DECL_UID (t) = next_decl_uid++; + { + DECL_UID (t) = next_decl_uid++; + SET_DECL_PT_UID (t, -1); + } if (TREE_CODE (t) == LABEL_DECL) LABEL_DECL_UID (t) = -1; @@ -963,7 +966,11 @@ copy_node_stat (tree node MEM_STAT_DECL) if (code == DEBUG_EXPR_DECL) DECL_UID (t) = --next_debug_decl_uid; else - DECL_UID (t) = next_decl_uid++; + { + DECL_UID (t) = next_decl_uid++; + if (DECL_PT_UID_SET_P (node)) + SET_DECL_PT_UID (t, DECL_PT_UID (node)); + } if ((TREE_CODE (node) == PARM_DECL || TREE_CODE (node) == VAR_DECL) && DECL_HAS_VALUE_EXPR_P (node)) { -- cgit v1.2.1 From ad086ed471d513856fff3cf8325b8d5e0ee571a4 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Sun, 18 Apr 2010 21:49:29 +0000 Subject: =?UTF-8?q?2010-04-18=20=C2=A0Eric=20Botcazou=20=C2=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fold-const.c (fold_comparison): Use ssizetype. * gimple-fold.c (maybe_fold_offset_to_array_ref): Likewise. * ipa-prop.c (ipa_modify_call_arguments): Use sizetype. * tree-loop-distribution.c (build_size_arg_loc): Likewise. * tree-object-size.c (compute_object_sizes): Use size_type_node. * tree.h (initialize_sizetypes): Remove parameter. (build_common_tree_nodes): Remove second parameter. * stor-layout.c (initialize_sizetypes): Remove parameter. Always create an unsigned type. (set_sizetype): Assert that the passed type is unsigned and simplify. * tree.c (build_common_tree_nodes): Remove second parameter. Adjust call to initialize_sizetypes. * c-decl.c (c_init_decl_processing): Remove second argument in call to build_common_tree_nodes. cp/ * decl.c (cxx_init_decl_processing): Remove second argument in call to build_common_tree_nodes. java/ * decl.c (java_init_decl_processing): Remove argument in call to initialize_sizetypes fortran/ * f95-lang.c (gfc_init_decl_processing): Remove second argument in call to build_common_tree_nodes. ada/ * gcc-interface/misc.c (gnat_init): Remove second argument in call to build_common_tree_nodes. lto/ * lto-lang.c (lto_init): Remove second argument in call to build_common_tree_nodes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158496 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 6ac13186675..0eab137863b 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -8747,12 +8747,12 @@ make_or_reuse_accum_type (unsigned size, int unsignedp, int satp) this function to select one of the types as sizetype. */ void -build_common_tree_nodes (bool signed_char, bool signed_sizetype) +build_common_tree_nodes (bool signed_char) { error_mark_node = make_node (ERROR_MARK); TREE_TYPE (error_mark_node) = error_mark_node; - initialize_sizetypes (signed_sizetype); + initialize_sizetypes (); /* Define both `signed char' and `unsigned char'. */ signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE); -- cgit v1.2.1 From 712afa458d060ce5a7b4e23702faa0f34d2eeee3 Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 23 Apr 2010 14:20:59 +0000 Subject: 2010-04-23 Richard Guenther PR lto/42653 * tree.c (free_lang_data_in_decl): Do not reset DECL_CONTEXT of FUNCTION_DECLs. * g++.dg/lto/20100423-1_0.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158666 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 0eab137863b..561367bdd43 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4361,7 +4361,8 @@ free_lang_data_in_decl (tree decl) /* Ignore any intervening types, because we are going to clear their TYPE_CONTEXT fields. */ - if (TREE_CODE (decl) != FIELD_DECL) + if (TREE_CODE (decl) != FIELD_DECL + && TREE_CODE (decl) != FUNCTION_DECL) DECL_CONTEXT (decl) = decl_function_context (decl); if (DECL_CONTEXT (decl) -- cgit v1.2.1 From be9d48ea44a0bf260a2384f5fb44607266119851 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 26 Apr 2010 09:13:00 +0000 Subject: 2010-04-26 Richard Guenther PR lto/42425 * tree.c (free_lang_data_in_type): Do not free TYPE_CONTEXT if emitting debug information and it is either a function or a namespace decl. * g++.dg/lto/20100423-2_0.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158722 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 561367bdd43..8eeecff7122 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4258,7 +4258,12 @@ free_lang_data_in_type (tree type) TYPE_LANG_SLOT_1 (type) = NULL_TREE; } - TYPE_CONTEXT (type) = NULL_TREE; + if (debug_info_level < DINFO_LEVEL_TERSE + || (TYPE_CONTEXT (type) + && TREE_CODE (TYPE_CONTEXT (type)) != FUNCTION_DECL + && TREE_CODE (TYPE_CONTEXT (type)) != NAMESPACE_DECL)) + TYPE_CONTEXT (type) = NULL_TREE; + if (debug_info_level < DINFO_LEVEL_TERSE) TYPE_STUB_DECL (type) = NULL_TREE; } -- cgit v1.2.1 From 877fe38069155cb84a4b8a32e6245039c6c58248 Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 30 Apr 2010 11:24:16 +0000 Subject: PR debug/43942 * tree.c (auto_var_in_fn_p): Return false for DECL_EXTERNAL vars. * c-c++-common/pr43942.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158931 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 8eeecff7122..24482af95d8 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -7936,7 +7936,8 @@ bool auto_var_in_fn_p (const_tree var, const_tree fn) { return (DECL_P (var) && DECL_CONTEXT (var) == fn - && (((TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == PARM_DECL) + && ((((TREE_CODE (var) == VAR_DECL && ! DECL_EXTERNAL (var)) + || TREE_CODE (var) == PARM_DECL) && ! TREE_STATIC (var)) || TREE_CODE (var) == LABEL_DECL || TREE_CODE (var) == RESULT_DECL)); -- cgit v1.2.1 From b79dc18ae87999996a7b365f056c73011f2b3388 Mon Sep 17 00:00:00 2001 From: aesok Date: Mon, 3 May 2010 16:21:15 +0000 Subject: * double-int.h (tree_to_double_int): Remove macro. (double_int_to_tree, double_int_fits_to_tree_p): Move prototypes ... * tree.h (double_int_to_tree, double_int_fits_to_tree_p): ... here. (tree_to_double_int): New function. * double-int.c (double_int_to_tree, double_int_fits_to_tree_p): Move ... * tree.c (double_int_to_tree, double_int_fits_to_tree_p): ... here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158993 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 24482af95d8..b8f80deaf69 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1082,6 +1082,30 @@ build_int_cst_wide_type (tree type, return build_int_cst_wide (type, low, high); } +/* 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. */ + +tree +double_int_to_tree (tree type, double_int cst) +{ + cst = double_int_ext (cst, TYPE_PRECISION (type), TYPE_UNSIGNED (type)); + + return build_int_cst_wide (type, cst.low, cst.high); +} + +/* Returns true if CST fits into range of TYPE. Signedness of CST is assumed + to be the same as the signedness of TYPE. */ + +bool +double_int_fits_to_tree_p (const_tree type, double_int cst) +{ + double_int ext = double_int_ext (cst, + TYPE_PRECISION (type), + TYPE_UNSIGNED (type)); + + return double_int_equal_p (cst, ext); +} + /* These are the hash table functions for the hash table of INTEGER_CST nodes of a sizetype. */ -- cgit v1.2.1 From 621b002b1fbe2e8e52eeb5981a6f372a80129541 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Tue, 4 May 2010 17:47:52 +0000 Subject: * tree.c (free_lang_data_in_one_sizepos): New inline function. (free_lang_data_in_type): Call it on TYPE_{MIN|MAX}_VALUE of numerical types. Call it on TYPE_SIZE and TYPE_SIZE_UNIT of all types. (free_lang_data_in_decl): Call it on DECL_SIZE and DECL_SIZE_UNIT of all decls. Call it on DECL_FIELD_OFFSET of fields. (find_decls_types_r): Follow DECL_VALUE_EXPR. (iterative_hash_expr) : New case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159039 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 49 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index b8f80deaf69..b9eeb3d9693 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4174,6 +4174,26 @@ build_type_attribute_variant (tree ttype, tree attribute) } +/* 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. */ + +static inline void +free_lang_data_in_one_sizepos (tree *expr_p) +{ + tree expr = *expr_p; + if (CONTAINS_PLACEHOLDER_P (expr)) + *expr_p = build0 (PLACEHOLDER_EXPR, TREE_TYPE (expr)); +} + + /* Reset all the fields in a binfo node BINFO. We only keep BINFO_VIRTUALS, which is used by gimple_fold_obj_type_ref. */ @@ -4280,8 +4300,19 @@ free_lang_data_in_type (tree type) /* For non-aggregate types, clear out the language slot (which overloads TYPE_BINFO). */ TYPE_LANG_SLOT_1 (type) = NULL_TREE; + + if (INTEGRAL_TYPE_P (type) + || SCALAR_FLOAT_TYPE_P (type) + || FIXED_POINT_TYPE_P (type)) + { + free_lang_data_in_one_sizepos (&TYPE_MIN_VALUE (type)); + free_lang_data_in_one_sizepos (&TYPE_MAX_VALUE (type)); + } } + free_lang_data_in_one_sizepos (&TYPE_SIZE (type)); + free_lang_data_in_one_sizepos (&TYPE_SIZE_UNIT (type)); + if (debug_info_level < DINFO_LEVEL_TERSE || (TYPE_CONTEXT (type) && TREE_CODE (TYPE_CONTEXT (type)) != FUNCTION_DECL @@ -4417,9 +4448,10 @@ free_lang_data_in_decl (tree decl) } } - /* ??? We could free non-constant DECL_SIZE, DECL_SIZE_UNIT - and DECL_FIELD_OFFSET. But it's cheap enough to not do - that and refrain from adding workarounds to dwarf2out.c */ + free_lang_data_in_one_sizepos (&DECL_SIZE (decl)); + free_lang_data_in_one_sizepos (&DECL_SIZE_UNIT (decl)); + if (TREE_CODE (decl) == FIELD_DECL) + free_lang_data_in_one_sizepos (&DECL_FIELD_OFFSET (decl)); /* DECL_FCONTEXT is only used for debug info generation. */ if (TREE_CODE (decl) == FIELD_DECL @@ -4633,6 +4665,10 @@ find_decls_types_r (tree *tp, int *ws, void *data) fld_worklist_push (DECL_COMDAT_GROUP (t), fld); } + if ((TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == PARM_DECL) + && DECL_HAS_VALUE_EXPR_P (t)) + fld_worklist_push (DECL_VALUE_EXPR (t), fld); + if (TREE_CODE (t) != FIELD_DECL) fld_worklist_push (TREE_CHAIN (t), fld); *ws = 0; @@ -6591,11 +6627,12 @@ iterative_hash_expr (const_tree t, hashval_t val) return iterative_hash_expr (TREE_IMAGPART (t), val); case VECTOR_CST: return iterative_hash_expr (TREE_VECTOR_CST_ELTS (t), val); - case SSA_NAME: - /* we can just compare by pointer. */ + /* We can just compare by pointer. */ return iterative_hash_host_wide_int (SSA_NAME_VERSION (t), val); - + case PLACEHOLDER_EXPR: + /* The node itself doesn't matter. */ + return val; case TREE_LIST: /* A list of expressions, for a CALL_EXPR or as the elements of a VECTOR_CST. */ -- cgit v1.2.1 From ea181df02d140bae7e14ba78713fd721ae3c17db Mon Sep 17 00:00:00 2001 From: mkuvyrkov Date: Thu, 6 May 2010 10:28:46 +0000 Subject: * tree.c (initializer_zerop): Handle STRING_CST. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159103 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index b9eeb3d9693..c45e807b43d 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9414,6 +9414,19 @@ initializer_zerop (const_tree init) return true; } + case STRING_CST: + { + int i; + + /* We need to loop through all elements to handle cases like + "\0" and "\0foobar". */ + for (i = 0; i < TREE_STRING_LENGTH (init); ++i) + if (TREE_STRING_POINTER (init)[i] != '\0') + return false; + + return true; + } + default: return false; } -- cgit v1.2.1 From 8ce9d9df2f188cd5a7f61f4398a5850bbc5fdba3 Mon Sep 17 00:00:00 2001 From: froydnj Date: Wed, 12 May 2010 15:29:51 +0000 Subject: * tree.c (build_constructor): Compute TREE_CONSTANT for the resultant constructor. (build_constructor_single): Don't set TREE_CONSTANT. (build_constructor_from_list): Don't compute TREE_CONSTANT. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159325 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index c45e807b43d..934536f2479 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1332,8 +1332,22 @@ tree build_constructor (tree type, VEC(constructor_elt,gc) *vals) { tree c = make_node (CONSTRUCTOR); + unsigned int i; + constructor_elt *elt; + bool constant_p = true; + TREE_TYPE (c) = type; CONSTRUCTOR_ELTS (c) = vals; + + for (i = 0; VEC_iterate (constructor_elt, vals, i, elt); i++) + if (!TREE_CONSTANT (elt->value)) + { + constant_p = false; + break; + } + + TREE_CONSTANT (c) = constant_p; + return c; } @@ -1344,16 +1358,13 @@ build_constructor_single (tree type, tree index, tree value) { VEC(constructor_elt,gc) *v; constructor_elt *elt; - tree t; v = VEC_alloc (constructor_elt, gc, 1); elt = VEC_quick_push (constructor_elt, v, NULL); elt->index = index; elt->value = value; - t = build_constructor (type, v); - TREE_CONSTANT (t) = TREE_CONSTANT (value); - return t; + return build_constructor (type, v); } @@ -1362,27 +1373,17 @@ build_constructor_single (tree type, tree index, tree value) tree build_constructor_from_list (tree type, tree vals) { - tree t, val; + tree t; VEC(constructor_elt,gc) *v = NULL; - bool constant_p = true; if (vals) { v = VEC_alloc (constructor_elt, gc, list_length (vals)); for (t = vals; t; t = TREE_CHAIN (t)) - { - constructor_elt *elt = VEC_quick_push (constructor_elt, v, NULL); - val = TREE_VALUE (t); - elt->index = TREE_PURPOSE (t); - elt->value = val; - if (!TREE_CONSTANT (val)) - constant_p = false; - } + CONSTRUCTOR_APPEND_ELT (v, TREE_PURPOSE (t), TREE_VALUE (t)); } - t = build_constructor (type, v); - TREE_CONSTANT (t) = constant_p; - return t; + return build_constructor (type, v); } /* Return a new FIXED_CST node whose type is TYPE and value is F. */ -- cgit v1.2.1 From 2b5b3ca3fbf6ed96aadca786ad8d4d51e5fed3f0 Mon Sep 17 00:00:00 2001 From: jamborm Date: Fri, 14 May 2010 13:08:45 +0000 Subject: 2010-05-14 Martin Jambor * cp/cp-lang.c (LANG_HOOKS_FOLD_OBJ_TYPE_REF): Remove both its undef and define. * langhooks-def.h (LANG_HOOKS_FOLD_OBJ_TYPE_REF): Remove. (LANG_HOOKS_INITIALIZER): Remove LANG_HOOKS_FOLD_OBJ_TYPE_REF. * langhooks.h (struct lang_hooks_for_decls): Removed field fold_obj_type_ref. * tree.c (free_lang_data): Remove assignment to lang_hooks.fold_obj_type_ref. * tree.def (OBJ_TYPE_REF): Update comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159393 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 1 - 1 file changed, 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 934536f2479..acbdeee953f 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -5039,7 +5039,6 @@ free_lang_data (void) lang_hooks.dwarf_name = lhd_dwarf_name; lang_hooks.decl_printable_name = gimple_decl_printable_name; lang_hooks.set_decl_assembler_name = lhd_set_decl_assembler_name; - lang_hooks.fold_obj_type_ref = gimple_fold_obj_type_ref; /* Reset diagnostic machinery. */ diagnostic_starter (global_dc) = default_diagnostic_starter; -- cgit v1.2.1 From 7858b562839bc05caf0e0586bcae129b022dff5f Mon Sep 17 00:00:00 2001 From: froydnj Date: Sat, 15 May 2010 18:41:11 +0000 Subject: * tree.h (ctor_to_list): Delete. * tree.c (ctor_to_list): Delete. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159437 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index acbdeee953f..9dbd08450cd 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2124,25 +2124,6 @@ tree_cons_stat (tree purpose, tree value, tree chain MEM_STAT_DECL) return node; } -/* Return the elements of a CONSTRUCTOR as a TREE_LIST. */ - -tree -ctor_to_list (tree ctor) -{ - tree list = NULL_TREE; - tree *p = &list; - unsigned ix; - tree purpose, val; - - FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (ctor), ix, purpose, val) - { - *p = build_tree_list (purpose, val); - p = &TREE_CHAIN (*p); - } - - return list; -} - /* Return the values of the elements of a CONSTRUCTOR as a vector of trees. */ -- cgit v1.2.1 From 06a0401ba938d648062f522ec01c5e592e36ec20 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Sun, 16 May 2010 15:20:47 +0000 Subject: * tree.c (build_common_builtin_nodes): Always clear TREE_NOTHROW on BUILT_IN_ALLOCA if stack checking is enabled. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159457 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 9dbd08450cd..3c456a2f409 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9083,10 +9083,13 @@ build_common_builtin_nodes (void) tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); ftype = build_function_type (ptr_type_node, tmp); local_define_builtin ("__builtin_alloca", ftype, BUILT_IN_ALLOCA, - "alloca", - ECF_MALLOC | (flag_stack_check ? 0 : ECF_NOTHROW)); + "alloca", ECF_MALLOC | ECF_NOTHROW); } + /* If we're checking the stack, `alloca' can throw. */ + if (flag_stack_check) + TREE_NOTHROW (built_in_decls[BUILT_IN_ALLOCA]) = 0; + tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); -- cgit v1.2.1 From e1036019ffb87690c22208ec7bab1f17c23e9c65 Mon Sep 17 00:00:00 2001 From: froydnj Date: Mon, 17 May 2010 16:09:35 +0000 Subject: gcc/ * tree.c (build_function_type_list_1): Remove bogus assert condition. gcc/fortran/ * trans-types.c (gfc_init_types): Use build_function_type_list. (gfc_get_ppc_type): Likewise. * trans-decl.c (gfc_generate_constructors): Likewise. * f95-lang.c (build_builtin_fntypes): Likewise. (gfc_init_builtin_functions): Likewise. (DEF_FUNCTION_TYPE_0): Likewise. (DEF_FUNCTION_TYPE_1): Likewise. (DEF_FUNCTION_TYPE_2): Likewise. (DEF_FUNCTION_TYPE_3): Likewise. (DEF_FUNCTION_TYPE_4): Likewise. (DEF_FUNCTION_TYPE_5): Likewise. (DEF_FUNCTION_TYPE_6): Likewise. (DEF_FUNCTION_TYPE_7): Likewise. Use ARG7. (DEF_FUNCTION_TYPE_VAR_0): Use build_varags_function_type_list. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159491 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 3c456a2f409..00de313f476 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -7330,7 +7330,7 @@ build_function_type_list_1 (bool vaargs, tree return_type, va_list argp) last = args; if (args != NULL_TREE) args = nreverse (args); - gcc_assert (args != NULL_TREE && last != void_list_node); + gcc_assert (last != void_list_node); } else if (args == NULL_TREE) args = void_list_node; -- cgit v1.2.1 From 432093e542b0d6e13fbfcc8ddeda63d322db551c Mon Sep 17 00:00:00 2001 From: froydnj Date: Mon, 17 May 2010 18:16:27 +0000 Subject: * tree.h (CALL_EXPR_ARGS): Delete. (call_expr_arglist): Delete. * tree.c (call_expr_arglist): Delete. * builtins.c (fold_call_expr): Pass the whole CALL_EXPR to targetm.fold_builtin. * config/alpha/alpha.c (alpha_fold_builtin): Rename arglist parameter. Rewrite iteration to work on call_expr_nargs rather than TREE_CHAIN. * config/picochip/picochip.c (picochip_expand_builtin_2op): Rename arglist parameter. Use CALL_EXPR_ARG. (picochip_expand_builtin_3op): Likewise. (picochip_expand_builtin_2opvoid): Likewise. (picochip_expand_array_get): Likewise. (picochip_expand_array_put): Likewise. (picochip_expand_array_testport): Likewise. (picochip_expand_builtin): Don't call CALL_EXPR_ARGS. Pass exp rather than arglist. * config/rx/rx.c (rx_expand_builtin): Call call_expr_nargs instead of CALL_EXPR_ARGS. * config/sparc/sparc.c (sparc_fold_builtin): Use CALL_EXPR_ARG rather than TREE_VALUE and TREE_CHAIN. * config/xtensa/xtensa.c (xtensa_fold_builtin): Likewise. * doc/tm.texi (TARGET_FOLD_BUILTIN): Pass CALL_EXPR tree instead of the arglist. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159502 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 00de313f476..8c0ed4e0e15 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -10376,22 +10376,6 @@ tree_block (tree t) return NULL; } -/* Build and return a TREE_LIST of arguments in the CALL_EXPR exp. - FIXME: don't use this function. It exists for compatibility with - the old representation of CALL_EXPRs where a list was used to hold the - arguments. Places that currently extract the arglist from a CALL_EXPR - ought to be rewritten to use the CALL_EXPR itself. */ -tree -call_expr_arglist (tree exp) -{ - tree arglist = NULL_TREE; - int i; - for (i = call_expr_nargs (exp) - 1; i >= 0; i--) - arglist = tree_cons (NULL_TREE, CALL_EXPR_ARG (exp, i), arglist); - return arglist; -} - - /* 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. */ -- cgit v1.2.1 From 6378ffb3e243f7ec668341240c3771873da4b8d2 Mon Sep 17 00:00:00 2001 From: jamborm Date: Mon, 17 May 2010 19:43:40 +0000 Subject: 2010-05-17 Martin Jambor * cgraph.h (cgraph_indirect_call_info): New fields anc_offset, otr_token and polymorphic. * cgraph.c (cgraph_create_indirect_edge): Inilialize the above fields. (cgraph_clone_edge): Copy the above fields. * tree.c (get_binfo_at_offset): New function. * tree.h (get_binfo_at_offset): Declare. * ipa-prop.h (enum jump_func_type): Added known_type jump function type, reordered items, updated comments. (union jump_func_value): Added base_type field, reordered fields. (enum ipa_lattice_type): Moved down in the file. (struct ipa_param_descriptor): New field polymorphic. (ipa_is_param_polymorphic): New function. * ipa-prop.c: Include gimple.h and gimple-fold.h. (ipa_print_node_jump_functions): Print known type jump functions. (compute_complex_pass_through): Renamed to... (compute_complex_assign_jump_func): this. (compute_complex_ancestor_jump_func): New function. (compute_known_type_jump_func): Likewise. (compute_scalar_jump_functions): Create known type and complex ancestor jump functions. (ipa_note_param_call): New parameter polymorphic, set the corresponding flag in the call note accordingly. (ipa_analyze_call_uses): Renamed to... (ipa_analyze_indirect_call_uses): this. New parameter target, define variable var only in the block where it is used. (ipa_analyze_virtual_call_uses): New function. (ipa_analyze_call_uses): Likewise. (combine_known_type_and_ancestor_jfs): Likewise. (update_jump_functions_after_inlining): Implemented handling of a number of new jump function types combination. (print_edge_addition_message): Removed. (make_edge_direct_to_target): New function. (try_make_edge_direct_simple_call): Likewise. (try_make_edge_direct_virtual_call): Likewise. (update_call_notes_after_inlining): Renamed to... (update_indirect_edges_after_inlining): this. Moved edge creation for indirect calls to try_make_edge_direct_simple_call, also calls try_make_edge_direct_virtual_call for virtual calls. (ipa_print_node_params): Changed the header message. (ipa_write_jump_function): Stream also known type jump functions. (ipa_read_jump_function): Likewise. (ipa_write_indirect_edge_info): Stream new fields in cgraph_indirect_call_info. (ipa_read_indirect_edge_info): Likewise. * Makefile.in (ipa-prop.o): Add dependency to GIMPLE_H and GIMPLE_FOLD_H. * testsuite/g++.dg/ipa/ivinline-1.C: New test. * testsuite/g++.dg/ipa/ivinline-2.C: New test. * testsuite/g++.dg/ipa/ivinline-3.C: New test. * testsuite/g++.dg/ipa/ivinline-4.C: New test. * testsuite/g++.dg/ipa/ivinline-5.C: New test. * testsuite/g++.dg/ipa/ivinline-6.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159507 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 8c0ed4e0e15..f00f82e9995 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -10779,4 +10779,60 @@ lhd_gcc_personality (void) return gcc_eh_personality_decl; } +/* 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. */ + +tree +get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type) +{ + tree type; + + if (offset == 0) + return binfo; + + type = TREE_TYPE (binfo); + while (offset > 0) + { + tree base_binfo, found_binfo; + HOST_WIDE_INT pos, size; + tree fld; + int i; + + if (TREE_CODE (type) != RECORD_TYPE) + return NULL_TREE; + + for (fld = TYPE_FIELDS (type); fld; fld = TREE_CHAIN (fld)) + { + if (TREE_CODE (fld) != FIELD_DECL) + continue; + + pos = int_bit_position (fld); + size = tree_low_cst (DECL_SIZE (fld), 1); + if (pos <= offset && (pos + size) > offset) + break; + } + if (!fld) + return NULL_TREE; + + found_binfo = NULL_TREE; + for (i = 0; BINFO_BASE_ITERATE (binfo, i, base_binfo); i++) + if (TREE_TYPE (base_binfo) == TREE_TYPE (fld)) + { + found_binfo = base_binfo; + break; + } + + if (!found_binfo) + return NULL_TREE; + + type = TREE_TYPE (fld); + binfo = found_binfo; + offset -= pos; + } + if (type != expected_type) + return NULL_TREE; + return binfo; +} + #include "gt-tree.h" -- cgit v1.2.1 From d3bd87c3760f14f27c84634420b10713acc95653 Mon Sep 17 00:00:00 2001 From: aesok Date: Tue, 18 May 2010 20:54:59 +0000 Subject: * tree.h (build_int_cstu): Implement as static inline. * tree.c (build_int_cstu): Remove function. (double_int_to_tree, double_int_fits_to_tree_p): Handle size types as sign extended. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159544 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index f00f82e9995..76be316eef9 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1041,14 +1041,6 @@ build_int_cst (tree type, HOST_WIDE_INT low) return build_int_cst_wide (type, low, low < 0 ? -1 : 0); } -/* Create an INT_CST node with a LOW value zero extended. */ - -tree -build_int_cstu (tree type, unsigned HOST_WIDE_INT low) -{ - return build_int_cst_wide (type, low, 0); -} - /* Create an INT_CST node with a LOW value in TYPE. The value is sign extended if it is negative. This function is similar to build_int_cst, but the extra bits outside of the type precision are cleared. Constants @@ -1088,7 +1080,12 @@ build_int_cst_wide_type (tree type, tree double_int_to_tree (tree type, double_int cst) { - cst = double_int_ext (cst, TYPE_PRECISION (type), TYPE_UNSIGNED (type)); + /* Size types *are* sign extended. */ + bool sign_extended_type = (!TYPE_UNSIGNED (type) + || (TREE_CODE (type) == INTEGER_TYPE + && TYPE_IS_SIZETYPE (type))); + + cst = double_int_ext (cst, TYPE_PRECISION (type), !sign_extended_type); return build_int_cst_wide (type, cst.low, cst.high); } @@ -1099,9 +1096,13 @@ double_int_to_tree (tree type, double_int cst) bool double_int_fits_to_tree_p (const_tree type, double_int cst) { - double_int ext = double_int_ext (cst, - TYPE_PRECISION (type), - TYPE_UNSIGNED (type)); + /* Size types *are* sign extended. */ + bool sign_extended_type = (!TYPE_UNSIGNED (type) + || (TREE_CODE (type) == INTEGER_TYPE + && TYPE_IS_SIZETYPE (type))); + + double_int ext + = double_int_ext (cst, TYPE_PRECISION (type), !sign_extended_type); return double_int_equal_p (cst, ext); } -- cgit v1.2.1 From 8ce390427438cd93ede36ccf2bc1db8288d22cce Mon Sep 17 00:00:00 2001 From: froydnj Date: Tue, 18 May 2010 23:45:21 +0000 Subject: gcc/ * tree.h (build_call_list): Remove. * tree.c (build_call_list): Remove. gcc/ada/ * gcc-interface/trans.c (call_to_gnu): Use build_call_vec instead of build_call_list. * gcc-interface/utils.c (build_function_stub): Likewise. gcc/cp/ * tree.c (build_min_non_dep_call_vec): Update comment. gcc/java/ * expr.c (expand_java_multianewarray): Use build_call_vec instead of build_call_list. (pop_arguments): Return a VEC instead of a tree. Take a method type rather than a list of argument types. (rewrite_rule): Change signature. of rewrite_arglist member. (rewrite_arglist_getcaller): Update signature. (rewrite_arglist_getclass): Likewise. (maybe_rewrite_invocation): Update for rewrite_arglist change. (build_known_method_ref): Take a VEC instead of a tree. (invoke_build_dtable): Likewise. (expand_invoke): Update calls to pop_arguments. Use build_call_vec instead of build_call_list. (build_jni_stub): Use build_call_vec instead of build_call_list. * java-tree.h (maybe_rewrite_invocation): Update declaration. (build_known_method_ref): Likewise. (invoke_build_dtable): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159548 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 76be316eef9..9374bfa215d 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9486,27 +9486,6 @@ build_vl_exp_stat (enum tree_code code, int len MEM_STAT_DECL) return t; } - -/* Build a CALL_EXPR of class tcc_vl_exp with the indicated RETURN_TYPE - and FN and a null static chain slot. ARGLIST is a TREE_LIST of the - arguments. */ - -tree -build_call_list (tree return_type, tree fn, tree arglist) -{ - tree t; - int i; - - t = build_vl_exp (CALL_EXPR, list_length (arglist) + 3); - TREE_TYPE (t) = return_type; - CALL_EXPR_FN (t) = fn; - CALL_EXPR_STATIC_CHAIN (t) = NULL_TREE; - for (i = 0; arglist; arglist = TREE_CHAIN (arglist), i++) - CALL_EXPR_ARG (t, i) = TREE_VALUE (arglist); - process_call_operands (t); - return t; -} - /* 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. */ -- cgit v1.2.1 From 578fcce9dee02ac2ac2a7f76634d8befccc51ef3 Mon Sep 17 00:00:00 2001 From: froydnj Date: Wed, 19 May 2010 00:43:27 +0000 Subject: Revert: 2010-05-18 Nathan Froyd * tree.h (build_call_list): Remove. * tree.c (build_call_list): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159554 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 9374bfa215d..76be316eef9 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9486,6 +9486,27 @@ build_vl_exp_stat (enum tree_code code, int len MEM_STAT_DECL) return t; } + +/* Build a CALL_EXPR of class tcc_vl_exp with the indicated RETURN_TYPE + and FN and a null static chain slot. ARGLIST is a TREE_LIST of the + arguments. */ + +tree +build_call_list (tree return_type, tree fn, tree arglist) +{ + tree t; + int i; + + t = build_vl_exp (CALL_EXPR, list_length (arglist) + 3); + TREE_TYPE (t) = return_type; + CALL_EXPR_FN (t) = fn; + CALL_EXPR_STATIC_CHAIN (t) = NULL_TREE; + for (i = 0; arglist; arglist = TREE_CHAIN (arglist), i++) + CALL_EXPR_ARG (t, i) = TREE_VALUE (arglist); + process_call_operands (t); + return t; +} + /* 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. */ -- cgit v1.2.1 From e35f74d5cd4b44925efd02c63399b5e83f086fb2 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 19 May 2010 15:57:17 +0000 Subject: 2010-05-19 Richard Guenther PR lto/44196 * tree.c (find_decls_types_r): Walk BLOCKs and its vars. * g++.dg/lto/20100519-1_0.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159582 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 76be316eef9..fbf24b1e8bc 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4713,6 +4713,15 @@ find_decls_types_r (tree *tp, int *ws, void *data) fld_worklist_push (TREE_CHAIN (t), fld); *ws = 0; } + else if (TREE_CODE (t) == BLOCK) + { + tree tem; + for (tem = BLOCK_VARS (t); tem; tem = TREE_CHAIN (tem)) + fld_worklist_push (tem, fld); + for (tem = BLOCK_SUBBLOCKS (t); tem; tem = BLOCK_CHAIN (tem)) + fld_worklist_push (tem, fld); + fld_worklist_push (BLOCK_ABSTRACT_ORIGIN (t), fld); + } fld_worklist_push (TREE_TYPE (t), fld); -- cgit v1.2.1 From c5083e8b59f188c155a36a3335d803220428f7a9 Mon Sep 17 00:00:00 2001 From: aesok Date: Wed, 19 May 2010 20:09:57 +0000 Subject: * double-int.h (double_int_ior): New function. * tree.h (build_int_cst_wide_type): Remove. * tree.c (build_int_cst_wide_type): Remove. * fold-const.c (native_interpret_int): Use double_int_to_tree instead of build_int_cst_wide_type. * stor-layout.c (set_sizetype): (Ditto.). * dojump.c (do_jump): Use build_int_cstu instead of build_int_cst_wide_type. /java * jcf-parse.c (get_constant): Use double_int_to_tree instead of build_int_cst_wide_type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159595 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index fbf24b1e8bc..887326664fa 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1063,17 +1063,6 @@ build_int_cst_type (tree type, HOST_WIDE_INT low) return build_int_cst_wide (type, low1, hi); } -/* Create an INT_CST node of TYPE and value HI:LOW. The value is truncated - and sign extended according to the value range of TYPE. */ - -tree -build_int_cst_wide_type (tree type, - unsigned HOST_WIDE_INT low, HOST_WIDE_INT high) -{ - fit_double_type (low, high, &low, &high, type); - return build_int_cst_wide (type, low, high); -} - /* 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. */ -- cgit v1.2.1 From a7a4626828090600459358ca745c4482cf9551a1 Mon Sep 17 00:00:00 2001 From: steven Date: Fri, 21 May 2010 13:53:22 +0000 Subject: gcc/ChangeLog: * tree.h: Include real.h and fixed-value.h as basic datatypes. * dfp.c, convert.c, reload1.c, reginfo.c, tree-flow.h, tree-ssa-threadedge.c, tree-ssanames.c, tree-loop-linear.c, tree-into-ssa.c, tree-vect-generic.c, tree-ssa-structalias.c, tree-ssa-loop-im.c, tree-dump.c, tree-complex.c, tree-ssa-uninit.c, genrecog.c, tree-ssa-threadupdate.c, tree-ssa-loop-niter.c, tree-pretty-print.c, tree-loop-distribution.c, tree-ssa-loop-unswitch.c, c-lex.c, optabs.c, postreload-gcse.c, tree-ssa-loop-manip.c, postreload.c, tree-ssa-loop-ch.c, tree-tailcall.c, tree.c, reload.c, tree-scalar-evolution.c, rtlanal.c, tree-phinodes.c, builtins.c, final.c, genoutput.c, fold-const.c, tree-ssa-dse.c, genautomata.c, tree-ssa-uncprop.c, toplev.c, tree-chrec.c, genemit.c, c-cppbuiltin.c, tree-ssa-sccvn.c, tree-ssa-ccp.c, tree-ssa-loop-ivopts.c, mode-switching.c, tree-call-cdce.c, cse.c, genpeep.c, tree-ssa-math-opts.c, tree-ssa-dom.c, tree-nrv.c, tree-ssa-propagate.c, tree-ssa-alias.c, tree-ssa-sink.c, jump.c, ifcvt.c, dwarf2out.c, expr.c, genattrtab.c, genconditions.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop.c, tree-parloops.c, recog.c, tree-ssa-address.c, lcm.c, tree-eh.c, gimple-pretty-print.c, c-pretty-print.c, print-rtl.c, gcse.c, tree-if-conv.c, tree-data-ref.c, tree-affine.c, gimplify.c, tree-ssa-phiopt.c, implicit-zee.c, expmed.c, tree-dfa.c, emit-rtl.c, store-motion.c, cselib.c, tree-cfgcleanup.c, simplify-rtx.c, tree-ssa-pre.c, genpreds.c, tree-mudflap.c, print-tree.c, tree-ssa-copy.c, tree-ssa-forwprop.c, tree-ssa-dce.c, varasm.c, tree-nested.c, tree-ssa.c, tree-ssa-loop-prefetch.c, rtl.c, tree-inline.c, integrate.c, tree-optimize.c, tree-ssa-phiprop.c, fixed-value.c, combine.c, tree-profile.c, c-common.c, sched-vis.c, tree-cfg.c, passes.c, tree-ssa-reassoc.c, config/alpha/alpha.c, config/frv/frv.c, config/s390/s390.c, config/m32c/m32c.c, config/spu/spu.c, config/sparc/sparc.c, config/mep/mep.c, config/m32r/m32r.c, config/rx/rx.c, config/i386/i386.c, config/sh/sh.c, config/pdp11/pdp11.c, config/avr/avr.c, config/crx/crx.c, config/xtensa/xtensa.c, config/stormy16/stormy16.c, config/fr30/fr30.c, config/lm32/lm32.c, config/moxie/moxie.c, config/m68hc11/m68hc11.c, config/cris/cris.c, config/iq2000/iq2000.c, config/mn10300/mn10300.c, config/ia64/ia64.c, config/m68k/m68k.c, config/rs6000/rs6000.c, config/picochip/picochip.c, config/darwin.c, config/arc/arc.c, config/mcore/mcore.c, config/score/score3.c, config/score/score7.c, config/score/score.c, config/arm/arm.c, config/pa/pa.c, config/mips/mips.c, config/vax/vax.c, config/h8300/h8300.c, config/v850/v850.c, config/mmix/mmix.c, config/bfin/bfin.c: Clean up redundant includes. * Makefile.in: Update accordingly. java/ChangeLog: * typeck.c, decl.c, jcf-parse.c, except.c, expr.c: cp/Changelog: * error.c, tree.c, typeck2.c, cxx-pretty-print.c, mangle.c: Clean up redundant includes. fortran/ChangeLog: * trans-const.c, trans-types.c, trans-intrinsic.c: Clean up redundant includes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159663 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 887326664fa..120a10c07d3 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -35,7 +35,6 @@ along with GCC; see the file COPYING3. If not see #include "tm.h" #include "flags.h" #include "tree.h" -#include "real.h" #include "tm_p.h" #include "function.h" #include "obstack.h" @@ -51,7 +50,6 @@ along with GCC; see the file COPYING3. If not see #include "tree-flow.h" #include "params.h" #include "pointer-set.h" -#include "fixed-value.h" #include "tree-pass.h" #include "langhooks-def.h" #include "diagnostic.h" -- cgit v1.2.1 From 30b22e1c0b6e257e5be094c9a44d40ced4ddc998 Mon Sep 17 00:00:00 2001 From: froydnj Date: Fri, 21 May 2010 14:37:16 +0000 Subject: * tree.c (build_function_decl_skip_args): Fix grammar. (build_function_type_list_1): Fix typos, adjust formatting. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159666 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 120a10c07d3..805c0525a24 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -7288,7 +7288,7 @@ build_function_type_skip_args (tree orig_type, bitmap args_to_skip) /* Build variant of function type ORIG_TYPE skipping ARGS_TO_SKIP. Arguments from DECL_ARGUMENTS list can't be removed now, since they are - linked by TREE_CHAIN directly. It is caller responsibility to eliminate + linked by TREE_CHAIN directly. The caller is responsible for eliminating them when they are being duplicated (i.e. copy_arguments_for_versioning). */ tree @@ -7310,8 +7310,8 @@ build_function_decl_skip_args (tree orig_decl, bitmap args_to_skip) } /* 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 muse be alway be terminated be a NULL_TREE. */ + 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. */ static tree build_function_type_list_1 (bool vaargs, tree return_type, va_list argp) -- cgit v1.2.1 From ce084dfc1cd60d867d38dbed86a914d82fa908d1 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Fri, 21 May 2010 22:34:26 +0000 Subject: * diagnostic.c: Don't include tm.h, tree.h, tm_p.h, langhooks.h or langhooks-def.h. (diagnostic_initialize): Initialize x_data not last_function. (diagnostic_report_current_function): Move to tree-diagnostic.c. (default_diagnostic_starter): Call diagnostic_report_current_module not diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize x_data not abstract_origin. (verbatim): Likewise. * diagnostic.h (struct diagnostic_info): Change abstract_origin to x_data. (struct diagnostic_context): Change last_function to x_data. (diagnostic_auxiliary_data): Replace with diagnostic_context_auxiliary_data and diagnostic_info_auxiliary_data. (diagnostic_last_function_changed, diagnostic_set_last_function, diagnostic_report_current_function): Move to tree-diagnostic.h. (print_declaration, dump_generic_node, print_generic_stmt, print_generic_stmt_indented, print_generic_expr, print_generic_decl, debug_c_tree, dump_omp_clauses, print_call_name, debug_generic_expr, debug_generic_stmt, debug_tree_chain, default_tree_printer): Move to tree-pretty-print.h. (debug_gimple_stmt, debug_gimple_seq, print_gimple_seq, print_gimple_stmt, print_gimple_expr, dump_gimple_stmt): Move to gimple-pretty-print.h. * pretty-print.c: Don't include tree.h (pp_base_format): Don't handle %K here. (pp_base_tree_identifier): Move to tree-pretty-print.c. * pretty-print.h (text_info): Change abstract_origin to x_data. (pp_tree_identifier, pp_unsupported_tree, pp_base_tree_identifier): Move to tree-pretty-print.h. * gimple-pretty-print.h, tree-diagnostic.c, tree-diagnostic.h, tree-pretty-print.h: New files. * tree-pretty-print.c: Include tree-pretty-print.h. (percent_K_format): New. Moved from pretty-print.c. (pp_base_tree_identifier): Move from pretty-print.c. * c-objc-common.c: Include tree-pretty-print.h. (c_tree_printer): Handle %K here. * langhooks.c: Include tree-diagnostic.h. (lhd_print_error_function): Use diagnostic_abstract_origin macro. * toplev.c: Include tree-diagnostic.h and tree-pretty-print.h. (default_tree_printer): Handle %K using percent_K_format. (general_init): Use default_tree_diagnostic_starter. * tree.c: Include tree-diagnostic.h and tree-pretty-print.h. (free_lang_data): Use default_tree_diagnostic_starter. * c-pretty-print.c: Include tree-pretty-print.h. * cfgexpand.c: Include tree-pretty-print.h and gimple-pretty-print.h. * cgraphunit.c: Include tree-pretty-print.h and gimple-pretty-print.h. * dwarf2out.c: Include tree-pretty-print.h. * except.c: Include tree-pretty-print.h. * gimple-pretty-print.c: Include tree-pretty-print.h and gimple-pretty-print.h. * gimplify.c: Include tree-pretty-print.h. * graphite-poly.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-cp.c: Include tree-pretty-print.h. * ipa-inline.c: Include gimple-pretty-print.h. * ipa-prop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-pure-const.c: Include gimple-pretty-print.h. * ipa-struct-reorg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-type-escape.c: Include tree-pretty-print.h. * print-rtl.c: Include tree-pretty-print.h. * print-tree.c: Include gimple-pretty-print.h. * sese.c: Include tree-pretty-print.h. * tree-affine.c: Include tree-pretty-print.h. * tree-browser.c: Include tree-pretty-print.h. * tree-call-cdce.c: Include gimple-pretty-print.h. * tree-cfg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-chrec.c: Include tree-pretty-print.h. * tree-data-ref.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-dfa.c: Include tree-pretty-print.h. * tree-if-conv.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-inline.c: Include tree-pretty-print.h. * tree-into-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-nrv.c: Include tree-pretty-print.h. * tree-object-size.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-outof-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-parloops.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-predcom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-scalar-evolution.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-sra.c: Include tree-pretty-print.h. * tree-ssa-address.c: Include tree-pretty-print.h. * tree-ssa-alias.c: Include tree-pretty-print.h. * tree-ssa-ccp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-coalesce.c: Include tree-pretty-print.h. * tree-ssa-copy.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-copyrename.c: Include tree-pretty-print.h. * tree-ssa-dce.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dse.c: Include gimple-pretty-print.h. * tree-ssa-forwprop.c: Include tree-pretty-print.h. * tree-ssa-ifcombine.c: Include tree-pretty-print.h. * tree-ssa-live.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-im.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivcanon.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivopts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-niter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-prefetch.c: Include tree-pretty-print.h. * tree-ssa-math-opts.c: Include gimple-pretty-print.h. * tree-ssa-operands.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-phiprop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-pre.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-propagate.c: Include gimple-pretty-print.h. * tree-ssa-reassoc.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sccvn.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sink.c: Include gimple-pretty-print.h. * tree-ssa-ter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-uninit.c: Include gimple-pretty-print.h. * tree-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-stdarg.c: Include gimple-pretty-print.h. * tree-switch-conversion.c: Include gimple-pretty-print.h. * tree-tailcall.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-data-refs.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop-manip.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-patterns.c: Include gimple-pretty-print.h. * tree-vect-slp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-stmts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vectorizer.c: Include tree-pretty-print.h. * tree-vrp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * value-prof.c: Include tree-pretty-print.h and gimple-pretty-print.h. * var-tracking.c: Include tree-pretty-print.h. * Makefile.in (OBJS-common): Add tree-diagnostic.o. (tree-diagnostic.o): New dependencies. (c-objc-common.o, c-pretty-print.o, langhooks.o, tree.o, tree-inline.o, print-tree.o, stor-layout.o, tree-ssa-uninit.o, tree-ssa.o, tree-into-ssa.o, tree-ssa-ter.o, tree-ssa-coalesce.o, tree-outof-ssa.o, tree-ssa-forwprop.o, tree-ssa-phiprop.o, tree-ssa-ifcombine.o, tree-nrv.o, tree-ssa-copy.o, tree-ssa-propagate.o, tree-ssa-dom.o, tree-ssa-uncprop.o, tree-ssa-live.o, tree-ssa-copyrename.o, tree-ssa-pre.o, tree-ssa-sccvn.o, tree-vrp.o, tree-cfg.o, tree-tailcall.o, tree-ssa-sink.o, tree-if-conv.o, tree-dfa.o, tree-ssa-operands.o, tree-ssa-address.o, tree-ssa-loop-niter.o, tree-ssa-loop-ivcanon.o, tree-ssa-loop-prefetch.o, tree-predcom.o, tree-ssa-loop-ivopts.o, tree-affine.o, tree-ssa-loop-im.o, tree-ssa-math-opts.o, tree-ssa-alias.o, tree-ssa-reassoc.o, gimplify.o, tree-browser.o, tree-chrec.o, tree-scalar-evolution.o, tree-data-ref.o, sese.o, graphite-poly.o, tree-vect-loop.o, tree-vect-loop-manip.o, tree-vect-patterns.o, tree-vect-slp.o, tree-vect-stmts.o, tree-vect-data-refs.o, tree-vectorizer.o, tree-parloops.o, tree-stdarg.o, tree-object-size.o, gimple-pretty-print.o, tree-pretty-print.o, diagnostic.o, toplev.o, print-rtl.o, except.o, dwarf2out.o, cgraphunit.o, ipa-prop.o, ipa-cp.o, ipa-inline.o, ipa-pure-const.o, ipa-type-escape.o, ipa-struct-reorg.o, tree-ssa-dce.o, tree-call-cdce.o, tree-ssa-ccp.o, tree-sra.o, tree-switch-conversion.o, var-tracking.o, value-prof.o, cfgexpand.o, pretty-print.o): Update dependencies. cp: * error.c: Include tree-diagnostic.h and tree-pretty-print.h. (cp_print_error_function): Use diagnostic_abstract_origin macro. (cp_printer): Handle %K here using percent_K_format. * cxx-pretty-print.c: Include tree-pretty-print.h. * Make-lang.in (cp/error.o, cp/cxx-pretty-print.o): Update dependencies. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159685 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 805c0525a24..cc4a2d66fc1 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -53,6 +53,8 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" #include "langhooks-def.h" #include "diagnostic.h" +#include "tree-diagnostic.h" +#include "tree-pretty-print.h" #include "cgraph.h" #include "timevar.h" #include "except.h" @@ -5019,7 +5021,7 @@ free_lang_data (void) lang_hooks.set_decl_assembler_name = lhd_set_decl_assembler_name; /* Reset diagnostic machinery. */ - diagnostic_starter (global_dc) = default_diagnostic_starter; + diagnostic_starter (global_dc) = default_tree_diagnostic_starter; diagnostic_finalizer (global_dc) = default_diagnostic_finalizer; diagnostic_format_decoder (global_dc) = default_tree_printer; -- cgit v1.2.1 From 6388cfe24f7ecbdc2ba2d4c80638ea6c95ba07c2 Mon Sep 17 00:00:00 2001 From: ktietz Date: Wed, 26 May 2010 16:13:55 +0000 Subject: libiberty/ 2010-05-26 Kai Tietz * testsuite/demangle-expected: Add tests for __int128 and unsigned __int128 types. gcc/testsuite 2010-05-26 Kai Tietz * lib/target-supports.exp (check_effective_target_int128): New function to check if __int128 types are available for target. * testsuite/c-c++-common/int128-types-1.c: New. * testsuite/c-c++-common/int128-1.c: New. * testsuite/c-c++-common/int128-2.c: New. * g++.dg/abi/mangle43.C: New. * g++.dg/init/enum1.C: Handle __int128 case and add -Wno-overflow. * g++.dg/cpp0x/nullptr04.C: Use __SIZE_TYPE__ for getting pointer-wide scalar. * g++.dg/other/pr25632.C: Likewise. * g++.dg/other/large-size-array.C (DIM): Use ULLONG_MAX for win64 case. * g++.dg/warn/pr13358-2.C: Add llp64 for check of special overflow warnings. * g++.dg/warn/pr13358-4.C: Likewise. * g++.dg/warn/Wconversion-null-2.C: Add 'long long' case. * g++.dg/warn/Wconversion-null.C: Likewise. gcc/ 2010-05-26 Kai Tietz * builtin-types.def (BT_INT128): New primitive type. (BT_UINT128): Likewise. * c-common.c (c_common_r): Add __int128 keyword. (c_common_type_for_size): Handle __int128. (c_common_type_for_mode): Likewise. (c_common_signed_or_unsigned_type): Likewise. (c_common_nodes_and_builtins): Add builtin type if target supports 128-bit integer scalar. * c-common.h (enum rid): Add RID_INT128. * c-cppbuiltin.c (c_cpp_builtins): Define __SIZEOF_INT128__ if target supports 128-bit integer scalar. * c-decl.c (declspecs_add_type): Handle new keyword __int128. (finish_declspecs): Likewise. * c-parser.c (c_token_starts_typename): Handle RID_INT128. (c_token_starts_declspecs): Likewise. (c_parser_declspecs): Likewise. (c_parser_attributes): Likewise. (c_parser_objc_selector): Likewise. * c-pretty-print.c (pp_c_integer_constant): Handle __int128. * c-tree.h (enum c_typespec_keyword): Add cts_int128. * gimple.c (gimple_signed_or_unsigned_type): Handle int128 types. * tree.c (make_or_reuse_type): Likewise. (make_unsigned_type): Likewise. (build_common_tree_nodes_2): Likewise. * tree.h (enum integer_type_kind): Add itk_int128 and itk_unsigned_int128. (int128_integer_type_node): New define.. (int128_unsigned_type_node): New define. * cp/cp-tree.h (cp_decl_specifier_seq): Add new bifield explicit_int128_p. * cp/decl.c (grokdeclarator): Handle __int128. * cp/parser.c (cp_lexer_next_token_is_decl_specifier_ke): Likewise. (cp_parser_simple_type_specifier): Likewise. * cp/rtti.c (emit_support_tinfos): Add int128 nodes for rtti. * cp/typeck.c (cp_common_type): Handle __int128. * cp/mangle.c (integer_type_codes): Add itk_int128 and itk_unsigned_int128. * doc/extend.texi: Add documentation about __int128 type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159879 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index cc4a2d66fc1..4bef134c7f0 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -8709,6 +8709,9 @@ make_or_reuse_type (unsigned size, int unsignedp) if (size == LONG_LONG_TYPE_SIZE) return (unsignedp ? long_long_unsigned_type_node : long_long_integer_type_node); + if (size == 128 && int128_integer_type_node) + return (unsignedp ? int128_unsigned_type_node + : int128_integer_type_node); if (unsignedp) return make_unsigned_type (size); @@ -8824,7 +8827,17 @@ build_common_tree_nodes (bool signed_char) long_unsigned_type_node = make_unsigned_type (LONG_TYPE_SIZE); long_long_integer_type_node = make_signed_type (LONG_LONG_TYPE_SIZE); long_long_unsigned_type_node = make_unsigned_type (LONG_LONG_TYPE_SIZE); - +#if HOST_BITS_PER_WIDE_INT >= 64 + /* 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. */ + if (targetm.scalar_mode_supported_p (TImode)) + { + int128_integer_type_node = make_signed_type (128); + int128_unsigned_type_node = make_unsigned_type (128); + } +#endif /* 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 -- cgit v1.2.1 From 37ba48872f773ad93053f35d5f545c2fa1d2244a Mon Sep 17 00:00:00 2001 From: jsm28 Date: Thu, 27 May 2010 11:33:27 +0000 Subject: * input.c: New file. * input.h (main_input_filename): Move declaration to toplev.h. * toplev.c (input_location, line_table): Move to input.c * toplev.h (main_input_filename): Move declaration from input.h. * tree.c (expand_location): Move to input.c. * Makefile.in (OBJS-common): Add input.o. (input.o): Add dependencies. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159914 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 4bef134c7f0..743293e288a 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3950,28 +3950,6 @@ build_block (tree vars, tree subblocks, tree supercontext, tree chain) return block; } -expanded_location -expand_location (source_location loc) -{ - expanded_location xloc; - if (loc <= BUILTINS_LOCATION) - { - xloc.file = loc == UNKNOWN_LOCATION ? NULL : _(""); - xloc.line = 0; - xloc.column = 0; - xloc.sysp = 0; - } - else - { - const struct line_map *map = linemap_lookup (line_table, loc); - xloc.file = map->to_file; - xloc.line = SOURCE_LINE (map, loc); - xloc.column = SOURCE_COLUMN (map, loc); - xloc.sysp = map->sysp != 0; - }; - return xloc; -} - /* Like SET_EXPR_LOCATION, but make sure the tree can have a location. -- cgit v1.2.1 From 15a007df5edd3e7f2c80d11b4d01d1ff66c63f3a Mon Sep 17 00:00:00 2001 From: dodji Date: Thu, 27 May 2010 19:29:53 +0000 Subject: Fix PR c++/44188 gcc/ChangeLog: PR c++/44188 * c-common.c (is_typedef_decl): Move this definition ... * tree.c (is_typedef_decl): ... here. (typdef_variant_p): Move definition here from gcc/cp/tree.c. * c-common.h (is_typedef_decl): Move this declaration ... * tree.h (is_typedef_decl): ... here. (typedef_variant_p): Move declaration here from gcc/cp/cp-tree.h * dwarf2out.c (is_naming_typedef_decl): New function. (gen_tagged_type_die): Split out of ... (gen_type_die_with_usage): ... this function. When an anonymous tagged type is named by a typedef, make sure a DW_TAG_typedef DIE is emitted for the typedef. (gen_typedef_die): Emit DW_TAG_typedef also for typedefs naming anonymous tagged types. gcc/cp/ChangeLog: PR c++/44188 * cp-tree.h (typedef_variant_p): Move this declaration to gcc/tree.h. * tree.c (typedef_variant_p): Move this definition to gcc/tree.c. * decl.c (grokdeclarator): Do not rename debug info of an anonymous tagged type named by a typedef. gcc/testsuite/ChangeLog: PR c++/44188 * g++.dg/debug/dwarf2/typedef3.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159943 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 743293e288a..8b04c376594 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -10825,4 +10825,21 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type) return binfo; } +/* Returns true if X is a typedef decl. */ + +bool +is_typedef_decl (tree x) +{ + return (x && TREE_CODE (x) == TYPE_DECL + && DECL_ORIGINAL_TYPE (x) != NULL_TREE); +} + +/* Returns true iff TYPE is a type variant created for a typedef. */ + +bool +typedef_variant_p (tree type) +{ + return is_typedef_decl (TYPE_NAME (type)); +} + #include "gt-tree.h" -- cgit v1.2.1 From bcf72c8bad93b0284cfcbea57a57b56df8587935 Mon Sep 17 00:00:00 2001 From: dodji Date: Fri, 28 May 2010 00:03:19 +0000 Subject: Revert "Fix PR c++/44188" gcc/ChangeLog: revert fix for PR c++/44188 * c-common.c (is_typedef_decl): Revert the moving of this definition ... * tree.c (is_typedef_decl): ... here. (typdef_variant_p): Revert the moving of this definition here from gcc/cp/tree.c. * c-common.h (is_typedef_decl): Revert the moving of this declaration ... * tree.h (is_typedef_decl): ... here. (typedef_variant_p): Revert the moving of this declaration here from gcc/cp/cp-tree.h * dwarf2out.c (is_naming_typedef_decl): Revert this new function. (gen_tagged_type_die): Revert the splitting out of ... (gen_type_die_with_usage): ... this function. Revert the anonymous tagged type handling. (gen_typedef_die): Revert emitting DW_TAG_typedef for typedefs naming anonymous tagged types. gcc/cp/ChangeLog: Revert fix of PR c++/44188 * cp-tree.h (typedef_variant_p): Revert moving this declaration to gcc/tree.h. * tree.c (typedef_variant_p): Revert moving this definition to gcc/tree.c. * decl.c (grokdeclarator): Revert naming typedef handling. gcc/testsuite/ChangeLog: Revert fix for PR c++/44188 * g++.dg/debug/dwarf2/typedef3.C: Revert new test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159955 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 8b04c376594..743293e288a 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -10825,21 +10825,4 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type) return binfo; } -/* Returns true if X is a typedef decl. */ - -bool -is_typedef_decl (tree x) -{ - return (x && TREE_CODE (x) == TYPE_DECL - && DECL_ORIGINAL_TYPE (x) != NULL_TREE); -} - -/* Returns true iff TYPE is a type variant created for a typedef. */ - -bool -typedef_variant_p (tree type) -{ - return is_typedef_decl (TYPE_NAME (type)); -} - #include "gt-tree.h" -- cgit v1.2.1 From 5d8c393e1dc0b8df0a62eb3df1c68cb5082ab121 Mon Sep 17 00:00:00 2001 From: froydnj Date: Tue, 1 Jun 2010 19:34:57 +0000 Subject: * tree.h (build_nt_call_list): Delete. * tree.c (build_nt_call_list): Delete. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160120 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 743293e288a..81ea666d8aa 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3852,23 +3852,6 @@ build_nt (enum tree_code code, ...) return t; } -/* Similar to build_nt, but for creating a CALL_EXPR object with - ARGLIST passed as a list. */ - -tree -build_nt_call_list (tree fn, tree arglist) -{ - tree t; - int i; - - t = build_vl_exp (CALL_EXPR, list_length (arglist) + 3); - CALL_EXPR_FN (t) = fn; - CALL_EXPR_STATIC_CHAIN (t) = NULL_TREE; - for (i = 0; arglist; arglist = TREE_CHAIN (arglist), i++) - CALL_EXPR_ARG (t, i) = TREE_VALUE (arglist); - return t; -} - /* Similar to build_nt, but for creating a CALL_EXPR object with a tree VEC. */ -- cgit v1.2.1 From cc194b6e3a0bb9be324e211b2f5011ba34653d1e Mon Sep 17 00:00:00 2001 From: jakub Date: Wed, 2 Jun 2010 19:49:21 +0000 Subject: * tree.h (struct tree_decl_map): New type. (tree_decl_map_eq, tree_decl_map_marked_p): Define. (tree_decl_map_hash): New prototype. (debug_expr_for_decl, value_expr_for_decl): Change into tree_decl_map hashtab from tree_map. (init_ttree): Adjust initialization. (tree_decl_map_hash): New function. (decl_debug_expr_lookup, decl_debug_expr_insert, decl_value_expr_lookup, decl_value_expr_insert): Adjust. cp/ * cp-objcp-common.c (shadowed_var_for_decl): Change into tree_decl_map hashtab from tree_map. (decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert): Adjust. (init_shadowed_var_for_decl): Adjust initialization. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160185 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 56 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 23 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 81ea666d8aa..67e2f417cb9 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -196,10 +196,10 @@ static GTY ((if_marked ("ggc_marked_p"), param_is (union tree_node))) /* General tree->tree mapping structure for use in hash tables. */ -static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) +static GTY ((if_marked ("tree_decl_map_marked_p"), param_is (struct tree_decl_map))) htab_t debug_expr_for_decl; -static GTY ((if_marked ("tree_map_marked_p"), param_is (struct tree_map))) +static GTY ((if_marked ("tree_decl_map_marked_p"), param_is (struct tree_decl_map))) htab_t value_expr_for_decl; static GTY ((if_marked ("tree_priority_map_marked_p"), @@ -533,11 +533,11 @@ init_ttree (void) type_hash_table = htab_create_ggc (TYPE_HASH_INITIAL_SIZE, type_hash_hash, type_hash_eq, 0); - debug_expr_for_decl = htab_create_ggc (512, tree_map_hash, - tree_map_eq, 0); + debug_expr_for_decl = htab_create_ggc (512, tree_decl_map_hash, + tree_decl_map_eq, 0); - value_expr_for_decl = htab_create_ggc (512, tree_map_hash, - tree_map_eq, 0); + value_expr_for_decl = htab_create_ggc (512, tree_decl_map_hash, + tree_decl_map_eq, 0); init_priority_for_decl = htab_create_ggc (512, tree_priority_map_hash, tree_priority_map_eq, 0); @@ -5560,7 +5560,7 @@ tree_map_base_eq (const void *va, const void *vb) return (a->from == b->from); } -/* Hash a from tree in a tree_map. */ +/* Hash a from tree in a tree_base_map. */ unsigned int tree_map_base_hash (const void *item) @@ -5578,12 +5578,22 @@ tree_map_base_marked_p (const void *p) return ggc_marked_p (((const struct tree_map_base *) p)->from); } +/* Hash a from tree in a tree_map. */ + unsigned int tree_map_hash (const void *item) { return (((const struct tree_map *) item)->hash); } +/* Hash a from tree in a tree_decl_map. */ + +unsigned int +tree_decl_map_hash (const void *item) +{ + return DECL_UID (((const struct tree_decl_map *) item)->base.from); +} + /* Return the initialization priority for DECL. */ priority_type @@ -5689,11 +5699,11 @@ print_value_expr_statistics (void) tree decl_debug_expr_lookup (tree from) { - struct tree_map *h, in; + struct tree_decl_map *h, in; in.base.from = from; - h = (struct tree_map *) htab_find_with_hash (debug_expr_for_decl, &in, - htab_hash_pointer (from)); + h = (struct tree_decl_map *) + htab_find_with_hash (debug_expr_for_decl, &in, DECL_UID (from)); if (h) return h->to; return NULL_TREE; @@ -5704,15 +5714,15 @@ decl_debug_expr_lookup (tree from) void decl_debug_expr_insert (tree from, tree to) { - struct tree_map *h; + struct tree_decl_map *h; void **loc; - h = GGC_NEW (struct tree_map); - h->hash = htab_hash_pointer (from); + h = GGC_NEW (struct tree_decl_map); h->base.from = from; h->to = to; - loc = htab_find_slot_with_hash (debug_expr_for_decl, h, h->hash, INSERT); - *(struct tree_map **) loc = h; + loc = htab_find_slot_with_hash (debug_expr_for_decl, h, DECL_UID (from), + INSERT); + *(struct tree_decl_map **) loc = h; } /* Lookup a value expression for FROM, and return it if we find one. */ @@ -5720,11 +5730,11 @@ decl_debug_expr_insert (tree from, tree to) tree decl_value_expr_lookup (tree from) { - struct tree_map *h, in; + struct tree_decl_map *h, in; in.base.from = from; - h = (struct tree_map *) htab_find_with_hash (value_expr_for_decl, &in, - htab_hash_pointer (from)); + h = (struct tree_decl_map *) + htab_find_with_hash (value_expr_for_decl, &in, DECL_UID (from)); if (h) return h->to; return NULL_TREE; @@ -5735,15 +5745,15 @@ decl_value_expr_lookup (tree from) void decl_value_expr_insert (tree from, tree to) { - struct tree_map *h; + struct tree_decl_map *h; void **loc; - h = GGC_NEW (struct tree_map); - h->hash = htab_hash_pointer (from); + h = GGC_NEW (struct tree_decl_map); h->base.from = from; h->to = to; - loc = htab_find_slot_with_hash (value_expr_for_decl, h, h->hash, INSERT); - *(struct tree_map **) loc = h; + loc = htab_find_slot_with_hash (value_expr_for_decl, h, DECL_UID (from), + INSERT); + *(struct tree_decl_map **) loc = h; } /* Hashing of types so that we don't make duplicates. -- cgit v1.2.1 From a8891ab12879a8d2f8421492c85a1b409144cea4 Mon Sep 17 00:00:00 2001 From: dodji Date: Sun, 6 Jun 2010 18:24:27 +0000 Subject: Fix PR c++/44188 gcc/ChangeLog: PR c++/44188 * c-common.c (is_typedef_decl): Move this definition ... * tree.c (is_typedef_decl): ... here. (typdef_variant_p): Move definition here from gcc/cp/tree.c. * c-common.h (is_typedef_decl): Move this declaration ... * tree.h (is_typedef_decl): ... here. (typedef_variant_p): Move declaration here from gcc/cp/cp-tree.h * dwarf2out.c (is_naming_typedef_decl): New function. (gen_tagged_type_die): Split out of ... (gen_type_die_with_usage): ... this function. When an anonymous tagged type is named by a typedef, make sure a DW_TAG_typedef DIE is emitted for the typedef. (gen_typedef_die): Emit DW_TAG_typedef also for typedefs naming anonymous tagged types. gcc/cp/ChangeLog: PR c++/44188 * cp-tree.h (typedef_variant_p): Move this declaration to gcc/tree.h. * tree.c (typedef_variant_p): Move this definition to gcc/tree.c. * decl.c (grokdeclarator): Do not rename debug info of an anonymous tagged type named by a typedef. gcc/testsuite/ChangeLog: PR c++/44188 * g++.dg/debug/dwarf2/typedef3.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160347 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 67e2f417cb9..7b1a489a03f 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -10818,4 +10818,21 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type) return binfo; } +/* Returns true if X is a typedef decl. */ + +bool +is_typedef_decl (tree x) +{ + return (x && TREE_CODE (x) == TYPE_DECL + && DECL_ORIGINAL_TYPE (x) != NULL_TREE); +} + +/* Returns true iff TYPE is a type variant created for a typedef. */ + +bool +typedef_variant_p (tree type) +{ + return is_typedef_decl (TYPE_NAME (type)); +} + #include "gt-tree.h" -- cgit v1.2.1 From ba72912a012b97cad825eebee3f5f22253d0afe4 Mon Sep 17 00:00:00 2001 From: lauras Date: Tue, 8 Jun 2010 07:25:24 +0000 Subject: gcc/ada: 2010-06-08 Laurynas Biveinis * gcc-interface/utils.c (init_gnat_to_gnu): Use typed GC allocation. (init_dummy_type): Likewise. (gnat_pushlevel): Likewise. * gcc-interface/trans.c (Attribute_to_gnu): Likewise. (Subprogram_Body_to_gnu): Likewise. (Compilation_Unit_to_gnu): Likewise. (start_stmt_group): Likewise. (extract_encoding): Likewise. (decode_name): Likewise. * gcc-interface/misc.c (gnat_printable_name): Likewise. * gcc-interface/decl.c (annotate_value): Likewise. * gcc-interface/ada-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. (SET_TYPE_LANG_SPECIFIC): Use typed GC allocation. (SET_DECL_LANG_SPECIFIC): Likewise. gcc/c-family: 2010-06-08 Laurynas Biveinis * c-pragma.c (push_alignment): Use typed GC allocation. (handle_pragma_push_options): Likewise. * c-common.c (parse_optimize_options): Likewise. * c-common.h (struct sorted_fields_type): Add variable_size GTY option. gcc/cp: 2010-06-08 Laurynas Biveinis * typeck2.c (abstract_virtuals_error): Likewise. * pt.c (maybe_process_partial_specialization): Likewise. (register_specialization): Likewise. (add_pending_template): Likewise. (lookup_template_class): Likewise. (push_tinst_level): Likewise. * parser.c (cp_lexer_new_main): Likewise. (cp_lexer_new_from_tokens): Likewise. (cp_token_cache_new): Likewise. (cp_parser_context_new): Likewise. (cp_parser_new): Likewise. (cp_parser_nested_name_specifier_opt): Likewise. (cp_parser_template_id): Likewise. * name-lookup.c (binding_entry_make): Likewise. (binding_table_construct): Likewise. (binding_table_new): Likewise. (cxx_binding_make): Likewise. (pushdecl_maybe_friend): Likewise. (begin_scope): Likewise. (push_to_top_level): Likewise. * lex.c (init_reswords): Likewise. (retrofit_lang_decl): Likewise. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. * decl.c (make_label_decl): Likewise. (check_goto): Likewise. (start_preparsed_function): Likewise. (save_function_data): Likewise. * cp-tree.h (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. * cp-objcp-common.c (decl_shadowed_for_var_insert): Likewise. * class.c (finish_struct_1): Likewise. * cp-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. * parser.c (cp_parser_new): Update comment to not reference ggc_alloc. gcc/fortran: 2010-06-08 Laurynas Biveinis * trans-types.c (gfc_get_nodesc_array_type): Use typed GC allocation. (gfc_get_array_type_bounds): Likewise. * trans-decl.c (gfc_allocate_lang_decl): Likewise. (gfc_find_module): Likewise. * f95-lang.c (pushlevel): Likewise. * trans.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. gcc/java: 2010-06-08 Laurynas Biveinis * jcf-reader.c (jcf_parse_constant_pool): Use typed GC allocation. * jcf-parse.c (java_parse_file): Likewise. (process_zip_dir): Likewise. * java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Likewise. (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Likewise. * expr.c (add_type_assertion): Likewise. * decl.c (make_binding_level): Likewise. (java_dup_lang_specific_decl): Likewise. * constants.c (set_constant_entry): Likewise. (cpool_for_class): Likewise. * class.c (add_method_1): Likewise. (java_treetreehash_new): Likewise. * java-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. * jch.h (struct cpool_entry): Likewise. * java-tree.h (java_treetreehash_create): Remove parameter ggc. * except.c (prepare_eh_table_type): Update java_treetreehash_create call. * class.c (add_method_1): Update java_treetreehash_create call. (java_treetreehash_create): Remove parameter gc. Use htab_create_ggc. gcc/lto: 2010-06-08 Laurynas Biveinis * lto.c (lto_read_in_decl_state): Use typed GC allocation. (lto_file_read): Likewise. (new_partition): Likewise. (read_cgraph_and_symbols): Likewise. gcc/objc: 2010-06-08 Laurynas Biveinis * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC allocation. * objc-act.c (objc_volatilize_decl): Likewise. (objc_build_string_object): Likewise. (hash_init): Likewise. (hash_enter): Likewise. (hash_add_attr): Likewise. (add_class): Likewise. (start_class): Likewise. gcc/objcp: 2010-06-08 Laurynas Biveinis * objcp-decl.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC allocation. gcc: 2010-06-08 Laurynas Biveinis * doc/tm.texi (Per-Function Data): Do not reference ggc_alloc. * doc/gty.texi (GTY Options): Document typed GC allocation and variable_size GTY option. * ggc-internal.h: New. * ggc.h: Update copyright year. (digit_string): Move to stringpool.c. (ggc_mark_stringpool, ggc_purge_stringpool, ggc_mark_roots) (gt_pch_save_stringpool, gt_pch_fixup_stringpool) (gt_pach_restore_stringpool, gt_pch_p_S, gt_pch_note_object) (init_ggc_pch, ggc_pch_count_object, ggc_pch_total_size) (ggc_pch_this_base, ggc_pch_alloc_object, ggc_pch_prepare_write) (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read) (ggc_force_collect, ggc_get_size, ggc_statistics) (ggc_print_common_statistics): Move to ggc-internal.h. (digit_vector, new_ggc_zone, destroy_ggc_zone, ggc_alloc_stat) (ggc_alloc, ggc_alloc_cleared, ggc_realloc, ggc_calloc, GGC_NEW) (GGC_CNEW, GGC_NEWVEC, GGC_CNEWVEC, GGC_NEWVAR, ggc_alloc_rtvec) (ggc_alloc_tree, gt_pch_save, ggc_min_expand_heuristic) (ggc_min_heapsize_heuristic, ggc_alloc_zone) (ggc_alloc_zone_pass_stat): Remove. (ggc_internal_alloc_stat, ggc_internal_alloc) (ggc_internal_cleared_alloc_stat): New. (GGC_RESIZEVEC, GGC_RESIZEVAR): Redefine. (ggc_internal_vec_alloc_stat) (ggc_internal_cleared_vec_alloc_stat) (ggc_internal_vec_alloc_stat, ggc_internal_cleared_vec_alloc) (ggc_alloc_atomic_stat, ggc_alloc_atomic) (ggc_alloc_cleared_atomic, ggc_cleared_alloc_htab_ignore_args) (ggc_cleared_alloc_ptr_array_two_args): New. (htab_create_ggc, splay_tree_new_ggc): Redefine. (ggc_splay_alloc): Change the type of the first argument to enum gt_types_enum. (ggc_alloc_string): Make macro. (ggc_alloc_string_stat): New. (ggc_strdup): Redefine. (rtl_zone, tree_zone, tree_id_zone): Declare unconditionally. (ggc_alloc_rtvec_sized): New. (ggc_alloc_zone_stat): Rename to ggc_internal_alloc_zone_stat. (ggc_internal_alloc_zone_pass_stat, ggc_internal_alloc_zone_stat) (ggc_internal_cleared_alloc_zone_stat) (ggc_internal_zone_alloc_stat) (ggc_internal_zone_cleared_alloc_stat) (ggc_internal_zone_vec_alloc_stat) (ggc_alloc_zone_rtx_def_stat) (ggc_alloc_zone_tree_node_stat) (ggc_alloc_zone_cleared_tree_node_stat) (ggc_alloc_cleared_gimple_statement_d_stat): New. * ggc-common.c: Include ggc-internal.h. (ggc_internal_cleared_alloc_stat): Rename from ggc_alloc_cleared_stat. (ggc_realloc_stat): Use ggc_internal_alloc_stat. (ggc_calloc): Remove. (ggc_cleared_alloc_htab_ignore_args): New. (ggc_cleared_alloc_ptr_array_two_args): New. (ggc_splay_alloc): Add obj_type parameter. (init_ggc_heuristics): Formatting fixes. * ggc-none.c: Update copyright year. (ggc_alloc_stat): Rename to ggc_alloc_stat. (ggc_alloc_cleared_stat): Rename to ggc_internal_cleared_alloc_stat. (struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New. * ggc-page.c: Update copyright year. Include ggc-internal.h. Remove references to ggc_alloc in comments. (ggc_alloc_typed_stat): Call ggc_internal_alloc_stat. (ggc_alloc_stat): Rename to ggc_internal_alloc_stat. (new_ggc_zone, destroy_ggc_zone): Remove. (struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New. * ggc-zone.c: Include ggc-internal.h. Remove references to ggc_alloc in comments. (ggc_alloc_zone_stat): ggc_internal_alloc_zone_stat. (ggc_internal_alloc_zone_pass_stat): New. (ggc_internal_cleared_alloc_zone_stat): New. (ggc_alloc_typed_stat): Use ggc_internal_alloc_zone_pass_stat. (ggc_alloc_stat): Rename ggc_internal_alloc_stat. (new_ggc_zone, destroy_ggc_zone): Remove. * stringpool.c: Update copyright year. Include ggc-internal.h (digit_vector): Make static. (digit_string): Moved from ggc.h. (stringpool_ggc_alloc): Use ggc_alloc_atomic. (ggc_alloc_string): Rename to ggc_alloc_string_stat. * Makefile.in (GGC_INTERNAL_H): New. (ggc_common.o, ggc-page.o, ggc-zone.o, stringpool.o): Add $(GGC_INTERNAL_H) to dependencies. * gentype.c: Update copyright year. (walk_type): Accept variable_size GTY option. (USED_BY_TYPED_GC_P): New macro. (write_enum_defn): Use USED_BY_TYPED_GC_P. Do not output whitespace at the end of strings. (get_type_specifier, variable_size_p): New functions. (alloc_quantity, alloc_zone): New enums. (write_typed_alloc_def): New function. (write_typed_struct_alloc_def): Likewise. (write_typed_typed_typedef_alloc_def): Likewise. (write_typed_alloc_defns): Likewise. (output_typename, write_splay_tree_allocator_def): Likewise. (write_splay_tree_allocators): Likewise. (main): Call write_typed_alloc_defns and write_splay_tree_allocators. * lto-streamer.h (lto_file_decl_data_ptr): New. * passes.c (order): Define using cgraph_node_ptr. * strinpool.c (struct string_pool_data): Declare nested_ptr using ht_identifier_ptr. * gimple.h (union gimple_statement_d): Likewise. * rtl.h (struct rtx_def): Likewise. (struct rtvec_def): Likewise. * tree.h (union tree_node): Likewise. * tree-ssa-operands.h (struct ssa_operand_memory_d): Likewise. * cfgloop.c (record_loop_exits): Use htab_create_ggc. * tree-scalar-evolution.c (scev_initialize): Likewise. * alias.c (record_alias_subset): Update splay_tree_new_ggc call. * dwarf2asm.c (dw2_force_const_mem): Likewise. * omp-low.c (lower_omp_critical): Likewise. * bitmap.h (struct bitmap_head_def): Update comment to not reference ggc_alloc. * config/pa/pa.c (get_deferred_label): Use GGC_RESIZEVEC. * ira.c (fix_reg_equiv_init): Use GGC_RESIZEVEC. * ipa-prop.c (duplicate_ggc_array): Rename to duplicate_ipa_jump_func_array. Use typed GC allocation. (ipa_edge_duplication_hook): Call duplicate_ipa_jump_func_array. * gimple.c (gimple_alloc_stat): Use ggc_alloc_cleared_gimple_statement_d_stat. * varasm.c (create_block_symbol): Use ggc_alloc_zone_rtx_def. * tree.c (make_node_stat): Use ggc_alloc_zone_cleared_tree_node_stat. (make_tree_vec_stat): Likewise. (build_vl_exp_stat): Likewise. (copy_node_stat): Use ggc_alloc_zone_tree_node_stat. (make_tree_binfo_stat): Likewise. (tree_cons_stat): Likewise. * rtl.c (rtx_alloc_stat): Use ggc_alloc_zone_rtx_def_stat. (shallow_copy_rtx_stat): Likewise. (make_node_stat): Likewise. * lto-symtab.c: Fix comment. * tree-cfg.c (create_bb): Update comment to not reference ggc_alloc_cleared. * tree-ssa-structalias.c (struct heapvar_for_stmt): Fix param_is value. * varpool.c (varpool_node): Use typed GC allocation. (varpool_extra_name_alias): Likewise. * varasm.c (emutls_decl): Likewise. (get_unnamed_section): Likewise. (get_noswitch_section): Likewise. (get_section): Likewise. (get_block_for_section): Likewise. (build_constant_desc): Likewise. (create_constant_pool): Likewise. (force_const_mem): Likewise. * tree.c (build_vl_exp_stat): Likewise. (build_real): Likewise. (build_string): Likewise. (decl_debug_expr_insert): Likewise. (decl_value_expr_insert): Likewise. (type_hash_add): Likewise. (build_omp_clause): Likewise. * tree-ssanames.c (duplicate_ssa_name_ptr_info): Likewise. * tree-ssa.c (init_tree_ssa): Likewise. * tree-ssa-structalias.c (heapvar_insert): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Likewise. * tree-ssa-loop-niter.c (record_estimate): Likewise. * tree-ssa-alias.c (get_ptr_info): Likewise. * tree-scalar-evolution.c (new_scev_info_str): Likewise. * tree-phinodes.c (allocate_phi_node): Likewise. * tree-iterator.c (tsi_link_before): Likewise. (tsi_link_after): Likewise. * tree-eh.c (add_stmt_to_eh_lp_fn): Likewise. * tree-dfa.c (create_var_ann): Likewise. * tree-cfg.c (create_bb): Likewise. * toplev.c (alloc_for_identifier_to_locale): Likewise. (general_init): Likewise. * stringpool.c (stringpool_ggc_alloc): Likewise. (gt_pch_save_stringpool): Likewise. * sese.c (if_region_set_false_region): Likewise. * passes.c (do_per_function_toporder): Likewise. * optabs.c (set_optab_libfunc): Likewise. (set_conv_libfunc): Likewise. * lto-symtab.c (lto_symtab_register_decl): Likewise. * lto-streamer-in.c (lto_input_eh_catch_list): Likewise. (input_eh_region): Likewise. (input_eh_lp): Likewise. (make_new_block): Likewise. (unpack_ts_real_cst_value_fields): Likewise. * lto-section-in.c (lto_new_in_decl_state): Likewise. * lto-cgraph.c (input_node_opt_summary): Likewise. * loop-init.c (loop_optimizer_init): Likewise. * lambda.h (lambda_vector_new): Likewise. * lambda-code.c (replace_uses_equiv_to_x_with_y): Likewise. * ira.c (update_equiv_regs): Likewise. * ipa.c (cgraph_node_set_new): Likewise. (cgraph_node_set_add): Likewise. (varpool_node_set_new): Likewise. (varpool_node_set_add): Likewise. * ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise. (duplicate_ipa_jump_func_array): Likewise. (ipa_read_node_info): Likewise. * ipa-cp.c (ipcp_create_replace_map): Likewise. * integrate.c (get_hard_reg_initial_val): Likewise. * gimple.c (gimple_alloc_stat): Likewise. (gimple_build_omp_for): Likewise. (gimple_seq_alloc): Likewise. (gimple_copy): Likewise. * gimple-iterator.c (gsi_insert_before_without_update): Likewise. (gsi_insert_after_without_update): Likewise. * function.c (add_frame_space): Likewise. (insert_temp_slot_address): Likewise. (assign_stack_temp_for_type): Likewise. (allocate_struct_function): Likewise. (types_used_by_var_decl_insert): Likewise. * except.c (init_eh_for_function): Likewise. (gen_eh_region): Likewise. (gen_eh_region_catch): Likewise. (gen_eh_landing_pad): Likewise. (add_call_site): Likewise. * emit-rtl.c (get_mem_attrs): Likewise. (get_reg_attrs): Likewise. (start_sequence): Likewise. (init_emit): Likewise. * dwarf2out.c (new_cfi): Likewise. (queue_reg_save): Likewise. (dwarf2out_frame_init): Likewise. (new_loc_descr): Likewise. (find_AT_string): Likewise. (new_die): Likewise. (add_var_loc_to_decl): Likewise. (clone_die): Likewise. (clone_as_declaration): Likewise. (break_out_comdat_types): Likewise. (new_loc_list): Likewise. (loc_descriptor): Likewise. (add_loc_descr_to_each): Likewise. (add_const_value_attribute): Likewise. (tree_add_const_value_attribute): Likewise. (add_comp_dir_attribute): Likewise. (add_name_and_src_coords_attributes): Likewise. (lookup_filename): Likewise. (store_vcall_insn): Likewise. (dwarf2out_init): Likewise. * dbxout.c (dbxout_init): Likewise. * config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise. * config/sparc/sparc.c (sparc_init_machine_status): Likewise. * config/score/score7.c (score7_output_external): Likewise. * config/score/score3.c (score3_output_external): Likewise. * config/s390/s390.c (s390_init_machine_status): Likewise. * config/rs6000/rs6000.c (builtin_function_type): Likewise. (rs6000_init_machine_status): Likewise. (output_toc): Likewise. * config/pa/pa.c (pa_init_machine_status): Likewise. (get_deferred_plabel): Likewise. * config/moxie/moxie.c (moxie_init_machine_status): Likewise. * config/mmix/mmix.c (mmix_init_machine_status): Likewise. * config/mips/mips.c (mflip_mips16_use_mips16_p): Likewise. * config/mep/mep.c (mep_init_machine_status): Likewise. (mep_note_pragma_flag): Likewise. * config/m32c/m32c.c (m32c_init_machine_status): Likewise. * config/iq2000/iq2000.c (iq2000_init_machine_status): Likewise. * config/ia64/ia64.c (ia64_init_machine_status): Likewise. * config/i386/winnt.c (i386_pe_record_external_function): Likewise. (i386_pe_maybe_record_exported_symbol): Likewise. * config/i386/i386.c (get_dllimport_decl): Likewise. (ix86_init_machine_status): Likewise. (assign_386_stack_local): Likewise. * config/frv/frv.c (frv_init_machine_status): Likewise. * config/darwin.c (machopic_indirection_name): Likewise. * config/cris/cris.c (cris_init_machine_status): Likewise. * config/bfin/bfin.c (bfin_init_machine_status): Likewise. * config/avr/avr.c (avr_init_machine_status): Likewise. * config/arm/arm.c (arm_init_machine_status): Likewise. * config/alpha/alpha.c (alpha_init_machine_status): Likewise. (alpha_need_linkage): Likewise. (alpha_use_linkage): Likewise. * cgraph.c (cgraph_allocate_node): Likewise. (cgraph_create_edge_1): Likewise. (cgraph_create_indirect_edge): Likewise. (cgraph_add_asm_node): Likewise. * cfgrtl.c (init_rtl_bb_info): Likewise. * cfgloop.c (alloc_loop): Likewise. (rescan_loop_exit): Likewise. * cfg.c (init_flow): Likewise. (alloc_block): Likewise. (unchecked_make_edge): Likewise. * c-parser.c (c_parse_init): Likewise. (c_parse_file): Likewise. * c-decl.c (bind): Likewise. (record_inline_static): Likewise. (push_scope): Likewise. (make_label): Likewise. (lookup_label_for_goto): Likewise. (finish_struct): Likewise. (finish_enum): Likewise. (c_push_function_context): Likewise. * bitmap.c (bitmap_element_allocate): Likewise. (bitmap_gc_alloc_stat): Likewise. * alias.c (record_alias_subset): Likewise. (init_alias_analysis): Likewise. include: 2010-06-08 Laurynas Biveinis * splay-tree.h: Update copyright years. (splay_tree_s): Document fields. (splay_tree_new_typed_alloc): New. * hashtab.h: Update copyright years. (htab_create_typed_alloc): New. libcpp: 2010-06-08 Laurynas Biveinis * include/symtab.h (ht_identifier_ptr): New. libiberty: 2010-06-08 Laurynas Biveinis * splay-tree.c: Update copyright years. (splay_tree_new_typed_alloc): New. (splay_tree_new_with_allocator): Use it. * hashtab.c: Update copyright years. (htab_create_typed_alloc): New. (htab_create_alloc): Use it. * functions.texi: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160425 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 46 +++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 27 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 7b1a489a03f..3c1a8782cbb 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -853,13 +853,9 @@ make_node_stat (enum tree_code code MEM_STAT_DECL) tree_node_sizes[(int) kind] += length; #endif - if (code == IDENTIFIER_NODE) - t = (tree) ggc_alloc_zone_pass_stat (length, &tree_id_zone); - else - t = (tree) ggc_alloc_zone_pass_stat (length, &tree_zone); - - memset (t, 0, length); - + t = ggc_alloc_zone_cleared_tree_node_stat ( + (code == IDENTIFIER_NODE) ? &tree_id_zone : &tree_zone, + length PASS_MEM_STAT); TREE_SET_CODE (t, code); switch (type) @@ -952,7 +948,7 @@ copy_node_stat (tree node MEM_STAT_DECL) gcc_assert (code != STATEMENT_LIST); length = tree_size (node); - t = (tree) ggc_alloc_zone_pass_stat (length, &tree_zone); + t = ggc_alloc_zone_tree_node_stat (&tree_zone, length PASS_MEM_STAT); memcpy (t, node, length); TREE_CHAIN (t) = 0; @@ -1385,7 +1381,7 @@ build_fixed (tree type, FIXED_VALUE_TYPE f) FIXED_VALUE_TYPE *fp; v = make_node (FIXED_CST); - fp = GGC_NEW (FIXED_VALUE_TYPE); + fp = ggc_alloc_fixed_value (); memcpy (fp, &f, sizeof (FIXED_VALUE_TYPE)); TREE_TYPE (v) = type; @@ -1406,7 +1402,7 @@ build_real (tree type, REAL_VALUE_TYPE d) Consider doing it via real_convert now. */ v = make_node (REAL_CST); - dp = GGC_NEW (REAL_VALUE_TYPE); + dp = ggc_alloc_real_value (); memcpy (dp, &d, sizeof (REAL_VALUE_TYPE)); TREE_TYPE (v) = type; @@ -1466,7 +1462,7 @@ build_string (int len, const char *str) tree_node_sizes[(int) c_kind] += length; #endif - s = ggc_alloc_tree (length); + s = ggc_alloc_tree_node (length); memset (s, 0, sizeof (struct tree_common)); TREE_SET_CODE (s, STRING_CST); @@ -1555,7 +1551,7 @@ make_tree_binfo_stat (unsigned base_binfos MEM_STAT_DECL) tree_node_sizes[(int) binfo_kind] += length; #endif - t = (tree) ggc_alloc_zone_pass_stat (length, &tree_zone); + t = ggc_alloc_zone_tree_node_stat (&tree_zone, length PASS_MEM_STAT); memset (t, 0, offsetof (struct tree_binfo, base_binfos)); @@ -1580,9 +1576,7 @@ make_tree_vec_stat (int len MEM_STAT_DECL) tree_node_sizes[(int) vec_kind] += length; #endif - t = (tree) ggc_alloc_zone_pass_stat (length, &tree_zone); - - memset (t, 0, length); + t = ggc_alloc_zone_cleared_tree_node_stat (&tree_zone, length PASS_MEM_STAT); TREE_SET_CODE (t, TREE_VEC); TREE_VEC_LENGTH (t) = len; @@ -2093,13 +2087,13 @@ build_tree_list_vec_stat (const VEC(tree,gc) *vec MEM_STAT_DECL) purpose and value fields are PURPOSE and VALUE and whose TREE_CHAIN is CHAIN. */ -tree +tree tree_cons_stat (tree purpose, tree value, tree chain MEM_STAT_DECL) { tree node; - node = (tree) ggc_alloc_zone_pass_stat (sizeof (struct tree_list), &tree_zone); - + node = ggc_alloc_zone_tree_node_stat (&tree_zone, sizeof (struct tree_list) + PASS_MEM_STAT); memset (node, 0, sizeof (struct tree_common)); #ifdef GATHER_STATISTICS @@ -3578,7 +3572,7 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL) gcc_assert (TREE_CODE_LENGTH (code) == 1); - t = (tree) ggc_alloc_zone_pass_stat (length, &tree_zone); + t = ggc_alloc_zone_tree_node_stat (&tree_zone, length PASS_MEM_STAT); memset (t, 0, sizeof (struct tree_common)); @@ -5638,7 +5632,7 @@ decl_priority_info (tree decl) h = (struct tree_priority_map *) *loc; if (!h) { - h = GGC_CNEW (struct tree_priority_map); + h = ggc_alloc_cleared_tree_priority_map (); *loc = h; h->base.from = decl; h->init = DEFAULT_INIT_PRIORITY; @@ -5717,7 +5711,7 @@ decl_debug_expr_insert (tree from, tree to) struct tree_decl_map *h; void **loc; - h = GGC_NEW (struct tree_decl_map); + h = ggc_alloc_tree_decl_map (); h->base.from = from; h->to = to; loc = htab_find_slot_with_hash (debug_expr_for_decl, h, DECL_UID (from), @@ -5748,7 +5742,7 @@ decl_value_expr_insert (tree from, tree to) struct tree_decl_map *h; void **loc; - h = GGC_NEW (struct tree_decl_map); + h = ggc_alloc_tree_decl_map (); h->base.from = from; h->to = to; loc = htab_find_slot_with_hash (value_expr_for_decl, h, DECL_UID (from), @@ -5921,7 +5915,7 @@ type_hash_add (hashval_t hashcode, tree type) struct type_hash *h; void **loc; - h = GGC_NEW (struct type_hash); + h = ggc_alloc_type_hash (); h->hash = hashcode; h->type = type; loc = htab_find_slot_with_hash (type_hash_table, h, hashcode, INSERT); @@ -9422,7 +9416,7 @@ build_omp_clause (location_t loc, enum omp_clause_code code) length = omp_clause_num_ops[code]; size = (sizeof (struct tree_omp_clause) + (length - 1) * sizeof (tree)); - t = GGC_NEWVAR (union tree_node, size); + t = ggc_alloc_tree_node (size); memset (t, 0, size); TREE_SET_CODE (t, OMP_CLAUSE); OMP_CLAUSE_SET_CODE (t, code); @@ -9455,9 +9449,7 @@ build_vl_exp_stat (enum tree_code code, int len MEM_STAT_DECL) tree_node_sizes[(int) e_kind] += length; #endif - t = (tree) ggc_alloc_zone_pass_stat (length, &tree_zone); - - memset (t, 0, length); + t = ggc_alloc_zone_cleared_tree_node_stat (&tree_zone, length PASS_MEM_STAT); TREE_SET_CODE (t, code); -- cgit v1.2.1 From 1df3c246147fc1bf3ec6e6dad58701dbc6858a33 Mon Sep 17 00:00:00 2001 From: froydnj Date: Thu, 17 Jun 2010 17:26:28 +0000 Subject: gcc/ * tree.h (vec_member): Declare. * tree.c (vec_member): Define. gcc/cp/ * name-lookup.c (struct arg_lookup): Convert namespaces and classes fields to VEC. (arg_assoc_namespace): Adjust for new type of namespaces. (arg_assoc_class): Adjust for new type of classes. (lookup_arg_dependent): Use make_tree_vector and release_tree_vector. * typeck2.c (build_x_arrow): Use vec_member. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160936 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 3c1a8782cbb..0922ab5b915 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1917,6 +1917,19 @@ purpose_member (const_tree elem, tree list) return NULL_TREE; } +/* Return true if ELEM is in V. */ + +bool +vec_member (const_tree elem, VEC(tree,gc) *v) +{ + unsigned ix; + tree t; + for (ix = 0; VEC_iterate (tree, v, ix, t); ix++) + if (elem == t) + return true; + return false; +} + /* Returns element number IDX (zero-origin) of chain CHAIN, or NULL_TREE. */ -- cgit v1.2.1 From 00f4f70565fa903b89c2f1be5059898ddb069db0 Mon Sep 17 00:00:00 2001 From: bernds Date: Fri, 25 Jun 2010 08:56:24 +0000 Subject: With large parts from Jim Wilson: PR target/43902 * tree-pretty-print.c (dump_generic_node, op_code_prio): Add WIDEN_MULT_PLUS_EXPR and WIDEN_MULT_MINUS_EXPR. * optabs.c (optab_for_tree_code): Likewise. (expand_widen_pattern_expr): Likewise. * tree-ssa-math-opts.c (convert_mult_to_widen): New function, broken out of execute_optimize_widening_mul. (convert_plusminus_to_widen): New function. (execute_optimize_widening_mul): Use the two new functions. * expr.c (expand_expr_real_2): Add support for GIMPLE_TERNARY_RHS. Remove code to generate widening multiply-accumulate. Add support for WIDEN_MULT_PLUS_EXPR and WIDEN_MULT_MINUS_EXPR. * gimple-pretty-print.c (dump_ternary_rhs): New function. (dump_gimple_assign): Call it when appropriate. * tree.def (WIDEN_MULT_PLUS_EXPR, WIDEN_MULT_MINUS_EXPR): New codes. * cfgexpand.c (gimple_assign_rhs_to_tree): Likewise. (expand_gimple_stmt_1): Likewise. (expand_debug_expr): Support WIDEN_MULT_PLUS_EXPR and WIDEN_MULT_MINUS_EXPR. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-inline.c (estimate_operator_cost): Likewise. * gimple.c (extract_ops_from_tree_1): Renamed from extract_ops_from_tree. Add new arg for a third operand; fill it. (gimple_build_assign_stat): Support operations with three operands. (gimple_build_assign_with_ops_stat): Likewise. (gimple_assign_set_rhs_from_tree): Likewise. (gimple_assign_set_rhs_with_ops_1): Renamed from gimple_assign_set_rhs_with_ops. Add new arg for a third operand. (get_gimple_rhs_num_ops): Support GIMPLE_TERNARY_RHS. (get_gimple_rhs_num_ops): Handle WIDEN_MULT_PLUS_EXPR and WIDEN_MULT_MINUS_EXPR. * gimple.h (enum gimple_rhs_class): Add GIMPLE_TERNARY_RHS. (extract_ops_from_tree_1): Adjust declaration. (gimple_assign_set_rhs_with_ops_1): Likewise. (gimple_build_assign_with_ops): Pass NULL for last operand. (gimple_build_assign_with_ops3): New macro. (gimple_assign_rhs3, gimple_assign_rhs3_ptr, gimple_assign_set_rhs3, gimple_assign_set_rhs_with_ops, extract_ops_from_tree): New inline functions. * tree-cfg.c (verify_gimple_assign_ternary): New static function. (verify_gimple_assign): Call it. * doc/gimple.texi (Manipulating operands): Document GIMPLE_TERNARY_RHS. (Tuple specific accessors, subsection GIMPLE_ASSIGN): Document new functions for dealing with three-operand statements. * tree.c (commutative_ternary_tree_code): New function. * tree.h (commutative_ternary_tree_code): Declare it. * tree-vrp.c (gimple_assign_nonnegative_warnv_p): Return false for ternary statements. (gimple_assign_nonzero_warnv_p): Likewise. * tree-ssa-sccvn.c (stmt_has_constants): Handle GIMPLE_TERNARY_RHS. * tree-ssa-ccp.c (get_rhs_assign_op_for_ccp): New static function. (ccp_fold): Use it. Handle GIMPLE_TERNARY_RHS. * tree-ssa-dom.c (enum expr_kind): Add EXPR_TERNARY. (struct hashtable_expr): New member ternary in the union. (initialize_hash_element): Handle GIMPLE_TERNARY_RHS. (hashable_expr_equal_p): Fix indentation. Handle EXPR_TERNARY. (iterative_hash_hashable_expr): Likewise. (print_expr_hash_elt): Handle EXPR_TERNARY. * gimple-fold.c (fold_gimple_assign): Handle GIMPLE_TERNARY_RHS. * tree-ssa-threadedge.c (fold_assignment_stmt): Remove useless break statements. Handle GIMPLE_TERNARY_RHS. testsuite/ PR target/43902 * gcc.target/mips/madd-9.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161366 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 0922ab5b915..a02ac395a33 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -6540,6 +6540,23 @@ commutative_tree_code (enum tree_code code) return false; } +/* Return true if CODE represents a ternary tree code for which the + first two operands are commutative. Otherwise return false. */ +bool +commutative_ternary_tree_code (enum tree_code code) +{ + switch (code) + { + case WIDEN_MULT_PLUS_EXPR: + case WIDEN_MULT_MINUS_EXPR: + return true; + + default: + break; + } + return false; +} + /* Generate a hash value for an expression. This can be used iteratively by passing a previous result as the VAL argument. -- cgit v1.2.1 From fd8d648f5d683591eda703215ed615ea2a605c8d Mon Sep 17 00:00:00 2001 From: hubicka Date: Mon, 28 Jun 2010 00:10:34 +0000 Subject: PR middle-end/44671 PR middle-end/44686 * tree.c (build_function_decl_skip_args): Clear DECL_BUILT_IN on signature change. * ipa-split.c (split_function): Always clear DECL_BUILT_IN. * ipa-prop.c (ipa_modify_formal_parameters): Likewise. * gcc.c-torture/pr44686.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161476 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index a02ac395a33..5e7de012e2a 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -7303,6 +7303,13 @@ build_function_decl_skip_args (tree orig_decl, bitmap args_to_skip) we expect first argument to be THIS pointer. */ if (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) && !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; } -- cgit v1.2.1 From d3237426929c302bcab9d683353b041667b22488 Mon Sep 17 00:00:00 2001 From: aesok Date: Mon, 28 Jun 2010 18:23:16 +0000 Subject: * double-int.h (force_fit_type_double): Remove declaration. * double-int.c (force_fit_type_double): Move to tree.c. * tree.h (force_fit_type_double): Declare. * tree.h (force_fit_type_double): Moved from double-int.c. Use double_int type for 'cst' argument. Use double_int_fits_to_tree_p and double_int_to_tree instead of fit_double_type and build_int_cst_wide. * convert.c (convert_to_pointer): Adjust call to force_fit_type_double. * tree-vrp.c (extract_range_from_assert, extract_range_from_unary_expr): Adjust call to force_fit_type_double. * fold-const.c: Update comment. (int_const_binop, fold_convert_const_int_from_int, fold_convert_const_int_from_real, fold_convert_const_int_from_fixed, extract_muldiv_1, fold_div_compare, fold_sign_changed_comparison, fold_unary_loc, fold_negate_const, fold_abs_const, fold_not_const, round_up_loc): Adjust call to force_fit_type_double. /c-family * c-common.c (shorten_compare): Adjust call to force_fit_type_double. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161509 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 5e7de012e2a..de83e64cea1 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1092,6 +1092,52 @@ double_int_fits_to_tree_p (const_tree type, double_int cst) return double_int_equal_p (cst, ext); } +/* 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. */ + + +tree +force_fit_type_double (tree type, double_int cst, int overflowable, + bool overflowed) +{ + bool sign_extended_type; + + /* Size types *are* sign extended. */ + sign_extended_type = (!TYPE_UNSIGNED (type) + || (TREE_CODE (type) == INTEGER_TYPE + && TYPE_IS_SIZETYPE (type))); + + /* If we need to set overflow flags, return a new unshared node. */ + if (overflowed || !double_int_fits_to_tree_p(type, cst)) + { + if (overflowed + || overflowable < 0 + || (overflowable > 0 && sign_extended_type)) + { + tree t = make_node (INTEGER_CST); + TREE_INT_CST (t) = double_int_ext (cst, TYPE_PRECISION (type), + !sign_extended_type); + TREE_TYPE (t) = type; + TREE_OVERFLOW (t) = 1; + return t; + } + } + + /* Else build a shared node. */ + return double_int_to_tree (type, cst); +} + /* These are the hash table functions for the hash table of INTEGER_CST nodes of a sizetype. */ -- cgit v1.2.1 From 182cf5a9a415f31df0f9a10e46faed1221484a35 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 1 Jul 2010 08:49:19 +0000 Subject: 2010-07-01 Richard Guenther PR middle-end/42834 PR middle-end/44468 * doc/gimple.texi (is_gimple_mem_ref_addr): Document. * doc/generic.texi (References to storage): Document MEM_REF. * tree-pretty-print.c (dump_generic_node): Handle MEM_REF. (print_call_name): Likewise. * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF. (build_simple_mem_ref_loc): New function. (mem_ref_offset): Likewise. * tree.h (build_simple_mem_ref_loc): Declare. (build_simple_mem_ref): Define. (mem_ref_offset): Declare. * fold-const.c: Include tree-flow.h. (operand_equal_p): Handle MEM_REF. (build_fold_addr_expr_with_type_loc): Likewise. (fold_comparison): Likewise. (fold_unary_loc): Fold VIEW_CONVERT_EXPR > to MEM_REF . (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2], fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2]. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF. (ptr_deref_may_alias_ref_p_1): Likewise. (ao_ref_base_alias_set): Properly differentiate base object for offset and TBAA. (ao_ref_init_from_ptr_and_size): Use MEM_REF. (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. Remove pointer SSA name def chasing code. (ref_maybe_used_by_call_p_1): Handle MEM_REF. (call_may_clobber_ref_p_1): Likewise. * dwarf2out.c (loc_list_from_tree): Handle MEM_REF. * expr.c (expand_assignment): Handle MEM_REF. (store_expr): Handle MEM_REFs from STRING_CSTs. (store_field): If expanding a MEM_REF of a non-addressable decl use bitfield operations. (get_inner_reference): Handle MEM_REF. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * tree-eh.c (tree_could_trap_p): Handle MEM_REF. * alias.c (ao_ref_from_mem): Handle MEM_REF. (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs. * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF. (dr_analyze_indices): Likewise. (dr_analyze_alias): Likewise. (object_address_invariant_in_loop_p): Likewise. * gimplify.c (mark_addressable): Handle MEM_REF. (gimplify_cond_expr): Build MEM_REFs. (gimplify_modify_expr_to_memcpy): Likewise. (gimplify_init_ctor_preeval_1): Handle MEM_REF. (gimple_fold_indirect_ref): Adjust. (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF. * tree.def (MEM_REF): New tree code. * tree-dfa.c: Include toplev.h. (get_ref_base_and_extent): Handle MEM_REF. (get_addr_base_and_unit_offset): New function. * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF. * gimple-fold.c (may_propagate_address_into_dereference): Handle MEM_REF. (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds accesses if the array has just one dimension. Remove always true parameter. Do not require type compatibility here. (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_stmt_indirect): Remove. (maybe_fold_reference): Remove INDIRECT_REF handling. Fold back to non-MEM_REF. (maybe_fold_offset_to_address): Simplify. Deal with type mismatches here. (maybe_fold_reference): Likewise. (maybe_fold_stmt_addition): Likewise. Also handle &ARRAY + I in addition to &ARRAY[0] + I. (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs. (gimple_get_relevant_ref_binfo): Handle MEM_REF. * cfgexpand.c (expand_debug_expr): Handle MEM_REF. * tree-ssa.c (useless_type_conversion_p): Make most pointer conversions useless. (warn_uninitialized_var): Handle MEM_REF. (maybe_rewrite_mem_ref_base): New function. (execute_update_addresses_taken): Implement re-writing of MEM_REFs to SSA form. * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove INDIRECT_REF handling. (copy_tree_body_r): Handle MEM_REF. * gimple.c (is_gimple_addressable): Adjust. (is_gimple_address): Likewise. (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with invariant base are invariant. (is_gimple_min_lval): Adjust. (is_gimple_mem_ref_addr): New function. (get_base_address): Handle MEM_REF. (count_ptr_derefs): Likewise. (get_base_loadstore): Likewise. * gimple.h (is_gimple_mem_ref_addr): Declare. (gimple_call_fndecl): Handle invariant MEM_REF addresses. * tree-cfg.c (verify_address): New function, split out from ... (verify_expr): ... here. Use for verifying ADDR_EXPRs and the address operand of MEM_REFs. Verify MEM_REFs. Reject INDIRECT_REFs. (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow INDIRECT_REF. Allow conversions. (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of a register does not change its size. (verify_types_in_gimple_reference): Verify MEM_REF. (verify_gimple_assign_single): Disallow INDIRECT_REF. Handle MEM_REF. * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable): New. (mark_address_taken): Handle MEM_REF. (get_indirect_ref_operands): Pass through opf_not_non_addressable. (get_asm_expr_operands): Pass opf_not_non_addressable. (get_expr_operands): Handle opf_[not_]non_addressable. Handle MEM_REF. Remove INDIRECT_REF handling. * tree-vrp.c: (check_array_ref): Handle MEM_REF. (search_for_addr_array): Likewise. (check_array_bounds): Likewise. (vrp_stmt_computes_nonzero): Adjust for MEM_REF. * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF. (ref_always_accessed_p): Likewise. (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR. * tree-complex.c (extract_component): Do not handle INDIRECT_REF. Handle MEM_REF. * cgraphbuild.c (mark_load): Properly check for NULL result from get_base_address. (mark_store): Likewise. * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF. * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF handling for MEM_REF. * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle &MEM[ptr + CST] similar to POINTER_PLUS_EXPR. * builtins.c (stabilize_va_list_loc): Use the function ABI valist type if we couldn't canonicalize the argument type. Always dereference with the canonical va-list type. (maybe_emit_free_warning): Handle MEM_REF. (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding memmove to memcpy. * builtins.c (fold_builtin_memory_op): Use ref-all types for all memcpy foldings. * omp-low.c (build_receiver_ref): Adjust for MEM_REF. (build_outer_var_ref): Likewise. (scan_omp_1_op): Likewise. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Likewise. (lower_reduction_clauses): Likewise. (lower_copyprivate_clauses): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (create_task_copyfn): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF. Remove old union trick. Initialize constant offsets. (ao_ref_init_from_vn_reference): Likewise. Do not handle INDIRECT_REF. Init base_alias_set properly. (vn_reference_lookup_3): Replace INDIRECT_REF handling with MEM_REF. (vn_reference_fold_indirect): Adjust for MEM_REFs. (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. (may_insert): Remove. (visit_reference_op_load): Do not test may_insert. (run_scc_vn): Remove parameter, do not fiddle with may_insert. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add a field to store the constant offset this op applies. (run_scc_vn): Adjust prototype. * cgraphunit.c (thunk_adjust): Adjust for MEM_REF. * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not bother about volatile qualifiers on pointers. (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF. * tree-ssa-loop-ivopts.c * tree-ssa-loop-ivopts.c (determine_base_object): Adjust for MEM_REF. (strip_offset_1): Likewise. (find_interesting_uses_address): Replace INDIRECT_REF handling with MEM_REF handling. (get_computation_cost_at): Likewise. * ipa-pure-const.c (check_op): Handle MEM_REF. * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF. * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF and constants. * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF. * tree-parloops.c (take_address_of): Adjust for MEM_REF. (eliminate_local_variables_1): Likewise. (create_call_for_reduction_1): Likewise. (create_loads_for_reductions): Likewise. (create_loads_and_stores_for_name): Likewise. * matrix-reorg.c (may_flatten_matrices_1): Sanitize. (ssa_accessed_in_tree): Handle MEM_REF. (ssa_accessed_in_assign_rhs): Likewise. (update_type_size): Likewise. (analyze_accesses_for_call_stmt): Likewise. (analyze_accesses_for_assign_stmt): Likewise. (transform_access_sites): Likewise. (transform_allocation_sites): Likewise. * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not handle INDIRECT_REF. * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF. (cond_store_replacement): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle MEM_REF, no not handle INDIRECT_REFs. (insert_into_preds_of_block): Properly initialize avail. (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. Properly handle reference lookups that require a bit re-interpretation. (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF. * tree-sra.c * tree-sra.c (build_access_from_expr_1): Handle MEM_REF. (build_ref_for_offset_1): Remove. (build_ref_for_offset): Build MEM_REFs. (gate_intra_sra): Disable for now. (sra_ipa_modify_expr): Handle MEM_REF. (ipa_early_sra_gate): Disable for now. * tree-sra.c (create_access): Swap INDIRECT_REF handling for MEM_REF handling. (disqualify_base_of_expr): Likewise. (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for MEM_REF handling. (sra_ipa_modify_expr): Remove INDIRECT_REF handling. Use mem_ref_offset. Remove bogus folding. (build_access_from_expr_1): Properly handle MEM_REF for non IPA-SRA. (make_fancy_name_1): Add support for MEM_REF. * tree-predcom.c (ref_at_iteration): Handle MEM_REFs. * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF. * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF. (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace INDIRECT_REF folding with more generalized MEM_REF folding. (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly. (forward_propagate_addr_into_variable_array_index): Also handle &ARRAY + I in addition to &ARRAY[0] + I. * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF. * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that creates assignments with overlap. * tree-nested.c (get_static_chain): Adjust for MEM_REF. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. (struct nesting_info): Add mem_refs pointer-set. (create_nesting_tree): Allocate it. (convert_local_reference_op): Insert to be folded mem-refs. (fold_mem_refs): New function. (finalize_nesting_tree_1): Perform defered folding of mem-refs (free_nesting_tree): Free the pointer-set. * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF. (vectorizable_load): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF. (propagate_with_phi): Likewise. * tree-object-size.c (addr_object_size): Handle MEM_REFs instead of INDIRECT_REFs. (compute_object_offset): Handle MEM_REF. (plus_stmt_object_size): Handle MEM_REF. (collect_object_sizes_for): Dispatch to plus_stmt_object_size for &MEM_REF. * tree-flow.h (get_addr_base_and_unit_offset): Declare. (symbol_marked_for_renaming): Likewise. * Makefile.in (tree-dfa.o): Add $(TOPLEV_H). (fold-const.o): Add $(TREE_FLOW_H). * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF. (find_func_clobbers): Likewise. * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF. (decompose_access): Likewise. (replace_field_acc): Likewise. (replace_field_access_stmt): Likewise. (insert_new_var_in_stmt): Likewise. (get_stmt_accesses): Likewise. (reorg_structs_drive): Disable. * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF. (ix86_canonical_va_list_type): Likewise. cp/ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs predicate we are looking for, allow non-gimplified INDIRECT_REFs. testsuite/ * gcc.c-torture/execute/20100316-1.c: New testcase. * gcc.c-torture/execute/pr44468.c: Likewise. * gcc.c-torture/compile/20100609-1.c: Likewise. * gcc.dg/volatile2.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/pr36902.c: Likewise. * gcc.dg/tree-ssa/foldaddr-2.c: Remove. * gcc.dg/tree-ssa/foldaddr-3.c: Likewise. * gcc.dg/tree-ssa/forwprop-8.c: Adjust. * gcc.dg/tree-ssa/pr17141-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise. * gcc.dg/tree-ssa/20030807-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-10.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. * gcc.dg/tree-ssa/forwprop-1.c: Likewise. * gcc.dg/tree-ssa/forwprop-2.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-5.c: Likewise. * gcc.dg/struct/w_prof_two_strs.c: XFAIL. * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise. * gcc.dg/struct/wo_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise. * gcc.dg/struct/w_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise. * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise. * gcc.dg/struct/w_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_array_field.c: Likewise. * gcc.dg/struct/wo_prof_single_str_local.c: Likewise. * gcc.dg/struct/w_prof_local_var.c: Likewise. * gcc.dg/struct/wo_prof_two_strs.c: Likewise. * gcc.dg/struct/wo_prof_empty_str.c: Likewise. * gcc.dg/struct/wo_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise. * gcc.dg/struct/wo_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_escape_return.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise. * gcc.dg/struct/wo_prof_double_malloc.c: Likewise. * gcc.dg/struct/w_ratio_cold_str.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise. * gcc.dg/struct/wo_prof_local_var.c: Likewise. * gcc.dg/tree-prof/stringop-1.c: Adjust. * g++.dg/tree-ssa/pr31146.C: Likewise. * g++.dg/tree-ssa/copyprop-1.C: Likewise. * g++.dg/tree-ssa/pr33604.C: Likewise. * g++.dg/plugin/selfassign.c: Likewise. * gfortran.dg/array_memcpy_3.f90: Likewise. * gfortran.dg/array_memcpy_4.f90: Likewise. * c-c++-common/torture/pr42834.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161655 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index de83e64cea1..17accb2f912 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3564,7 +3564,8 @@ do { tree _node = (NODE); \ 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. */ - if (TREE_CODE (node) == INDIRECT_REF) + if (TREE_CODE (node) == INDIRECT_REF + || TREE_CODE (node) == MEM_REF) UPDATE_FLAGS (TREE_OPERAND (node, 0)); else if (CONSTANT_CLASS_P (node)) ; @@ -3878,6 +3879,42 @@ build6_stat (enum tree_code code, tree tt, tree arg0, tree arg1, return t; } +/* Build a simple MEM_REF tree with the sematics of a plain INDIRECT_REF + on the pointer PTR. */ + +tree +build_simple_mem_ref_loc (location_t loc, tree ptr) +{ + HOST_WIDE_INT offset = 0; + tree ptype = TREE_TYPE (ptr); + tree tem; + /* For convenience allow addresses that collapse to a simple base + and offset. */ + if (TREE_CODE (ptr) == ADDR_EXPR + && (handled_component_p (TREE_OPERAND (ptr, 0)) + || TREE_CODE (TREE_OPERAND (ptr, 0)) == MEM_REF)) + { + ptr = get_addr_base_and_unit_offset (TREE_OPERAND (ptr, 0), &offset); + gcc_assert (ptr); + ptr = build_fold_addr_expr (ptr); + gcc_assert (is_gimple_reg (ptr) || is_gimple_min_invariant (ptr)); + } + tem = build2 (MEM_REF, TREE_TYPE (ptype), + ptr, build_int_cst (ptype, offset)); + SET_EXPR_LOCATION (tem, loc); + return tem; +} + +/* Return the constant offset of a MEM_REF tree T. */ + +double_int +mem_ref_offset (const_tree t) +{ + tree toff = TREE_OPERAND (t, 1); + return double_int_sext (tree_to_double_int (toff), + TYPE_PRECISION (TREE_TYPE (toff))); +} + /* Similar except don't specify the TREE_TYPE and leave the TREE_SIDE_EFFECTS as 0. It is permissible for arguments to be null, -- cgit v1.2.1 From 86638c2ef3b5ed40e2c8f19e5ce0cdbf86593413 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 5 Jul 2010 12:25:20 +0000 Subject: 2010-07-05 Richard Guenther * tree-ssa-loop-im.c (for_each_index): Do not handle ALIGN_INDIRECT_REF. (gen_lsm_tmp_name): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. (op_code_prio): Likewise. (op_symbol_code): Likewise. * tree.c (staticp): Likewise. (build1_stat): Likewise. * tree.h (INDIRECT_REF_P): Likewise. * fold-const.c (maybe_lvalue_p): Likewise. (operand_equal_p): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Likewise. (ao_ref_init_from_vn_reference): Likewise. * tree-ssa-loop-ivopts.c (idx_find_step): Likewise. (find_interesting_uses_address): Likewise. * dwarf2out.c (loc_list_from_tree): Likewise. * gimplify.c (gimplify_expr): Likewise. * tree-eh.c (tree_could_trap_p): Likewise. * emit-rtl.c (set_mem_attributes_minus_bitpos): Likewise. * cfgexpand.c (expand_debug_expr): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Likewise. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Likewise. * tree-cfg.c (verify_types_in_gimple_min_lval): Likewise. * config/rs6000/rs6000 (rs6000_check_sdmode): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * expr.c (safe_from_p): Likewise. (expand_expr_real_1): Likewise. TER BIT_AND_EXPRs into MEM_REFs. * tree-vect-data-refs.c (vect_setup_realignment): Build BIT_AND_EXPR and MEM_REF instead of ALIGN_INDIRECT_REF. * tree-vect-stmts.c (vectorizable_load): Likewise. * tree.def (ALIGN_INDIRECT_REF): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161830 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 17accb2f912..fbbca2fb95a 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2432,7 +2432,6 @@ staticp (tree arg) return NULL; case MISALIGNED_INDIRECT_REF: - case ALIGN_INDIRECT_REF: case INDIRECT_REF: return TREE_CONSTANT (TREE_OPERAND (arg, 0)) ? arg : NULL; @@ -3660,7 +3659,6 @@ build1_stat (enum tree_code code, tree type, tree node MEM_STAT_DECL) break; case MISALIGNED_INDIRECT_REF: - case ALIGN_INDIRECT_REF: case INDIRECT_REF: /* Whether a dereference is readonly has nothing to do with whether its operand is readonly. */ -- cgit v1.2.1 From beec9a6ace9f4f45bffb4025f013812584ab4f21 Mon Sep 17 00:00:00 2001 From: froydnj Date: Mon, 5 Jul 2010 13:15:31 +0000 Subject: * tree.h (build_call_list): Remove. * tree.c (build_call_list): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161837 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index fbbca2fb95a..cb2c276b715 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9578,27 +9578,6 @@ build_vl_exp_stat (enum tree_code code, int len MEM_STAT_DECL) return t; } - -/* Build a CALL_EXPR of class tcc_vl_exp with the indicated RETURN_TYPE - and FN and a null static chain slot. ARGLIST is a TREE_LIST of the - arguments. */ - -tree -build_call_list (tree return_type, tree fn, tree arglist) -{ - tree t; - int i; - - t = build_vl_exp (CALL_EXPR, list_length (arglist) + 3); - TREE_TYPE (t) = return_type; - CALL_EXPR_FN (t) = fn; - CALL_EXPR_STATIC_CHAIN (t) = NULL_TREE; - for (i = 0; arglist; arglist = TREE_CHAIN (arglist), i++) - CALL_EXPR_ARG (t, i) = TREE_VALUE (arglist); - process_call_operands (t); - return t; -} - /* 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. */ -- cgit v1.2.1 From 9614eeffe73081e7a1048f8e6dfd9cd2b80d607e Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 5 Jul 2010 14:51:16 +0000 Subject: 2010-07-05 Richard Guenther * tree.c (reference_alias_ptr_type): New function. * tree.h (reference_alias_ptr_type): Declare. * tree-ssa-loop-ivopts.c (copy_ref_info): Restructure to allow non-TARGET_MEM_REF new refs. (rewrite_use_address): Pass old alias pointer type to create_mem_ref. * tree-ssa-address.c (create_mem_ref_raw): Get alias pointer type. Build a MEM_REF instead of a TARGET_MEM_REF if possible. (create_mem_ref): Get alias pointer type. Adjust calls to create_mem_ref_raw. (maybe_fold_tmr): Likewise. * tree-flow.h (create_mem_ref): Adjust prototype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161840 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index cb2c276b715..e6deacce0f7 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -3913,6 +3913,25 @@ mem_ref_offset (const_tree t) TYPE_PRECISION (TREE_TYPE (toff))); } +/* Return the pointer-type relevant for TBAA purposes from the + gimple memory reference tree T. This is the type to be used for + the offset operand of MEM_REF or TARGET_MEM_REF replacements of T. */ + +tree +reference_alias_ptr_type (const_tree t) +{ + const_tree base = t; + while (handled_component_p (base)) + base = TREE_OPERAND (base, 0); + if (TREE_CODE (base) == MEM_REF) + return TREE_TYPE (TREE_OPERAND (base, 1)); + else if (TREE_CODE (base) == TARGET_MEM_REF + || TREE_CODE (base) == MISALIGNED_INDIRECT_REF) + return NULL_TREE; + else + return build_pointer_type (TYPE_MAIN_VARIANT (TREE_TYPE (base))); +} + /* Similar except don't specify the TREE_TYPE and leave the TREE_SIDE_EFFECTS as 0. It is permissible for arguments to be null, -- cgit v1.2.1 From a6caa15fd850657e54b7503695521137c0d55dff Mon Sep 17 00:00:00 2001 From: aesok Date: Mon, 5 Jul 2010 18:45:40 +0000 Subject: * double-int.h (fit_double_type): Remove declaration. * double-int.c (fit_double_type): Remove function. * tree.h (int_fits_type_p): Adjust prototype. * tree.c (int_fits_type_p): Return bool. Use double_int_fits_to_tree_p instead of fit_double_type. (build_int_cst_type): Use double_int_to_tree and shwi_to_double_int instead of fit_double_type and build_int_cst_wide. * builtins.c (): Use double_int_fits_to_tree_p and double_int_to_tree instead of fit_double_type and build_int_cst_wide. (fold_builtin_object_size): Use double_int_fits_to_tree_p instead of fit_double_type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161847 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index e6deacce0f7..b5a99f9de1d 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1049,14 +1049,9 @@ build_int_cst (tree type, HOST_WIDE_INT low) tree build_int_cst_type (tree type, HOST_WIDE_INT low) { - unsigned HOST_WIDE_INT low1; - HOST_WIDE_INT hi; - gcc_assert (type); - fit_double_type (low, low < 0 ? -1 : 0, &low1, &hi, type); - - return build_int_cst_wide (type, low1, hi); + return double_int_to_tree (type, shwi_to_double_int (low)); } /* Constructs tree in type TYPE from with value given by CST. Signedness @@ -7900,10 +7895,10 @@ get_narrower (tree op, int *unsignedp_ptr) return win; } -/* Nonzero if integer constant C has a value that is permissible +/* Returns true if integer constant C has a value that is permissible for type TYPE (an INTEGER_TYPE). */ -int +bool int_fits_type_p (const_tree c, const_tree type) { tree type_low_bound, type_high_bound; @@ -7932,7 +7927,7 @@ retry: /* 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 - fit_double_type, which checks against the precision. + 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 @@ -7953,12 +7948,12 @@ retry: int t_neg = (unsc && double_int_negative_p (dd)); if (c_neg && !t_neg) - return 0; + return false; if ((c_neg || !t_neg) && double_int_ucmp (dc, dd) < 0) - return 0; + return false; } else if (double_int_cmp (dc, dd, unsc) < 0) - return 0; + return false; ok_for_low_bound = true; } else @@ -7978,12 +7973,12 @@ retry: int t_neg = (unsc && double_int_negative_p (dd)); if (t_neg && !c_neg) - return 0; + return false; if ((t_neg || !c_neg) && double_int_ucmp (dc, dd) > 0) - return 0; + return false; } else if (double_int_cmp (dc, dd, unsc) > 0) - return 0; + return false; ok_for_high_bound = true; } else @@ -7991,17 +7986,17 @@ retry: /* If the constant fits both bounds, the result is known. */ if (ok_for_low_bound && ok_for_high_bound) - return 1; + return true; /* 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, */ if (TYPE_UNSIGNED (type) && !unsc && double_int_negative_p (dc)) - return 0; + return false; /* Second, narrower types always fit in wider ones. */ if (TYPE_PRECISION (type) > TYPE_PRECISION (TREE_TYPE (c))) - return 1; + return true; /* Third, unsigned integers with top bit set never fit signed types. */ if (! TYPE_UNSIGNED (type) && unsc) @@ -8010,11 +8005,11 @@ retry: if (prec < HOST_BITS_PER_WIDE_INT) { if (((((unsigned HOST_WIDE_INT) 1) << prec) & dc.low) != 0) - return 0; + return false; } else if (((((unsigned HOST_WIDE_INT) 1) << (prec - HOST_BITS_PER_WIDE_INT)) & dc.high) != 0) - return 0; + return false; } /* If we haven't been able to decide at this point, there nothing more we @@ -8028,8 +8023,8 @@ retry: goto retry; } - /* Or to fit_double_type, if nothing else. */ - return !fit_double_type (dc.low, dc.high, &dc.low, &dc.high, type); + /* Or to double_int_fits_to_tree_p, if nothing else. */ + return double_int_fits_to_tree_p (type, dc); } /* Stores bounds of an integer TYPE in MIN and MAX. If TYPE has non-constant -- cgit v1.2.1 From 2ab2ce89368289e93c9022aae8689f109c132f5c Mon Sep 17 00:00:00 2001 From: froydnj Date: Tue, 6 Jul 2010 02:26:33 +0000 Subject: gcc/ * vec.h (FOR_EACH_VEC_ELT_REVERSE): New macro. * function.h (struct_function): Change type of local_decls field to a VEC. (add_local_decl): New function. (FOR_EACH_LOCAL_DECL): New macro. * cfgexpand.c (init_vars_expansion): Adjust for new type of cfun->local_decls. (estimated_stack_frame_size): Likewise. (expand_used_vars): Likewise. * cgraphbuild.c (build_cgraph_edges): Likewise. * function.c (instantiate_decls_1): Likewise. * ipa-struct-reorg.c (build_data_structure): Likewise. * ipa-type-escape.c (analyze_function): Likewise. * lto-streamer-in.c (input_function): Likewise. * lto-streamer-out.c (output_function): Likewise. * tree-ssa-live.c (remove_unused_locals): Likewise. * tree.c (free_lang_data_in_decl): Likewise. (find_decls_types_in_node): Likewise. * omp-low.c (remove_exit_barrier): Likewise. (expand_omp_taskreg): Likewise. (list2chain): Rename to... (vec2chain): ...this. Adjust. * cgraphunit.c (assemble_thunk): Call add_local_decl. * tree-cfg.c (replace_by_duplicate_decl): Likewise. * gimple-low.c (record_vars_into): Likewise. * tree-inline.c (remap_decls): Likewise. (declare_return_variable): Likewise. (declare_inline_vars): Likewise. (copy_forbidden): Adjust for new type of cfun->local_decls. (add_local_variables): New function. (expand_call_inline): Call it. (tree_function_versioning): Likewise. gcc/cp/ * decl.c (cp_finish_decl): Call add_local_decl. * optimize.c (clone_body): Adjust for new type of cfun->local_decls. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161862 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index b5a99f9de1d..42470479564 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4498,6 +4498,7 @@ free_lang_data_in_decl (tree decl) if (gimple_has_body_p (decl)) { tree t; + unsigned ix; struct pointer_set_t *locals; /* If DECL has a gimple body, then the context for its @@ -4514,14 +4515,13 @@ free_lang_data_in_decl (tree decl) /* Collect all the symbols declared in DECL. */ locals = pointer_set_create (); - t = DECL_STRUCT_FUNCTION (decl)->local_decls; - for (; t; t = TREE_CHAIN (t)) + FOR_EACH_LOCAL_DECL (DECL_STRUCT_FUNCTION (decl), ix, t) { - pointer_set_insert (locals, TREE_VALUE (t)); + pointer_set_insert (locals, t); /* All the local symbols should have DECL as their context. */ - DECL_CONTEXT (TREE_VALUE (t)) = decl; + DECL_CONTEXT (t) = decl; } /* Get rid of any decl not in local_decls. */ @@ -4873,6 +4873,7 @@ find_decls_types_in_node (struct cgraph_node *n, struct free_lang_data_d *fld) { basic_block bb; struct function *fn; + unsigned ix; tree t; find_decls_types (n->decl, fld); @@ -4885,8 +4886,8 @@ find_decls_types_in_node (struct cgraph_node *n, struct free_lang_data_d *fld) fn = DECL_STRUCT_FUNCTION (n->decl); /* Traverse locals. */ - for (t = fn->local_decls; t; t = TREE_CHAIN (t)) - find_decls_types (TREE_VALUE (t), fld); + FOR_EACH_LOCAL_DECL (fn, ix, t) + find_decls_types (t, fld); /* Traverse EH regions in FN. */ { -- cgit v1.2.1 From 524a05313c645ed67701d7de7837bc5fa65d3104 Mon Sep 17 00:00:00 2001 From: hubicka Date: Wed, 7 Jul 2010 01:00:42 +0000 Subject: PR middle-end/44813 * tree-ssa-uninit.c (ssa_undefined_value_p): Result decl is defined for functions passed by reference. * tree.c (needs_to_live_in_memory): RESULT_DECL don't need to live in memory when passed by reference. * tree-ssa-ccp.c (get_default_value): Only VAR_DECL is undefined at beggining. * ipa-split.c (split_function): Cleanup way return value is passed; handle SSA DECL_BY_REFERENCE retvals. * tree-ssa.c (verify_def): Verify that RESULT_DECL is read only when DECL_BY_REFERENCE is set. * tree-ssa-structalias.c (get_constraint_for_ssa_var, get_fi_for_callee, find_what_p_points_to): Handle RESULT_DECL. * tree-inline.c (declare_return_variable): Get new entry_block argument; when passing by reference ensure that RESULT_DECL is gimple_val. (remap_gimple_op_r): Remap RESULT_DECL ssa name. (remap_gimple_stmt): Handle SSA DECL_BY_REFERENCE returns. * g++.dg/torture/pr44813.C: New testcase. * g++.dg/torture/pr44826.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161898 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 42470479564..dda9287a190 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9742,6 +9742,7 @@ needs_to_live_in_memory (const_tree t) return (TREE_ADDRESSABLE (t) || is_global_var (t) || (TREE_CODE (t) == RESULT_DECL + && !DECL_BY_REFERENCE (t) && aggregate_value_p (t, current_function_decl))); } -- cgit v1.2.1 From 275327540b92ab5e90b2beeb653097fbf133a32f Mon Sep 17 00:00:00 2001 From: baldrick Date: Wed, 7 Jul 2010 15:21:16 +0000 Subject: When materializing a cloned function with arguments removed, to TYPE_POINTER_TO field of the new type (which has fewer arguments) was left pointing to the original type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161918 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index dda9287a190..2ddd1d87fe4 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -7350,7 +7350,7 @@ build_function_type_skip_args (tree orig_type, bitmap args_to_skip) if (TREE_CODE (orig_type) != METHOD_TYPE || !bitmap_bit_p (args_to_skip, 0)) { - new_type = copy_node (orig_type); + new_type = build_distinct_type_copy (orig_type); TYPE_ARG_TYPES (new_type) = new_reversed; } else -- cgit v1.2.1 From 45ebb60b0d89017bf97f2901e999f368eedab4ca Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 9 Jul 2010 14:22:45 +0000 Subject: 2010-07-09 Tom de Vries * tree.c (type_hash_if_marked_p): Removed non-ggc_marked_p clause. * gcc.dg/debug/dwarf2/pr31230.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161998 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 2ddd1d87fe4..cca171c8c3c 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -6072,16 +6072,14 @@ type_hash_canon (unsigned int hashcode, tree type) /* 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. This reduces the amount of - debugging output and eliminates that dependency of the debug output on - the number of garbage collections. */ + table entry has been made for the type. */ static int type_hash_marked_p (const void *p) { const_tree const type = ((const struct type_hash *) p)->type; - return ggc_marked_p (type) || TYPE_SYMTAB_POINTER (type); + return ggc_marked_p (type); } static void -- cgit v1.2.1 From 1767a056f10a2ccbc900df04d01193da73a3d272 Mon Sep 17 00:00:00 2001 From: froydnj Date: Thu, 15 Jul 2010 14:31:28 +0000 Subject: gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162223 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index cca171c8c3c..7f37d45fba2 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1991,7 +1991,7 @@ chain_member (const_tree elem, const_tree chain) { if (elem == chain) return 1; - chain = TREE_CHAIN (chain); + chain = DECL_CHAIN (chain); } return 0; @@ -2032,7 +2032,7 @@ fields_length (const_tree type) tree t = TYPE_FIELDS (type); int count = 0; - for (; t; t = TREE_CHAIN (t)) + for (; t; t = DECL_CHAIN (t)) if (TREE_CODE (t) == FIELD_DECL) ++count; @@ -2860,7 +2860,7 @@ type_contains_placeholder_1 (const_tree type) { tree field; - for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) + for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) if (TREE_CODE (field) == FIELD_DECL && (CONTAINS_PLACEHOLDER_P (DECL_FIELD_OFFSET (field)) || (TREE_CODE (type) == QUAL_UNION_TYPE @@ -8169,7 +8169,7 @@ variably_modified_type_p (tree type, tree fn) definition we normally use, since that would produce infinite recursion via pointers. */ /* This is variably modified if some field's type is. */ - for (t = TYPE_FIELDS (type); t; t = TREE_CHAIN (t)) + for (t = TYPE_FIELDS (type); t; t = DECL_CHAIN (t)) if (TREE_CODE (t) == FIELD_DECL) { RETURN_TRUE_IF_VAR (DECL_FIELD_OFFSET (t)); @@ -10257,7 +10257,7 @@ walk_tree_1 (tree *tp, walk_tree_fn func, void *data, case BIND_EXPR: { tree decl; - for (decl = BIND_EXPR_VARS (*tp); decl; decl = TREE_CHAIN (decl)) + for (decl = BIND_EXPR_VARS (*tp); decl; decl = DECL_CHAIN (decl)) { /* Walk the DECL_INITIAL and DECL_SIZE. We don't want to walk into declarations that are just mentioned, rather than @@ -10372,7 +10372,7 @@ walk_tree_1 (tree *tp, walk_tree_fn func, void *data, tree field; for (field = TYPE_FIELDS (*type_p); field; - field = TREE_CHAIN (field)) + field = DECL_CHAIN (field)) { /* We'd like to look at the type of the field, but we can easily get infinite recursion. So assume it's pointed @@ -10888,7 +10888,7 @@ get_binfo_at_offset (tree binfo, HOST_WIDE_INT offset, tree expected_type) if (TREE_CODE (type) != RECORD_TYPE) return NULL_TREE; - for (fld = TYPE_FIELDS (type); fld; fld = TREE_CHAIN (fld)) + for (fld = TYPE_FIELDS (type); fld; fld = DECL_CHAIN (fld)) { if (TREE_CODE (fld) != FIELD_DECL) continue; -- cgit v1.2.1 From 2512209b236017dc6514906a6f6cf624a490d680 Mon Sep 17 00:00:00 2001 From: aesok Date: Thu, 15 Jul 2010 18:47:23 +0000 Subject: * tree.h (enum tree_index): Add TI_INTEGER_THREE. (integer_three_node): Add. * tree.c (build_common_tree_nodes_2): Use integer_type_node insead of NULL_TREE in build_int_cst calls. Initialize the integer_three_node. * builtins.c (expand_builtin_prefetch): Use common tree nodes instead of call build_int_cst. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Ditto. * tree-ssa-loop-ivopts.c (idx_find_step): Ditto. (find_interesting_uses_address): Ditto. * tree-ssa-alias.c (ao_ref_init_from_ptr_and_size): Ditto. * tree-eh.c (lower_eh_constructs_2): Ditto. * tree-vect-loop.c (get_initial_def_for_induction): Ditto. * c-typeck.c (really_start_incremental_init, push_init_level): Ditto. * expmed.c (expand_divmod): Ditto. * tree-mudflap.c (mx_register_decls): Ditto. * varasm.c (array_size_for_constructor): Ditto. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Ditto. * c-parser.c (c_parser_postfix_expression): Ditto. /cp * decl.c (integer_three_node): Remove. (cxx_init_decl_processing): Do not initialize the integer_three_node. * cp-tree.h (integer_three_node): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162230 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 7f37d45fba2..5726ca427ce 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -8969,9 +8969,10 @@ void build_common_tree_nodes_2 (int short_double) { /* Define these next since types below may used them. */ - integer_zero_node = build_int_cst (NULL_TREE, 0); - integer_one_node = build_int_cst (NULL_TREE, 1); - integer_minus_one_node = build_int_cst (NULL_TREE, -1); + integer_zero_node = build_int_cst (integer_type_node, 0); + integer_one_node = build_int_cst (integer_type_node, 1); + integer_three_node = build_int_cst (integer_type_node, 3); + integer_minus_one_node = build_int_cst (integer_type_node, -1); size_zero_node = size_int (0); size_one_node = size_int (1); -- cgit v1.2.1 From dbdf4b3183c88b679cdb0b2741b5cb7891b67f54 Mon Sep 17 00:00:00 2001 From: froydnj Date: Fri, 16 Jul 2010 17:51:56 +0000 Subject: * tree.c (build_common_builtin_nodes): Use build_function_type_list instead of build_function_type. * tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Likewise. * cgraphunit.c (cgraph_build_static_cdtor): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162264 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 86 ++++++++++++++++++++++++++------------------------------------ 1 file changed, 36 insertions(+), 50 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 5726ca427ce..aab4cfe86e8 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -9149,15 +9149,14 @@ local_define_builtin (const char *name, tree type, enum built_in_function code, void build_common_builtin_nodes (void) { - tree tmp, tmp2, ftype; + tree tmp, ftype; if (built_in_decls[BUILT_IN_MEMCPY] == NULL || built_in_decls[BUILT_IN_MEMMOVE] == NULL) { - tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, const_ptr_type_node, tmp); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - ftype = build_function_type (ptr_type_node, tmp); + ftype = build_function_type_list (ptr_type_node, + ptr_type_node, const_ptr_type_node, + size_type_node, NULL_TREE); if (built_in_decls[BUILT_IN_MEMCPY] == NULL) local_define_builtin ("__builtin_memcpy", ftype, BUILT_IN_MEMCPY, @@ -9169,28 +9168,26 @@ build_common_builtin_nodes (void) if (built_in_decls[BUILT_IN_MEMCMP] == NULL) { - tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, const_ptr_type_node, tmp); - tmp = tree_cons (NULL_TREE, const_ptr_type_node, tmp); - ftype = build_function_type (integer_type_node, tmp); + ftype = build_function_type_list (integer_type_node, const_ptr_type_node, + const_ptr_type_node, size_type_node, + NULL_TREE); local_define_builtin ("__builtin_memcmp", ftype, BUILT_IN_MEMCMP, "memcmp", ECF_PURE | ECF_NOTHROW); } if (built_in_decls[BUILT_IN_MEMSET] == NULL) { - tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, integer_type_node, tmp); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - ftype = build_function_type (ptr_type_node, tmp); + ftype = build_function_type_list (ptr_type_node, + ptr_type_node, integer_type_node, + size_type_node, NULL_TREE); local_define_builtin ("__builtin_memset", ftype, BUILT_IN_MEMSET, "memset", ECF_NOTHROW); } if (built_in_decls[BUILT_IN_ALLOCA] == NULL) { - tmp = tree_cons (NULL_TREE, size_type_node, void_list_node); - ftype = build_function_type (ptr_type_node, tmp); + ftype = build_function_type_list (ptr_type_node, + size_type_node, NULL_TREE); local_define_builtin ("__builtin_alloca", ftype, BUILT_IN_ALLOCA, "alloca", ECF_MALLOC | ECF_NOTHROW); } @@ -9199,60 +9196,53 @@ build_common_builtin_nodes (void) if (flag_stack_check) TREE_NOTHROW (built_in_decls[BUILT_IN_ALLOCA]) = 0; - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, + ptr_type_node, ptr_type_node, + ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_init_trampoline", ftype, BUILT_IN_INIT_TRAMPOLINE, "__builtin_init_trampoline", ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - ftype = build_function_type (ptr_type_node, tmp); + ftype = build_function_type_list (ptr_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_adjust_trampoline", ftype, BUILT_IN_ADJUST_TRAMPOLINE, "__builtin_adjust_trampoline", ECF_CONST | ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, + ptr_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_nonlocal_goto", ftype, BUILT_IN_NONLOCAL_GOTO, "__builtin_nonlocal_goto", ECF_NORETURN | ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, ptr_type_node, tmp); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, + ptr_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_setjmp_setup", ftype, BUILT_IN_SETJMP_SETUP, "__builtin_setjmp_setup", ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - ftype = build_function_type (ptr_type_node, tmp); + ftype = build_function_type_list (ptr_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_setjmp_dispatcher", ftype, BUILT_IN_SETJMP_DISPATCHER, "__builtin_setjmp_dispatcher", ECF_PURE | ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_setjmp_receiver", ftype, BUILT_IN_SETJMP_RECEIVER, "__builtin_setjmp_receiver", ECF_NOTHROW); - ftype = build_function_type (ptr_type_node, void_list_node); + ftype = build_function_type_list (ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_stack_save", ftype, BUILT_IN_STACK_SAVE, "__builtin_stack_save", ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_stack_restore", ftype, BUILT_IN_STACK_RESTORE, "__builtin_stack_restore", ECF_NOTHROW); - ftype = build_function_type (void_type_node, void_list_node); + ftype = build_function_type_list (void_type_node, NULL_TREE); local_define_builtin ("__builtin_profile_func_enter", ftype, BUILT_IN_PROFILE_FUNC_ENTER, "profile_func_enter", 0); local_define_builtin ("__builtin_profile_func_exit", ftype, @@ -9262,14 +9252,13 @@ build_common_builtin_nodes (void) alternate __cxa_end_cleanup node used to resume from C++ and Java. */ if (targetm.arm_eabi_unwinder) { - ftype = build_function_type (void_type_node, void_list_node); + ftype = build_function_type_list (void_type_node, NULL_TREE); local_define_builtin ("__builtin_cxa_end_cleanup", ftype, BUILT_IN_CXA_END_CLEANUP, "__cxa_end_cleanup", ECF_NORETURN); } - tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE); local_define_builtin ("__builtin_unwind_resume", ftype, BUILT_IN_UNWIND_RESUME, (USING_SJLJ_EXCEPTIONS @@ -9282,19 +9271,19 @@ build_common_builtin_nodes (void) 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. */ - tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node); - ftype = build_function_type (ptr_type_node, tmp); + ftype = build_function_type_list (ptr_type_node, + integer_type_node, NULL_TREE); local_define_builtin ("__builtin_eh_pointer", ftype, BUILT_IN_EH_POINTER, "__builtin_eh_pointer", ECF_PURE | ECF_NOTHROW); - tmp2 = lang_hooks.types.type_for_mode (targetm.eh_return_filter_mode (), 0); - ftype = build_function_type (tmp2, tmp); + tmp = lang_hooks.types.type_for_mode (targetm.eh_return_filter_mode (), 0); + ftype = build_function_type_list (tmp, integer_type_node, NULL_TREE); local_define_builtin ("__builtin_eh_filter", ftype, BUILT_IN_EH_FILTER, "__builtin_eh_filter", ECF_PURE | ECF_NOTHROW); - tmp = tree_cons (NULL_TREE, integer_type_node, void_list_node); - tmp = tree_cons (NULL_TREE, integer_type_node, tmp); - ftype = build_function_type (void_type_node, tmp); + ftype = build_function_type_list (void_type_node, + integer_type_node, integer_type_node, + NULL_TREE); local_define_builtin ("__builtin_eh_copy_values", ftype, BUILT_IN_EH_COPY_VALUES, "__builtin_eh_copy_values", ECF_NOTHROW); @@ -9318,11 +9307,8 @@ build_common_builtin_nodes (void) continue; inner_type = TREE_TYPE (type); - tmp = tree_cons (NULL_TREE, inner_type, void_list_node); - tmp = tree_cons (NULL_TREE, inner_type, tmp); - tmp = tree_cons (NULL_TREE, inner_type, tmp); - tmp = tree_cons (NULL_TREE, inner_type, tmp); - ftype = build_function_type (type, tmp); + ftype = build_function_type_list (type, inner_type, inner_type, + inner_type, inner_type, NULL_TREE); mcode = ((enum built_in_function) (BUILT_IN_COMPLEX_MUL_MIN + mode - MIN_MODE_COMPLEX_FLOAT)); -- cgit v1.2.1 From e8fe2029241159f9b55ef3117ace84dfc676aace Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 21 Jul 2010 15:09:00 +0000 Subject: 2010-07-21 Richard Guenther PR lto/45018 * tree.c (find_decls_types_r): Do not follow TREE_CHAIN of TYPE_DECLs. Do not follow TYPE_NEXT_VARIANT, TYPE_NEXT_PTR_TO, nor TYPE_NEXT_REF_TO or TYPE_CANONICAL. * g++.dg/lto/20100721-1_0.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162380 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index aab4cfe86e8..a33f22b40f5 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4704,7 +4704,8 @@ find_decls_types_r (tree *tp, int *ws, void *data) && DECL_HAS_VALUE_EXPR_P (t)) fld_worklist_push (DECL_VALUE_EXPR (t), fld); - if (TREE_CODE (t) != FIELD_DECL) + if (TREE_CODE (t) != FIELD_DECL + && TREE_CODE (t) != TYPE_DECL) fld_worklist_push (TREE_CHAIN (t), fld); *ws = 0; } @@ -4722,13 +4723,19 @@ find_decls_types_r (tree *tp, int *ws, void *data) fld_worklist_push (TYPE_POINTER_TO (t), fld); fld_worklist_push (TYPE_REFERENCE_TO (t), fld); fld_worklist_push (TYPE_NAME (t), fld); - fld_worklist_push (TYPE_MINVAL (t), fld); + /* 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. */ + if (!POINTER_TYPE_P (t)) + fld_worklist_push (TYPE_MINVAL (t), fld); if (!RECORD_OR_UNION_TYPE_P (t)) fld_worklist_push (TYPE_MAXVAL (t), fld); fld_worklist_push (TYPE_MAIN_VARIANT (t), fld); - fld_worklist_push (TYPE_NEXT_VARIANT (t), fld); + /* Do not walk TYPE_NEXT_VARIANT. We do not stream it and thus + do not and want not to reach unused variants this way. */ fld_worklist_push (TYPE_CONTEXT (t), fld); - fld_worklist_push (TYPE_CANONICAL (t), fld); + /* Do not walk TYPE_CANONICAL. We do not stream it and thus do not + and want not to reach unused types this way. */ if (RECORD_OR_UNION_TYPE_P (t) && TYPE_BINFO (t)) { -- cgit v1.2.1