This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix illegal cast to rtx (*insn_gen_fn) (rtx, ...)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Oleg Endo <oleg dot endo at t-online dot de>
- Cc: Michael Meissner <meissner at linux dot vnet dot ibm dot com>, Richard Henderson <rth at redhat dot com>, Uros Bizjak <ubizjak at gmail dot com>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Stefan Kristiansson <stefan dot kristiansson at saunalahti dot fi>, Andreas Schwab <schwab at linux-m68k dot org>
- Date: Thu, 29 Aug 2013 20:51:27 +0200
- Subject: Re: [PATCH] Fix illegal cast to rtx (*insn_gen_fn) (rtx, ...)
- Authentication-results: sourceware.org; auth=none
- References: <CAFULd4a48kfeg5pJfBYx4ejnKBedUQvWj_-wYEVhBCGPL2uL5A at mail dot gmail dot com> <1374929541 dot 2368 dot 76 dot camel at yam-132-YW-E178-FTW> <52001C5F dot 5080809 at redhat dot com> <1375741943 dot 3952 dot 69 dot camel at yam-132-YW-E178-FTW> <52003462 dot 2090500 at redhat dot com> <1375825540 dot 3952 dot 87 dot camel at yam-132-YW-E178-FTW> <20130807190820 dot GA12791 at ibm-tiger dot the-meissners dot org> <1375903499 dot 3952 dot 89 dot camel at yam-132-YW-E178-FTW> <1377801933 dot 16741 dot 3 dot camel at yam-132-YW-E178-FTW>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Aug 29, 2013 at 08:45:33PM +0200, Oleg Endo wrote:
> Sorry for the delay. I've just backported the 2 patches to 4.8.
> Tested with 'make all-gcc' for SH and PPC cross compilers.
> Committed as rev 202083.
Please fix the overly long lines as a follow-up.
> +struct insn_gen_fn
> +{
> + typedef rtx (*f0) (void);
> + typedef rtx (*f1) (rtx);
> + typedef rtx (*f2) (rtx, rtx);
> + typedef rtx (*f3) (rtx, rtx, rtx);
> + typedef rtx (*f4) (rtx, rtx, rtx, rtx);
> + typedef rtx (*f5) (rtx, rtx, rtx, rtx, rtx);
> + typedef rtx (*f6) (rtx, rtx, rtx, rtx, rtx, rtx);
> + typedef rtx (*f7) (rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> + typedef rtx (*f8) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> + typedef rtx (*f9) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> + typedef rtx (*f10) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> + typedef rtx (*f11) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> + typedef rtx (*f12) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> + typedef rtx (*f13) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> + typedef rtx (*f14) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> + typedef rtx (*f15) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> + typedef rtx (*f16) (rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +
> + typedef f0 stored_funcptr;
> +
> + rtx operator () (void) const { return ((f0)func) (); }
> + rtx operator () (rtx a0) const { return ((f1)func) (a0); }
> + rtx operator () (rtx a0, rtx a1) const { return ((f2)func) (a0, a1); }
> + rtx operator () (rtx a0, rtx a1, rtx a2) const { return ((f3)func) (a0, a1, a2); }
> + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3) const { return ((f4)func) (a0, a1, a2, a3); }
> + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4) const { return ((f5)func) (a0, a1, a2, a3, a4); }
> + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5) const { return ((f6)func) (a0, a1, a2, a3, a4, a5); }
> + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6) const { return ((f7)func) (a0, a1, a2, a3, a4, a5, a6); }
> + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7) const { return ((f8)func) (a0, a1, a2, a3, a4, a5, a6, a7); }
> + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8) const { return ((f9)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8); }
> + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9) const { return ((f10)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9); }
> + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10) const { return ((f11)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); }
> + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11) const { return ((f12)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11); }
> + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12) const { return ((f13)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12); }
> + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12, rtx a13) const { return ((f14)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13); }
> + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12, rtx a13, rtx a14) const { return ((f15)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14); }
> + rtx operator () (rtx a0, rtx a1, rtx a2, rtx a3, rtx a4, rtx a5, rtx a6, rtx a7, rtx a8, rtx a9, rtx a10, rtx a11, rtx a12, rtx a13, rtx a14, rtx a15) const { return ((f16)func) (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); }
> +
> + // This is for compatibility of code that invokes functions like
> + // (*funcptr) (arg)
> + insn_gen_fn operator * (void) const { return *this; }
> +
> + // The wrapped function pointer must be public and there must not be any
> + // constructors. Otherwise the insn_data_d struct initializers generated
> + // by genoutput.c will result in static initializer functions, which defeats
> + // the purpose of the generated insn_data_d array.
> + stored_funcptr func;
> +};
Jakub