This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch][AVR]: Use define_c_enum where appropriate
- From: Georg-Johann Lay <avr at gjlay dot de>
- To: "Weddington, Eric" <Eric dot Weddington at atmel dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Denis Chertykov <chertykov at gmail dot com>, Anatoly Sokolov <aesok at post dot ru>, Joerg Wunsch <joerg_wunsch at uriah dot heep dot sax dot de>
- Date: Wed, 23 Mar 2011 19:00:44 +0100
- Subject: Re: [Patch][AVR]: Use define_c_enum where appropriate
- References: <4D8A074E.8040009@gjlay.de> <8D64F155F1C88743BFDC71288E8E2DA8F41AC8@csomb01.corp.atmel.com>
Weddington, Eric schrieb:
Hi Johann,
Can we hold off on this patch for just a little bit? I agree it would
be good to clean it up, but I would like to get in the attached patch
to add some builtin functions that Anatoly and I worked on. The patch
was (nominally) for 4.4. I need to see if it will patch cleanly to
trunk, and if not, then I'd like to keep the changes minimal.
Your patch is more elaborate, I just didn't know you planned to commit
builtin support, nothing exciting in my work.
+ case AVR_BUILTIN_DELAY_CYCLES:
+ {
+ arg0 = CALL_EXPR_ARG (exp, 0);
+ op0 = expand_expr (arg0, NULL_RTX, VOIDmode, 0);
+
+ if (!CONSTANT_P (op0))
+ error ("__builtin_avr_delay_cycles expects an integer
constant.");
Should be
if (!CONST_INT_P (op0))
error ("__builtin_avr_delay_cycles expects a compile time
constant.");
You use INTVAL in the insns, and symbols/addresses cannot be handled
reasonably.
AFAIR avr-libc casts float down to int, so no need to handle/cast float?
+ emit_insn (gen_delay_cycles (op0));
+ return 0;
+ }
+ }
+
+ for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
+ if (d->code == fcode)
+ return avr_expand_unop_builtin (d->icode, exp, target);
+
+ for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
-------------------------^
Tippo?
+ if (d->code == fcode)
+ return avr_expand_binop_builtin (d->icode, exp, target);
Johann