diff mbox

RFA: Remove redundant "enum" from "enum machine_mode"

Message ID 87zjcfi666.fsf@e105548-lin.cambridge.arm.com
State New
Headers show

Commit Message

Richard Sandiford Oct. 29, 2014, 9:20 a.m. UTC
In https://gcc.gnu.org/ml/gcc/2014-10/msg00206.html I asked:

  I have some plans to "clean up" the machine_mode handling and perhaps
  make it hierarchical, so that functions that can only handle scalar
  integer modes (say) will be able to take a scalar_int_mode rather than
  a machine_mode as argument.  The first step would be to do a blanket
  removal of the (in C++) redundant "enum" from all those "enum machine_mode"
  variables, parameters and fields.

  Regardless of whether the hierarchy sounds like a good idea, would removing
  the "enum" be OK?  There's never a good time for that much churn, but since
  the release branches are fairly mature and since we already have quite a
  bit of churn in rtl land between 4.9 and 5, now seemed like as good a
  time as any.

No-one objected (or said it was a good idea :-)) so this patch makes
the change.  The hand-written part is very simple.  The automatic part
is to run this hacky script:

----------------------------------------------------------------------------
#!/bin/bash
rfind gcc -name '*.h' -o -name '*.c' -o -name '*.md' -o -name '*.texi*' \
  -o -name '*.awk' -o -name '*.def' |
  grep -v testsuite/ |
  xargs sed -i 's/enum machine_mode/machine_mode/g'
sed -i 's/machine_mode\\n{");/enum machine_mode\\n{");/' gcc/genmodes.c
rfind gcc -name '*.texi*' |
  xargs sed -i -e 's/ {machine_mode} / machine_mode /g' \
               -e 's/enum @var{machine_mode}/machine_mode/' \
               -e '/TARGET_SPILL_CLASS/s/machine_mode)/@var{machine_mode})/'
touch gcc/doc/tm.texi
----------------------------------------------------------------------------

I've attached the result for reference.

The special handling of TARGET_SPILL_CLASS is due to a bug in the way
genhooks handles target.def entries that have no argument names.
It affects other hooks too, e.g.:

    @deftypefn {Target Hook} int TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN (struct cgraph_node *@var{}, struct cgraph_simd_clone *@var{}, @var{tree}, @var{int})

where "tree" and "int" shouldn't be @var{...}s.  I'd like to deal with
that separately.

Tested on x86_64-linux-gnu.  OK to install?

Thanks,
Richard


gcc/
	* gengtype.c (main): Treat machine_mode as a scalar typedef.
	* genmodes.c (emit_insn_modes_h): Hide inline functions if
	USED_FOR_TARGET.



gcc/ada/
	* gcc-interface/decl.c, gcc-interface/gigi.h, gcc-interface/misc.c,
	gcc-interface/trans.c, gcc-interface/utils.c, gcc-interface/utils2.c:
	Remove redundant enum from machine_mode.

c-family/
	* c-common.c, c-common.h, c-cppbuiltin.c, c-lex.c: Remove redundant
	enum from machine_mode.

c/
	* c-decl.c, c-tree.h, c-typeck.c: Remove redundant enum from
	machine_mode.

cp/
	* constexpr.c: Remove redundant enum from machine_mode.

fortran/
	* trans-types.c, trans-types.h: Remove redundant enum from
	machine_mode.

go/
	* go-lang.c: Remove redundant enum from machine_mode.

java/
	* builtins.c, java-tree.h, typeck.c: Remove redundant enum from
	machine_mode.

lto/
	* lto-lang.c: Remove redundant enum from machine_mode.

