gcc/gcc/double-int.c

1572 lines
39 KiB
C
Raw Permalink Normal View History

/* Operations with long integers.
Copyright (C) 2006-2017 Free Software Foundation, Inc.
Remove trailing white spaces. 2009-11-25 H.J. Lu <hongjiu.lu@intel.com> * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. From-SVN: r154645
2009-11-25 11:55:54 +01:00
This file is part of GCC.
Remove trailing white spaces. 2009-11-25 H.J. Lu <hongjiu.lu@intel.com> * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. From-SVN: r154645
2009-11-25 11:55:54 +01:00
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
Remove trailing white spaces. 2009-11-25 H.J. Lu <hongjiu.lu@intel.com> * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. From-SVN: r154645
2009-11-25 11:55:54 +01:00
GCC is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Remove trailing white spaces. 2009-11-25 H.J. Lu <hongjiu.lu@intel.com> * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. From-SVN: r154645
2009-11-25 11:55:54 +01:00
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h" /* For BITS_PER_UNIT and *_BIG_ENDIAN. */
#include "tree.h"
Finish conversion of uses of double_int to the new API. Some old functionality required new interfaces, and these have been added to double-int.[hc]: double_int::from_pair - static constructor function wide_mul_with_sign - double-wide multiply instruction sub_with_overflow - subtraction with overlow testing neg_with_overflow - negation with overlow testing divmod_with_overflow - div and mod with overlow testing This patch corrects the bootstrap problem on HPPA, via the addition of sub_with_overflow. (The overflow properties of negation and addition are different from subtraction.) The prior two generations of the interface have been removed. Some of these old interfaces are still used as static implementation in double-int.c. The changed compiler appears 0.321% faster with 80% confidence of being faster. Tested on x86_64, HPPA, and SPARC. However, there are changes to the avr config files, and I have not tested those. Index: gcc/java/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * decl.c (java_init_decl_processing): Change to new double_int API. * jcf-parse.c (get_constant): Likewise. * boehm.c (mark_reference_fields): Likewise. (get_boehm_type_descriptor): Likewise. Index: gcc/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::from_pair): New. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. (shwi_to_double_int): Remove. (uhwi_to_double_int): Remove. (double_int_to_shwi): Remove. (double_int_to_uhwi): Remove. (double_int_fits_in_uhwi_p): Remove. (double_int_fits_in_shwi_p): Remove. (double_int_fits_in_hwi_p): Remove. (double_int_mul): Remove. (double_int_mul_with_sign): Remove. (double_int_add): Remove. (double_int_sub): Remove. (double_int_neg): Remove. (double_int_div): Remove. (double_int_sdiv): Remove. (double_int_udiv): Remove. (double_int_mod): Remove. (double_int_smod): Remove. (double_int_umod): Remove. (double_int_divmod): Remove. (double_int_sdivmod): Remove. (double_int_udivmod): Remove. (double_int_multiple_of): Remove. (double_int_setbit): Remove. (double_int_ctz): Remove. (double_int_not): Remove. (double_int_ior): Remove. (double_int_and): Remove. (double_int_and_not): Remove. (double_int_xor): Remove. (double_int_lshift): Remove. (double_int_rshift): Remove. (double_int_lrotate): Remove. (double_int_rrotate): Remove. (double_int_negative_p): Remove. (double_int_cmp): Remove. (double_int_scmp): Remove. (double_int_ucmp): Remove. (double_int_max): Remove. (double_int_smax): Remove. (double_int_umax): Remove. (double_int_min): Remove. (double_int_smin): Remove. (double_int_umin): Remove. (double_int_ext): Remove. (double_int_sext): Remove. (double_int_zext): Remove. (double_int_mask): Remove. (double_int_max_value): Remove. (double_int_min_value): Remove. (double_int_zero_p): Remove. (double_int_one_p): Remove. (double_int_minus_one_p): Remove. (double_int_equal_p): Remove. (double_int_popcount): Remove. (extern add_double_with_sign): Remove. (#define add_double): Remove. (extern neg_double): Remove. (extern mul_double_with_sign): Remove. (extern mul_double_wide_with_sign): Remove. (#define mul_double): Remove. (extern lshift_double): Remove. (extern div_and_round_double): Remove. * double-int.c (add_double_with_sign): Make static. (#defined add_double): Localized from header. (neg_double): Make static. (mul_double_with_sign): Make static. (mul_double_wide_with_sign): Make static. (#defined mul_double): Localized from header. (lshift_double): Make static. (div_and_round_double): Make static. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. * emit-rtl.c (init_emit_once): Change to new double_int API. * explow.c (plus_constant): Likewise. * expmed.c (choose_multiplier): Likewise. * fold-const.c (#define OVERFLOW_SUM_SIGN): Remove. (int_const_binop_1): Change to new double_int API. (fold_div_compare): Likewise. (maybe_canonicalize_comparison): Likewise. (pointer_may_wrap_p): Likewise. (fold_negate_const): Likewise. (fold_abs_const): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_const_binary_operation): Likewise. * tree-chrec.c (tree_fold_binomial): Likewise. * tree-vrp.c (extract_range_from_binary_expr_1): Likewise. * config/sparc/sparc.c (sparc_fold_builtin): Likewise. * config/avr/avr.c (avr_double_int_push_digit): Likewise. (avr_map): Likewise. (avr_map_decompose): Likewise. (avr_out_insert_bits): Likewise. Index: gcc/cp/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * init.c (build_new_1): Change to new double_int API. * decl.c (build_enumerator): Likewise. * typeck2.c (process_init_constructor_array): Likewise. * mangle.c (write_array_type): Likewise. Index: gcc/fortran/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * trans-expr.c (gfc_conv_cst_int_power): Change to new double_int API. * target-memory.c (gfc_interpret_logical): Likewise. From-SVN: r191675
2012-09-24 20:22:31 +02:00
static int add_double_with_sign (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
unsigned HOST_WIDE_INT, HOST_WIDE_INT,
unsigned HOST_WIDE_INT *, HOST_WIDE_INT *,
bool);
#define add_double(l1,h1,l2,h2,lv,hv) \
add_double_with_sign (l1, h1, l2, h2, lv, hv, false)
static int neg_double (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
unsigned HOST_WIDE_INT *, HOST_WIDE_INT *);
static int mul_double_wide_with_sign (unsigned HOST_WIDE_INT, HOST_WIDE_INT,
unsigned HOST_WIDE_INT, HOST_WIDE_INT,
unsigned HOST_WIDE_INT *, HOST_WIDE_INT *,
unsigned HOST_WIDE_INT *, HOST_WIDE_INT *,
bool);
#define mul_double(l1,h1,l2,h2,lv,hv) \
mul_double_wide_with_sign (l1, h1, l2, h2, lv, hv, NULL, NULL, false)
Finish conversion of uses of double_int to the new API. Some old functionality required new interfaces, and these have been added to double-int.[hc]: double_int::from_pair - static constructor function wide_mul_with_sign - double-wide multiply instruction sub_with_overflow - subtraction with overlow testing neg_with_overflow - negation with overlow testing divmod_with_overflow - div and mod with overlow testing This patch corrects the bootstrap problem on HPPA, via the addition of sub_with_overflow. (The overflow properties of negation and addition are different from subtraction.) The prior two generations of the interface have been removed. Some of these old interfaces are still used as static implementation in double-int.c. The changed compiler appears 0.321% faster with 80% confidence of being faster. Tested on x86_64, HPPA, and SPARC. However, there are changes to the avr config files, and I have not tested those. Index: gcc/java/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * decl.c (java_init_decl_processing): Change to new double_int API. * jcf-parse.c (get_constant): Likewise. * boehm.c (mark_reference_fields): Likewise. (get_boehm_type_descriptor): Likewise. Index: gcc/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::from_pair): New. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. (shwi_to_double_int): Remove. (uhwi_to_double_int): Remove. (double_int_to_shwi): Remove. (double_int_to_uhwi): Remove. (double_int_fits_in_uhwi_p): Remove. (double_int_fits_in_shwi_p): Remove. (double_int_fits_in_hwi_p): Remove. (double_int_mul): Remove. (double_int_mul_with_sign): Remove. (double_int_add): Remove. (double_int_sub): Remove. (double_int_neg): Remove. (double_int_div): Remove. (double_int_sdiv): Remove. (double_int_udiv): Remove. (double_int_mod): Remove. (double_int_smod): Remove. (double_int_umod): Remove. (double_int_divmod): Remove. (double_int_sdivmod): Remove. (double_int_udivmod): Remove. (double_int_multiple_of): Remove. (double_int_setbit): Remove. (double_int_ctz): Remove. (double_int_not): Remove. (double_int_ior): Remove. (double_int_and): Remove. (double_int_and_not): Remove. (double_int_xor): Remove. (double_int_lshift): Remove. (double_int_rshift): Remove. (double_int_lrotate): Remove. (double_int_rrotate): Remove. (double_int_negative_p): Remove. (double_int_cmp): Remove. (double_int_scmp): Remove. (double_int_ucmp): Remove. (double_int_max): Remove. (double_int_smax): Remove. (double_int_umax): Remove. (double_int_min): Remove. (double_int_smin): Remove. (double_int_umin): Remove. (double_int_ext): Remove. (double_int_sext): Remove. (double_int_zext): Remove. (double_int_mask): Remove. (double_int_max_value): Remove. (double_int_min_value): Remove. (double_int_zero_p): Remove. (double_int_one_p): Remove. (double_int_minus_one_p): Remove. (double_int_equal_p): Remove. (double_int_popcount): Remove. (extern add_double_with_sign): Remove. (#define add_double): Remove. (extern neg_double): Remove. (extern mul_double_with_sign): Remove. (extern mul_double_wide_with_sign): Remove. (#define mul_double): Remove. (extern lshift_double): Remove. (extern div_and_round_double): Remove. * double-int.c (add_double_with_sign): Make static. (#defined add_double): Localized from header. (neg_double): Make static. (mul_double_with_sign): Make static. (mul_double_wide_with_sign): Make static. (#defined mul_double): Localized from header. (lshift_double): Make static. (div_and_round_double): Make static. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. * emit-rtl.c (init_emit_once): Change to new double_int API. * explow.c (plus_constant): Likewise. * expmed.c (choose_multiplier): Likewise. * fold-const.c (#define OVERFLOW_SUM_SIGN): Remove. (int_const_binop_1): Change to new double_int API. (fold_div_compare): Likewise. (maybe_canonicalize_comparison): Likewise. (pointer_may_wrap_p): Likewise. (fold_negate_const): Likewise. (fold_abs_const): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_const_binary_operation): Likewise. * tree-chrec.c (tree_fold_binomial): Likewise. * tree-vrp.c (extract_range_from_binary_expr_1): Likewise. * config/sparc/sparc.c (sparc_fold_builtin): Likewise. * config/avr/avr.c (avr_double_int_push_digit): Likewise. (avr_map): Likewise. (avr_map_decompose): Likewise. (avr_out_insert_bits): Likewise. Index: gcc/cp/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * init.c (build_new_1): Change to new double_int API. * decl.c (build_enumerator): Likewise. * typeck2.c (process_init_constructor_array): Likewise. * mangle.c (write_array_type): Likewise. Index: gcc/fortran/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * trans-expr.c (gfc_conv_cst_int_power): Change to new double_int API. * target-memory.c (gfc_interpret_logical): Likewise. From-SVN: r191675
2012-09-24 20:22:31 +02:00
static int div_and_round_double (unsigned, int, unsigned HOST_WIDE_INT,
HOST_WIDE_INT, unsigned HOST_WIDE_INT,
HOST_WIDE_INT, unsigned HOST_WIDE_INT *,
HOST_WIDE_INT *, unsigned HOST_WIDE_INT *,
HOST_WIDE_INT *);
/* We know that A1 + B1 = SUM1, using 2's complement arithmetic and ignoring
overflow. Suppose A, B and SUM have the same respective signs as A1, B1,
and SUM1. Then this yields nonzero if overflow occurred during the
addition.
Overflow occurs if A and B have the same sign, but A and SUM differ in
sign. Use `^' to test whether signs differ, and `< 0' to isolate the
sign. */
#define OVERFLOW_SUM_SIGN(a, b, sum) ((~((a) ^ (b)) & ((a) ^ (sum))) < 0)
/* To do constant folding on INTEGER_CST nodes requires two-word arithmetic.
We do that by representing the two-word integer in 4 words, with only
HOST_BITS_PER_WIDE_INT / 2 bits stored in each word, as a positive
number. The value of the word is LOWPART + HIGHPART * BASE. */
#define LOWPART(x) \
((x) & ((HOST_WIDE_INT_1U << (HOST_BITS_PER_WIDE_INT / 2)) - 1))
#define HIGHPART(x) \
((unsigned HOST_WIDE_INT) (x) >> HOST_BITS_PER_WIDE_INT / 2)
#define BASE (HOST_WIDE_INT_1U << HOST_BITS_PER_WIDE_INT / 2)
/* Unpack a two-word integer into 4 words.
LOW and HI are the integer, as two `HOST_WIDE_INT' pieces.
WORDS points to the array of HOST_WIDE_INTs. */
static void
encode (HOST_WIDE_INT *words, unsigned HOST_WIDE_INT low, HOST_WIDE_INT hi)
{
words[0] = LOWPART (low);
words[1] = HIGHPART (low);
words[2] = LOWPART (hi);
words[3] = HIGHPART (hi);
}
/* Pack an array of 4 words into a two-word integer.
WORDS points to the array of words.
The integer is stored into *LOW and *HI as two `HOST_WIDE_INT' pieces. */
static void
decode (HOST_WIDE_INT *words, unsigned HOST_WIDE_INT *low,
HOST_WIDE_INT *hi)
{
*low = words[0] + words[1] * BASE;
*hi = words[2] + words[3] * BASE;
}
/* Add two doubleword integers with doubleword result.
Return nonzero if the operation overflows according to UNSIGNED_P.
Each argument is given as two `HOST_WIDE_INT' pieces.
One argument is L1 and H1; the other, L2 and H2.
The value is stored as two `HOST_WIDE_INT' pieces in *LV and *HV. */
Finish conversion of uses of double_int to the new API. Some old functionality required new interfaces, and these have been added to double-int.[hc]: double_int::from_pair - static constructor function wide_mul_with_sign - double-wide multiply instruction sub_with_overflow - subtraction with overlow testing neg_with_overflow - negation with overlow testing divmod_with_overflow - div and mod with overlow testing This patch corrects the bootstrap problem on HPPA, via the addition of sub_with_overflow. (The overflow properties of negation and addition are different from subtraction.) The prior two generations of the interface have been removed. Some of these old interfaces are still used as static implementation in double-int.c. The changed compiler appears 0.321% faster with 80% confidence of being faster. Tested on x86_64, HPPA, and SPARC. However, there are changes to the avr config files, and I have not tested those. Index: gcc/java/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * decl.c (java_init_decl_processing): Change to new double_int API. * jcf-parse.c (get_constant): Likewise. * boehm.c (mark_reference_fields): Likewise. (get_boehm_type_descriptor): Likewise. Index: gcc/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::from_pair): New. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. (shwi_to_double_int): Remove. (uhwi_to_double_int): Remove. (double_int_to_shwi): Remove. (double_int_to_uhwi): Remove. (double_int_fits_in_uhwi_p): Remove. (double_int_fits_in_shwi_p): Remove. (double_int_fits_in_hwi_p): Remove. (double_int_mul): Remove. (double_int_mul_with_sign): Remove. (double_int_add): Remove. (double_int_sub): Remove. (double_int_neg): Remove. (double_int_div): Remove. (double_int_sdiv): Remove. (double_int_udiv): Remove. (double_int_mod): Remove. (double_int_smod): Remove. (double_int_umod): Remove. (double_int_divmod): Remove. (double_int_sdivmod): Remove. (double_int_udivmod): Remove. (double_int_multiple_of): Remove. (double_int_setbit): Remove. (double_int_ctz): Remove. (double_int_not): Remove. (double_int_ior): Remove. (double_int_and): Remove. (double_int_and_not): Remove. (double_int_xor): Remove. (double_int_lshift): Remove. (double_int_rshift): Remove. (double_int_lrotate): Remove. (double_int_rrotate): Remove. (double_int_negative_p): Remove. (double_int_cmp): Remove. (double_int_scmp): Remove. (double_int_ucmp): Remove. (double_int_max): Remove. (double_int_smax): Remove. (double_int_umax): Remove. (double_int_min): Remove. (double_int_smin): Remove. (double_int_umin): Remove. (double_int_ext): Remove. (double_int_sext): Remove. (double_int_zext): Remove. (double_int_mask): Remove. (double_int_max_value): Remove. (double_int_min_value): Remove. (double_int_zero_p): Remove. (double_int_one_p): Remove. (double_int_minus_one_p): Remove. (double_int_equal_p): Remove. (double_int_popcount): Remove. (extern add_double_with_sign): Remove. (#define add_double): Remove. (extern neg_double): Remove. (extern mul_double_with_sign): Remove. (extern mul_double_wide_with_sign): Remove. (#define mul_double): Remove. (extern lshift_double): Remove. (extern div_and_round_double): Remove. * double-int.c (add_double_with_sign): Make static. (#defined add_double): Localized from header. (neg_double): Make static. (mul_double_with_sign): Make static. (mul_double_wide_with_sign): Make static. (#defined mul_double): Localized from header. (lshift_double): Make static. (div_and_round_double): Make static. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. * emit-rtl.c (init_emit_once): Change to new double_int API. * explow.c (plus_constant): Likewise. * expmed.c (choose_multiplier): Likewise. * fold-const.c (#define OVERFLOW_SUM_SIGN): Remove. (int_const_binop_1): Change to new double_int API. (fold_div_compare): Likewise. (maybe_canonicalize_comparison): Likewise. (pointer_may_wrap_p): Likewise. (fold_negate_const): Likewise. (fold_abs_const): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_const_binary_operation): Likewise. * tree-chrec.c (tree_fold_binomial): Likewise. * tree-vrp.c (extract_range_from_binary_expr_1): Likewise. * config/sparc/sparc.c (sparc_fold_builtin): Likewise. * config/avr/avr.c (avr_double_int_push_digit): Likewise. (avr_map): Likewise. (avr_map_decompose): Likewise. (avr_out_insert_bits): Likewise. Index: gcc/cp/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * init.c (build_new_1): Change to new double_int API. * decl.c (build_enumerator): Likewise. * typeck2.c (process_init_constructor_array): Likewise. * mangle.c (write_array_type): Likewise. Index: gcc/fortran/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * trans-expr.c (gfc_conv_cst_int_power): Change to new double_int API. * target-memory.c (gfc_interpret_logical): Likewise. From-SVN: r191675
2012-09-24 20:22:31 +02:00
static int
add_double_with_sign (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
unsigned HOST_WIDE_INT l2, HOST_WIDE_INT h2,
unsigned HOST_WIDE_INT *lv, HOST_WIDE_INT *hv,
bool unsigned_p)
{
unsigned HOST_WIDE_INT l;
HOST_WIDE_INT h;
l = l1 + l2;
h = (HOST_WIDE_INT) ((unsigned HOST_WIDE_INT) h1
+ (unsigned HOST_WIDE_INT) h2
+ (l < l1));
*lv = l;
*hv = h;
if (unsigned_p)
return ((unsigned HOST_WIDE_INT) h < (unsigned HOST_WIDE_INT) h1
|| (h == h1
&& l < l1));
else
return OVERFLOW_SUM_SIGN (h1, h2, h);
}
/* Negate a doubleword integer with doubleword result.
Return nonzero if the operation overflows, assuming it's signed.
The argument is given as two `HOST_WIDE_INT' pieces in L1 and H1.
The value is stored as two `HOST_WIDE_INT' pieces in *LV and *HV. */
Finish conversion of uses of double_int to the new API. Some old functionality required new interfaces, and these have been added to double-int.[hc]: double_int::from_pair - static constructor function wide_mul_with_sign - double-wide multiply instruction sub_with_overflow - subtraction with overlow testing neg_with_overflow - negation with overlow testing divmod_with_overflow - div and mod with overlow testing This patch corrects the bootstrap problem on HPPA, via the addition of sub_with_overflow. (The overflow properties of negation and addition are different from subtraction.) The prior two generations of the interface have been removed. Some of these old interfaces are still used as static implementation in double-int.c. The changed compiler appears 0.321% faster with 80% confidence of being faster. Tested on x86_64, HPPA, and SPARC. However, there are changes to the avr config files, and I have not tested those. Index: gcc/java/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * decl.c (java_init_decl_processing): Change to new double_int API. * jcf-parse.c (get_constant): Likewise. * boehm.c (mark_reference_fields): Likewise. (get_boehm_type_descriptor): Likewise. Index: gcc/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::from_pair): New. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. (shwi_to_double_int): Remove. (uhwi_to_double_int): Remove. (double_int_to_shwi): Remove. (double_int_to_uhwi): Remove. (double_int_fits_in_uhwi_p): Remove. (double_int_fits_in_shwi_p): Remove. (double_int_fits_in_hwi_p): Remove. (double_int_mul): Remove. (double_int_mul_with_sign): Remove. (double_int_add): Remove. (double_int_sub): Remove. (double_int_neg): Remove. (double_int_div): Remove. (double_int_sdiv): Remove. (double_int_udiv): Remove. (double_int_mod): Remove. (double_int_smod): Remove. (double_int_umod): Remove. (double_int_divmod): Remove. (double_int_sdivmod): Remove. (double_int_udivmod): Remove. (double_int_multiple_of): Remove. (double_int_setbit): Remove. (double_int_ctz): Remove. (double_int_not): Remove. (double_int_ior): Remove. (double_int_and): Remove. (double_int_and_not): Remove. (double_int_xor): Remove. (double_int_lshift): Remove. (double_int_rshift): Remove. (double_int_lrotate): Remove. (double_int_rrotate): Remove. (double_int_negative_p): Remove. (double_int_cmp): Remove. (double_int_scmp): Remove. (double_int_ucmp): Remove. (double_int_max): Remove. (double_int_smax): Remove. (double_int_umax): Remove. (double_int_min): Remove. (double_int_smin): Remove. (double_int_umin): Remove. (double_int_ext): Remove. (double_int_sext): Remove. (double_int_zext): Remove. (double_int_mask): Remove. (double_int_max_value): Remove. (double_int_min_value): Remove. (double_int_zero_p): Remove. (double_int_one_p): Remove. (double_int_minus_one_p): Remove. (double_int_equal_p): Remove. (double_int_popcount): Remove. (extern add_double_with_sign): Remove. (#define add_double): Remove. (extern neg_double): Remove. (extern mul_double_with_sign): Remove. (extern mul_double_wide_with_sign): Remove. (#define mul_double): Remove. (extern lshift_double): Remove. (extern div_and_round_double): Remove. * double-int.c (add_double_with_sign): Make static. (#defined add_double): Localized from header. (neg_double): Make static. (mul_double_with_sign): Make static. (mul_double_wide_with_sign): Make static. (#defined mul_double): Localized from header. (lshift_double): Make static. (div_and_round_double): Make static. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. * emit-rtl.c (init_emit_once): Change to new double_int API. * explow.c (plus_constant): Likewise. * expmed.c (choose_multiplier): Likewise. * fold-const.c (#define OVERFLOW_SUM_SIGN): Remove. (int_const_binop_1): Change to new double_int API. (fold_div_compare): Likewise. (maybe_canonicalize_comparison): Likewise. (pointer_may_wrap_p): Likewise. (fold_negate_const): Likewise. (fold_abs_const): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_const_binary_operation): Likewise. * tree-chrec.c (tree_fold_binomial): Likewise. * tree-vrp.c (extract_range_from_binary_expr_1): Likewise. * config/sparc/sparc.c (sparc_fold_builtin): Likewise. * config/avr/avr.c (avr_double_int_push_digit): Likewise. (avr_map): Likewise. (avr_map_decompose): Likewise. (avr_out_insert_bits): Likewise. Index: gcc/cp/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * init.c (build_new_1): Change to new double_int API. * decl.c (build_enumerator): Likewise. * typeck2.c (process_init_constructor_array): Likewise. * mangle.c (write_array_type): Likewise. Index: gcc/fortran/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * trans-expr.c (gfc_conv_cst_int_power): Change to new double_int API. * target-memory.c (gfc_interpret_logical): Likewise. From-SVN: r191675
2012-09-24 20:22:31 +02:00
static int
neg_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
unsigned HOST_WIDE_INT *lv, HOST_WIDE_INT *hv)
{
if (l1 == 0)
{
*lv = 0;
*hv = - (unsigned HOST_WIDE_INT) h1;
return (*hv & h1) < 0;
}
else
{
*lv = -l1;
*hv = ~h1;
return 0;
}
}
/* Multiply two doubleword integers with quadword result.
Return nonzero if the operation overflows according to UNSIGNED_P.
Each argument is given as two `HOST_WIDE_INT' pieces.
One argument is L1 and H1; the other, L2 and H2.
The value is stored as four `HOST_WIDE_INT' pieces in *LV and *HV,
*LW and *HW.
If lw is NULL then only the low part and no overflow is computed. */
Finish conversion of uses of double_int to the new API. Some old functionality required new interfaces, and these have been added to double-int.[hc]: double_int::from_pair - static constructor function wide_mul_with_sign - double-wide multiply instruction sub_with_overflow - subtraction with overlow testing neg_with_overflow - negation with overlow testing divmod_with_overflow - div and mod with overlow testing This patch corrects the bootstrap problem on HPPA, via the addition of sub_with_overflow. (The overflow properties of negation and addition are different from subtraction.) The prior two generations of the interface have been removed. Some of these old interfaces are still used as static implementation in double-int.c. The changed compiler appears 0.321% faster with 80% confidence of being faster. Tested on x86_64, HPPA, and SPARC. However, there are changes to the avr config files, and I have not tested those. Index: gcc/java/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * decl.c (java_init_decl_processing): Change to new double_int API. * jcf-parse.c (get_constant): Likewise. * boehm.c (mark_reference_fields): Likewise. (get_boehm_type_descriptor): Likewise. Index: gcc/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::from_pair): New. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. (shwi_to_double_int): Remove. (uhwi_to_double_int): Remove. (double_int_to_shwi): Remove. (double_int_to_uhwi): Remove. (double_int_fits_in_uhwi_p): Remove. (double_int_fits_in_shwi_p): Remove. (double_int_fits_in_hwi_p): Remove. (double_int_mul): Remove. (double_int_mul_with_sign): Remove. (double_int_add): Remove. (double_int_sub): Remove. (double_int_neg): Remove. (double_int_div): Remove. (double_int_sdiv): Remove. (double_int_udiv): Remove. (double_int_mod): Remove. (double_int_smod): Remove. (double_int_umod): Remove. (double_int_divmod): Remove. (double_int_sdivmod): Remove. (double_int_udivmod): Remove. (double_int_multiple_of): Remove. (double_int_setbit): Remove. (double_int_ctz): Remove. (double_int_not): Remove. (double_int_ior): Remove. (double_int_and): Remove. (double_int_and_not): Remove. (double_int_xor): Remove. (double_int_lshift): Remove. (double_int_rshift): Remove. (double_int_lrotate): Remove. (double_int_rrotate): Remove. (double_int_negative_p): Remove. (double_int_cmp): Remove. (double_int_scmp): Remove. (double_int_ucmp): Remove. (double_int_max): Remove. (double_int_smax): Remove. (double_int_umax): Remove. (double_int_min): Remove. (double_int_smin): Remove. (double_int_umin): Remove. (double_int_ext): Remove. (double_int_sext): Remove. (double_int_zext): Remove. (double_int_mask): Remove. (double_int_max_value): Remove. (double_int_min_value): Remove. (double_int_zero_p): Remove. (double_int_one_p): Remove. (double_int_minus_one_p): Remove. (double_int_equal_p): Remove. (double_int_popcount): Remove. (extern add_double_with_sign): Remove. (#define add_double): Remove. (extern neg_double): Remove. (extern mul_double_with_sign): Remove. (extern mul_double_wide_with_sign): Remove. (#define mul_double): Remove. (extern lshift_double): Remove. (extern div_and_round_double): Remove. * double-int.c (add_double_with_sign): Make static. (#defined add_double): Localized from header. (neg_double): Make static. (mul_double_with_sign): Make static. (mul_double_wide_with_sign): Make static. (#defined mul_double): Localized from header. (lshift_double): Make static. (div_and_round_double): Make static. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. * emit-rtl.c (init_emit_once): Change to new double_int API. * explow.c (plus_constant): Likewise. * expmed.c (choose_multiplier): Likewise. * fold-const.c (#define OVERFLOW_SUM_SIGN): Remove. (int_const_binop_1): Change to new double_int API. (fold_div_compare): Likewise. (maybe_canonicalize_comparison): Likewise. (pointer_may_wrap_p): Likewise. (fold_negate_const): Likewise. (fold_abs_const): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_const_binary_operation): Likewise. * tree-chrec.c (tree_fold_binomial): Likewise. * tree-vrp.c (extract_range_from_binary_expr_1): Likewise. * config/sparc/sparc.c (sparc_fold_builtin): Likewise. * config/avr/avr.c (avr_double_int_push_digit): Likewise. (avr_map): Likewise. (avr_map_decompose): Likewise. (avr_out_insert_bits): Likewise. Index: gcc/cp/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * init.c (build_new_1): Change to new double_int API. * decl.c (build_enumerator): Likewise. * typeck2.c (process_init_constructor_array): Likewise. * mangle.c (write_array_type): Likewise. Index: gcc/fortran/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * trans-expr.c (gfc_conv_cst_int_power): Change to new double_int API. * target-memory.c (gfc_interpret_logical): Likewise. From-SVN: r191675
2012-09-24 20:22:31 +02:00
static int
mul_double_wide_with_sign (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
unsigned HOST_WIDE_INT l2, HOST_WIDE_INT h2,
unsigned HOST_WIDE_INT *lv, HOST_WIDE_INT *hv,
unsigned HOST_WIDE_INT *lw, HOST_WIDE_INT *hw,
bool unsigned_p)
{
HOST_WIDE_INT arg1[4];
HOST_WIDE_INT arg2[4];
HOST_WIDE_INT prod[4 * 2];
unsigned HOST_WIDE_INT carry;
int i, j, k;
unsigned HOST_WIDE_INT neglow;
HOST_WIDE_INT neghigh;
encode (arg1, l1, h1);
encode (arg2, l2, h2);
memset (prod, 0, sizeof prod);
for (i = 0; i < 4; i++)
{
carry = 0;
for (j = 0; j < 4; j++)
{
k = i + j;
/* This product is <= 0xFFFE0001, the sum <= 0xFFFF0000. */
carry += (unsigned HOST_WIDE_INT) arg1[i] * arg2[j];
/* Since prod[p] < 0xFFFF, this sum <= 0xFFFFFFFF. */
carry += prod[k];
prod[k] = LOWPART (carry);
carry = HIGHPART (carry);
}
prod[i + 4] = carry;
}
decode (prod, lv, hv);
/* We are not interested in the wide part nor in overflow. */
if (lw == NULL)
return 0;
decode (prod + 4, lw, hw);
/* Unsigned overflow is immediate. */
if (unsigned_p)
return (*lw | *hw) != 0;
/* Check for signed overflow by calculating the signed representation of the
top half of the result; it should agree with the low half's sign bit. */
if (h1 < 0)
{
neg_double (l2, h2, &neglow, &neghigh);
add_double (neglow, neghigh, *lw, *hw, lw, hw);
}
if (h2 < 0)
{
neg_double (l1, h1, &neglow, &neghigh);
add_double (neglow, neghigh, *lw, *hw, lw, hw);
}
return (*hv < 0 ? ~(*lw & *hw) : *lw | *hw) != 0;
}
/* Shift the doubleword integer in L1, H1 right by COUNT places
keeping only PREC bits of result. ARITH nonzero specifies
arithmetic shifting; otherwise use logical shift.
Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */
static void
rshift_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
unsigned HOST_WIDE_INT count, unsigned int prec,
unsigned HOST_WIDE_INT *lv, HOST_WIDE_INT *hv,
bool arith)
{
unsigned HOST_WIDE_INT signmask;
signmask = (arith
? -((unsigned HOST_WIDE_INT) h1 >> (HOST_BITS_PER_WIDE_INT - 1))
: 0);
2012-06-2 Kenneth Zadeck <zadeck@naturalbridge.com> * expmed.c (expand_mult, choose_multiplier): Change "2 * HOST_BITS_PER_WIDE_INT" to "HOST_BITS_PER_DOUBLE_INT". * expr.c (convert_modes): Likewise. * explow.c (plus_constant): Likewise. * fixed-value.c (fixed_saturate1, fixed_saturate2) (do_fixed_add, do_fixed_multiply, do_fixed_multiply) (do_fixed_multiply, do_fixed_multiply, do_fixed_divide) (do_fixed_divide, do_fixed_divide, do_fixed_divide) (do_fixed_divide, do_fixed_divide, do_fixed_shift, do_fixed_shift) (do_fixed_shift, fixed_convert, fixed_convert) (fixed_convert_from_int, fixed_convert_from_int) (fixed_convert_from_real): Likewise. * fold-const.c (fold_convert_const_int_from_fixed, sign_bit_p) (native_interpret_int, fold_binary_loc, fold_ternary_loc): Likewise. * varasm.c (output_constructor_bitfield): Likewise. * tree-vrp.c (register_edge_assert_for_2): Likewise. * double-int.c (rshift_double, lshift_double): Likewise. * double-int.h (double_int_fits_in_uhwi_p, double_int, double_int): Likewise. * simplify-rtx.c (mode_signbit_p) (simplify_const_unary_operation, simplify_binary_operation_1) (simplify_immed_subreg): Likewise. * builtins.c (c_readstr, fold_builtin_bitop): Likewise. * tree-vect-generic.c (build_replicated_const): Likewise. * dbxout.c (stabstr_O): Likewise. * emit-rtl.c (immed_double_int_const, immed_double_const) (gen_lowpart_common, init_emit_once): Likewise. * tree.c (integer_pow2p, tree_log2, tree_floor_log2) (widest_int_cst_value, upper_bound_in_type): Likewise. * stor-layout.c (initialize_sizetypes, fixup_signed_type) (fixup_unsigned_type): Likewise. * real.c (real_to_integer2, real_from_integer): Likewise. * dwarf2out.c (size_of_loc_descr, size_of_die, output_die) (clz_loc_descriptor, mem_loc_descriptor): Likewise. From-SVN: r188139
2012-06-02 18:08:39 +02:00
if (count >= HOST_BITS_PER_DOUBLE_INT)
{
/* Shifting by the host word size is undefined according to the
ANSI standard, so we must handle this as a special case. */
*hv = 0;
*lv = 0;
}
else if (count >= HOST_BITS_PER_WIDE_INT)
{
*hv = 0;
*lv = (unsigned HOST_WIDE_INT) h1 >> (count - HOST_BITS_PER_WIDE_INT);
}
else
{
*hv = (unsigned HOST_WIDE_INT) h1 >> count;
*lv = ((l1 >> count)
| ((unsigned HOST_WIDE_INT) h1
<< (HOST_BITS_PER_WIDE_INT - count - 1) << 1));
}
/* Zero / sign extend all bits that are beyond the precision. */
if (count >= prec)
{
*hv = signmask;
*lv = signmask;
}
2012-06-2 Kenneth Zadeck <zadeck@naturalbridge.com> * expmed.c (expand_mult, choose_multiplier): Change "2 * HOST_BITS_PER_WIDE_INT" to "HOST_BITS_PER_DOUBLE_INT". * expr.c (convert_modes): Likewise. * explow.c (plus_constant): Likewise. * fixed-value.c (fixed_saturate1, fixed_saturate2) (do_fixed_add, do_fixed_multiply, do_fixed_multiply) (do_fixed_multiply, do_fixed_multiply, do_fixed_divide) (do_fixed_divide, do_fixed_divide, do_fixed_divide) (do_fixed_divide, do_fixed_divide, do_fixed_shift, do_fixed_shift) (do_fixed_shift, fixed_convert, fixed_convert) (fixed_convert_from_int, fixed_convert_from_int) (fixed_convert_from_real): Likewise. * fold-const.c (fold_convert_const_int_from_fixed, sign_bit_p) (native_interpret_int, fold_binary_loc, fold_ternary_loc): Likewise. * varasm.c (output_constructor_bitfield): Likewise. * tree-vrp.c (register_edge_assert_for_2): Likewise. * double-int.c (rshift_double, lshift_double): Likewise. * double-int.h (double_int_fits_in_uhwi_p, double_int, double_int): Likewise. * simplify-rtx.c (mode_signbit_p) (simplify_const_unary_operation, simplify_binary_operation_1) (simplify_immed_subreg): Likewise. * builtins.c (c_readstr, fold_builtin_bitop): Likewise. * tree-vect-generic.c (build_replicated_const): Likewise. * dbxout.c (stabstr_O): Likewise. * emit-rtl.c (immed_double_int_const, immed_double_const) (gen_lowpart_common, init_emit_once): Likewise. * tree.c (integer_pow2p, tree_log2, tree_floor_log2) (widest_int_cst_value, upper_bound_in_type): Likewise. * stor-layout.c (initialize_sizetypes, fixup_signed_type) (fixup_unsigned_type): Likewise. * real.c (real_to_integer2, real_from_integer): Likewise. * dwarf2out.c (size_of_loc_descr, size_of_die, output_die) (clz_loc_descriptor, mem_loc_descriptor): Likewise. From-SVN: r188139
2012-06-02 18:08:39 +02:00
else if ((prec - count) >= HOST_BITS_PER_DOUBLE_INT)
;
else if ((prec - count) >= HOST_BITS_PER_WIDE_INT)
{
*hv &= ~(HOST_WIDE_INT_M1U << (prec - count - HOST_BITS_PER_WIDE_INT));
*hv |= signmask << (prec - count - HOST_BITS_PER_WIDE_INT);
}
else
{
*hv = signmask;
*lv &= ~(HOST_WIDE_INT_M1U << (prec - count));
*lv |= signmask << (prec - count);
}
}
/* Shift the doubleword integer in L1, H1 left by COUNT places
keeping only PREC bits of result.
Shift right if COUNT is negative.
ARITH nonzero specifies arithmetic shifting; otherwise use logical shift.
Store the value as two `HOST_WIDE_INT' pieces in *LV and *HV. */
Finish conversion of uses of double_int to the new API. Some old functionality required new interfaces, and these have been added to double-int.[hc]: double_int::from_pair - static constructor function wide_mul_with_sign - double-wide multiply instruction sub_with_overflow - subtraction with overlow testing neg_with_overflow - negation with overlow testing divmod_with_overflow - div and mod with overlow testing This patch corrects the bootstrap problem on HPPA, via the addition of sub_with_overflow. (The overflow properties of negation and addition are different from subtraction.) The prior two generations of the interface have been removed. Some of these old interfaces are still used as static implementation in double-int.c. The changed compiler appears 0.321% faster with 80% confidence of being faster. Tested on x86_64, HPPA, and SPARC. However, there are changes to the avr config files, and I have not tested those. Index: gcc/java/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * decl.c (java_init_decl_processing): Change to new double_int API. * jcf-parse.c (get_constant): Likewise. * boehm.c (mark_reference_fields): Likewise. (get_boehm_type_descriptor): Likewise. Index: gcc/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::from_pair): New. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. (shwi_to_double_int): Remove. (uhwi_to_double_int): Remove. (double_int_to_shwi): Remove. (double_int_to_uhwi): Remove. (double_int_fits_in_uhwi_p): Remove. (double_int_fits_in_shwi_p): Remove. (double_int_fits_in_hwi_p): Remove. (double_int_mul): Remove. (double_int_mul_with_sign): Remove. (double_int_add): Remove. (double_int_sub): Remove. (double_int_neg): Remove. (double_int_div): Remove. (double_int_sdiv): Remove. (double_int_udiv): Remove. (double_int_mod): Remove. (double_int_smod): Remove. (double_int_umod): Remove. (double_int_divmod): Remove. (double_int_sdivmod): Remove. (double_int_udivmod): Remove. (double_int_multiple_of): Remove. (double_int_setbit): Remove. (double_int_ctz): Remove. (double_int_not): Remove. (double_int_ior): Remove. (double_int_and): Remove. (double_int_and_not): Remove. (double_int_xor): Remove. (double_int_lshift): Remove. (double_int_rshift): Remove. (double_int_lrotate): Remove. (double_int_rrotate): Remove. (double_int_negative_p): Remove. (double_int_cmp): Remove. (double_int_scmp): Remove. (double_int_ucmp): Remove. (double_int_max): Remove. (double_int_smax): Remove. (double_int_umax): Remove. (double_int_min): Remove. (double_int_smin): Remove. (double_int_umin): Remove. (double_int_ext): Remove. (double_int_sext): Remove. (double_int_zext): Remove. (double_int_mask): Remove. (double_int_max_value): Remove. (double_int_min_value): Remove. (double_int_zero_p): Remove. (double_int_one_p): Remove. (double_int_minus_one_p): Remove. (double_int_equal_p): Remove. (double_int_popcount): Remove. (extern add_double_with_sign): Remove. (#define add_double): Remove. (extern neg_double): Remove. (extern mul_double_with_sign): Remove. (extern mul_double_wide_with_sign): Remove. (#define mul_double): Remove. (extern lshift_double): Remove. (extern div_and_round_double): Remove. * double-int.c (add_double_with_sign): Make static. (#defined add_double): Localized from header. (neg_double): Make static. (mul_double_with_sign): Make static. (mul_double_wide_with_sign): Make static. (#defined mul_double): Localized from header. (lshift_double): Make static. (div_and_round_double): Make static. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. * emit-rtl.c (init_emit_once): Change to new double_int API. * explow.c (plus_constant): Likewise. * expmed.c (choose_multiplier): Likewise. * fold-const.c (#define OVERFLOW_SUM_SIGN): Remove. (int_const_binop_1): Change to new double_int API. (fold_div_compare): Likewise. (maybe_canonicalize_comparison): Likewise. (pointer_may_wrap_p): Likewise. (fold_negate_const): Likewise. (fold_abs_const): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_const_binary_operation): Likewise. * tree-chrec.c (tree_fold_binomial): Likewise. * tree-vrp.c (extract_range_from_binary_expr_1): Likewise. * config/sparc/sparc.c (sparc_fold_builtin): Likewise. * config/avr/avr.c (avr_double_int_push_digit): Likewise. (avr_map): Likewise. (avr_map_decompose): Likewise. (avr_out_insert_bits): Likewise. Index: gcc/cp/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * init.c (build_new_1): Change to new double_int API. * decl.c (build_enumerator): Likewise. * typeck2.c (process_init_constructor_array): Likewise. * mangle.c (write_array_type): Likewise. Index: gcc/fortran/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * trans-expr.c (gfc_conv_cst_int_power): Change to new double_int API. * target-memory.c (gfc_interpret_logical): Likewise. From-SVN: r191675
2012-09-24 20:22:31 +02:00
static void
lshift_double (unsigned HOST_WIDE_INT l1, HOST_WIDE_INT h1,
unsigned HOST_WIDE_INT count, unsigned int prec,
unsigned HOST_WIDE_INT *lv, HOST_WIDE_INT *hv)
{
unsigned HOST_WIDE_INT signmask;
2012-06-2 Kenneth Zadeck <zadeck@naturalbridge.com> * expmed.c (expand_mult, choose_multiplier): Change "2 * HOST_BITS_PER_WIDE_INT" to "HOST_BITS_PER_DOUBLE_INT". * expr.c (convert_modes): Likewise. * explow.c (plus_constant): Likewise. * fixed-value.c (fixed_saturate1, fixed_saturate2) (do_fixed_add, do_fixed_multiply, do_fixed_multiply) (do_fixed_multiply, do_fixed_multiply, do_fixed_divide) (do_fixed_divide, do_fixed_divide, do_fixed_divide) (do_fixed_divide, do_fixed_divide, do_fixed_shift, do_fixed_shift) (do_fixed_shift, fixed_convert, fixed_convert) (fixed_convert_from_int, fixed_convert_from_int) (fixed_convert_from_real): Likewise. * fold-const.c (fold_convert_const_int_from_fixed, sign_bit_p) (native_interpret_int, fold_binary_loc, fold_ternary_loc): Likewise. * varasm.c (output_constructor_bitfield): Likewise. * tree-vrp.c (register_edge_assert_for_2): Likewise. * double-int.c (rshift_double, lshift_double): Likewise. * double-int.h (double_int_fits_in_uhwi_p, double_int, double_int): Likewise. * simplify-rtx.c (mode_signbit_p) (simplify_const_unary_operation, simplify_binary_operation_1) (simplify_immed_subreg): Likewise. * builtins.c (c_readstr, fold_builtin_bitop): Likewise. * tree-vect-generic.c (build_replicated_const): Likewise. * dbxout.c (stabstr_O): Likewise. * emit-rtl.c (immed_double_int_const, immed_double_const) (gen_lowpart_common, init_emit_once): Likewise. * tree.c (integer_pow2p, tree_log2, tree_floor_log2) (widest_int_cst_value, upper_bound_in_type): Likewise. * stor-layout.c (initialize_sizetypes, fixup_signed_type) (fixup_unsigned_type): Likewise. * real.c (real_to_integer2, real_from_integer): Likewise. * dwarf2out.c (size_of_loc_descr, size_of_die, output_die) (clz_loc_descriptor, mem_loc_descriptor): Likewise. From-SVN: r188139
2012-06-02 18:08:39 +02:00
if (count >= HOST_BITS_PER_DOUBLE_INT)
{
/* Shifting by the host word size is undefined according to the
ANSI standard, so we must handle this as a special case. */
*hv = 0;
*lv = 0;
}
else if (count >= HOST_BITS_PER_WIDE_INT)
{
*hv = l1 << (count - HOST_BITS_PER_WIDE_INT);
*lv = 0;
}
else
{
*hv = (((unsigned HOST_WIDE_INT) h1 << count)
| (l1 >> (HOST_BITS_PER_WIDE_INT - count - 1) >> 1));
*lv = l1 << count;
}
/* Sign extend all bits that are beyond the precision. */
signmask = -((prec > HOST_BITS_PER_WIDE_INT
? ((unsigned HOST_WIDE_INT) *hv
>> (prec - HOST_BITS_PER_WIDE_INT - 1))
: (*lv >> (prec - 1))) & 1);
2012-06-2 Kenneth Zadeck <zadeck@naturalbridge.com> * expmed.c (expand_mult, choose_multiplier): Change "2 * HOST_BITS_PER_WIDE_INT" to "HOST_BITS_PER_DOUBLE_INT". * expr.c (convert_modes): Likewise. * explow.c (plus_constant): Likewise. * fixed-value.c (fixed_saturate1, fixed_saturate2) (do_fixed_add, do_fixed_multiply, do_fixed_multiply) (do_fixed_multiply, do_fixed_multiply, do_fixed_divide) (do_fixed_divide, do_fixed_divide, do_fixed_divide) (do_fixed_divide, do_fixed_divide, do_fixed_shift, do_fixed_shift) (do_fixed_shift, fixed_convert, fixed_convert) (fixed_convert_from_int, fixed_convert_from_int) (fixed_convert_from_real): Likewise. * fold-const.c (fold_convert_const_int_from_fixed, sign_bit_p) (native_interpret_int, fold_binary_loc, fold_ternary_loc): Likewise. * varasm.c (output_constructor_bitfield): Likewise. * tree-vrp.c (register_edge_assert_for_2): Likewise. * double-int.c (rshift_double, lshift_double): Likewise. * double-int.h (double_int_fits_in_uhwi_p, double_int, double_int): Likewise. * simplify-rtx.c (mode_signbit_p) (simplify_const_unary_operation, simplify_binary_operation_1) (simplify_immed_subreg): Likewise. * builtins.c (c_readstr, fold_builtin_bitop): Likewise. * tree-vect-generic.c (build_replicated_const): Likewise. * dbxout.c (stabstr_O): Likewise. * emit-rtl.c (immed_double_int_const, immed_double_const) (gen_lowpart_common, init_emit_once): Likewise. * tree.c (integer_pow2p, tree_log2, tree_floor_log2) (widest_int_cst_value, upper_bound_in_type): Likewise. * stor-layout.c (initialize_sizetypes, fixup_signed_type) (fixup_unsigned_type): Likewise. * real.c (real_to_integer2, real_from_integer): Likewise. * dwarf2out.c (size_of_loc_descr, size_of_die, output_die) (clz_loc_descriptor, mem_loc_descriptor): Likewise. From-SVN: r188139
2012-06-02 18:08:39 +02:00
if (prec >= HOST_BITS_PER_DOUBLE_INT)
;
else if (prec >= HOST_BITS_PER_WIDE_INT)
{
*hv &= ~(HOST_WIDE_INT_M1U << (prec - HOST_BITS_PER_WIDE_INT));
*hv |= signmask << (prec - HOST_BITS_PER_WIDE_INT);
}
else
{
*hv = signmask;
*lv &= ~(HOST_WIDE_INT_M1U << prec);
*lv |= signmask << prec;
}
}
/* Divide doubleword integer LNUM, HNUM by doubleword integer LDEN, HDEN
for a quotient (stored in *LQUO, *HQUO) and remainder (in *LREM, *HREM).
CODE is a tree code for a kind of division, one of
TRUNC_DIV_EXPR, FLOOR_DIV_EXPR, CEIL_DIV_EXPR, ROUND_DIV_EXPR
or EXACT_DIV_EXPR
It controls how the quotient is rounded to an integer.
Return nonzero if the operation overflows.
UNS nonzero says do unsigned division. */
Finish conversion of uses of double_int to the new API. Some old functionality required new interfaces, and these have been added to double-int.[hc]: double_int::from_pair - static constructor function wide_mul_with_sign - double-wide multiply instruction sub_with_overflow - subtraction with overlow testing neg_with_overflow - negation with overlow testing divmod_with_overflow - div and mod with overlow testing This patch corrects the bootstrap problem on HPPA, via the addition of sub_with_overflow. (The overflow properties of negation and addition are different from subtraction.) The prior two generations of the interface have been removed. Some of these old interfaces are still used as static implementation in double-int.c. The changed compiler appears 0.321% faster with 80% confidence of being faster. Tested on x86_64, HPPA, and SPARC. However, there are changes to the avr config files, and I have not tested those. Index: gcc/java/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * decl.c (java_init_decl_processing): Change to new double_int API. * jcf-parse.c (get_constant): Likewise. * boehm.c (mark_reference_fields): Likewise. (get_boehm_type_descriptor): Likewise. Index: gcc/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::from_pair): New. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. (shwi_to_double_int): Remove. (uhwi_to_double_int): Remove. (double_int_to_shwi): Remove. (double_int_to_uhwi): Remove. (double_int_fits_in_uhwi_p): Remove. (double_int_fits_in_shwi_p): Remove. (double_int_fits_in_hwi_p): Remove. (double_int_mul): Remove. (double_int_mul_with_sign): Remove. (double_int_add): Remove. (double_int_sub): Remove. (double_int_neg): Remove. (double_int_div): Remove. (double_int_sdiv): Remove. (double_int_udiv): Remove. (double_int_mod): Remove. (double_int_smod): Remove. (double_int_umod): Remove. (double_int_divmod): Remove. (double_int_sdivmod): Remove. (double_int_udivmod): Remove. (double_int_multiple_of): Remove. (double_int_setbit): Remove. (double_int_ctz): Remove. (double_int_not): Remove. (double_int_ior): Remove. (double_int_and): Remove. (double_int_and_not): Remove. (double_int_xor): Remove. (double_int_lshift): Remove. (double_int_rshift): Remove. (double_int_lrotate): Remove. (double_int_rrotate): Remove. (double_int_negative_p): Remove. (double_int_cmp): Remove. (double_int_scmp): Remove. (double_int_ucmp): Remove. (double_int_max): Remove. (double_int_smax): Remove. (double_int_umax): Remove. (double_int_min): Remove. (double_int_smin): Remove. (double_int_umin): Remove. (double_int_ext): Remove. (double_int_sext): Remove. (double_int_zext): Remove. (double_int_mask): Remove. (double_int_max_value): Remove. (double_int_min_value): Remove. (double_int_zero_p): Remove. (double_int_one_p): Remove. (double_int_minus_one_p): Remove. (double_int_equal_p): Remove. (double_int_popcount): Remove. (extern add_double_with_sign): Remove. (#define add_double): Remove. (extern neg_double): Remove. (extern mul_double_with_sign): Remove. (extern mul_double_wide_with_sign): Remove. (#define mul_double): Remove. (extern lshift_double): Remove. (extern div_and_round_double): Remove. * double-int.c (add_double_with_sign): Make static. (#defined add_double): Localized from header. (neg_double): Make static. (mul_double_with_sign): Make static. (mul_double_wide_with_sign): Make static. (#defined mul_double): Localized from header. (lshift_double): Make static. (div_and_round_double): Make static. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. * emit-rtl.c (init_emit_once): Change to new double_int API. * explow.c (plus_constant): Likewise. * expmed.c (choose_multiplier): Likewise. * fold-const.c (#define OVERFLOW_SUM_SIGN): Remove. (int_const_binop_1): Change to new double_int API. (fold_div_compare): Likewise. (maybe_canonicalize_comparison): Likewise. (pointer_may_wrap_p): Likewise. (fold_negate_const): Likewise. (fold_abs_const): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_const_binary_operation): Likewise. * tree-chrec.c (tree_fold_binomial): Likewise. * tree-vrp.c (extract_range_from_binary_expr_1): Likewise. * config/sparc/sparc.c (sparc_fold_builtin): Likewise. * config/avr/avr.c (avr_double_int_push_digit): Likewise. (avr_map): Likewise. (avr_map_decompose): Likewise. (avr_out_insert_bits): Likewise. Index: gcc/cp/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * init.c (build_new_1): Change to new double_int API. * decl.c (build_enumerator): Likewise. * typeck2.c (process_init_constructor_array): Likewise. * mangle.c (write_array_type): Likewise. Index: gcc/fortran/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * trans-expr.c (gfc_conv_cst_int_power): Change to new double_int API. * target-memory.c (gfc_interpret_logical): Likewise. From-SVN: r191675
2012-09-24 20:22:31 +02:00
static int
div_and_round_double (unsigned code, int uns,
/* num == numerator == dividend */
unsigned HOST_WIDE_INT lnum_orig,
HOST_WIDE_INT hnum_orig,
/* den == denominator == divisor */
unsigned HOST_WIDE_INT lden_orig,
HOST_WIDE_INT hden_orig,
unsigned HOST_WIDE_INT *lquo,
HOST_WIDE_INT *hquo, unsigned HOST_WIDE_INT *lrem,
HOST_WIDE_INT *hrem)
{
int quo_neg = 0;
HOST_WIDE_INT num[4 + 1]; /* extra element for scaling. */
HOST_WIDE_INT den[4], quo[4];
int i, j;
unsigned HOST_WIDE_INT work;
unsigned HOST_WIDE_INT carry = 0;
unsigned HOST_WIDE_INT lnum = lnum_orig;
HOST_WIDE_INT hnum = hnum_orig;
unsigned HOST_WIDE_INT lden = lden_orig;
HOST_WIDE_INT hden = hden_orig;
int overflow = 0;
if (hden == 0 && lden == 0)
overflow = 1, lden = 1;
/* Calculate quotient sign and convert operands to unsigned. */
if (!uns)
{
if (hnum < 0)
{
quo_neg = ~ quo_neg;
/* (minimum integer) / (-1) is the only overflow case. */
if (neg_double (lnum, hnum, &lnum, &hnum)
&& ((HOST_WIDE_INT) lden & hden) == -1)
overflow = 1;
}
if (hden < 0)
{
quo_neg = ~ quo_neg;
neg_double (lden, hden, &lden, &hden);
}
}
if (hnum == 0 && hden == 0)
{ /* single precision */
*hquo = *hrem = 0;
/* This unsigned division rounds toward zero. */
*lquo = lnum / lden;
goto finish_up;
}
if (hnum == 0)
{ /* trivial case: dividend < divisor */
/* hden != 0 already checked. */
*hquo = *lquo = 0;
*hrem = hnum;
*lrem = lnum;
goto finish_up;
}
memset (quo, 0, sizeof quo);
memset (num, 0, sizeof num); /* to zero 9th element */
memset (den, 0, sizeof den);
encode (num, lnum, hnum);
encode (den, lden, hden);
/* Special code for when the divisor < BASE. */
if (hden == 0 && lden < (unsigned HOST_WIDE_INT) BASE)
{
/* hnum != 0 already checked. */
for (i = 4 - 1; i >= 0; i--)
{
work = num[i] + carry * BASE;
quo[i] = work / lden;
carry = work % lden;
}
}
else
{
/* Full double precision division,
with thanks to Don Knuth's "Seminumerical Algorithms". */
int num_hi_sig, den_hi_sig;
unsigned HOST_WIDE_INT quo_est, scale;
/* Find the highest nonzero divisor digit. */
for (i = 4 - 1;; i--)
if (den[i] != 0)
{
den_hi_sig = i;
break;
}
/* Insure that the first digit of the divisor is at least BASE/2.
This is required by the quotient digit estimation algorithm. */
scale = BASE / (den[den_hi_sig] + 1);
if (scale > 1)
{ /* scale divisor and dividend */
carry = 0;
for (i = 0; i <= 4 - 1; i++)
{
work = (num[i] * scale) + carry;
num[i] = LOWPART (work);
carry = HIGHPART (work);
}
num[4] = carry;
carry = 0;
for (i = 0; i <= 4 - 1; i++)
{
work = (den[i] * scale) + carry;
den[i] = LOWPART (work);
carry = HIGHPART (work);
if (den[i] != 0) den_hi_sig = i;
}
}
num_hi_sig = 4;
/* Main loop */
for (i = num_hi_sig - den_hi_sig - 1; i >= 0; i--)
{
/* Guess the next quotient digit, quo_est, by dividing the first
two remaining dividend digits by the high order quotient digit.
quo_est is never low and is at most 2 high. */
unsigned HOST_WIDE_INT tmp;
num_hi_sig = i + den_hi_sig + 1;
work = num[num_hi_sig] * BASE + num[num_hi_sig - 1];
if (num[num_hi_sig] != den[den_hi_sig])
quo_est = work / den[den_hi_sig];
else
quo_est = BASE - 1;
/* Refine quo_est so it's usually correct, and at most one high. */
tmp = work - quo_est * den[den_hi_sig];
if (tmp < BASE
&& (den[den_hi_sig - 1] * quo_est
> (tmp * BASE + num[num_hi_sig - 2])))
quo_est--;
/* Try QUO_EST as the quotient digit, by multiplying the
divisor by QUO_EST and subtracting from the remaining dividend.
Keep in mind that QUO_EST is the I - 1st digit. */
carry = 0;
for (j = 0; j <= den_hi_sig; j++)
{
work = quo_est * den[j] + carry;
carry = HIGHPART (work);
work = num[i + j] - LOWPART (work);
num[i + j] = LOWPART (work);
carry += HIGHPART (work) != 0;
}
/* If quo_est was high by one, then num[i] went negative and
we need to correct things. */
if (num[num_hi_sig] < (HOST_WIDE_INT) carry)
{
quo_est--;
carry = 0; /* add divisor back in */
for (j = 0; j <= den_hi_sig; j++)
{
work = num[i + j] + den[j] + carry;
carry = HIGHPART (work);
num[i + j] = LOWPART (work);
}
num [num_hi_sig] += carry;
}
/* Store the quotient digit. */
quo[i] = quo_est;
}
}
decode (quo, lquo, hquo);
finish_up:
/* If result is negative, make it so. */
if (quo_neg)
neg_double (*lquo, *hquo, lquo, hquo);
/* Compute trial remainder: rem = num - (quo * den) */
mul_double (*lquo, *hquo, lden_orig, hden_orig, lrem, hrem);
neg_double (*lrem, *hrem, lrem, hrem);
add_double (lnum_orig, hnum_orig, *lrem, *hrem, lrem, hrem);
switch (code)
{
case TRUNC_DIV_EXPR:
case TRUNC_MOD_EXPR: /* round toward zero */
case EXACT_DIV_EXPR: /* for this one, it shouldn't matter */
return overflow;
case FLOOR_DIV_EXPR:
case FLOOR_MOD_EXPR: /* round toward negative infinity */
if (quo_neg && (*lrem != 0 || *hrem != 0)) /* ratio < 0 && rem != 0 */
{
/* quo = quo - 1; */
add_double (*lquo, *hquo, HOST_WIDE_INT_M1, HOST_WIDE_INT_M1,
lquo, hquo);
}
else
return overflow;
break;
case CEIL_DIV_EXPR:
case CEIL_MOD_EXPR: /* round toward positive infinity */
if (!quo_neg && (*lrem != 0 || *hrem != 0)) /* ratio > 0 && rem != 0 */
{
add_double (*lquo, *hquo, HOST_WIDE_INT_1, HOST_WIDE_INT_0,
lquo, hquo);
}
else
return overflow;
break;
case ROUND_DIV_EXPR:
case ROUND_MOD_EXPR: /* round to closest integer */
{
unsigned HOST_WIDE_INT labs_rem = *lrem;
HOST_WIDE_INT habs_rem = *hrem;
unsigned HOST_WIDE_INT labs_den = lden, lnegabs_rem, ldiff;
HOST_WIDE_INT habs_den = hden, hnegabs_rem, hdiff;
/* Get absolute values. */
if (!uns && *hrem < 0)
neg_double (*lrem, *hrem, &labs_rem, &habs_rem);
if (!uns && hden < 0)
neg_double (lden, hden, &labs_den, &habs_den);
/* If abs(rem) >= abs(den) - abs(rem), adjust the quotient. */
neg_double (labs_rem, habs_rem, &lnegabs_rem, &hnegabs_rem);
add_double (labs_den, habs_den, lnegabs_rem, hnegabs_rem,
&ldiff, &hdiff);
if (((unsigned HOST_WIDE_INT) habs_rem
> (unsigned HOST_WIDE_INT) hdiff)
|| (habs_rem == hdiff && labs_rem >= ldiff))
{
if (quo_neg)
/* quo = quo - 1; */
add_double (*lquo, *hquo,
HOST_WIDE_INT_M1, HOST_WIDE_INT_M1, lquo, hquo);
else
/* quo = quo + 1; */
add_double (*lquo, *hquo, HOST_WIDE_INT_1, HOST_WIDE_INT_0,
lquo, hquo);
}
else
return overflow;
}
break;
default:
gcc_unreachable ();
}
/* Compute true remainder: rem = num - (quo * den) */
mul_double (*lquo, *hquo, lden_orig, hden_orig, lrem, hrem);
neg_double (*lrem, *hrem, lrem, hrem);
add_double (lnum_orig, hnum_orig, *lrem, *hrem, lrem, hrem);
return overflow;
}
/* Construct from a buffer of length LEN. BUFFER will be read according
re PR translation/79019 (translatable string typo in cif-code.def:141) PR translation/79019 PR translation/79020 * params.def (PARAM_INLINE_MIN_SPEEDUP, PARAM_IPA_CP_SINGLE_CALL_PENALTY, PARAM_USE_AFTER_SCOPE_DIRECT_EMISSION_THRESHOLD): Fix typos in descriptions. * config/avr/avr.opt (maccumulate-args): Likewise. * config/msp430/msp430.opt (mwarn-mcu): Likewise. * common.opt (freport-bug): Likewise. * cif-code.def (CIF_FINAL_ERROR): Likewise. * doc/invoke.texi (ipa-cp-single-call-penalty): Likewise. * config/s390/s390.c (s390_invalid_binary_op): Fix spelling in translatable string. * config/i386/i386.c (function_value_32): Likewise. * config/nios2/nios2.c (nios2_valid_target_attribute_rec): Likewise. * config/msp430/msp430.c (msp430_option_override, msp430_attr): Likewise. * config/msp430/driver-msp430.c (msp430_select_hwmult_lib): Likewise. * common/config/msp430/msp430-common.c (msp430_handle_option): Likewise. * symtab.c (symtab_node::verify_base): Likewise. * opts.c (set_debug_level): Likewise. * tree.c (verify_type_variant): Likewise. Fix typo in comment. * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Add missing whitespace to translatable strings. * config/avr/avr.md (bswapsi2): Fix typo in comment. * config/sh/superh.h: Likewise. * config/i386/xopintrin.h: Likewise. * config/i386/znver1.md: Likewise. * config/rs6000/rs6000.c (struct rs6000_opt_mask): Likewise. * ipa-inline-analysis.c (compute_inline_parameters): Likewise. * double-int.h (struct double_int): Likewise. * double-int.c (div_and_round_double): Likewise. * wide-int.cc: Likewise. * tree-ssa.c (non_rewritable_mem_ref_base): Likewise. * tree-ssa-sccvn.c (vn_reference_lookup_3): Likewise. * cfgcleanup.c (crossjumps_occured): Renamed to ... (crossjumps_occurred): ... this. (try_crossjump_bb, try_head_merge_bb, try_optimize_cfg, cleanup_cfg): Adjust all uses. cp/ * semantics.c (finish_omp_clauses): Add missing whitespace to translatable strings. * cp-cilkplus.c (cpp_validate_cilk_plus_loop_aux): Fix comment typo. lto/ * lto-symtab.c (lto_symtab_merge_symbols): Fix comment typo. fortran/ * decl.c (attr_decl1): Fix spelling in translatable string. * intrinsic.texi: Fix spelling - invokation -> invocation. * lang.opt (faggressive-function-elimination, gfc_convert): Fix typos in descriptions. * openmp.c (resolve_omp_clauses): Add missing whitespace to translatable strings. c-family/ * c.opt (Wnormalized=): Fix typo in description. testsuite/ * c-c++-common/goacc/host_data-2.c (f): Adjust expected spelling of diagnostics. * gfortran.dg/initialization_17.f90: Likewise. From-SVN: r244245
2017-01-09 22:48:33 +01:00
to byte endianness and word endianness. Only the lower LEN bytes
of the result are set; the remaining high bytes are cleared. */
double_int
double_int::from_buffer (const unsigned char *buffer, int len)
{
double_int result = double_int_zero;
int words = len / UNITS_PER_WORD;
gcc_assert (len * BITS_PER_UNIT <= HOST_BITS_PER_DOUBLE_INT);
for (int byte = 0; byte < len; byte++)
{
int offset;
int bitpos = byte * BITS_PER_UNIT;
unsigned HOST_WIDE_INT value;
if (len > UNITS_PER_WORD)
{
int word = byte / UNITS_PER_WORD;
if (WORDS_BIG_ENDIAN)
word = (words - 1) - word;
offset = word * UNITS_PER_WORD;
if (BYTES_BIG_ENDIAN)
offset += (UNITS_PER_WORD - 1) - (byte % UNITS_PER_WORD);
else
offset += byte % UNITS_PER_WORD;
}
else
offset = BYTES_BIG_ENDIAN ? (len - 1) - byte : byte;
value = (unsigned HOST_WIDE_INT) buffer[offset];
if (bitpos < HOST_BITS_PER_WIDE_INT)
result.low |= value << bitpos;
else
result.high |= value << (bitpos - HOST_BITS_PER_WIDE_INT);
}
return result;
}
/* Returns mask for PREC bits. */
re PR tree-optimization/30730 (-Wunsafe-loop-optimizations gives too many warnings) PR tree-optimization/30730 PR tree-optimization/26900 * tree-ssa-loop-niter.c: Include gmp.h. (bounds): New type. (mpz_set_double_int, get_type_bounds, mpz_to_double_int, split_to_var_and_offset, determine_value_range, bound_difference_of_offsetted_base, refine_bounds_using_guard, bound_difference, bounds_add, bounds_negate, number_of_iterations_ne_max, dump_affine_iv): New functions. (number_of_iterations_ne, number_of_iterations_lt_to_ne, assert_loop_rolls_lt, assert_loop_rolls_le): Use bounds on the difference of initial and final value of control iv to validate results. (number_of_iterations_cond): Add loop parameter. Determine bounds on the difference of the extremes of the control iv. Add dumps. (expand_simple_operations): Handle phi nodes. (simplify_using_initial_conditions): Do not record used conditions. (number_of_iterations_exit): Pass loop to number_of_iterations_cond. Do not set additional_info. (implies_nonnegative_p, implies_ge_p): Removed. (derive_constant_upper_bound): Do not use parameter `additional'. (record_estimate): Parameter `additional' removed. Parameter `i_bound' added. Do not call derive_constant_upper_bound. (record_nonwrapping_iv): Use derive_constant_upper_bound to bound the number of iterations estimate. (estimate_numbers_of_iterations_loop): Pass the estimate from the number of iterations analysis to record_estimate. * tree.h (multiple_of_p): Declare. * tree-scalar-evolution.c (expression_expensive_p): Removed. (scev_const_prop): Do not check expression_expensive_p. * fold-const.c (multiple_of_p): Exported. * double-int.c (double_int_mask): Exported. * double-int.h (double_int_mask): Declare. * tree-flow.h (struct tree_niter_desc): Removed additional_info field. Added max field. * gcc.dg/tree-ssa/loop-26.c: New test. From-SVN: r122896
2007-03-14 01:38:34 +01:00
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::mask (unsigned prec)
{
unsigned HOST_WIDE_INT m;
double_int mask;
if (prec > HOST_BITS_PER_WIDE_INT)
{
prec -= HOST_BITS_PER_WIDE_INT;
m = ((unsigned HOST_WIDE_INT) 2 << (prec - 1)) - 1;
mask.high = (HOST_WIDE_INT) m;
mask.low = ALL_ONES;
}
else
{
mask.high = 0;
mask.low = prec ? ((unsigned HOST_WIDE_INT) 2 << (prec - 1)) - 1 : 0;
}
return mask;
}
/* Returns a maximum value for signed or unsigned integer
of precision PREC. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::max_value (unsigned int prec, bool uns)
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return double_int::mask (prec - (uns ? 0 : 1));
}
/* Returns a minimum value for signed or unsigned integer
of precision PREC. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::min_value (unsigned int prec, bool uns)
{
if (uns)
return double_int_zero;
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return double_int_one.lshift (prec - 1, prec, false);
}
/* Clears the bits of CST over the precision PREC. If UNS is false, the bits
outside of the precision are set to the sign bit (i.e., the PREC-th one),
otherwise they are set to zero.
Remove trailing white spaces. 2009-11-25 H.J. Lu <hongjiu.lu@intel.com> * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. From-SVN: r154645
2009-11-25 11:55:54 +01:00
This corresponds to returning the value represented by PREC lowermost bits
of CST, with the given signedness. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::ext (unsigned prec, bool uns) const
{
if (uns)
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return this->zext (prec);
else
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return this->sext (prec);
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
/* The same as double_int::ext with UNS = true. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::zext (unsigned prec) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
const double_int &cst = *this;
double_int mask = double_int::mask (prec);
double_int r;
r.low = cst.low & mask.low;
r.high = cst.high & mask.high;
return r;
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
/* The same as double_int::ext with UNS = false. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::sext (unsigned prec) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
const double_int &cst = *this;
double_int mask = double_int::mask (prec);
double_int r;
unsigned HOST_WIDE_INT snum;
if (prec <= HOST_BITS_PER_WIDE_INT)
snum = cst.low;
else
{
prec -= HOST_BITS_PER_WIDE_INT;
snum = (unsigned HOST_WIDE_INT) cst.high;
}
if (((snum >> (prec - 1)) & 1) == 1)
{
r.low = cst.low | ~mask.low;
r.high = cst.high | ~mask.high;
}
else
{
r.low = cst.low & mask.low;
r.high = cst.high & mask.high;
Remove trailing white spaces. 2009-11-25 H.J. Lu <hongjiu.lu@intel.com> * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. From-SVN: r154645
2009-11-25 11:55:54 +01:00
}
return r;
}
/* Returns true if CST fits in signed HOST_WIDE_INT. */
bool
double_int::fits_shwi () const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
const double_int &cst = *this;
if (cst.high == 0)
return (HOST_WIDE_INT) cst.low >= 0;
else if (cst.high == -1)
return (HOST_WIDE_INT) cst.low < 0;
else
return false;
}
/* Returns true if CST fits in HOST_WIDE_INT if UNS is false, or in
unsigned HOST_WIDE_INT if UNS is true. */
bool
double_int::fits_hwi (bool uns) const
{
if (uns)
return this->fits_uhwi ();
else
return this->fits_shwi ();
}
/* Returns A * B. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::operator * (double_int b) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
const double_int &a = *this;
double_int ret;
mul_double (a.low, a.high, b.low, b.high, &ret.low, &ret.high);
return ret;
}
/* Multiplies *this with B and returns a reference to *this. */
double_int &
double_int::operator *= (double_int b)
{
mul_double (low, high, b.low, b.high, &low, &high);
return *this;
}
2010-11-09 03:01:06 +01:00
/* Returns A * B. If the operation overflows according to UNSIGNED_P,
*OVERFLOW is set to nonzero. */
double_int
Modify gcc/*.[hc] double_int call sites to use the new interface. This change entailed adding a few new methods to double_int. The change results in a 0.163% time improvement with a 70% confidence. Tested on x86_64. Index: gcc/ChangeLog 2012-09-06 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::operator &=): New. (double_int::operator ^=): New. (double_int::operator |=): New. (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. (binary double_int::operator *): Remove parameter name. (binary double_int::operator +): Likewise. (binary double_int::operator -): Likewise. (binary double_int::operator &): Likewise. (double_int::operator |): Likewise. (double_int::operator ^): Likewise. (double_int::and_not): Likewise. (double_int::from_shwi): Tidy formatting. (double_int::from_uhwi): Likewise. (double_int::from_uhwi): Likewise. * double-int.c (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. * builtins.c: Modify to use the new double_int interface. * cgraph.c: Likewise. * combine.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * gimple-fold.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimplify-rtx.c: Likewise. * ipa-prop.c: Likewise. * loop-iv.c: Likewise. * optabs.c: Likewise. * stor-layout.c: Likewise. * tree-affine.c: Likewise. * tree-cfg.c: Likewise. * tree-dfa.c: Likewise. * tree-flow-inline.h: Likewise. * tree-object-size.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-sccvn: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vrp.c: Likewise. * tree.h: Likewise. * tree.c: Likewise. * varasm.c: Likewise. From-SVN: r191047
2012-09-07 02:06:35 +02:00
double_int::mul_with_sign (double_int b, bool unsigned_p, bool *overflow) const
2010-11-09 03:01:06 +01:00
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
const double_int &a = *this;
double_int ret, tem;
*overflow = mul_double_wide_with_sign (a.low, a.high, b.low, b.high,
&ret.low, &ret.high,
&tem.low, &tem.high, unsigned_p);
2010-11-09 03:01:06 +01:00
return ret;
}
Finish conversion of uses of double_int to the new API. Some old functionality required new interfaces, and these have been added to double-int.[hc]: double_int::from_pair - static constructor function wide_mul_with_sign - double-wide multiply instruction sub_with_overflow - subtraction with overlow testing neg_with_overflow - negation with overlow testing divmod_with_overflow - div and mod with overlow testing This patch corrects the bootstrap problem on HPPA, via the addition of sub_with_overflow. (The overflow properties of negation and addition are different from subtraction.) The prior two generations of the interface have been removed. Some of these old interfaces are still used as static implementation in double-int.c. The changed compiler appears 0.321% faster with 80% confidence of being faster. Tested on x86_64, HPPA, and SPARC. However, there are changes to the avr config files, and I have not tested those. Index: gcc/java/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * decl.c (java_init_decl_processing): Change to new double_int API. * jcf-parse.c (get_constant): Likewise. * boehm.c (mark_reference_fields): Likewise. (get_boehm_type_descriptor): Likewise. Index: gcc/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::from_pair): New. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. (shwi_to_double_int): Remove. (uhwi_to_double_int): Remove. (double_int_to_shwi): Remove. (double_int_to_uhwi): Remove. (double_int_fits_in_uhwi_p): Remove. (double_int_fits_in_shwi_p): Remove. (double_int_fits_in_hwi_p): Remove. (double_int_mul): Remove. (double_int_mul_with_sign): Remove. (double_int_add): Remove. (double_int_sub): Remove. (double_int_neg): Remove. (double_int_div): Remove. (double_int_sdiv): Remove. (double_int_udiv): Remove. (double_int_mod): Remove. (double_int_smod): Remove. (double_int_umod): Remove. (double_int_divmod): Remove. (double_int_sdivmod): Remove. (double_int_udivmod): Remove. (double_int_multiple_of): Remove. (double_int_setbit): Remove. (double_int_ctz): Remove. (double_int_not): Remove. (double_int_ior): Remove. (double_int_and): Remove. (double_int_and_not): Remove. (double_int_xor): Remove. (double_int_lshift): Remove. (double_int_rshift): Remove. (double_int_lrotate): Remove. (double_int_rrotate): Remove. (double_int_negative_p): Remove. (double_int_cmp): Remove. (double_int_scmp): Remove. (double_int_ucmp): Remove. (double_int_max): Remove. (double_int_smax): Remove. (double_int_umax): Remove. (double_int_min): Remove. (double_int_smin): Remove. (double_int_umin): Remove. (double_int_ext): Remove. (double_int_sext): Remove. (double_int_zext): Remove. (double_int_mask): Remove. (double_int_max_value): Remove. (double_int_min_value): Remove. (double_int_zero_p): Remove. (double_int_one_p): Remove. (double_int_minus_one_p): Remove. (double_int_equal_p): Remove. (double_int_popcount): Remove. (extern add_double_with_sign): Remove. (#define add_double): Remove. (extern neg_double): Remove. (extern mul_double_with_sign): Remove. (extern mul_double_wide_with_sign): Remove. (#define mul_double): Remove. (extern lshift_double): Remove. (extern div_and_round_double): Remove. * double-int.c (add_double_with_sign): Make static. (#defined add_double): Localized from header. (neg_double): Make static. (mul_double_with_sign): Make static. (mul_double_wide_with_sign): Make static. (#defined mul_double): Localized from header. (lshift_double): Make static. (div_and_round_double): Make static. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. * emit-rtl.c (init_emit_once): Change to new double_int API. * explow.c (plus_constant): Likewise. * expmed.c (choose_multiplier): Likewise. * fold-const.c (#define OVERFLOW_SUM_SIGN): Remove. (int_const_binop_1): Change to new double_int API. (fold_div_compare): Likewise. (maybe_canonicalize_comparison): Likewise. (pointer_may_wrap_p): Likewise. (fold_negate_const): Likewise. (fold_abs_const): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_const_binary_operation): Likewise. * tree-chrec.c (tree_fold_binomial): Likewise. * tree-vrp.c (extract_range_from_binary_expr_1): Likewise. * config/sparc/sparc.c (sparc_fold_builtin): Likewise. * config/avr/avr.c (avr_double_int_push_digit): Likewise. (avr_map): Likewise. (avr_map_decompose): Likewise. (avr_out_insert_bits): Likewise. Index: gcc/cp/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * init.c (build_new_1): Change to new double_int API. * decl.c (build_enumerator): Likewise. * typeck2.c (process_init_constructor_array): Likewise. * mangle.c (write_array_type): Likewise. Index: gcc/fortran/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * trans-expr.c (gfc_conv_cst_int_power): Change to new double_int API. * target-memory.c (gfc_interpret_logical): Likewise. From-SVN: r191675
2012-09-24 20:22:31 +02:00
double_int
double_int::wide_mul_with_sign (double_int b, bool unsigned_p,
double_int *higher, bool *overflow) const
{
double_int lower;
*overflow = mul_double_wide_with_sign (low, high, b.low, b.high,
&lower.low, &lower.high,
&higher->low, &higher->high,
unsigned_p);
return lower;
}
/* Returns A + B. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::operator + (double_int b) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
const double_int &a = *this;
double_int ret;
add_double (a.low, a.high, b.low, b.high, &ret.low, &ret.high);
return ret;
}
/* Adds B to *this and returns a reference to *this. */
double_int &
double_int::operator += (double_int b)
{
add_double (low, high, b.low, b.high, &low, &high);
return *this;
}
Modify gcc/*.[hc] double_int call sites to use the new interface. This change entailed adding a few new methods to double_int. The change results in a 0.163% time improvement with a 70% confidence. Tested on x86_64. Index: gcc/ChangeLog 2012-09-06 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::operator &=): New. (double_int::operator ^=): New. (double_int::operator |=): New. (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. (binary double_int::operator *): Remove parameter name. (binary double_int::operator +): Likewise. (binary double_int::operator -): Likewise. (binary double_int::operator &): Likewise. (double_int::operator |): Likewise. (double_int::operator ^): Likewise. (double_int::and_not): Likewise. (double_int::from_shwi): Tidy formatting. (double_int::from_uhwi): Likewise. (double_int::from_uhwi): Likewise. * double-int.c (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. * builtins.c: Modify to use the new double_int interface. * cgraph.c: Likewise. * combine.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * gimple-fold.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimplify-rtx.c: Likewise. * ipa-prop.c: Likewise. * loop-iv.c: Likewise. * optabs.c: Likewise. * stor-layout.c: Likewise. * tree-affine.c: Likewise. * tree-cfg.c: Likewise. * tree-dfa.c: Likewise. * tree-flow-inline.h: Likewise. * tree-object-size.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-sccvn: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vrp.c: Likewise. * tree.h: Likewise. * tree.c: Likewise. * varasm.c: Likewise. From-SVN: r191047
2012-09-07 02:06:35 +02:00
/* Returns A + B. If the operation overflows according to UNSIGNED_P,
*OVERFLOW is set to nonzero. */
double_int
double_int::add_with_sign (double_int b, bool unsigned_p, bool *overflow) const
{
const double_int &a = *this;
double_int ret;
*overflow = add_double_with_sign (a.low, a.high, b.low, b.high,
&ret.low, &ret.high, unsigned_p);
return ret;
}
/* Returns A - B. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::operator - (double_int b) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
const double_int &a = *this;
double_int ret;
neg_double (b.low, b.high, &b.low, &b.high);
add_double (a.low, a.high, b.low, b.high, &ret.low, &ret.high);
return ret;
}
/* Subtracts B from *this and returns a reference to *this. */
double_int &
double_int::operator -= (double_int b)
{
neg_double (b.low, b.high, &b.low, &b.high);
add_double (low, high, b.low, b.high, &low, &high);
return *this;
}
Finish conversion of uses of double_int to the new API. Some old functionality required new interfaces, and these have been added to double-int.[hc]: double_int::from_pair - static constructor function wide_mul_with_sign - double-wide multiply instruction sub_with_overflow - subtraction with overlow testing neg_with_overflow - negation with overlow testing divmod_with_overflow - div and mod with overlow testing This patch corrects the bootstrap problem on HPPA, via the addition of sub_with_overflow. (The overflow properties of negation and addition are different from subtraction.) The prior two generations of the interface have been removed. Some of these old interfaces are still used as static implementation in double-int.c. The changed compiler appears 0.321% faster with 80% confidence of being faster. Tested on x86_64, HPPA, and SPARC. However, there are changes to the avr config files, and I have not tested those. Index: gcc/java/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * decl.c (java_init_decl_processing): Change to new double_int API. * jcf-parse.c (get_constant): Likewise. * boehm.c (mark_reference_fields): Likewise. (get_boehm_type_descriptor): Likewise. Index: gcc/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::from_pair): New. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. (shwi_to_double_int): Remove. (uhwi_to_double_int): Remove. (double_int_to_shwi): Remove. (double_int_to_uhwi): Remove. (double_int_fits_in_uhwi_p): Remove. (double_int_fits_in_shwi_p): Remove. (double_int_fits_in_hwi_p): Remove. (double_int_mul): Remove. (double_int_mul_with_sign): Remove. (double_int_add): Remove. (double_int_sub): Remove. (double_int_neg): Remove. (double_int_div): Remove. (double_int_sdiv): Remove. (double_int_udiv): Remove. (double_int_mod): Remove. (double_int_smod): Remove. (double_int_umod): Remove. (double_int_divmod): Remove. (double_int_sdivmod): Remove. (double_int_udivmod): Remove. (double_int_multiple_of): Remove. (double_int_setbit): Remove. (double_int_ctz): Remove. (double_int_not): Remove. (double_int_ior): Remove. (double_int_and): Remove. (double_int_and_not): Remove. (double_int_xor): Remove. (double_int_lshift): Remove. (double_int_rshift): Remove. (double_int_lrotate): Remove. (double_int_rrotate): Remove. (double_int_negative_p): Remove. (double_int_cmp): Remove. (double_int_scmp): Remove. (double_int_ucmp): Remove. (double_int_max): Remove. (double_int_smax): Remove. (double_int_umax): Remove. (double_int_min): Remove. (double_int_smin): Remove. (double_int_umin): Remove. (double_int_ext): Remove. (double_int_sext): Remove. (double_int_zext): Remove. (double_int_mask): Remove. (double_int_max_value): Remove. (double_int_min_value): Remove. (double_int_zero_p): Remove. (double_int_one_p): Remove. (double_int_minus_one_p): Remove. (double_int_equal_p): Remove. (double_int_popcount): Remove. (extern add_double_with_sign): Remove. (#define add_double): Remove. (extern neg_double): Remove. (extern mul_double_with_sign): Remove. (extern mul_double_wide_with_sign): Remove. (#define mul_double): Remove. (extern lshift_double): Remove. (extern div_and_round_double): Remove. * double-int.c (add_double_with_sign): Make static. (#defined add_double): Localized from header. (neg_double): Make static. (mul_double_with_sign): Make static. (mul_double_wide_with_sign): Make static. (#defined mul_double): Localized from header. (lshift_double): Make static. (div_and_round_double): Make static. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. * emit-rtl.c (init_emit_once): Change to new double_int API. * explow.c (plus_constant): Likewise. * expmed.c (choose_multiplier): Likewise. * fold-const.c (#define OVERFLOW_SUM_SIGN): Remove. (int_const_binop_1): Change to new double_int API. (fold_div_compare): Likewise. (maybe_canonicalize_comparison): Likewise. (pointer_may_wrap_p): Likewise. (fold_negate_const): Likewise. (fold_abs_const): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_const_binary_operation): Likewise. * tree-chrec.c (tree_fold_binomial): Likewise. * tree-vrp.c (extract_range_from_binary_expr_1): Likewise. * config/sparc/sparc.c (sparc_fold_builtin): Likewise. * config/avr/avr.c (avr_double_int_push_digit): Likewise. (avr_map): Likewise. (avr_map_decompose): Likewise. (avr_out_insert_bits): Likewise. Index: gcc/cp/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * init.c (build_new_1): Change to new double_int API. * decl.c (build_enumerator): Likewise. * typeck2.c (process_init_constructor_array): Likewise. * mangle.c (write_array_type): Likewise. Index: gcc/fortran/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * trans-expr.c (gfc_conv_cst_int_power): Change to new double_int API. * target-memory.c (gfc_interpret_logical): Likewise. From-SVN: r191675
2012-09-24 20:22:31 +02:00
/* Returns A - B. If the operation overflows via inconsistent sign bits,
*OVERFLOW is set to nonzero. */
double_int
double_int::sub_with_overflow (double_int b, bool *overflow) const
{
double_int ret;
neg_double (b.low, b.high, &ret.low, &ret.high);
add_double (low, high, ret.low, ret.high, &ret.low, &ret.high);
*overflow = OVERFLOW_SUM_SIGN (ret.high, b.high, high);
return ret;
}
/* Returns -A. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::operator - () const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
const double_int &a = *this;
double_int ret;
neg_double (a.low, a.high, &ret.low, &ret.high);
return ret;
}
Finish conversion of uses of double_int to the new API. Some old functionality required new interfaces, and these have been added to double-int.[hc]: double_int::from_pair - static constructor function wide_mul_with_sign - double-wide multiply instruction sub_with_overflow - subtraction with overlow testing neg_with_overflow - negation with overlow testing divmod_with_overflow - div and mod with overlow testing This patch corrects the bootstrap problem on HPPA, via the addition of sub_with_overflow. (The overflow properties of negation and addition are different from subtraction.) The prior two generations of the interface have been removed. Some of these old interfaces are still used as static implementation in double-int.c. The changed compiler appears 0.321% faster with 80% confidence of being faster. Tested on x86_64, HPPA, and SPARC. However, there are changes to the avr config files, and I have not tested those. Index: gcc/java/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * decl.c (java_init_decl_processing): Change to new double_int API. * jcf-parse.c (get_constant): Likewise. * boehm.c (mark_reference_fields): Likewise. (get_boehm_type_descriptor): Likewise. Index: gcc/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::from_pair): New. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. (shwi_to_double_int): Remove. (uhwi_to_double_int): Remove. (double_int_to_shwi): Remove. (double_int_to_uhwi): Remove. (double_int_fits_in_uhwi_p): Remove. (double_int_fits_in_shwi_p): Remove. (double_int_fits_in_hwi_p): Remove. (double_int_mul): Remove. (double_int_mul_with_sign): Remove. (double_int_add): Remove. (double_int_sub): Remove. (double_int_neg): Remove. (double_int_div): Remove. (double_int_sdiv): Remove. (double_int_udiv): Remove. (double_int_mod): Remove. (double_int_smod): Remove. (double_int_umod): Remove. (double_int_divmod): Remove. (double_int_sdivmod): Remove. (double_int_udivmod): Remove. (double_int_multiple_of): Remove. (double_int_setbit): Remove. (double_int_ctz): Remove. (double_int_not): Remove. (double_int_ior): Remove. (double_int_and): Remove. (double_int_and_not): Remove. (double_int_xor): Remove. (double_int_lshift): Remove. (double_int_rshift): Remove. (double_int_lrotate): Remove. (double_int_rrotate): Remove. (double_int_negative_p): Remove. (double_int_cmp): Remove. (double_int_scmp): Remove. (double_int_ucmp): Remove. (double_int_max): Remove. (double_int_smax): Remove. (double_int_umax): Remove. (double_int_min): Remove. (double_int_smin): Remove. (double_int_umin): Remove. (double_int_ext): Remove. (double_int_sext): Remove. (double_int_zext): Remove. (double_int_mask): Remove. (double_int_max_value): Remove. (double_int_min_value): Remove. (double_int_zero_p): Remove. (double_int_one_p): Remove. (double_int_minus_one_p): Remove. (double_int_equal_p): Remove. (double_int_popcount): Remove. (extern add_double_with_sign): Remove. (#define add_double): Remove. (extern neg_double): Remove. (extern mul_double_with_sign): Remove. (extern mul_double_wide_with_sign): Remove. (#define mul_double): Remove. (extern lshift_double): Remove. (extern div_and_round_double): Remove. * double-int.c (add_double_with_sign): Make static. (#defined add_double): Localized from header. (neg_double): Make static. (mul_double_with_sign): Make static. (mul_double_wide_with_sign): Make static. (#defined mul_double): Localized from header. (lshift_double): Make static. (div_and_round_double): Make static. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. * emit-rtl.c (init_emit_once): Change to new double_int API. * explow.c (plus_constant): Likewise. * expmed.c (choose_multiplier): Likewise. * fold-const.c (#define OVERFLOW_SUM_SIGN): Remove. (int_const_binop_1): Change to new double_int API. (fold_div_compare): Likewise. (maybe_canonicalize_comparison): Likewise. (pointer_may_wrap_p): Likewise. (fold_negate_const): Likewise. (fold_abs_const): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_const_binary_operation): Likewise. * tree-chrec.c (tree_fold_binomial): Likewise. * tree-vrp.c (extract_range_from_binary_expr_1): Likewise. * config/sparc/sparc.c (sparc_fold_builtin): Likewise. * config/avr/avr.c (avr_double_int_push_digit): Likewise. (avr_map): Likewise. (avr_map_decompose): Likewise. (avr_out_insert_bits): Likewise. Index: gcc/cp/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * init.c (build_new_1): Change to new double_int API. * decl.c (build_enumerator): Likewise. * typeck2.c (process_init_constructor_array): Likewise. * mangle.c (write_array_type): Likewise. Index: gcc/fortran/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * trans-expr.c (gfc_conv_cst_int_power): Change to new double_int API. * target-memory.c (gfc_interpret_logical): Likewise. From-SVN: r191675
2012-09-24 20:22:31 +02:00
double_int
double_int::neg_with_overflow (bool *overflow) const
{
double_int ret;
*overflow = neg_double (low, high, &ret.low, &ret.high);
return ret;
}
/* Returns A / B (computed as unsigned depending on UNS, and rounded as
specified by CODE). CODE is enum tree_code in fact, but double_int.h
must be included before tree.h. The remainder after the division is
stored to MOD. */
Finish conversion of uses of double_int to the new API. Some old functionality required new interfaces, and these have been added to double-int.[hc]: double_int::from_pair - static constructor function wide_mul_with_sign - double-wide multiply instruction sub_with_overflow - subtraction with overlow testing neg_with_overflow - negation with overlow testing divmod_with_overflow - div and mod with overlow testing This patch corrects the bootstrap problem on HPPA, via the addition of sub_with_overflow. (The overflow properties of negation and addition are different from subtraction.) The prior two generations of the interface have been removed. Some of these old interfaces are still used as static implementation in double-int.c. The changed compiler appears 0.321% faster with 80% confidence of being faster. Tested on x86_64, HPPA, and SPARC. However, there are changes to the avr config files, and I have not tested those. Index: gcc/java/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * decl.c (java_init_decl_processing): Change to new double_int API. * jcf-parse.c (get_constant): Likewise. * boehm.c (mark_reference_fields): Likewise. (get_boehm_type_descriptor): Likewise. Index: gcc/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::from_pair): New. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. (shwi_to_double_int): Remove. (uhwi_to_double_int): Remove. (double_int_to_shwi): Remove. (double_int_to_uhwi): Remove. (double_int_fits_in_uhwi_p): Remove. (double_int_fits_in_shwi_p): Remove. (double_int_fits_in_hwi_p): Remove. (double_int_mul): Remove. (double_int_mul_with_sign): Remove. (double_int_add): Remove. (double_int_sub): Remove. (double_int_neg): Remove. (double_int_div): Remove. (double_int_sdiv): Remove. (double_int_udiv): Remove. (double_int_mod): Remove. (double_int_smod): Remove. (double_int_umod): Remove. (double_int_divmod): Remove. (double_int_sdivmod): Remove. (double_int_udivmod): Remove. (double_int_multiple_of): Remove. (double_int_setbit): Remove. (double_int_ctz): Remove. (double_int_not): Remove. (double_int_ior): Remove. (double_int_and): Remove. (double_int_and_not): Remove. (double_int_xor): Remove. (double_int_lshift): Remove. (double_int_rshift): Remove. (double_int_lrotate): Remove. (double_int_rrotate): Remove. (double_int_negative_p): Remove. (double_int_cmp): Remove. (double_int_scmp): Remove. (double_int_ucmp): Remove. (double_int_max): Remove. (double_int_smax): Remove. (double_int_umax): Remove. (double_int_min): Remove. (double_int_smin): Remove. (double_int_umin): Remove. (double_int_ext): Remove. (double_int_sext): Remove. (double_int_zext): Remove. (double_int_mask): Remove. (double_int_max_value): Remove. (double_int_min_value): Remove. (double_int_zero_p): Remove. (double_int_one_p): Remove. (double_int_minus_one_p): Remove. (double_int_equal_p): Remove. (double_int_popcount): Remove. (extern add_double_with_sign): Remove. (#define add_double): Remove. (extern neg_double): Remove. (extern mul_double_with_sign): Remove. (extern mul_double_wide_with_sign): Remove. (#define mul_double): Remove. (extern lshift_double): Remove. (extern div_and_round_double): Remove. * double-int.c (add_double_with_sign): Make static. (#defined add_double): Localized from header. (neg_double): Make static. (mul_double_with_sign): Make static. (mul_double_wide_with_sign): Make static. (#defined mul_double): Localized from header. (lshift_double): Make static. (div_and_round_double): Make static. (double_int::wide_mul_with_sign): New. (double_int::sub_with_overflow): New. (double_int::neg_with_overflow): New. (double_int::divmod_with_overflow): New. * emit-rtl.c (init_emit_once): Change to new double_int API. * explow.c (plus_constant): Likewise. * expmed.c (choose_multiplier): Likewise. * fold-const.c (#define OVERFLOW_SUM_SIGN): Remove. (int_const_binop_1): Change to new double_int API. (fold_div_compare): Likewise. (maybe_canonicalize_comparison): Likewise. (pointer_may_wrap_p): Likewise. (fold_negate_const): Likewise. (fold_abs_const): Likewise. * simplify-rtx.c (simplify_const_unary_operation): Likewise. (simplify_const_binary_operation): Likewise. * tree-chrec.c (tree_fold_binomial): Likewise. * tree-vrp.c (extract_range_from_binary_expr_1): Likewise. * config/sparc/sparc.c (sparc_fold_builtin): Likewise. * config/avr/avr.c (avr_double_int_push_digit): Likewise. (avr_map): Likewise. (avr_map_decompose): Likewise. (avr_out_insert_bits): Likewise. Index: gcc/cp/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * init.c (build_new_1): Change to new double_int API. * decl.c (build_enumerator): Likewise. * typeck2.c (process_init_constructor_array): Likewise. * mangle.c (write_array_type): Likewise. Index: gcc/fortran/ChangeLog 2012-09-24 Lawrence Crowl <crowl@google.com> * trans-expr.c (gfc_conv_cst_int_power): Change to new double_int API. * target-memory.c (gfc_interpret_logical): Likewise. From-SVN: r191675
2012-09-24 20:22:31 +02:00
double_int
double_int::divmod_with_overflow (double_int b, bool uns, unsigned code,
double_int *mod, bool *overflow) const
{
const double_int &a = *this;
double_int ret;
*overflow = div_and_round_double (code, uns, a.low, a.high,
b.low, b.high, &ret.low, &ret.high,
&mod->low, &mod->high);
return ret;
}
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::divmod (double_int b, bool uns, unsigned code,
double_int *mod) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
const double_int &a = *this;
double_int ret;
div_and_round_double (code, uns, a.low, a.high,
Fix enum conversions which are invalid in C++: gcc/: Fix enum conversions which are invalid in C++: * auto-inc-dec.c (attempt_change): Change 0 to SET in function call. * calls.c (store_one_arg): Change 0 to EXPAND_NORMAL in function call. * cse.c (hash_rtx_cb): Change 0 to VOIDmode in function call. * dbgcnt.c (dbg_cnt_set_limit_by_name): Add cast to enum type. * dbxout.c (dbxout_symbol): Change 0 to VOIDmode in function call. (dbxout_parms): Likewise. * df-core.c (df_set_flags): Change changeable_flags parameter to int. (df_clear_flags): Likewise. * df-problems.c (df_rd_bb_local_compute_process_def): Change top_flag parameter to int. (df_chain_create_bb_process_use): Likewise. (df_chain_add_problem): Change chain_flags parameter to unsigned int. Remove cast. * df-scan.c (df_ref_create): Change ref_flags parameter to int. (df_ref_create_structure, df_def_record_1): Likewise. (df_defs_record, df_uses_record, df_get_call_refs): Likewise. (df_notes_rescan): Change 0 to VOIDmode in function call. (df_get_call_refs, df_insn_refs_collect): Likewise. (df_bb_regs_collect): Likewise. (df_entry_block_defs_collect): Likewise. (df_exit_block_uses_collect): Likewise. * df.h: Update declarations. * double-int.c (double_int_divmod): Add cast to enum type. * dse.c (replace_inc_dec): Reverse parameters to gen_int_mode. * dwarf2out.c (new_reg_loc_descr): Add casts to enum type. (based_loc_descr): Likewise. (loc_descriptor_from_tree_1): Change first_op and second_op to enum dwarf_location_atom. Add cast to enum type. * expmed.c (init_expmed): Change 0 to SET in function call. * expr.c (init_expr_target): Change 0 to VOIDmode in function call. (expand_expr_real_1): Change 0 to EXPAND_NORMAL in function call. (do_store_flag): Likewise. * fixed-value.h (struct fixed_value): Change mode to enum machine_mode. * function.c (assign_parms): Change 0 to VOIDmode in function call. * genautomata.c (insert_automaton_decl): Change 1 to INSERT in function call. (insert_insn_decl, insert_decl, insert_state): Likewise. (automata_list_finish): Likewise. * genrecog.c (process_define_predicate): Add cast to enum type. * gensupport.c (init_predicate_table): Add cast to enum type. * gimple.c (gimple_build_return): Change 0 to ERROR_MARK in function call. (gimple_build_call_1, gimple_build_label): Likewise. (gimple_build_goto, gimple_build_asm_1): Likewise. (gimple_build_switch_1, gimple_build_cdt): Likewise. * gimple.h (GIMPLE_CHECK): Change 0 to ERROR_MARK in function call. (enum fallback): Rename from enum fallback_t. (fallback_t): Typedef as int. * gimple-low.c (lower_builtin_setjmp): Change TSI_SAME_STMT to GSI_SAME_STMT in function call. * ira.c (setup_class_subset_and_memory_move_costs): Add casts to enum type. (setup_reg_class_relations): Likewise. (setup_reg_class_nregs): Change cl to int. Add casts to enum type. (setup_prohibited_class_mode_regs): Add cast to enum type. (setup_prohibited_mode_move_regs): Likewise. * ira-costs.c (record_reg_classes): Change rclass to enum reg_class. (record_address_regs): Change i to enum reg_class. * lists.c (alloc_EXPR_LIST): Add cast to enum type. * machmode.h (GET_MODE_CLASS): Cast value to enum mode_class. (GET_MODE_WIDER_MODE): Cast value to enum machine_mode. (GET_MODE_2XWIDER_MODE): Likewise. (GET_CLASS_NARROWEST_MODE): Likewise. * omp-low.c (expand_omp_for): Add cast to enum type. * optabs.c (debug_optab_libfuncs): Add casts to enum type. * opts.c (enable_warning_as_error): Change kind to diagostic_t. * postreload.c (reload_cse_simplify_operands): Change rclass local to enum reg_class. * predict.c (combine_predictions_for_insn): Change best_predictor and predictor to enum br_predictor. (combine_predictions_for_bb): Likewise. (build_predict_expr): Change assignment to PREDICT_EXPR_OUTCOME to use SET_PREDICT_EXPR_OUTCOME. * real.c (real_arithmetic): Change icode to code in function call. * reginfo.c (init_move_cost): Add casts to enum type. (init_reg_sets_1, init_fake_stack_mems): Likewise. * regmove.c (regclass_compatible_p): Change class0 and class1 to enum reg_class. * reload.c (find_valid_class): Add casts to enum type. (push_reload): Change 0 to NO_REGS in function call. (find_reloads): Change this_alternative to array of enum reg_class. Remove some now-unnecessary casts. (make_memloc): Change 0 to VOIDmode in function call. * reload1.c (reload): Change 0 to VOIDmode in function call. (eliminate_regs_1, elimination_effects): Likewise. (eliminate_regs_in_insn): Likewise. (emit_input_reload_insns): Add cast to enum type. (delete_output_reload): Change 0 to VOIDmode in function call. * reorg.c (insn_sets_resource_p): Convert include_delayed_effects to enum type in function call. * tree.h (PREDICT_EXPR_OUTCOME): Add cast to enum type. (SET_PREDICT_EXPR_OUTCOME): Define. * tree-dump.c (get_dump_file_info): Change phase parameter to int. (get_dump_file_name, dump_begin, dump_enabled_p): Likewise. (dump_initialized_p, dump_flag_name, dump_end): Likewise. (dump_function): Likewise. * tree-dump.h: Update declarations. * tree-pass.h: Update declarations. * varasm.c (assemble_integer): Change mclass to enum mode_class. * config/arm/arm.c (thumb_legitimize_reload_address): Add cast to enum type. (arm_rtx_costs_1): Correct parenthesization. (arm_rtx_costs): Add casts to enum type. (adjacent_mem_locations): Reverse arguments to const_ok_for_op. (vfp_emit_fstmd): Use add_rg_note. (emit_multi_reg_push, emit_sfm): Likewise. (thumb_set_frame_pointer): Likewise. (arm_expand_prologue): Likewise. (arm_regno_class): Change return type to enum reg_class. (thumb1_expand_prologue): Use add_reg_note. * config/arm/arm-protos.h (arm_regno_class): Update declaration. * config/arm/arm.h (INITIALIZE_TRAMPOLINE): Change 0 to LCT_NORMAL in function call. * config/arm/gentune.sh: Add cast to enum type. * config/arm/arm-tune.md: Rebuild. * config/i386/i386.c (ix86_expand_prologue): Use add_reg_note. (ix86_split_fp_branch, predict_jump): Likewise. (ix86_expand_multi_arg_builtin): Change sub_code from enum insn_code to enum rtx_code. (ix86_builtin_vectorized_function): Add cast to enum type. * config/i386/i386.md (truncdfsf2): Change slot to enum ix86_stack_slot. (truncxf<mode>2, isinf<mode>2): Likewise. * config/i386/i386-c.c (ix86_pragma_target_parse): Add cast to enum type. * config/ia64/ia64.c (ia64_split_tmode_move): Use add_reg_note. (spill_restore_mem, do_spill, ia64_expand_prologue): Likewise. (insert_bundle_state): Change 1 to INSERT in function call. (ia64_add_bundle_selector_before): Likewise. * config/ia64/ia64.md (cpu attr): Add cast to enum type. (save_stack_nonlocal): Change 0 to LCT_NORMAL in function call. (restore_stack_nonlocal): Likewise. * config/mips/mips.h (MIPS_ICACHE_SYNC): Change 0 to LCT_NORMAL in function call. * config/mips/mips.c (mips_binary_cost): Change 0 to SET in function call. (mips_rtx_costs): Likewise. (mips_override_options): Add casts to enum type. * config/mips/sdemtk.h (MIPS_ICACHE_SYNC): Change 0 to LCT_NORMAL in function call. * config/pa/pa.c (legitimize_pic_address): Use add_reg_note. (store_reg, set_reg_plus_d): Likewise. (hppa_expand_prologue, hppa_profile_hook): Likewise. * config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Add cast to enum type. (altivec_expand_vec_set_builtin): Change 0 to EXPAND_NORMAL in function call. (emit_unlikely_jump): Use add_reg_note. (rs6000_emit_allocate_stack): Likewise. (rs6000_frame_related, rs6000_emit_prologue): Likewise. (output_toc): Change 1 to INSERT in function call. (output_profile_hook): Change 0 to LCT_NORMAL in function call. (rs6000_initialize_trampoline): Likewise. (rs6000_init_dwarf_reg_sizes_extra): Change 0 to EXPAND_NORMAL in function call. * config/s390/s390.c (s390_rtx_costs): Add cast to enum type. (s390_expand_movmem): Change 0 to OPTAB_DIRECT in function call. (s390_expand_setmem, s390_expand_cmpmem): Likewise. (save_gprs): Use add_reg_note. (s390_emit_prologue): Likewise. (s390_expand_builtin): Change 0 to EXPAND_NORMAL in function call. * config/sparc/sparc.c (sparc_expand_prologue): Use add_reg_note. (sparc_fold_builtin): Add cast to enum type. * config/spu/spu.c (spu_emit_branch_or_set): Change ior_code to enum insn_code. (spu_expand_prologue): Use add_reg_note. (expand_builtin_args): Change 0 to EXPAND_NORMAL in function call. * c-parser.c (c_parser_attributes): Change VEC back to tree list. (c_parser_postfix_expression_after_primary): Get VEC for list of arguments. Get original types of arguments. Call build_function_call_vec. (cached_expr_list_1, cached_expr_list_2): New static variables. (c_parser_expr_list): Change return type to VEC *. Add p_orig_types parameter. Change all callers. (c_parser_release_expr): New static function. (c_parser_vec_to_tree_list): New static function. * c-typeck.c (build_function_call): Rewrite to build a VEC and call build_function_call_vec. (build_function_call_vec): New function, based on old build_function_call. (convert_arguments): Remove nargs and argarray parameters. Change values to a VEC. Add origtypes parameter. (build_modify_expr): Add rhs_origtype parameter. Change all callers. (convert_for_assignment): Add origtype parameter. Change all callers. If warn_cxx_compat, check for conversion to an enum type when calling a function. (store_init_value): Add origtype parameter. Change all callers. (digest_init): Likewise. (struct init_node): Add origtype field. (add_pending_init): Add origtype parameter. Change all callers. (output_init_element): Likewise. (output_pending_init_elements): Pass origtype from init_node to output_init_element. (process_init_elemnt): Pass origtype from c_expr to output_init_element. (c_finish_return): Add origtype parameter. Change all callers. * c-common.c (sync_resolve_size): Change params to VEC *. Change caller. (sync_resolve_params): Likewise. (sync_resolve_return): Change params to first_param. Change caller. (resolve_overloaded_builtins): Change params to VEC *. Change callers. Save first parameter around call to build_function_call_vec. * c-decl.c (finish_decl): Add origtype parameter. Change all callers. Call build_function_call_vec rather than build_function_call for cleanup. * c-tree.h: Update declarations. * c-common.h: Update declarations. * stub-objc.c (objc_rewrite_function_call): Change parameter from params to first_param. * target.h (struct gcc_target): Change resolve_overloaded_builtin params parameter from tree to void *. * config/rs6000/rs6000-c.c (altivec_resolve_overloaded_builtin): Change arglist parameter to have type void *, and to be a pointer to a VEC. * config/rs6000/rs6000-protos.h (altivec_resolve_overloaded_builtin): Update declaration. * config/spu/spu-c.c (spu_resolved_overloaded_builtin): Change fnargs parameter to have type void *, and to be a pointer to a VEC. Call build_function_call_vec instead of build_function_call. * config/spu/spu-protos.h (spu_expand_builtin): Update declaration. gcc/cp/: * typeck.c (build_function_call_vec): New function. (cp_build_function_call): Only pass first parameter to objc_rewrite_function_call. (build_modify_expr): Add rhs_origtype parameter. Change all callers. * decl.c (finish_decl): Add origtype parameter. Change all callers. * semantics.c (finish_call_expr): Pass VEC to resolve_overloaded_builtin. gcc/objc: * objc-act.c (objc_rewrite_function_call): Change parameter from params to first_param. Change all callers. gcc/testsuite: * gcc.dg/Wcxx-compat-3.c: New testcase. From-SVN: r146451
2009-04-20 21:35:00 +02:00
b.low, b.high, &ret.low, &ret.high,
&mod->low, &mod->high);
return ret;
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
/* The same as double_int::divmod with UNS = false. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::sdivmod (double_int b, unsigned code, double_int *mod) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return this->divmod (b, false, code, mod);
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
/* The same as double_int::divmod with UNS = true. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::udivmod (double_int b, unsigned code, double_int *mod) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return this->divmod (b, true, code, mod);
}
/* Returns A / B (computed as unsigned depending on UNS, and rounded as
specified by CODE). CODE is enum tree_code in fact, but double_int.h
must be included before tree.h. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::div (double_int b, bool uns, unsigned code) const
{
double_int mod;
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return this->divmod (b, uns, code, &mod);
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
/* The same as double_int::div with UNS = false. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::sdiv (double_int b, unsigned code) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return this->div (b, false, code);
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
/* The same as double_int::div with UNS = true. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::udiv (double_int b, unsigned code) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return this->div (b, true, code);
}
/* Returns A % B (computed as unsigned depending on UNS, and rounded as
specified by CODE). CODE is enum tree_code in fact, but double_int.h
must be included before tree.h. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::mod (double_int b, bool uns, unsigned code) const
{
double_int mod;
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
this->divmod (b, uns, code, &mod);
return mod;
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
/* The same as double_int::mod with UNS = false. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::smod (double_int b, unsigned code) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return this->mod (b, false, code);
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
/* The same as double_int::mod with UNS = true. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::umod (double_int b, unsigned code) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return this->mod (b, true, code);
}
double-int.c (double_int_multiple_of): New function. 2012-06-22 Bill Schmidt <wschmidt@linux.ibm.com> * double-int.c (double_int_multiple_of): New function. * double-int.h (double_int_multiple_of): New decl. * tree-ssa-loop-ivopts.c (add_cost, zero_cost): Remove undefs. (mbc_entry_hash): New forward decl. (mbc_entry_eq): Likewise. (zero_cost): Change to no_cost. (mult_costs): New static var. (cost_tables_exist): Likewise. (initialize_costs): New function. (finalize_costs): Likewise. (tree_ssa_iv_optimize_init): Call initialize_costs. (add_cost): Change to add_regs_cost; distinguish costs by speed. (multiply_regs_cost): New function. (add_const_cost): Likewise. (extend_or_trunc_reg_cost): Likewise. (negate_reg_cost): Likewise. (multiply_by_cost): Change to multiply_by_const_cost; distinguish costs by speed. (get_address_cost): Change add_cost to add_regs_cost; change multiply_by_cost to multiply_by_const_cost. (force_expr_to_var_cost): Change zero_cost to no_cost; change add_cost to add_regs_cost; change multiply_by_cost to multiply_by_const_cost. (split_cost): Change zero_cost to no_cost. (ptr_difference_cost): Likewise. (difference_cost): Change zero_cost to no_cost; change multiply_by_cost to multiply_by_const_cost. (get_computation_cost_at): Change add_cost to add_regs_cost; change multiply_by_cost to multiply_by_const_cost. (determine_use_iv_cost_generic): Change zero_cost to no_cost. (determine_iv_cost): Change add_cost to add_regs_cost. (iv_ca_new): Change zero_cost to no_cost. (tree_ssa_iv_optimize_finalize): Call finalize_costs. * tree-ssa-address.c (most_expensive_mult_to_index): Change multiply_by_cost to multiply_by_const_cost. * tree-flow.h (multiply_by_cost): Change to multiply_by_const_cost. (add_regs_cost): New decl. (multiply_regs_cost): Likewise. (add_const_cost): Likewise. (extend_or_trunc_reg_cost): Likewise. (negate_reg_cost): Likewise. From-SVN: r188891
2012-06-22 18:37:40 +02:00
/* Return TRUE iff PRODUCT is an integral multiple of FACTOR, and return
the multiple in *MULTIPLE. Otherwise return FALSE and leave *MULTIPLE
unchanged. */
bool
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::multiple_of (double_int factor,
bool unsigned_p, double_int *multiple) const
double-int.c (double_int_multiple_of): New function. 2012-06-22 Bill Schmidt <wschmidt@linux.ibm.com> * double-int.c (double_int_multiple_of): New function. * double-int.h (double_int_multiple_of): New decl. * tree-ssa-loop-ivopts.c (add_cost, zero_cost): Remove undefs. (mbc_entry_hash): New forward decl. (mbc_entry_eq): Likewise. (zero_cost): Change to no_cost. (mult_costs): New static var. (cost_tables_exist): Likewise. (initialize_costs): New function. (finalize_costs): Likewise. (tree_ssa_iv_optimize_init): Call initialize_costs. (add_cost): Change to add_regs_cost; distinguish costs by speed. (multiply_regs_cost): New function. (add_const_cost): Likewise. (extend_or_trunc_reg_cost): Likewise. (negate_reg_cost): Likewise. (multiply_by_cost): Change to multiply_by_const_cost; distinguish costs by speed. (get_address_cost): Change add_cost to add_regs_cost; change multiply_by_cost to multiply_by_const_cost. (force_expr_to_var_cost): Change zero_cost to no_cost; change add_cost to add_regs_cost; change multiply_by_cost to multiply_by_const_cost. (split_cost): Change zero_cost to no_cost. (ptr_difference_cost): Likewise. (difference_cost): Change zero_cost to no_cost; change multiply_by_cost to multiply_by_const_cost. (get_computation_cost_at): Change add_cost to add_regs_cost; change multiply_by_cost to multiply_by_const_cost. (determine_use_iv_cost_generic): Change zero_cost to no_cost. (determine_iv_cost): Change add_cost to add_regs_cost. (iv_ca_new): Change zero_cost to no_cost. (tree_ssa_iv_optimize_finalize): Call finalize_costs. * tree-ssa-address.c (most_expensive_mult_to_index): Change multiply_by_cost to multiply_by_const_cost. * tree-flow.h (multiply_by_cost): Change to multiply_by_const_cost. (add_regs_cost): New decl. (multiply_regs_cost): Likewise. (add_const_cost): Likewise. (extend_or_trunc_reg_cost): Likewise. (negate_reg_cost): Likewise. From-SVN: r188891
2012-06-22 18:37:40 +02:00
{
double_int remainder;
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int quotient = this->divmod (factor, unsigned_p,
double-int.c (double_int_multiple_of): New function. 2012-06-22 Bill Schmidt <wschmidt@linux.ibm.com> * double-int.c (double_int_multiple_of): New function. * double-int.h (double_int_multiple_of): New decl. * tree-ssa-loop-ivopts.c (add_cost, zero_cost): Remove undefs. (mbc_entry_hash): New forward decl. (mbc_entry_eq): Likewise. (zero_cost): Change to no_cost. (mult_costs): New static var. (cost_tables_exist): Likewise. (initialize_costs): New function. (finalize_costs): Likewise. (tree_ssa_iv_optimize_init): Call initialize_costs. (add_cost): Change to add_regs_cost; distinguish costs by speed. (multiply_regs_cost): New function. (add_const_cost): Likewise. (extend_or_trunc_reg_cost): Likewise. (negate_reg_cost): Likewise. (multiply_by_cost): Change to multiply_by_const_cost; distinguish costs by speed. (get_address_cost): Change add_cost to add_regs_cost; change multiply_by_cost to multiply_by_const_cost. (force_expr_to_var_cost): Change zero_cost to no_cost; change add_cost to add_regs_cost; change multiply_by_cost to multiply_by_const_cost. (split_cost): Change zero_cost to no_cost. (ptr_difference_cost): Likewise. (difference_cost): Change zero_cost to no_cost; change multiply_by_cost to multiply_by_const_cost. (get_computation_cost_at): Change add_cost to add_regs_cost; change multiply_by_cost to multiply_by_const_cost. (determine_use_iv_cost_generic): Change zero_cost to no_cost. (determine_iv_cost): Change add_cost to add_regs_cost. (iv_ca_new): Change zero_cost to no_cost. (tree_ssa_iv_optimize_finalize): Call finalize_costs. * tree-ssa-address.c (most_expensive_mult_to_index): Change multiply_by_cost to multiply_by_const_cost. * tree-flow.h (multiply_by_cost): Change to multiply_by_const_cost. (add_regs_cost): New decl. (multiply_regs_cost): Likewise. (add_const_cost): Likewise. (extend_or_trunc_reg_cost): Likewise. (negate_reg_cost): Likewise. From-SVN: r188891
2012-06-22 18:37:40 +02:00
TRUNC_DIV_EXPR, &remainder);
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
if (remainder.is_zero ())
double-int.c (double_int_multiple_of): New function. 2012-06-22 Bill Schmidt <wschmidt@linux.ibm.com> * double-int.c (double_int_multiple_of): New function. * double-int.h (double_int_multiple_of): New decl. * tree-ssa-loop-ivopts.c (add_cost, zero_cost): Remove undefs. (mbc_entry_hash): New forward decl. (mbc_entry_eq): Likewise. (zero_cost): Change to no_cost. (mult_costs): New static var. (cost_tables_exist): Likewise. (initialize_costs): New function. (finalize_costs): Likewise. (tree_ssa_iv_optimize_init): Call initialize_costs. (add_cost): Change to add_regs_cost; distinguish costs by speed. (multiply_regs_cost): New function. (add_const_cost): Likewise. (extend_or_trunc_reg_cost): Likewise. (negate_reg_cost): Likewise. (multiply_by_cost): Change to multiply_by_const_cost; distinguish costs by speed. (get_address_cost): Change add_cost to add_regs_cost; change multiply_by_cost to multiply_by_const_cost. (force_expr_to_var_cost): Change zero_cost to no_cost; change add_cost to add_regs_cost; change multiply_by_cost to multiply_by_const_cost. (split_cost): Change zero_cost to no_cost. (ptr_difference_cost): Likewise. (difference_cost): Change zero_cost to no_cost; change multiply_by_cost to multiply_by_const_cost. (get_computation_cost_at): Change add_cost to add_regs_cost; change multiply_by_cost to multiply_by_const_cost. (determine_use_iv_cost_generic): Change zero_cost to no_cost. (determine_iv_cost): Change add_cost to add_regs_cost. (iv_ca_new): Change zero_cost to no_cost. (tree_ssa_iv_optimize_finalize): Call finalize_costs. * tree-ssa-address.c (most_expensive_mult_to_index): Change multiply_by_cost to multiply_by_const_cost. * tree-flow.h (multiply_by_cost): Change to multiply_by_const_cost. (add_regs_cost): New decl. (multiply_regs_cost): Likewise. (add_const_cost): Likewise. (extend_or_trunc_reg_cost): Likewise. (negate_reg_cost): Likewise. From-SVN: r188891
2012-06-22 18:37:40 +02:00
{
*multiple = quotient;
return true;
}
return false;
}
/* Set BITPOS bit in A. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::set_bit (unsigned bitpos) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int a = *this;
if (bitpos < HOST_BITS_PER_WIDE_INT)
a.low |= HOST_WIDE_INT_1U << bitpos;
else
a.high |= HOST_WIDE_INT_1 << (bitpos - HOST_BITS_PER_WIDE_INT);
return a;
}
/* Count trailing zeros in A. */
int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::trailing_zeros () const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
const double_int &a = *this;
unsigned HOST_WIDE_INT w = a.low ? a.low : (unsigned HOST_WIDE_INT) a.high;
unsigned bits = a.low ? 0 : HOST_BITS_PER_WIDE_INT;
if (!w)
return HOST_BITS_PER_DOUBLE_INT;
bits += ctz_hwi (w);
return bits;
}
/* Shift A left by COUNT places. */
double_int
double_int::lshift (HOST_WIDE_INT count) const
{
double_int ret;
gcc_checking_assert (count >= 0);
if (count >= HOST_BITS_PER_DOUBLE_INT)
{
/* Shifting by the host word size is undefined according to the
ANSI standard, so we must handle this as a special case. */
ret.high = 0;
ret.low = 0;
}
else if (count >= HOST_BITS_PER_WIDE_INT)
{
ret.high = low << (count - HOST_BITS_PER_WIDE_INT);
ret.low = 0;
}
else
{
ret.high = (((unsigned HOST_WIDE_INT) high << count)
| (low >> (HOST_BITS_PER_WIDE_INT - count - 1) >> 1));
ret.low = low << count;
}
return ret;
}
/* Shift A right by COUNT places. */
double_int
double_int::rshift (HOST_WIDE_INT count) const
{
double_int ret;
gcc_checking_assert (count >= 0);
if (count >= HOST_BITS_PER_DOUBLE_INT)
{
/* Shifting by the host word size is undefined according to the
ANSI standard, so we must handle this as a special case. */
ret.high = 0;
ret.low = 0;
}
else if (count >= HOST_BITS_PER_WIDE_INT)
{
ret.high = 0;
ret.low
= (unsigned HOST_WIDE_INT) (high >> (count - HOST_BITS_PER_WIDE_INT));
}
else
{
ret.high = high >> count;
ret.low = ((low >> count)
| ((unsigned HOST_WIDE_INT) high
<< (HOST_BITS_PER_WIDE_INT - count - 1) << 1));
}
return ret;
}
/* Shift A left by COUNT places keeping only PREC bits of result. Shift
right if COUNT is negative. ARITH true specifies arithmetic shifting;
otherwise use logical shift. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::lshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const
{
double_int ret;
if (count > 0)
lshift_double (low, high, count, prec, &ret.low, &ret.high);
else
rshift_double (low, high, absu_hwi (count), prec, &ret.low, &ret.high, arith);
return ret;
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
/* Shift A right by COUNT places keeping only PREC bits of result. Shift
left if COUNT is negative. ARITH true specifies arithmetic shifting;
otherwise use logical shift. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::rshift (HOST_WIDE_INT count, unsigned int prec, bool arith) const
{
double_int ret;
if (count > 0)
rshift_double (low, high, count, prec, &ret.low, &ret.high, arith);
else
lshift_double (low, high, absu_hwi (count), prec, &ret.low, &ret.high);
return ret;
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
/* Arithmetic shift A left by COUNT places keeping only PREC bits of result.
Shift right if COUNT is negative. */
double_int
double_int::alshift (HOST_WIDE_INT count, unsigned int prec) const
{
double_int r;
if (count > 0)
lshift_double (low, high, count, prec, &r.low, &r.high);
else
rshift_double (low, high, absu_hwi (count), prec, &r.low, &r.high, true);
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return r;
}
/* Arithmetic shift A right by COUNT places keeping only PREC bits of result.
Shift left if COUNT is negative. */
double_int
double_int::arshift (HOST_WIDE_INT count, unsigned int prec) const
{
double_int r;
if (count > 0)
rshift_double (low, high, count, prec, &r.low, &r.high, true);
else
lshift_double (low, high, absu_hwi (count), prec, &r.low, &r.high);
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return r;
}
/* Logical shift A left by COUNT places keeping only PREC bits of result.
Shift right if COUNT is negative. */
double_int
double_int::llshift (HOST_WIDE_INT count, unsigned int prec) const
{
double_int r;
if (count > 0)
lshift_double (low, high, count, prec, &r.low, &r.high);
else
rshift_double (low, high, absu_hwi (count), prec, &r.low, &r.high, false);
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return r;
}
/* Logical shift A right by COUNT places keeping only PREC bits of result.
Shift left if COUNT is negative. */
double_int
double_int::lrshift (HOST_WIDE_INT count, unsigned int prec) const
{
double_int r;
if (count > 0)
rshift_double (low, high, count, prec, &r.low, &r.high, false);
else
lshift_double (low, high, absu_hwi (count), prec, &r.low, &r.high);
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return r;
}
/* Rotate A left by COUNT places keeping only PREC bits of result.
Rotate right if COUNT is negative. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::lrotate (HOST_WIDE_INT count, unsigned int prec) const
{
double_int t1, t2;
count %= prec;
if (count < 0)
count += prec;
t1 = this->llshift (count, prec);
t2 = this->lrshift (prec - count, prec);
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return t1 | t2;
}
/* Rotate A rigth by COUNT places keeping only PREC bits of result.
Rotate right if COUNT is negative. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::rrotate (HOST_WIDE_INT count, unsigned int prec) const
{
double_int t1, t2;
count %= prec;
if (count < 0)
count += prec;
t1 = this->lrshift (count, prec);
t2 = this->llshift (prec - count, prec);
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return t1 | t2;
}
/* Returns -1 if A < B, 0 if A == B and 1 if A > B. Signedness of the
comparison is given by UNS. */
int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::cmp (double_int b, bool uns) const
{
if (uns)
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return this->ucmp (b);
else
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return this->scmp (b);
}
/* Compares two unsigned values A and B. Returns -1 if A < B, 0 if A == B,
and 1 if A > B. */
int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::ucmp (double_int b) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
const double_int &a = *this;
if ((unsigned HOST_WIDE_INT) a.high < (unsigned HOST_WIDE_INT) b.high)
return -1;
if ((unsigned HOST_WIDE_INT) a.high > (unsigned HOST_WIDE_INT) b.high)
return 1;
if (a.low < b.low)
return -1;
if (a.low > b.low)
return 1;
return 0;
}
/* Compares two signed values A and B. Returns -1 if A < B, 0 if A == B,
and 1 if A > B. */
int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::scmp (double_int b) const
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
const double_int &a = *this;
if (a.high < b.high)
return -1;
if (a.high > b.high)
return 1;
if (a.low < b.low)
return -1;
if (a.low > b.low)
return 1;
return 0;
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
/* Compares two unsigned values A and B for less-than. */
bool
double_int::ult (double_int b) const
{
if ((unsigned HOST_WIDE_INT) high < (unsigned HOST_WIDE_INT) b.high)
return true;
if ((unsigned HOST_WIDE_INT) high > (unsigned HOST_WIDE_INT) b.high)
return false;
if (low < b.low)
return true;
return false;
}
Modify gcc/*.[hc] double_int call sites to use the new interface. This change entailed adding a few new methods to double_int. The change results in a 0.163% time improvement with a 70% confidence. Tested on x86_64. Index: gcc/ChangeLog 2012-09-06 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::operator &=): New. (double_int::operator ^=): New. (double_int::operator |=): New. (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. (binary double_int::operator *): Remove parameter name. (binary double_int::operator +): Likewise. (binary double_int::operator -): Likewise. (binary double_int::operator &): Likewise. (double_int::operator |): Likewise. (double_int::operator ^): Likewise. (double_int::and_not): Likewise. (double_int::from_shwi): Tidy formatting. (double_int::from_uhwi): Likewise. (double_int::from_uhwi): Likewise. * double-int.c (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. * builtins.c: Modify to use the new double_int interface. * cgraph.c: Likewise. * combine.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * gimple-fold.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimplify-rtx.c: Likewise. * ipa-prop.c: Likewise. * loop-iv.c: Likewise. * optabs.c: Likewise. * stor-layout.c: Likewise. * tree-affine.c: Likewise. * tree-cfg.c: Likewise. * tree-dfa.c: Likewise. * tree-flow-inline.h: Likewise. * tree-object-size.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-sccvn: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vrp.c: Likewise. * tree.h: Likewise. * tree.c: Likewise. * varasm.c: Likewise. From-SVN: r191047
2012-09-07 02:06:35 +02:00
/* Compares two unsigned values A and B for less-than or equal-to. */
bool
double_int::ule (double_int b) const
{
if ((unsigned HOST_WIDE_INT) high < (unsigned HOST_WIDE_INT) b.high)
return true;
if ((unsigned HOST_WIDE_INT) high > (unsigned HOST_WIDE_INT) b.high)
return false;
if (low <= b.low)
return true;
return false;
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
/* Compares two unsigned values A and B for greater-than. */
bool
double_int::ugt (double_int b) const
{
if ((unsigned HOST_WIDE_INT) high > (unsigned HOST_WIDE_INT) b.high)
return true;
if ((unsigned HOST_WIDE_INT) high < (unsigned HOST_WIDE_INT) b.high)
return false;
if (low > b.low)
return true;
return false;
}
/* Compares two signed values A and B for less-than. */
bool
double_int::slt (double_int b) const
{
if (high < b.high)
return true;
if (high > b.high)
return false;
if (low < b.low)
return true;
return false;
Modify gcc/*.[hc] double_int call sites to use the new interface. This change entailed adding a few new methods to double_int. The change results in a 0.163% time improvement with a 70% confidence. Tested on x86_64. Index: gcc/ChangeLog 2012-09-06 Lawrence Crowl <crowl@google.com> * double-int.h (double_int::operator &=): New. (double_int::operator ^=): New. (double_int::operator |=): New. (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. (binary double_int::operator *): Remove parameter name. (binary double_int::operator +): Likewise. (binary double_int::operator -): Likewise. (binary double_int::operator &): Likewise. (double_int::operator |): Likewise. (double_int::operator ^): Likewise. (double_int::and_not): Likewise. (double_int::from_shwi): Tidy formatting. (double_int::from_uhwi): Likewise. (double_int::from_uhwi): Likewise. * double-int.c (double_int::mul_with_sign): Modify overflow parameter to bool*. (double_int::add_with_sign): New. (double_int::ule): New. (double_int::sle): New. * builtins.c: Modify to use the new double_int interface. * cgraph.c: Likewise. * combine.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * gimple-fold.c: Likewise. * gimple-ssa-strength-reduction.c: Likewise. * gimplify-rtx.c: Likewise. * ipa-prop.c: Likewise. * loop-iv.c: Likewise. * optabs.c: Likewise. * stor-layout.c: Likewise. * tree-affine.c: Likewise. * tree-cfg.c: Likewise. * tree-dfa.c: Likewise. * tree-flow-inline.h: Likewise. * tree-object-size.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-sccvn: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vrp.c: Likewise. * tree.h: Likewise. * tree.c: Likewise. * varasm.c: Likewise. From-SVN: r191047
2012-09-07 02:06:35 +02:00
}
/* Compares two signed values A and B for less-than or equal-to. */
bool
double_int::sle (double_int b) const
{
if (high < b.high)
return true;
if (high > b.high)
return false;
if (low <= b.low)
return true;
return false;
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
}
/* Compares two signed values A and B for greater-than. */
bool
double_int::sgt (double_int b) const
{
if (high > b.high)
return true;
if (high < b.high)
return false;
if (low > b.low)
return true;
return false;
}
/* Compares two values A and B. Returns max value. Signedness of the
comparison is given by UNS. */
double_int
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int::max (double_int b, bool uns)
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return (this->cmp (b, uns) == 1) ? *this : b;
}
/* Compares two signed values A and B. Returns max value. */
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int
double_int::smax (double_int b)
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return (this->scmp (b) == 1) ? *this : b;
}
/* Compares two unsigned values A and B. Returns max value. */
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int
double_int::umax (double_int b)
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return (this->ucmp (b) == 1) ? *this : b;
}
/* Compares two values A and B. Returns mix value. Signedness of the
comparison is given by UNS. */
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int
double_int::min (double_int b, bool uns)
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return (this->cmp (b, uns) == -1) ? *this : b;
}
/* Compares two signed values A and B. Returns min value. */
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int
double_int::smin (double_int b)
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return (this->scmp (b) == -1) ? *this : b;
}
/* Compares two unsigned values A and B. Returns min value. */
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
double_int
double_int::umin (double_int b)
{
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
return (this->ucmp (b) == -1) ? *this : b;
}
/* Splits last digit of *CST (taken as unsigned) in BASE and returns it. */
static unsigned
double_int_split_digit (double_int *cst, unsigned base)
{
unsigned HOST_WIDE_INT resl, reml;
HOST_WIDE_INT resh, remh;
div_and_round_double (FLOOR_DIV_EXPR, true, cst->low, cst->high, base, 0,
&resl, &resh, &reml, &remh);
cst->high = resh;
cst->low = resl;
return reml;
}
/* Dumps CST to FILE. If UNS is true, CST is considered to be unsigned,
otherwise it is signed. */
void
dump_double_int (FILE *file, double_int cst, bool uns)
{
unsigned digits[100], n;
int i;
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
if (cst.is_zero ())
{
fprintf (file, "0");
return;
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
if (!uns && cst.is_negative ())
{
fprintf (file, "-");
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
cst = -cst;
}
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
for (n = 0; !cst.is_zero (); n++)
digits[n] = double_int_split_digit (&cst, 10);
for (i = n - 1; i >= 0; i--)
fprintf (file, "%u", digits[i]);
}
/* Sets RESULT to VAL, taken unsigned if UNS is true and as signed
otherwise. */
void
mpz_set_double_int (mpz_t result, double_int val, bool uns)
{
bool negate = false;
unsigned HOST_WIDE_INT vp[2];
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
if (!uns && val.is_negative ())
{
negate = true;
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
val = -val;
}
vp[0] = val.low;
vp[1] = (unsigned HOST_WIDE_INT) val.high;
mpz_import (result, 2, -1, sizeof (HOST_WIDE_INT), 0, 0, vp);
if (negate)
mpz_neg (result, result);
}
/* Returns VAL converted to TYPE. If WRAP is true, then out-of-range
values of VAL will be wrapped; otherwise, they will be set to the
appropriate minimum or maximum TYPE bound. */
double_int
alias.c (component_uses_parent_alias_set): Constify. * alias.c (component_uses_parent_alias_set): Constify. * alias.h (component_uses_parent_alias_set): Likewise. * cfgrtl.c (print_rtl_with_bb): Likewise. * double-int.c (tree_to_double_int, double_int_fits_to_tree_p, mpz_get_double_int): Likewise. * double-int.h (double_int_fits_to_tree_p, tree_to_double_int, mpz_get_double_int): Likewise. * expr.c (is_aligning_offset, undefined_operand_subword_p, mostly_zeros_p, all_zeros_p, safe_from_p, is_aligning_offset): Likewise. * expr.h (safe_from_p): Likewise. * gimple-low.c (try_catch_may_fallthru, block_may_fallthru): Likewise. * gimplify.c (should_carry_locus_p, zero_sized_field_decl, zero_sized_type, goa_lhs_expr_p): Likewise. * omp-low.c (is_variable_sized, use_pointer_for_field): Likewise. * rtl.h (print_rtl_with_bb): Likewise. * sched-vis.c (print_exp, print_value, print_pattern): Likewise. * tree-cfg.c (const_first_stmt, const_last_stmt): New. * tree-flow-inline.h (bb_stmt_list): Constify. (cbsi_start, cbsi_last, cbsi_end_p, cbsi_next, cbsi_prev, cbsi_stmt): New. * tree-flow.h (const_block_stmt_iterator, cbsi_start, cbsi_last, const_first_stmt, const_last_stmt): New. (block_may_fallthru, empty_block_p): Constify. * tree-iterator.c (EXPR_FIRST_BODY, EXPR_LAST_BODY, EXPR_ONLY_BODY): New. (expr_first, expr_last, expr_only): Use macro for body. (const_expr_first, const_expr_last, const_expr_only): New. * tree-iterator.h (const_tree_stmt_iterator, ctsi_start, ctsi_last, ctsi_end_p, ctsi_one_before_end_p, ctsi_next, ctsi_prev, ctsi_stmt): New. * tree-scalar-evolution.c (get_loop_exit_condition): Constify. * tree-scalar-evolution.h (get_loop_exit_condition): Likewise. * tree-ssa-loop-niter.c (loop_only_exit_p, derive_constant_upper_bound): Likewise. * tree-ssa-phiopt.c (empty_block_p): Likewise. * tree-ssa-threadupdate.c (redirection_block_p): Likewise. * tree-vectorizer.c (slpeel_can_duplicate_loop_p): Likewise. * tree-vectorizer.h (slpeel_can_duplicate_loop_p): Likewise. * tree-vrp.c (vrp_bitmap_equal_p): Likewise. * tree.c (get_type_static_bounds): Likewise. * tree.h (const_expr_first, const_expr_last, const_expr_only): New. (get_type_static_bounds): Constify. From-SVN: r127483
2007-08-14 17:18:11 +02:00
mpz_get_double_int (const_tree type, mpz_t val, bool wrap)
{
unsigned HOST_WIDE_INT *vp;
size_t count, numb;
double_int res;
if (!wrap)
Remove trailing white spaces. 2009-11-25 H.J. Lu <hongjiu.lu@intel.com> * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. From-SVN: r154645
2009-11-25 11:55:54 +01:00
{
mpz_t min, max;
mpz_init (min);
mpz_init (max);
get_type_static_bounds (type, min, max);
if (mpz_cmp (val, min) < 0)
mpz_set (val, min);
else if (mpz_cmp (val, max) > 0)
mpz_set (val, max);
mpz_clear (min);
mpz_clear (max);
}
/* Determine the number of unsigned HOST_WIDE_INT that are required
for representing the value. The code to calculate count is
extracted from the GMP manual, section "Integer Import and Export":
http://gmplib.org/manual/Integer-Import-and-Export.html */
alloc-pool.c, [...]: Add missing whitespace before "(". gcc/ * alloc-pool.c, asan.c, auto-inc-dec.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, bt-load.c, builtins.c, calls.c, cfgcleanup.c, cfgexpand.c, cfghooks.c, cfgloop.c, cfgloopmanip.c, cfgrtl.c, cgraph.c, cgraph.h, cgraphbuild.c, cgraphclones.c, cgraphunit.c, collect2.c, combine-stack-adj.c, combine.c, compare-elim.c, context.c, context.h, cprop.c, cse.c, cselib.c, dbxout.c, dce.c, defaults.h, df-core.c, df-problems.c, df-scan.c, df.h, diagnostic.c, double-int.c, dse.c, dumpfile.c, dwarf2asm.c, dwarf2cfi.c, dwarf2out.c, emit-rtl.c, errors.c, except.c, expmed.c, expr.c, file-find.c, final.c, fixed-value.c, fold-const.c, function.c, fwprop.c, gcc-ar.c, gcc.c, gcov-io.c, gcov-io.h, gcov.c, gcse.c, genattr-common.c, genattr.c, genattrtab.c, genautomata.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, gengtype-state.c, gengtype.c, genmodes.c, genopinit.c, genoutput.c, genpeep.c, genpreds.c, genrecog.c, gensupport.c, ggc-common.c, ggc-page.c, gimple-fold.c, gimple-low.c, gimple-pretty-print.c, gimple-ssa-strength-reduction.c, gimple.c, gimple.h, godump.c, graphite-clast-to-gimple.c, graphite-optimize-isl.c, graphite-poly.h, graphite-sese-to-poly.c, graphite.c, haifa-sched.c, hash-table.c, hash-table.h, hwint.c, hwint.h, ifcvt.c, incpath.c, init-regs.c, input.h, intl.c, intl.h, ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa-utils.c, ipa.c, ira-build.c, ira.c, jump.c, loop-doloop.c, loop-init.c, loop-invariant.c, loop-iv.c, lower-subreg.c, lto-cgraph.c, lto-streamer-in.c, lto-streamer-out.c, lto-wrapper.c, mcf.c, mode-switching.c, modulo-sched.c, omp-low.c, optabs.c, opts.c, pass_manager.h, passes.c, plugin.c, postreload-gcse.c, postreload.c, predict.c, prefix.c, pretty-print.c, print-rtl.c, print-tree.c, profile.c, read-md.c, real.c, real.h, recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regmove.c, regrename.c, regs.h, regstat.c, reload1.c, reorg.c, rtl.c, rtl.h, rtlanal.c, sbitmap.c, sched-rgn.c, sdbout.c, sel-sched-ir.c, sel-sched.c, sparseset.c, stack-ptr-mod.c, statistics.c, stmt.c, stor-layout.c, store-motion.c, streamer-hooks.h, system.h, target-hooks-macros.h, targhooks.c, targhooks.h, toplev.c, tracer.c, trans-mem.c, tree-browser.c, tree-call-cdce.c, tree-cfg.c, tree-cfgcleanup.c, tree-complex.c, tree-data-ref.c, tree-data-ref.h, tree-eh.c, tree-emutls.c, tree-flow.h, tree-if-conv.c, tree-into-ssa.c, tree-iterator.c, tree-loop-distribution.c, tree-mudflap.c, tree-nested.c, tree-nomudflap.c, tree-nrv.c, tree-object-size.c, tree-optimize.c, tree-pass.h, tree-pretty-print.c, tree-profile.c, tree-scalar-evolution.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c, tree-ssa-live.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c, tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-operands.c, tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c, tree-ssa-structalias.c, tree-ssa-threadedge.c, tree-ssa-threadupdate.c, tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c, tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop-manip.c, tree-vect-stmts.c, tree-vectorizer.c, tree-vectorizer.h, tree-vrp.c, tree.c, tree.h, tsan.c, tsystem.h, value-prof.c, var-tracking.c, varasm.c, vec.h, vmsdbgout.c, vtable-verify.c, web.c: Add missing whitespace before "(". From-SVN: r203004
2013-09-28 10:42:34 +02:00
numb = 8 * sizeof (HOST_WIDE_INT);
count = (mpz_sizeinbase (val, 2) + numb-1) / numb;
if (count < 2)
count = 2;
alloc-pool.c, [...]: Add missing whitespace before "(". gcc/ * alloc-pool.c, asan.c, auto-inc-dec.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, bt-load.c, builtins.c, calls.c, cfgcleanup.c, cfgexpand.c, cfghooks.c, cfgloop.c, cfgloopmanip.c, cfgrtl.c, cgraph.c, cgraph.h, cgraphbuild.c, cgraphclones.c, cgraphunit.c, collect2.c, combine-stack-adj.c, combine.c, compare-elim.c, context.c, context.h, cprop.c, cse.c, cselib.c, dbxout.c, dce.c, defaults.h, df-core.c, df-problems.c, df-scan.c, df.h, diagnostic.c, double-int.c, dse.c, dumpfile.c, dwarf2asm.c, dwarf2cfi.c, dwarf2out.c, emit-rtl.c, errors.c, except.c, expmed.c, expr.c, file-find.c, final.c, fixed-value.c, fold-const.c, function.c, fwprop.c, gcc-ar.c, gcc.c, gcov-io.c, gcov-io.h, gcov.c, gcse.c, genattr-common.c, genattr.c, genattrtab.c, genautomata.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, gengtype-state.c, gengtype.c, genmodes.c, genopinit.c, genoutput.c, genpeep.c, genpreds.c, genrecog.c, gensupport.c, ggc-common.c, ggc-page.c, gimple-fold.c, gimple-low.c, gimple-pretty-print.c, gimple-ssa-strength-reduction.c, gimple.c, gimple.h, godump.c, graphite-clast-to-gimple.c, graphite-optimize-isl.c, graphite-poly.h, graphite-sese-to-poly.c, graphite.c, haifa-sched.c, hash-table.c, hash-table.h, hwint.c, hwint.h, ifcvt.c, incpath.c, init-regs.c, input.h, intl.c, intl.h, ipa-cp.c, ipa-devirt.c, ipa-inline-analysis.c, ipa-inline.c, ipa-profile.c, ipa-pure-const.c, ipa-reference.c, ipa-split.c, ipa-utils.c, ipa.c, ira-build.c, ira.c, jump.c, loop-doloop.c, loop-init.c, loop-invariant.c, loop-iv.c, lower-subreg.c, lto-cgraph.c, lto-streamer-in.c, lto-streamer-out.c, lto-wrapper.c, mcf.c, mode-switching.c, modulo-sched.c, omp-low.c, optabs.c, opts.c, pass_manager.h, passes.c, plugin.c, postreload-gcse.c, postreload.c, predict.c, prefix.c, pretty-print.c, print-rtl.c, print-tree.c, profile.c, read-md.c, real.c, real.h, recog.c, ree.c, reg-stack.c, regcprop.c, reginfo.c, regmove.c, regrename.c, regs.h, regstat.c, reload1.c, reorg.c, rtl.c, rtl.h, rtlanal.c, sbitmap.c, sched-rgn.c, sdbout.c, sel-sched-ir.c, sel-sched.c, sparseset.c, stack-ptr-mod.c, statistics.c, stmt.c, stor-layout.c, store-motion.c, streamer-hooks.h, system.h, target-hooks-macros.h, targhooks.c, targhooks.h, toplev.c, tracer.c, trans-mem.c, tree-browser.c, tree-call-cdce.c, tree-cfg.c, tree-cfgcleanup.c, tree-complex.c, tree-data-ref.c, tree-data-ref.h, tree-eh.c, tree-emutls.c, tree-flow.h, tree-if-conv.c, tree-into-ssa.c, tree-iterator.c, tree-loop-distribution.c, tree-mudflap.c, tree-nested.c, tree-nomudflap.c, tree-nrv.c, tree-object-size.c, tree-optimize.c, tree-pass.h, tree-pretty-print.c, tree-profile.c, tree-scalar-evolution.c, tree-sra.c, tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-copyrename.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c, tree-ssa-live.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-loop-prefetch.c, tree-ssa-loop.c, tree-ssa-math-opts.c, tree-ssa-operands.c, tree-ssa-phiopt.c, tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-reassoc.c, tree-ssa-sink.c, tree-ssa-strlen.c, tree-ssa-structalias.c, tree-ssa-threadedge.c, tree-ssa-threadupdate.c, tree-ssa-uncprop.c, tree-ssa-uninit.c, tree-ssa.c, tree-ssanames.c, tree-stdarg.c, tree-switch-conversion.c, tree-tailcall.c, tree-vect-data-refs.c, tree-vect-generic.c, tree-vect-loop-manip.c, tree-vect-stmts.c, tree-vectorizer.c, tree-vectorizer.h, tree-vrp.c, tree.c, tree.h, tsan.c, tsystem.h, value-prof.c, var-tracking.c, varasm.c, vec.h, vmsdbgout.c, vtable-verify.c, web.c: Add missing whitespace before "(". From-SVN: r203004
2013-09-28 10:42:34 +02:00
vp = (unsigned HOST_WIDE_INT *) alloca (count * sizeof (HOST_WIDE_INT));
vp[0] = 0;
vp[1] = 0;
mpz_export (vp, &count, -1, sizeof (HOST_WIDE_INT), 0, 0, val);
gcc_assert (wrap || count <= 2);
res.low = vp[0];
res.high = (HOST_WIDE_INT) vp[1];
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
res = res.ext (TYPE_PRECISION (type), TYPE_UNSIGNED (type));
if (mpz_sgn (val) < 0)
backport: As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html... Merge from cxx-conversion branch (http://gcc.gnu.org/wiki/cxx-conversion). As described in http://gcc.gnu.org/ml/gcc/2012-08/msg00015.html, this patch changes the default bootstrap process so that stage 1 always builds with a C++ compiler. Other than the bootstrap change, the patch makes no functional changes to the compiler. Everything should build as it does now in trunk. The main changes in this patch are: 1- Configuration changes. 2- Re-write of VEC. 3- Re-write of gengtype to support C++ templates and user-provided marking functions. 4- New hash table class. 5- Re-write double_int. 6- Implement tree macros as inline functions so they can be called from gdb. As discussed before, several of these changes do not fully change the call sites to use the new APIs. The bootstrap changes have already been tested on a wide range of targets (http://gcc.gnu.org/wiki/CppBuildStatus). Additionally, I have tested the merged trunk on: x86_64-unknown-linux-gnu, mips64el-unknown-linux-gnu, powerpc64-unknown-linux-gnu, i686-pc-linux-gnu, and ia64-unknown-linux-gnu. ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. * Makefile.tpl (STAGE[+id+]_CXXFLAGS): Remove POSTSTAGE1_CONFIGURE_FLAGS. * Makefile.in: Regenerate. * configure.ac (ENABLE_BUILD_WITH_CXX): Remove. Update all users. Force C++ when bootstrapping. * configure: Regenerate. libcpp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * Makefile.in: Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure.ac: Likewise. * configure: Regenerate. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. New C++ hash table. * include/symtab.h (typedef struct ht hash_table): Change the typedef name to cpp_hash_table. Update all users of the typedef. gcc/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * configure.ac (CXX_FOR_BUILD): Define and substitute. (BUILD_CXXFLAGS): Define. Remove all handlers of ENABLE_BUILD_WITH_CXX. Force all build to be with C++. * Makefile.in (BUILD_CXXFLAGS): Use it. Remove all handlers of ENABLE_BUILD_WITH_CXX. * configure: Regenerate. * config.in: Regenerate. * doc/install.texi: Remove documentation for --enable-build-with-cxx and --enable-build-poststage1-with-cxx. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-implement VEC in C++. * vec.c (vec_heap_free): Convert into a template function. (vec_gc_o_reserve_1): Make extern. (vec_gc_p_reserve): Remove. (vec_gc_p_reserve_exact): Remove. (vec_gc_o_reserve): Remove. (vec_gc_o_reserve_exact): Remove. (vec_heap_o_reserve_1): Make extern. (vec_heap_p_reserve): Remove. (vec_heap_p_reserve_exact): Remove. (vec_heap_o_reserve): Remove. (vec_heap_o_reserve_exact): Remove. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. * vec.h (VEC_CHECK_INFO, VEC_CHECK_DECL, VEC_CHECK_PASS, VEC_ASSERT, VEC_ASSERT_FAIL, vec_assert_fail): Move earlier in the file. (VEC): Define to vec_t<T>. (vec_allocation_t): Define. (struct vec_prefix): Move earlier in the file. (vec_t<T>): New template. (DEF_VEC_I, DEF_VECL_ALLOC_I, DEF_VEC_P, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_P, DEF_VEC_O, DEF_VEC_ALLOC_O, DEF_VEC_ALLOC_P_STACK, DEF_VEC_ALLOC_O_STACK, DEF_VEC_ALLOC_I_STACK): Expand to 'struct vec_swallow_trailing_semi'. (DEF_VEC_A): Provide template instantiations for GC/PCH markers that do not traverse the vector. (vec_stack_p_reserve): Remove. (vec_stack_p_reserve_exact): Remove. (vec_stack_p_reserve_exact_1): Remove. (vec_stack_o_reserve): Remove. (vec_stack_o_reserve_exact): Remove. (vec_stack_free): Re-write as a template function. (vec_reserve): New template function. (vec_reserve_exact): New template function. (vec_heap_free): New template function if GATHER_STATISTICS is defined. Otherwise, macro that expands to free(). (VEC_length_1): New template function. (VEC_length): Call it. (VEC_empty_1): New template function. (VEC_empty): Call it. (VEC_address_1): New template function. (VEC_address): Call it. (VEC_last_1): New template function. (VEC_last): Call it. Change return type to T&. Change all users that used VEC_Os. (VEC_index_1): New template function. (VEC_index): Call it. Return a T& instead of a T*. Update all callers that were using VEC_O before. (VEC_iterate_1): New template function. (VEC_iterate): Call it. (VEC_embedded_size_1): New template function. (VEC_embedded_size): Call it. (VEC_embedded_init_1): New template function. (VEC_embedded_init): Call it. (VEC_alloc_1): New template function. (VEC_alloc): Call it. If A is 'stack', call XALLOCAVAR to do the allocation. (VEC_free_1): New template function. (VEC_free): Call it. (VEC_copy_1): New template function. (VEC_copy): Call it. (VEC_space_1): New template function (VEC_space): Call it. (VEC_reserve_1): New template function. (VEC_reserve): Call it. (VEC_reserve_exact_1): New template function. (VEC_reserve_exact): Call it. (VEC_splice_1): New template function. (VEC_splice): Call it. (VEC_safe_splice_1): New template function. (VEC_safe_splice): Call it. (VEC_quick_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_quick_push): Call it. (VEC_safe_push_1): New template function. Create two overloads, one accepting T, the other accepting T *. Update all callers where T and T * are ambiguous. (VEC_safe_push): Call it. (VEC_pop_1): New template function. (VEC_pop): Call it. (VEC_truncate_1): New template function. (VEC_truncate): Call it. (VEC_safe_grow_1): New template function. (VEC_safe_grow): Call it. (VEC_safe_grow_cleared_1): New template function. (VEC_safe_grow_cleared): Call it. (VEC_replace_1): New template function. (VEC_replace): Call it. Always accept T instead of T*. Update all callers that used VEC_Os. (VEC_quick_insert_1): New template function. (VEC_quick_insert): Call it. (VEC_safe_insert_1): New template function. (VEC_safe_insert): Call it. (VEC_ordered_remove_1): New template function. (VEC_ordered_remove): Call it. (VEC_unordered_remove_1): New template function. (VEC_unordered_remove): Call it. (VEC_block_remove_1): New template function. (VEC_block_remove): Call it. (VEC_lower_bound_1): New template function. (VEC_lower_bound): Call it. (VEC_OP): Remove. (DEF_VEC_FUNC_P): Remove. (DEF_VEC_ALLOC_FUNC_P): Remove. (DEF_VEC_NONALLOC_FUNCS_P): Remove. (DEF_VEC_FUNC_O): Remove. (DEF_VEC_ALLOC_FUNC_O): Remove. (DEF_VEC_NONALLOC_FUNCS_O): Remove. (DEF_VEC_ALLOC_FUNC_I): Remove. (DEF_VEC_NONALLOC_FUNCS_I): Remove. (DEF_VEC_ALLOC_FUNC_P_STACK): Remove. (DEF_VEC_ALLOC_FUNC_O_STACK): Remove. (DEF_VEC_ALLOC_FUNC_I_STACK): Remove. (vec_reserve_exact): New template function. * gengtype-lex.l (DEF_VEC_ALLOC_[IOP]/{EOID}): Remove. * gengtype-parse.c (token_names): Remove DEF_VEC_ALLOC_[IOP]. (typedef_name): Emit vec_t<C1> instead of VEC_C1_C2. (def_vec_alloc): Remove. Update all callers. * gengtype.c (filter_type_name): New. (output_mangled_typename): Call it. (write_func_for_structure): Likewise. (write_types): Likewise. (write_root): Likewise. (write_typed_alloc_def): Likewise. (note_def_vec): Emit vec_t<TYPE_NAME> instead of VEC_TYPE_NAME_base. (note_def_vec_alloc): Remove. * gengtype.h (note_def_vec_alloc): Remove. (DEFVEC_ALLOC): Remove token code. * df-scan.c (df_bb_verify): Remove call to df_free_collection_rec inside the insn traversal loop. * gimplify.c (gimplify_compound_lval): Rename STACK to EXPR_STACK. * ipa-inline.c (inline_small_functions): Rename HEAP to EDGE_HEAP. * reg-stack.c (stack): Rename to STACK_PTR. Update all users. * tree-vrp.c (stack): Rename to EQUIV_STACK. Update all users. * config/bfin/bfin.c (hwloop_optimize): Update some calls to VEC_* for vectors of non-pointers. * config/c6x/c6x.c (try_rename_operands): Likewise. (reshuffle_units): Likewise. * config/mips/mips.c (mips_multi_start): Likewise. (mips_multi_add): Likewise. (mips_multi_copy_insn): Likewise. (mips_multi_set_operand): Likewise. * hw-doloop.c (discover_loop): Likewise. (discover_loops): Likewise. (reorg_loops): Likewise. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. C++ support in gengtype. * coretypes.h (gt_pointer_operator): Move from ... * ggc.h: ... here. * doc/gty.texi: Document support for C++ templates and user-provided markers. * gcc/gengtype-lex.l: Update copyright year. Remove support for recognizing DEF_VEC_O, DEF_VEC_P and DEFVEC_I. * gengtype-parse.c: Update copyright year. (token_names): Remove DEF_VEC_O, DEF_VEC_P and DEF_VEC_I. (require_template_declaration): New. (typedef_name): Call it. (type): Replace IS_UNION with KIND. Replace all users. (def_vec): Remove. Update all users. * gengtype-state.c (type_lineloc): Handle TYPE_USER_STRUCT. (write_state_user_struct_type): New. (write_state_type): Call it. (read_state_user_struct_type): New. (read_state_type): Call it. * gengtype.c: Update copyright year. (dump_pair): Move declaration to the top. (dump_type): Likewise. (dump_type_list): Likewise. (dbgprint_count_type_at): Handle TYPE_USER_STRUCT. (create_user_defined_type): New. (resolve_typedef): Call it. (new_structure): Replace argument ISUNION with KIND. Change users to refer to KIND directly. Update all callers. (find_structure): Likewise. (set_gc_used_type): Handle TYPE_USER_STRUCT. (create_file): Update HDR to include new copyright year. (struct walk_type_data): Add field IN_PTR_FIELD. (output_mangled_typename): Handle TYPE_USER_STRUCT. (walk_type): Set D->IN_PTR_FIELD when walking a TYPE_POINTER. Clear it afterwards. Handle TYPE_USER_STRUCT. (write_types_process_field): Handle TYPE_USER_STRUCT. (get_type_specifier): Move earlier in the file. (write_type_decl): New. (write_marker_function_name): New. (write_user_func_for_structure_ptr): New. (write_user_func_for_structure_body): New. (write_user_marking_functions): New. (write_func_for_structure): Call write_marker_function_name and write_type_decl. Do not call walk_type for TYPE_USER_STRUCT. Emit a call to the user function directly. Call write_user_marking_functions on TYPE_USER_STRUCTs. (write_types_local_user_process_field): New. (write_pch_user_walking_for_structure_body): New. (write_pch_user_walking_functions): New. (write_types_local_process_field): Handle TYPE_USER_STRUCT. (write_local_func_for_structure): Do not call walk_type for TYPE_USER_STRUCT. Instead, emit the call to gt_pch_nx directly. Call write_pch_user_walking_functions for TYPE_USER_STRUCTs. (write_root): Handle TYPE_USER_STRUCT. (vec_prefix_type): Remove. Update all users. (note_def_vec): Remove. Update all users. (dump_typekind): Handle TYPE_USER_STRUCT. (dump_type): Initialize SEEN_TYPES, if needed. Handle TYPE_USER_STRUCT. (dump_everything): Do not initialize SEEN_TYPES. * gengtype.h: Update copyright year. (enum typekind): Add TYPE_USER_STRUCT. (union_or_struct_p): Rename from UNION_OR_STRUCT_P. Convert into function. Add an overload taking const_type_p. Update all callers. (new_structure): Change second field to type enum typekind. Update all users. (find_structure): Likewise. (note_def_vec): Remove. (DEFVEC_OP): Remove. (DEFVEC_I): Remove. * ggc-page.c (gt_ggc_mx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. * ggc-zone.c (gt_ggc_mx): Add entry points for marking 'const char *&' and 'unsigned char *&'. * stringpool.c (gt_pch_nx): Add entry points for marking 'const char *&', 'unsigned char *&' and 'unsigned char&'. Add an entry point for the overload taking arguments 'unsigned char *', 'gt_pointer_operator' and 'void *'. * vec.h (struct vec_prefix): Remove GTY marker. (struct vec_t): Remove GTY((length)) attribute from field 'vec'. (gt_ggc_mx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T> *)): New template function. (gt_pch_nx (vec_t<T *> *, gt_pointer_operator, void *)): New template function. (gt_pch_nx (vec_t<T> *, gt_pointer_operator, void *)): New template function. * basic-block.h (struct edge_def): Mark GTY((user)). Remove all GTY markers from fields. (gt_ggc_mx): Declare. (gt_pch_nx): Declare. * tree-cfg.c (gt_ggc_mx): New. (gt_pch_nx): New. * gengtype-lex.l (USER_GTY): Add pattern for "user". * gengtype-parse.c (option): Handle USER_GTY. (opts_have): New. (type): Call it. If the keyword 'user' is used, do not walk the fields of the structure. * gengtype.h (USER_GTY): Add. * doc/gty.texi: Update. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Implement C++ hash table. * hash-table.h: New. Implementation borrowed from libiberty/hashtab.c. * hash-table.c: Likewise. * tree-ssa-tail-merge.c: Include hash-table.h instead of hashtab.h. (static htab_t same_succ_htab): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (same_succ_print_traverse): Make extern ssa_.... Change callers. Remove void* casting. (same_succ_hash): Likewise. (same_succ_equal): Likewise. (same_succ_delete): Likewise. * tree-ssa-threadupdate.c: Include hash-table.h. (struct local_info): Rename to ssa_local_info_t to avoid overloading the type name local_info with the variable name local_info. (static htab_t redirection_data): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (redirection_data_hash): Make extern ssa_.... Change callers. Remove void* casting. (redirection_data_eq): Likewise. (fix_duplicate_block_edges): Likewise. (create_duplicates): Likewise. (fixup_template_block): Likewise. (redirect_edges): Likewise. (lookup_redirection_data): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. * tree-ssa-ccp.c: Include hash-table.h. (typedef gimple_htab): New. Uses hash_table. Replace specific uses of htab_t with gimple_htab. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * tree-ssa-coalesce.c: Include hash-table.h instead of hashtab.h. (hash_ssa_name_by_var): Make extern. Remove void* casting. (eq_ssa_name_by_var): Likewise. (coalesce_ssa_name): Change type of local static htab_t ssa_name_hash to hash_table. Change users to invoke member functions. Move specification of helper functions from create call to declaration. * coverage.c: Include hash-table.h instead of hashtab.h. (static htab_t counts_hash): Change type to hash_table; move specification of helper functions from create call to declaration. Change users to invoke member functions. (htab_counts_entry_hash): Make extern. Rename with coverage_... instead of htab_... Remove void* casting. (htab_counts_entry_eq): Likewise. (htab_counts_entry_del): Likewise. * tree-ssa-pre.c: Include hash-table.h instead of hashtab.h. (static htab_t expression_to_id): Change type to hash_table. Move specification of helper functions from create call to declaration. Change users to invoke member functions. (static htab_t phi_translate_table): Likewise. (pre_expr_eq): Make extern ssa_.... Change callers. Remove void* casting. (pre_expr_hash): Likewise. (expr_pred_trans_hash): Likewise. (expr_pred_trans_eq): Likewise. (alloc_expression_id): Change types associated with the hash table from void* to their actual type. Remove unnecessary casts. (lookup_expression_id): Likewise. (phi_trans_lookup): Likewise. (phi_trans_add): Likewise. * stringpool.c: Rename uses of libcpp typedef hash_table to cpp_hash_table. * Makefile.in: Add hash-table.o to OBJS-libcommon-target. Add $(HASH_TABLE_H). Add new dependences on $(HASH_TABLE_H). 2012-08-14 Lawrence Crowl <crowl@google.com> Merge from cxx-conversion branch. Re-write double_int in C++. * hash-table.h (typedef double_int): Change to struct (POD). (double_int::make): New overloads for int to double-int conversion. (double_int::mask): New. (double_int::max_value): New. (double_int::min_value): New. (double_int::operator ++): New. (double_int::operator --): New. (double_int::operator *=): New. (double_int::operator +=): New. (double_int::operator -=): New. (double_int::to_signed): New. (double_int::to_unsigned): New. (double_int::fits_unsigned): New. (double_int::fits_signed): New. (double_int::fits): New. (double_int::trailing_zeros): New. (double_int::popcount): New. (double_int::multiple_of): New. (double_int::set_bit): New. (double_int::mul_with_sign): New. (double_int::operator * (binary)): New. (double_int::operator + (binary)): New. (double_int::operator - (binary)): New. (double_int::operator - (unary)): New. (double_int::operator ~ (unary)): New. (double_int::operator & (binary)): New. (double_int::operator | (binary)): New. (double_int::operator ^ (binary)): New. (double_int::and_not): New. (double_int::lshift): New. (double_int::rshift): New. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::lrotate): New. (double_int::rrotate): New. (double_int::div): New. (double_int::sdiv): New. (double_int::udiv): New. (double_int::mod): New. (double_int::smod): New. (double_int::umod): New. (double_int::divmod): New. (double_int::sdivmod): New. (double_int::udivmod): New. (double_int::ext): New. (double_int::zext): New. (double_int::sext): New. (double_int::is_zero): New. (double_int::is_one): New. (double_int::is_minus_one): New. (double_int::is_negative): New. (double_int::cmp): New. (double_int::ucmp): New. (double_int::scmp): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int::max): New. (double_int::smax): New. (double_int::umax): New. (double_int::min): New. (double_int::smin): New. (double_int::umin): New. (double_int::operator ==): New. (double_int::operator !=): New. (shwi_to_double_int): Change implementation to use member function. (double_int_minus_one): Likewise. (double_int_zero): Likewise. (double_int_one): Likewise. (double_int_two): Likewise. (double_int_ten): Likewise. (uhwi_to_double_int): Likewise. (double_int_to_shwi): Likewise. (double_int_to_uhwi): Likewise. (double_int_fits_in_uhwi_p): Likewise. (double_int_fits_in_shwi_p): Likewise. (double_int_fits_in_hwi_p): Likewise. (double_int_mul): Likewise. (double_int_mul_with_sign): Likewise. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_multiple_of): Likewise. (double_int_setbit): Likewise. (double_int_ctz): Likewise. (double_int_not): Likewise. (double_int_ior): Likewise. (double_int_and): Likewise. (double_int_and_not): Likewise. (double_int_xor): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_scmp): Likewise. (double_int_ucmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_ext): Likewise. (double_int_sext): Likewise. (double_int_zext): Likewise. (double_int_mask): Likewise. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_zero_p): Likewise. (double_int_one_p): Likewise. (double_int_minus_one_p): Likewise. (double_int_equal_p): Likewise. (double_int_popcount): Likewise. * hash-table.c (double_int_mask): Reuse implementation for double_int::mask. (double_int_max_value): Likewise. (double_int_min_value): Likewise. (double_int_ext): Likewise. (double_int_zext): Likewise. (double_int_sext): Likewise. (double_int_mul_with_sign): Likewise. (double_int_divmod): Likewise. (double_int_sdivmod): Likewise. (double_int_udivmod): Likewise. (double_int_div): Likewise. (double_int_sdiv): Likewise. (double_int_udiv): Likewise. (double_int_mod): Likewise. (double_int_smod): Likewise. (double_int_umod): Likewise. (double_int_multiple_of): Likewise. (double_int_lshift): Likewise. (double_int_rshift): Likewise. (double_int_lrotate): Likewise. (double_int_rrotate): Likewise. (double_int_cmp): Likewise. (double_int_ucmp): Likewise. (double_int_scmp): Likewise. (double_int_max): Likewise. (double_int_smax): Likewise. (double_int_umax): Likewise. (double_int_min): Likewise. (double_int_smin): Likewise. (double_int_umin): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int_min): Likewise. (double_int::alshift): New. (double_int::arshift): New. (double_int::llshift): New. (double_int::lrshift): New. (double_int::ult): New. (double_int::ugt): New. (double_int::slt): New. (double_int::sgt): New. (double_int_setbit): Reuse implementation for double_int::set_bit, which avoids a name conflict with a macro. (double_int_double_int_ctz): Reuse implementation for double_int::trailing_zeros. (double_int_fits_in_shwi_p): Reuse implementation for double_int::fits_signed. (double_int_fits_in_hwi_p): Reuse implementation for double_int::fits. (double_int_mul): Reuse implementation for binary double_int::operator *. (double_int_add): Likewise. (double_int_sub): Likewise. (double_int_neg): Reuse implementation for unary double_int::operator -. (double_int_max_value): Likewise. * fixed-value.c: Change to use member functions introduced above. 2012-08-14 Lawrence Crowl <crowl@google.com> Merge cxx-conversion branch. Support tree macro calling from gdb. * tree.h (tree_check): New. (TREE_CHECK): Use inline function above instead of __extension__. (tree_not_check): New. (TREE_NOT_CHECK): Use inline function above instead of __extension__. (tree_check2): New. (TREE_CHECK2): Use inline function above instead of __extension__. (tree_not_check2): New. (TREE_NOT_CHECK2): Use inline function above instead of __extension__. (tree_check3): New. (TREE_CHECK3): Use inline function above instead of __extension__. (tree_not_check3): New. (TREE_NOT_CHECK3): Use inline function above instead of __extension__. (tree_check4): New. (TREE_CHECK4): Use inline function above instead of __extension__. (tree_not_check4): New. (TREE_NOT_CHECK4): Use inline function above instead of __extension__. (tree_check5): New. (TREE_CHECK5): Use inline function above instead of __extension__. (tree_not_check5): New. (TREE_NOT_CHECK5): Use inline function above instead of __extension__. (contains_struct_check): New. (CONTAINS_STRUCT_CHECK): Use inline function above instead of __extension__. (tree_class_check): New. (TREE_CLASS_CHECK): Use inline function above instead of __extension__. (tree_range_check): New. (TREE_RANGE_CHECK): Use inline function above instead of __extension__. (omp_clause_subcode_check): New. (OMP_CLAUSE_SUBCODE_CHECK): Use inline function above instead of __extension__. (omp_clause_range_check): New. (OMP_CLAUSE_RANGE_CHECK): Use inline function above instead of __extension__. (expr_check): New. (EXPR_CHECK): Use inline function above instead of __extension__. (non_type_check): New. (NON_TYPE_CHECK): Use inline function above instead of __extension__. (tree_vec_elt_check): New. (TREE_VEC_ELT_CHECK): Use inline function above instead of __extension__. (omp_clause_elt_check): New. (OMP_CLAUSE_ELT_CHECK): Use inline function above instead of __extension__. (tree_operand_check): New. (TREE_OPERAND_CHECK): Use inline function above instead of __extension__. (tree_operand_check_code): New. (TREE_OPERAND_CHECK_CODE): Use inline function above instead of __extension__. (TREE_CHAIN): Simplify implementation. (TREE_TYPE): Simplify implementation. (tree_operand_length): Move for compilation dependences. * gdbinit.in: (macro define __FILE__): New. (macro define __LINE__): New. (skip "tree.h"): New. gcc/cp/ChangeLog 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Re-write VEC in C++. * call.c (add_function_candidate): Remove const qualifier from call to VEC_index. 2012-08-14 Diego Novillo <dnovillo@google.com> Merge from cxx-conversion branch. Configury. * go-c.h: Remove all handlers of ENABLE_BUILD_WITH_CXX. * go-gcc.cc: Likewise. * go-system.h: Likewise. From-SVN: r190402
2012-08-15 03:56:07 +02:00
res = -res;
return res;
}