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: RFA: Make mn10300 use an UNSPEC instead of nested (const (minus ...))s


Richard Sandiford wrote:
This patch makes the mn10300 port use UNSPECs instead of (const (minus ...)).
It's part of my ongoing quest to enforce a grammar for CONSTs.  See:

http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00339.html

for details.

The only use of (const (minus ...)) is in:

	 (const
	  (unspec [(minus:SI
		    (match_dup 1)
		    (const (minus:SI
			    (const (match_operand:SI 0 "" ""))
			    (pc))))
		  ] UNSPEC_PIC))))]

As with SH, these nested consts appear to be there to enforce a
particular bracketing, but I don't think that behaviour is documented
or guaranteed.  The patch avoids this by adding a new unspec.

Tested by comparing the before and after assembly output for
gcc.c-torture, gcc.dg and g++.dg on mn10300-elf, using the
options:

{-O0,-O2} x {-fpic}

There were no differences. OK to install?

Richard


gcc/
* config/mn10300/mn10300.h (OUTPUT_ADDR_CONST_EXTRA): Handle
UNSPEC_GOTSYM_OFFs.
* config/mn10300/mn10300.c (legitimate_pic_operand_p): Return true
for UNSPEC_GOTSYM_OFFs.
* config/mn10300/mn10300.md (UNSPEC_GOTSYM_OFF): New unspec.
(add_GOT_to_pic_reg): Use it.
* config/mn10300/constraints.md (S): Allow UNSPEC_GOTSYM_OFF.
This is fine.

I can only guess the idea was that we could CSE the inner subtraction, but I can't see how that would work either.

Jeff


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