public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Use predicates for RTL objects
@ 2019-08-07 16:15 Arvind Sankar
  2019-08-07 17:33 ` Segher Boessenkool
  2019-08-08 15:04 ` Michael Matz
  0 siblings, 2 replies; 25+ messages in thread
From: Arvind Sankar @ 2019-08-07 16:15 UTC (permalink / raw)
  To: gcc

Hi,
I have posted a patch series [1] for converting some of the RTL code to
use predicate macros, as described in the suggestions for beginner GCC
projects [2]. Segher was kind enough to give some comments on the
initial posting [3].

The code has been bootstrapped natively on x86_64, and I have built
cross-compilers for all targets except tilegx which gave build errors
even on trunk. The compiler object files are identical with trunk except
for *-checksum.o and string tables in build/gen*.o which change from
GET_CODE (..) == .. etc to the predicate macro.

Not all possible changes have been made yet, I figured I'd send this out
to check first.

I am hoping one of the maintainers will be able to take some time to
review the patches -- a few are quite large but are mechanical.

I would also like to get some comments on the following idea to make the
code checks more readable: I am thinking of adding
	bool rtx_def::is_a (enum rtx_code) const
This would allow us to make all the rtx_code comparisons more readable
without having to define individual macros for each.
i.e.,
	REG_P (x)			   => x->is_a (REG)
	GET_CODE (x) == PLUS		   => x->is_a (PLUS)
	GET_CODE (PATTERN (x)) == SEQUENCE => PATTERN (x)->is_a (SEQUENCE)

More complex predicates could be left as macros or additional methods
could be defined like rtx_def::is_a_nondebug_insn etc. I think this
should mostly be an improvement, although the comparisons around INSN
may become slightly more confusing: currently, INSN_P (x) is different
from is_a <rtx_insn *> (x), and using something like x->is_a_insn () for
the former would probably increase confusion.

Thanks.

[1] https://gcc.gnu.org/ml/gcc-patches/2019-08/msg00327.html
[2] https://gcc.gnu.org/projects/beginner.html
[3] https://gcc.gnu.org/ml/gcc-patches/2019-08/msg00171.html

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Use predicates for RTL objects
@ 2006-02-03  4:23 nathan bullock
  2006-02-03  5:46 ` Ben Elliston
  0 siblings, 1 reply; 25+ messages in thread
From: nathan bullock @ 2006-02-03  4:23 UTC (permalink / raw)
  To: gcc

Do people still want (GET_CODE (rtx) == XXX) cleaned up to XXX_P(RTX).

If so I notice that there are quite a few of the following:

200 of
GET_CODE(rtx) == PLUS  ---> PLUS_P(rtx)

50 of
GET_CODE(rtx) == MINUS ----> MINUS_P(rtx)

550 of
GET_CODE(rtx) == CONST_INT ---> CONST_INT_P(rtx)

70 of
GET_CODE(rtx) == CONST_DOUBLE ----> CONST_DOUBLE_P(rtx)

150 of
GET_CODE(rtx) == PARALLEL ----> CONST_PARALLEL_P(rtx)

I would probably do all the plus/minus stuff first. Submit that as a patch.

Nathan Bullock

ps. Do I just send the diff file to this mailing list?

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2019-08-09  8:06 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-07 16:15 Use predicates for RTL objects Arvind Sankar
2019-08-07 17:33 ` Segher Boessenkool
2019-08-07 17:40   ` Arvind Sankar
2019-08-07 18:05     ` Segher Boessenkool
2019-08-07 18:58       ` Arvind Sankar
2019-08-08 15:04         ` Segher Boessenkool
2019-08-08 17:42           ` Arvind Sankar
2019-08-08 18:26             ` Segher Boessenkool
2019-08-08 18:53               ` Arvind Sankar
2019-08-08 20:28             ` Jeff Law
2019-08-08  9:10       ` Richard Sandiford
2019-08-08 15:28         ` Segher Boessenkool
2019-08-08 14:31       ` Jeff Law
2019-08-08 15:36         ` Segher Boessenkool
2019-08-08 17:07         ` Arvind Sankar
2019-08-08 20:11           ` Jeff Law
2019-08-09  8:06   ` Richard Biener
2019-08-08 15:04 ` Michael Matz
2019-08-08 17:12   ` Arvind Sankar
2019-08-08 18:14     ` Jakub Jelinek
2019-08-08 18:35       ` Arvind Sankar
2019-08-08 18:46         ` Jakub Jelinek
2019-08-08 20:32           ` Jeff Law
  -- strict thread matches above, loose matches on Subject: below --
2006-02-03  4:23 nathan bullock
2006-02-03  5:46 ` Ben Elliston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).