aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/avr/avr-c.c
diff options
context:
space:
mode:
authorGeorg-Johann Lay <avr@gjlay.de>2012-02-28 08:57:39 +0000
committerGeorg-Johann Lay <gjl@gcc.gnu.org>2012-02-28 08:57:39 +0000
commit639d0302e66e9be17e7979a7c7be71080abcd5b5 (patch)
tree825810f4862db52ee58d2ce059b5c409b59da8bb /gcc/config/avr/avr-c.c
parent8310dca7787a4f1fee92fedc041095f2fb902d5c (diff)
downloadgcc-639d0302e66e9be17e7979a7c7be71080abcd5b5.zip
gcc-639d0302e66e9be17e7979a7c7be71080abcd5b5.tar.gz
gcc-639d0302e66e9be17e7979a7c7be71080abcd5b5.tar.bz2
builtins.def: New file.
* 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. From-SVN: r184616
Diffstat (limited to 'gcc/config/avr/avr-c.c')
-rw-r--r--gcc/config/avr/avr-c.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/gcc/config/avr/avr-c.c b/gcc/config/avr/avr-c.c
index 64f5f80..598a340 100644
--- a/gcc/config/avr/avr-c.c
+++ b/gcc/config/avr/avr-c.c
@@ -71,9 +71,19 @@ avr_toupper (char *up, const char *lo)
/* Worker function for TARGET_CPU_CPP_BUILTINS. */
+static const char *const avr_builtin_name[] =
+ {
+#define DEF_BUILTIN(NAME, N_ARGS, ID, TYPE, CODE) NAME,
+#include "builtins.def"
+#undef DEF_BUILTIN
+ NULL
+ };
+
void
avr_cpu_cpp_builtins (struct cpp_reader *pfile)
{
+ int i;
+
builtin_define_std ("AVR");
if (avr_current_arch->macro)
@@ -140,8 +150,6 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
if (!strcmp (lang_hooks.name, "GNU C"))
{
- int i;
-
for (i = 0; avr_addrspace[i].name; i++)
if (!ADDR_SPACE_GENERIC_P (i)
/* Only supply __FLASH<n> macro if the address space is reasonable
@@ -161,20 +169,11 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile)
easily query if or if not a specific builtin
is available. */
- cpp_define (pfile, "__BUILTIN_AVR_NOP");
- cpp_define (pfile, "__BUILTIN_AVR_SEI");
- cpp_define (pfile, "__BUILTIN_AVR_CLI");
- cpp_define (pfile, "__BUILTIN_AVR_WDR");
- cpp_define (pfile, "__BUILTIN_AVR_SLEEP");
- cpp_define (pfile, "__BUILTIN_AVR_SWAP");
- cpp_define (pfile, "__BUILTIN_AVR_INSERT_BITS");
- cpp_define (pfile, "__BUILTIN_AVR_DELAY_CYCLES");
-
- cpp_define (pfile, "__BUILTIN_AVR_FMUL");
- cpp_define (pfile, "__BUILTIN_AVR_FMULS");
- cpp_define (pfile, "__BUILTIN_AVR_FMULSU");
-
- cpp_define (pfile, "__INT24_MAX__=8388607L");
- cpp_define (pfile, "__INT24_MIN__=(-__INT24_MAX__-1)");
- cpp_define (pfile, "__UINT24_MAX__=16777215UL");
+ for (i = 0; avr_builtin_name[i]; i++)
+ {
+ const char *name = avr_builtin_name[i];
+ char *Name = (char*) alloca (1 + strlen (name));
+
+ cpp_define (pfile, avr_toupper (Name, name));
+ }
}