diff options
author | Martin Liska <mliska@suse.cz> | 2022-01-14 16:56:44 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-01-17 22:12:04 +0100 |
commit | 5c69acb32329d49e58c26fa41ae74229a52b9106 (patch) | |
tree | ddb05f9d73afb6f998457d2ac4b720e3b3b60483 /gcc/jit/libgccjit.c | |
parent | 490e23032baaece71f2ec09fa1805064b150fbc2 (diff) | |
download | gcc-5c69acb32329d49e58c26fa41ae74229a52b9106.zip gcc-5c69acb32329d49e58c26fa41ae74229a52b9106.tar.gz gcc-5c69acb32329d49e58c26fa41ae74229a52b9106.tar.bz2 |
Rename .c files to .cc files.
gcc/ada/ChangeLog:
* adadecode.c: Moved to...
* adadecode.cc: ...here.
* affinity.c: Moved to...
* affinity.cc: ...here.
* argv-lynxos178-raven-cert.c: Moved to...
* argv-lynxos178-raven-cert.cc: ...here.
* argv.c: Moved to...
* argv.cc: ...here.
* aux-io.c: Moved to...
* aux-io.cc: ...here.
* cio.c: Moved to...
* cio.cc: ...here.
* cstreams.c: Moved to...
* cstreams.cc: ...here.
* env.c: Moved to...
* env.cc: ...here.
* exit.c: Moved to...
* exit.cc: ...here.
* expect.c: Moved to...
* expect.cc: ...here.
* final.c: Moved to...
* final.cc: ...here.
* gcc-interface/cuintp.c: Moved to...
* gcc-interface/cuintp.cc: ...here.
* gcc-interface/decl.c: Moved to...
* gcc-interface/decl.cc: ...here.
* gcc-interface/misc.c: Moved to...
* gcc-interface/misc.cc: ...here.
* gcc-interface/targtyps.c: Moved to...
* gcc-interface/targtyps.cc: ...here.
* gcc-interface/trans.c: Moved to...
* gcc-interface/trans.cc: ...here.
* gcc-interface/utils.c: Moved to...
* gcc-interface/utils.cc: ...here.
* gcc-interface/utils2.c: Moved to...
* gcc-interface/utils2.cc: ...here.
* init.c: Moved to...
* init.cc: ...here.
* initialize.c: Moved to...
* initialize.cc: ...here.
* libgnarl/thread.c: Moved to...
* libgnarl/thread.cc: ...here.
* link.c: Moved to...
* link.cc: ...here.
* locales.c: Moved to...
* locales.cc: ...here.
* mkdir.c: Moved to...
* mkdir.cc: ...here.
* raise.c: Moved to...
* raise.cc: ...here.
* rtfinal.c: Moved to...
* rtfinal.cc: ...here.
* rtinit.c: Moved to...
* rtinit.cc: ...here.
* seh_init.c: Moved to...
* seh_init.cc: ...here.
* sigtramp-armdroid.c: Moved to...
* sigtramp-armdroid.cc: ...here.
* sigtramp-ios.c: Moved to...
* sigtramp-ios.cc: ...here.
* sigtramp-qnx.c: Moved to...
* sigtramp-qnx.cc: ...here.
* sigtramp-vxworks.c: Moved to...
* sigtramp-vxworks.cc: ...here.
* socket.c: Moved to...
* socket.cc: ...here.
* tracebak.c: Moved to...
* tracebak.cc: ...here.
* version.c: Moved to...
* version.cc: ...here.
* vx_stack_info.c: Moved to...
* vx_stack_info.cc: ...here.
gcc/ChangeLog:
* adjust-alignment.c: Moved to...
* adjust-alignment.cc: ...here.
* alias.c: Moved to...
* alias.cc: ...here.
* alloc-pool.c: Moved to...
* alloc-pool.cc: ...here.
* asan.c: Moved to...
* asan.cc: ...here.
* attribs.c: Moved to...
* attribs.cc: ...here.
* auto-inc-dec.c: Moved to...
* auto-inc-dec.cc: ...here.
* auto-profile.c: Moved to...
* auto-profile.cc: ...here.
* bb-reorder.c: Moved to...
* bb-reorder.cc: ...here.
* bitmap.c: Moved to...
* bitmap.cc: ...here.
* btfout.c: Moved to...
* btfout.cc: ...here.
* builtins.c: Moved to...
* builtins.cc: ...here.
* caller-save.c: Moved to...
* caller-save.cc: ...here.
* calls.c: Moved to...
* calls.cc: ...here.
* ccmp.c: Moved to...
* ccmp.cc: ...here.
* cfg.c: Moved to...
* cfg.cc: ...here.
* cfganal.c: Moved to...
* cfganal.cc: ...here.
* cfgbuild.c: Moved to...
* cfgbuild.cc: ...here.
* cfgcleanup.c: Moved to...
* cfgcleanup.cc: ...here.
* cfgexpand.c: Moved to...
* cfgexpand.cc: ...here.
* cfghooks.c: Moved to...
* cfghooks.cc: ...here.
* cfgloop.c: Moved to...
* cfgloop.cc: ...here.
* cfgloopanal.c: Moved to...
* cfgloopanal.cc: ...here.
* cfgloopmanip.c: Moved to...
* cfgloopmanip.cc: ...here.
* cfgrtl.c: Moved to...
* cfgrtl.cc: ...here.
* cgraph.c: Moved to...
* cgraph.cc: ...here.
* cgraphbuild.c: Moved to...
* cgraphbuild.cc: ...here.
* cgraphclones.c: Moved to...
* cgraphclones.cc: ...here.
* cgraphunit.c: Moved to...
* cgraphunit.cc: ...here.
* collect-utils.c: Moved to...
* collect-utils.cc: ...here.
* collect2-aix.c: Moved to...
* collect2-aix.cc: ...here.
* collect2.c: Moved to...
* collect2.cc: ...here.
* combine-stack-adj.c: Moved to...
* combine-stack-adj.cc: ...here.
* combine.c: Moved to...
* combine.cc: ...here.
* common/common-targhooks.c: Moved to...
* common/common-targhooks.cc: ...here.
* common/config/aarch64/aarch64-common.c: Moved to...
* common/config/aarch64/aarch64-common.cc: ...here.
* common/config/alpha/alpha-common.c: Moved to...
* common/config/alpha/alpha-common.cc: ...here.
* common/config/arc/arc-common.c: Moved to...
* common/config/arc/arc-common.cc: ...here.
* common/config/arm/arm-common.c: Moved to...
* common/config/arm/arm-common.cc: ...here.
* common/config/avr/avr-common.c: Moved to...
* common/config/avr/avr-common.cc: ...here.
* common/config/bfin/bfin-common.c: Moved to...
* common/config/bfin/bfin-common.cc: ...here.
* common/config/bpf/bpf-common.c: Moved to...
* common/config/bpf/bpf-common.cc: ...here.
* common/config/c6x/c6x-common.c: Moved to...
* common/config/c6x/c6x-common.cc: ...here.
* common/config/cr16/cr16-common.c: Moved to...
* common/config/cr16/cr16-common.cc: ...here.
* common/config/cris/cris-common.c: Moved to...
* common/config/cris/cris-common.cc: ...here.
* common/config/csky/csky-common.c: Moved to...
* common/config/csky/csky-common.cc: ...here.
* common/config/default-common.c: Moved to...
* common/config/default-common.cc: ...here.
* common/config/epiphany/epiphany-common.c: Moved to...
* common/config/epiphany/epiphany-common.cc: ...here.
* common/config/fr30/fr30-common.c: Moved to...
* common/config/fr30/fr30-common.cc: ...here.
* common/config/frv/frv-common.c: Moved to...
* common/config/frv/frv-common.cc: ...here.
* common/config/gcn/gcn-common.c: Moved to...
* common/config/gcn/gcn-common.cc: ...here.
* common/config/h8300/h8300-common.c: Moved to...
* common/config/h8300/h8300-common.cc: ...here.
* common/config/i386/i386-common.c: Moved to...
* common/config/i386/i386-common.cc: ...here.
* common/config/ia64/ia64-common.c: Moved to...
* common/config/ia64/ia64-common.cc: ...here.
* common/config/iq2000/iq2000-common.c: Moved to...
* common/config/iq2000/iq2000-common.cc: ...here.
* common/config/lm32/lm32-common.c: Moved to...
* common/config/lm32/lm32-common.cc: ...here.
* common/config/m32r/m32r-common.c: Moved to...
* common/config/m32r/m32r-common.cc: ...here.
* common/config/m68k/m68k-common.c: Moved to...
* common/config/m68k/m68k-common.cc: ...here.
* common/config/mcore/mcore-common.c: Moved to...
* common/config/mcore/mcore-common.cc: ...here.
* common/config/microblaze/microblaze-common.c: Moved to...
* common/config/microblaze/microblaze-common.cc: ...here.
* common/config/mips/mips-common.c: Moved to...
* common/config/mips/mips-common.cc: ...here.
* common/config/mmix/mmix-common.c: Moved to...
* common/config/mmix/mmix-common.cc: ...here.
* common/config/mn10300/mn10300-common.c: Moved to...
* common/config/mn10300/mn10300-common.cc: ...here.
* common/config/msp430/msp430-common.c: Moved to...
* common/config/msp430/msp430-common.cc: ...here.
* common/config/nds32/nds32-common.c: Moved to...
* common/config/nds32/nds32-common.cc: ...here.
* common/config/nios2/nios2-common.c: Moved to...
* common/config/nios2/nios2-common.cc: ...here.
* common/config/nvptx/nvptx-common.c: Moved to...
* common/config/nvptx/nvptx-common.cc: ...here.
* common/config/or1k/or1k-common.c: Moved to...
* common/config/or1k/or1k-common.cc: ...here.
* common/config/pa/pa-common.c: Moved to...
* common/config/pa/pa-common.cc: ...here.
* common/config/pdp11/pdp11-common.c: Moved to...
* common/config/pdp11/pdp11-common.cc: ...here.
* common/config/pru/pru-common.c: Moved to...
* common/config/pru/pru-common.cc: ...here.
* common/config/riscv/riscv-common.c: Moved to...
* common/config/riscv/riscv-common.cc: ...here.
* common/config/rs6000/rs6000-common.c: Moved to...
* common/config/rs6000/rs6000-common.cc: ...here.
* common/config/rx/rx-common.c: Moved to...
* common/config/rx/rx-common.cc: ...here.
* common/config/s390/s390-common.c: Moved to...
* common/config/s390/s390-common.cc: ...here.
* common/config/sh/sh-common.c: Moved to...
* common/config/sh/sh-common.cc: ...here.
* common/config/sparc/sparc-common.c: Moved to...
* common/config/sparc/sparc-common.cc: ...here.
* common/config/tilegx/tilegx-common.c: Moved to...
* common/config/tilegx/tilegx-common.cc: ...here.
* common/config/tilepro/tilepro-common.c: Moved to...
* common/config/tilepro/tilepro-common.cc: ...here.
* common/config/v850/v850-common.c: Moved to...
* common/config/v850/v850-common.cc: ...here.
* common/config/vax/vax-common.c: Moved to...
* common/config/vax/vax-common.cc: ...here.
* common/config/visium/visium-common.c: Moved to...
* common/config/visium/visium-common.cc: ...here.
* common/config/xstormy16/xstormy16-common.c: Moved to...
* common/config/xstormy16/xstormy16-common.cc: ...here.
* common/config/xtensa/xtensa-common.c: Moved to...
* common/config/xtensa/xtensa-common.cc: ...here.
* compare-elim.c: Moved to...
* compare-elim.cc: ...here.
* config/aarch64/aarch64-bti-insert.c: Moved to...
* config/aarch64/aarch64-bti-insert.cc: ...here.
* config/aarch64/aarch64-builtins.c: Moved to...
* config/aarch64/aarch64-builtins.cc: ...here.
* config/aarch64/aarch64-c.c: Moved to...
* config/aarch64/aarch64-c.cc: ...here.
* config/aarch64/aarch64-d.c: Moved to...
* config/aarch64/aarch64-d.cc: ...here.
* config/aarch64/aarch64.c: Moved to...
* config/aarch64/aarch64.cc: ...here.
* config/aarch64/cortex-a57-fma-steering.c: Moved to...
* config/aarch64/cortex-a57-fma-steering.cc: ...here.
* config/aarch64/driver-aarch64.c: Moved to...
* config/aarch64/driver-aarch64.cc: ...here.
* config/aarch64/falkor-tag-collision-avoidance.c: Moved to...
* config/aarch64/falkor-tag-collision-avoidance.cc: ...here.
* config/aarch64/host-aarch64-darwin.c: Moved to...
* config/aarch64/host-aarch64-darwin.cc: ...here.
* config/alpha/alpha.c: Moved to...
* config/alpha/alpha.cc: ...here.
* config/alpha/driver-alpha.c: Moved to...
* config/alpha/driver-alpha.cc: ...here.
* config/arc/arc-c.c: Moved to...
* config/arc/arc-c.cc: ...here.
* config/arc/arc.c: Moved to...
* config/arc/arc.cc: ...here.
* config/arc/driver-arc.c: Moved to...
* config/arc/driver-arc.cc: ...here.
* config/arm/aarch-common.c: Moved to...
* config/arm/aarch-common.cc: ...here.
* config/arm/arm-builtins.c: Moved to...
* config/arm/arm-builtins.cc: ...here.
* config/arm/arm-c.c: Moved to...
* config/arm/arm-c.cc: ...here.
* config/arm/arm-d.c: Moved to...
* config/arm/arm-d.cc: ...here.
* config/arm/arm.c: Moved to...
* config/arm/arm.cc: ...here.
* config/arm/driver-arm.c: Moved to...
* config/arm/driver-arm.cc: ...here.
* config/avr/avr-c.c: Moved to...
* config/avr/avr-c.cc: ...here.
* config/avr/avr-devices.c: Moved to...
* config/avr/avr-devices.cc: ...here.
* config/avr/avr-log.c: Moved to...
* config/avr/avr-log.cc: ...here.
* config/avr/avr.c: Moved to...
* config/avr/avr.cc: ...here.
* config/avr/driver-avr.c: Moved to...
* config/avr/driver-avr.cc: ...here.
* config/avr/gen-avr-mmcu-specs.c: Moved to...
* config/avr/gen-avr-mmcu-specs.cc: ...here.
* config/avr/gen-avr-mmcu-texi.c: Moved to...
* config/avr/gen-avr-mmcu-texi.cc: ...here.
* config/bfin/bfin.c: Moved to...
* config/bfin/bfin.cc: ...here.
* config/bpf/bpf.c: Moved to...
* config/bpf/bpf.cc: ...here.
* config/bpf/coreout.c: Moved to...
* config/bpf/coreout.cc: ...here.
* config/c6x/c6x.c: Moved to...
* config/c6x/c6x.cc: ...here.
* config/cr16/cr16.c: Moved to...
* config/cr16/cr16.cc: ...here.
* config/cris/cris.c: Moved to...
* config/cris/cris.cc: ...here.
* config/csky/csky.c: Moved to...
* config/csky/csky.cc: ...here.
* config/darwin-c.c: Moved to...
* config/darwin-c.cc: ...here.
* config/darwin-d.c: Moved to...
* config/darwin-d.cc: ...here.
* config/darwin-driver.c: Moved to...
* config/darwin-driver.cc: ...here.
* config/darwin-f.c: Moved to...
* config/darwin-f.cc: ...here.
* config/darwin.c: Moved to...
* config/darwin.cc: ...here.
* config/default-c.c: Moved to...
* config/default-c.cc: ...here.
* config/default-d.c: Moved to...
* config/default-d.cc: ...here.
* config/dragonfly-d.c: Moved to...
* config/dragonfly-d.cc: ...here.
* config/epiphany/epiphany.c: Moved to...
* config/epiphany/epiphany.cc: ...here.
* config/epiphany/mode-switch-use.c: Moved to...
* config/epiphany/mode-switch-use.cc: ...here.
* config/epiphany/resolve-sw-modes.c: Moved to...
* config/epiphany/resolve-sw-modes.cc: ...here.
* config/fr30/fr30.c: Moved to...
* config/fr30/fr30.cc: ...here.
* config/freebsd-d.c: Moved to...
* config/freebsd-d.cc: ...here.
* config/frv/frv.c: Moved to...
* config/frv/frv.cc: ...here.
* config/ft32/ft32.c: Moved to...
* config/ft32/ft32.cc: ...here.
* config/gcn/driver-gcn.c: Moved to...
* config/gcn/driver-gcn.cc: ...here.
* config/gcn/gcn-run.c: Moved to...
* config/gcn/gcn-run.cc: ...here.
* config/gcn/gcn-tree.c: Moved to...
* config/gcn/gcn-tree.cc: ...here.
* config/gcn/gcn.c: Moved to...
* config/gcn/gcn.cc: ...here.
* config/gcn/mkoffload.c: Moved to...
* config/gcn/mkoffload.cc: ...here.
* config/glibc-c.c: Moved to...
* config/glibc-c.cc: ...here.
* config/glibc-d.c: Moved to...
* config/glibc-d.cc: ...here.
* config/h8300/h8300.c: Moved to...
* config/h8300/h8300.cc: ...here.
* config/host-darwin.c: Moved to...
* config/host-darwin.cc: ...here.
* config/host-hpux.c: Moved to...
* config/host-hpux.cc: ...here.
* config/host-linux.c: Moved to...
* config/host-linux.cc: ...here.
* config/host-netbsd.c: Moved to...
* config/host-netbsd.cc: ...here.
* config/host-openbsd.c: Moved to...
* config/host-openbsd.cc: ...here.
* config/host-solaris.c: Moved to...
* config/host-solaris.cc: ...here.
* config/i386/djgpp.c: Moved to...
* config/i386/djgpp.cc: ...here.
* config/i386/driver-i386.c: Moved to...
* config/i386/driver-i386.cc: ...here.
* config/i386/driver-mingw32.c: Moved to...
* config/i386/driver-mingw32.cc: ...here.
* config/i386/gnu-property.c: Moved to...
* config/i386/gnu-property.cc: ...here.
* config/i386/host-cygwin.c: Moved to...
* config/i386/host-cygwin.cc: ...here.
* config/i386/host-i386-darwin.c: Moved to...
* config/i386/host-i386-darwin.cc: ...here.
* config/i386/host-mingw32.c: Moved to...
* config/i386/host-mingw32.cc: ...here.
* config/i386/i386-builtins.c: Moved to...
* config/i386/i386-builtins.cc: ...here.
* config/i386/i386-c.c: Moved to...
* config/i386/i386-c.cc: ...here.
* config/i386/i386-d.c: Moved to...
* config/i386/i386-d.cc: ...here.
* config/i386/i386-expand.c: Moved to...
* config/i386/i386-expand.cc: ...here.
* config/i386/i386-features.c: Moved to...
* config/i386/i386-features.cc: ...here.
* config/i386/i386-options.c: Moved to...
* config/i386/i386-options.cc: ...here.
* config/i386/i386.c: Moved to...
* config/i386/i386.cc: ...here.
* config/i386/intelmic-mkoffload.c: Moved to...
* config/i386/intelmic-mkoffload.cc: ...here.
* config/i386/msformat-c.c: Moved to...
* config/i386/msformat-c.cc: ...here.
* config/i386/winnt-cxx.c: Moved to...
* config/i386/winnt-cxx.cc: ...here.
* config/i386/winnt-d.c: Moved to...
* config/i386/winnt-d.cc: ...here.
* config/i386/winnt-stubs.c: Moved to...
* config/i386/winnt-stubs.cc: ...here.
* config/i386/winnt.c: Moved to...
* config/i386/winnt.cc: ...here.
* config/i386/x86-tune-sched-atom.c: Moved to...
* config/i386/x86-tune-sched-atom.cc: ...here.
* config/i386/x86-tune-sched-bd.c: Moved to...
* config/i386/x86-tune-sched-bd.cc: ...here.
* config/i386/x86-tune-sched-core.c: Moved to...
* config/i386/x86-tune-sched-core.cc: ...here.
* config/i386/x86-tune-sched.c: Moved to...
* config/i386/x86-tune-sched.cc: ...here.
* config/ia64/ia64-c.c: Moved to...
* config/ia64/ia64-c.cc: ...here.
* config/ia64/ia64.c: Moved to...
* config/ia64/ia64.cc: ...here.
* config/iq2000/iq2000.c: Moved to...
* config/iq2000/iq2000.cc: ...here.
* config/linux.c: Moved to...
* config/linux.cc: ...here.
* config/lm32/lm32.c: Moved to...
* config/lm32/lm32.cc: ...here.
* config/m32c/m32c-pragma.c: Moved to...
* config/m32c/m32c-pragma.cc: ...here.
* config/m32c/m32c.c: Moved to...
* config/m32c/m32c.cc: ...here.
* config/m32r/m32r.c: Moved to...
* config/m32r/m32r.cc: ...here.
* config/m68k/m68k.c: Moved to...
* config/m68k/m68k.cc: ...here.
* config/mcore/mcore.c: Moved to...
* config/mcore/mcore.cc: ...here.
* config/microblaze/microblaze-c.c: Moved to...
* config/microblaze/microblaze-c.cc: ...here.
* config/microblaze/microblaze.c: Moved to...
* config/microblaze/microblaze.cc: ...here.
* config/mips/driver-native.c: Moved to...
* config/mips/driver-native.cc: ...here.
* config/mips/frame-header-opt.c: Moved to...
* config/mips/frame-header-opt.cc: ...here.
* config/mips/mips-d.c: Moved to...
* config/mips/mips-d.cc: ...here.
* config/mips/mips.c: Moved to...
* config/mips/mips.cc: ...here.
* config/mmix/mmix.c: Moved to...
* config/mmix/mmix.cc: ...here.
* config/mn10300/mn10300.c: Moved to...
* config/mn10300/mn10300.cc: ...here.
* config/moxie/moxie.c: Moved to...
* config/moxie/moxie.cc: ...here.
* config/msp430/driver-msp430.c: Moved to...
* config/msp430/driver-msp430.cc: ...here.
* config/msp430/msp430-c.c: Moved to...
* config/msp430/msp430-c.cc: ...here.
* config/msp430/msp430-devices.c: Moved to...
* config/msp430/msp430-devices.cc: ...here.
* config/msp430/msp430.c: Moved to...
* config/msp430/msp430.cc: ...here.
* config/nds32/nds32-cost.c: Moved to...
* config/nds32/nds32-cost.cc: ...here.
* config/nds32/nds32-fp-as-gp.c: Moved to...
* config/nds32/nds32-fp-as-gp.cc: ...here.
* config/nds32/nds32-intrinsic.c: Moved to...
* config/nds32/nds32-intrinsic.cc: ...here.
* config/nds32/nds32-isr.c: Moved to...
* config/nds32/nds32-isr.cc: ...here.
* config/nds32/nds32-md-auxiliary.c: Moved to...
* config/nds32/nds32-md-auxiliary.cc: ...here.
* config/nds32/nds32-memory-manipulation.c: Moved to...
* config/nds32/nds32-memory-manipulation.cc: ...here.
* config/nds32/nds32-pipelines-auxiliary.c: Moved to...
* config/nds32/nds32-pipelines-auxiliary.cc: ...here.
* config/nds32/nds32-predicates.c: Moved to...
* config/nds32/nds32-predicates.cc: ...here.
* config/nds32/nds32-relax-opt.c: Moved to...
* config/nds32/nds32-relax-opt.cc: ...here.
* config/nds32/nds32-utils.c: Moved to...
* config/nds32/nds32-utils.cc: ...here.
* config/nds32/nds32.c: Moved to...
* config/nds32/nds32.cc: ...here.
* config/netbsd-d.c: Moved to...
* config/netbsd-d.cc: ...here.
* config/netbsd.c: Moved to...
* config/netbsd.cc: ...here.
* config/nios2/nios2.c: Moved to...
* config/nios2/nios2.cc: ...here.
* config/nvptx/mkoffload.c: Moved to...
* config/nvptx/mkoffload.cc: ...here.
* config/nvptx/nvptx-c.c: Moved to...
* config/nvptx/nvptx-c.cc: ...here.
* config/nvptx/nvptx.c: Moved to...
* config/nvptx/nvptx.cc: ...here.
* config/openbsd-d.c: Moved to...
* config/openbsd-d.cc: ...here.
* config/or1k/or1k.c: Moved to...
* config/or1k/or1k.cc: ...here.
* config/pa/pa-d.c: Moved to...
* config/pa/pa-d.cc: ...here.
* config/pa/pa.c: Moved to...
* config/pa/pa.cc: ...here.
* config/pdp11/pdp11.c: Moved to...
* config/pdp11/pdp11.cc: ...here.
* config/pru/pru-passes.c: Moved to...
* config/pru/pru-passes.cc: ...here.
* config/pru/pru-pragma.c: Moved to...
* config/pru/pru-pragma.cc: ...here.
* config/pru/pru.c: Moved to...
* config/pru/pru.cc: ...here.
* config/riscv/riscv-builtins.c: Moved to...
* config/riscv/riscv-builtins.cc: ...here.
* config/riscv/riscv-c.c: Moved to...
* config/riscv/riscv-c.cc: ...here.
* config/riscv/riscv-d.c: Moved to...
* config/riscv/riscv-d.cc: ...here.
* config/riscv/riscv-shorten-memrefs.c: Moved to...
* config/riscv/riscv-shorten-memrefs.cc: ...here.
* config/riscv/riscv-sr.c: Moved to...
* config/riscv/riscv-sr.cc: ...here.
* config/riscv/riscv.c: Moved to...
* config/riscv/riscv.cc: ...here.
* config/rl78/rl78-c.c: Moved to...
* config/rl78/rl78-c.cc: ...here.
* config/rl78/rl78.c: Moved to...
* config/rl78/rl78.cc: ...here.
* config/rs6000/driver-rs6000.c: Moved to...
* config/rs6000/driver-rs6000.cc: ...here.
* config/rs6000/host-darwin.c: Moved to...
* config/rs6000/host-darwin.cc: ...here.
* config/rs6000/host-ppc64-darwin.c: Moved to...
* config/rs6000/host-ppc64-darwin.cc: ...here.
* config/rs6000/rbtree.c: Moved to...
* config/rs6000/rbtree.cc: ...here.
* config/rs6000/rs6000-c.c: Moved to...
* config/rs6000/rs6000-c.cc: ...here.
* config/rs6000/rs6000-call.c: Moved to...
* config/rs6000/rs6000-call.cc: ...here.
* config/rs6000/rs6000-d.c: Moved to...
* config/rs6000/rs6000-d.cc: ...here.
* config/rs6000/rs6000-gen-builtins.c: Moved to...
* config/rs6000/rs6000-gen-builtins.cc: ...here.
* config/rs6000/rs6000-linux.c: Moved to...
* config/rs6000/rs6000-linux.cc: ...here.
* config/rs6000/rs6000-logue.c: Moved to...
* config/rs6000/rs6000-logue.cc: ...here.
* config/rs6000/rs6000-p8swap.c: Moved to...
* config/rs6000/rs6000-p8swap.cc: ...here.
* config/rs6000/rs6000-pcrel-opt.c: Moved to...
* config/rs6000/rs6000-pcrel-opt.cc: ...here.
* config/rs6000/rs6000-string.c: Moved to...
* config/rs6000/rs6000-string.cc: ...here.
* config/rs6000/rs6000.c: Moved to...
* config/rs6000/rs6000.cc: ...here.
* config/rx/rx.c: Moved to...
* config/rx/rx.cc: ...here.
* config/s390/driver-native.c: Moved to...
* config/s390/driver-native.cc: ...here.
* config/s390/s390-c.c: Moved to...
* config/s390/s390-c.cc: ...here.
* config/s390/s390-d.c: Moved to...
* config/s390/s390-d.cc: ...here.
* config/s390/s390.c: Moved to...
* config/s390/s390.cc: ...here.
* config/sh/divtab-sh4-300.c: Moved to...
* config/sh/divtab-sh4-300.cc: ...here.
* config/sh/divtab-sh4.c: Moved to...
* config/sh/divtab-sh4.cc: ...here.
* config/sh/divtab.c: Moved to...
* config/sh/divtab.cc: ...here.
* config/sh/sh-c.c: Moved to...
* config/sh/sh-c.cc: ...here.
* config/sh/sh.c: Moved to...
* config/sh/sh.cc: ...here.
* config/sol2-c.c: Moved to...
* config/sol2-c.cc: ...here.
* config/sol2-cxx.c: Moved to...
* config/sol2-cxx.cc: ...here.
* config/sol2-d.c: Moved to...
* config/sol2-d.cc: ...here.
* config/sol2-stubs.c: Moved to...
* config/sol2-stubs.cc: ...here.
* config/sol2.c: Moved to...
* config/sol2.cc: ...here.
* config/sparc/driver-sparc.c: Moved to...
* config/sparc/driver-sparc.cc: ...here.
* config/sparc/sparc-c.c: Moved to...
* config/sparc/sparc-c.cc: ...here.
* config/sparc/sparc-d.c: Moved to...
* config/sparc/sparc-d.cc: ...here.
* config/sparc/sparc.c: Moved to...
* config/sparc/sparc.cc: ...here.
* config/stormy16/stormy16.c: Moved to...
* config/stormy16/stormy16.cc: ...here.
* config/tilegx/mul-tables.c: Moved to...
* config/tilegx/mul-tables.cc: ...here.
* config/tilegx/tilegx-c.c: Moved to...
* config/tilegx/tilegx-c.cc: ...here.
* config/tilegx/tilegx.c: Moved to...
* config/tilegx/tilegx.cc: ...here.
* config/tilepro/mul-tables.c: Moved to...
* config/tilepro/mul-tables.cc: ...here.
* config/tilepro/tilepro-c.c: Moved to...
* config/tilepro/tilepro-c.cc: ...here.
* config/tilepro/tilepro.c: Moved to...
* config/tilepro/tilepro.cc: ...here.
* config/v850/v850-c.c: Moved to...
* config/v850/v850-c.cc: ...here.
* config/v850/v850.c: Moved to...
* config/v850/v850.cc: ...here.
* config/vax/vax.c: Moved to...
* config/vax/vax.cc: ...here.
* config/visium/visium.c: Moved to...
* config/visium/visium.cc: ...here.
* config/vms/vms-c.c: Moved to...
* config/vms/vms-c.cc: ...here.
* config/vms/vms-f.c: Moved to...
* config/vms/vms-f.cc: ...here.
* config/vms/vms.c: Moved to...
* config/vms/vms.cc: ...here.
* config/vxworks-c.c: Moved to...
* config/vxworks-c.cc: ...here.
* config/vxworks.c: Moved to...
* config/vxworks.cc: ...here.
* config/winnt-c.c: Moved to...
* config/winnt-c.cc: ...here.
* config/xtensa/xtensa.c: Moved to...
* config/xtensa/xtensa.cc: ...here.
* context.c: Moved to...
* context.cc: ...here.
* convert.c: Moved to...
* convert.cc: ...here.
* coverage.c: Moved to...
* coverage.cc: ...here.
* cppbuiltin.c: Moved to...
* cppbuiltin.cc: ...here.
* cppdefault.c: Moved to...
* cppdefault.cc: ...here.
* cprop.c: Moved to...
* cprop.cc: ...here.
* cse.c: Moved to...
* cse.cc: ...here.
* cselib.c: Moved to...
* cselib.cc: ...here.
* ctfc.c: Moved to...
* ctfc.cc: ...here.
* ctfout.c: Moved to...
* ctfout.cc: ...here.
* data-streamer-in.c: Moved to...
* data-streamer-in.cc: ...here.
* data-streamer-out.c: Moved to...
* data-streamer-out.cc: ...here.
* data-streamer.c: Moved to...
* data-streamer.cc: ...here.
* dbgcnt.c: Moved to...
* dbgcnt.cc: ...here.
* dbxout.c: Moved to...
* dbxout.cc: ...here.
* dce.c: Moved to...
* dce.cc: ...here.
* ddg.c: Moved to...
* ddg.cc: ...here.
* debug.c: Moved to...
* debug.cc: ...here.
* df-core.c: Moved to...
* df-core.cc: ...here.
* df-problems.c: Moved to...
* df-problems.cc: ...here.
* df-scan.c: Moved to...
* df-scan.cc: ...here.
* dfp.c: Moved to...
* dfp.cc: ...here.
* diagnostic-color.c: Moved to...
* diagnostic-color.cc: ...here.
* diagnostic-show-locus.c: Moved to...
* diagnostic-show-locus.cc: ...here.
* diagnostic-spec.c: Moved to...
* diagnostic-spec.cc: ...here.
* diagnostic.c: Moved to...
* diagnostic.cc: ...here.
* dojump.c: Moved to...
* dojump.cc: ...here.
* dominance.c: Moved to...
* dominance.cc: ...here.
* domwalk.c: Moved to...
* domwalk.cc: ...here.
* double-int.c: Moved to...
* double-int.cc: ...here.
* dse.c: Moved to...
* dse.cc: ...here.
* dumpfile.c: Moved to...
* dumpfile.cc: ...here.
* dwarf2asm.c: Moved to...
* dwarf2asm.cc: ...here.
* dwarf2cfi.c: Moved to...
* dwarf2cfi.cc: ...here.
* dwarf2ctf.c: Moved to...
* dwarf2ctf.cc: ...here.
* dwarf2out.c: Moved to...
* dwarf2out.cc: ...here.
* early-remat.c: Moved to...
* early-remat.cc: ...here.
* edit-context.c: Moved to...
* edit-context.cc: ...here.
* emit-rtl.c: Moved to...
* emit-rtl.cc: ...here.
* errors.c: Moved to...
* errors.cc: ...here.
* et-forest.c: Moved to...
* et-forest.cc: ...here.
* except.c: Moved to...
* except.cc: ...here.
* explow.c: Moved to...
* explow.cc: ...here.
* expmed.c: Moved to...
* expmed.cc: ...here.
* expr.c: Moved to...
* expr.cc: ...here.
* fibonacci_heap.c: Moved to...
* fibonacci_heap.cc: ...here.
* file-find.c: Moved to...
* file-find.cc: ...here.
* file-prefix-map.c: Moved to...
* file-prefix-map.cc: ...here.
* final.c: Moved to...
* final.cc: ...here.
* fixed-value.c: Moved to...
* fixed-value.cc: ...here.
* fold-const-call.c: Moved to...
* fold-const-call.cc: ...here.
* fold-const.c: Moved to...
* fold-const.cc: ...here.
* fp-test.c: Moved to...
* fp-test.cc: ...here.
* function-tests.c: Moved to...
* function-tests.cc: ...here.
* function.c: Moved to...
* function.cc: ...here.
* fwprop.c: Moved to...
* fwprop.cc: ...here.
* gcc-ar.c: Moved to...
* gcc-ar.cc: ...here.
* gcc-main.c: Moved to...
* gcc-main.cc: ...here.
* gcc-rich-location.c: Moved to...
* gcc-rich-location.cc: ...here.
* gcc.c: Moved to...
* gcc.cc: ...here.
* gcov-dump.c: Moved to...
* gcov-dump.cc: ...here.
* gcov-io.c: Moved to...
* gcov-io.cc: ...here.
* gcov-tool.c: Moved to...
* gcov-tool.cc: ...here.
* gcov.c: Moved to...
* gcov.cc: ...here.
* gcse-common.c: Moved to...
* gcse-common.cc: ...here.
* gcse.c: Moved to...
* gcse.cc: ...here.
* genattr-common.c: Moved to...
* genattr-common.cc: ...here.
* genattr.c: Moved to...
* genattr.cc: ...here.
* genattrtab.c: Moved to...
* genattrtab.cc: ...here.
* genautomata.c: Moved to...
* genautomata.cc: ...here.
* gencfn-macros.c: Moved to...
* gencfn-macros.cc: ...here.
* gencheck.c: Moved to...
* gencheck.cc: ...here.
* genchecksum.c: Moved to...
* genchecksum.cc: ...here.
* gencodes.c: Moved to...
* gencodes.cc: ...here.
* genconditions.c: Moved to...
* genconditions.cc: ...here.
* genconfig.c: Moved to...
* genconfig.cc: ...here.
* genconstants.c: Moved to...
* genconstants.cc: ...here.
* genemit.c: Moved to...
* genemit.cc: ...here.
* genenums.c: Moved to...
* genenums.cc: ...here.
* generic-match-head.c: Moved to...
* generic-match-head.cc: ...here.
* genextract.c: Moved to...
* genextract.cc: ...here.
* genflags.c: Moved to...
* genflags.cc: ...here.
* gengenrtl.c: Moved to...
* gengenrtl.cc: ...here.
* gengtype-parse.c: Moved to...
* gengtype-parse.cc: ...here.
* gengtype-state.c: Moved to...
* gengtype-state.cc: ...here.
* gengtype.c: Moved to...
* gengtype.cc: ...here.
* genhooks.c: Moved to...
* genhooks.cc: ...here.
* genmatch.c: Moved to...
* genmatch.cc: ...here.
* genmddeps.c: Moved to...
* genmddeps.cc: ...here.
* genmddump.c: Moved to...
* genmddump.cc: ...here.
* genmodes.c: Moved to...
* genmodes.cc: ...here.
* genopinit.c: Moved to...
* genopinit.cc: ...here.
* genoutput.c: Moved to...
* genoutput.cc: ...here.
* genpeep.c: Moved to...
* genpeep.cc: ...here.
* genpreds.c: Moved to...
* genpreds.cc: ...here.
* genrecog.c: Moved to...
* genrecog.cc: ...here.
* gensupport.c: Moved to...
* gensupport.cc: ...here.
* gentarget-def.c: Moved to...
* gentarget-def.cc: ...here.
* genversion.c: Moved to...
* genversion.cc: ...here.
* ggc-common.c: Moved to...
* ggc-common.cc: ...here.
* ggc-none.c: Moved to...
* ggc-none.cc: ...here.
* ggc-page.c: Moved to...
* ggc-page.cc: ...here.
* ggc-tests.c: Moved to...
* ggc-tests.cc: ...here.
* gimple-builder.c: Moved to...
* gimple-builder.cc: ...here.
* gimple-expr.c: Moved to...
* gimple-expr.cc: ...here.
* gimple-fold.c: Moved to...
* gimple-fold.cc: ...here.
* gimple-iterator.c: Moved to...
* gimple-iterator.cc: ...here.
* gimple-laddress.c: Moved to...
* gimple-laddress.cc: ...here.
* gimple-loop-jam.c: Moved to...
* gimple-loop-jam.cc: ...here.
* gimple-low.c: Moved to...
* gimple-low.cc: ...here.
* gimple-match-head.c: Moved to...
* gimple-match-head.cc: ...here.
* gimple-pretty-print.c: Moved to...
* gimple-pretty-print.cc: ...here.
* gimple-ssa-backprop.c: Moved to...
* gimple-ssa-backprop.cc: ...here.
* gimple-ssa-evrp-analyze.c: Moved to...
* gimple-ssa-evrp-analyze.cc: ...here.
* gimple-ssa-evrp.c: Moved to...
* gimple-ssa-evrp.cc: ...here.
* gimple-ssa-isolate-paths.c: Moved to...
* gimple-ssa-isolate-paths.cc: ...here.
* gimple-ssa-nonnull-compare.c: Moved to...
* gimple-ssa-nonnull-compare.cc: ...here.
* gimple-ssa-split-paths.c: Moved to...
* gimple-ssa-split-paths.cc: ...here.
* gimple-ssa-sprintf.c: Moved to...
* gimple-ssa-sprintf.cc: ...here.
* gimple-ssa-store-merging.c: Moved to...
* gimple-ssa-store-merging.cc: ...here.
* gimple-ssa-strength-reduction.c: Moved to...
* gimple-ssa-strength-reduction.cc: ...here.
* gimple-ssa-warn-alloca.c: Moved to...
* gimple-ssa-warn-alloca.cc: ...here.
* gimple-ssa-warn-restrict.c: Moved to...
* gimple-ssa-warn-restrict.cc: ...here.
* gimple-streamer-in.c: Moved to...
* gimple-streamer-in.cc: ...here.
* gimple-streamer-out.c: Moved to...
* gimple-streamer-out.cc: ...here.
* gimple-walk.c: Moved to...
* gimple-walk.cc: ...here.
* gimple-warn-recursion.c: Moved to...
* gimple-warn-recursion.cc: ...here.
* gimple.c: Moved to...
* gimple.cc: ...here.
* gimplify-me.c: Moved to...
* gimplify-me.cc: ...here.
* gimplify.c: Moved to...
* gimplify.cc: ...here.
* godump.c: Moved to...
* godump.cc: ...here.
* graph.c: Moved to...
* graph.cc: ...here.
* graphds.c: Moved to...
* graphds.cc: ...here.
* graphite-dependences.c: Moved to...
* graphite-dependences.cc: ...here.
* graphite-isl-ast-to-gimple.c: Moved to...
* graphite-isl-ast-to-gimple.cc: ...here.
* graphite-optimize-isl.c: Moved to...
* graphite-optimize-isl.cc: ...here.
* graphite-poly.c: Moved to...
* graphite-poly.cc: ...here.
* graphite-scop-detection.c: Moved to...
* graphite-scop-detection.cc: ...here.
* graphite-sese-to-poly.c: Moved to...
* graphite-sese-to-poly.cc: ...here.
* graphite.c: Moved to...
* graphite.cc: ...here.
* haifa-sched.c: Moved to...
* haifa-sched.cc: ...here.
* hash-map-tests.c: Moved to...
* hash-map-tests.cc: ...here.
* hash-set-tests.c: Moved to...
* hash-set-tests.cc: ...here.
* hash-table.c: Moved to...
* hash-table.cc: ...here.
* hooks.c: Moved to...
* hooks.cc: ...here.
* host-default.c: Moved to...
* host-default.cc: ...here.
* hw-doloop.c: Moved to...
* hw-doloop.cc: ...here.
* hwint.c: Moved to...
* hwint.cc: ...here.
* ifcvt.c: Moved to...
* ifcvt.cc: ...here.
* inchash.c: Moved to...
* inchash.cc: ...here.
* incpath.c: Moved to...
* incpath.cc: ...here.
* init-regs.c: Moved to...
* init-regs.cc: ...here.
* input.c: Moved to...
* input.cc: ...here.
* internal-fn.c: Moved to...
* internal-fn.cc: ...here.
* intl.c: Moved to...
* intl.cc: ...here.
* ipa-comdats.c: Moved to...
* ipa-comdats.cc: ...here.
* ipa-cp.c: Moved to...
* ipa-cp.cc: ...here.
* ipa-devirt.c: Moved to...
* ipa-devirt.cc: ...here.
* ipa-fnsummary.c: Moved to...
* ipa-fnsummary.cc: ...here.
* ipa-icf-gimple.c: Moved to...
* ipa-icf-gimple.cc: ...here.
* ipa-icf.c: Moved to...
* ipa-icf.cc: ...here.
* ipa-inline-analysis.c: Moved to...
* ipa-inline-analysis.cc: ...here.
* ipa-inline-transform.c: Moved to...
* ipa-inline-transform.cc: ...here.
* ipa-inline.c: Moved to...
* ipa-inline.cc: ...here.
* ipa-modref-tree.c: Moved to...
* ipa-modref-tree.cc: ...here.
* ipa-modref.c: Moved to...
* ipa-modref.cc: ...here.
* ipa-param-manipulation.c: Moved to...
* ipa-param-manipulation.cc: ...here.
* ipa-polymorphic-call.c: Moved to...
* ipa-polymorphic-call.cc: ...here.
* ipa-predicate.c: Moved to...
* ipa-predicate.cc: ...here.
* ipa-profile.c: Moved to...
* ipa-profile.cc: ...here.
* ipa-prop.c: Moved to...
* ipa-prop.cc: ...here.
* ipa-pure-const.c: Moved to...
* ipa-pure-const.cc: ...here.
* ipa-ref.c: Moved to...
* ipa-ref.cc: ...here.
* ipa-reference.c: Moved to...
* ipa-reference.cc: ...here.
* ipa-split.c: Moved to...
* ipa-split.cc: ...here.
* ipa-sra.c: Moved to...
* ipa-sra.cc: ...here.
* ipa-utils.c: Moved to...
* ipa-utils.cc: ...here.
* ipa-visibility.c: Moved to...
* ipa-visibility.cc: ...here.
* ipa.c: Moved to...
* ipa.cc: ...here.
* ira-build.c: Moved to...
* ira-build.cc: ...here.
* ira-color.c: Moved to...
* ira-color.cc: ...here.
* ira-conflicts.c: Moved to...
* ira-conflicts.cc: ...here.
* ira-costs.c: Moved to...
* ira-costs.cc: ...here.
* ira-emit.c: Moved to...
* ira-emit.cc: ...here.
* ira-lives.c: Moved to...
* ira-lives.cc: ...here.
* ira.c: Moved to...
* ira.cc: ...here.
* jump.c: Moved to...
* jump.cc: ...here.
* langhooks.c: Moved to...
* langhooks.cc: ...here.
* lcm.c: Moved to...
* lcm.cc: ...here.
* lists.c: Moved to...
* lists.cc: ...here.
* loop-doloop.c: Moved to...
* loop-doloop.cc: ...here.
* loop-init.c: Moved to...
* loop-init.cc: ...here.
* loop-invariant.c: Moved to...
* loop-invariant.cc: ...here.
* loop-iv.c: Moved to...
* loop-iv.cc: ...here.
* loop-unroll.c: Moved to...
* loop-unroll.cc: ...here.
* lower-subreg.c: Moved to...
* lower-subreg.cc: ...here.
* lra-assigns.c: Moved to...
* lra-assigns.cc: ...here.
* lra-coalesce.c: Moved to...
* lra-coalesce.cc: ...here.
* lra-constraints.c: Moved to...
* lra-constraints.cc: ...here.
* lra-eliminations.c: Moved to...
* lra-eliminations.cc: ...here.
* lra-lives.c: Moved to...
* lra-lives.cc: ...here.
* lra-remat.c: Moved to...
* lra-remat.cc: ...here.
* lra-spills.c: Moved to...
* lra-spills.cc: ...here.
* lra.c: Moved to...
* lra.cc: ...here.
* lto-cgraph.c: Moved to...
* lto-cgraph.cc: ...here.
* lto-compress.c: Moved to...
* lto-compress.cc: ...here.
* lto-opts.c: Moved to...
* lto-opts.cc: ...here.
* lto-section-in.c: Moved to...
* lto-section-in.cc: ...here.
* lto-section-out.c: Moved to...
* lto-section-out.cc: ...here.
* lto-streamer-in.c: Moved to...
* lto-streamer-in.cc: ...here.
* lto-streamer-out.c: Moved to...
* lto-streamer-out.cc: ...here.
* lto-streamer.c: Moved to...
* lto-streamer.cc: ...here.
* lto-wrapper.c: Moved to...
* lto-wrapper.cc: ...here.
* main.c: Moved to...
* main.cc: ...here.
* mcf.c: Moved to...
* mcf.cc: ...here.
* mode-switching.c: Moved to...
* mode-switching.cc: ...here.
* modulo-sched.c: Moved to...
* modulo-sched.cc: ...here.
* multiple_target.c: Moved to...
* multiple_target.cc: ...here.
* omp-expand.c: Moved to...
* omp-expand.cc: ...here.
* omp-general.c: Moved to...
* omp-general.cc: ...here.
* omp-low.c: Moved to...
* omp-low.cc: ...here.
* omp-offload.c: Moved to...
* omp-offload.cc: ...here.
* omp-simd-clone.c: Moved to...
* omp-simd-clone.cc: ...here.
* opt-suggestions.c: Moved to...
* opt-suggestions.cc: ...here.
* optabs-libfuncs.c: Moved to...
* optabs-libfuncs.cc: ...here.
* optabs-query.c: Moved to...
* optabs-query.cc: ...here.
* optabs-tree.c: Moved to...
* optabs-tree.cc: ...here.
* optabs.c: Moved to...
* optabs.cc: ...here.
* opts-common.c: Moved to...
* opts-common.cc: ...here.
* opts-global.c: Moved to...
* opts-global.cc: ...here.
* opts.c: Moved to...
* opts.cc: ...here.
* passes.c: Moved to...
* passes.cc: ...here.
* plugin.c: Moved to...
* plugin.cc: ...here.
* postreload-gcse.c: Moved to...
* postreload-gcse.cc: ...here.
* postreload.c: Moved to...
* postreload.cc: ...here.
* predict.c: Moved to...
* predict.cc: ...here.
* prefix.c: Moved to...
* prefix.cc: ...here.
* pretty-print.c: Moved to...
* pretty-print.cc: ...here.
* print-rtl-function.c: Moved to...
* print-rtl-function.cc: ...here.
* print-rtl.c: Moved to...
* print-rtl.cc: ...here.
* print-tree.c: Moved to...
* print-tree.cc: ...here.
* profile-count.c: Moved to...
* profile-count.cc: ...here.
* profile.c: Moved to...
* profile.cc: ...here.
* read-md.c: Moved to...
* read-md.cc: ...here.
* read-rtl-function.c: Moved to...
* read-rtl-function.cc: ...here.
* read-rtl.c: Moved to...
* read-rtl.cc: ...here.
* real.c: Moved to...
* real.cc: ...here.
* realmpfr.c: Moved to...
* realmpfr.cc: ...here.
* recog.c: Moved to...
* recog.cc: ...here.
* ree.c: Moved to...
* ree.cc: ...here.
* reg-stack.c: Moved to...
* reg-stack.cc: ...here.
* regcprop.c: Moved to...
* regcprop.cc: ...here.
* reginfo.c: Moved to...
* reginfo.cc: ...here.
* regrename.c: Moved to...
* regrename.cc: ...here.
* regstat.c: Moved to...
* regstat.cc: ...here.
* reload.c: Moved to...
* reload.cc: ...here.
* reload1.c: Moved to...
* reload1.cc: ...here.
* reorg.c: Moved to...
* reorg.cc: ...here.
* resource.c: Moved to...
* resource.cc: ...here.
* rtl-error.c: Moved to...
* rtl-error.cc: ...here.
* rtl-tests.c: Moved to...
* rtl-tests.cc: ...here.
* rtl.c: Moved to...
* rtl.cc: ...here.
* rtlanal.c: Moved to...
* rtlanal.cc: ...here.
* rtlhash.c: Moved to...
* rtlhash.cc: ...here.
* rtlhooks.c: Moved to...
* rtlhooks.cc: ...here.
* rtx-vector-builder.c: Moved to...
* rtx-vector-builder.cc: ...here.
* run-rtl-passes.c: Moved to...
* run-rtl-passes.cc: ...here.
* sancov.c: Moved to...
* sancov.cc: ...here.
* sanopt.c: Moved to...
* sanopt.cc: ...here.
* sbitmap.c: Moved to...
* sbitmap.cc: ...here.
* sched-deps.c: Moved to...
* sched-deps.cc: ...here.
* sched-ebb.c: Moved to...
* sched-ebb.cc: ...here.
* sched-rgn.c: Moved to...
* sched-rgn.cc: ...here.
* sel-sched-dump.c: Moved to...
* sel-sched-dump.cc: ...here.
* sel-sched-ir.c: Moved to...
* sel-sched-ir.cc: ...here.
* sel-sched.c: Moved to...
* sel-sched.cc: ...here.
* selftest-diagnostic.c: Moved to...
* selftest-diagnostic.cc: ...here.
* selftest-rtl.c: Moved to...
* selftest-rtl.cc: ...here.
* selftest-run-tests.c: Moved to...
* selftest-run-tests.cc: ...here.
* selftest.c: Moved to...
* selftest.cc: ...here.
* sese.c: Moved to...
* sese.cc: ...here.
* shrink-wrap.c: Moved to...
* shrink-wrap.cc: ...here.
* simplify-rtx.c: Moved to...
* simplify-rtx.cc: ...here.
* sparseset.c: Moved to...
* sparseset.cc: ...here.
* spellcheck-tree.c: Moved to...
* spellcheck-tree.cc: ...here.
* spellcheck.c: Moved to...
* spellcheck.cc: ...here.
* sreal.c: Moved to...
* sreal.cc: ...here.
* stack-ptr-mod.c: Moved to...
* stack-ptr-mod.cc: ...here.
* statistics.c: Moved to...
* statistics.cc: ...here.
* stmt.c: Moved to...
* stmt.cc: ...here.
* stor-layout.c: Moved to...
* stor-layout.cc: ...here.
* store-motion.c: Moved to...
* store-motion.cc: ...here.
* streamer-hooks.c: Moved to...
* streamer-hooks.cc: ...here.
* stringpool.c: Moved to...
* stringpool.cc: ...here.
* substring-locations.c: Moved to...
* substring-locations.cc: ...here.
* symtab.c: Moved to...
* symtab.cc: ...here.
* target-globals.c: Moved to...
* target-globals.cc: ...here.
* targhooks.c: Moved to...
* targhooks.cc: ...here.
* timevar.c: Moved to...
* timevar.cc: ...here.
* toplev.c: Moved to...
* toplev.cc: ...here.
* tracer.c: Moved to...
* tracer.cc: ...here.
* trans-mem.c: Moved to...
* trans-mem.cc: ...here.
* tree-affine.c: Moved to...
* tree-affine.cc: ...here.
* tree-call-cdce.c: Moved to...
* tree-call-cdce.cc: ...here.
* tree-cfg.c: Moved to...
* tree-cfg.cc: ...here.
* tree-cfgcleanup.c: Moved to...
* tree-cfgcleanup.cc: ...here.
* tree-chrec.c: Moved to...
* tree-chrec.cc: ...here.
* tree-complex.c: Moved to...
* tree-complex.cc: ...here.
* tree-data-ref.c: Moved to...
* tree-data-ref.cc: ...here.
* tree-dfa.c: Moved to...
* tree-dfa.cc: ...here.
* tree-diagnostic.c: Moved to...
* tree-diagnostic.cc: ...here.
* tree-dump.c: Moved to...
* tree-dump.cc: ...here.
* tree-eh.c: Moved to...
* tree-eh.cc: ...here.
* tree-emutls.c: Moved to...
* tree-emutls.cc: ...here.
* tree-if-conv.c: Moved to...
* tree-if-conv.cc: ...here.
* tree-inline.c: Moved to...
* tree-inline.cc: ...here.
* tree-into-ssa.c: Moved to...
* tree-into-ssa.cc: ...here.
* tree-iterator.c: Moved to...
* tree-iterator.cc: ...here.
* tree-loop-distribution.c: Moved to...
* tree-loop-distribution.cc: ...here.
* tree-nested.c: Moved to...
* tree-nested.cc: ...here.
* tree-nrv.c: Moved to...
* tree-nrv.cc: ...here.
* tree-object-size.c: Moved to...
* tree-object-size.cc: ...here.
* tree-outof-ssa.c: Moved to...
* tree-outof-ssa.cc: ...here.
* tree-parloops.c: Moved to...
* tree-parloops.cc: ...here.
* tree-phinodes.c: Moved to...
* tree-phinodes.cc: ...here.
* tree-predcom.c: Moved to...
* tree-predcom.cc: ...here.
* tree-pretty-print.c: Moved to...
* tree-pretty-print.cc: ...here.
* tree-profile.c: Moved to...
* tree-profile.cc: ...here.
* tree-scalar-evolution.c: Moved to...
* tree-scalar-evolution.cc: ...here.
* tree-sra.c: Moved to...
* tree-sra.cc: ...here.
* tree-ssa-address.c: Moved to...
* tree-ssa-address.cc: ...here.
* tree-ssa-alias.c: Moved to...
* tree-ssa-alias.cc: ...here.
* tree-ssa-ccp.c: Moved to...
* tree-ssa-ccp.cc: ...here.
* tree-ssa-coalesce.c: Moved to...
* tree-ssa-coalesce.cc: ...here.
* tree-ssa-copy.c: Moved to...
* tree-ssa-copy.cc: ...here.
* tree-ssa-dce.c: Moved to...
* tree-ssa-dce.cc: ...here.
* tree-ssa-dom.c: Moved to...
* tree-ssa-dom.cc: ...here.
* tree-ssa-dse.c: Moved to...
* tree-ssa-dse.cc: ...here.
* tree-ssa-forwprop.c: Moved to...
* tree-ssa-forwprop.cc: ...here.
* tree-ssa-ifcombine.c: Moved to...
* tree-ssa-ifcombine.cc: ...here.
* tree-ssa-live.c: Moved to...
* tree-ssa-live.cc: ...here.
* tree-ssa-loop-ch.c: Moved to...
* tree-ssa-loop-ch.cc: ...here.
* tree-ssa-loop-im.c: Moved to...
* tree-ssa-loop-im.cc: ...here.
* tree-ssa-loop-ivcanon.c: Moved to...
* tree-ssa-loop-ivcanon.cc: ...here.
* tree-ssa-loop-ivopts.c: Moved to...
* tree-ssa-loop-ivopts.cc: ...here.
* tree-ssa-loop-manip.c: Moved to...
* tree-ssa-loop-manip.cc: ...here.
* tree-ssa-loop-niter.c: Moved to...
* tree-ssa-loop-niter.cc: ...here.
* tree-ssa-loop-prefetch.c: Moved to...
* tree-ssa-loop-prefetch.cc: ...here.
* tree-ssa-loop-split.c: Moved to...
* tree-ssa-loop-split.cc: ...here.
* tree-ssa-loop-unswitch.c: Moved to...
* tree-ssa-loop-unswitch.cc: ...here.
* tree-ssa-loop.c: Moved to...
* tree-ssa-loop.cc: ...here.
* tree-ssa-math-opts.c: Moved to...
* tree-ssa-math-opts.cc: ...here.
* tree-ssa-operands.c: Moved to...
* tree-ssa-operands.cc: ...here.
* tree-ssa-phiopt.c: Moved to...
* tree-ssa-phiopt.cc: ...here.
* tree-ssa-phiprop.c: Moved to...
* tree-ssa-phiprop.cc: ...here.
* tree-ssa-pre.c: Moved to...
* tree-ssa-pre.cc: ...here.
* tree-ssa-propagate.c: Moved to...
* tree-ssa-propagate.cc: ...here.
* tree-ssa-reassoc.c: Moved to...
* tree-ssa-reassoc.cc: ...here.
* tree-ssa-sccvn.c: Moved to...
* tree-ssa-sccvn.cc: ...here.
* tree-ssa-scopedtables.c: Moved to...
* tree-ssa-scopedtables.cc: ...here.
* tree-ssa-sink.c: Moved to...
* tree-ssa-sink.cc: ...here.
* tree-ssa-strlen.c: Moved to...
* tree-ssa-strlen.cc: ...here.
* tree-ssa-structalias.c: Moved to...
* tree-ssa-structalias.cc: ...here.
* tree-ssa-tail-merge.c: Moved to...
* tree-ssa-tail-merge.cc: ...here.
* tree-ssa-ter.c: Moved to...
* tree-ssa-ter.cc: ...here.
* tree-ssa-threadbackward.c: Moved to...
* tree-ssa-threadbackward.cc: ...here.
* tree-ssa-threadedge.c: Moved to...
* tree-ssa-threadedge.cc: ...here.
* tree-ssa-threadupdate.c: Moved to...
* tree-ssa-threadupdate.cc: ...here.
* tree-ssa-uncprop.c: Moved to...
* tree-ssa-uncprop.cc: ...here.
* tree-ssa-uninit.c: Moved to...
* tree-ssa-uninit.cc: ...here.
* tree-ssa.c: Moved to...
* tree-ssa.cc: ...here.
* tree-ssanames.c: Moved to...
* tree-ssanames.cc: ...here.
* tree-stdarg.c: Moved to...
* tree-stdarg.cc: ...here.
* tree-streamer-in.c: Moved to...
* tree-streamer-in.cc: ...here.
* tree-streamer-out.c: Moved to...
* tree-streamer-out.cc: ...here.
* tree-streamer.c: Moved to...
* tree-streamer.cc: ...here.
* tree-switch-conversion.c: Moved to...
* tree-switch-conversion.cc: ...here.
* tree-tailcall.c: Moved to...
* tree-tailcall.cc: ...here.
* tree-vect-data-refs.c: Moved to...
* tree-vect-data-refs.cc: ...here.
* tree-vect-generic.c: Moved to...
* tree-vect-generic.cc: ...here.
* tree-vect-loop-manip.c: Moved to...
* tree-vect-loop-manip.cc: ...here.
* tree-vect-loop.c: Moved to...
* tree-vect-loop.cc: ...here.
* tree-vect-patterns.c: Moved to...
* tree-vect-patterns.cc: ...here.
* tree-vect-slp-patterns.c: Moved to...
* tree-vect-slp-patterns.cc: ...here.
* tree-vect-slp.c: Moved to...
* tree-vect-slp.cc: ...here.
* tree-vect-stmts.c: Moved to...
* tree-vect-stmts.cc: ...here.
* tree-vector-builder.c: Moved to...
* tree-vector-builder.cc: ...here.
* tree-vectorizer.c: Moved to...
* tree-vectorizer.cc: ...here.
* tree-vrp.c: Moved to...
* tree-vrp.cc: ...here.
* tree.c: Moved to...
* tree.cc: ...here.
* tsan.c: Moved to...
* tsan.cc: ...here.
* typed-splay-tree.c: Moved to...
* typed-splay-tree.cc: ...here.
* ubsan.c: Moved to...
* ubsan.cc: ...here.
* valtrack.c: Moved to...
* valtrack.cc: ...here.
* value-prof.c: Moved to...
* value-prof.cc: ...here.
* var-tracking.c: Moved to...
* var-tracking.cc: ...here.
* varasm.c: Moved to...
* varasm.cc: ...here.
* varpool.c: Moved to...
* varpool.cc: ...here.
* vec-perm-indices.c: Moved to...
* vec-perm-indices.cc: ...here.
* vec.c: Moved to...
* vec.cc: ...here.
* vmsdbgout.c: Moved to...
* vmsdbgout.cc: ...here.
* vr-values.c: Moved to...
* vr-values.cc: ...here.
* vtable-verify.c: Moved to...
* vtable-verify.cc: ...here.
* web.c: Moved to...
* web.cc: ...here.
* xcoffout.c: Moved to...
* xcoffout.cc: ...here.
gcc/c-family/ChangeLog:
* c-ada-spec.c: Moved to...
* c-ada-spec.cc: ...here.
* c-attribs.c: Moved to...
* c-attribs.cc: ...here.
* c-common.c: Moved to...
* c-common.cc: ...here.
* c-cppbuiltin.c: Moved to...
* c-cppbuiltin.cc: ...here.
* c-dump.c: Moved to...
* c-dump.cc: ...here.
* c-format.c: Moved to...
* c-format.cc: ...here.
* c-gimplify.c: Moved to...
* c-gimplify.cc: ...here.
* c-indentation.c: Moved to...
* c-indentation.cc: ...here.
* c-lex.c: Moved to...
* c-lex.cc: ...here.
* c-omp.c: Moved to...
* c-omp.cc: ...here.
* c-opts.c: Moved to...
* c-opts.cc: ...here.
* c-pch.c: Moved to...
* c-pch.cc: ...here.
* c-ppoutput.c: Moved to...
* c-ppoutput.cc: ...here.
* c-pragma.c: Moved to...
* c-pragma.cc: ...here.
* c-pretty-print.c: Moved to...
* c-pretty-print.cc: ...here.
* c-semantics.c: Moved to...
* c-semantics.cc: ...here.
* c-ubsan.c: Moved to...
* c-ubsan.cc: ...here.
* c-warn.c: Moved to...
* c-warn.cc: ...here.
* cppspec.c: Moved to...
* cppspec.cc: ...here.
* stub-objc.c: Moved to...
* stub-objc.cc: ...here.
gcc/c/ChangeLog:
* c-aux-info.c: Moved to...
* c-aux-info.cc: ...here.
* c-convert.c: Moved to...
* c-convert.cc: ...here.
* c-decl.c: Moved to...
* c-decl.cc: ...here.
* c-errors.c: Moved to...
* c-errors.cc: ...here.
* c-fold.c: Moved to...
* c-fold.cc: ...here.
* c-lang.c: Moved to...
* c-lang.cc: ...here.
* c-objc-common.c: Moved to...
* c-objc-common.cc: ...here.
* c-parser.c: Moved to...
* c-parser.cc: ...here.
* c-typeck.c: Moved to...
* c-typeck.cc: ...here.
* gccspec.c: Moved to...
* gccspec.cc: ...here.
* gimple-parser.c: Moved to...
* gimple-parser.cc: ...here.
gcc/cp/ChangeLog:
* call.c: Moved to...
* call.cc: ...here.
* class.c: Moved to...
* class.cc: ...here.
* constexpr.c: Moved to...
* constexpr.cc: ...here.
* cp-gimplify.c: Moved to...
* cp-gimplify.cc: ...here.
* cp-lang.c: Moved to...
* cp-lang.cc: ...here.
* cp-objcp-common.c: Moved to...
* cp-objcp-common.cc: ...here.
* cp-ubsan.c: Moved to...
* cp-ubsan.cc: ...here.
* cvt.c: Moved to...
* cvt.cc: ...here.
* cxx-pretty-print.c: Moved to...
* cxx-pretty-print.cc: ...here.
* decl.c: Moved to...
* decl.cc: ...here.
* decl2.c: Moved to...
* decl2.cc: ...here.
* dump.c: Moved to...
* dump.cc: ...here.
* error.c: Moved to...
* error.cc: ...here.
* except.c: Moved to...
* except.cc: ...here.
* expr.c: Moved to...
* expr.cc: ...here.
* friend.c: Moved to...
* friend.cc: ...here.
* g++spec.c: Moved to...
* g++spec.cc: ...here.
* init.c: Moved to...
* init.cc: ...here.
* lambda.c: Moved to...
* lambda.cc: ...here.
* lex.c: Moved to...
* lex.cc: ...here.
* mangle.c: Moved to...
* mangle.cc: ...here.
* method.c: Moved to...
* method.cc: ...here.
* name-lookup.c: Moved to...
* name-lookup.cc: ...here.
* optimize.c: Moved to...
* optimize.cc: ...here.
* parser.c: Moved to...
* parser.cc: ...here.
* pt.c: Moved to...
* pt.cc: ...here.
* ptree.c: Moved to...
* ptree.cc: ...here.
* rtti.c: Moved to...
* rtti.cc: ...here.
* search.c: Moved to...
* search.cc: ...here.
* semantics.c: Moved to...
* semantics.cc: ...here.
* tree.c: Moved to...
* tree.cc: ...here.
* typeck.c: Moved to...
* typeck.cc: ...here.
* typeck2.c: Moved to...
* typeck2.cc: ...here.
* vtable-class-hierarchy.c: Moved to...
* vtable-class-hierarchy.cc: ...here.
gcc/fortran/ChangeLog:
* arith.c: Moved to...
* arith.cc: ...here.
* array.c: Moved to...
* array.cc: ...here.
* bbt.c: Moved to...
* bbt.cc: ...here.
* check.c: Moved to...
* check.cc: ...here.
* class.c: Moved to...
* class.cc: ...here.
* constructor.c: Moved to...
* constructor.cc: ...here.
* convert.c: Moved to...
* convert.cc: ...here.
* cpp.c: Moved to...
* cpp.cc: ...here.
* data.c: Moved to...
* data.cc: ...here.
* decl.c: Moved to...
* decl.cc: ...here.
* dependency.c: Moved to...
* dependency.cc: ...here.
* dump-parse-tree.c: Moved to...
* dump-parse-tree.cc: ...here.
* error.c: Moved to...
* error.cc: ...here.
* expr.c: Moved to...
* expr.cc: ...here.
* f95-lang.c: Moved to...
* f95-lang.cc: ...here.
* frontend-passes.c: Moved to...
* frontend-passes.cc: ...here.
* gfortranspec.c: Moved to...
* gfortranspec.cc: ...here.
* interface.c: Moved to...
* interface.cc: ...here.
* intrinsic.c: Moved to...
* intrinsic.cc: ...here.
* io.c: Moved to...
* io.cc: ...here.
* iresolve.c: Moved to...
* iresolve.cc: ...here.
* match.c: Moved to...
* match.cc: ...here.
* matchexp.c: Moved to...
* matchexp.cc: ...here.
* misc.c: Moved to...
* misc.cc: ...here.
* module.c: Moved to...
* module.cc: ...here.
* openmp.c: Moved to...
* openmp.cc: ...here.
* options.c: Moved to...
* options.cc: ...here.
* parse.c: Moved to...
* parse.cc: ...here.
* primary.c: Moved to...
* primary.cc: ...here.
* resolve.c: Moved to...
* resolve.cc: ...here.
* scanner.c: Moved to...
* scanner.cc: ...here.
* simplify.c: Moved to...
* simplify.cc: ...here.
* st.c: Moved to...
* st.cc: ...here.
* symbol.c: Moved to...
* symbol.cc: ...here.
* target-memory.c: Moved to...
* target-memory.cc: ...here.
* trans-array.c: Moved to...
* trans-array.cc: ...here.
* trans-common.c: Moved to...
* trans-common.cc: ...here.
* trans-const.c: Moved to...
* trans-const.cc: ...here.
* trans-decl.c: Moved to...
* trans-decl.cc: ...here.
* trans-expr.c: Moved to...
* trans-expr.cc: ...here.
* trans-intrinsic.c: Moved to...
* trans-intrinsic.cc: ...here.
* trans-io.c: Moved to...
* trans-io.cc: ...here.
* trans-openmp.c: Moved to...
* trans-openmp.cc: ...here.
* trans-stmt.c: Moved to...
* trans-stmt.cc: ...here.
* trans-types.c: Moved to...
* trans-types.cc: ...here.
* trans.c: Moved to...
* trans.cc: ...here.
gcc/go/ChangeLog:
* go-backend.c: Moved to...
* go-backend.cc: ...here.
* go-lang.c: Moved to...
* go-lang.cc: ...here.
* gospec.c: Moved to...
* gospec.cc: ...here.
gcc/jit/ChangeLog:
* dummy-frontend.c: Moved to...
* dummy-frontend.cc: ...here.
* jit-builtins.c: Moved to...
* jit-builtins.cc: ...here.
* jit-logging.c: Moved to...
* jit-logging.cc: ...here.
* jit-playback.c: Moved to...
* jit-playback.cc: ...here.
* jit-recording.c: Moved to...
* jit-recording.cc: ...here.
* jit-result.c: Moved to...
* jit-result.cc: ...here.
* jit-spec.c: Moved to...
* jit-spec.cc: ...here.
* jit-tempdir.c: Moved to...
* jit-tempdir.cc: ...here.
* jit-w32.c: Moved to...
* jit-w32.cc: ...here.
* libgccjit.c: Moved to...
* libgccjit.cc: ...here.
gcc/lto/ChangeLog:
* common.c: Moved to...
* common.cc: ...here.
* lto-common.c: Moved to...
* lto-common.cc: ...here.
* lto-dump.c: Moved to...
* lto-dump.cc: ...here.
* lto-lang.c: Moved to...
* lto-lang.cc: ...here.
* lto-object.c: Moved to...
* lto-object.cc: ...here.
* lto-partition.c: Moved to...
* lto-partition.cc: ...here.
* lto-symtab.c: Moved to...
* lto-symtab.cc: ...here.
* lto.c: Moved to...
* lto.cc: ...here.
gcc/objc/ChangeLog:
* objc-act.c: Moved to...
* objc-act.cc: ...here.
* objc-encoding.c: Moved to...
* objc-encoding.cc: ...here.
* objc-gnu-runtime-abi-01.c: Moved to...
* objc-gnu-runtime-abi-01.cc: ...here.
* objc-lang.c: Moved to...
* objc-lang.cc: ...here.
* objc-map.c: Moved to...
* objc-map.cc: ...here.
* objc-next-runtime-abi-01.c: Moved to...
* objc-next-runtime-abi-01.cc: ...here.
* objc-next-runtime-abi-02.c: Moved to...
* objc-next-runtime-abi-02.cc: ...here.
* objc-runtime-shared-support.c: Moved to...
* objc-runtime-shared-support.cc: ...here.
gcc/objcp/ChangeLog:
* objcp-decl.c: Moved to...
* objcp-decl.cc: ...here.
* objcp-lang.c: Moved to...
* objcp-lang.cc: ...here.
libcpp/ChangeLog:
* charset.c: Moved to...
* charset.cc: ...here.
* directives.c: Moved to...
* directives.cc: ...here.
* errors.c: Moved to...
* errors.cc: ...here.
* expr.c: Moved to...
* expr.cc: ...here.
* files.c: Moved to...
* files.cc: ...here.
* identifiers.c: Moved to...
* identifiers.cc: ...here.
* init.c: Moved to...
* init.cc: ...here.
* lex.c: Moved to...
* lex.cc: ...here.
* line-map.c: Moved to...
* line-map.cc: ...here.
* macro.c: Moved to...
* macro.cc: ...here.
* makeucnid.c: Moved to...
* makeucnid.cc: ...here.
* mkdeps.c: Moved to...
* mkdeps.cc: ...here.
* pch.c: Moved to...
* pch.cc: ...here.
* symtab.c: Moved to...
* symtab.cc: ...here.
* traditional.c: Moved to...
* traditional.cc: ...here.
Diffstat (limited to 'gcc/jit/libgccjit.c')
-rw-r--r-- | gcc/jit/libgccjit.c | 4172 |
1 files changed, 0 insertions, 4172 deletions
diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c deleted file mode 100644 index 03704ef..0000000 --- a/gcc/jit/libgccjit.c +++ /dev/null @@ -1,4172 +0,0 @@ -/* Implementation of the C API; all wrappers into the internal C++ API - Copyright (C) 2013-2022 Free Software Foundation, Inc. - Contributed by David Malcolm <dmalcolm@redhat.com>. - -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 "config.h" -#include "system.h" -#include "coretypes.h" -#include "timevar.h" -#include "typed-splay-tree.h" -#include "cppbuiltin.h" -#include <pthread.h> - -#include "libgccjit.h" -#include "jit-recording.h" -#include "jit-result.h" - -/* The opaque types used by the public API are actually subclasses - of the gcc::jit::recording classes. */ - -struct gcc_jit_context : public gcc::jit::recording::context -{ - gcc_jit_context (gcc_jit_context *parent_ctxt) : - context (parent_ctxt) - {} -}; - -struct gcc_jit_result : public gcc::jit::result -{ -}; - -struct gcc_jit_object : public gcc::jit::recording::memento -{ -}; - -struct gcc_jit_location : public gcc::jit::recording::location -{ -}; - -struct gcc_jit_type : public gcc::jit::recording::type -{ -}; - -struct gcc_jit_struct : public gcc::jit::recording::struct_ -{ -}; - -struct gcc_jit_function_type : public gcc::jit::recording::function_type -{ -}; - -struct gcc_jit_vector_type : public gcc::jit::recording::vector_type -{ -}; - -struct gcc_jit_field : public gcc::jit::recording::field -{ -}; - -struct gcc_jit_bitfield : public gcc::jit::recording::bitfield -{ -}; - -struct gcc_jit_function : public gcc::jit::recording::function -{ -}; - -struct gcc_jit_block : public gcc::jit::recording::block -{ -}; - -struct gcc_jit_rvalue : public gcc::jit::recording::rvalue -{ -}; - -struct gcc_jit_lvalue : public gcc::jit::recording::lvalue -{ -}; - -struct gcc_jit_param : public gcc::jit::recording::param -{ -}; - -struct gcc_jit_case : public gcc::jit::recording::case_ -{ -}; - -struct gcc_jit_timer : public timer -{ -}; - -struct gcc_jit_extended_asm : public gcc::jit::recording::extended_asm -{ -}; - - -/********************************************************************** - Error-handling. - - We try to gracefully handle API usage errors by being defensive - at the API boundary. - **********************************************************************/ - -#define JIT_BEGIN_STMT do { -#define JIT_END_STMT } while(0) - -/* Each of these error-handling macros determines if TEST_EXPR holds. - - If TEXT_EXPR fails to hold we return from the enclosing function and - print an error, either via adding an error on the given context CTXT - if CTXT is non-NULL, falling back to simply printing to stderr if CTXT - is NULL. - - They have to be macros since they inject their "return" into the - function they are placed in. - - The variant macros express: - - (A) whether or not we need to return a value: - RETURN_VAL_IF_FAIL* vs - RETURN_IF_FAIL*, - with the former returning RETURN_EXPR, and - RETURN_NULL_IF_FAIL* - for the common case where a NULL value is to be returned on - error, and - - (B) whether the error message is to be directly printed: - RETURN_*IF_FAIL - or is a format string with some number of arguments: - RETURN_*IF_FAIL_PRINTF* - - They all use JIT_BEGIN_STMT/JIT_END_STMT so they can be written with - trailing semicolons. -*/ - -#define RETURN_VAL_IF_FAIL(TEST_EXPR, RETURN_EXPR, CTXT, LOC, ERR_MSG) \ - JIT_BEGIN_STMT \ - if (!(TEST_EXPR)) \ - { \ - jit_error ((CTXT), (LOC), "%s: %s", __func__, (ERR_MSG)); \ - return (RETURN_EXPR); \ - } \ - JIT_END_STMT - -#define RETURN_VAL_IF_FAIL_PRINTF1(TEST_EXPR, RETURN_EXPR, CTXT, LOC, ERR_FMT, A0) \ - JIT_BEGIN_STMT \ - if (!(TEST_EXPR)) \ - { \ - jit_error ((CTXT), (LOC), "%s: " ERR_FMT, \ - __func__, (A0)); \ - return (RETURN_EXPR); \ - } \ - JIT_END_STMT - -#define RETURN_VAL_IF_FAIL_PRINTF2(TEST_EXPR, RETURN_EXPR, CTXT, LOC, ERR_FMT, A0, A1) \ - JIT_BEGIN_STMT \ - if (!(TEST_EXPR)) \ - { \ - jit_error ((CTXT), (LOC), "%s: " ERR_FMT, \ - __func__, (A0), (A1)); \ - return (RETURN_EXPR); \ - } \ - JIT_END_STMT - -#define RETURN_VAL_IF_FAIL_PRINTF3(TEST_EXPR, RETURN_EXPR, CTXT, LOC, ERR_FMT, A0, A1, A2) \ - JIT_BEGIN_STMT \ - if (!(TEST_EXPR)) \ - { \ - jit_error ((CTXT), (LOC), "%s: " ERR_FMT, \ - __func__, (A0), (A1), (A2)); \ - return (RETURN_EXPR); \ - } \ - JIT_END_STMT - -#define RETURN_VAL_IF_FAIL_PRINTF4(TEST_EXPR, RETURN_EXPR, CTXT, LOC, ERR_FMT, A0, A1, A2, A3) \ - JIT_BEGIN_STMT \ - if (!(TEST_EXPR)) \ - { \ - jit_error ((CTXT), (LOC), "%s: " ERR_FMT, \ - __func__, (A0), (A1), (A2), (A3)); \ - return (RETURN_EXPR); \ - } \ - JIT_END_STMT - -#define RETURN_VAL_IF_FAIL_PRINTF5(TEST_EXPR, RETURN_EXPR, CTXT, LOC, ERR_FMT, A0, A1, A2, A3, A4) \ - JIT_BEGIN_STMT \ - if (!(TEST_EXPR)) \ - { \ - jit_error ((CTXT), (LOC), "%s: " ERR_FMT, \ - __func__, (A0), (A1), (A2), (A3), (A4)); \ - return (RETURN_EXPR); \ - } \ - JIT_END_STMT - -#define RETURN_VAL_IF_FAIL_PRINTF6(TEST_EXPR, RETURN_EXPR, CTXT, LOC, ERR_FMT, A0, A1, A2, A3, A4, A5) \ - JIT_BEGIN_STMT \ - if (!(TEST_EXPR)) \ - { \ - jit_error ((CTXT), (LOC), "%s: " ERR_FMT, \ - __func__, (A0), (A1), (A2), (A3), (A4), (A5)); \ - return (RETURN_EXPR); \ - } \ - JIT_END_STMT - -#define RETURN_NULL_IF_FAIL(TEST_EXPR, CTXT, LOC, ERR_MSG) \ - RETURN_VAL_IF_FAIL ((TEST_EXPR), NULL, (CTXT), (LOC), (ERR_MSG)) - -#define RETURN_NULL_IF_FAIL_PRINTF1(TEST_EXPR, CTXT, LOC, ERR_FMT, A0) \ - RETURN_VAL_IF_FAIL_PRINTF1 (TEST_EXPR, NULL, CTXT, LOC, ERR_FMT, A0) - -#define RETURN_NULL_IF_FAIL_PRINTF2(TEST_EXPR, CTXT, LOC, ERR_FMT, A0, A1) \ - RETURN_VAL_IF_FAIL_PRINTF2 (TEST_EXPR, NULL, CTXT, LOC, ERR_FMT, A0, A1) - -#define RETURN_NULL_IF_FAIL_PRINTF3(TEST_EXPR, CTXT, LOC, ERR_FMT, A0, A1, A2) \ - RETURN_VAL_IF_FAIL_PRINTF3 (TEST_EXPR, NULL, CTXT, LOC, ERR_FMT, A0, A1, A2) - -#define RETURN_NULL_IF_FAIL_PRINTF4(TEST_EXPR, CTXT, LOC, ERR_FMT, A0, A1, A2, A3) \ - RETURN_VAL_IF_FAIL_PRINTF4 (TEST_EXPR, NULL, CTXT, LOC, ERR_FMT, A0, A1, A2, A3) - -#define RETURN_NULL_IF_FAIL_PRINTF5(TEST_EXPR, CTXT, LOC, ERR_FMT, A0, A1, A2, A3, A4) \ - RETURN_VAL_IF_FAIL_PRINTF5 (TEST_EXPR, NULL, CTXT, LOC, ERR_FMT, A0, A1, A2, A3, A4) - -#define RETURN_NULL_IF_FAIL_PRINTF6(TEST_EXPR, CTXT, LOC, ERR_FMT, A0, A1, A2, A3, A4, A5) \ - RETURN_VAL_IF_FAIL_PRINTF6 (TEST_EXPR, NULL, CTXT, LOC, ERR_FMT, A0, A1, A2, A3, A4, A5) - -#define RETURN_IF_FAIL(TEST_EXPR, CTXT, LOC, ERR_MSG) \ - JIT_BEGIN_STMT \ - if (!(TEST_EXPR)) \ - { \ - jit_error ((CTXT), (LOC), "%s: %s", __func__, (ERR_MSG)); \ - return; \ - } \ - JIT_END_STMT - -#define RETURN_IF_FAIL_PRINTF1(TEST_EXPR, CTXT, LOC, ERR_FMT, A0) \ - JIT_BEGIN_STMT \ - if (!(TEST_EXPR)) \ - { \ - jit_error ((CTXT), (LOC), "%s: " ERR_FMT, \ - __func__, (A0)); \ - return; \ - } \ - JIT_END_STMT - -#define RETURN_IF_FAIL_PRINTF2(TEST_EXPR, CTXT, LOC, ERR_FMT, A0, A1) \ - JIT_BEGIN_STMT \ - if (!(TEST_EXPR)) \ - { \ - jit_error ((CTXT), (LOC), "%s: " ERR_FMT, \ - __func__, (A0), (A1)); \ - return; \ - } \ - JIT_END_STMT - -#define RETURN_IF_FAIL_PRINTF4(TEST_EXPR, CTXT, LOC, ERR_FMT, A0, A1, A2, A3) \ - JIT_BEGIN_STMT \ - if (!(TEST_EXPR)) \ - { \ - jit_error ((CTXT), (LOC), "%s: " ERR_FMT, \ - __func__, (A0), (A1), (A2), (A3)); \ - return; \ - } \ - JIT_END_STMT - -/* Check that BLOCK is non-NULL, and that it's OK to add statements to - it. This will fail if BLOCK has already been terminated by some - kind of jump or a return. */ -#define RETURN_IF_NOT_VALID_BLOCK(BLOCK, LOC) \ - JIT_BEGIN_STMT \ - RETURN_IF_FAIL ((BLOCK), NULL, (LOC), "NULL block"); \ - RETURN_IF_FAIL_PRINTF2 ( \ - !(BLOCK)->has_been_terminated (), \ - (BLOCK)->get_context (), \ - (LOC), \ - "adding to terminated block: %s (already terminated by: %s)", \ - (BLOCK)->get_debug_string (), \ - (BLOCK)->get_last_statement ()->get_debug_string ()); \ - JIT_END_STMT - -/* As RETURN_IF_NOT_VALID_BLOCK, but injecting a "return NULL;" if it - fails. */ -#define RETURN_NULL_IF_NOT_VALID_BLOCK(BLOCK, LOC) \ - JIT_BEGIN_STMT \ - RETURN_NULL_IF_FAIL ((BLOCK), NULL, (LOC), "NULL block"); \ - RETURN_NULL_IF_FAIL_PRINTF2 ( \ - !(BLOCK)->has_been_terminated (), \ - (BLOCK)->get_context (), \ - (LOC), \ - "adding to terminated block: %s (already terminated by: %s)", \ - (BLOCK)->get_debug_string (), \ - (BLOCK)->get_last_statement ()->get_debug_string ()); \ - JIT_END_STMT - -/* Format the given string, and report it as an error, either on CTXT - if non-NULL, or by printing to stderr if we have a NULL context. - LOC gives the source location where the error occcurred, and can be - NULL. */ - -static void -jit_error (gcc::jit::recording::context *ctxt, - gcc::jit::recording::location *loc, - const char *fmt, ...) - GNU_PRINTF(3, 4); - -static void -jit_error (gcc::jit::recording::context *ctxt, - gcc::jit::recording::location *loc, - const char *fmt, ...) -{ - va_list ap; - va_start (ap, fmt); - - if (ctxt) - ctxt->add_error_va (loc, fmt, ap); - else - { - /* No context? Send to stderr. */ - vfprintf (stderr, fmt, ap); - fprintf (stderr, "\n"); - } - - va_end (ap); -} - -/* Determine whether or not we can write to lvalues of type LTYPE from - rvalues of type RTYPE, detecting type errors such as attempting to - write to an int with a string literal (without an explicit cast). - - This is implemented by calling the - gcc::jit::recording::type::accepts_writes_from virtual function on - LTYPE. */ - -static bool -compatible_types (gcc::jit::recording::type *ltype, - gcc::jit::recording::type *rtype) -{ - return ltype->accepts_writes_from (rtype); -} - -/* Public entrypoint for acquiring a gcc_jit_context. - Note that this creates a new top-level context; contrast with - gcc_jit_context_new_child_context below. - - The real work is done in the constructor for - gcc::jit::recording::context in jit-recording.c. */ - -gcc_jit_context * -gcc_jit_context_acquire (void) -{ - gcc_jit_context *ctxt = new gcc_jit_context (NULL); - ctxt->log ("new top-level ctxt: %p", (void *)ctxt); - return ctxt; -} - -/* Public entrypoint for releasing a gcc_jit_context. - The real work is done in the destructor for - gcc::jit::recording::context in jit-recording.c. */ - -void -gcc_jit_context_release (gcc_jit_context *ctxt) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL ctxt"); - JIT_LOG_FUNC (ctxt->get_logger ()); - ctxt->log ("deleting ctxt: %p", (void *)ctxt); - delete ctxt; -} - -/* Public entrypoint for creating a child context within - PARENT_CTXT. See description in libgccjit.h. - - The real work is done in the constructor for - gcc::jit::recording::context in jit-recording.c. */ - -gcc_jit_context * -gcc_jit_context_new_child_context (gcc_jit_context *parent_ctxt) -{ - RETURN_NULL_IF_FAIL (parent_ctxt, NULL, NULL, "NULL parent ctxt"); - JIT_LOG_FUNC (parent_ctxt->get_logger ()); - parent_ctxt->log ("parent_ctxt: %p", (void *)parent_ctxt); - gcc_jit_context *child_ctxt = new gcc_jit_context (parent_ctxt); - child_ctxt->log ("new child_ctxt: %p", (void *)child_ctxt); - return child_ctxt; -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_location - method in jit-recording.c. */ - -gcc_jit_location * -gcc_jit_context_new_location (gcc_jit_context *ctxt, - const char *filename, - int line, - int column) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - return (gcc_jit_location *)ctxt->new_location (filename, line, column, true); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::memento::as_object method (a location is a - memento), in jit-recording.h. */ - -gcc_jit_object * -gcc_jit_location_as_object (gcc_jit_location *loc) -{ - RETURN_NULL_IF_FAIL (loc, NULL, NULL, "NULL location"); - - return static_cast <gcc_jit_object *> (loc->as_object ()); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::memento::as_object method (a type is a - memento), in jit-recording.h. */ - -gcc_jit_object * -gcc_jit_type_as_object (gcc_jit_type *type) -{ - RETURN_NULL_IF_FAIL (type, NULL, NULL, "NULL type"); - - return static_cast <gcc_jit_object *> (type->as_object ()); -} - -/* Public entrypoint for getting a specific type from a context. - - After error-checking, the real work is done by the - gcc::jit::recording::context::get_type method, in - jit-recording.c */ - -gcc_jit_type * -gcc_jit_context_get_type (gcc_jit_context *ctxt, - enum gcc_jit_types type) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL_PRINTF1 ( - (type >= GCC_JIT_TYPE_VOID - && type <= GCC_JIT_TYPE_FILE_PTR), - ctxt, NULL, - "unrecognized value for enum gcc_jit_types: %i", type); - - return (gcc_jit_type *)ctxt->get_type (type); -} - -/* Public entrypoint for getting the integer type of the given size and - signedness. - - After error-checking, the real work is done by the - gcc::jit::recording::context::get_int_type method, - in jit-recording.c. */ - -gcc_jit_type * -gcc_jit_context_get_int_type (gcc_jit_context *ctxt, - int num_bytes, int is_signed) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL (num_bytes >= 0, ctxt, NULL, "negative size"); - - return (gcc_jit_type *)ctxt->get_int_type (num_bytes, is_signed); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::type::get_pointer method, in - jit-recording.c */ - -gcc_jit_type * -gcc_jit_type_get_pointer (gcc_jit_type *type) -{ - RETURN_NULL_IF_FAIL (type, NULL, NULL, "NULL type"); - - return (gcc_jit_type *)type->get_pointer (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::type::get_const method, in - jit-recording.c. */ - -gcc_jit_type * -gcc_jit_type_get_const (gcc_jit_type *type) -{ - RETURN_NULL_IF_FAIL (type, NULL, NULL, "NULL type"); - - return (gcc_jit_type *)type->get_const (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::type::get_volatile method, in - jit-recording.c. */ - -gcc_jit_type * -gcc_jit_type_get_volatile (gcc_jit_type *type) -{ - RETURN_NULL_IF_FAIL (type, NULL, NULL, "NULL type"); - - return (gcc_jit_type *)type->get_volatile (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::type::is_array method, in - jit-recording.c. */ - -gcc_jit_type * -gcc_jit_type_dyncast_array (gcc_jit_type *type) -{ - RETURN_NULL_IF_FAIL (type, NULL, NULL, "NULL type"); - - return (gcc_jit_type *)type->is_array (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::type::is_bool method, in - jit-recording.c. */ - -int -gcc_jit_type_is_bool (gcc_jit_type *type) -{ - RETURN_VAL_IF_FAIL (type, FALSE, NULL, NULL, "NULL type"); - - return type->is_bool (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::type::is_pointer method, in - jit-recording.c. */ - -gcc_jit_type * -gcc_jit_type_is_pointer (gcc_jit_type *type) -{ - RETURN_NULL_IF_FAIL (type, NULL, NULL, "NULL type"); - - return (gcc_jit_type *)type->is_pointer (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::type::is_int method, in - jit-recording.c. */ - -int -gcc_jit_type_is_integral (gcc_jit_type *type) -{ - RETURN_VAL_IF_FAIL (type, FALSE, NULL, NULL, "NULL type"); - - return type->is_int (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::type::is_vector method, in - jit-recording.c. */ - -gcc_jit_vector_type * -gcc_jit_type_dyncast_vector (gcc_jit_type *type) -{ - RETURN_NULL_IF_FAIL (type, NULL, NULL, "NULL type"); - gcc::jit::recording::vector_type *vector_type = type->is_vector (); - return (gcc_jit_vector_type *)vector_type; -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::type::is_struct method, in - jit-recording.c. */ - -gcc_jit_struct * -gcc_jit_type_is_struct (gcc_jit_type *type) -{ - RETURN_NULL_IF_FAIL (type, NULL, NULL, "NULL type"); - gcc::jit::recording::struct_ *struct_type = type->is_struct (); - return (gcc_jit_struct *)struct_type; -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::vector_type::get_num_units method, in - jit-recording.c. */ - -size_t -gcc_jit_vector_type_get_num_units (gcc_jit_vector_type *vector_type) -{ - RETURN_VAL_IF_FAIL (vector_type, 0, NULL, NULL, "NULL vector_type"); - return vector_type->get_num_units (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::vector_type::get_element_type method, in - jit-recording.c. */ - -gcc_jit_type * -gcc_jit_vector_type_get_element_type (gcc_jit_vector_type *vector_type) -{ - RETURN_NULL_IF_FAIL (vector_type, NULL, NULL, "NULL vector_type"); - return (gcc_jit_type *)vector_type->get_element_type (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::type::unqualified method, in - jit-recording.c. */ - -gcc_jit_type * -gcc_jit_type_unqualified (gcc_jit_type *type) -{ - RETURN_NULL_IF_FAIL (type, NULL, NULL, "NULL type"); - - return (gcc_jit_type *)type->unqualified (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::type::dyn_cast_function_type method, in - jit-recording.c. */ - -gcc_jit_function_type * -gcc_jit_type_dyncast_function_ptr_type (gcc_jit_type *type) -{ - RETURN_NULL_IF_FAIL (type, NULL, NULL, "NULL type"); - gcc::jit::recording::type *func_ptr_type = type->dereference (); - if (!func_ptr_type) - { - return NULL; - } - - return (gcc_jit_function_type *)func_ptr_type->dyn_cast_function_type (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::function_type::get_return_type method, in - jit-recording.c. */ - -gcc_jit_type * -gcc_jit_function_type_get_return_type (gcc_jit_function_type *function_type) -{ - RETURN_NULL_IF_FAIL (function_type, NULL, NULL, "NULL function_type"); - return (gcc_jit_type *)function_type->get_return_type (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::function_type::get_param_types method, in - jit-recording.c. */ - -size_t -gcc_jit_function_type_get_param_count (gcc_jit_function_type *function_type) -{ - RETURN_VAL_IF_FAIL (function_type, 0, NULL, NULL, "NULL function_type"); - return function_type->get_param_types ().length (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::function_type::get_param_types method, in - jit-recording.c. */ - -gcc_jit_type * -gcc_jit_function_type_get_param_type (gcc_jit_function_type *function_type, - size_t index) -{ - RETURN_NULL_IF_FAIL (function_type, NULL, NULL, "NULL function_type"); - size_t num_params = function_type->get_param_types ().length (); - gcc::jit::recording::context *ctxt = function_type->m_ctxt; - RETURN_NULL_IF_FAIL_PRINTF3 (index < num_params, - ctxt, NULL, - "index of %zu is too large (%s has %zu params)", - index, - function_type->get_debug_string (), - num_params); - return (gcc_jit_type *)function_type->get_param_types ()[index]; -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_array_type method, in - jit-recording.c. */ - -gcc_jit_type * -gcc_jit_context_new_array_type (gcc_jit_context *ctxt, - gcc_jit_location *loc, - gcc_jit_type *element_type, - int num_elements) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (element_type, ctxt, loc, "NULL type"); - RETURN_NULL_IF_FAIL (num_elements >= 0, ctxt, NULL, "negative size"); - RETURN_NULL_IF_FAIL (!element_type->is_void (), ctxt, loc, - "void type for elements"); - - return (gcc_jit_type *)ctxt->new_array_type (loc, - element_type, - num_elements); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_field method, in - jit-recording.c. */ - -gcc_jit_field * -gcc_jit_context_new_field (gcc_jit_context *ctxt, - gcc_jit_location *loc, - gcc_jit_type *type, - const char *name) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); - RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name"); - RETURN_NULL_IF_FAIL_PRINTF2 ( - type->has_known_size (), - ctxt, loc, - "unknown size for field \"%s\" (type: %s)", - name, - type->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF1 ( - !type->is_void (), - ctxt, loc, - "void type for field \"%s\"", - name); - - return (gcc_jit_field *)ctxt->new_field (loc, type, name); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_bitfield method, in - jit-recording.c. */ - -gcc_jit_field * -gcc_jit_context_new_bitfield (gcc_jit_context *ctxt, - gcc_jit_location *loc, - gcc_jit_type *type, - int width, - const char *name) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name"); - RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); - RETURN_NULL_IF_FAIL_PRINTF2 (type->is_int () || type->is_bool (), - ctxt, loc, - "bit-field %s has non integral type %s", - name, type->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF2 ( - width > 0, ctxt, loc, - "invalid width %d for bitfield \"%s\" (must be > 0)", - width, name); - RETURN_NULL_IF_FAIL_PRINTF2 ( - type->has_known_size (), - ctxt, loc, - "unknown size for field \"%s\" (type: %s)", - name, - type->get_debug_string ()); - - return (gcc_jit_field *)ctxt->new_bitfield (loc, type, width, name); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::memento::as_object method (a field is a - memento), in jit-recording.h. */ - -gcc_jit_object * -gcc_jit_field_as_object (gcc_jit_field *field) -{ - RETURN_NULL_IF_FAIL (field, NULL, NULL, "NULL field"); - - return static_cast <gcc_jit_object *> (field->as_object ()); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_struct_type method, - immediately followed by a "set_fields" call on the resulting - gcc::jit::recording::compound_type *, both in jit-recording.c */ - -gcc_jit_struct * -gcc_jit_context_new_struct_type (gcc_jit_context *ctxt, - gcc_jit_location *loc, - const char *name, - int num_fields, - gcc_jit_field **fields) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name"); - if (num_fields) - RETURN_NULL_IF_FAIL (fields, ctxt, loc, "NULL fields ptr"); - for (int i = 0; i < num_fields; i++) - { - RETURN_NULL_IF_FAIL (fields[i], ctxt, loc, "NULL field ptr"); - RETURN_NULL_IF_FAIL_PRINTF2 ( - fields[i]->get_container () == NULL, - ctxt, loc, - "%s is already a field of %s", - fields[i]->get_debug_string (), - fields[i]->get_container ()->get_debug_string ()); - } - - gcc::jit::recording::struct_ *result = - ctxt->new_struct_type (loc, name); - result->set_fields (loc, - num_fields, - (gcc::jit::recording::field **)fields); - return static_cast<gcc_jit_struct *> (result); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_struct_type method in - jit-recording.c. */ - -gcc_jit_struct * -gcc_jit_context_new_opaque_struct (gcc_jit_context *ctxt, - gcc_jit_location *loc, - const char *name) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name"); - - return (gcc_jit_struct *)ctxt->new_struct_type (loc, name); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::struct_::as_object method in - jit-recording.h. */ - -gcc_jit_type * -gcc_jit_struct_as_type (gcc_jit_struct *struct_type) -{ - RETURN_NULL_IF_FAIL (struct_type, NULL, NULL, "NULL struct_type"); - - return static_cast <gcc_jit_type *> (struct_type->as_type ()); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::compound_type::set_fields method in - jit-recording.c. */ - -void -gcc_jit_struct_set_fields (gcc_jit_struct *struct_type, - gcc_jit_location *loc, - int num_fields, - gcc_jit_field **fields) -{ - RETURN_IF_FAIL (struct_type, NULL, loc, "NULL struct_type"); - gcc::jit::recording::context *ctxt = struct_type->m_ctxt; - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_IF_FAIL_PRINTF1 ( - struct_type->get_fields () == NULL, ctxt, loc, - "%s already has had fields set", - struct_type->get_debug_string ()); - if (num_fields) - RETURN_IF_FAIL (fields, ctxt, loc, "NULL fields ptr"); - for (int i = 0; i < num_fields; i++) - { - RETURN_IF_FAIL_PRINTF2 ( - fields[i], - ctxt, loc, - "%s: NULL field ptr at index %i", - struct_type->get_debug_string (), - i); - RETURN_IF_FAIL_PRINTF2 ( - fields[i]->get_container () == NULL, - ctxt, loc, - "%s is already a field of %s", - fields[i]->get_debug_string (), - fields[i]->get_container ()->get_debug_string ()); - } - - struct_type->set_fields (loc, num_fields, - (gcc::jit::recording::field **)fields); -} - - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::fields::get_field method in - jit-recording.c. */ -extern gcc_jit_field * -gcc_jit_struct_get_field (gcc_jit_struct *struct_type, - size_t index) -{ - RETURN_NULL_IF_FAIL (struct_type, NULL, NULL, "NULL struct type"); - RETURN_NULL_IF_FAIL (struct_type->get_fields (), NULL, NULL, - "NULL struct fields"); - size_t num_fields = struct_type->get_fields ()->length (); - RETURN_NULL_IF_FAIL_PRINTF3 (index < num_fields, - NULL, NULL, - "index of %zu is too large (%s has %zu fields)", - index, - struct_type->get_debug_string (), - num_fields); - return (gcc_jit_field *)struct_type->get_fields ()->get_field (index); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::struct_::get_fields method in - jit-recording.h. */ - -size_t -gcc_jit_struct_get_field_count (gcc_jit_struct *struct_type) -{ - RETURN_VAL_IF_FAIL (struct_type, 0, NULL, NULL, "NULL struct type"); - return struct_type->get_fields ()->length (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_union_type method, - immediately followed by a "set_fields" call on the resulting - gcc::jit::recording::compound_type *, both in jit-recording.c */ - -gcc_jit_type * -gcc_jit_context_new_union_type (gcc_jit_context *ctxt, - gcc_jit_location *loc, - const char *name, - int num_fields, - gcc_jit_field **fields) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name"); - if (num_fields) - RETURN_NULL_IF_FAIL (fields, ctxt, loc, "NULL fields ptr"); - for (int i = 0; i < num_fields; i++) - { - RETURN_NULL_IF_FAIL (fields[i], ctxt, loc, "NULL field ptr"); - RETURN_NULL_IF_FAIL_PRINTF2 ( - fields[i]->get_container () == NULL, - ctxt, loc, - "%s is already a field of %s", - fields[i]->get_debug_string (), - fields[i]->get_container ()->get_debug_string ()); - } - - gcc::jit::recording::union_ *result = - ctxt->new_union_type (loc, name); - result->set_fields (loc, - num_fields, - (gcc::jit::recording::field **)fields); - return (gcc_jit_type *) (result); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_function_ptr_type method, - in jit-recording.c */ - -gcc_jit_type * -gcc_jit_context_new_function_ptr_type (gcc_jit_context *ctxt, - gcc_jit_location *loc, - gcc_jit_type *return_type, - int num_params, - gcc_jit_type **param_types, - int is_variadic) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (return_type, ctxt, loc, "NULL return_type"); - RETURN_NULL_IF_FAIL ( - (num_params == 0) || param_types, - ctxt, loc, - "NULL param_types creating function pointer type"); - for (int i = 0; i < num_params; i++) - { - RETURN_NULL_IF_FAIL_PRINTF1 (param_types[i], - ctxt, loc, - "NULL parameter type %i" - " creating function pointer type", i); - RETURN_NULL_IF_FAIL_PRINTF1 (!param_types[i]->is_void (), - ctxt, loc, - "void type for param %i", i); - } - - return (gcc_jit_type*) - ctxt->new_function_ptr_type (loc, return_type, - num_params, - (gcc::jit::recording::type **)param_types, - is_variadic); -} - -/* Constructing functions. */ - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_param method, in jit-recording.c */ - -gcc_jit_param * -gcc_jit_context_new_param (gcc_jit_context *ctxt, - gcc_jit_location *loc, - gcc_jit_type *type, - const char *name) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); - RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name"); - RETURN_NULL_IF_FAIL_PRINTF1 (!type->is_void (), - ctxt, loc, - "void type for param \"%s\"", name); - - return (gcc_jit_param *)ctxt->new_param (loc, type, name); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::memento::as_object method (a param is a memento), - in jit-recording.h. */ - -gcc_jit_object * -gcc_jit_param_as_object (gcc_jit_param *param) -{ - RETURN_NULL_IF_FAIL (param, NULL, NULL, "NULL param"); - - return static_cast <gcc_jit_object *> (param->as_object ()); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::param::as_lvalue method in jit-recording.h. */ - -gcc_jit_lvalue * -gcc_jit_param_as_lvalue (gcc_jit_param *param) -{ - RETURN_NULL_IF_FAIL (param, NULL, NULL, "NULL param"); - - return (gcc_jit_lvalue *)param->as_lvalue (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::lvalue::as_rvalue method (a param is an rvalue), - in jit-recording.h. */ - -gcc_jit_rvalue * -gcc_jit_param_as_rvalue (gcc_jit_param *param) -{ - RETURN_NULL_IF_FAIL (param, NULL, NULL, "NULL param"); - - return (gcc_jit_rvalue *)param->as_rvalue (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_function method, in - jit-recording.c. */ - -gcc_jit_function * -gcc_jit_context_new_function (gcc_jit_context *ctxt, - gcc_jit_location *loc, - enum gcc_jit_function_kind kind, - gcc_jit_type *return_type, - const char *name, - int num_params, - gcc_jit_param **params, - int is_variadic) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL_PRINTF1 ( - ((kind >= GCC_JIT_FUNCTION_EXPORTED) - && (kind <= GCC_JIT_FUNCTION_ALWAYS_INLINE)), - ctxt, loc, - "unrecognized value for enum gcc_jit_function_kind: %i", - kind); - RETURN_NULL_IF_FAIL (return_type, ctxt, loc, "NULL return_type"); - RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name"); - /* The assembler can only handle certain names, so for now, enforce - C's rules for identifiers upon the name, using ISALPHA and ISALNUM - from safe-ctype.h to ignore the current locale. - Eventually we'll need some way to interact with e.g. C++ name - mangling. */ - { - /* Leading char: */ - char ch = *name; - RETURN_NULL_IF_FAIL_PRINTF2 ( - ISALPHA (ch) || ch == '_', - ctxt, loc, - "name \"%s\" contains invalid character: '%c'", - name, ch); - /* Subsequent chars: */ - for (const char *ptr = name + 1; (ch = *ptr); ptr++) - { - RETURN_NULL_IF_FAIL_PRINTF2 ( - ISALNUM (ch) || ch == '_', - ctxt, loc, - "name \"%s\" contains invalid character: '%c'", - name, ch); - } - } - RETURN_NULL_IF_FAIL_PRINTF1 ( - (num_params == 0) || params, - ctxt, loc, - "NULL params creating function %s", name); - for (int i = 0; i < num_params; i++) - { - RETURN_NULL_IF_FAIL_PRINTF2 ( - params[i], - ctxt, loc, - "NULL parameter %i creating function %s", i, name); - RETURN_NULL_IF_FAIL_PRINTF5 ( - params[i]->get_scope () == NULL, - ctxt, loc, - "parameter %i \"%s\"" - " (type: %s)" - " for function %s" - " was already used for function %s", - i, params[i]->get_debug_string (), - params[i]->get_type ()->get_debug_string (), - name, - params[i]->get_scope ()->get_debug_string ()); - } - - return (gcc_jit_function*) - ctxt->new_function (loc, kind, return_type, name, - num_params, - (gcc::jit::recording::param **)params, - is_variadic, - BUILT_IN_NONE); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::get_builtin_function method, in - jit-recording.c. */ - -gcc_jit_function * -gcc_jit_context_get_builtin_function (gcc_jit_context *ctxt, - const char *name) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL (name, ctxt, NULL, "NULL name"); - - return static_cast <gcc_jit_function *> (ctxt->get_builtin_function (name)); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::memento::as_object method (a function is a - memento), in jit-recording.h. */ - -gcc_jit_object * -gcc_jit_function_as_object (gcc_jit_function *func) -{ - RETURN_NULL_IF_FAIL (func, NULL, NULL, "NULL function"); - - return static_cast <gcc_jit_object *> (func->as_object ()); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::function::get_param method, in - jit-recording.h. */ - -gcc_jit_param * -gcc_jit_function_get_param (gcc_jit_function *func, int index) -{ - RETURN_NULL_IF_FAIL (func, NULL, NULL, "NULL function"); - gcc::jit::recording::context *ctxt = func->m_ctxt; - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL (index >= 0, ctxt, NULL, "negative index"); - int num_params = func->get_params ().length (); - RETURN_NULL_IF_FAIL_PRINTF3 (index < num_params, - ctxt, NULL, - "index of %d is too large (%s has %d params)", - index, - func->get_debug_string (), - num_params); - - return static_cast <gcc_jit_param *> (func->get_param (index)); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::function::get_params method, in - jit-recording.h. - */ - -size_t -gcc_jit_function_get_param_count (gcc_jit_function *func) -{ - RETURN_VAL_IF_FAIL (func, 0, NULL, NULL, "NULL function"); - gcc::jit::recording::context *ctxt = func->m_ctxt; - JIT_LOG_FUNC (ctxt->get_logger ()); - return func->get_params ().length (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::function::get_return_type method, in - jit-recording.h. */ - -gcc_jit_type * -gcc_jit_function_get_return_type (gcc_jit_function *func) -{ - RETURN_NULL_IF_FAIL (func, NULL, NULL, "NULL function_type"); - return (gcc_jit_type *)func->get_return_type (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::function::dump_to_dot method, in - jit-recording.c. */ - -void -gcc_jit_function_dump_to_dot (gcc_jit_function *func, - const char *path) -{ - RETURN_IF_FAIL (func, NULL, NULL, "NULL function"); - gcc::jit::recording::context *ctxt = func->m_ctxt; - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_IF_FAIL (path, ctxt, NULL, "NULL path"); - - func->dump_to_dot (path); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::function::new_block method, in - jit-recording.c. */ - -gcc_jit_block* -gcc_jit_function_new_block (gcc_jit_function *func, - const char *name) -{ - RETURN_NULL_IF_FAIL (func, NULL, NULL, "NULL function"); - JIT_LOG_FUNC (func->get_context ()->get_logger ()); - RETURN_NULL_IF_FAIL (func->get_kind () != GCC_JIT_FUNCTION_IMPORTED, - func->get_context (), NULL, - "cannot add block to an imported function"); - /* name can be NULL. */ - - return (gcc_jit_block *)func->new_block (name); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::memento::as_object method (a block is a - memento), in jit-recording.h. */ - -gcc_jit_object * -gcc_jit_block_as_object (gcc_jit_block *block) -{ - RETURN_NULL_IF_FAIL (block, NULL, NULL, "NULL block"); - - return static_cast <gcc_jit_object *> (block->as_object ()); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::block::get_function method, in - jit-recording.h. */ - -gcc_jit_function * -gcc_jit_block_get_function (gcc_jit_block *block) -{ - RETURN_NULL_IF_FAIL (block, NULL, NULL, "NULL block"); - - return static_cast <gcc_jit_function *> (block->get_function ()); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_global method, in - jit-recording.c. */ - -gcc_jit_lvalue * -gcc_jit_context_new_global (gcc_jit_context *ctxt, - gcc_jit_location *loc, - enum gcc_jit_global_kind kind, - gcc_jit_type *type, - const char *name) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL_PRINTF1 ( - ((kind >= GCC_JIT_GLOBAL_EXPORTED) - && (kind <= GCC_JIT_GLOBAL_IMPORTED)), - ctxt, loc, - "unrecognized value for enum gcc_jit_global_kind: %i", - kind); - RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); - RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name"); - RETURN_NULL_IF_FAIL_PRINTF2 ( - type->has_known_size (), - ctxt, loc, - "unknown size for global \"%s\" (type: %s)", - name, - type->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF1 ( - !type->is_void (), - ctxt, loc, - "void type for global \"%s\"", - name); - - return (gcc_jit_lvalue *)ctxt->new_global (loc, kind, type, name); -} - -extern gcc_jit_rvalue * -gcc_jit_context_new_struct_constructor (gcc_jit_context *ctxt, - gcc_jit_location *loc, - gcc_jit_type *type, - size_t num_values, - gcc_jit_field **fields, - gcc_jit_rvalue **values) -{ - using namespace gcc::jit::recording; - - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); - - RETURN_NULL_IF_FAIL_PRINTF1 (type->is_struct (), - ctxt, loc, - "constructor type is not a struct: %s", - type->get_debug_string ()); - - compound_type *ct = reinterpret_cast<compound_type *>(type); - gcc::jit::recording::fields *fields_struct = ct->get_fields (); - size_t n_fields = fields_struct->length (); - - RETURN_NULL_IF_FAIL_PRINTF1 (ct->has_known_size (), - ctxt, loc, - "struct can't be opaque: %s", - type->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF1 (n_fields, - ctxt, loc, - "no fields in struct: %s", - type->get_debug_string ()); - - /* If there is no array input we just short circuit to zero the struct. */ - if (!num_values) - return (gcc_jit_rvalue *)ctxt->new_ctor (loc, type, 0, NULL, NULL); - - RETURN_NULL_IF_FAIL_PRINTF3 (n_fields >= num_values, - ctxt, loc, - "more values in constructor (n=%zu) than fields" - " in target %s (n=%zu)", - num_values, - type->get_debug_string (), - n_fields); - - /* It is OK if fields are null here, indicating definiton order, - but there has to be a values array. */ - RETURN_NULL_IF_FAIL (values, - ctxt, loc, - "'values' NULL with non-zero 'num_values'"); - - size_t idx = 0; /* Runner index for fields in the type object. */ - - for (size_t i = 0; i < num_values; i++) - { - gcc::jit::recording::rvalue *rv = values[i]; - - /* rv kan be NULL, which would indicate zero init for the field. */ - gcc::jit::recording::type *rv_type = rv ? rv->get_type () : nullptr; - - /* If fields are specified we need to check that they are in - definition order. */ - if (fields) - { - gcc::jit::recording::field *f = fields[i]; - - RETURN_NULL_IF_FAIL_PRINTF1 ( - f, - ctxt, loc, - "NULL field in 'fields', at index %zu", i); - - RETURN_NULL_IF_FAIL_PRINTF3 ( - f->get_container () == - static_cast<gcc::jit::recording::type*>(type), - ctxt, loc, - "field object at index %zu (%s), was not used when creating " - "the %s", - i, - f->get_debug_string (), - type->get_debug_string ()); - - /* Fields in the constructor need to be in struct definition - order, but there can be gaps. */ - size_t j; - for (j = idx; j < n_fields; j++) - { - field *fs = fields_struct->get_field (j); - if (fs == f) - { - idx = j; /* Advance runner index for next iteration. */ - break; - } - } - - RETURN_NULL_IF_FAIL_PRINTF3 ( - j != n_fields, - ctxt, loc, - "field at index %zu in 'fields' is not in definition order " - "(struct: %s) (ctor field: %s)", - i, - type->get_debug_string (), - f->get_debug_string ()); - - /* Check that the specified field has the same type as the - value, unless the value is null (a zero value init). */ - RETURN_NULL_IF_FAIL_PRINTF5 ( - !rv || gcc::jit::types_kinda_same (rv_type, - f->get_type ()), - ctxt, loc, - "value and field not the same unqualified type, at index %zu" - " (%s.%s: %s)(value type: %s)", - i, - type->get_debug_string (), - f->get_debug_string (), - f->get_type ()->get_debug_string (), - rv_type->get_debug_string ()); - } - - /* If no fields are specified, check that the value has the same type - as the field in the definition of the struct. */ - if (rv && !fields) - { - RETURN_NULL_IF_FAIL_PRINTF5 ( - gcc::jit::types_kinda_same (rv_type, - fields_struct-> - get_field (i)->get_type ()), - ctxt, loc, - "value and field not the same unqualified type, at index %zu" - " (%s.%s: %s)(value type: %s)", - i, - type->get_debug_string (), - fields_struct->get_field (i)->get_debug_string (), - fields_struct->get_field (i)->get_type ()->get_debug_string (), - rv_type->get_debug_string ()); - } - - if (rv) - { - RETURN_NULL_IF_FAIL_PRINTF1 ( - !rv_type->is_void (), - ctxt, loc, - "can't construct the void type, at index %zu", i); - } - } - - return (gcc_jit_rvalue *)ctxt->new_ctor ( - loc, - type, - num_values, - reinterpret_cast<gcc::jit::recording::field**>(fields), - reinterpret_cast<gcc::jit::recording::rvalue**>(values)); -} - -extern gcc_jit_rvalue * -gcc_jit_context_new_union_constructor (gcc_jit_context *ctxt, - gcc_jit_location *loc, - gcc_jit_type *type, - gcc_jit_field *field, - gcc_jit_rvalue *value) -{ - using namespace gcc::jit::recording; - - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); - - RETURN_NULL_IF_FAIL_PRINTF1 (type->is_union (), - ctxt, loc, - "constructor type is not an union: %s", - type->get_debug_string ()); - - compound_type *ct = reinterpret_cast<compound_type *>(type); - gcc::jit::recording::fields *fields_union = ct->get_fields (); - size_t n_fields = fields_union->length (); - - RETURN_NULL_IF_FAIL_PRINTF1 (ct->has_known_size (), - ctxt, loc, - "union can't be opaque: %s", - type->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF1 (n_fields, - ctxt, loc, - "no fields in union: %s", - type->get_debug_string ()); - - /* If value is NULL we are just supposed to zero the whole union. */ - if (!value) - return (gcc_jit_rvalue *)ctxt->new_ctor (loc, type, 0, NULL, NULL); - - gcc::jit::recording::type *rv_type = value->get_type (); - - RETURN_NULL_IF_FAIL ( - !rv_type->is_void (), - ctxt, loc, - "can't construct the void type"); - - if (field) - { - RETURN_NULL_IF_FAIL_PRINTF2 ( - field->get_container () == - static_cast<gcc::jit::recording::type*>(type), - ctxt, loc, - "field object (%s) was not used when creating " - "the type %s", - field->get_debug_string (), - type->get_debug_string ()); - - RETURN_NULL_IF_FAIL_PRINTF4 ( - gcc::jit::types_kinda_same (rv_type, - field->get_type ()), - ctxt, loc, - "value and field are not the same unqualified type" - " (%s.%s: %s)(value type: %s)", - type->get_debug_string (), - field->get_debug_string (), - field->get_type ()->get_debug_string (), - rv_type->get_debug_string ()); - } - /* If no field is specified, check that the value has the same type - as the first field in the definition of the union. */ - if (!field) - RETURN_NULL_IF_FAIL_PRINTF2 ( - gcc::jit::types_kinda_same (rv_type, - fields_union-> - get_field (0)->get_type ()), - ctxt, loc, - "value and first union field not the same unqualified type" - " (field type: %s)(value type: %s)", - fields_union->get_field (0)->get_type ()->get_debug_string (), - rv_type->get_debug_string ()); - - - return (gcc_jit_rvalue *)ctxt->new_ctor ( - loc, - type, - 1, - /* A NULL fields array tells new_ctor to take fields from the type obj. */ - reinterpret_cast<gcc::jit::recording::field**>(field ? &field : NULL), - reinterpret_cast<gcc::jit::recording::rvalue**>(&value)); -} - -extern gcc_jit_rvalue * -gcc_jit_context_new_array_constructor (gcc_jit_context *ctxt, - gcc_jit_location *loc, - gcc_jit_type *type, - size_t num_values, - gcc_jit_rvalue **values) -{ - using namespace gcc::jit::recording; - - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); - - RETURN_NULL_IF_FAIL (type->is_array () != NULL, - ctxt, loc, - "constructor type not an array"); - - if (!num_values) - values = NULL; - - if (num_values) - { - RETURN_NULL_IF_FAIL ( - values, - ctxt, loc, - "'values' NULL with non-zero 'num_values'"); - - gcc::jit::recording::array_type *arr_type = - reinterpret_cast<gcc::jit::recording::array_type*>(type); - size_t n_el = arr_type->num_elements (); - - RETURN_NULL_IF_FAIL_PRINTF2 ( - n_el >= num_values, - ctxt, loc, - "array constructor has more values than the array type's length" - " (array type length: %zu, constructor length: %zu)", - n_el, - num_values); - - /* For arrays, all values need to be the same base type. */ - gcc::jit::recording::type *type0 = NULL; - size_t i = 0; - /* Find first non-null value. */ - for (;i < num_values; i++) - { - if (values[i]) - break; - } - - if (i < num_values) /* All values might be null and i == num_values. */ - type0 = values[i]->get_type (); - - /* If we got a type0, check that all other values have - the same type. */ - for (; i < num_values; i++) - { - if (values[i]) - RETURN_NULL_IF_FAIL_PRINTF3 ( - gcc::jit::types_kinda_same (type0, - values[i]->get_type ()), - ctxt, loc, - "value type at index %zu differ from first value type" - " (first type: %s)(different type: %s)", - i, - type0->get_debug_string (), - values[i]->get_type ()->get_debug_string ()); - } - - /* Compare type0 with the element type specified in the - type of the array. */ - if (type0) - { - gcc::jit::recording::type *el_type = - type->is_array (); - - RETURN_NULL_IF_FAIL_PRINTF2 ( - gcc::jit::types_kinda_same (type0, el_type), - ctxt, loc, - "array element value types differ from types in 'values'" - " (element type: %s)('values' type: %s)", - el_type->get_debug_string (), - type0->get_debug_string ()); - } - } - - return (gcc_jit_rvalue *)ctxt->new_ctor ( - loc, - type, - num_values, - NULL, - reinterpret_cast<gcc::jit::recording::rvalue**>(values)); -} - -/* Public entrypoint. See description in libgccjit.h. */ - -extern gcc_jit_lvalue * -gcc_jit_global_set_initializer_rvalue (gcc_jit_lvalue *global, - gcc_jit_rvalue *init_rvalue) -{ - RETURN_NULL_IF_FAIL (global, NULL, NULL,"NULL global"); - - gcc::jit::recording::context *ctxt = global->get_context (); - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL,"NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL (init_rvalue, ctxt, NULL,"NULL init_rvalue"); - - RETURN_NULL_IF_FAIL_PRINTF1 (global->is_global (), - ctxt, NULL, - "lvalue \"%s\" not a global", - global->get_debug_string ()); - - gcc::jit::recording::global *gbl = - reinterpret_cast<gcc::jit::recording::global *> (global); - - RETURN_NULL_IF_FAIL_PRINTF1 (gbl->get_kind () != - GCC_JIT_GLOBAL_IMPORTED, - ctxt, NULL, - "can't initialize \"%s\", it is imported", - global->get_debug_string ()); - - RETURN_NULL_IF_FAIL_PRINTF4 (gcc::jit::types_kinda_same ( - global->get_type (), - init_rvalue->get_type ()), - ctxt, NULL, - "mismatching types:" - " initializing %s (type: %s) with %s (type: %s)", - global->get_debug_string (), - global->get_type ()->get_debug_string (), - init_rvalue->get_debug_string (), - init_rvalue->get_type ()->get_debug_string ()); - - /* Check that there are no initializers set for the global yet. */ - RETURN_NULL_IF_FAIL_PRINTF1 (!gbl->test_flags_anyof ( - gcc::jit::GLOBAL_VAR_FLAGS_WILL_BE_RVAL_INIT | - gcc::jit::GLOBAL_VAR_FLAGS_WILL_BE_BLOB_INIT), - ctxt, NULL, - "global variable already initialized: %s", - global->get_debug_string ()); - - /* The global need to know during playback that it will be - initialized. */ - gbl->set_flags (gcc::jit::GLOBAL_VAR_FLAGS_WILL_BE_RVAL_INIT); - - ctxt->new_global_init_rvalue (global, init_rvalue); - - return global; -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::global::set_initializer method, in - jit-recording.c. */ - -extern gcc_jit_lvalue * -gcc_jit_global_set_initializer (gcc_jit_lvalue *global, - const void *blob, - size_t num_bytes) -{ - RETURN_NULL_IF_FAIL (global, NULL, NULL, "NULL global"); - RETURN_NULL_IF_FAIL (blob, NULL, NULL, "NULL blob"); - RETURN_NULL_IF_FAIL_PRINTF1 (global->is_global (), NULL, NULL, - "lvalue \"%s\" not a global", - global->get_debug_string ()); - - gcc::jit::recording::type *lval_type = global->get_type (); - RETURN_NULL_IF_FAIL_PRINTF1 (lval_type->is_array (), NULL, NULL, - "global \"%s\" is not an array", - global->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF1 (lval_type->dereference ()->is_int (), NULL, NULL, - "global \"%s\" is not an array of integral type", - global->get_debug_string ()); - size_t lvalue_size = - lval_type->dereference ()->get_size () - * static_cast <gcc::jit::recording::array_type *> (lval_type)->num_elements (); - RETURN_NULL_IF_FAIL_PRINTF3 ( - lvalue_size == num_bytes, NULL, NULL, - "mismatching sizes:" - " global \"%s\" has size %zu whereas initializer has size %zu", - global->get_debug_string (), lvalue_size, num_bytes); - - /* Check that the rvalue initializer is not set for this global. - Note that we do not check if this blob type initializer is - already set, since that check was not present when the entrypoint - was initially written. */ - gcc::jit::recording::global *gbl = - reinterpret_cast<gcc::jit::recording::global *> (global); - RETURN_NULL_IF_FAIL_PRINTF1 (!gbl->test_flags_anyof ( - gcc::jit::GLOBAL_VAR_FLAGS_WILL_BE_RVAL_INIT), - NULL, NULL, - "global variable already initialized: %s", - global->get_debug_string ()); - - gbl->set_initializer (blob, num_bytes); - /* The global need to know during playback that it will be - initialized. */ - gbl->set_flags (gcc::jit::GLOBAL_VAR_FLAGS_WILL_BE_BLOB_INIT); - - return global; -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::memento::as_object method (an lvalue is a - memento), in jit-recording.h. */ - -gcc_jit_object * -gcc_jit_lvalue_as_object (gcc_jit_lvalue *lvalue) -{ - RETURN_NULL_IF_FAIL (lvalue, NULL, NULL, "NULL lvalue"); - - return static_cast <gcc_jit_object *> (lvalue->as_object ()); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::lvalue::as_rvalue method in jit-recording.h. */ - -gcc_jit_rvalue * -gcc_jit_lvalue_as_rvalue (gcc_jit_lvalue *lvalue) -{ - RETURN_NULL_IF_FAIL (lvalue, NULL, NULL, "NULL lvalue"); - - return (gcc_jit_rvalue *)lvalue->as_rvalue (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::memento::as_object method (an rvalue is a - memento), in jit-recording.h. */ - -gcc_jit_object * -gcc_jit_rvalue_as_object (gcc_jit_rvalue *rvalue) -{ - RETURN_NULL_IF_FAIL (rvalue, NULL, NULL, "NULL rvalue"); - - return static_cast <gcc_jit_object *> (rvalue->as_object ()); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::rvalue::get_type method, in - jit-recording.h. */ - -gcc_jit_type * -gcc_jit_rvalue_get_type (gcc_jit_rvalue *rvalue) -{ - RETURN_NULL_IF_FAIL (rvalue, NULL, NULL, "NULL rvalue"); - - return static_cast <gcc_jit_type *> (rvalue->get_type ()); -} - -/* Verify that NUMERIC_TYPE is non-NULL, and that it is a "numeric" - type i.e. it satisfies gcc::jit::type::is_numeric (), such as the - result of gcc_jit_context_get_type (GCC_JIT_TYPE_INT). */ - -#define RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE(CTXT, NUMERIC_TYPE) \ - JIT_BEGIN_STMT \ - RETURN_NULL_IF_FAIL (NUMERIC_TYPE, CTXT, NULL, "NULL type"); \ - RETURN_NULL_IF_FAIL_PRINTF1 ( \ - NUMERIC_TYPE->is_numeric (), ctxt, NULL, \ - "not a numeric type: %s", \ - NUMERIC_TYPE->get_debug_string ()); \ - JIT_END_STMT - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_rvalue_from_const <int> method in - jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_context_new_rvalue_from_int (gcc_jit_context *ctxt, - gcc_jit_type *numeric_type, - int value) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE (ctxt, numeric_type); - - return ((gcc_jit_rvalue *)ctxt - ->new_rvalue_from_const <int> (numeric_type, value)); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_rvalue_from_const <long> method - in jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_context_new_rvalue_from_long (gcc_jit_context *ctxt, - gcc_jit_type *numeric_type, - long value) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE (ctxt, numeric_type); - - return ((gcc_jit_rvalue *)ctxt - ->new_rvalue_from_const <long> (numeric_type, value)); -} - -/* Public entrypoint. See description in libgccjit.h. - - This is essentially equivalent to: - gcc_jit_context_new_rvalue_from_int (ctxt, numeric_type, 0); - albeit with slightly different error messages if an error occurs. */ - -gcc_jit_rvalue * -gcc_jit_context_zero (gcc_jit_context *ctxt, - gcc_jit_type *numeric_type) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE (ctxt, numeric_type); - - return gcc_jit_context_new_rvalue_from_int (ctxt, numeric_type, 0); -} - -/* Public entrypoint. See description in libgccjit.h. - - This is essentially equivalent to: - gcc_jit_context_new_rvalue_from_int (ctxt, numeric_type, 1); - albeit with slightly different error messages if an error occurs. */ - -gcc_jit_rvalue * -gcc_jit_context_one (gcc_jit_context *ctxt, - gcc_jit_type *numeric_type) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE (ctxt, numeric_type); - - return gcc_jit_context_new_rvalue_from_int (ctxt, numeric_type, 1); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_rvalue_from_const <double> method in - jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_context_new_rvalue_from_double (gcc_jit_context *ctxt, - gcc_jit_type *numeric_type, - double value) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE (ctxt, numeric_type); - - return ((gcc_jit_rvalue *)ctxt - ->new_rvalue_from_const <double> (numeric_type, value)); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_rvalue_from_const <void *> method - in jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_context_new_rvalue_from_ptr (gcc_jit_context *ctxt, - gcc_jit_type *pointer_type, - void *value) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL (pointer_type, ctxt, NULL, "NULL type"); - RETURN_NULL_IF_FAIL_PRINTF1 ( - pointer_type->is_pointer (), - ctxt, NULL, - "not a pointer type (type: %s)", - pointer_type->get_debug_string ()); - - return ((gcc_jit_rvalue *)ctxt - ->new_rvalue_from_const <void *> (pointer_type, value)); -} - -/* Public entrypoint. See description in libgccjit.h. - - This is essentially equivalent to: - gcc_jit_context_new_rvalue_from_ptr (ctxt, pointer_type, NULL); - albeit with slightly different error messages if an error occurs. */ - -gcc_jit_rvalue * -gcc_jit_context_null (gcc_jit_context *ctxt, - gcc_jit_type *pointer_type) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL (pointer_type, ctxt, NULL, "NULL type"); - RETURN_NULL_IF_FAIL_PRINTF1 ( - pointer_type->is_pointer (), - ctxt, NULL, - "not a pointer type (type: %s)", - pointer_type->get_debug_string ()); - - return gcc_jit_context_new_rvalue_from_ptr (ctxt, pointer_type, NULL); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_string_literal method in - jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_context_new_string_literal (gcc_jit_context *ctxt, - const char *value) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL (value, ctxt, NULL, "NULL value"); - - return (gcc_jit_rvalue *)ctxt->new_string_literal (value); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_unary_op method in - jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_context_new_unary_op (gcc_jit_context *ctxt, - gcc_jit_location *loc, - enum gcc_jit_unary_op op, - gcc_jit_type *result_type, - gcc_jit_rvalue *rvalue) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL_PRINTF1 ( - (op >= GCC_JIT_UNARY_OP_MINUS - && op <= GCC_JIT_UNARY_OP_ABS), - ctxt, loc, - "unrecognized value for enum gcc_jit_unary_op: %i", - op); - RETURN_NULL_IF_FAIL (result_type, ctxt, loc, "NULL result_type"); - RETURN_NULL_IF_FAIL_PRINTF3 ( - result_type->is_numeric (), ctxt, loc, - "gcc_jit_unary_op %s with operand %s " - "has non-numeric result_type: %s", - gcc::jit::unary_op_reproducer_strings[op], - rvalue->get_debug_string (), - result_type->get_debug_string ()); - RETURN_NULL_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue"); - - return (gcc_jit_rvalue *)ctxt->new_unary_op (loc, op, result_type, rvalue); -} - -/* Determine if OP is a valid value for enum gcc_jit_binary_op. - For use by both gcc_jit_context_new_binary_op and - gcc_jit_block_add_assignment_op. */ - -static bool -valid_binary_op_p (enum gcc_jit_binary_op op) -{ - return (op >= GCC_JIT_BINARY_OP_PLUS - && op <= GCC_JIT_BINARY_OP_RSHIFT); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_binary_op method in - jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_context_new_binary_op (gcc_jit_context *ctxt, - gcc_jit_location *loc, - enum gcc_jit_binary_op op, - gcc_jit_type *result_type, - gcc_jit_rvalue *a, gcc_jit_rvalue *b) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL_PRINTF1 ( - valid_binary_op_p (op), - ctxt, loc, - "unrecognized value for enum gcc_jit_binary_op: %i", - op); - RETURN_NULL_IF_FAIL (result_type, ctxt, loc, "NULL result_type"); - RETURN_NULL_IF_FAIL (a, ctxt, loc, "NULL a"); - RETURN_NULL_IF_FAIL (b, ctxt, loc, "NULL b"); - RETURN_NULL_IF_FAIL_PRINTF4 ( - a->get_type ()->unqualified () == b->get_type ()->unqualified (), - ctxt, loc, - "mismatching types for binary op:" - " a: %s (type: %s) b: %s (type: %s)", - a->get_debug_string (), - a->get_type ()->get_debug_string (), - b->get_debug_string (), - b->get_type ()->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF4 ( - result_type->is_numeric (), ctxt, loc, - "gcc_jit_binary_op %s with operands a: %s b: %s " - "has non-numeric result_type: %s", - gcc::jit::binary_op_reproducer_strings[op], - a->get_debug_string (), b->get_debug_string (), - result_type->get_debug_string ()); - - return (gcc_jit_rvalue *)ctxt->new_binary_op (loc, op, result_type, a, b); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_comparison method in - jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_context_new_comparison (gcc_jit_context *ctxt, - gcc_jit_location *loc, - enum gcc_jit_comparison op, - gcc_jit_rvalue *a, gcc_jit_rvalue *b) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL_PRINTF1 ( - (op >= GCC_JIT_COMPARISON_EQ - && op <= GCC_JIT_COMPARISON_GE), - ctxt, loc, - "unrecognized value for enum gcc_jit_comparison: %i", - op); - RETURN_NULL_IF_FAIL (a, ctxt, loc, "NULL a"); - RETURN_NULL_IF_FAIL (b, ctxt, loc, "NULL b"); - RETURN_NULL_IF_FAIL_PRINTF4 ( - a->get_type ()->unqualified () == b->get_type ()->unqualified (), - ctxt, loc, - "mismatching types for comparison:" - " a: %s (type: %s) b: %s (type: %s)", - a->get_debug_string (), - a->get_type ()->get_debug_string (), - b->get_debug_string (), - b->get_type ()->get_debug_string ()); - - return (gcc_jit_rvalue *)ctxt->new_comparison (loc, op, a, b); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_call method in - jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_context_new_call (gcc_jit_context *ctxt, - gcc_jit_location *loc, - gcc_jit_function *func, - int numargs , gcc_jit_rvalue **args) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (func, ctxt, loc, "NULL function"); - if (numargs) - RETURN_NULL_IF_FAIL (args, ctxt, loc, "NULL args"); - - int min_num_params = func->get_params ().length (); - bool is_variadic = func->is_variadic (); - - RETURN_NULL_IF_FAIL_PRINTF3 ( - numargs >= min_num_params, - ctxt, loc, - "not enough arguments to function \"%s\"" - " (got %i args, expected %i)", - func->get_name ()->c_str (), - numargs, min_num_params); - - RETURN_NULL_IF_FAIL_PRINTF3 ( - (numargs == min_num_params || is_variadic), - ctxt, loc, - "too many arguments to function \"%s\"" - " (got %i args, expected %i)", - func->get_name ()->c_str (), - numargs, min_num_params); - - for (int i = 0; i < min_num_params; i++) - { - gcc::jit::recording::param *param = func->get_param (i); - gcc_jit_rvalue *arg = args[i]; - - RETURN_NULL_IF_FAIL_PRINTF4 ( - arg, - ctxt, loc, - "NULL argument %i to function \"%s\":" - " param %s (type: %s)", - i + 1, - func->get_name ()->c_str (), - param->get_debug_string (), - param->get_type ()->get_debug_string ()); - - RETURN_NULL_IF_FAIL_PRINTF6 ( - compatible_types (param->get_type (), - arg->get_type ()), - ctxt, loc, - "mismatching types for argument %d of function \"%s\":" - " assignment to param %s (type: %s) from %s (type: %s)", - i + 1, - func->get_name ()->c_str (), - param->get_debug_string (), - param->get_type ()->get_debug_string (), - arg->get_debug_string (), - arg->get_type ()->get_debug_string ()); - } - - return (gcc_jit_rvalue *)ctxt->new_call (loc, - func, - numargs, - (gcc::jit::recording::rvalue **)args); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_call_through_ptr method in - jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_context_new_call_through_ptr (gcc_jit_context *ctxt, - gcc_jit_location *loc, - gcc_jit_rvalue *fn_ptr, - int numargs, gcc_jit_rvalue **args) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (fn_ptr, ctxt, loc, "NULL fn_ptr"); - if (numargs) - RETURN_NULL_IF_FAIL (args, ctxt, loc, "NULL args"); - - gcc::jit::recording::type *ptr_type = fn_ptr->get_type ()->dereference (); - RETURN_NULL_IF_FAIL_PRINTF2 ( - ptr_type, ctxt, loc, - "fn_ptr is not a ptr: %s" - " type: %s", - fn_ptr->get_debug_string (), - fn_ptr->get_type ()->get_debug_string ()); - - gcc::jit::recording::function_type *fn_type = - ptr_type->dyn_cast_function_type(); - RETURN_NULL_IF_FAIL_PRINTF2 ( - fn_type, ctxt, loc, - "fn_ptr is not a function ptr: %s" - " type: %s", - fn_ptr->get_debug_string (), - fn_ptr->get_type ()->get_debug_string ()); - - int min_num_params = fn_type->get_param_types ().length (); - bool is_variadic = fn_type->is_variadic (); - - RETURN_NULL_IF_FAIL_PRINTF3 ( - numargs >= min_num_params, - ctxt, loc, - "not enough arguments to fn_ptr: %s" - " (got %i args, expected %i)", - fn_ptr->get_debug_string (), - numargs, min_num_params); - - RETURN_NULL_IF_FAIL_PRINTF3 ( - (numargs == min_num_params || is_variadic), - ctxt, loc, - "too many arguments to fn_ptr: %s" - " (got %i args, expected %i)", - fn_ptr->get_debug_string (), - numargs, min_num_params); - - for (int i = 0; i < min_num_params; i++) - { - gcc::jit::recording::type *param_type = fn_type->get_param_types ()[i]; - gcc_jit_rvalue *arg = args[i]; - - RETURN_NULL_IF_FAIL_PRINTF3 ( - arg, - ctxt, loc, - "NULL argument %i to fn_ptr: %s" - " (type: %s)", - i + 1, - fn_ptr->get_debug_string (), - param_type->get_debug_string ()); - - RETURN_NULL_IF_FAIL_PRINTF6 ( - compatible_types (param_type, - arg->get_type ()), - ctxt, loc, - "mismatching types for argument %d of fn_ptr: %s:" - " assignment to param %d (type: %s) from %s (type: %s)", - i + 1, - fn_ptr->get_debug_string (), - i + 1, - param_type->get_debug_string (), - arg->get_debug_string (), - arg->get_type ()->get_debug_string ()); - } - - return (gcc_jit_rvalue *)( - ctxt->new_call_through_ptr (loc, - fn_ptr, - numargs, - (gcc::jit::recording::rvalue **)args)); -} - -/* Helper function for determining if we can cast an rvalue from SRC_TYPE - to DST_TYPE, for use by gcc_jit_context_new_cast. - - We only permit these kinds of cast: - - int <-> float - int <-> bool - P* <-> Q* for pointer types P and Q. */ - -static bool -is_valid_cast (gcc::jit::recording::type *src_type, - gcc_jit_type *dst_type) -{ - bool src_is_int = src_type->is_int (); - bool dst_is_int = dst_type->is_int (); - bool src_is_float = src_type->is_float (); - bool dst_is_float = dst_type->is_float (); - bool src_is_bool = src_type->is_bool (); - bool dst_is_bool = dst_type->is_bool (); - - if (src_is_int) - if (dst_is_int || dst_is_float || dst_is_bool) - return true; - - if (src_is_float) - if (dst_is_int || dst_is_float) - return true; - - if (src_is_bool) - if (dst_is_int || dst_is_bool) - return true; - - /* Permit casts between pointer types. */ - gcc::jit::recording::type *deref_src_type = src_type->is_pointer (); - gcc::jit::recording::type *deref_dst_type = dst_type->is_pointer (); - if (deref_src_type && deref_dst_type) - return true; - - return false; -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_cast method in jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_context_new_cast (gcc_jit_context *ctxt, - gcc_jit_location *loc, - gcc_jit_rvalue *rvalue, - gcc_jit_type *type) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue"); - RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); - RETURN_NULL_IF_FAIL_PRINTF3 ( - is_valid_cast (rvalue->get_type (), type), - ctxt, loc, - "cannot cast %s from type: %s to type: %s", - rvalue->get_debug_string (), - rvalue->get_type ()->get_debug_string (), - type->get_debug_string ()); - - return static_cast <gcc_jit_rvalue *> (ctxt->new_cast (loc, rvalue, type)); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_array_access method in - jit-recording.c. */ - -extern gcc_jit_lvalue * -gcc_jit_context_new_array_access (gcc_jit_context *ctxt, - gcc_jit_location *loc, - gcc_jit_rvalue *ptr, - gcc_jit_rvalue *index) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (ptr, ctxt, loc, "NULL ptr"); - RETURN_NULL_IF_FAIL (index, ctxt, loc, "NULL index"); - RETURN_NULL_IF_FAIL_PRINTF2 ( - ptr->get_type ()->dereference (), - ctxt, loc, - "ptr: %s (type: %s) is not a pointer or array", - ptr->get_debug_string (), - ptr->get_type ()->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF2 ( - index->get_type ()->is_numeric (), - ctxt, loc, - "index: %s (type: %s) is not of numeric type", - index->get_debug_string (), - index->get_type ()->get_debug_string ()); - - return (gcc_jit_lvalue *)ctxt->new_array_access (loc, ptr, index); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::memento::get_context method in - jit-recording.h. */ - -gcc_jit_context * -gcc_jit_object_get_context (gcc_jit_object *obj) -{ - RETURN_NULL_IF_FAIL (obj, NULL, NULL, "NULL object"); - - return static_cast <gcc_jit_context *> (obj->get_context ()); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::memento::get_debug_string method in - jit-recording.c. */ - -const char * -gcc_jit_object_get_debug_string (gcc_jit_object *obj) -{ - RETURN_NULL_IF_FAIL (obj, NULL, NULL, "NULL object"); - - return obj->get_debug_string (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::lvalue::access_field method in - jit-recording.c. */ - -gcc_jit_lvalue * -gcc_jit_lvalue_access_field (gcc_jit_lvalue *struct_, - gcc_jit_location *loc, - gcc_jit_field *field) -{ - RETURN_NULL_IF_FAIL (struct_, NULL, loc, "NULL struct"); - gcc::jit::recording::context *ctxt = struct_->m_ctxt; - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (field, ctxt, loc, "NULL field"); - RETURN_NULL_IF_FAIL_PRINTF1 (field->get_container (), field->m_ctxt, loc, - "field %s has not been placed in a struct", - field->get_debug_string ()); - gcc::jit::recording::type *underlying_type = - struct_->get_type (); - RETURN_NULL_IF_FAIL_PRINTF2 ( - (field->get_container ()->unqualified () - == underlying_type->unqualified ()), - struct_->m_ctxt, loc, - "%s is not a field of %s", - field->get_debug_string (), - underlying_type->get_debug_string ()); - - return (gcc_jit_lvalue *)struct_->access_field (loc, field); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::rvalue::access_field method in - jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_rvalue_access_field (gcc_jit_rvalue *struct_, - gcc_jit_location *loc, - gcc_jit_field *field) -{ - RETURN_NULL_IF_FAIL (struct_, NULL, loc, "NULL struct"); - gcc::jit::recording::context *ctxt = struct_->m_ctxt; - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (field, ctxt, loc, "NULL field"); - RETURN_NULL_IF_FAIL_PRINTF1 (field->get_container (), field->m_ctxt, loc, - "field %s has not been placed in a struct", - field->get_debug_string ()); - gcc::jit::recording::type *underlying_type = - struct_->get_type (); - RETURN_NULL_IF_FAIL_PRINTF2 ( - (field->get_container ()->unqualified () - == underlying_type->unqualified ()), - struct_->m_ctxt, loc, - "%s is not a field of %s", - field->get_debug_string (), - underlying_type->get_debug_string ()); - - return (gcc_jit_rvalue *)struct_->access_field (loc, field); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::rvalue::deference_field method in - jit-recording.c. */ - -gcc_jit_lvalue * -gcc_jit_rvalue_dereference_field (gcc_jit_rvalue *ptr, - gcc_jit_location *loc, - gcc_jit_field *field) -{ - RETURN_NULL_IF_FAIL (ptr, NULL, loc, "NULL ptr"); - JIT_LOG_FUNC (ptr->get_context ()->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (field, NULL, loc, "NULL field"); - gcc::jit::recording::type *underlying_type = - ptr->get_type ()->is_pointer (); - RETURN_NULL_IF_FAIL_PRINTF1 (field->get_container (), field->m_ctxt, loc, - "field %s has not been placed in a struct", - field->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF3 ( - underlying_type, - ptr->m_ctxt, loc, - "dereference of non-pointer %s (type: %s) when accessing ->%s", - ptr->get_debug_string (), - ptr->get_type ()->get_debug_string (), - field->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF2 ( - (field->get_container ()->unqualified () - == underlying_type->unqualified ()), - ptr->m_ctxt, loc, - "%s is not a field of %s", - field->get_debug_string (), - underlying_type->get_debug_string ()); - - return (gcc_jit_lvalue *)ptr->dereference_field (loc, field); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::rvalue::deference method in - jit-recording.c. */ - -gcc_jit_lvalue * -gcc_jit_rvalue_dereference (gcc_jit_rvalue *rvalue, - gcc_jit_location *loc) -{ - RETURN_NULL_IF_FAIL (rvalue, NULL, loc, "NULL rvalue"); - JIT_LOG_FUNC (rvalue->get_context ()->get_logger ()); - /* LOC can be NULL. */ - - gcc::jit::recording::type *underlying_type = - rvalue->get_type ()->is_pointer (); - - RETURN_NULL_IF_FAIL_PRINTF2 ( - underlying_type, - rvalue->m_ctxt, loc, - "dereference of non-pointer %s (type: %s)", - rvalue->get_debug_string (), - rvalue->get_type ()->get_debug_string ()); - - RETURN_NULL_IF_FAIL_PRINTF2 ( - !underlying_type->is_void (), - rvalue->m_ctxt, loc, - "dereference of void pointer %s (type: %s)", - rvalue->get_debug_string (), - rvalue->get_type ()->get_debug_string ()); - - return (gcc_jit_lvalue *)rvalue->dereference (loc); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::lvalue::get_address method in jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_lvalue_get_address (gcc_jit_lvalue *lvalue, - gcc_jit_location *loc) -{ - RETURN_NULL_IF_FAIL (lvalue, NULL, loc, "NULL lvalue"); - JIT_LOG_FUNC (lvalue->get_context ()->get_logger ()); - /* LOC can be NULL. */ - - return (gcc_jit_rvalue *)lvalue->get_address (loc); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::lvalue::set_tls_model method in jit-recording.c. */ - -void -gcc_jit_lvalue_set_tls_model (gcc_jit_lvalue *lvalue, - enum gcc_jit_tls_model model) -{ - RETURN_IF_FAIL (lvalue, NULL, NULL, "NULL lvalue"); - JIT_LOG_FUNC (lvalue->get_context ()->get_logger ()); - RETURN_IF_FAIL_PRINTF1 (lvalue->is_global (), lvalue->get_context (), NULL, - "lvalue \"%s\" not a global", - lvalue->get_debug_string ()); - - lvalue->set_tls_model (model); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::lvalue::set_link_section method in jit-recording.c. */ - -void -gcc_jit_lvalue_set_link_section (gcc_jit_lvalue *lvalue, - const char *section_name) -{ - RETURN_IF_FAIL (section_name, NULL, NULL, "NULL section_name"); - lvalue->set_link_section (section_name); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::function::new_local method in jit-recording.c. */ - -gcc_jit_lvalue * -gcc_jit_function_new_local (gcc_jit_function *func, - gcc_jit_location *loc, - gcc_jit_type *type, - const char *name) -{ - RETURN_NULL_IF_FAIL (func, NULL, loc, "NULL function"); - gcc::jit::recording::context *ctxt = func->m_ctxt; - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (func->get_kind () != GCC_JIT_FUNCTION_IMPORTED, - ctxt, loc, - "Cannot add locals to an imported function"); - RETURN_NULL_IF_FAIL (type, ctxt, loc, "NULL type"); - RETURN_NULL_IF_FAIL (name, ctxt, loc, "NULL name"); - RETURN_NULL_IF_FAIL_PRINTF2 ( - type->has_known_size (), - ctxt, loc, - "unknown size for local \"%s\" (type: %s)", - name, - type->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF1 ( - !type->is_void (), - ctxt, loc, - "void type for local \"%s\"", - name); - - return (gcc_jit_lvalue *)func->new_local (loc, type, name); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::block::add_eval method in jit-recording.c. */ - -void -gcc_jit_block_add_eval (gcc_jit_block *block, - gcc_jit_location *loc, - gcc_jit_rvalue *rvalue) -{ - RETURN_IF_NOT_VALID_BLOCK (block, loc); - gcc::jit::recording::context *ctxt = block->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue"); - - gcc::jit::recording::statement *stmt = block->add_eval (loc, rvalue); - - /* "stmt" should be good enough to be usable in error-messages, - but might still not be compilable; perform some more - error-checking here. We do this here so that the error messages - can contain a stringified version of "stmt", whilst appearing - as close as possible to the point of failure. */ - rvalue->verify_valid_within_stmt (__func__, stmt); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::block::add_assignment method in - jit-recording.c. */ - -void -gcc_jit_block_add_assignment (gcc_jit_block *block, - gcc_jit_location *loc, - gcc_jit_lvalue *lvalue, - gcc_jit_rvalue *rvalue) -{ - RETURN_IF_NOT_VALID_BLOCK (block, loc); - gcc::jit::recording::context *ctxt = block->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_IF_FAIL (lvalue, ctxt, loc, "NULL lvalue"); - RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue"); - RETURN_IF_FAIL_PRINTF4 ( - compatible_types (lvalue->get_type (), - rvalue->get_type ()), - ctxt, loc, - "mismatching types:" - " assignment to %s (type: %s) from %s (type: %s)", - lvalue->get_debug_string (), - lvalue->get_type ()->get_debug_string (), - rvalue->get_debug_string (), - rvalue->get_type ()->get_debug_string ()); - - gcc::jit::recording::statement *stmt = block->add_assignment (loc, lvalue, rvalue); - - /* "stmt" should be good enough to be usable in error-messages, - but might still not be compilable; perform some more - error-checking here. We do this here so that the error messages - can contain a stringified version of "stmt", whilst appearing - as close as possible to the point of failure. */ - lvalue->verify_valid_within_stmt (__func__, stmt); - rvalue->verify_valid_within_stmt (__func__, stmt); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::block::add_assignment_op method in - jit-recording.c. */ - -void -gcc_jit_block_add_assignment_op (gcc_jit_block *block, - gcc_jit_location *loc, - gcc_jit_lvalue *lvalue, - enum gcc_jit_binary_op op, - gcc_jit_rvalue *rvalue) -{ - RETURN_IF_NOT_VALID_BLOCK (block, loc); - gcc::jit::recording::context *ctxt = block->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_IF_FAIL (lvalue, ctxt, loc, "NULL lvalue"); - RETURN_IF_FAIL_PRINTF1 ( - valid_binary_op_p (op), - ctxt, loc, - "unrecognized value for enum gcc_jit_binary_op: %i", - op); - RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue"); - RETURN_IF_FAIL_PRINTF4 ( - compatible_types (lvalue->get_type (), - rvalue->get_type ()), - ctxt, loc, - "mismatching types:" - " assignment to %s (type: %s) involving %s (type: %s)", - lvalue->get_debug_string (), - lvalue->get_type ()->get_debug_string (), - rvalue->get_debug_string (), - rvalue->get_type ()->get_debug_string ()); - - gcc::jit::recording::statement *stmt = block->add_assignment_op (loc, lvalue, op, rvalue); - - /* "stmt" should be good enough to be usable in error-messages, - but might still not be compilable; perform some more - error-checking here. We do this here so that the error messages - can contain a stringified version of "stmt", whilst appearing - as close as possible to the point of failure. */ - lvalue->verify_valid_within_stmt (__func__, stmt); - rvalue->verify_valid_within_stmt (__func__, stmt); -} - -/* Internal helper function for determining if rvalue BOOLVAL is of - boolean type. For use by gcc_jit_block_end_with_conditional. */ - -static bool -is_bool (gcc_jit_rvalue *boolval) -{ - gcc::jit::recording::type *actual_type = boolval->get_type (); - gcc::jit::recording::type *bool_type = - boolval->m_ctxt->get_type (GCC_JIT_TYPE_BOOL); - return actual_type == bool_type; -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::block::end_with_conditional method in - jit-recording.c. */ - -void -gcc_jit_block_end_with_conditional (gcc_jit_block *block, - gcc_jit_location *loc, - gcc_jit_rvalue *boolval, - gcc_jit_block *on_true, - gcc_jit_block *on_false) -{ - RETURN_IF_NOT_VALID_BLOCK (block, loc); - gcc::jit::recording::context *ctxt = block->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_IF_FAIL (boolval, ctxt, loc, "NULL boolval"); - RETURN_IF_FAIL_PRINTF2 ( - is_bool (boolval), ctxt, loc, - "%s (type: %s) is not of boolean type ", - boolval->get_debug_string (), - boolval->get_type ()->get_debug_string ()); - RETURN_IF_FAIL (on_true, ctxt, loc, "NULL on_true"); - RETURN_IF_FAIL (on_true, ctxt, loc, "NULL on_false"); - RETURN_IF_FAIL_PRINTF4 ( - block->get_function () == on_true->get_function (), - ctxt, loc, - "\"on_true\" block is not in same function:" - " source block %s is in function %s" - " whereas target block %s is in function %s", - block->get_debug_string (), - block->get_function ()->get_debug_string (), - on_true->get_debug_string (), - on_true->get_function ()->get_debug_string ()); - RETURN_IF_FAIL_PRINTF4 ( - block->get_function () == on_false->get_function (), - ctxt, loc, - "\"on_false\" block is not in same function:" - " source block %s is in function %s" - " whereas target block %s is in function %s", - block->get_debug_string (), - block->get_function ()->get_debug_string (), - on_false->get_debug_string (), - on_false->get_function ()->get_debug_string ()); - - gcc::jit::recording::statement *stmt = block->end_with_conditional (loc, boolval, on_true, on_false); - - /* "stmt" should be good enough to be usable in error-messages, - but might still not be compilable; perform some more - error-checking here. We do this here so that the error messages - can contain a stringified version of "stmt", whilst appearing - as close as possible to the point of failure. */ - boolval->verify_valid_within_stmt (__func__, stmt); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::block::add_comment method in - jit-recording.c. */ - -void -gcc_jit_block_add_comment (gcc_jit_block *block, - gcc_jit_location *loc, - const char *text) -{ - RETURN_IF_NOT_VALID_BLOCK (block, loc); - gcc::jit::recording::context *ctxt = block->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_IF_FAIL (text, ctxt, loc, "NULL text"); - - block->add_comment (loc, text); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::block::end_with_jump method in - jit-recording.c. */ - -void -gcc_jit_block_end_with_jump (gcc_jit_block *block, - gcc_jit_location *loc, - gcc_jit_block *target) -{ - RETURN_IF_NOT_VALID_BLOCK (block, loc); - gcc::jit::recording::context *ctxt = block->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_IF_FAIL (target, ctxt, loc, "NULL target"); - RETURN_IF_FAIL_PRINTF4 ( - block->get_function () == target->get_function (), - ctxt, loc, - "target block is not in same function:" - " source block %s is in function %s" - " whereas target block %s is in function %s", - block->get_debug_string (), - block->get_function ()->get_debug_string (), - target->get_debug_string (), - target->get_function ()->get_debug_string ()); - - block->end_with_jump (loc, target); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::block::end_with_return method in - jit-recording.c. */ - -void -gcc_jit_block_end_with_return (gcc_jit_block *block, - gcc_jit_location *loc, - gcc_jit_rvalue *rvalue) -{ - RETURN_IF_NOT_VALID_BLOCK (block, loc); - gcc::jit::recording::context *ctxt = block->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - gcc::jit::recording::function *func = block->get_function (); - RETURN_IF_FAIL (rvalue, ctxt, loc, "NULL rvalue"); - RETURN_IF_FAIL_PRINTF4 ( - compatible_types ( - func->get_return_type (), - rvalue->get_type ()), - ctxt, loc, - "mismatching types:" - " return of %s (type: %s) in function %s (return type: %s)", - rvalue->get_debug_string (), - rvalue->get_type ()->get_debug_string (), - func->get_debug_string (), - func->get_return_type ()->get_debug_string ()); - - gcc::jit::recording::statement *stmt = block->end_with_return (loc, rvalue); - - /* "stmt" should be good enough to be usable in error-messages, - but might still not be compilable; perform some more - error-checking here. We do this here so that the error messages - can contain a stringified version of "stmt", whilst appearing - as close as possible to the point of failure. */ - rvalue->verify_valid_within_stmt (__func__, stmt); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::block::end_with_return method in - jit-recording.c. */ - -void -gcc_jit_block_end_with_void_return (gcc_jit_block *block, - gcc_jit_location *loc) -{ - RETURN_IF_NOT_VALID_BLOCK (block, loc); - gcc::jit::recording::context *ctxt = block->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - gcc::jit::recording::function *func = block->get_function (); - RETURN_IF_FAIL_PRINTF2 ( - func->get_return_type () == ctxt->get_type (GCC_JIT_TYPE_VOID), - ctxt, loc, - "mismatching types:" - " void return in function %s (return type: %s)", - func->get_debug_string (), - func->get_return_type ()->get_debug_string ()); - - block->end_with_return (loc, NULL); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_case method in - jit-recording.c. */ - -gcc_jit_case * -gcc_jit_context_new_case (gcc_jit_context *ctxt, - gcc_jit_rvalue *min_value, - gcc_jit_rvalue *max_value, - gcc_jit_block *block) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_NULL_IF_FAIL (min_value, ctxt, NULL, "NULL min_value"); - RETURN_NULL_IF_FAIL (max_value, ctxt, NULL, "NULL max_value"); - RETURN_NULL_IF_FAIL (block, ctxt, NULL, "NULL block"); - - RETURN_NULL_IF_FAIL_PRINTF1 (min_value->is_constant (), ctxt, NULL, - "min_value is not a constant: %s", - min_value->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF1 (max_value->is_constant (), ctxt, NULL, - "max_value is not a constant: %s", - max_value->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF2 ( - min_value->get_type ()->is_int (), - ctxt, NULL, - "min_value: %s (type: %s) is not of integer type", - min_value->get_debug_string (), - min_value->get_type ()->get_debug_string ()); - RETURN_NULL_IF_FAIL_PRINTF2 ( - max_value->get_type ()->is_int (), - ctxt, NULL, - "max_value: %s (type: %s) is not of integer type", - max_value->get_debug_string (), - max_value->get_type ()->get_debug_string ()); - - wide_int wi_min, wi_max; - if (!min_value->get_wide_int (&wi_min)) - gcc_unreachable (); - if (!max_value->get_wide_int (&wi_max)) - gcc_unreachable (); - RETURN_NULL_IF_FAIL_PRINTF2 ( - wi::les_p (wi_min, wi_max), - ctxt, NULL, - "min_value: %s > max_value: %s", - min_value->get_debug_string (), - max_value->get_debug_string ()); - return (gcc_jit_case *)ctxt->new_case (min_value, - max_value, - block); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::memento::as_object method (a case is a - memento), in jit-recording.h. */ - -gcc_jit_object * -gcc_jit_case_as_object (gcc_jit_case *case_) -{ - RETURN_NULL_IF_FAIL (case_, NULL, NULL, "NULL case"); - - return static_cast <gcc_jit_object *> (case_->as_object ()); -} - -/* Helper function for gcc_jit_block_end_with_switch and - valid_case_for_switch. */ - -static bool -valid_dest_for_switch (gcc::jit::recording::context *ctxt, - gcc_jit_location *loc, - const char *api_funcname, - gcc::jit::recording::block *switch_block, - gcc::jit::recording::block *dest_block, - const char *dest_block_desc) -{ - if (!dest_block) - { - jit_error (ctxt, loc, "%s: NULL %s", api_funcname, dest_block_desc); - return false; - } - gcc::jit::recording::function *switch_fn = switch_block->get_function (); - gcc::jit::recording::function *dest_fn = dest_block->get_function (); - if (switch_fn != dest_fn) - { - jit_error (ctxt, loc, - "%s: %s is not in same function:" - " switch block %s is in function %s" - " whereas %s %s is in function %s", - api_funcname, - dest_block_desc, - switch_block->get_debug_string (), - switch_fn->get_debug_string (), - dest_block_desc, - dest_block->get_debug_string (), - dest_fn->get_debug_string ()); - return false; - } - return true; -} - -/* Helper function for gcc_jit_block_end_with_switch. */ - -static bool -valid_case_for_switch (gcc::jit::recording::context *ctxt, - gcc_jit_location *loc, - const char *api_funcname, - gcc_jit_block *switch_block, - gcc_jit_rvalue *expr, - gcc_jit_case *case_, - const char *case_desc, - int case_idx) -{ - if (!case_) - { - jit_error (ctxt, loc, - "%s:" - " NULL case %i", - api_funcname, - case_idx); - return false; - } - if (!valid_dest_for_switch (ctxt, loc, - api_funcname, - switch_block, - case_->get_dest_block (), - case_desc)) - return false; - gcc::jit::recording::type *expr_type = expr->get_type (); - if (expr_type != case_->get_min_value ()->get_type ()) - { - jit_error (ctxt, loc, - "%s:" - " mismatching types between case and expression:" - " cases[%i]->min_value: %s (type: %s)" - " expr: %s (type: %s)", - api_funcname, - case_idx, - case_->get_min_value ()->get_debug_string (), - case_->get_min_value ()->get_type ()->get_debug_string (), - expr->get_debug_string (), - expr_type->get_debug_string ()); - return false; - } - if (expr_type != case_->get_max_value ()->get_type ()) - { - jit_error (ctxt, loc, - "%s:" - " mismatching types between case and expression:" - " cases[%i]->max_value: %s (type: %s)" - " expr: %s (type: %s)", - api_funcname, - case_idx, - case_->get_max_value ()->get_debug_string (), - case_->get_max_value ()->get_type ()->get_debug_string (), - expr->get_debug_string (), - expr_type->get_debug_string ()); - return false; - } - return true; -} - -/* A class for holding the data we need to perform error-checking - on a libgccjit API call. */ - -class api_call_validator -{ - public: - api_call_validator (gcc::jit::recording::context *ctxt, - gcc_jit_location *loc, - const char *funcname) - : m_ctxt (ctxt), - m_loc (loc), - m_funcname (funcname) - {} - - protected: - gcc::jit::recording::context *m_ctxt; - gcc_jit_location *m_loc; - const char *m_funcname; -}; - -/* A class for verifying that the ranges of cases within - gcc_jit_block_end_with_switch don't overlap. */ - -class case_range_validator : public api_call_validator -{ - public: - case_range_validator (gcc::jit::recording::context *ctxt, - gcc_jit_location *loc, - const char *funcname); - - bool - validate (gcc_jit_case *case_, int idx); - - private: - static int - case_compare (gcc::jit::recording::rvalue *k1, - gcc::jit::recording::rvalue *k2); - - static wide_int - get_wide_int (gcc::jit::recording::rvalue *k); - - private: - typed_splay_tree <gcc::jit::recording::rvalue *, gcc_jit_case *> m_cases; -}; - -/* case_range_validator's ctor. */ - -case_range_validator::case_range_validator (gcc::jit::recording::context *ctxt, - gcc_jit_location *loc, - const char *funcname) -: api_call_validator (ctxt, loc, funcname), - m_cases (case_compare, NULL, NULL) -{ -} - -/* Ensure that the range of CASE_ does not overlap with any of the - ranges of cases we've already seen. - Return true if everything is OK. - Return false and emit an error if there is an overlap. - Compare with c-family/c-common.c:c_add_case_label. */ - -bool -case_range_validator::validate (gcc_jit_case *case_, - int case_idx) -{ - /* Look up the LOW_VALUE in the table of case labels we already - have. */ - gcc_jit_case *other = m_cases.lookup (case_->get_min_value ()); - - /* If there was not an exact match, check for overlapping ranges. */ - if (!other) - { - gcc_jit_case *pred; - gcc_jit_case *succ; - - /* Even though there wasn't an exact match, there might be an - overlap between this case range and another case range. - Since we've (inductively) not allowed any overlapping case - ranges, we simply need to find the greatest low case label - that is smaller that CASE_MIN_VALUE, and the smallest low case - label that is greater than CASE_MAX_VALUE. If there is an overlap - it will occur in one of these two ranges. */ - pred = m_cases.predecessor (case_->get_min_value ()); - succ = m_cases.successor (case_->get_max_value ()); - - /* Check to see if the PRED overlaps. It is smaller than - the LOW_VALUE, so we only need to check its max value. */ - if (pred) - { - wide_int wi_case_min = get_wide_int (case_->get_min_value ()); - wide_int wi_pred_max = get_wide_int (pred->get_max_value ()); - if (wi::ges_p (wi_pred_max, wi_case_min)) - other = pred; - } - - if (!other && succ) - { - /* Check to see if the SUCC overlaps. The low end of that - range is bigger than the low end of the current range. */ - wide_int wi_case_max = get_wide_int (case_->get_max_value ()); - wide_int wi_succ_min = get_wide_int (succ->get_min_value ()); - if (wi::les_p (wi_succ_min, wi_case_max)) - other = succ; - } - } - - /* If there was an overlap, issue an error. */ - if (other) - { - jit_error (m_ctxt, m_loc, - "%s: duplicate (or overlapping) cases values:" - " case %i: %s overlaps %s", - m_funcname, - case_idx, - case_->get_debug_string (), - other->get_debug_string ()); - return false; - } - - /* Register this case label in the splay tree. */ - m_cases.insert (case_->get_min_value (), - case_); - return true; -} - -/* Compare with c-family/c-common.c:case_compare, which acts on tree - nodes, rather than rvalue *. - - Comparator for case label values. K1 and K2 must be constant integer - values (anything else should have been rejected by - gcc_jit_context_new_case. - - Returns -1 if K1 is ordered before K2, -1 if K1 is ordered after - K2, and 0 if K1 and K2 are equal. */ - -int -case_range_validator::case_compare (gcc::jit::recording::rvalue * k1, - gcc::jit::recording::rvalue * k2) -{ - wide_int wi1 = get_wide_int (k1); - wide_int wi2 = get_wide_int (k2); - return wi::cmps(wi1, wi2); -} - -/* Given a const int rvalue K, get the underlying value as a wide_int. */ - -wide_int -case_range_validator::get_wide_int (gcc::jit::recording::rvalue *k) -{ - wide_int wi; - bool got_wi = k->get_wide_int (&wi); - gcc_assert (got_wi); - return wi; -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::block::end_with_switch method in - jit-recording.c. */ - -void -gcc_jit_block_end_with_switch (gcc_jit_block *block, - gcc_jit_location *loc, - gcc_jit_rvalue *expr, - gcc_jit_block *default_block, - int num_cases, - gcc_jit_case **cases) -{ - RETURN_IF_NOT_VALID_BLOCK (block, loc); - gcc::jit::recording::context *ctxt = block->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_IF_FAIL (expr, ctxt, loc, - "NULL expr"); - gcc::jit::recording::type *expr_type = expr->get_type (); - RETURN_IF_FAIL_PRINTF2 ( - expr_type->is_int (), - ctxt, loc, - "expr: %s (type: %s) is not of integer type", - expr->get_debug_string (), - expr_type->get_debug_string ()); - if (!valid_dest_for_switch (ctxt, loc, - __func__, - block, - default_block, - "default_block")) - return; - RETURN_IF_FAIL (num_cases >= 0, ctxt, loc, "num_cases < 0"); - case_range_validator crv (ctxt, loc, __func__); - for (int i = 0; i < num_cases; i++) - { - char case_desc[32]; - snprintf (case_desc, sizeof (case_desc), - "cases[%i]", i); - if (!valid_case_for_switch (ctxt, loc, - __func__, - block, - expr, - cases[i], - case_desc, - i)) - return; - if (!crv.validate (cases[i], i)) - return; - } - - block->end_with_switch (loc, expr, default_block, - num_cases, - (gcc::jit::recording::case_ **)cases); -} - -/********************************************************************** - Option-management - **********************************************************************/ - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::set_str_option method in - jit-recording.c. */ - -void -gcc_jit_context_set_str_option (gcc_jit_context *ctxt, - enum gcc_jit_str_option opt, - const char *value) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* opt is checked by the inner function. - value can be NULL. */ - - ctxt->set_str_option (opt, value); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::set_int_option method in - jit-recording.c. */ - -void -gcc_jit_context_set_int_option (gcc_jit_context *ctxt, - enum gcc_jit_int_option opt, - int value) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* opt is checked by the inner function. */ - - ctxt->set_int_option (opt, value); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::set_bool_option method in - jit-recording.c. */ - -void -gcc_jit_context_set_bool_option (gcc_jit_context *ctxt, - enum gcc_jit_bool_option opt, - int value) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* opt is checked by the inner function. */ - - ctxt->set_bool_option (opt, value); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::set_inner_bool_option method in - jit-recording.c. */ - -void -gcc_jit_context_set_bool_allow_unreachable_blocks (gcc_jit_context *ctxt, - int bool_value) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - ctxt->set_inner_bool_option ( - gcc::jit::INNER_BOOL_OPTION_ALLOW_UNREACHABLE_BLOCKS, - bool_value); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::set_inner_bool_option method in - jit-recording.c. */ - -extern void -gcc_jit_context_set_bool_use_external_driver (gcc_jit_context *ctxt, - int bool_value) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - ctxt->set_inner_bool_option ( - gcc::jit::INNER_BOOL_OPTION_USE_EXTERNAL_DRIVER, - bool_value); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::add_command_line_option method in - jit-recording.c. */ - -void -gcc_jit_context_add_command_line_option (gcc_jit_context *ctxt, - const char *optname) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_IF_FAIL (optname, ctxt, NULL, "NULL optname"); - if (ctxt->get_logger ()) - ctxt->get_logger ()->log ("optname: %s", optname); - - ctxt->add_command_line_option (optname); -} - -/* Public entrypoint. See description in libgccjit.h. - - The real work is done by the - gcc::jit::recording::context::add_driver_option method in - jit-recording.c. */ - -void -gcc_jit_context_add_driver_option (gcc_jit_context *ctxt, - const char *optname) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_IF_FAIL (optname, ctxt, NULL, "NULL optname"); - if (ctxt->get_logger ()) - ctxt->get_logger ()->log ("optname: %s", optname); - - ctxt->add_driver_option (optname); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::enable_dump method in - jit-recording.c. */ - -void -gcc_jit_context_enable_dump (gcc_jit_context *ctxt, - const char *dumpname, - char **out_ptr) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_IF_FAIL (dumpname, ctxt, NULL, "NULL dumpname"); - RETURN_IF_FAIL (out_ptr, ctxt, NULL, "NULL out_ptr"); - - ctxt->enable_dump (dumpname, out_ptr); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::compile method in - jit-recording.c. */ - -gcc_jit_result * -gcc_jit_context_compile (gcc_jit_context *ctxt) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - - JIT_LOG_FUNC (ctxt->get_logger ()); - - ctxt->log ("in-memory compile of ctxt: %p", (void *)ctxt); - - gcc_jit_result *result = (gcc_jit_result *)ctxt->compile (); - - ctxt->log ("%s: returning (gcc_jit_result *)%p", - __func__, (void *)result); - - return result; -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::compile_to_file method in - jit-recording.c. */ - -void -gcc_jit_context_compile_to_file (gcc_jit_context *ctxt, - enum gcc_jit_output_kind output_kind, - const char *output_path) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_IF_FAIL_PRINTF1 ( - ((output_kind >= GCC_JIT_OUTPUT_KIND_ASSEMBLER) - && (output_kind <= GCC_JIT_OUTPUT_KIND_EXECUTABLE)), - ctxt, NULL, - "unrecognized output_kind: %i", - output_kind); - RETURN_IF_FAIL (output_path, ctxt, NULL, "NULL output_path"); - - ctxt->log ("compile_to_file of ctxt: %p", (void *)ctxt); - ctxt->log ("output_kind: %i", output_kind); - ctxt->log ("output_path: %s", output_path); - - ctxt->compile_to_file (output_kind, output_path); -} - - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::dump_to_file method in - jit-recording.c. */ - -void -gcc_jit_context_dump_to_file (gcc_jit_context *ctxt, - const char *path, - int update_locations) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_IF_FAIL (path, ctxt, NULL, "NULL path"); - ctxt->dump_to_file (path, update_locations); -} - -/* Public entrypoint. See description in libgccjit.h. */ - -void -gcc_jit_context_set_logfile (gcc_jit_context *ctxt, - FILE *logfile, - int flags, - int verbosity) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_IF_FAIL ((flags == 0), ctxt, NULL, "flags must be 0 for now"); - RETURN_IF_FAIL ((verbosity == 0), ctxt, NULL, "verbosity must be 0 for now"); - - gcc::jit::logger *logger; - if (logfile) - logger = new gcc::jit::logger (logfile, flags, verbosity); - else - logger = NULL; - ctxt->set_logger (logger); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::dump_reproducer_to_file method in - jit-recording.c. */ - -void -gcc_jit_context_dump_reproducer_to_file (gcc_jit_context *ctxt, - const char *path) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - RETURN_IF_FAIL (path, ctxt, NULL, "NULL path"); - ctxt->dump_reproducer_to_file (path); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::get_first_error method in - jit-recording.c. */ - -const char * -gcc_jit_context_get_first_error (gcc_jit_context *ctxt) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - JIT_LOG_FUNC (ctxt->get_logger ()); - - return ctxt->get_first_error (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::get_last_error method in - jit-recording.c. */ - -const char * -gcc_jit_context_get_last_error (gcc_jit_context *ctxt) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context"); - - return ctxt->get_last_error (); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::result::get_code method in jit-result.c. */ - -void * -gcc_jit_result_get_code (gcc_jit_result *result, - const char *fnname) -{ - RETURN_NULL_IF_FAIL (result, NULL, NULL, "NULL result"); - JIT_LOG_FUNC (result->get_logger ()); - RETURN_NULL_IF_FAIL (fnname, NULL, NULL, "NULL fnname"); - - result->log ("locating fnname: %s", fnname); - void *code = result->get_code (fnname); - result->log ("%s: returning (void *)%p", __func__, code); - - return code; -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::result::get_global method in jit-result.c. */ - -void * -gcc_jit_result_get_global (gcc_jit_result *result, - const char *name) -{ - RETURN_NULL_IF_FAIL (result, NULL, NULL, "NULL result"); - JIT_LOG_FUNC (result->get_logger ()); - RETURN_NULL_IF_FAIL (name, NULL, NULL, "NULL name"); - - void *global = result->get_global (name); - result->log ("%s: returning (void *)%p", __func__, global); - - return global; -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this is essentially a wrapper around the - destructor for gcc::jit::result in jit-result.c. */ - -void -gcc_jit_result_release (gcc_jit_result *result) -{ - RETURN_IF_FAIL (result, NULL, NULL, "NULL result"); - JIT_LOG_FUNC (result->get_logger ()); - result->log ("deleting result: %p", (void *)result); - delete result; -} - -/********************************************************************** - Timing support. - **********************************************************************/ - -/* Create a gcc_jit_timer instance, and start timing. */ - -gcc_jit_timer * -gcc_jit_timer_new (void) -{ - gcc_jit_timer *timer = new gcc_jit_timer (); - timer->start (TV_TOTAL); - timer->push (TV_JIT_CLIENT_CODE); - return timer; -} - -/* Release a gcc_jit_timer instance. */ - -void -gcc_jit_timer_release (gcc_jit_timer *timer) -{ - RETURN_IF_FAIL (timer, NULL, NULL, "NULL timer"); - - delete timer; -} - -/* Associate a gcc_jit_timer instance with a context. */ - -void -gcc_jit_context_set_timer (gcc_jit_context *ctxt, - gcc_jit_timer *timer) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL ctxt"); - RETURN_IF_FAIL (timer, ctxt, NULL, "NULL timer"); - - ctxt->set_timer (timer); -} - -/* Get the timer associated with a context (if any). */ - -gcc_jit_timer * -gcc_jit_context_get_timer (gcc_jit_context *ctxt) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL ctxt"); - - return (gcc_jit_timer *)ctxt->get_timer (); -} - -/* Push the given item onto the timing stack. */ - -void -gcc_jit_timer_push (gcc_jit_timer *timer, - const char *item_name) -{ - RETURN_IF_FAIL (timer, NULL, NULL, "NULL timer"); - RETURN_IF_FAIL (item_name, NULL, NULL, "NULL item_name"); - timer->push_client_item (item_name); -} - -/* Pop the top item from the timing stack. */ - -void -gcc_jit_timer_pop (gcc_jit_timer *timer, - const char *item_name) -{ - RETURN_IF_FAIL (timer, NULL, NULL, "NULL timer"); - - if (item_name) - { - const char *top_item_name = timer->get_topmost_item_name (); - - RETURN_IF_FAIL_PRINTF1 - (top_item_name, NULL, NULL, - "pop of empty timing stack (attempting to pop: \"%s\")", - item_name); - - RETURN_IF_FAIL_PRINTF2 - (strcmp (item_name, top_item_name) == 0, NULL, NULL, - "mismatching item_name:" - " top of timing stack: \"%s\"," - " attempting to pop: \"%s\"", - top_item_name, - item_name); - } - - timer->pop_client_item (); -} - -/* Print timing information to the given stream about activity since - the timer was started. */ - -void -gcc_jit_timer_print (gcc_jit_timer *timer, - FILE *f_out) -{ - RETURN_IF_FAIL (timer, NULL, NULL, "NULL timer"); - RETURN_IF_FAIL (f_out, NULL, NULL, "NULL f_out"); - - timer->pop (TV_JIT_CLIENT_CODE); - timer->stop (TV_TOTAL); - timer->print (f_out); - timer->start (TV_TOTAL); - timer->push (TV_JIT_CLIENT_CODE); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is effectively done by the - gcc::jit::base_call::set_require_tail_call setter in jit-recording.h. */ - -void -gcc_jit_rvalue_set_bool_require_tail_call (gcc_jit_rvalue *rvalue, - int require_tail_call) -{ - RETURN_IF_FAIL (rvalue, NULL, NULL, "NULL call"); - JIT_LOG_FUNC (rvalue->get_context ()->get_logger ()); - - /* Verify that it's a call. */ - gcc::jit::recording::base_call *call = rvalue->dyn_cast_base_call (); - RETURN_IF_FAIL_PRINTF1 (call, NULL, NULL, "not a call: %s", - rvalue->get_debug_string ()); - - call->set_require_tail_call (require_tail_call); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::type::get_aligned method, in - jit-recording.c. */ - -gcc_jit_type * -gcc_jit_type_get_aligned (gcc_jit_type *type, - size_t alignment_in_bytes) -{ - RETURN_NULL_IF_FAIL (type, NULL, NULL, "NULL type"); - - gcc::jit::recording::context *ctxt = type->m_ctxt; - - JIT_LOG_FUNC (ctxt->get_logger ()); - - RETURN_NULL_IF_FAIL_PRINTF1 - (pow2_or_zerop (alignment_in_bytes), ctxt, NULL, - "alignment not a power of two: %zi", - alignment_in_bytes); - RETURN_NULL_IF_FAIL (!type->is_void (), ctxt, NULL, "void type"); - - return (gcc_jit_type *)type->get_aligned (alignment_in_bytes); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::type::get_vector method, in - jit-recording.c. */ - -gcc_jit_type * -gcc_jit_type_get_vector (gcc_jit_type *type, size_t num_units) -{ - RETURN_NULL_IF_FAIL (type, NULL, NULL, "NULL type"); - - gcc::jit::recording::context *ctxt = type->m_ctxt; - - JIT_LOG_FUNC (ctxt->get_logger ()); - - RETURN_NULL_IF_FAIL_PRINTF1 - (type->is_int () || type->is_float (), ctxt, NULL, - "type is not integral or floating point: %s", - type->get_debug_string ()); - - RETURN_NULL_IF_FAIL_PRINTF1 - (pow2_or_zerop (num_units), ctxt, NULL, - "num_units not a power of two: %zi", - num_units); - - return (gcc_jit_type *)type->get_vector (num_units); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::function::get_address method, in - jit-recording.c. */ - -gcc_jit_rvalue * -gcc_jit_function_get_address (gcc_jit_function *fn, - gcc_jit_location *loc) -{ - RETURN_NULL_IF_FAIL (fn, NULL, NULL, "NULL function"); - - gcc::jit::recording::context *ctxt = fn->m_ctxt; - - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - - return (gcc_jit_rvalue *)fn->get_address (loc); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::new_rvalue_from_vector method, in - jit-recording.c. */ - -extern gcc_jit_rvalue * -gcc_jit_context_new_rvalue_from_vector (gcc_jit_context *ctxt, - gcc_jit_location *loc, - gcc_jit_type *vec_type, - size_t num_elements, - gcc_jit_rvalue **elements) -{ - RETURN_NULL_IF_FAIL (ctxt, NULL, loc, "NULL ctxt"); - JIT_LOG_FUNC (ctxt->get_logger ()); - - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (vec_type, ctxt, loc, "NULL vec_type"); - - /* "vec_type" must be a vector type. */ - gcc::jit::recording::vector_type *as_vec_type - = vec_type->dyn_cast_vector_type (); - RETURN_NULL_IF_FAIL_PRINTF1 (as_vec_type, ctxt, loc, - "%s is not a vector type", - vec_type->get_debug_string ()); - - /* "num_elements" must match. */ - RETURN_NULL_IF_FAIL_PRINTF1 ( - num_elements == as_vec_type->get_num_units (), ctxt, loc, - "num_elements != %zi", as_vec_type->get_num_units ()); - - /* "elements must be non-NULL. */ - RETURN_NULL_IF_FAIL (elements, ctxt, loc, "NULL elements"); - - /* Each of "elements" must be non-NULL and of the correct type. */ - gcc::jit::recording::type *element_type - = as_vec_type->get_element_type (); - for (size_t i = 0; i < num_elements; i++) - { - RETURN_NULL_IF_FAIL_PRINTF1 ( - elements[i], ctxt, loc, "NULL elements[%zi]", i); - RETURN_NULL_IF_FAIL_PRINTF4 ( - compatible_types (element_type, - elements[i]->get_type ()), - ctxt, loc, - "mismatching type for element[%zi] (expected type: %s): %s (type: %s)", - i, - element_type->get_debug_string (), - elements[i]->get_debug_string (), - elements[i]->get_type ()->get_debug_string ()); - } - - return (gcc_jit_rvalue *)ctxt->new_rvalue_from_vector - (loc, - as_vec_type, - (gcc::jit::recording::rvalue **)elements); -} - -/* A mutex around the cached state in parse_basever. - Ideally this would be within parse_basever, but the mutex is only needed - by libgccjit. */ - -static pthread_mutex_t version_mutex = PTHREAD_MUTEX_INITIALIZER; - -struct jit_version_info -{ - /* Default constructor. Populate via parse_basever, - guarded by version_mutex. */ - jit_version_info () - { - pthread_mutex_lock (&version_mutex); - parse_basever (&major, &minor, &patchlevel); - pthread_mutex_unlock (&version_mutex); - } - - int major; - int minor; - int patchlevel; -}; - - -extern int -gcc_jit_version_major (void) -{ - jit_version_info vi; - return vi.major; -} - -extern int -gcc_jit_version_minor (void) -{ - jit_version_info vi; - return vi.minor; -} - -extern int -gcc_jit_version_patchlevel (void) -{ - jit_version_info vi; - return vi.patchlevel; -} - -/********************************************************************** - Asm support. - **********************************************************************/ - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::block::add_extended_asm, in - jit-recording.c. */ - -gcc_jit_extended_asm * -gcc_jit_block_add_extended_asm (gcc_jit_block *block, - gcc_jit_location *loc, - const char *asm_template) -{ - RETURN_NULL_IF_NOT_VALID_BLOCK (block, loc); - gcc::jit::recording::context *ctxt = block->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (asm_template, ctxt, loc, "NULL asm_template"); - - return (gcc_jit_extended_asm *)block->add_extended_asm (loc, asm_template); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::block::end_with_extended_asm_goto, in - jit-recording.c. */ - -gcc_jit_extended_asm * -gcc_jit_block_end_with_extended_asm_goto (gcc_jit_block *block, - gcc_jit_location *loc, - const char *asm_template, - int num_goto_blocks, - gcc_jit_block **goto_blocks, - gcc_jit_block *fallthrough_block) -{ - RETURN_NULL_IF_NOT_VALID_BLOCK (block, loc); - gcc::jit::recording::context *ctxt = block->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_NULL_IF_FAIL (asm_template, ctxt, loc, "NULL asm_template"); - RETURN_NULL_IF_FAIL (num_goto_blocks >= 0, ctxt, loc, "num_goto_blocks < 0"); - for (int i = 0; i < num_goto_blocks; i++) - RETURN_NULL_IF_FAIL_PRINTF1 (goto_blocks[i], - ctxt, loc, - "NULL goto_blocks[%i]", i); - /* fallthrough_block can be NULL. */ - return (gcc_jit_extended_asm *)block->end_with_extended_asm_goto - (loc, asm_template, - num_goto_blocks, (gcc::jit::recording::block **)goto_blocks, - fallthrough_block); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, this calls the trivial - gcc::jit::recording::memento::as_object method (an extended_asm is a - memento), in jit-recording.h. */ - -gcc_jit_object * -gcc_jit_extended_asm_as_object (gcc_jit_extended_asm *ext_asm) -{ - RETURN_NULL_IF_FAIL (ext_asm, NULL, NULL, "NULL ext_asm"); - - return static_cast <gcc_jit_object *> (ext_asm->as_object ()); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::extended_asm::set_volatile_flag, in - jit-recording.c. */ - -void -gcc_jit_extended_asm_set_volatile_flag (gcc_jit_extended_asm *ext_asm, - int flag) -{ - RETURN_IF_FAIL (ext_asm, NULL, NULL, "NULL ext_asm"); - ext_asm->set_volatile_flag (flag); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::extended_asm::set_inline_flag, in - jit-recording.c. */ - -void -gcc_jit_extended_asm_set_inline_flag (gcc_jit_extended_asm *ext_asm, - int flag) -{ - RETURN_IF_FAIL (ext_asm, NULL, NULL, "NULL ext_asm"); - ext_asm->set_inline_flag (flag); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::extended_asm::add_output_operand, in - jit-recording.c. */ - -void -gcc_jit_extended_asm_add_output_operand (gcc_jit_extended_asm *ext_asm, - const char *asm_symbolic_name, - const char *constraint, - gcc_jit_lvalue *dest) -{ - RETURN_IF_FAIL (ext_asm, NULL, NULL, "NULL ext_asm"); - gcc::jit::recording::context *ctxt = ext_asm->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - gcc::jit::recording::location *loc = ext_asm->get_loc (); - /* asm_symbolic_name can be NULL. */ - RETURN_IF_FAIL (constraint, ctxt, loc, "NULL constraint"); - RETURN_IF_FAIL (dest, ctxt, loc, "NULL dest"); - RETURN_IF_FAIL (!ext_asm->is_goto (), ctxt, loc, - "cannot add output operand to asm goto"); - ext_asm->add_output_operand (asm_symbolic_name, constraint, dest); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::extended_asm::add_input_operand, in - jit-recording.c. */ - -extern void -gcc_jit_extended_asm_add_input_operand (gcc_jit_extended_asm *ext_asm, - const char *asm_symbolic_name, - const char *constraint, - gcc_jit_rvalue *src) -{ - RETURN_IF_FAIL (ext_asm, NULL, NULL, "NULL ext_asm"); - gcc::jit::recording::context *ctxt = ext_asm->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - gcc::jit::recording::location *loc = ext_asm->get_loc (); - /* asm_symbolic_name can be NULL. */ - RETURN_IF_FAIL (constraint, ctxt, loc, "NULL constraint"); - RETURN_IF_FAIL (src, ctxt, loc, "NULL src"); - ext_asm->add_input_operand (asm_symbolic_name, constraint, src); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::extended_asm::add_clobber, in - jit-recording.c. */ - -void -gcc_jit_extended_asm_add_clobber (gcc_jit_extended_asm *ext_asm, - const char *victim) -{ - RETURN_IF_FAIL (ext_asm, NULL, NULL, "NULL ext_asm"); - gcc::jit::recording::context *ctxt = ext_asm->get_context (); - JIT_LOG_FUNC (ctxt->get_logger ()); - gcc::jit::recording::location *loc = ext_asm->get_loc (); - RETURN_IF_FAIL (victim, ctxt, loc, "NULL victim"); - ext_asm->add_clobber (victim); -} - -/* Public entrypoint. See description in libgccjit.h. - - After error-checking, the real work is done by the - gcc::jit::recording::context::add_top_level_asm, in - jit-recording.c. */ - -void -gcc_jit_context_add_top_level_asm (gcc_jit_context *ctxt, - gcc_jit_location *loc, - const char *asm_stmts) -{ - RETURN_IF_FAIL (ctxt, NULL, NULL, "NULL ctxt"); - JIT_LOG_FUNC (ctxt->get_logger ()); - /* LOC can be NULL. */ - RETURN_IF_FAIL (asm_stmts, ctxt, NULL, "NULL asm_stmts"); - ctxt->add_top_level_asm (loc, asm_stmts); -} |