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: [patch] gcse.c: Fix the header ordering.


Kazu Hirata wrote:
Hi Graham,


     rtx dest = SET_DEST (sset);
     if ((REG_P (dest) || CC0_P (dest))
	  && cprop_jump (BLOCK_FOR_INSN (insn), insn, NEXT_INSN (insn), from, to))

Since rtl.h is included before insn-config.h, which contains HAVE_cc0,
CC0_P is defined to be 0, so the above "if" statement doesn't let us
call cprop_jump at all.
Actually it will if dest is a REG rtx :-)

Right. :-)


A quick grep shows that combine.c also uses CC0_P but includes
insn-config.h after rtl.h.  I haven't seen what happens if I correct
the order.

I am going to run the testsuite with the patch below, but the problem
seems to be a little deeper.  Should rtl.h include insn-config.h?
Should rtl.h give an error if insn-config.h is not included yet?
I think rtl.h should include insn-config.h
It would also need be guarded by ifndef GENERATOR_FILE and also added to
RTL_BASE_H list in Makefile.in

Note in the not to distant past such nested included were discouraged but
it would appear that that position has changed because grepping for
"#include" in *.h files within the gcc directory gets quite a few hits.

Discouraged for simplicity?  Or for a little more specific reason?
I'm not sure on the specifics I think it was just convention.

I just put insn-config.h before rtl.h in combine.c, the generated code
seems to get slightly better.  (That is, CC0_P in combine.c is now
triggered.)

Anyway, grepping in *.c arena is scary.  A lot of files include
insn-config.h after rtl.h...
For the majority of files it currently makes no difference.

Kazu Hirata

Graham


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