gcc/
	* addresses.h, alias.c, asan.c, auto-inc-dec.c, bt-load.c, builtins.c,
	builtins.h, caller-save.c, calls.c, calls.h, cfgexpand.c, cfgloop.h,
	cfgrtl.c, combine.c, compare-elim.c, config/aarch64/aarch64-builtins.c,
	config/aarch64/aarch64-protos.h, config/aarch64/aarch64-simd.md,
	config/aarch64/aarch64.c, config/aarch64/aarch64.h,
	config/aarch64/aarch64.md, config/alpha/alpha-protos.h,
	config/alpha/alpha.c, config/arc/arc-protos.h, config/arc/arc.c,
	config/arc/arc.h, config/arc/predicates.md,
	config/arm/aarch-common-protos.h, config/arm/aarch-common.c,
	config/arm/arm-protos.h, config/arm/arm.c, config/arm/arm.h,
	config/arm/arm.md, config/arm/neon.md, config/arm/thumb2.md,
	config/avr/avr-log.c, config/avr/avr-protos.h, config/avr/avr.c,
	config/avr/avr.md, config/bfin/bfin-protos.h, config/bfin/bfin.c,
	config/c6x/c6x-protos.h, config/c6x/c6x.c, config/c6x/c6x.md,
	config/cr16/cr16-protos.h, config/cr16/cr16.c,
	config/cris/cris-protos.h, config/cris/cris.c, config/cris/cris.md,
	config/darwin-protos.h, config/darwin.c,
	config/epiphany/epiphany-protos.h, config/epiphany/epiphany.c,
	config/epiphany/epiphany.md, config/fr30/fr30.c,
	config/frv/frv-protos.h, config/frv/frv.c, config/frv/predicates.md,
	config/h8300/h8300-protos.h, config/h8300/h8300.c,
	config/i386/i386-builtin-types.awk, config/i386/i386-protos.h,
	config/i386/i386.c, config/i386/i386.md, config/i386/predicates.md,
	config/i386/sse.md, config/i386/sync.md, config/ia64/ia64-protos.h,
	config/ia64/ia64.c, config/iq2000/iq2000-protos.h,
	config/iq2000/iq2000.c, config/iq2000/iq2000.md,
	config/lm32/lm32-protos.h, config/lm32/lm32.c,
	config/m32c/m32c-protos.h, config/m32c/m32c.c,
	config/m32r/m32r-protos.h, config/m32r/m32r.c,
	config/m68k/m68k-protos.h, config/m68k/m68k.c,
	config/mcore/mcore-protos.h, config/mcore/mcore.c,
	config/mcore/mcore.md, config/mep/mep-protos.h, config/mep/mep.c,
	config/microblaze/microblaze-protos.h, config/microblaze/microblaze.c,
	config/mips/mips-protos.h, config/mips/mips.c,
	config/mmix/mmix-protos.h, config/mmix/mmix.c,
	config/mn10300/mn10300-protos.h, config/mn10300/mn10300.c,
	config/moxie/moxie.c, config/msp430/msp430-protos.h,
	config/msp430/msp430.c, config/nds32/nds32-cost.c,
	config/nds32/nds32-intrinsic.c, config/nds32/nds32-md-auxiliary.c,
	config/nds32/nds32-protos.h, config/nds32/nds32.c,
	config/nios2/nios2-protos.h, config/nios2/nios2.c,
	config/pa/pa-protos.h, config/pa/pa.c, config/pdp11/pdp11-protos.h,
	config/pdp11/pdp11.c, config/rl78/rl78-protos.h, config/rl78/rl78.c,
	config/rs6000/altivec.md, config/rs6000/rs6000-c.c,
	config/rs6000/rs6000-protos.h, config/rs6000/rs6000.c,
	config/rs6000/rs6000.h, config/rx/rx-protos.h, config/rx/rx.c,
	config/s390/predicates.md, config/s390/s390-protos.h,
	config/s390/s390.c, config/s390/s390.h, config/s390/s390.md,
	config/sh/predicates.md, config/sh/sh-protos.h, config/sh/sh.c,
	config/sh/sh.md, config/sparc/predicates.md,
	config/sparc/sparc-protos.h, config/sparc/sparc.c,
	config/sparc/sparc.md, config/spu/spu-protos.h, config/spu/spu.c,
	config/stormy16/stormy16-protos.h, config/stormy16/stormy16.c,
	config/tilegx/tilegx-protos.h, config/tilegx/tilegx.c,
	config/tilegx/tilegx.md, config/tilepro/tilepro-protos.h,
	config/tilepro/tilepro.c, config/v850/v850-protos.h,
	config/v850/v850.c, config/v850/v850.md, config/vax/vax-protos.h,
	config/vax/vax.c, config/vms/vms-c.c, config/xtensa/xtensa-protos.h,
	config/xtensa/xtensa.c, coverage.c, cprop.c, cse.c, cselib.c, cselib.h,
	dbxout.c, ddg.c, df-problems.c, dfp.c, dfp.h, doc/md.texi,
	doc/rtl.texi, doc/tm.texi, doc/tm.texi.in, dojump.c, dse.c,
	dwarf2cfi.c, dwarf2out.c, dwarf2out.h, emit-rtl.c, emit-rtl.h,
	except.c, explow.c, expmed.c, expmed.h, expr.c, expr.h, final.c,
	fixed-value.c, fixed-value.h, fold-const.c, function.c, function.h,
	fwprop.c, gcse.c, gengenrtl.c, genmodes.c, genopinit.c, genoutput.c,
	genpreds.c, genrecog.c, gensupport.c, gimple-ssa-strength-reduction.c,
	graphite-clast-to-gimple.c, haifa-sched.c, hooks.c, hooks.h, ifcvt.c,
	internal-fn.c, ira-build.c, ira-color.c, ira-conflicts.c, ira-costs.c,
	ira-emit.c, ira-int.h, ira-lives.c, ira.c, ira.h, jump.c, langhooks.h,
	libfuncs.h, lists.c, loop-doloop.c, loop-invariant.c, loop-iv.c,
	loop-unroll.c, lower-subreg.c, lower-subreg.h, lra-assigns.c,
	lra-constraints.c, lra-eliminations.c, lra-int.h, lra-lives.c,
	lra-spills.c, lra.c, lra.h, machmode.h, omp-low.c, optabs.c, optabs.h,
	output.h, postreload.c, print-tree.c, read-rtl.c ,real.c, real.h,
	recog.c, recog.h, ree.c, reg-stack.c, regcprop.c, reginfo.c,
	regrename.c, regs.h, reload.c, reload.h, reload1.c, rtl.c, rtl.h,
	rtlanal.c, rtlhash.c, rtlhooks-def.h, rtlhooks.c, sched-deps.c,
	sel-sched-dump.c, sel-sched-ir.c, sel-sched-ir.h, sel-sched.c,
	simplify-rtx.c, stmt.c, stor-layout.c, stor-layout.h, target.def,
	targhooks.c, targhooks.h, tree-affine.c, tree-call-cdce.c,
	tree-complex.c, tree-data-ref.c, tree-dfa.c, tree-if-conv.c,
	tree-inline.c, tree-outof-ssa.c, tree-scalar-evolution.c,
	tree-ssa-address.c, tree-ssa-ccp.c, tree-ssa-loop-ivopts.c,
	tree-ssa-loop-ivopts.h, tree-ssa-loop-manip.c,
	tree-ssa-loop-prefetch.c, tree-ssa-math-opts.c, tree-ssa-reassoc.c,
	tree-ssa-sccvn.c, tree-streamer-in.c, tree-switch-conversion.c,
	tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop.c,
	tree-vect-patterns.c, tree-vect-slp.c, tree-vect-stmts.c,
	tree-vrp.c, tree.c, tree.h, tsan.c, ubsan.c, valtrack.c,
	var-tracking.c, varasm.c: Remove redundant enum from
	machine_mode.

