[Patch,AVR]: Add builtins.def and fix some ICE, add tests

Georg-Johann Lay avr@gjlay.de
Wed Feb 15 22:16:00 GMT 2012


This patch introduces a new file builtins.def that is used as central registry
to hold built-ins' information.

The file is used by defining DEF_BUILTIN macre and then including the file as
described in the head comment of builtins.def.

Up to here it's all code clean-up and no functional change.

Moreover there are some minor changes and ICE fixes:

* Fold __builtin_avr_swap to rotate <<< 4
* Don't fold __builtin_avr_insert_bits if first arg is non-const (was ICE)
* Don't expand __builtin_avr_delay_cycles if arg is not-const (was ICE)

Ok for trunk?

Johann

gcc/testsuite/
	* gcc.target/avr/torture/builtins-1.c: New test.
	* gcc.target/avr/torture/builtins-error.c: New test.
gcc/
	* config/avr/builtins.def: New file.
	* config/avr/t-avr (avr.o, avr-c.o): Depend on it.
	* config/avr/avr.c (enum avr_builtin_id): Use it.
	(avr_init_builtins): Use it. And use avr_bdesc.
	(bdesc_1arg): Remove.
	(bdesc_2arg): Remove.
	(bdesc_3arg): Remove.
	(struct avr_builtin_description): Add field n_args.
	(avr_bdesc): New static variable using builtins.def.
	(avr_expand_builtin): Use it.
	Don't call avr_expand_delay_cycles if op0 is not CONST_INT.
	(avr_fold_builtin): Fold AVR_BUILTIN_SWAP.
	Don't fold AVR_BUILTIN_INSERT_BITS if arg0 is not INTEGER_CST.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: def-builtin.diff
Type: text/x-patch
Size: 12663 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120215/934f2e0f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: builtins-test.diff
Type: text/x-patch
Size: 2035 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20120215/934f2e0f/attachment-0001.bin>


More information about the Gcc-patches mailing list