40e2396121
2015-01-09 Michael Collison <michael.collison@linaro.org> * genattrtab.c (write_header): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-attrtab.c. * genautomata.c (main) : Include hash-set.h, macInclude hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-automata.c. * genemit.c (main): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-emit.c. * gengtype.c (open_base_files): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating gtype-desc.c. * genopinit.c (main): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-opinit.c. * genoutput.c (output_prologue): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-output.c. * genpeep.c (main): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-peep.c. * genpreds.c (write_insn_preds_c): Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating insn-preds.c. * optc-save-gen-awk: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h when generating options-save.c. * opth-gen.awk: Change include guard from GCC_C_COMMON_H to GCC_C_COMMON_C when generating options.h. * ada/gcc-interface/cuintp.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ada/gcc-interface/decl.c: ditto. * ada/gcc-interface/misc.c: ditto. * ada/gcc-interface/targtyps.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ada/gcc-interface/trans.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, real.h, fold-const.h, wide-int.h, inchash.h due to flattening of tree.h. * ada/gcc-interface/utils.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ada/gcc-interface/utils2.c: ditto. * alias.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * asan.c: ditto. * attribs.c: ditto. * auto-inc-dec.c: ditto. * auto-profile.c: ditto * bb-reorder.c: ditto. * bt-load.c: Include symtab.h due to flattening of tree.h. * builtins.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * c/c-array-notation.c: ditto. * c/c-aux-info.c: ditto. * c/c-convert.c: ditto. * c/c-decl.c: ditto. * c/c-errors.c: ditto. * c/c-lang.c: dittoxs. * c/c-objc-common.c: ditto. * c/c-parser.c: ditto. * c/c-typeck.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, inchash.h, real.h and fixed-value.h due to flattening of tree.h. * calls.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ccmp.c: ditto. * c-family/array-notation-common.c: ditto. * c-family/c-ada-spec.c: ditto. * c-family/c-cilkplus.c: ditto. * c-family/c-common.c: Include input.h due to flattening of tree.h. Define macro GCC_C_COMMON_C. * c-family/c-common.h: Flatten tree.h header files into c-common.h. Remove include of tree-core.h. * c-family/c-cppbuiltin.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * c-family/c-dump.c: ditto. * c-family/c-format.c: Flatten tree.h header files into c-common.h. * c-family/c-cppbuiltin.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * c-family/c-dump.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * c-family/c-format.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * c-family/c-gimplify.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * c-family/cilk.c: ditto. * c-family/c-lex.c: ditto. * c-family/c-omp.c: ditto. * c-family/c-opts.c: ditto. * c-family/c-pch.c: ditto. * c-family/c-ppoutput.c: ditto. * c-family/c-pragma.c: ditto. * c-family/c-pretty-print.c: ditto. * c-family/c-semantics.c: ditto. * c-family/c-ubsan.c: ditto. * c-family/stub-objc.c: ditto. * cfgbuild.c: ditto. * cfg.c: ditto. * cfgcleanup.c: ditto. * cfgexpand.c: ditto. * cfghooks.c: ditto. * cfgloop.c: Include symtab.h, fold-const.h, and inchash.h due to flattening of tree.h. * cfgloopmanip.c: ditto. * cfgrtl.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * cgraphbuild.c: ditto. * cgraph.c: ditto. * cgraphclones.c: ditto. * cgraphunit.c: ditto. * cilk-common.c: ditto. * combine.c: ditto. * combine-stack-adj.c: Include symbol.h due to flattening of tree.h. * config/aarch64/aarch64-builtins.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/aarch64/aarch64.c: ditto. * config/alpha/alpha.c: ditto. * config/arc/arc.c: ditto. * config/arm/aarch-common.c: ditto. * config/arm/arm-builtins.c: ditto. * config/arm/arm.c: ditto. * config/arm/arm-c.c: ditto. * config/avr/avr.c: ditto. * config/avr/avr-c.c: ditto. * config/avr/avr-log.c: ditto. * config/bfin/bfin.c: ditto. * config/c6x/c6x.c: ditto. * config/cr16/cr16.c: ditto. * config/cris/cris.c: ditto. * config/darwin.c: ditto. * config/darwin-c.c: ditto. * config/default-c.c: ditto. * config/epiphany/epiphany.c: ditto. * config/fr30/fr30.c: ditto. * config/frv/frv.c: ditto. * config/glibc-c.c: ditto. * config/h8300/h8300.c: ditto. * config/i386/i386.c: ditto. * config/i386/i386-c.c: ditto. * config/i386/msformat.c: ditto. * config/i386/winnt.c: ditto. * config/i386/winnt-cxx.c: ditto. * config/i386/winnt-stubs.c: ditto. * config/ia64/ia64.c: ditto. * config/ia64/ia64-c.c: ditto. * config/iq2000/iq2000.c: ditto. * config/lm32/lm32.c: Include symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/m32c/m32c.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/m32c/m32c-pragma.c: ditto. * config/m32c/m32cr.c: ditto. * config/m68/m68k.c: ditto. * config/mcore/mcore.c: ditto. * config/mep/mep.c: ditto. * config/mep/mep-pragma.c: ditto. * config/microblaze/microblaze.c: ditto. * config/microblaze/microblaze-c.c: ditto. * config/mips/mips.c: ditto. * config/mmix/mmix.c: Include symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/mn10300/mn10300.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/moxie/moxie.c: ditto. * config/msp430/msp430.c: ditto. * config/msp430/msp430-c.c: ditto. * config/nds32/nds32.c: ditto. * config/nds32/nds32-cost.c: ditto. * config/nds32/nds32-fp-as-gp.c: ditto. * config/nds32/nds32-intrinsic.c: ditto. * config/nds32/nds32-isr.c: ditto. * config/nds32/nds32-md-auxillary.c: ditto. * config/nds32/nds32-memory-manipulationx.c: ditto. * config/nds32/nds32-pipelines-auxillary.c: ditto. * config/nds32/nds32-predicates.c: ditto. * config/nios2/nios2.c: ditto. * config/nvptx/nvptx.c: ditto. * config/pa/pa.c: ditto. * config/pdp11/pdp11x.c: Include symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/rl78/rl78.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/rl78/rl78-cx.c: ditto. * config/rs6000/rs6000.c: ditto. * config/rs6000/rs6000-c.c: ditto. * config/rx/rx.c: ditto. * config/s390/s390.c: ditto. * config/sh/sh.c: ditto. * config/sh/sc.c: ditto. * config/sh/sh-mem.cc: ditto. * config/sh/sh_treg_combine.cc: Include symtab.h, inchash.h and tree.h due to flattening of tree.h. Remove include of tree-core.h. * config/sol2.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/sol2-c.c: ditto. * config/sol2-cxx.c: ditto. * config/sol2-stubs.c: ditto. * config/sparc/sparc.c: ditto. * config/sparc/sparc-cx.c: ditto. * config/spu/spu.c: ditto. * config/spu/spu-c.c: ditto * config/storym16/stormy16.c: ditto. * config/tilegx/tilegx.c: Include symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/tilepro/gen-mul-tables.cc: Include symtab.h in generated file. * config/tilegx/tilegx-c.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/tilepro/tilepro.c: Include symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/tilepro/tilepro-c.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * config/v850/v850.c: ditto. * config/v850/v850-c.c: ditto. * config/vax/vax.c: ditto. * config/vms/vms.c: ditto. * config/vms/vms-c.c: ditto. * config/vxworks.c: ditto. * config/winnt-c.c: ditto. * config/xtensa/xtensa.c: Include symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * convert.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * coverage.c: ditto. * cp/call.c: ditto. * cp/class.c: ditto. * cp/constexpr.c: ditto. * cp/cp-array-notation.c: ditto. * cp/cp-gimplify.c: ditto. * cp/cp-lang.c: ditto. * cp/cp-objcp-common.c: ditto. * cp/cvt.c: ditto. * cp/decl2.c: ditto. * cp/decl.c: ditto. * cp/dump.c: ditto. * cp/error.c: ditto. * cp/except.c: ditto. * cp/expr.c: ditto. * cp/friend.c: ditto. * cp/init.c: ditto. * cp/lambda.c: ditto. * cp/lex.c: ditto. * cp/mangle.c: ditto. * cp/name-lookup.c: ditto. * cp/optimize.c: ditto. * cp/parser.c: ditto. * cp/pt.c: ditto. * cp/ptree.c: ditto. * cp/repo.c: ditto. * cp/rtti.c: ditto. * cp/search.c: ditto. * cp/semantics.c: ditto. * cp/tree.c: ditto. * cp/typeck2.c: ditto. * cp/typeck.c: ditto. * cppbuiltin.c: ditto. * cprop.c: ditto. * cse.c: Add include of symtab.h due to flattening of tree.h. * cselib.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * data-streamer.c: ditto. * data-streamer-in.c: ditto. * data-streamer-out.c: ditto. * dbxout.c: ditto. * dce.c: ditto. * ddg.c: Add include of symtab.h due to flattening of tree.h. * debug.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * dfp.c: ditto. * df-scan.c: ditto. * dojump.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * double-int.c: ditto. * dse.c: ditto. * dumpfile.c: ditto. * dwarf2asm.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * dwarf2cfi.c: ditto. * dwarf2out.c: ditto. * emit-rtl.c: ditto. * except.c: ditto. * explow.c: ditto. * expmed.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * expr.c: ditto. * final.c: ditto. * fixed-value.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and fixed-value.h due to flattening of tree.h. * fold-const.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. Relocate inline function convert_to_ptrofftype_loc from tree.h. Relocate inline function fold_build_pointer_plus_loc from tree.h. Relocate inline function fold_build_pointer_plus_hwi_loc from tree.h. * fold-const.h: Relocate macro convert_to_ptrofftype from tree.h. Relocate macro fold_build_pointer_plus to relocate from tree.h.h. Relocate macro fold_build_pointer_plus_hwi from tree.h. Add prototype for convert_to_ptrofftype_loc relocated from tree.h. Add prototype for fold_build_pointer_plus_loc relocated from tree.h. Add prototype for fold_build_pointer_plus_hwi_loc relocated from tree.h. * fortran/convert.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/cpp.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/decl.c: ditto. * fortran/f95.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/iresolve.c: ditto. * fortran/match.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/module.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/options.c: ditto. * fortran/target-memory.c: Include hash-set.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/trans-array.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/trans.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/trans-common.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/trans-const.c: ditto. * fortran/trans-decl.c: ditto. * fortran/trans-expr.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/trans-intrinsic.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * fortran/trans-io.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * fortran/trans-openmp.c: ditto. * fortran/trans-stmt.c: ditto. * fortran/trans-types.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * function.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * gcc-plugin.h: Include statistics.h, double-int.h, real.h, fixed-value.h, alias.h, flags.h, and symtab.h due to flattening of tree.h * gcse.c: ditto. * generic-match-head.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ggc-page.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * gimple-builder.c: ditto. * gimple.c: ditto. * gimple-expr.c: ditto. * gimple-fold.c: ditto. * gimple-iterator.c: ditto. * gimple-low.c: ditto. * gimple-match-head.c: ditto. * gimple-pretty-print.c: ditto. * generic-ssa-isolate-paths.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * gimple-ssa-strength-reduction.c: ditto. * gimple-streamer-in.c: ditto. * gimple-streamer-out.c: ditto. * gimple-walk.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * gimplify.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * gimplify-me.c: ditto. * go/go-gcc.cc: ditto. * go/go-lang.c: ditto. * go/gdump.c: ditto. * graphite-blocking.c: ditto. * graphite.c: ditto. * graphite-dependencies.c: ditto. * graphite-interchange.c: ditto. * graphite-isl-ast-to-gimple.c: ditto. * graphite-optimize-isl.c: ditto. * graphite-poly.c: ditto. * graphite-scop-detection.c: ditto. * graphite-sese-to-poly.c: ditto. * hw-doloop.c: Include symtab.h due to flattening of tree.h. * ifcvt.c: ditto. * init-regs.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * internal-fc.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h,options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa.c: ditto. * ipa-chkp.c: ditto. * ipa-comdats.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-cp.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h,options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-devirt.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-icf.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h,options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-icf-gimple.c: ditto. * ipa-inline-analysis.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-inline.c: ditto. * ipa-inline-transform.c: ditto. * ipa-polymorhpic-call.c: ditto. * ipa-profile.c: ditto. * ipa-prop.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-pure-const.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-ref.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ipa-reference.c: ditto. * ipa-split.c: ditto. * ipa-utils.c: ditto. * ipa-visbility.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ira.c: ditto. * ira-color.c: Include hash-set.h due to flattening of tree.h. * ira-costs.c: ditto. * ira-emit.c: ditto. * java/boehm.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * java/builtins.c: ditto. * java/class.c: ditto. * java/constants.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * java/decl.c: ditto. * java/except.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * java/expr.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h,inchash.h and real.h due to flattening of tree.h. * java/gimplify.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * java/jcf-dump.c: ditto. * java/jcf-io.c: ditto. * java/jcf-parse.c: ditto. * java/jvgenmain.c: ditto. * java/lang.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * java/mangle.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * java/mangle_name.c: ditto. * java/resource.c: ditto. * java/typeck.c: ditto. * java/verify-glue.c: ditto. * java/verify-impl.c: ditto. * jump.c: Include symtab.h due to flattening of tree.h. * langhooks.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * loop-doloop.c: Include symtab.h due to flattening of tree.h. * loop-init.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * loop-invariant.c: Include symtab.h due to flattening of tree.h. * loop-iv.c: ditto. * loop-unroll.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lower-subreg.c: ditto. * lra-assigns.c: Include symtab.h due to flattening of tree.h. * lra.c: Include symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * lra-coalesce.c: Include symtab.h due to flattening of tree.h. * lra-constraints.c: ditto. * lra-eliminations.c: ditto. * lra-livesc: ditto. * lra-remat.c: ditto. * lra-spills.c: ditto. * lto/lto.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lto/lto-lang.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lto/lto-object.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lto/lto-partition.c: ditto. * lto/lto-symtab.c: ditto. * lto-cgraph.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lto-compress.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lto-opts.c: ditto. * lto-section-in.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * lto-section-out.c: ditto. * lto-streamer.c: ditto. * lto-streamer-in.c: ditto. * lto-streamer-out.c: ditto. * modulo-sched.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * objc/objc-act.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * objc/objc-encoding.c: ditto. * objc/objc-gnu-runtime-abi-01.c: ditto. * objc/objc-lang.c: ditto. * objc/objc-map.c: ditto. * objc/objc-next-runtime-abi-01.c: ditto. * objc/objc-next-runtime-abi-02.c: ditto. * objc/objc-runtime-shared-support.c: ditto. * objcp/objcp-decl.c: ditto. * objcp/objcp-lang.c: ditto. * omega.c: ditto. * omega-low.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * optabs.c: ditto. * opts-global.c: ditto. * passes.c: ditto. * plugin.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * postreload.c: Include symtab.h due to flattening of tree.h. * postreload-gcse.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * predict.c: ditto. * print-rtl.c: ditto. * print-tree.c: ditto. * profile.c: Include symtab.h, fold-const.h and inchash.h due to flattening of tree.h. * real.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * realmpfr.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * recog.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * ree.c: ditto. * reginfo.c: ditto. * reg-stack.c: ditto. * reload1.c: Include symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * reload.c: Include symtab.h due to flattening of tree.h. * reorg.c: ditto. * rtlanal.c: Include symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * rtl-chkp.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * rtlhooks.c: Include symtab.h due to flattening of tree.h. * sanopt.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * sched-deps.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * sched-vis.c: ditto. * sdbout.c: ditto. * sel-sched.c: Include symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * sel-sched-ir.c: ditto. * sese.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * shrink-wrap.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * simplify-rtx.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * stack-ptr-mod.c: ditto. * stmt.c: ditto. * store-motion.c: ditto. * store-layout.c: ditto. * stringpool.c: ditto. * symtab.c: ditto. * target-globals.c: ditto. * targhooks.c: ditto. * toplev.c: ditto. * tracer.c: ditto. * trans-mem.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-affine.c: ditto. * tree-browser.c: ditto. * tree.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-call-cdce.c: Include symtab.h, alias.h, double-int.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * tree-cfg.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-cfgcleanup.c: ditto. * tree-chkp.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-chkp-opt.c: ditto. * tree-chrec.c: ditto. * tree-chkp-opt.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * tree-core.h: Flatten header file by removing all #include statements. * tree-data-ref.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-dfa.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * tree-diagnostic.c: ditto. * tree-dump.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h, real.h and fixed-value.h due to flattening of tree.h. * tree-dfa.c: ditto. * tree-eh.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * tree-emutls.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree.h: Flatten header files by removing all includes except tree-core.h. Remove inline function convert_to_ptrofftype_loc to relocate to fold-const.c. Remove macro convert_to_ptrofftype to relocate to fold-const.h. Remove inline function fold_build_pointer_plus_loc to relocate to fold-const.c. Remove macro fold_build_pointer_plus to relocate to fold-const.h. Remove inline function fold_build_pointer_plus_hwi_loc to relocate to fold-const.c. Remove macro fold_build_pointer_plus_hwi to relocate to fold-const.h. * tree-if-conv.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h, real.h and fixed-value.h due to flattening of tree.h. * tree-inline.c: ditto. * tree-into-ssa.c: ditto. * tree-iterator.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-loop-distribution.c: ditto. * tree-nested.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-nrv.c: ditto. * tree-object-size.c: ditto. * tree-outof-ssa.c: ditto. * tree-parloops.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-phinodes.c: ditto. * tree-predcom.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-pretty-print.c: ditto. * tree-profile.c: double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-scalar-evolution.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-sra.c: Include vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, and inchash.h due to flattening of tree.h. * tree-ssa-alias.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa.c: ditto. * tree-ssa-ccp.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * tree-ssa-coalesce.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-copy.c: ditto. * tree-ssa-copyrename.c: ditto. * tree-ssa-dce.c: ditto. * tree-ssa-dom.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h, inchash.h and real.h due to flattening of tree.h. * tree-ssa-dse.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-forwprop.c: ditto. * tree-ssa-ifcombine.c: ditto. * tree-ssa-live.c: ditto. * tree-ssa-loop.c: ditto. * tree-ssa-loop-ch.c: ditto. * tree-ssa-loop-im.c: ditto. * tree-ssa-loop-ivcanon.c: ditto. * tree-ssa-loop-ivopts.c: ditto. * tree-ssa-loop-manip.c: ditto. * tree-ssa-loop-niter.c: ditto. * tree-ssa-loop-prefetch.c: ditto. * tree-ssa-loop-unswitch.c: ditto. * tree-ssa-loop-math-opts.c: ditto. * tree-ssanames.c: ditto. * tree-ssa-operands.c: ditto. * tree-ssa-phiopt.c: ditto. * tree-ssa-phiprop.c: ditto. * tree-ssa-pre.c: ditto. * tree-ssa-propagate.c: ditto. * tree-ssa-reassoc.c: ditto. * tree-ssa-sccvn.c: ditto. * tree-ssa-sink.c: ditto. * tree-ssa-strlen.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-structalias.c: double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-tail-merge.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-ter.c: ditto. * tree-ssa-threadedge.c: ditto. * tree-ssa-threadupdate.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-uncprop.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-ssa-uninit.c: ditto. * tree-stdarg.c: Include vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-streamer.c: Include vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-streamer-in.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h, inchash.h, real.h and fixed-value.h due to flattening of tree.h. * tree-streamer-out.c: dittoo. * tree-switch-conversion.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-tailcall.c: ditto. * tree-vect-data-refs.c: ditto. * tree-vect-generic.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-vect-loop.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * tree-vect-loop-manip.c: ditto. * tree-vectorizer.c: ditto. * tree-vect-patterns.c: ditto. * tree-vect-slp.c: ditto. * tree-vect-stmts.c: ditto. * tree-vrp.c: ditto. * tsan.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * ubsan.c: ditto. * value-prof.c.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * varasm.c: ditto. * varpool.c: ditto. * var-tracking.c: ditto. * vmsdbgout.c: ditto. * vtable-verify.c: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * wide-int.cc: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. * xcoffout.c: ditto. * libcc1/plugin.cc: Include hash-set.h, machmode.h, vec.h, double-int.h, input.h, alias.h, symtab.h, options.h, fold-const.h, wide-int.h and inchash.h due to flattening of tree.h. From-SVN: r219402
925 lines
24 KiB
C++
925 lines
24 KiB
C++
/* Library interface to C front end
|
||
Copyright (C) 2014 Free Software Foundation, Inc.
|
||
|
||
This file is part of GCC.
|
||
|
||
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.
|
||
|
||
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.
|
||
|
||
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 <cc1plugin-config.h>
|
||
|
||
#undef PACKAGE_NAME
|
||
#undef PACKAGE_STRING
|
||
#undef PACKAGE_TARNAME
|
||
#undef PACKAGE_VERSION
|
||
|
||
#include "../gcc/config.h"
|
||
|
||
#undef PACKAGE_NAME
|
||
#undef PACKAGE_STRING
|
||
#undef PACKAGE_TARNAME
|
||
#undef PACKAGE_VERSION
|
||
|
||
#include "gcc-plugin.h"
|
||
#include "system.h"
|
||
#include "coretypes.h"
|
||
#include "stringpool.h"
|
||
|
||
#include "gcc-interface.h"
|
||
#include "hash-set.h"
|
||
#include "machmode.h"
|
||
#include "vec.h"
|
||
#include "double-int.h"
|
||
#include "input.h"
|
||
#include "alias.h"
|
||
#include "symtab.h"
|
||
#include "options.h"
|
||
#include "wide-int.h"
|
||
#include "inchash.h"
|
||
#include "tree.h"
|
||
#include "fold-const.h"
|
||
#include "stor-layout.h"
|
||
#include "c-tree.h"
|
||
#include "toplev.h"
|
||
#include "timevar.h"
|
||
#include "hash-table.h"
|
||
#include "tm.h"
|
||
#include "c-family/c-pragma.h"
|
||
#include "c-lang.h"
|
||
#include "diagnostic.h"
|
||
#include "langhooks.h"
|
||
#include "langhooks-def.h"
|
||
|
||
#include "callbacks.hh"
|
||
#include "connection.hh"
|
||
#include "rpc.hh"
|
||
|
||
#ifdef __GNUC__
|
||
#pragma GCC visibility push(default)
|
||
#endif
|
||
int plugin_is_GPL_compatible;
|
||
#ifdef __GNUC__
|
||
#pragma GCC visibility pop
|
||
#endif
|
||
|
||
|
||
|
||
// This is put into the lang hooks when the plugin starts.
|
||
|
||
static void
|
||
plugin_print_error_function (diagnostic_context *context, const char *file,
|
||
diagnostic_info *diagnostic)
|
||
{
|
||
if (current_function_decl != NULL_TREE
|
||
&& DECL_NAME (current_function_decl) != NULL_TREE
|
||
&& strcmp (IDENTIFIER_POINTER (DECL_NAME (current_function_decl)),
|
||
GCC_FE_WRAPPER_FUNCTION) == 0)
|
||
return;
|
||
lhd_print_error_function (context, file, diagnostic);
|
||
}
|
||
|
||
|
||
|
||
static unsigned long long
|
||
convert_out (tree t)
|
||
{
|
||
return (unsigned long long) (uintptr_t) t;
|
||
}
|
||
|
||
static tree
|
||
convert_in (unsigned long long v)
|
||
{
|
||
return (tree) (uintptr_t) v;
|
||
}
|
||
|
||
|
||
|
||
struct decl_addr_value
|
||
{
|
||
tree decl;
|
||
tree address;
|
||
};
|
||
|
||
struct decl_addr_hasher : typed_free_remove<decl_addr_value>
|
||
{
|
||
typedef decl_addr_value value_type;
|
||
typedef decl_addr_value compare_type;
|
||
|
||
static inline hashval_t hash (const value_type *);
|
||
static inline bool equal (const value_type *, const compare_type *);
|
||
};
|
||
|
||
inline hashval_t
|
||
decl_addr_hasher::hash (const value_type *e)
|
||
{
|
||
return IDENTIFIER_HASH_VALUE (DECL_NAME (e->decl));
|
||
}
|
||
|
||
inline bool
|
||
decl_addr_hasher::equal (const value_type *p1, const compare_type *p2)
|
||
{
|
||
return p1->decl == p2->decl;
|
||
}
|
||
|
||
|
||
|
||
struct string_hasher : typed_noop_remove<char>
|
||
{
|
||
typedef char value_type;
|
||
typedef char compare_type;
|
||
|
||
static inline hashval_t hash (const value_type *s)
|
||
{
|
||
return htab_hash_string (s);
|
||
}
|
||
|
||
static inline bool equal (const value_type *p1, const value_type *p2)
|
||
{
|
||
return strcmp (p1, p2) == 0;
|
||
}
|
||
};
|
||
|
||
|
||
|
||
// A wrapper for pushdecl that doesn't let gdb have a chance to
|
||
// instantiate a symbol.
|
||
|
||
static void
|
||
pushdecl_safe (tree decl)
|
||
{
|
||
void (*save) (enum c_oracle_request, tree identifier);
|
||
|
||
save = c_binding_oracle;
|
||
c_binding_oracle = NULL;
|
||
pushdecl (decl);
|
||
c_binding_oracle = save;
|
||
}
|
||
|
||
|
||
|
||
struct plugin_context : public cc1_plugin::connection
|
||
{
|
||
plugin_context (int fd);
|
||
|
||
// Map decls to addresses.
|
||
hash_table<decl_addr_hasher> address_map;
|
||
|
||
// A collection of trees that are preserved for the GC.
|
||
hash_table< pointer_hash<tree_node> > preserved;
|
||
|
||
// File name cache.
|
||
hash_table<string_hasher> file_names;
|
||
|
||
// Perform GC marking.
|
||
void mark ();
|
||
|
||
// Preserve a tree during the plugin's operation.
|
||
tree preserve (tree t)
|
||
{
|
||
tree_node **slot = preserved.find_slot (t, INSERT);
|
||
*slot = t;
|
||
return t;
|
||
}
|
||
|
||
source_location get_source_location (const char *filename,
|
||
unsigned int line_number)
|
||
{
|
||
if (filename == NULL)
|
||
return UNKNOWN_LOCATION;
|
||
|
||
filename = intern_filename (filename);
|
||
linemap_add (line_table, LC_ENTER, false, filename, line_number);
|
||
source_location loc = linemap_line_start (line_table, line_number, 0);
|
||
linemap_add (line_table, LC_LEAVE, false, NULL, 0);
|
||
return loc;
|
||
}
|
||
|
||
private:
|
||
|
||
// Add a file name to FILE_NAMES and return the canonical copy.
|
||
const char *intern_filename (const char *filename)
|
||
{
|
||
char **slot = file_names.find_slot (filename, INSERT);
|
||
if (*slot == NULL)
|
||
{
|
||
/* The file name must live as long as the line map, which
|
||
effectively means as long as this compilation. So, we copy
|
||
the string here but never free it. */
|
||
*slot = xstrdup (filename);
|
||
}
|
||
return *slot;
|
||
}
|
||
};
|
||
|
||
static plugin_context *current_context;
|
||
|
||
|
||
|
||
plugin_context::plugin_context (int fd)
|
||
: cc1_plugin::connection (fd),
|
||
address_map (30),
|
||
preserved (30),
|
||
file_names (30)
|
||
{
|
||
}
|
||
|
||
void
|
||
plugin_context::mark ()
|
||
{
|
||
for (hash_table<decl_addr_hasher>::iterator it = address_map.begin ();
|
||
it != address_map.end ();
|
||
++it)
|
||
{
|
||
ggc_mark ((*it)->decl);
|
||
ggc_mark ((*it)->address);
|
||
}
|
||
|
||
for (hash_table< pointer_hash<tree_node> >::iterator it = preserved.begin ();
|
||
it != preserved.end ();
|
||
++it)
|
||
ggc_mark (&*it);
|
||
}
|
||
|
||
static void
|
||
plugin_binding_oracle (enum c_oracle_request kind, tree identifier)
|
||
{
|
||
enum gcc_c_oracle_request request;
|
||
|
||
gcc_assert (current_context != NULL);
|
||
|
||
switch (kind)
|
||
{
|
||
case C_ORACLE_SYMBOL:
|
||
request = GCC_C_ORACLE_SYMBOL;
|
||
break;
|
||
case C_ORACLE_TAG:
|
||
request = GCC_C_ORACLE_TAG;
|
||
break;
|
||
case C_ORACLE_LABEL:
|
||
request = GCC_C_ORACLE_LABEL;
|
||
break;
|
||
default:
|
||
abort ();
|
||
}
|
||
|
||
int ignore;
|
||
cc1_plugin::call (current_context, "binding_oracle", &ignore,
|
||
request, IDENTIFIER_POINTER (identifier));
|
||
}
|
||
|
||
static void
|
||
plugin_pragma_user_expression (cpp_reader *)
|
||
{
|
||
c_binding_oracle = plugin_binding_oracle;
|
||
}
|
||
|
||
static void
|
||
plugin_init_extra_pragmas (void *, void *)
|
||
{
|
||
c_register_pragma ("GCC", "user_expression", plugin_pragma_user_expression);
|
||
}
|
||
|
||
|
||
|
||
// Maybe rewrite a decl to its address.
|
||
static tree
|
||
address_rewriter (tree *in, int *walk_subtrees, void *arg)
|
||
{
|
||
plugin_context *ctx = (plugin_context *) arg;
|
||
|
||
if (!DECL_P (*in) || DECL_NAME (*in) == NULL_TREE)
|
||
return NULL_TREE;
|
||
|
||
decl_addr_value value;
|
||
value.decl = *in;
|
||
decl_addr_value *found_value = ctx->address_map.find (&value);
|
||
if (found_value != NULL)
|
||
{
|
||
// At this point we don't need VLA sizes for gdb-supplied
|
||
// variables, and having them here confuses later passes, so we
|
||
// drop them.
|
||
if (C_TYPE_VARIABLE_SIZE (TREE_TYPE (*in)))
|
||
{
|
||
TREE_TYPE (*in)
|
||
= build_array_type_nelts (TREE_TYPE (TREE_TYPE (*in)), 1);
|
||
DECL_SIZE (*in) = TYPE_SIZE (TREE_TYPE (*in));
|
||
DECL_SIZE_UNIT (*in) = TYPE_SIZE_UNIT (TREE_TYPE (*in));
|
||
}
|
||
}
|
||
else if (DECL_IS_BUILTIN (*in))
|
||
{
|
||
gcc_address address;
|
||
|
||
if (!cc1_plugin::call (ctx, "address_oracle", &address,
|
||
IDENTIFIER_POINTER (DECL_NAME (*in))))
|
||
return NULL_TREE;
|
||
if (address == 0)
|
||
return NULL_TREE;
|
||
|
||
// Insert the decl into the address map in case it is referenced
|
||
// again.
|
||
value.address = build_int_cst_type (ptr_type_node, address);
|
||
decl_addr_value **slot = ctx->address_map.find_slot (&value, INSERT);
|
||
gcc_assert (*slot == NULL);
|
||
*slot
|
||
= static_cast<decl_addr_value *> (xmalloc (sizeof (decl_addr_value)));
|
||
**slot = value;
|
||
found_value = *slot;
|
||
}
|
||
else
|
||
return NULL_TREE;
|
||
|
||
if (found_value->address != error_mark_node)
|
||
{
|
||
// We have an address for the decl, so rewrite the tree.
|
||
tree ptr_type = build_pointer_type (TREE_TYPE (*in));
|
||
*in = fold_build1 (INDIRECT_REF, TREE_TYPE (*in),
|
||
fold_build1 (CONVERT_EXPR, ptr_type,
|
||
found_value->address));
|
||
}
|
||
|
||
*walk_subtrees = 0;
|
||
|
||
return NULL_TREE;
|
||
}
|
||
|
||
// When generating code for gdb, we want to be able to use absolute
|
||
// addresses to refer to otherwise external objects that gdb knows
|
||
// about. gdb passes in these addresses when building decls, and then
|
||
// before gimplification we go through the trees, rewriting uses to
|
||
// the equivalent of "*(TYPE *) ADDR".
|
||
static void
|
||
rewrite_decls_to_addresses (void *function_in, void *)
|
||
{
|
||
tree function = (tree) function_in;
|
||
|
||
// Do nothing if we're not in gdb.
|
||
if (current_context == NULL)
|
||
return;
|
||
|
||
walk_tree (&DECL_SAVED_TREE (function), address_rewriter, current_context,
|
||
NULL);
|
||
}
|
||
|
||
|
||
|
||
gcc_decl
|
||
plugin_build_decl (cc1_plugin::connection *self,
|
||
const char *name,
|
||
enum gcc_c_symbol_kind sym_kind,
|
||
gcc_type sym_type_in,
|
||
const char *substitution_name,
|
||
gcc_address address,
|
||
const char *filename,
|
||
unsigned int line_number)
|
||
{
|
||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||
tree identifier = get_identifier (name);
|
||
enum tree_code code;
|
||
tree decl;
|
||
tree sym_type = convert_in (sym_type_in);
|
||
|
||
switch (sym_kind)
|
||
{
|
||
case GCC_C_SYMBOL_FUNCTION:
|
||
code = FUNCTION_DECL;
|
||
break;
|
||
|
||
case GCC_C_SYMBOL_VARIABLE:
|
||
code = VAR_DECL;
|
||
break;
|
||
|
||
case GCC_C_SYMBOL_TYPEDEF:
|
||
code = TYPE_DECL;
|
||
break;
|
||
|
||
case GCC_C_SYMBOL_LABEL:
|
||
// FIXME: we aren't ready to handle labels yet.
|
||
// It isn't clear how to translate them properly
|
||
// and in any case a "goto" isn't likely to work.
|
||
return convert_out (error_mark_node);
|
||
|
||
default:
|
||
abort ();
|
||
}
|
||
|
||
source_location loc = ctx->get_source_location (filename, line_number);
|
||
|
||
decl = build_decl (loc, code, identifier, sym_type);
|
||
TREE_USED (decl) = 1;
|
||
TREE_ADDRESSABLE (decl) = 1;
|
||
|
||
if (sym_kind != GCC_C_SYMBOL_TYPEDEF)
|
||
{
|
||
decl_addr_value value;
|
||
|
||
value.decl = decl;
|
||
if (substitution_name != NULL)
|
||
{
|
||
// If the translator gave us a name without a binding,
|
||
// we can just substitute error_mark_node, since we know the
|
||
// translator will be reporting an error anyhow.
|
||
value.address
|
||
= lookup_name (get_identifier (substitution_name));
|
||
if (value.address == NULL_TREE)
|
||
value.address = error_mark_node;
|
||
}
|
||
else
|
||
value.address = build_int_cst_type (ptr_type_node, address);
|
||
decl_addr_value **slot = ctx->address_map.find_slot (&value, INSERT);
|
||
gcc_assert (*slot == NULL);
|
||
*slot
|
||
= static_cast<decl_addr_value *> (xmalloc (sizeof (decl_addr_value)));
|
||
**slot = value;
|
||
}
|
||
|
||
return convert_out (ctx->preserve (decl));
|
||
}
|
||
|
||
int
|
||
plugin_bind (cc1_plugin::connection *,
|
||
gcc_decl decl_in, int is_global)
|
||
{
|
||
tree decl = convert_in (decl_in);
|
||
c_bind (DECL_SOURCE_LOCATION (decl), decl, is_global);
|
||
rest_of_decl_compilation (decl, is_global, 0);
|
||
return 1;
|
||
}
|
||
|
||
int
|
||
plugin_tagbind (cc1_plugin::connection *self,
|
||
const char *name, gcc_type tagged_type,
|
||
const char *filename, unsigned int line_number)
|
||
{
|
||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||
c_pushtag (ctx->get_source_location (filename, line_number),
|
||
get_identifier (name), convert_in (tagged_type));
|
||
return 1;
|
||
}
|
||
|
||
gcc_type
|
||
plugin_build_pointer_type (cc1_plugin::connection *,
|
||
gcc_type base_type)
|
||
{
|
||
// No need to preserve a pointer type as the base type is preserved.
|
||
return convert_out (build_pointer_type (convert_in (base_type)));
|
||
}
|
||
|
||
gcc_type
|
||
plugin_build_record_type (cc1_plugin::connection *self)
|
||
{
|
||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||
return convert_out (ctx->preserve (make_node (RECORD_TYPE)));
|
||
}
|
||
|
||
gcc_type
|
||
plugin_build_union_type (cc1_plugin::connection *self)
|
||
{
|
||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||
return convert_out (ctx->preserve (make_node (UNION_TYPE)));
|
||
}
|
||
|
||
int
|
||
plugin_build_add_field (cc1_plugin::connection *,
|
||
gcc_type record_or_union_type_in,
|
||
const char *field_name,
|
||
gcc_type field_type_in,
|
||
unsigned long bitsize,
|
||
unsigned long bitpos)
|
||
{
|
||
tree record_or_union_type = convert_in (record_or_union_type_in);
|
||
tree field_type = convert_in (field_type_in);
|
||
|
||
gcc_assert (TREE_CODE (record_or_union_type) == RECORD_TYPE
|
||
|| TREE_CODE (record_or_union_type) == UNION_TYPE);
|
||
|
||
/* Note that gdb does not preserve the location of field decls, so
|
||
we can't provide a decent location here. */
|
||
tree decl = build_decl (BUILTINS_LOCATION, FIELD_DECL,
|
||
get_identifier (field_name), field_type);
|
||
DECL_FIELD_CONTEXT (decl) = record_or_union_type;
|
||
|
||
if (TREE_CODE (field_type) == INTEGER_TYPE
|
||
&& TYPE_PRECISION (field_type) != bitsize)
|
||
{
|
||
DECL_BIT_FIELD_TYPE (decl) = field_type;
|
||
TREE_TYPE (decl)
|
||
= c_build_bitfield_integer_type (bitsize, TYPE_UNSIGNED (field_type));
|
||
}
|
||
|
||
DECL_MODE (decl) = TYPE_MODE (TREE_TYPE (decl));
|
||
|
||
// There's no way to recover this from DWARF.
|
||
SET_DECL_OFFSET_ALIGN (decl, TYPE_PRECISION (pointer_sized_int_node));
|
||
|
||
tree pos = bitsize_int (bitpos);
|
||
pos_from_bit (&DECL_FIELD_OFFSET (decl), &DECL_FIELD_BIT_OFFSET (decl),
|
||
DECL_OFFSET_ALIGN (decl), pos);
|
||
|
||
DECL_SIZE (decl) = bitsize_int (bitsize);
|
||
DECL_SIZE_UNIT (decl) = size_int ((bitsize + BITS_PER_UNIT - 1)
|
||
/ BITS_PER_UNIT);
|
||
|
||
DECL_CHAIN (decl) = TYPE_FIELDS (record_or_union_type);
|
||
TYPE_FIELDS (record_or_union_type) = decl;
|
||
|
||
return 1;
|
||
}
|
||
|
||
int
|
||
plugin_finish_record_or_union (cc1_plugin::connection *,
|
||
gcc_type record_or_union_type_in,
|
||
unsigned long size_in_bytes)
|
||
{
|
||
tree record_or_union_type = convert_in (record_or_union_type_in);
|
||
|
||
gcc_assert (TREE_CODE (record_or_union_type) == RECORD_TYPE
|
||
|| TREE_CODE (record_or_union_type) == UNION_TYPE);
|
||
|
||
/* We built the field list in reverse order, so fix it now. */
|
||
TYPE_FIELDS (record_or_union_type)
|
||
= nreverse (TYPE_FIELDS (record_or_union_type));
|
||
|
||
if (TREE_CODE (record_or_union_type) == UNION_TYPE)
|
||
{
|
||
/* Unions can just be handled by the generic code. */
|
||
layout_type (record_or_union_type);
|
||
}
|
||
else
|
||
{
|
||
// FIXME there's no way to get this from DWARF,
|
||
// or even, it seems, a particularly good way to deduce it.
|
||
TYPE_ALIGN (record_or_union_type)
|
||
= TYPE_PRECISION (pointer_sized_int_node);
|
||
|
||
TYPE_SIZE (record_or_union_type) = bitsize_int (size_in_bytes
|
||
* BITS_PER_UNIT);
|
||
TYPE_SIZE_UNIT (record_or_union_type) = size_int (size_in_bytes);
|
||
|
||
compute_record_mode (record_or_union_type);
|
||
finish_bitfield_layout (record_or_union_type);
|
||
// FIXME we have no idea about TYPE_PACKED
|
||
}
|
||
|
||
return 1;
|
||
}
|
||
|
||
gcc_type
|
||
plugin_build_enum_type (cc1_plugin::connection *self,
|
||
gcc_type underlying_int_type_in)
|
||
{
|
||
tree underlying_int_type = convert_in (underlying_int_type_in);
|
||
|
||
if (underlying_int_type == error_mark_node)
|
||
return convert_out (error_mark_node);
|
||
|
||
tree result = make_node (ENUMERAL_TYPE);
|
||
|
||
TYPE_PRECISION (result) = TYPE_PRECISION (underlying_int_type);
|
||
TYPE_UNSIGNED (result) = TYPE_UNSIGNED (underlying_int_type);
|
||
|
||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||
return convert_out (ctx->preserve (result));
|
||
}
|
||
|
||
int
|
||
plugin_build_add_enum_constant (cc1_plugin::connection *,
|
||
gcc_type enum_type_in,
|
||
const char *name,
|
||
unsigned long value)
|
||
{
|
||
tree cst, decl, cons;
|
||
tree enum_type = convert_in (enum_type_in);
|
||
|
||
gcc_assert (TREE_CODE (enum_type) == ENUMERAL_TYPE);
|
||
|
||
cst = build_int_cst (enum_type, value);
|
||
/* Note that gdb does not preserve the location of enum constants,
|
||
so we can't provide a decent location here. */
|
||
decl = build_decl (BUILTINS_LOCATION, CONST_DECL,
|
||
get_identifier (name), enum_type);
|
||
DECL_INITIAL (decl) = cst;
|
||
pushdecl_safe (decl);
|
||
|
||
cons = tree_cons (DECL_NAME (decl), cst, TYPE_VALUES (enum_type));
|
||
TYPE_VALUES (enum_type) = cons;
|
||
|
||
return 1;
|
||
}
|
||
|
||
int
|
||
plugin_finish_enum_type (cc1_plugin::connection *,
|
||
gcc_type enum_type_in)
|
||
{
|
||
tree enum_type = convert_in (enum_type_in);
|
||
tree minnode, maxnode, iter;
|
||
|
||
iter = TYPE_VALUES (enum_type);
|
||
minnode = maxnode = TREE_VALUE (iter);
|
||
for (iter = TREE_CHAIN (iter);
|
||
iter != NULL_TREE;
|
||
iter = TREE_CHAIN (iter))
|
||
{
|
||
tree value = TREE_VALUE (iter);
|
||
if (tree_int_cst_lt (maxnode, value))
|
||
maxnode = value;
|
||
if (tree_int_cst_lt (value, minnode))
|
||
minnode = value;
|
||
}
|
||
TYPE_MIN_VALUE (enum_type) = minnode;
|
||
TYPE_MAX_VALUE (enum_type) = maxnode;
|
||
|
||
layout_type (enum_type);
|
||
|
||
return 1;
|
||
}
|
||
|
||
gcc_type
|
||
plugin_build_function_type (cc1_plugin::connection *self,
|
||
gcc_type return_type_in,
|
||
const struct gcc_type_array *argument_types_in,
|
||
int is_varargs)
|
||
{
|
||
tree *argument_types;
|
||
tree return_type = convert_in (return_type_in);
|
||
tree result;
|
||
|
||
argument_types = new tree[argument_types_in->n_elements];
|
||
for (int i = 0; i < argument_types_in->n_elements; ++i)
|
||
argument_types[i] = convert_in (argument_types_in->elements[i]);
|
||
|
||
if (is_varargs)
|
||
result = build_varargs_function_type_array (return_type,
|
||
argument_types_in->n_elements,
|
||
argument_types);
|
||
else
|
||
result = build_function_type_array (return_type,
|
||
argument_types_in->n_elements,
|
||
argument_types);
|
||
|
||
delete[] argument_types;
|
||
|
||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||
return convert_out (ctx->preserve (result));
|
||
}
|
||
|
||
gcc_type
|
||
plugin_int_type (cc1_plugin::connection *self,
|
||
int is_unsigned, unsigned long size_in_bytes)
|
||
{
|
||
tree result = c_common_type_for_size (BITS_PER_UNIT * size_in_bytes,
|
||
is_unsigned);
|
||
if (result == NULL_TREE)
|
||
result = error_mark_node;
|
||
else
|
||
{
|
||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||
ctx->preserve (result);
|
||
}
|
||
return convert_out (result);
|
||
}
|
||
|
||
gcc_type
|
||
plugin_float_type (cc1_plugin::connection *,
|
||
unsigned long size_in_bytes)
|
||
{
|
||
if (BITS_PER_UNIT * size_in_bytes == TYPE_PRECISION (float_type_node))
|
||
return convert_out (float_type_node);
|
||
if (BITS_PER_UNIT * size_in_bytes == TYPE_PRECISION (double_type_node))
|
||
return convert_out (double_type_node);
|
||
if (BITS_PER_UNIT * size_in_bytes == TYPE_PRECISION (long_double_type_node))
|
||
return convert_out (long_double_type_node);
|
||
return convert_out (error_mark_node);
|
||
}
|
||
|
||
gcc_type
|
||
plugin_void_type (cc1_plugin::connection *)
|
||
{
|
||
return convert_out (void_type_node);
|
||
}
|
||
|
||
gcc_type
|
||
plugin_bool_type (cc1_plugin::connection *)
|
||
{
|
||
return convert_out (boolean_type_node);
|
||
}
|
||
|
||
gcc_type
|
||
plugin_build_array_type (cc1_plugin::connection *self,
|
||
gcc_type element_type_in, int num_elements)
|
||
{
|
||
tree element_type = convert_in (element_type_in);
|
||
tree result;
|
||
|
||
if (num_elements == -1)
|
||
result = build_array_type (element_type, NULL_TREE);
|
||
else
|
||
result = build_array_type_nelts (element_type, num_elements);
|
||
|
||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||
return convert_out (ctx->preserve (result));
|
||
}
|
||
|
||
gcc_type
|
||
plugin_build_vla_array_type (cc1_plugin::connection *self,
|
||
gcc_type element_type_in,
|
||
const char *upper_bound_name)
|
||
{
|
||
tree element_type = convert_in (element_type_in);
|
||
tree upper_bound = lookup_name (get_identifier (upper_bound_name));
|
||
tree range = build_index_type (upper_bound);
|
||
|
||
tree result = build_array_type (element_type, range);
|
||
C_TYPE_VARIABLE_SIZE (result) = 1;
|
||
|
||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||
return convert_out (ctx->preserve (result));
|
||
}
|
||
|
||
gcc_type
|
||
plugin_build_qualified_type (cc1_plugin::connection *,
|
||
gcc_type unqualified_type_in,
|
||
enum gcc_qualifiers qualifiers)
|
||
{
|
||
tree unqualified_type = convert_in (unqualified_type_in);
|
||
int quals = 0;
|
||
|
||
if ((qualifiers & GCC_QUALIFIER_CONST) != 0)
|
||
quals |= TYPE_QUAL_CONST;
|
||
if ((qualifiers & GCC_QUALIFIER_VOLATILE) != 0)
|
||
quals |= TYPE_QUAL_VOLATILE;
|
||
if ((qualifiers & GCC_QUALIFIER_RESTRICT) != 0)
|
||
quals |= TYPE_QUAL_RESTRICT;
|
||
|
||
return convert_out (build_qualified_type (unqualified_type, quals));
|
||
}
|
||
|
||
gcc_type
|
||
plugin_build_complex_type (cc1_plugin::connection *self,
|
||
gcc_type base_type)
|
||
{
|
||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||
return convert_out (ctx->preserve (build_complex_type (convert_in (base_type))));
|
||
}
|
||
|
||
gcc_type
|
||
plugin_build_vector_type (cc1_plugin::connection *self,
|
||
gcc_type base_type, int nunits)
|
||
{
|
||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||
return convert_out (ctx->preserve (build_vector_type (convert_in (base_type),
|
||
nunits)));
|
||
}
|
||
|
||
int
|
||
plugin_build_constant (cc1_plugin::connection *self, gcc_type type_in,
|
||
const char *name, unsigned long value,
|
||
const char *filename, unsigned int line_number)
|
||
{
|
||
plugin_context *ctx = static_cast<plugin_context *> (self);
|
||
tree cst, decl;
|
||
tree type = convert_in (type_in);
|
||
|
||
cst = build_int_cst (type, value);
|
||
decl = build_decl (ctx->get_source_location (filename, line_number),
|
||
CONST_DECL, get_identifier (name), type);
|
||
DECL_INITIAL (decl) = cst;
|
||
pushdecl_safe (decl);
|
||
|
||
return 1;
|
||
}
|
||
|
||
gcc_type
|
||
plugin_error (cc1_plugin::connection *,
|
||
const char *message)
|
||
{
|
||
error ("%s", message);
|
||
return convert_out (error_mark_node);
|
||
}
|
||
|
||
|
||
|
||
// Perform GC marking.
|
||
|
||
static void
|
||
gc_mark (void *, void *)
|
||
{
|
||
if (current_context != NULL)
|
||
current_context->mark ();
|
||
}
|
||
|
||
#ifdef __GNUC__
|
||
#pragma GCC visibility push(default)
|
||
#endif
|
||
|
||
int
|
||
plugin_init (struct plugin_name_args *plugin_info,
|
||
struct plugin_gcc_version *)
|
||
{
|
||
long fd = -1;
|
||
for (int i = 0; i < plugin_info->argc; ++i)
|
||
{
|
||
if (strcmp (plugin_info->argv[i].key, "fd") == 0)
|
||
{
|
||
char *tail;
|
||
errno = 0;
|
||
fd = strtol (plugin_info->argv[i].value, &tail, 0);
|
||
if (*tail != '\0' || errno != 0)
|
||
fatal_error ("%s: invalid file descriptor argument to plugin",
|
||
plugin_info->base_name);
|
||
break;
|
||
}
|
||
}
|
||
if (fd == -1)
|
||
fatal_error ("%s: required plugin argument %<fd%> is missing",
|
||
plugin_info->base_name);
|
||
|
||
current_context = new plugin_context (fd);
|
||
|
||
// Handshake.
|
||
cc1_plugin::protocol_int version;
|
||
if (!current_context->require ('H')
|
||
|| ! ::cc1_plugin::unmarshall (current_context, &version))
|
||
fatal_error ("%s: handshake failed", plugin_info->base_name);
|
||
if (version != GCC_C_FE_VERSION_0)
|
||
fatal_error ("%s: unknown version in handshake", plugin_info->base_name);
|
||
|
||
register_callback (plugin_info->base_name, PLUGIN_PRAGMAS,
|
||
plugin_init_extra_pragmas, NULL);
|
||
register_callback (plugin_info->base_name, PLUGIN_PRE_GENERICIZE,
|
||
rewrite_decls_to_addresses, NULL);
|
||
register_callback (plugin_info->base_name, PLUGIN_GGC_MARKING,
|
||
gc_mark, NULL);
|
||
|
||
lang_hooks.print_error_function = plugin_print_error_function;
|
||
|
||
#define GCC_METHOD0(R, N) \
|
||
{ \
|
||
cc1_plugin::callback_ftype *fun \
|
||
= cc1_plugin::callback<R, plugin_ ## N>; \
|
||
current_context->add_callback (# N, fun); \
|
||
}
|
||
#define GCC_METHOD1(R, N, A) \
|
||
{ \
|
||
cc1_plugin::callback_ftype *fun \
|
||
= cc1_plugin::callback<R, A, plugin_ ## N>; \
|
||
current_context->add_callback (# N, fun); \
|
||
}
|
||
#define GCC_METHOD2(R, N, A, B) \
|
||
{ \
|
||
cc1_plugin::callback_ftype *fun \
|
||
= cc1_plugin::callback<R, A, B, plugin_ ## N>; \
|
||
current_context->add_callback (# N, fun); \
|
||
}
|
||
#define GCC_METHOD3(R, N, A, B, C) \
|
||
{ \
|
||
cc1_plugin::callback_ftype *fun \
|
||
= cc1_plugin::callback<R, A, B, C, plugin_ ## N>; \
|
||
current_context->add_callback (# N, fun); \
|
||
}
|
||
#define GCC_METHOD4(R, N, A, B, C, D) \
|
||
{ \
|
||
cc1_plugin::callback_ftype *fun \
|
||
= cc1_plugin::callback<R, A, B, C, D, \
|
||
plugin_ ## N>; \
|
||
current_context->add_callback (# N, fun); \
|
||
}
|
||
#define GCC_METHOD5(R, N, A, B, C, D, E) \
|
||
{ \
|
||
cc1_plugin::callback_ftype *fun \
|
||
= cc1_plugin::callback<R, A, B, C, D, E, \
|
||
plugin_ ## N>; \
|
||
current_context->add_callback (# N, fun); \
|
||
}
|
||
#define GCC_METHOD7(R, N, A, B, C, D, E, F, G) \
|
||
{ \
|
||
cc1_plugin::callback_ftype *fun \
|
||
= cc1_plugin::callback<R, A, B, C, D, E, F, G, \
|
||
plugin_ ## N>; \
|
||
current_context->add_callback (# N, fun); \
|
||
}
|
||
|
||
#include "gcc-c-fe.def"
|
||
|
||
#undef GCC_METHOD0
|
||
#undef GCC_METHOD1
|
||
#undef GCC_METHOD2
|
||
#undef GCC_METHOD3
|
||
#undef GCC_METHOD4
|
||
#undef GCC_METHOD5
|
||
#undef GCC_METHOD7
|
||
|
||
return 0;
|
||
}
|