Comments

Richard Biener Oct. 29, 2014, 9:43 a.m. UTC | #1
On Wed, Oct 29, 2014 at 10:20 AM, Richard Sandiford
<richard.sandiford@arm.com> wrote:
> In https://gcc.gnu.org/ml/gcc/2014-10/msg00206.html I asked:
>
>   I have some plans to "clean up" the machine_mode handling and perhaps
>   make it hierarchical, so that functions that can only handle scalar
>   integer modes (say) will be able to take a scalar_int_mode rather than
>   a machine_mode as argument.  The first step would be to do a blanket
>   removal of the (in C++) redundant "enum" from all those "enum machine_mode"
>   variables, parameters and fields.
>
>   Regardless of whether the hierarchy sounds like a good idea, would removing
>   the "enum" be OK?  There's never a good time for that much churn, but since
>   the release branches are fairly mature and since we already have quite a
>   bit of churn in rtl land between 4.9 and 5, now seemed like as good a
>   time as any.
>
> No-one objected (or said it was a good idea :-)) so this patch makes
> the change.  The hand-written part is very simple.  The automatic part
> is to run this hacky script:
>
> ----------------------------------------------------------------------------
> #!/bin/bash
> rfind gcc -name '*.h' -o -name '*.c' -o -name '*.md' -o -name '*.texi*' \
>   -o -name '*.awk' -o -name '*.def' |
>   grep -v testsuite/ |
>   xargs sed -i 's/enum machine_mode/machine_mode/g'
> sed -i 's/machine_mode\\n{");/enum machine_mode\\n{");/' gcc/genmodes.c
> rfind gcc -name '*.texi*' |
>   xargs sed -i -e 's/ {machine_mode} / machine_mode /g' \
>                -e 's/enum @var{machine_mode}/machine_mode/' \
>                -e '/TARGET_SPILL_CLASS/s/machine_mode)/@var{machine_mode})/'
> touch gcc/doc/tm.texi
> ----------------------------------------------------------------------------
>
> I've attached the result for reference.
>
> The special handling of TARGET_SPILL_CLASS is due to a bug in the way
> genhooks handles target.def entries that have no argument names.
> It affects other hooks too, e.g.:
>
>     @deftypefn {Target Hook} int TARGET_SIMD_CLONE_COMPUTE_VECSIZE_AND_SIMDLEN (struct cgraph_node *@var{}, struct cgraph_simd_clone *@var{}, @var{tree}, @var{int})
>
> where "tree" and "int" shouldn't be @var{...}s.  I'd like to deal with
> that separately.
>
> Tested on x86_64-linux-gnu.  OK to install?

