Commit 1a299ae4 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 0d3c82d6
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> 2010-04-07 Richard Guenther <rguenther@suse.de>
* doc/invoke.texi (-fargument-alias, -fargument-noalias, * doc/invoke.texi (-fargument-alias, -fargument-noalias,
......
/* Language-independent node constructors for parse phase of GNU compiler. /* Language-independent node constructors for parse phase of GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 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. Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -6876,6 +6876,10 @@ build_index_type (tree maxval) ...@@ -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. /* Builds a signed or unsigned integer type of precision PRECISION.
Used for C bitfields whose precision does not match that of Used for C bitfields whose precision does not match that of
built-in target types. */ built-in target types. */
...@@ -6883,8 +6887,19 @@ tree ...@@ -6883,8 +6887,19 @@ tree
build_nonstandard_integer_type (unsigned HOST_WIDE_INT precision, build_nonstandard_integer_type (unsigned HOST_WIDE_INT precision,
int unsignedp) 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; TYPE_PRECISION (itype) = precision;
if (unsignedp) if (unsignedp)
...@@ -6892,10 +6907,13 @@ build_nonstandard_integer_type (unsigned HOST_WIDE_INT precision, ...@@ -6892,10 +6907,13 @@ build_nonstandard_integer_type (unsigned HOST_WIDE_INT precision,
else else
fixup_signed_type (itype); fixup_signed_type (itype);
ret = itype;
if (host_integerp (TYPE_MAX_VALUE (itype), 1)) 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, /* Create a range of some discrete type TYPE (an INTEGER_TYPE,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment