This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [07/nn] Add unique CONSTs


On 10/23/2017 05:21 AM, Richard Sandiford wrote:
> This patch adds a way of treating certain kinds of CONST as unique,
> so that pointer equality is equivalent to value equality.  For now it
> is restricted to VEC_DUPLICATE and VEC_SERIES, although the code to
> generate them remains in the else arm of an "if (1)" until a later
> patch.
> 
> This is needed so that (const (vec_duplicate xx)) can used as the
> CONSTxx_RTX of a variable-length vector.
You're brave :-)  I know we looked at making CONST_INTs behave in this
manner eons ago in an effort to reduce memory consumption and it was
just plain painful.   There may still be comments from that project
littering the source code.

I do wonder if we might want to revisit this again as we have better
infrastructure in place.


> 
> 
> 2017-10-23  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/
> 	* rtl.h (unique_const_p): New function.
> 	(gen_rtx_CONST): Declare.
> 	* emit-rtl.c (const_hasher): New struct.
> 	(const_htab): New variable.
> 	(init_emit_once): Initialize it.
> 	(const_hasher::hash, const_hasher::equal): New functions.
> 	(gen_rtx_CONST): New function.
> 	(spare_vec_duplicate, spare_vec_series): New variables.
> 	(gen_const_vec_duplicate_1): Add code for use (const (vec_duplicate)),
> 	but disable it for now.
> 	(gen_const_vec_series): Likewise (const (vec_series)).
> 	* gengenrtl.c (special_rtx): Return true for CONST.
> 	* rtl.c (shared_const_p): Return true if unique_const_p.
ISTM that you need an update the rtl.texi's structure sharing
assumptions section to describe the new rules around CONSTs.

So what's the purpose of the sparc_vec_* stuff that you're going to use
in the future?  It looks like a single element cache to me.    Am I
missing something?

jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]