aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-04-07 16:23:35 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2010-04-07 16:23:35 +0200
commit1a299ae4f206c4fd30ac72482c6685acd36ed9ab (patch)
tree3020e7f610343586ed9bd0388979c86c1c031b41 /gcc
parent0d3c82d66efda2c9986612bd593097bdb2cd8c8f (diff)
downloadgcc-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')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/tree.c26
2 files changed, 30 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index af2e371..0840425 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2010-04-07 Jakub Jelinek <jakub@redhat.com>
+
+ 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.
+
2010-04-07 Richard Guenther <rguenther@suse.de>
* doc/invoke.texi (-fargument-alias, -fargument-noalias,
diff --git a/gcc/tree.c b/gcc/tree.c
index b72e057..30bc5be 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,