diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-04-07 16:23:35 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-04-07 16:23:35 +0200 |
commit | 1a299ae4f206c4fd30ac72482c6685acd36ed9ab (patch) | |
tree | 3020e7f610343586ed9bd0388979c86c1c031b41 /gcc/tree.c | |
parent | 0d3c82d66efda2c9986612bd593097bdb2cd8c8f (diff) | |
download | gcc-1a299ae4f206c4fd30ac72482c6685acd36ed9ab.zip gcc-1a299ae4f206c4fd30ac72482c6685acd36ed9ab.tar.gz gcc-1a299ae4f206c4fd30ac72482c6685acd36ed9ab.tar.bz2 |
re PR debug/43516 ("-fcompare-debug failure" at -O2)
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.
From-SVN: r158062
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 26 |
1 files changed, 22 insertions, 4 deletions
@@ -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, |