Ok.  (not sure if we have headers that are still used by programs compiled
with a C compiler in some weird setups)

Thanks,
Richard.

> Thanks,
> Richard
>
>
> gcc/
>         * gengtype.c (main): Treat machine_mode as a scalar typedef.
>         * genmodes.c (emit_insn_modes_h): Hide inline functions if
>         USED_FOR_TARGET.
>
> Index: gcc/gengtype.c
> ===================================================================
> --- gcc/gengtype.c      (revision 216806)
> +++ gcc/gengtype.c      (working copy)
> @@ -5650,6 +5650,7 @@
>        POS_HERE (do_scalar_typedef ("jword", &pos));
>        POS_HERE (do_scalar_typedef ("JCF_u2", &pos));
>        POS_HERE (do_scalar_typedef ("void", &pos));
> +      POS_HERE (do_scalar_typedef ("machine_mode", &pos));
>        POS_HERE (do_typedef ("PTR",
>                             create_pointer (resolve_typedef ("void", &pos)),
>                             &pos));
> Index: gcc/genmodes.c
> ===================================================================
> --- gcc/genmodes.c      (revision 216806)
> +++ gcc/genmodes.c      (working copy)
> @@ -1108,7 +1108,7 @@
>
>    printf ("#define NUM_INT_N_ENTS %d\n", n_int_n_ents);
>
> -  puts ("\n#if GCC_VERSION >= 4001\n");
> +  puts ("\n#if !defined (USED_FOR_TARGET) && GCC_VERSION >= 4001\n");
>    emit_mode_size_inline ();
>    emit_mode_nunits_inline ();
>    emit_mode_inner_inline ();
>
>
> gcc/ada/
>         * gcc-interface/decl.c, gcc-interface/gigi.h, gcc-interface/misc.c,
>         gcc-interface/trans.c, gcc-interface/utils.c, gcc-interface/utils2.c:
>         Remove redundant enum from machine_mode.
>
> c-family/
>         * c-common.c, c-common.h, c-cppbuiltin.c, c-lex.c: Remove redundant
>         enum from machine_mode.
>
> c/
>         * c-decl.c, c-tree.h, c-typeck.c: Remove redundant enum from
>         machine_mode.
>
> cp/
>         * constexpr.c: Remove redundant enum from machine_mode.
>
> fortran/
>         * trans-types.c, trans-types.h: Remove redundant enum from
>         machine_mode.
>
> go/
>         * go-lang.c: Remove redundant enum from machine_mode.
>
> java/
>         * builtins.c, java-tree.h, typeck.c: Remove redundant enum from
>         machine_mode.
>
> lto/
>         * lto-lang.c: Remove redundant enum from machine_mode.
>
> gcc/
>         * addresses.h, alias.c, asan.c, auto-inc-dec.c, bt-load.c, builtins.c,
>         builtins.h, caller-save.c, calls.c, calls.h, cfgexpand.c, cfgloop.h,
>         cfgrtl.c, combine.c, compare-elim.c, config/aarch64/aarch64-builtins.c,
>         config/aarch64/aarch64-protos.h, config/aarch64/aarch64-simd.md,
>         config/aarch64/aarch64.c, config/aarch64/aarch64.h,
>         config/aarch64/aarch64.md, config/alpha/alpha-protos.h,
>         config/alpha/alpha.c, config/arc/arc-protos.h, config/arc/arc.c,
>         config/arc/arc.h, config/arc/predicates.md,
>         config/arm/aarch-common-protos.h, config/arm/aarch-common.c,
>         config/arm/arm-protos.h, config/arm/arm.c, config/arm/arm.h,
>         config/arm/arm.md, config/arm/neon.md, config/arm/thumb2.md,
>         config/avr/avr-log.c, config/avr/avr-protos.h, config/avr/avr.c,
>         config/avr/avr.md, config/bfin/bfin-protos.h, config/bfin/bfin.c,
>         config/c6x/c6x-protos.h, config/c6x/c6x.c, config/c6x/c6x.md,
>         config/cr16/cr16-protos.h, config/cr16/cr16.c,
>         config/cris/cris-protos.h, config/cris/cris.c, config/cris/cris.md,
>         config/darwin-protos.h, config/darwin.c,
>         config/epiphany/epiphany-protos.h, config/epiphany/epiphany.c,
>         config/epiphany/epiphany.md, config/fr30/fr30.c,
>         config/frv/frv-protos.h, config/frv/frv.c, config/frv/predicates.md,
>         config/h8300/h8300-protos.h, config/h8300/h8300.c,
>         config/i386/i386-builtin-types.awk, config/i386/i386-protos.h,
>         config/i386/i386.c, config/i386/i386.md, config/i386/predicates.md,
>         config/i386/sse.md, config/i386/sync.md, config/ia64/ia64-protos.h,
>         config/ia64/ia64.c, config/iq2000/iq2000-protos.h,
>         config/iq2000/iq2000.c, config/iq2000/iq2000.md,
>         config/lm32/lm32-protos.h, config/lm32/lm32.c,
>         config/m32c/m32c-protos.h, config/m32c/m32c.c,
>         config/m32r/m32r-protos.h, config/m32r/m32r.c,
>         config/m68k/m68k-protos.h, config/m68k/m68k.c,
>         config/mcore/mcore-protos.h, config/mcore/mcore.c,
>         config/mcore/mcore.md, config/mep/mep-protos.h, config/mep/mep.c,
>         config/microblaze/microblaze-protos.h, config/microblaze/microblaze.c,
>         config/mips/mips-protos.h, config/mips/mips.c,
>         config/mmix/mmix-protos.h, config/mmix/mmix.c,
>         config/mn10300/mn10300-protos.h, config/mn10300/mn10300.c,
>         config/moxie/moxie.c, config/msp430/msp430-protos.h,
>         config/msp430/msp430.c, config/nds32/nds32-cost.c,
>         config/nds32/nds32-intrinsic.c, config/nds32/nds32-md-auxiliary.c,
>         config/nds32/nds32-protos.h, config/nds32/nds32.c,
>         config/nios2/nios2-protos.h, config/nios2/nios2.c,
>         config/pa/pa-protos.h, config/pa/pa.c, config/pdp11/pdp11-protos.h,
>         config/pdp11/pdp11.c, config/rl78/rl78-protos.h, config/rl78/rl78.c,
>         config/rs6000/altivec.md, config/rs6000/rs6000-c.c,
>         config/rs6000/rs6000-protos.h, config/rs6000/rs6000.c,
>         config/rs6000/rs6000.h, config/rx/rx-protos.h, config/rx/rx.c,
>         config/s390/predicates.md, config/s390/s390-protos.h,
>         config/s390/s390.c, config/s390/s390.h, config/s390/s390.md,
>         config/sh/predicates.md, config/sh/sh-protos.h, config/sh/sh.c,
>         config/sh/sh.md, config/sparc/predicates.md,
>         config/sparc/sparc-protos.h, config/sparc/sparc.c,
>         config/sparc/sparc.md, config/spu/spu-protos.h, config/spu/spu.c,
>         config/stormy16/stormy16-protos.h, config/stormy16/stormy16.c,
>         config/tilegx/tilegx-protos.h, config/tilegx/tilegx.c,
>         config/tilegx/tilegx.md, config/tilepro/tilepro-protos.h,
>         config/tilepro/tilepro.c, config/v850/v850-protos.h,
>         config/v850/v850.c, config/v850/v850.md, config/vax/vax-protos.h,
>         config/vax/vax.c, config/vms/vms-c.c, config/xtensa/xtensa-protos.h,
>         config/xtensa/xtensa.c, coverage.c, cprop.c, cse.c, cselib.c, cselib.h,
>         dbxout.c, ddg.c, df-problems.c, dfp.c, dfp.h, doc/md.texi,
>         doc/rtl.texi, doc/tm.texi, doc/tm.texi.in, dojump.c, dse.c,
>         dwarf2cfi.c, dwarf2out.c, dwarf2out.h, emit-rtl.c, emit-rtl.h,
>         except.c, explow.c, expmed.c, expmed.h, expr.c, expr.h, final.c,
>         fixed-value.c, fixed-value.h, fold-const.c, function.c, function.h,
>         fwprop.c, gcse.c, gengenrtl.c, genmodes.c, genopinit.c, genoutput.c,
>         genpreds.c, genrecog.c, gensupport.c, gimple-ssa-strength-reduction.c,
>         graphite-clast-to-gimple.c, haifa-sched.c, hooks.c, hooks.h, ifcvt.c,
>         internal-fn.c, ira-build.c, ira-color.c, ira-conflicts.c, ira-costs.c,
>         ira-emit.c, ira-int.h, ira-lives.c, ira.c, ira.h, jump.c, langhooks.h,
>         libfuncs.h, lists.c, loop-doloop.c, loop-invariant.c, loop-iv.c,
>         loop-unroll.c, lower-subreg.c, lower-subreg.h, lra-assigns.c,
>         lra-constraints.c, lra-eliminations.c, lra-int.h, lra-lives.c,
>         lra-spills.c, lra.c, lra.h, machmode.h, omp-low.c, optabs.c, optabs.h,
>         output.h, postreload.c, print-tree.c, read-rtl.c ,real.c, real.h,
>         recog.c, recog.h, ree.c, reg-stack.c, regcprop.c, reginfo.c,
>         regrename.c, regs.h, reload.c, reload.h, reload1.c, rtl.c, rtl.h,
>         rtlanal.c, rtlhash.c, rtlhooks-def.h, rtlhooks.c, sched-deps.c,
>         sel-sched-dump.c, sel-sched-ir.c, sel-sched-ir.h, sel-sched.c,
>         simplify-rtx.c, stmt.c, stor-layout.c, stor-layout.h, target.def,
>         targhooks.c, targhooks.h, tree-affine.c, tree-call-cdce.c,
>         tree-complex.c, tree-data-ref.c, tree-dfa.c, tree-if-conv.c,
>         tree-inline.c, tree-outof-ssa.c, tree-scalar-evolution.c,
>         tree-ssa-address.c, tree-ssa-ccp.c, tree-ssa-loop-ivopts.c,
>         tree-ssa-loop-ivopts.h, tree-ssa-loop-manip.c,
>         tree-ssa-loop-prefetch.c, tree-ssa-math-opts.c, tree-ssa-reassoc.c,
>         tree-ssa-sccvn.c, tree-streamer-in.c, tree-switch-conversion.c,
>         tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop.c,
>         tree-vect-patterns.c, tree-vect-slp.c, tree-vect-stmts.c,
>         tree-vrp.c, tree.c, tree.h, tsan.c, ubsan.c, valtrack.c,
>         var-tracking.c, varasm.c: Remove redundant enum from
>         machine_mode.
diff mbox

Patch

Index: gcc/gengtype.c
===================================================================
--- gcc/gengtype.c	(revision 216806)
+++ gcc/gengtype.c	(working copy)
@@ -5650,6 +5650,7 @@ 
       POS_HERE (do_scalar_typedef ("jword", &pos));
       POS_HERE (do_scalar_typedef ("JCF_u2", &pos));
       POS_HERE (do_scalar_typedef ("void", &pos));
+      POS_HERE (do_scalar_typedef ("machine_mode", &pos));
       POS_HERE (do_typedef ("PTR", 
 			    create_pointer (resolve_typedef ("void", &pos)),
 			    &pos));
Index: gcc/genmodes.c
===================================================================
--- gcc/genmodes.c	(revision 216806)
+++ gcc/genmodes.c	(working copy)
@@ -1108,7 +1108,7 @@ 
 
   printf ("#define NUM_INT_N_ENTS %d\n", n_int_n_ents);
 
-  puts ("\n#if GCC_VERSION >= 4001\n");
+  puts ("\n#if !defined (USED_FOR_TARGET) && GCC_VERSION >= 4001\n");
   emit_mode_size_inline ();
   emit_mode_nunits_inline ();
   emit_mode_inner_inline ();