X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Ftree.c;h=d0c18b17ae2ff9671158865a5ceda18697967f45;hb=046f323efd9149bb5d2d5638466e98ed238b7635;hp=f1ac7a604ce6fb90dc418874b0d0a27dd986c51c;hpb=9ccd0eb43d4a922d93295cf1d6c6707469c525b6;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/tree.c b/gcc/tree.c index f1ac7a604ce..d0c18b17ae2 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -352,47 +352,6 @@ 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; @@ -407,27 +366,31 @@ initialize_tree_contains_struct (void) /* Mark all the structures that TS is derived from. */ switch (ts_code) { - case TS_COMMON: + case TS_TYPED: MARK_TS_BASE (code); break; + case TS_COMMON: case TS_INT_CST: case TS_REAL_CST: case TS_FIXED_CST: case TS_VECTOR: case TS_STRING: case TS_COMPLEX: + case TS_SSA_NAME: + case TS_CONSTRUCTOR: + MARK_TS_TYPED (code); + break; + 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: @@ -439,6 +402,7 @@ initialize_tree_contains_struct (void) break; case TS_DECL_WRTL: + case TS_CONST_DECL: MARK_TS_DECL_COMMON (code); break; @@ -450,7 +414,6 @@ initialize_tree_contains_struct (void) case TS_PARM_DECL: case TS_LABEL_DECL: case TS_RESULT_DECL: - case TS_CONST_DECL: MARK_TS_DECL_WRTL (code); break; @@ -488,7 +451,6 @@ initialize_tree_contains_struct (void) 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]); @@ -516,14 +478,6 @@ initialize_tree_contains_struct (void) 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 } @@ -959,7 +913,7 @@ make_node_stat (enum tree_code code MEM_STAT_DECL) } /* Return a new node with the same contents as NODE except that its - TREE_CHAIN is zero and it has a fresh uid. */ + TREE_CHAIN, if it has one, is zero and it has a fresh uid. */ tree copy_node_stat (tree node MEM_STAT_DECL) @@ -975,7 +929,8 @@ copy_node_stat (tree node MEM_STAT_DECL) t = ggc_alloc_zone_tree_node_stat (&tree_zone, length PASS_MEM_STAT); memcpy (t, node, length); - TREE_CHAIN (t) = 0; + if (CODE_CONTAINS_STRUCT (code, TS_COMMON)) + TREE_CHAIN (t) = 0; TREE_ASM_WRITTEN (t) = 0; TREE_VISITED (t) = 0; if (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL) @@ -1566,7 +1521,7 @@ build_string (int len, const char *str) s = ggc_alloc_tree_node (length); - memset (s, 0, sizeof (struct tree_common)); + memset (s, 0, sizeof (struct tree_typed)); TREE_SET_CODE (s, STRING_CST); TREE_CONSTANT (s) = 1; TREE_STRING_LENGTH (s) = len; @@ -2463,6 +2418,10 @@ array_type_nelts (const_tree type) min = TYPE_MIN_VALUE (index_type); max = TYPE_MAX_VALUE (index_type); + /* TYPE_MAX_VALUE may not be set if the array has unknown length. */ + if (!max) + return error_mark_node; + return (integer_zerop (min) ? max : fold_build2 (MINUS_EXPR, TREE_TYPE (max), max, min)); @@ -5217,7 +5176,12 @@ free_lang_data (void) lang_hooks.callgraph.analyze_expr = 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; + /* We do not want the default decl_assembler_name implementation, + rather if we have fixed everything we want a wrapper around it + asserting that all non-local symbols already got their assembler + name and only produce assembler names for local symbols. Or rather + make sure we never call decl_assembler_name on local symbols and + devise a separate, middle-end private scheme for it. */ /* Reset diagnostic machinery. */ diagnostic_starter (global_dc) = default_tree_diagnostic_starter; @@ -10005,7 +9969,7 @@ signed_type_for (tree type) tree upper_bound_in_type (tree outer, tree inner) { - unsigned HOST_WIDE_INT lo, hi; + double_int high; unsigned int det = 0; unsigned oprec = TYPE_PRECISION (outer); unsigned iprec = TYPE_PRECISION (inner); @@ -10052,18 +10016,18 @@ upper_bound_in_type (tree outer, tree inner) /* Compute 2^^prec - 1. */ if (prec <= HOST_BITS_PER_WIDE_INT) { - hi = 0; - lo = ((~(unsigned HOST_WIDE_INT) 0) + high.high = 0; + high.low = ((~(unsigned HOST_WIDE_INT) 0) >> (HOST_BITS_PER_WIDE_INT - prec)); } else { - hi = ((~(unsigned HOST_WIDE_INT) 0) + high.high = ((~(unsigned HOST_WIDE_INT) 0) >> (2 * HOST_BITS_PER_WIDE_INT - prec)); - lo = ~(unsigned HOST_WIDE_INT) 0; + high.low = ~(unsigned HOST_WIDE_INT) 0; } - return build_int_cst_wide (outer, lo, hi); + return double_int_to_tree (outer, high); } /* Returns the smallest value obtainable by casting something in INNER type to @@ -10072,7 +10036,7 @@ upper_bound_in_type (tree outer, tree inner) tree lower_bound_in_type (tree outer, tree inner) { - unsigned HOST_WIDE_INT lo, hi; + double_int low; unsigned oprec = TYPE_PRECISION (outer); unsigned iprec = TYPE_PRECISION (inner); @@ -10083,7 +10047,7 @@ lower_bound_in_type (tree outer, tree inner) contains all values of INNER type. In particular, both INNER and OUTER types have zero in common. */ || (oprec > iprec && TYPE_UNSIGNED (inner))) - lo = hi = 0; + low.low = low.high = 0; else { /* If we are widening a signed type to another signed type, we @@ -10094,18 +10058,18 @@ lower_bound_in_type (tree outer, tree inner) if (prec <= HOST_BITS_PER_WIDE_INT) { - hi = ~(unsigned HOST_WIDE_INT) 0; - lo = (~(unsigned HOST_WIDE_INT) 0) << (prec - 1); + low.high = ~(unsigned HOST_WIDE_INT) 0; + low.low = (~(unsigned HOST_WIDE_INT) 0) << (prec - 1); } else { - hi = ((~(unsigned HOST_WIDE_INT) 0) + low.high = ((~(unsigned HOST_WIDE_INT) 0) << (prec - HOST_BITS_PER_WIDE_INT - 1)); - lo = 0; + low.low = 0; } } - return build_int_cst_wide (outer, lo, hi); + return double_int_to_tree (outer, low); } /* Return nonzero if two operands that are suitable for PHI nodes are