aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop-iv.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-01-14 16:56:44 +0100
committerMartin Liska <mliska@suse.cz>2022-01-17 22:12:04 +0100
commit5c69acb32329d49e58c26fa41ae74229a52b9106 (patch)
treeddb05f9d73afb6f998457d2ac4b720e3b3b60483 /gcc/loop-iv.c
parent490e23032baaece71f2ec09fa1805064b150fbc2 (diff)
downloadgcc-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/loop-iv.c')
-rw-r--r--gcc/loop-iv.c3051
1 files changed, 0 insertions, 3051 deletions
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
deleted file mode 100644
index 0eafe7d..0000000
--- a/gcc/loop-iv.c
+++ /dev/null
@@ -1,3051 +0,0 @@
-/* Rtl-level induction variable analysis.
- Copyright (C) 2004-2022 Free Software Foundation, Inc.
-
-This file is part of GCC.
-
-GCC is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3, or (at your option) any
-later version.
-
-GCC is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING3. If not see
-<http://www.gnu.org/licenses/>. */
-
-/* This is a simple analysis of induction variables of the loop. The major use
- is for determining the number of iterations of a loop for loop unrolling,
- doloop optimization and branch prediction. The iv information is computed
- on demand.
-
- Induction variables are analyzed by walking the use-def chains. When
- a basic induction variable (biv) is found, it is cached in the bivs
- hash table. When register is proved to be a biv, its description
- is stored to DF_REF_DATA of the def reference.
-
- The analysis works always with one loop -- you must call
- iv_analysis_loop_init (loop) for it. All the other functions then work with
- this loop. When you need to work with another loop, just call
- iv_analysis_loop_init for it. When you no longer need iv analysis, call
- iv_analysis_done () to clean up the memory.
-
- The available functions are:
-
- iv_analyze (insn, mode, reg, iv): Stores the description of the induction
- variable corresponding to the use of register REG in INSN to IV, given
- that REG has mode MODE. Returns true if REG is an induction variable
- in INSN. false otherwise. If a use of REG is not found in INSN,
- the following insns are scanned (so that we may call this function
- on insns returned by get_condition).
- iv_analyze_result (insn, def, iv): Stores to IV the description of the iv
- corresponding to DEF, which is a register defined in INSN.
- iv_analyze_expr (insn, mode, expr, iv): Stores to IV the description of iv
- corresponding to expression EXPR evaluated at INSN. All registers used by
- EXPR must also be used in INSN. MODE is the mode of EXPR.
-*/
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "backend.h"
-#include "rtl.h"
-#include "df.h"
-#include "memmodel.h"
-#include "emit-rtl.h"
-#include "diagnostic-core.h"
-#include "cfgloop.h"
-#include "intl.h"
-#include "dumpfile.h"
-#include "rtl-iter.h"
-#include "tree-ssa-loop-niter.h"
-#include "regs.h"
-#include "function-abi.h"
-
-/* Possible return values of iv_get_reaching_def. */
-
-enum iv_grd_result
-{
- /* More than one reaching def, or reaching def that does not
- dominate the use. */
- GRD_INVALID,
-
- /* The use is trivial invariant of the loop, i.e. is not changed
- inside the loop. */
- GRD_INVARIANT,
-
- /* The use is reached by initial value and a value from the
- previous iteration. */
- GRD_MAYBE_BIV,
-
- /* The use has single dominating def. */
- GRD_SINGLE_DOM
-};
-
-/* Information about a biv. */
-
-class biv_entry
-{
-public:
- unsigned regno; /* The register of the biv. */
- class rtx_iv iv; /* Value of the biv. */
-};
-
-static bool clean_slate = true;
-
-static unsigned int iv_ref_table_size = 0;
-
-/* Table of rtx_ivs indexed by the df_ref uid field. */
-static class rtx_iv ** iv_ref_table;
-
-/* Induction variable stored at the reference. */
-#define DF_REF_IV(REF) iv_ref_table[DF_REF_ID (REF)]
-#define DF_REF_IV_SET(REF, IV) iv_ref_table[DF_REF_ID (REF)] = (IV)
-
-/* The current loop. */
-
-static class loop *current_loop;
-
-/* Hashtable helper. */
-
-struct biv_entry_hasher : free_ptr_hash <biv_entry>
-{
- typedef rtx_def *compare_type;
- static inline hashval_t hash (const biv_entry *);
- static inline bool equal (const biv_entry *, const rtx_def *);
-};
-
-/* Returns hash value for biv B. */
-
-inline hashval_t
-biv_entry_hasher::hash (const biv_entry *b)
-{
- return b->regno;
-}
-
-/* Compares biv B and register R. */
-
-inline bool
-biv_entry_hasher::equal (const biv_entry *b, const rtx_def *r)
-{
- return b->regno == REGNO (r);
-}
-
-/* Bivs of the current loop. */
-
-static hash_table<biv_entry_hasher> *bivs;
-
-static bool iv_analyze_op (rtx_insn *, scalar_int_mode, rtx, class rtx_iv *);
-
-/* Return the RTX code corresponding to the IV extend code EXTEND. */
-static inline enum rtx_code
-iv_extend_to_rtx_code (enum iv_extend_code extend)
-{
- switch (extend)
- {
- case IV_SIGN_EXTEND:
- return SIGN_EXTEND;
- case IV_ZERO_EXTEND:
- return ZERO_EXTEND;
- case IV_UNKNOWN_EXTEND:
- return UNKNOWN;
- }
- gcc_unreachable ();
-}
-
-/* Dumps information about IV to FILE. */
-
-extern void dump_iv_info (FILE *, class rtx_iv *);
-void
-dump_iv_info (FILE *file, class rtx_iv *iv)
-{
- if (!iv->base)
- {
- fprintf (file, "not simple");
- return;
- }
-
- if (iv->step == const0_rtx
- && !iv->first_special)
- fprintf (file, "invariant ");
-
- print_rtl (file, iv->base);
- if (iv->step != const0_rtx)
- {
- fprintf (file, " + ");
- print_rtl (file, iv->step);
- fprintf (file, " * iteration");
- }
- fprintf (file, " (in %s)", GET_MODE_NAME (iv->mode));
-
- if (iv->mode != iv->extend_mode)
- fprintf (file, " %s to %s",
- rtx_name[iv_extend_to_rtx_code (iv->extend)],
- GET_MODE_NAME (iv->extend_mode));
-
- if (iv->mult != const1_rtx)
- {
- fprintf (file, " * ");
- print_rtl (file, iv->mult);
- }
- if (iv->delta != const0_rtx)
- {
- fprintf (file, " + ");
- print_rtl (file, iv->delta);
- }
- if (iv->first_special)
- fprintf (file, " (first special)");
-}
-
-static void
-check_iv_ref_table_size (void)
-{
- if (iv_ref_table_size < DF_DEFS_TABLE_SIZE ())
- {
- unsigned int new_size = DF_DEFS_TABLE_SIZE () + (DF_DEFS_TABLE_SIZE () / 4);
- iv_ref_table = XRESIZEVEC (class rtx_iv *, iv_ref_table, new_size);
- memset (&iv_ref_table[iv_ref_table_size], 0,
- (new_size - iv_ref_table_size) * sizeof (class rtx_iv *));
- iv_ref_table_size = new_size;
- }
-}
-
-
-/* Checks whether REG is a well-behaved register. */
-
-static bool
-simple_reg_p (rtx reg)
-{
- unsigned r;
-
- if (GET_CODE (reg) == SUBREG)
- {
- if (!subreg_lowpart_p (reg))
- return false;
- reg = SUBREG_REG (reg);
- }
-
- if (!REG_P (reg))
- return false;
-
- r = REGNO (reg);
- if (HARD_REGISTER_NUM_P (r))
- return false;
-
- if (GET_MODE_CLASS (GET_MODE (reg)) != MODE_INT)
- return false;
-
- return true;
-}
-
-/* Clears the information about ivs stored in df. */
-
-static void
-clear_iv_info (void)
-{
- unsigned i, n_defs = DF_DEFS_TABLE_SIZE ();
- class rtx_iv *iv;
-
- check_iv_ref_table_size ();
- for (i = 0; i < n_defs; i++)
- {
- iv = iv_ref_table[i];
- if (iv)
- {
- free (iv);
- iv_ref_table[i] = NULL;
- }
- }
-
- bivs->empty ();
-}
-
-
-/* Prepare the data for an induction variable analysis of a LOOP. */
-
-void
-iv_analysis_loop_init (class loop *loop)
-{
- current_loop = loop;
-
- /* Clear the information from the analysis of the previous loop. */
- if (clean_slate)
- {
- df_set_flags (DF_EQ_NOTES + DF_DEFER_INSN_RESCAN);
- bivs = new hash_table<biv_entry_hasher> (10);
- clean_slate = false;
- }
- else
- clear_iv_info ();
-
- /* Get rid of the ud chains before processing the rescans. Then add
- the problem back. */
- df_remove_problem (df_chain);
- df_process_deferred_rescans ();
- df_set_flags (DF_RD_PRUNE_DEAD_DEFS);
- df_chain_add_problem (DF_UD_CHAIN);
- df_note_add_problem ();
- df_analyze_loop (loop);
- if (dump_file)
- df_dump_region (dump_file);
-
- check_iv_ref_table_size ();
-}
-
-/* Finds the definition of REG that dominates loop latch and stores
- it to DEF. Returns false if there is not a single definition
- dominating the latch. If REG has no definition in loop, DEF
- is set to NULL and true is returned. */
-
-static bool
-latch_dominating_def (rtx reg, df_ref *def)
-{
- df_ref single_rd = NULL, adef;
- unsigned regno = REGNO (reg);
- class df_rd_bb_info *bb_info = DF_RD_BB_INFO (current_loop->latch);
-
- for (adef = DF_REG_DEF_CHAIN (regno); adef; adef = DF_REF_NEXT_REG (adef))
- {
- if (!bitmap_bit_p (df->blocks_to_analyze, DF_REF_BBNO (adef))
- || !bitmap_bit_p (&bb_info->out, DF_REF_ID (adef)))
- continue;
-
- /* More than one reaching definition. */
- if (single_rd)
- return false;
-
- if (!just_once_each_iteration_p (current_loop, DF_REF_BB (adef)))
- return false;
-
- single_rd = adef;
- }
-
- *def = single_rd;
- return true;
-}
-
-/* Gets definition of REG reaching its use in INSN and stores it to DEF. */
-
-static enum iv_grd_result
-iv_get_reaching_def (rtx_insn *insn, rtx reg, df_ref *def)
-{
- df_ref use, adef;
- basic_block def_bb, use_bb;
- rtx_insn *def_insn;
- bool dom_p;
-
- *def = NULL;
- if (!simple_reg_p (reg))
- return GRD_INVALID;
- if (GET_CODE (reg) == SUBREG)
- reg = SUBREG_REG (reg);
- gcc_assert (REG_P (reg));
-
- use = df_find_use (insn, reg);
- gcc_assert (use != NULL);
-
- if (!DF_REF_CHAIN (use))
- return GRD_INVARIANT;
-
- /* More than one reaching def. */
- if (DF_REF_CHAIN (use)->next)
- return GRD_INVALID;
-
- adef = DF_REF_CHAIN (use)->ref;
-
- /* We do not handle setting only part of the register. */
- if (DF_REF_FLAGS (adef) & DF_REF_READ_WRITE)
- return GRD_INVALID;
-
- def_insn = DF_REF_INSN (adef);
- def_bb = DF_REF_BB (adef);
- use_bb = BLOCK_FOR_INSN (insn);
-
- if (use_bb == def_bb)
- dom_p = (DF_INSN_LUID (def_insn) < DF_INSN_LUID (insn));
- else
- dom_p = dominated_by_p (CDI_DOMINATORS, use_bb, def_bb);
-
- if (dom_p)
- {
- *def = adef;
- return GRD_SINGLE_DOM;
- }
-
- /* The definition does not dominate the use. This is still OK if
- this may be a use of a biv, i.e. if the def_bb dominates loop
- latch. */
- if (just_once_each_iteration_p (current_loop, def_bb))
- return GRD_MAYBE_BIV;
-
- return GRD_INVALID;
-}
-
-/* Sets IV to invariant CST in MODE. Always returns true (just for
- consistency with other iv manipulation functions that may fail). */
-
-static bool
-iv_constant (class rtx_iv *iv, scalar_int_mode mode, rtx cst)
-{
- iv->mode = mode;
- iv->base = cst;
- iv->step = const0_rtx;
- iv->first_special = false;
- iv->extend = IV_UNKNOWN_EXTEND;
- iv->extend_mode = iv->mode;
- iv->delta = const0_rtx;
- iv->mult = const1_rtx;
-
- return true;
-}
-
-/* Evaluates application of subreg to MODE on IV. */
-
-static bool
-iv_subreg (class rtx_iv *iv, scalar_int_mode mode)
-{
- /* If iv is invariant, just calculate the new value. */
- if (iv->step == const0_rtx
- && !iv->first_special)
- {
- rtx val = get_iv_value (iv, const0_rtx);
- val = lowpart_subreg (mode, val,
- iv->extend == IV_UNKNOWN_EXTEND
- ? iv->mode : iv->extend_mode);
-
- iv->base = val;
- iv->extend = IV_UNKNOWN_EXTEND;
- iv->mode = iv->extend_mode = mode;
- iv->delta = const0_rtx;
- iv->mult = const1_rtx;
- return true;
- }
-
- if (iv->extend_mode == mode)
- return true;
-
- if (GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (iv->mode))
- return false;
-
- iv->extend = IV_UNKNOWN_EXTEND;
- iv->mode = mode;
-
- iv->base = simplify_gen_binary (PLUS, iv->extend_mode, iv->delta,
- simplify_gen_binary (MULT, iv->extend_mode,
- iv->base, iv->mult));
- iv->step = simplify_gen_binary (MULT, iv->extend_mode, iv->step, iv->mult);
- iv->mult = const1_rtx;
- iv->delta = const0_rtx;
- iv->first_special = false;
-
- return true;
-}
-
-/* Evaluates application of EXTEND to MODE on IV. */
-
-static bool
-iv_extend (class rtx_iv *iv, enum iv_extend_code extend, scalar_int_mode mode)
-{
- /* If iv is invariant, just calculate the new value. */
- if (iv->step == const0_rtx
- && !iv->first_special)
- {
- rtx val = get_iv_value (iv, const0_rtx);
- if (iv->extend_mode != iv->mode
- && iv->extend != IV_UNKNOWN_EXTEND
- && iv->extend != extend)
- val = lowpart_subreg (iv->mode, val, iv->extend_mode);
- val = simplify_gen_unary (iv_extend_to_rtx_code (extend), mode,
- val,
- iv->extend == extend
- ? iv->extend_mode : iv->mode);
- iv->base = val;
- iv->extend = IV_UNKNOWN_EXTEND;
- iv->mode = iv->extend_mode = mode;
- iv->delta = const0_rtx;
- iv->mult = const1_rtx;
- return true;
- }
-
- if (mode != iv->extend_mode)
- return false;
-
- if (iv->extend != IV_UNKNOWN_EXTEND
- && iv->extend != extend)
- return false;
-
- iv->extend = extend;
-
- return true;
-}
-
-/* Evaluates negation of IV. */
-
-static bool
-iv_neg (class rtx_iv *iv)
-{
- if (iv->extend == IV_UNKNOWN_EXTEND)
- {
- iv->base = simplify_gen_unary (NEG, iv->extend_mode,
- iv->base, iv->extend_mode);
- iv->step = simplify_gen_unary (NEG, iv->extend_mode,
- iv->step, iv->extend_mode);
- }
- else
- {
- iv->delta = simplify_gen_unary (NEG, iv->extend_mode,
- iv->delta, iv->extend_mode);
- iv->mult = simplify_gen_unary (NEG, iv->extend_mode,
- iv->mult, iv->extend_mode);
- }
-
- return true;
-}
-
-/* Evaluates addition or subtraction (according to OP) of IV1 to IV0. */
-
-static bool
-iv_add (class rtx_iv *iv0, class rtx_iv *iv1, enum rtx_code op)
-{
- scalar_int_mode mode;
- rtx arg;
-
- /* Extend the constant to extend_mode of the other operand if necessary. */
- if (iv0->extend == IV_UNKNOWN_EXTEND
- && iv0->mode == iv0->extend_mode
- && iv0->step == const0_rtx
- && GET_MODE_SIZE (iv0->extend_mode) < GET_MODE_SIZE (iv1->extend_mode))
- {
- iv0->extend_mode = iv1->extend_mode;
- iv0->base = simplify_gen_unary (ZERO_EXTEND, iv0->extend_mode,
- iv0->base, iv0->mode);
- }
- if (iv1->extend == IV_UNKNOWN_EXTEND
- && iv1->mode == iv1->extend_mode
- && iv1->step == const0_rtx
- && GET_MODE_SIZE (iv1->extend_mode) < GET_MODE_SIZE (iv0->extend_mode))
- {
- iv1->extend_mode = iv0->extend_mode;
- iv1->base = simplify_gen_unary (ZERO_EXTEND, iv1->extend_mode,
- iv1->base, iv1->mode);
- }
-
- mode = iv0->extend_mode;
- if (mode != iv1->extend_mode)
- return false;
-
- if (iv0->extend == IV_UNKNOWN_EXTEND
- && iv1->extend == IV_UNKNOWN_EXTEND)
- {
- if (iv0->mode != iv1->mode)
- return false;
-
- iv0->base = simplify_gen_binary (op, mode, iv0->base, iv1->base);
- iv0->step = simplify_gen_binary (op, mode, iv0->step, iv1->step);
-
- return true;
- }
-
- /* Handle addition of constant. */
- if (iv1->extend == IV_UNKNOWN_EXTEND
- && iv1->mode == mode
- && iv1->step == const0_rtx)
- {
- iv0->delta = simplify_gen_binary (op, mode, iv0->delta, iv1->base);
- return true;
- }
-
- if (iv0->extend == IV_UNKNOWN_EXTEND
- && iv0->mode == mode
- && iv0->step == const0_rtx)
- {
- arg = iv0->base;
- *iv0 = *iv1;
- if (op == MINUS
- && !iv_neg (iv0))
- return false;
-
- iv0->delta = simplify_gen_binary (PLUS, mode, iv0->delta, arg);
- return true;
- }
-
- return false;
-}
-
-/* Evaluates multiplication of IV by constant CST. */
-
-static bool
-iv_mult (class rtx_iv *iv, rtx mby)
-{
- scalar_int_mode mode = iv->extend_mode;
-
- if (GET_MODE (mby) != VOIDmode
- && GET_MODE (mby) != mode)
- return false;
-
- if (iv->extend == IV_UNKNOWN_EXTEND)
- {
- iv->base = simplify_gen_binary (MULT, mode, iv->base, mby);
- iv->step = simplify_gen_binary (MULT, mode, iv->step, mby);
- }
- else
- {
- iv->delta = simplify_gen_binary (MULT, mode, iv->delta, mby);
- iv->mult = simplify_gen_binary (MULT, mode, iv->mult, mby);
- }
-
- return true;
-}
-
-/* Evaluates shift of IV by constant CST. */
-
-static bool
-iv_shift (class rtx_iv *iv, rtx mby)
-{
- scalar_int_mode mode = iv->extend_mode;
-
- if (GET_MODE (mby) != VOIDmode
- && GET_MODE (mby) != mode)
- return false;
-
- if (iv->extend == IV_UNKNOWN_EXTEND)
- {
- iv->base = simplify_gen_binary (ASHIFT, mode, iv->base, mby);
- iv->step = simplify_gen_binary (ASHIFT, mode, iv->step, mby);
- }
- else
- {
- iv->delta = simplify_gen_binary (ASHIFT, mode, iv->delta, mby);
- iv->mult = simplify_gen_binary (ASHIFT, mode, iv->mult, mby);
- }
-
- return true;
-}
-
-/* The recursive part of get_biv_step. Gets the value of the single value
- defined by DEF wrto initial value of REG inside loop, in shape described
- at get_biv_step. */
-
-static bool
-get_biv_step_1 (df_ref def, scalar_int_mode outer_mode, rtx reg,
- rtx *inner_step, scalar_int_mode *inner_mode,
- enum iv_extend_code *extend,
- rtx *outer_step)
-{
- rtx set, rhs, op0 = NULL_RTX, op1 = NULL_RTX;
- rtx next, nextr;
- enum rtx_code code;
- rtx_insn *insn = DF_REF_INSN (def);
- df_ref next_def;
- enum iv_grd_result res;
-
- set = single_set (insn);
- if (!set)
- return false;
-
- rhs = find_reg_equal_equiv_note (insn);
- if (rhs)
- rhs = XEXP (rhs, 0);
- else
- rhs = SET_SRC (set);
-
- code = GET_CODE (rhs);
- switch (code)
- {
- case SUBREG:
- case REG:
- next = rhs;
- break;
-
- case PLUS:
- case MINUS:
- op0 = XEXP (rhs, 0);
- op1 = XEXP (rhs, 1);
-
- if (code == PLUS && CONSTANT_P (op0))
- std::swap (op0, op1);
-
- if (!simple_reg_p (op0)
- || !CONSTANT_P (op1))
- return false;
-
- if (GET_MODE (rhs) != outer_mode)
- {
- /* ppc64 uses expressions like
-
- (set x:SI (plus:SI (subreg:SI y:DI) 1)).
-
- this is equivalent to
-
- (set x':DI (plus:DI y:DI 1))
- (set x:SI (subreg:SI (x':DI)). */
- if (GET_CODE (op0) != SUBREG)
- return false;
- if (GET_MODE (SUBREG_REG (op0)) != outer_mode)
- return false;
- }
-
- next = op0;
- break;
-
- case SIGN_EXTEND:
- case ZERO_EXTEND:
- if (GET_MODE (rhs) != outer_mode)
- return false;
-
- op0 = XEXP (rhs, 0);
- if (!simple_reg_p (op0))
- return false;
-
- next = op0;
- break;
-
- default:
- return false;
- }
-
- if (GET_CODE (next) == SUBREG)
- {
- if (!subreg_lowpart_p (next))
- return false;
-
- nextr = SUBREG_REG (next);
- if (GET_MODE (nextr) != outer_mode)
- return false;
- }
- else
- nextr = next;
-
- res = iv_get_reaching_def (insn, nextr, &next_def);
-
- if (res == GRD_INVALID || res == GRD_INVARIANT)
- return false;
-
- if (res == GRD_MAYBE_BIV)
- {
- if (!rtx_equal_p (nextr, reg))
- return false;
-
- *inner_step = const0_rtx;
- *extend = IV_UNKNOWN_EXTEND;
- *inner_mode = outer_mode;
- *outer_step = const0_rtx;
- }
- else if (!get_biv_step_1 (next_def, outer_mode, reg,
- inner_step, inner_mode, extend,
- outer_step))
- return false;
-
- if (GET_CODE (next) == SUBREG)
- {
- scalar_int_mode amode;
- if (!is_a <scalar_int_mode> (GET_MODE (next), &amode)
- || GET_MODE_SIZE (amode) > GET_MODE_SIZE (*inner_mode))
- return false;
-
- *inner_mode = amode;
- *inner_step = simplify_gen_binary (PLUS, outer_mode,
- *inner_step, *outer_step);
- *outer_step = const0_rtx;
- *extend = IV_UNKNOWN_EXTEND;
- }
-
- switch (code)
- {
- case REG:
- case SUBREG:
- break;
-
- case PLUS:
- case MINUS:
- if (*inner_mode == outer_mode
- /* See comment in previous switch. */
- || GET_MODE (rhs) != outer_mode)
- *inner_step = simplify_gen_binary (code, outer_mode,
- *inner_step, op1);
- else
- *outer_step = simplify_gen_binary (code, outer_mode,
- *outer_step, op1);
- break;
-
- case SIGN_EXTEND:
- case ZERO_EXTEND:
- gcc_assert (GET_MODE (op0) == *inner_mode
- && *extend == IV_UNKNOWN_EXTEND
- && *outer_step == const0_rtx);
-
- *extend = (code == SIGN_EXTEND) ? IV_SIGN_EXTEND : IV_ZERO_EXTEND;
- break;
-
- default:
- return false;
- }
-
- return true;
-}
-
-/* Gets the operation on register REG inside loop, in shape
-
- OUTER_STEP + EXTEND_{OUTER_MODE} (SUBREG_{INNER_MODE} (REG + INNER_STEP))
-
- If the operation cannot be described in this shape, return false.
- LAST_DEF is the definition of REG that dominates loop latch. */
-
-static bool
-get_biv_step (df_ref last_def, scalar_int_mode outer_mode, rtx reg,
- rtx *inner_step, scalar_int_mode *inner_mode,
- enum iv_extend_code *extend, rtx *outer_step)
-{
- if (!get_biv_step_1 (last_def, outer_mode, reg,
- inner_step, inner_mode, extend,
- outer_step))
- return false;
-
- gcc_assert ((*inner_mode == outer_mode) != (*extend != IV_UNKNOWN_EXTEND));
- gcc_assert (*inner_mode != outer_mode || *outer_step == const0_rtx);
-
- return true;
-}
-
-/* Records information that DEF is induction variable IV. */
-
-static void
-record_iv (df_ref def, class rtx_iv *iv)
-{
- class rtx_iv *recorded_iv = XNEW (class rtx_iv);
-
- *recorded_iv = *iv;
- check_iv_ref_table_size ();
- DF_REF_IV_SET (def, recorded_iv);
-}
-
-/* If DEF was already analyzed for bivness, store the description of the biv to
- IV and return true. Otherwise return false. */
-
-static bool
-analyzed_for_bivness_p (rtx def, class rtx_iv *iv)
-{
- class biv_entry *biv = bivs->find_with_hash (def, REGNO (def));
-
- if (!biv)
- return false;
-
- *iv = biv->iv;
- return true;
-}
-
-static void
-record_biv (rtx def, class rtx_iv *iv)
-{
- class biv_entry *biv = XNEW (class biv_entry);
- biv_entry **slot = bivs->find_slot_with_hash (def, REGNO (def), INSERT);
-
- biv->regno = REGNO (def);
- biv->iv = *iv;
- gcc_assert (!*slot);
- *slot = biv;
-}
-
-/* Determines whether DEF is a biv and if so, stores its description
- to *IV. OUTER_MODE is the mode of DEF. */
-
-static bool
-iv_analyze_biv (scalar_int_mode outer_mode, rtx def, class rtx_iv *iv)
-{
- rtx inner_step, outer_step;
- scalar_int_mode inner_mode;
- enum iv_extend_code extend;
- df_ref last_def;
-
- if (dump_file)
- {
- fprintf (dump_file, "Analyzing ");
- print_rtl (dump_file, def);
- fprintf (dump_file, " for bivness.\n");
- }
-
- if (!REG_P (def))
- {
- if (!CONSTANT_P (def))
- return false;
-
- return iv_constant (iv, outer_mode, def);
- }
-
- if (!latch_dominating_def (def, &last_def))
- {
- if (dump_file)
- fprintf (dump_file, " not simple.\n");
- return false;
- }
-
- if (!last_def)
- return iv_constant (iv, outer_mode, def);
-
- if (analyzed_for_bivness_p (def, iv))
- {
- if (dump_file)
- fprintf (dump_file, " already analysed.\n");
- return iv->base != NULL_RTX;
- }
-
- if (!get_biv_step (last_def, outer_mode, def, &inner_step, &inner_mode,
- &extend, &outer_step))
- {
- iv->base = NULL_RTX;
- goto end;
- }
-
- /* Loop transforms base to es (base + inner_step) + outer_step,
- where es means extend of subreg between inner_mode and outer_mode.
- The corresponding induction variable is
-
- es ((base - outer_step) + i * (inner_step + outer_step)) + outer_step */
-
- iv->base = simplify_gen_binary (MINUS, outer_mode, def, outer_step);
- iv->step = simplify_gen_binary (PLUS, outer_mode, inner_step, outer_step);
- iv->mode = inner_mode;
- iv->extend_mode = outer_mode;
- iv->extend = extend;
- iv->mult = const1_rtx;
- iv->delta = outer_step;
- iv->first_special = inner_mode != outer_mode;
-
- end:
- if (dump_file)
- {
- fprintf (dump_file, " ");
- dump_iv_info (dump_file, iv);
- fprintf (dump_file, "\n");
- }
-
- record_biv (def, iv);
- return iv->base != NULL_RTX;
-}
-
-/* Analyzes expression RHS used at INSN and stores the result to *IV.
- The mode of the induction variable is MODE. */
-
-bool
-iv_analyze_expr (rtx_insn *insn, scalar_int_mode mode, rtx rhs,
- class rtx_iv *iv)
-{
- rtx mby = NULL_RTX;
- rtx op0 = NULL_RTX, op1 = NULL_RTX;
- class rtx_iv iv0, iv1;
- enum rtx_code code = GET_CODE (rhs);
- scalar_int_mode omode = mode;
-
- iv->base = NULL_RTX;
- iv->step = NULL_RTX;
-
- gcc_assert (GET_MODE (rhs) == mode || GET_MODE (rhs) == VOIDmode);
-
- if (CONSTANT_P (rhs)
- || REG_P (rhs)
- || code == SUBREG)
- return iv_analyze_op (insn, mode, rhs, iv);
-
- switch (code)
- {
- case REG:
- op0 = rhs;
- break;
-
- case SIGN_EXTEND:
- case ZERO_EXTEND:
- case NEG:
- op0 = XEXP (rhs, 0);
- /* We don't know how many bits there are in a sign-extended constant. */
- if (!is_a <scalar_int_mode> (GET_MODE (op0), &omode))
- return false;
- break;
-
- case PLUS:
- case MINUS:
- op0 = XEXP (rhs, 0);
- op1 = XEXP (rhs, 1);
- break;
-
- case MULT:
- op0 = XEXP (rhs, 0);
- mby = XEXP (rhs, 1);
- if (!CONSTANT_P (mby))
- std::swap (op0, mby);
- if (!CONSTANT_P (mby))
- return false;
- break;
-
- case ASHIFT:
- op0 = XEXP (rhs, 0);
- mby = XEXP (rhs, 1);
- if (!CONSTANT_P (mby))
- return false;
- break;
-
- default:
- return false;
- }
-
- if (op0
- && !iv_analyze_expr (insn, omode, op0, &iv0))
- return false;
-
- if (op1
- && !iv_analyze_expr (insn, omode, op1, &iv1))
- return false;
-
- switch (code)
- {
- case SIGN_EXTEND:
- if (!iv_extend (&iv0, IV_SIGN_EXTEND, mode))
- return false;
- break;
-
- case ZERO_EXTEND:
- if (!iv_extend (&iv0, IV_ZERO_EXTEND, mode))
- return false;
- break;
-
- case NEG:
- if (!iv_neg (&iv0))
- return false;
- break;
-
- case PLUS:
- case MINUS:
- if (!iv_add (&iv0, &iv1, code))
- return false;
- break;
-
- case MULT:
- if (!iv_mult (&iv0, mby))
- return false;
- break;
-
- case ASHIFT:
- if (!iv_shift (&iv0, mby))
- return false;
- break;
-
- default:
- break;
- }
-
- *iv = iv0;
- return iv->base != NULL_RTX;
-}
-
-/* Analyzes iv DEF and stores the result to *IV. */
-
-static bool
-iv_analyze_def (df_ref def, class rtx_iv *iv)
-{
- rtx_insn *insn = DF_REF_INSN (def);
- rtx reg = DF_REF_REG (def);
- rtx set, rhs;
-
- if (dump_file)
- {
- fprintf (dump_file, "Analyzing def of ");
- print_rtl (dump_file, reg);
- fprintf (dump_file, " in insn ");
- print_rtl_single (dump_file, insn);
- }
-
- check_iv_ref_table_size ();
- if (DF_REF_IV (def))
- {
- if (dump_file)
- fprintf (dump_file, " already analysed.\n");
- *iv = *DF_REF_IV (def);
- return iv->base != NULL_RTX;
- }
-
- iv->base = NULL_RTX;
- iv->step = NULL_RTX;
-
- scalar_int_mode mode;
- if (!REG_P (reg) || !is_a <scalar_int_mode> (GET_MODE (reg), &mode))
- return false;
-
- set = single_set (insn);
- if (!set)
- return false;
-
- if (!REG_P (SET_DEST (set)))
- return false;
-
- gcc_assert (SET_DEST (set) == reg);
- rhs = find_reg_equal_equiv_note (insn);
- if (rhs)
- rhs = XEXP (rhs, 0);
- else
- rhs = SET_SRC (set);
-
- iv_analyze_expr (insn, mode, rhs, iv);
- record_iv (def, iv);
-
- if (dump_file)
- {
- print_rtl (dump_file, reg);
- fprintf (dump_file, " in insn ");
- print_rtl_single (dump_file, insn);
- fprintf (dump_file, " is ");
- dump_iv_info (dump_file, iv);
- fprintf (dump_file, "\n");
- }
-
- return iv->base != NULL_RTX;
-}
-
-/* Analyzes operand OP of INSN and stores the result to *IV. MODE is the
- mode of OP. */
-
-static bool
-iv_analyze_op (rtx_insn *insn, scalar_int_mode mode, rtx op, class rtx_iv *iv)
-{
- df_ref def = NULL;
- enum iv_grd_result res;
-
- if (dump_file)
- {
- fprintf (dump_file, "Analyzing operand ");
- print_rtl (dump_file, op);
- fprintf (dump_file, " of insn ");
- print_rtl_single (dump_file, insn);
- }
-
- if (function_invariant_p (op))
- res = GRD_INVARIANT;
- else if (GET_CODE (op) == SUBREG)
- {
- scalar_int_mode inner_mode;
- if (!subreg_lowpart_p (op)
- || !is_a <scalar_int_mode> (GET_MODE (SUBREG_REG (op)), &inner_mode))
- return false;
-
- if (!iv_analyze_op (insn, inner_mode, SUBREG_REG (op), iv))
- return false;
-
- return iv_subreg (iv, mode);
- }
- else
- {
- res = iv_get_reaching_def (insn, op, &def);
- if (res == GRD_INVALID)
- {
- if (dump_file)
- fprintf (dump_file, " not simple.\n");
- return false;
- }
- }
-
- if (res == GRD_INVARIANT)
- {
- iv_constant (iv, mode, op);
-
- if (dump_file)
- {
- fprintf (dump_file, " ");
- dump_iv_info (dump_file, iv);
- fprintf (dump_file, "\n");
- }
- return true;
- }
-
- if (res == GRD_MAYBE_BIV)
- return iv_analyze_biv (mode, op, iv);
-
- return iv_analyze_def (def, iv);
-}
-
-/* Analyzes value VAL at INSN and stores the result to *IV. MODE is the
- mode of VAL. */
-
-bool
-iv_analyze (rtx_insn *insn, scalar_int_mode mode, rtx val, class rtx_iv *iv)
-{
- rtx reg;
-
- /* We must find the insn in that val is used, so that we get to UD chains.
- Since the function is sometimes called on result of get_condition,
- this does not necessarily have to be directly INSN; scan also the
- following insns. */
- if (simple_reg_p (val))
- {
- if (GET_CODE (val) == SUBREG)
- reg = SUBREG_REG (val);
- else
- reg = val;
-
- while (!df_find_use (insn, reg))
- insn = NEXT_INSN (insn);
- }
-
- return iv_analyze_op (insn, mode, val, iv);
-}
-
-/* Analyzes definition of DEF in INSN and stores the result to IV. */
-
-bool
-iv_analyze_result (rtx_insn *insn, rtx def, class rtx_iv *iv)
-{
- df_ref adef;
-
- adef = df_find_def (insn, def);
- if (!adef)
- return false;
-
- return iv_analyze_def (adef, iv);
-}
-
-/* Checks whether definition of register REG in INSN is a basic induction
- variable. MODE is the mode of REG.
-
- IV analysis must have been initialized (via a call to
- iv_analysis_loop_init) for this function to produce a result. */
-
-bool
-biv_p (rtx_insn *insn, scalar_int_mode mode, rtx reg)
-{
- class rtx_iv iv;
- df_ref def, last_def;
-
- if (!simple_reg_p (reg))
- return false;
-
- def = df_find_def (insn, reg);
- gcc_assert (def != NULL);
- if (!latch_dominating_def (reg, &last_def))
- return false;
- if (last_def != def)
- return false;
-
- if (!iv_analyze_biv (mode, reg, &iv))
- return false;
-
- return iv.step != const0_rtx;
-}
-
-/* Calculates value of IV at ITERATION-th iteration. */
-
-rtx
-get_iv_value (class rtx_iv *iv, rtx iteration)
-{
- rtx val;
-
- /* We would need to generate some if_then_else patterns, and so far
- it is not needed anywhere. */
- gcc_assert (!iv->first_special);
-
- if (iv->step != const0_rtx && iteration != const0_rtx)
- val = simplify_gen_binary (PLUS, iv->extend_mode, iv->base,
- simplify_gen_binary (MULT, iv->extend_mode,
- iv->step, iteration));
- else
- val = iv->base;
-
- if (iv->extend_mode == iv->mode)
- return val;
-
- val = lowpart_subreg (iv->mode, val, iv->extend_mode);
-
- if (iv->extend == IV_UNKNOWN_EXTEND)
- return val;
-
- val = simplify_gen_unary (iv_extend_to_rtx_code (iv->extend),
- iv->extend_mode, val, iv->mode);
- val = simplify_gen_binary (PLUS, iv->extend_mode, iv->delta,
- simplify_gen_binary (MULT, iv->extend_mode,
- iv->mult, val));
-
- return val;
-}
-
-/* Free the data for an induction variable analysis. */
-
-void
-iv_analysis_done (void)
-{
- if (!clean_slate)
- {
- clear_iv_info ();
- clean_slate = true;
- df_finish_pass (true);
- delete bivs;
- bivs = NULL;
- free (iv_ref_table);
- iv_ref_table = NULL;
- iv_ref_table_size = 0;
- }
-}
-
-/* Computes inverse to X modulo (1 << MOD). */
-
-static uint64_t
-inverse (uint64_t x, int mod)
-{
- uint64_t mask =
- ((uint64_t) 1 << (mod - 1) << 1) - 1;
- uint64_t rslt = 1;
- int i;
-
- for (i = 0; i < mod - 1; i++)
- {
- rslt = (rslt * x) & mask;
- x = (x * x) & mask;
- }
-
- return rslt;
-}
-
-/* Checks whether any register in X is in set ALT. */
-
-static bool
-altered_reg_used (const_rtx x, bitmap alt)
-{
- subrtx_iterator::array_type array;
- FOR_EACH_SUBRTX (iter, array, x, NONCONST)
- {
- const_rtx x = *iter;
- if (REG_P (x) && REGNO_REG_SET_P (alt, REGNO (x)))
- return true;
- }
- return false;
-}
-
-/* Marks registers altered by EXPR in set ALT. */
-
-static void
-mark_altered (rtx expr, const_rtx by ATTRIBUTE_UNUSED, void *alt)
-{
- if (GET_CODE (expr) == SUBREG)
- expr = SUBREG_REG (expr);
- if (!REG_P (expr))
- return;
-
- SET_REGNO_REG_SET ((bitmap) alt, REGNO (expr));
-}
-
-/* Checks whether RHS is simple enough to process. */
-
-static bool
-simple_rhs_p (rtx rhs)
-{
- rtx op0, op1;
-
- if (function_invariant_p (rhs)
- || (REG_P (rhs) && !HARD_REGISTER_P (rhs)))
- return true;
-
- switch (GET_CODE (rhs))
- {
- case PLUS:
- case MINUS:
- case AND:
- op0 = XEXP (rhs, 0);
- op1 = XEXP (rhs, 1);
- /* Allow reg OP const and reg OP reg. */
- if (!(REG_P (op0) && !HARD_REGISTER_P (op0))
- && !function_invariant_p (op0))
- return false;
- if (!(REG_P (op1) && !HARD_REGISTER_P (op1))
- && !function_invariant_p (op1))
- return false;
-
- return true;
-
- case ASHIFT:
- case ASHIFTRT:
- case LSHIFTRT:
- case MULT:
- op0 = XEXP (rhs, 0);
- op1 = XEXP (rhs, 1);
- /* Allow reg OP const. */
- if (!(REG_P (op0) && !HARD_REGISTER_P (op0)))
- return false;
- if (!function_invariant_p (op1))
- return false;
-
- return true;
-
- default:
- return false;
- }
-}
-
-/* If REGNO has a single definition, return its known value, otherwise return
- null. */
-
-static rtx
-find_single_def_src (unsigned int regno)
-{
- rtx src = NULL_RTX;
-
- /* Don't look through unbounded number of single definition REG copies,
- there might be loops for sources with uninitialized variables. */
- for (int cnt = 0; cnt < 128; cnt++)
- {
- df_ref adef = DF_REG_DEF_CHAIN (regno);
- if (adef == NULL || DF_REF_NEXT_REG (adef) != NULL
- || DF_REF_IS_ARTIFICIAL (adef))
- return NULL_RTX;
-
- rtx set = single_set (DF_REF_INSN (adef));
- if (set == NULL || !REG_P (SET_DEST (set))
- || REGNO (SET_DEST (set)) != regno)
- return NULL_RTX;
-
- rtx note = find_reg_equal_equiv_note (DF_REF_INSN (adef));
- if (note && function_invariant_p (XEXP (note, 0)))
- {
- src = XEXP (note, 0);
- break;
- }
- src = SET_SRC (set);
-
- if (REG_P (src))
- {
- regno = REGNO (src);
- continue;
- }
- break;
- }
- if (!function_invariant_p (src))
- return NULL_RTX;
-
- return src;
-}
-
-/* If any registers in *EXPR that have a single definition, try to replace
- them with the known-equivalent values. */
-
-static void
-replace_single_def_regs (rtx *expr)
-{
- subrtx_var_iterator::array_type array;
- repeat:
- FOR_EACH_SUBRTX_VAR (iter, array, *expr, NONCONST)
- {
- rtx x = *iter;
- if (REG_P (x))
- if (rtx new_x = find_single_def_src (REGNO (x)))
- {
- *expr = simplify_replace_rtx (*expr, x, new_x);
- goto repeat;
- }
- }
-}
-
-/* A subroutine of simplify_using_initial_values, this function examines INSN
- to see if it contains a suitable set that we can use to make a replacement.
- If it is suitable, return true and set DEST and SRC to the lhs and rhs of
- the set; return false otherwise. */
-
-static bool
-suitable_set_for_replacement (rtx_insn *insn, rtx *dest, rtx *src)
-{
- rtx set = single_set (insn);
- rtx lhs = NULL_RTX, rhs;
-
- if (!set)
- return false;
-
- lhs = SET_DEST (set);
- if (!REG_P (lhs))
- return false;
-
- rhs = find_reg_equal_equiv_note (insn);
- if (rhs)
- rhs = XEXP (rhs, 0);
- else
- rhs = SET_SRC (set);
-
- if (!simple_rhs_p (rhs))
- return false;
-
- *dest = lhs;
- *src = rhs;
- return true;
-}
-
-/* Using the data returned by suitable_set_for_replacement, replace DEST
- with SRC in *EXPR and return the new expression. Also call
- replace_single_def_regs if the replacement changed something. */
-static void
-replace_in_expr (rtx *expr, rtx dest, rtx src)
-{
- rtx old = *expr;
- *expr = simplify_replace_rtx (*expr, dest, src);
- if (old == *expr)
- return;
- replace_single_def_regs (expr);
-}
-
-/* Checks whether A implies B. */
-
-static bool
-implies_p (rtx a, rtx b)
-{
- rtx op0, op1, opb0, opb1;
- machine_mode mode;
-
- if (rtx_equal_p (a, b))
- return true;
-
- if (GET_CODE (a) == EQ)
- {
- op0 = XEXP (a, 0);
- op1 = XEXP (a, 1);
-
- if (REG_P (op0)
- || (GET_CODE (op0) == SUBREG
- && REG_P (SUBREG_REG (op0))))
- {
- rtx r = simplify_replace_rtx (b, op0, op1);
- if (r == const_true_rtx)
- return true;
- }
-
- if (REG_P (op1)
- || (GET_CODE (op1) == SUBREG
- && REG_P (SUBREG_REG (op1))))
- {
- rtx r = simplify_replace_rtx (b, op1, op0);
- if (r == const_true_rtx)
- return true;
- }
- }
-
- if (b == const_true_rtx)
- return true;
-
- if ((GET_RTX_CLASS (GET_CODE (a)) != RTX_COMM_COMPARE
- && GET_RTX_CLASS (GET_CODE (a)) != RTX_COMPARE)
- || (GET_RTX_CLASS (GET_CODE (b)) != RTX_COMM_COMPARE
- && GET_RTX_CLASS (GET_CODE (b)) != RTX_COMPARE))
- return false;
-
- op0 = XEXP (a, 0);
- op1 = XEXP (a, 1);
- opb0 = XEXP (b, 0);
- opb1 = XEXP (b, 1);
-
- mode = GET_MODE (op0);
- if (mode != GET_MODE (opb0))
- mode = VOIDmode;
- else if (mode == VOIDmode)
- {
- mode = GET_MODE (op1);
- if (mode != GET_MODE (opb1))
- mode = VOIDmode;
- }
-
- /* A < B implies A + 1 <= B. */
- if ((GET_CODE (a) == GT || GET_CODE (a) == LT)
- && (GET_CODE (b) == GE || GET_CODE (b) == LE))
- {
-
- if (GET_CODE (a) == GT)
- std::swap (op0, op1);
-
- if (GET_CODE (b) == GE)
- std::swap (opb0, opb1);
-
- if (SCALAR_INT_MODE_P (mode)
- && rtx_equal_p (op1, opb1)
- && simplify_gen_binary (MINUS, mode, opb0, op0) == const1_rtx)
- return true;
- return false;
- }
-
- /* A < B or A > B imply A != B. TODO: Likewise
- A + n < B implies A != B + n if neither wraps. */
- if (GET_CODE (b) == NE
- && (GET_CODE (a) == GT || GET_CODE (a) == GTU
- || GET_CODE (a) == LT || GET_CODE (a) == LTU))
- {
- if (rtx_equal_p (op0, opb0)
- && rtx_equal_p (op1, opb1))
- return true;
- }
-
- /* For unsigned comparisons, A != 0 implies A > 0 and A >= 1. */
- if (GET_CODE (a) == NE
- && op1 == const0_rtx)
- {
- if ((GET_CODE (b) == GTU
- && opb1 == const0_rtx)
- || (GET_CODE (b) == GEU
- && opb1 == const1_rtx))
- return rtx_equal_p (op0, opb0);
- }
-
- /* A != N is equivalent to A - (N + 1) <u -1. */
- if (GET_CODE (a) == NE
- && CONST_INT_P (op1)
- && GET_CODE (b) == LTU
- && opb1 == constm1_rtx
- && GET_CODE (opb0) == PLUS
- && CONST_INT_P (XEXP (opb0, 1))
- /* Avoid overflows. */
- && ((unsigned HOST_WIDE_INT) INTVAL (XEXP (opb0, 1))
- != ((unsigned HOST_WIDE_INT)1
- << (HOST_BITS_PER_WIDE_INT - 1)) - 1)
- && INTVAL (XEXP (opb0, 1)) + 1 == -INTVAL (op1))
- return rtx_equal_p (op0, XEXP (opb0, 0));
-
- /* Likewise, A != N implies A - N > 0. */
- if (GET_CODE (a) == NE
- && CONST_INT_P (op1))
- {
- if (GET_CODE (b) == GTU
- && GET_CODE (opb0) == PLUS
- && opb1 == const0_rtx
- && CONST_INT_P (XEXP (opb0, 1))
- /* Avoid overflows. */
- && ((unsigned HOST_WIDE_INT) INTVAL (XEXP (opb0, 1))
- != (HOST_WIDE_INT_1U << (HOST_BITS_PER_WIDE_INT - 1)))
- && rtx_equal_p (XEXP (opb0, 0), op0))
- return INTVAL (op1) == -INTVAL (XEXP (opb0, 1));
- if (GET_CODE (b) == GEU
- && GET_CODE (opb0) == PLUS
- && opb1 == const1_rtx
- && CONST_INT_P (XEXP (opb0, 1))
- /* Avoid overflows. */
- && ((unsigned HOST_WIDE_INT) INTVAL (XEXP (opb0, 1))
- != (HOST_WIDE_INT_1U << (HOST_BITS_PER_WIDE_INT - 1)))
- && rtx_equal_p (XEXP (opb0, 0), op0))
- return INTVAL (op1) == -INTVAL (XEXP (opb0, 1));
- }
-
- /* A >s X, where X is positive, implies A <u Y, if Y is negative. */
- if ((GET_CODE (a) == GT || GET_CODE (a) == GE)
- && CONST_INT_P (op1)
- && ((GET_CODE (a) == GT && op1 == constm1_rtx)
- || INTVAL (op1) >= 0)
- && GET_CODE (b) == LTU
- && CONST_INT_P (opb1)
- && rtx_equal_p (op0, opb0))
- return INTVAL (opb1) < 0;
-
- return false;
-}
-
-/* Canonicalizes COND so that
-
- (1) Ensure that operands are ordered according to
- swap_commutative_operands_p.
- (2) (LE x const) will be replaced with (LT x <const+1>) and similarly
- for GE, GEU, and LEU. */
-
-rtx
-canon_condition (rtx cond)
-{
- rtx op0, op1;
- enum rtx_code code;
- machine_mode mode;
-
- code = GET_CODE (cond);
- op0 = XEXP (cond, 0);
- op1 = XEXP (cond, 1);
-
- if (swap_commutative_operands_p (op0, op1))
- {
- code = swap_condition (code);
- std::swap (op0, op1);
- }
-
- mode = GET_MODE (op0);
- if (mode == VOIDmode)
- mode = GET_MODE (op1);
- gcc_assert (mode != VOIDmode);
-
- if (CONST_SCALAR_INT_P (op1) && GET_MODE_CLASS (mode) != MODE_CC)
- {
- rtx_mode_t const_val (op1, mode);
-
- switch (code)
- {
- case LE:
- if (wi::ne_p (const_val, wi::max_value (mode, SIGNED)))
- {
- code = LT;
- op1 = immed_wide_int_const (wi::add (const_val, 1), mode);
- }
- break;
-
- case GE:
- if (wi::ne_p (const_val, wi::min_value (mode, SIGNED)))
- {
- code = GT;
- op1 = immed_wide_int_const (wi::sub (const_val, 1), mode);
- }
- break;
-
- case LEU:
- if (wi::ne_p (const_val, -1))
- {
- code = LTU;
- op1 = immed_wide_int_const (wi::add (const_val, 1), mode);
- }
- break;
-
- case GEU:
- if (wi::ne_p (const_val, 0))
- {
- code = GTU;
- op1 = immed_wide_int_const (wi::sub (const_val, 1), mode);
- }
- break;
-
- default:
- break;
- }
- }
-
- if (op0 != XEXP (cond, 0)
- || op1 != XEXP (cond, 1)
- || code != GET_CODE (cond)
- || GET_MODE (cond) != SImode)
- cond = gen_rtx_fmt_ee (code, SImode, op0, op1);
-
- return cond;
-}
-
-/* Reverses CONDition; returns NULL if we cannot. */
-
-static rtx
-reversed_condition (rtx cond)
-{
- enum rtx_code reversed;
- reversed = reversed_comparison_code (cond, NULL);
- if (reversed == UNKNOWN)
- return NULL_RTX;
- else
- return gen_rtx_fmt_ee (reversed,
- GET_MODE (cond), XEXP (cond, 0),
- XEXP (cond, 1));
-}
-
-/* Tries to use the fact that COND holds to simplify EXPR. ALTERED is the
- set of altered regs. */
-
-void
-simplify_using_condition (rtx cond, rtx *expr, regset altered)
-{
- rtx rev, reve, exp = *expr;
-
- /* If some register gets altered later, we do not really speak about its
- value at the time of comparison. */
- if (altered && altered_reg_used (cond, altered))
- return;
-
- if (GET_CODE (cond) == EQ
- && REG_P (XEXP (cond, 0)) && CONSTANT_P (XEXP (cond, 1)))
- {
- *expr = simplify_replace_rtx (*expr, XEXP (cond, 0), XEXP (cond, 1));
- return;
- }
-
- if (!COMPARISON_P (exp))
- return;
-
- rev = reversed_condition (cond);
- reve = reversed_condition (exp);
-
- cond = canon_condition (cond);
- exp = canon_condition (exp);
- if (rev)
- rev = canon_condition (rev);
- if (reve)
- reve = canon_condition (reve);
-
- if (rtx_equal_p (exp, cond))
- {
- *expr = const_true_rtx;
- return;
- }
-
- if (rev && rtx_equal_p (exp, rev))
- {
- *expr = const0_rtx;
- return;
- }
-
- if (implies_p (cond, exp))
- {
- *expr = const_true_rtx;
- return;
- }
-
- if (reve && implies_p (cond, reve))
- {
- *expr = const0_rtx;
- return;
- }
-
- /* A proof by contradiction. If *EXPR implies (not cond), *EXPR must
- be false. */
- if (rev && implies_p (exp, rev))
- {
- *expr = const0_rtx;
- return;
- }
-
- /* Similarly, If (not *EXPR) implies (not cond), *EXPR must be true. */
- if (rev && reve && implies_p (reve, rev))
- {
- *expr = const_true_rtx;
- return;
- }
-
- /* We would like to have some other tests here. TODO. */
-
- return;
-}
-
-/* Use relationship between A and *B to eventually eliminate *B.
- OP is the operation we consider. */
-
-static void
-eliminate_implied_condition (enum rtx_code op, rtx a, rtx *b)
-{
- switch (op)
- {
- case AND:
- /* If A implies *B, we may replace *B by true. */
- if (implies_p (a, *b))
- *b = const_true_rtx;
- break;
-
- case IOR:
- /* If *B implies A, we may replace *B by false. */
- if (implies_p (*b, a))
- *b = const0_rtx;
- break;
-
- default:
- gcc_unreachable ();
- }
-}
-
-/* Eliminates the conditions in TAIL that are implied by HEAD. OP is the
- operation we consider. */
-
-static void
-eliminate_implied_conditions (enum rtx_code op, rtx *head, rtx tail)
-{
- rtx elt;
-
- for (elt = tail; elt; elt = XEXP (elt, 1))
- eliminate_implied_condition (op, *head, &XEXP (elt, 0));
- for (elt = tail; elt; elt = XEXP (elt, 1))
- eliminate_implied_condition (op, XEXP (elt, 0), head);
-}
-
-/* Simplifies *EXPR using initial values at the start of the LOOP. If *EXPR
- is a list, its elements are assumed to be combined using OP. */
-
-static void
-simplify_using_initial_values (class loop *loop, enum rtx_code op, rtx *expr)
-{
- bool expression_valid;
- rtx head, tail, last_valid_expr;
- rtx_expr_list *cond_list;
- rtx_insn *insn;
- rtx neutral, aggr;
- regset altered, this_altered;
- edge e;
-
- if (!*expr)
- return;
-
- if (CONSTANT_P (*expr))
- return;
-
- if (GET_CODE (*expr) == EXPR_LIST)
- {
- head = XEXP (*expr, 0);
- tail = XEXP (*expr, 1);
-
- eliminate_implied_conditions (op, &head, tail);
-
- switch (op)
- {
- case AND:
- neutral = const_true_rtx;
- aggr = const0_rtx;
- break;
-
- case IOR:
- neutral = const0_rtx;
- aggr = const_true_rtx;
- break;
-
- default:
- gcc_unreachable ();
- }
-
- simplify_using_initial_values (loop, UNKNOWN, &head);
- if (head == aggr)
- {
- XEXP (*expr, 0) = aggr;
- XEXP (*expr, 1) = NULL_RTX;
- return;
- }
- else if (head == neutral)
- {
- *expr = tail;
- simplify_using_initial_values (loop, op, expr);
- return;
- }
- simplify_using_initial_values (loop, op, &tail);
-
- if (tail && XEXP (tail, 0) == aggr)
- {
- *expr = tail;
- return;
- }
-
- XEXP (*expr, 0) = head;
- XEXP (*expr, 1) = tail;
- return;
- }
-
- gcc_assert (op == UNKNOWN);
-
- replace_single_def_regs (expr);
- if (CONSTANT_P (*expr))
- return;
-
- e = loop_preheader_edge (loop);
- if (e->src == ENTRY_BLOCK_PTR_FOR_FN (cfun))
- return;
-
- altered = ALLOC_REG_SET (&reg_obstack);
- this_altered = ALLOC_REG_SET (&reg_obstack);
-
- expression_valid = true;
- last_valid_expr = *expr;
- cond_list = NULL;
- while (1)
- {
- insn = BB_END (e->src);
- if (any_condjump_p (insn) && onlyjump_p (insn))
- {
- rtx cond = get_condition (BB_END (e->src), NULL, false, true);
-
- if (cond && (e->flags & EDGE_FALLTHRU))
- cond = reversed_condition (cond);
- if (cond)
- {
- rtx old = *expr;
- simplify_using_condition (cond, expr, altered);
- if (old != *expr)
- {
- rtx note;
- if (CONSTANT_P (*expr))
- goto out;
- for (note = cond_list; note; note = XEXP (note, 1))
- {
- simplify_using_condition (XEXP (note, 0), expr, altered);
- if (CONSTANT_P (*expr))
- goto out;
- }
- }
- cond_list = alloc_EXPR_LIST (0, cond, cond_list);
- }
- }
-
- FOR_BB_INSNS_REVERSE (e->src, insn)
- {
- rtx src, dest;
- rtx old = *expr;
-
- if (!INSN_P (insn))
- continue;
-
- CLEAR_REG_SET (this_altered);
- note_stores (insn, mark_altered, this_altered);
- if (CALL_P (insn))
- {
- /* Kill all registers that might be clobbered by the call.
- We don't track modes of hard registers, so we need to be
- conservative and assume that partial kills are full kills. */
- function_abi callee_abi = insn_callee_abi (insn);
- IOR_REG_SET_HRS (this_altered,
- callee_abi.full_and_partial_reg_clobbers ());
- }
-
- if (suitable_set_for_replacement (insn, &dest, &src))
- {
- rtx_expr_list **pnote, **pnote_next;
-
- replace_in_expr (expr, dest, src);
- if (CONSTANT_P (*expr))
- goto out;
-
- for (pnote = &cond_list; *pnote; pnote = pnote_next)
- {
- rtx_expr_list *note = *pnote;
- rtx old_cond = XEXP (note, 0);
-
- pnote_next = (rtx_expr_list **)&XEXP (note, 1);
- replace_in_expr (&XEXP (note, 0), dest, src);
-
- /* We can no longer use a condition that has been simplified
- to a constant, and simplify_using_condition will abort if
- we try. */
- if (CONSTANT_P (XEXP (note, 0)))
- {
- *pnote = *pnote_next;
- pnote_next = pnote;
- free_EXPR_LIST_node (note);
- }
- /* Retry simplifications with this condition if either the
- expression or the condition changed. */
- else if (old_cond != XEXP (note, 0) || old != *expr)
- simplify_using_condition (XEXP (note, 0), expr, altered);
- }
- }
- else
- {
- rtx_expr_list **pnote, **pnote_next;
-
- /* If we did not use this insn to make a replacement, any overlap
- between stores in this insn and our expression will cause the
- expression to become invalid. */
- if (altered_reg_used (*expr, this_altered))
- goto out;
-
- /* Likewise for the conditions. */
- for (pnote = &cond_list; *pnote; pnote = pnote_next)
- {
- rtx_expr_list *note = *pnote;
- rtx old_cond = XEXP (note, 0);
-
- pnote_next = (rtx_expr_list **)&XEXP (note, 1);
- if (altered_reg_used (old_cond, this_altered))
- {
- *pnote = *pnote_next;
- pnote_next = pnote;
- free_EXPR_LIST_node (note);
- }
- }
- }
-
- if (CONSTANT_P (*expr))
- goto out;
-
- IOR_REG_SET (altered, this_altered);
-
- /* If the expression now contains regs that have been altered, we
- can't return it to the caller. However, it is still valid for
- further simplification, so keep searching to see if we can
- eventually turn it into a constant. */
- if (altered_reg_used (*expr, altered))
- expression_valid = false;
- if (expression_valid)
- last_valid_expr = *expr;
- }
-
- if (!single_pred_p (e->src)
- || single_pred (e->src) == ENTRY_BLOCK_PTR_FOR_FN (cfun))
- break;
- e = single_pred_edge (e->src);
- }
-
- out:
- free_EXPR_LIST_list (&cond_list);
- if (!CONSTANT_P (*expr))
- *expr = last_valid_expr;
- FREE_REG_SET (altered);
- FREE_REG_SET (this_altered);
-}
-
-/* Transforms invariant IV into MODE. Adds assumptions based on the fact
- that IV occurs as left operands of comparison COND and its signedness
- is SIGNED_P to DESC. */
-
-static void
-shorten_into_mode (class rtx_iv *iv, scalar_int_mode mode,
- enum rtx_code cond, bool signed_p, class niter_desc *desc)
-{
- rtx mmin, mmax, cond_over, cond_under;
-
- get_mode_bounds (mode, signed_p, iv->extend_mode, &mmin, &mmax);
- cond_under = simplify_gen_relational (LT, SImode, iv->extend_mode,
- iv->base, mmin);
- cond_over = simplify_gen_relational (GT, SImode, iv->extend_mode,
- iv->base, mmax);
-
- switch (cond)
- {
- case LE:
- case LT:
- case LEU:
- case LTU:
- if (cond_under != const0_rtx)
- desc->infinite =
- alloc_EXPR_LIST (0, cond_under, desc->infinite);
- if (cond_over != const0_rtx)
- desc->noloop_assumptions =
- alloc_EXPR_LIST (0, cond_over, desc->noloop_assumptions);
- break;
-
- case GE:
- case GT:
- case GEU:
- case GTU:
- if (cond_over != const0_rtx)
- desc->infinite =
- alloc_EXPR_LIST (0, cond_over, desc->infinite);
- if (cond_under != const0_rtx)
- desc->noloop_assumptions =
- alloc_EXPR_LIST (0, cond_under, desc->noloop_assumptions);
- break;
-
- case NE:
- if (cond_over != const0_rtx)
- desc->infinite =
- alloc_EXPR_LIST (0, cond_over, desc->infinite);
- if (cond_under != const0_rtx)
- desc->infinite =
- alloc_EXPR_LIST (0, cond_under, desc->infinite);
- break;
-
- default:
- gcc_unreachable ();
- }
-
- iv->mode = mode;
- iv->extend = signed_p ? IV_SIGN_EXTEND : IV_ZERO_EXTEND;
-}
-
-/* Transforms IV0 and IV1 compared by COND so that they are both compared as
- subregs of the same mode if possible (sometimes it is necessary to add
- some assumptions to DESC). */
-
-static bool
-canonicalize_iv_subregs (class rtx_iv *iv0, class rtx_iv *iv1,
- enum rtx_code cond, class niter_desc *desc)
-{
- scalar_int_mode comp_mode;
- bool signed_p;
-
- /* If the ivs behave specially in the first iteration, or are
- added/multiplied after extending, we ignore them. */
- if (iv0->first_special || iv0->mult != const1_rtx || iv0->delta != const0_rtx)
- return false;
- if (iv1->first_special || iv1->mult != const1_rtx || iv1->delta != const0_rtx)
- return false;
-
- /* If there is some extend, it must match signedness of the comparison. */
- switch (cond)
- {
- case LE:
- case LT:
- if (iv0->extend == IV_ZERO_EXTEND
- || iv1->extend == IV_ZERO_EXTEND)
- return false;
- signed_p = true;
- break;
-
- case LEU:
- case LTU:
- if (iv0->extend == IV_SIGN_EXTEND
- || iv1->extend == IV_SIGN_EXTEND)
- return false;
- signed_p = false;
- break;
-
- case NE:
- if (iv0->extend != IV_UNKNOWN_EXTEND
- && iv1->extend != IV_UNKNOWN_EXTEND
- && iv0->extend != iv1->extend)
- return false;
-
- signed_p = false;
- if (iv0->extend != IV_UNKNOWN_EXTEND)
- signed_p = iv0->extend == IV_SIGN_EXTEND;
- if (iv1->extend != IV_UNKNOWN_EXTEND)
- signed_p = iv1->extend == IV_SIGN_EXTEND;
- break;
-
- default:
- gcc_unreachable ();
- }
-
- /* Values of both variables should be computed in the same mode. These
- might indeed be different, if we have comparison like
-
- (compare (subreg:SI (iv0)) (subreg:SI (iv1)))
-
- and iv0 and iv1 are both ivs iterating in SI mode, but calculated
- in different modes. This does not seem impossible to handle, but
- it hardly ever occurs in practice.
-
- The only exception is the case when one of operands is invariant.
- For example pentium 3 generates comparisons like
- (lt (subreg:HI (reg:SI)) 100). Here we assign HImode to 100, but we
- definitely do not want this prevent the optimization. */
- comp_mode = iv0->extend_mode;
- if (GET_MODE_BITSIZE (comp_mode) < GET_MODE_BITSIZE (iv1->extend_mode))
- comp_mode = iv1->extend_mode;
-
- if (iv0->extend_mode != comp_mode)
- {
- if (iv0->mode != iv0->extend_mode
- || iv0->step != const0_rtx)
- return false;
-
- iv0->base = simplify_gen_unary (signed_p ? SIGN_EXTEND : ZERO_EXTEND,
- comp_mode, iv0->base, iv0->mode);
- iv0->extend_mode = comp_mode;
- }
-
- if (iv1->extend_mode != comp_mode)
- {
- if (iv1->mode != iv1->extend_mode
- || iv1->step != const0_rtx)
- return false;
-
- iv1->base = simplify_gen_unary (signed_p ? SIGN_EXTEND : ZERO_EXTEND,
- comp_mode, iv1->base, iv1->mode);
- iv1->extend_mode = comp_mode;
- }
-
- /* Check that both ivs belong to a range of a single mode. If one of the
- operands is an invariant, we may need to shorten it into the common
- mode. */
- if (iv0->mode == iv0->extend_mode
- && iv0->step == const0_rtx
- && iv0->mode != iv1->mode)
- shorten_into_mode (iv0, iv1->mode, cond, signed_p, desc);
-
- if (iv1->mode == iv1->extend_mode
- && iv1->step == const0_rtx
- && iv0->mode != iv1->mode)
- shorten_into_mode (iv1, iv0->mode, swap_condition (cond), signed_p, desc);
-
- if (iv0->mode != iv1->mode)
- return false;
-
- desc->mode = iv0->mode;
- desc->signed_p = signed_p;
-
- return true;
-}
-
-/* Tries to estimate the maximum number of iterations in LOOP, and return the
- result. This function is called from iv_number_of_iterations with
- a number of fields in DESC already filled in. OLD_NITER is the original
- expression for the number of iterations, before we tried to simplify it. */
-
-static uint64_t
-determine_max_iter (class loop *loop, class niter_desc *desc, rtx old_niter)
-{
- rtx niter = desc->niter_expr;
- rtx mmin, mmax, cmp;
- uint64_t nmax, inc;
- uint64_t andmax = 0;
-
- /* We used to look for constant operand 0 of AND,
- but canonicalization should always make this impossible. */
- gcc_checking_assert (GET_CODE (niter) != AND
- || !CONST_INT_P (XEXP (niter, 0)));
-
- if (GET_CODE (niter) == AND
- && CONST_INT_P (XEXP (niter, 1)))
- {
- andmax = UINTVAL (XEXP (niter, 1));
- niter = XEXP (niter, 0);
- }
-
- get_mode_bounds (desc->mode, desc->signed_p, desc->mode, &mmin, &mmax);
- nmax = UINTVAL (mmax) - UINTVAL (mmin);
-
- if (GET_CODE (niter) == UDIV)
- {
- if (!CONST_INT_P (XEXP (niter, 1)))
- return nmax;
- inc = INTVAL (XEXP (niter, 1));
- niter = XEXP (niter, 0);
- }
- else
- inc = 1;
-
- /* We could use a binary search here, but for now improving the upper
- bound by just one eliminates one important corner case. */
- cmp = simplify_gen_relational (desc->signed_p ? LT : LTU, VOIDmode,
- desc->mode, old_niter, mmax);
- simplify_using_initial_values (loop, UNKNOWN, &cmp);
- if (cmp == const_true_rtx)
- {
- nmax--;
-
- if (dump_file)
- fprintf (dump_file, ";; improved upper bound by one.\n");
- }
- nmax /= inc;
- if (andmax)
- nmax = MIN (nmax, andmax);
- if (dump_file)
- fprintf (dump_file, ";; Determined upper bound %" PRId64".\n",
- nmax);
- return nmax;
-}
-
-/* Computes number of iterations of the CONDITION in INSN in LOOP and stores
- the result into DESC. Very similar to determine_number_of_iterations
- (basically its rtl version), complicated by things like subregs. */
-
-static void
-iv_number_of_iterations (class loop *loop, rtx_insn *insn, rtx condition,
- class niter_desc *desc)
-{
- rtx op0, op1, delta, step, bound, may_xform, tmp, tmp0, tmp1;
- class rtx_iv iv0, iv1;
- rtx assumption, may_not_xform;
- enum rtx_code cond;
- machine_mode nonvoid_mode;
- scalar_int_mode comp_mode;
- rtx mmin, mmax, mode_mmin, mode_mmax;
- uint64_t s, size, d, inv, max, up, down;
- int64_t inc, step_val;
- int was_sharp = false;
- rtx old_niter;
- bool step_is_pow2;
-
- /* The meaning of these assumptions is this:
- if !assumptions
- then the rest of information does not have to be valid
- if noloop_assumptions then the loop does not roll
- if infinite then this exit is never used */
-
- desc->assumptions = NULL_RTX;
- desc->noloop_assumptions = NULL_RTX;
- desc->infinite = NULL_RTX;
- desc->simple_p = true;
-
- desc->const_iter = false;
- desc->niter_expr = NULL_RTX;
-
- cond = GET_CODE (condition);
- gcc_assert (COMPARISON_P (condition));
-
- nonvoid_mode = GET_MODE (XEXP (condition, 0));
- if (nonvoid_mode == VOIDmode)
- nonvoid_mode = GET_MODE (XEXP (condition, 1));
- /* The constant comparisons should be folded. */
- gcc_assert (nonvoid_mode != VOIDmode);
-
- /* We only handle integers or pointers. */
- scalar_int_mode mode;
- if (!is_a <scalar_int_mode> (nonvoid_mode, &mode))
- goto fail;
-
- op0 = XEXP (condition, 0);
- if (!iv_analyze (insn, mode, op0, &iv0))
- goto fail;
-
- op1 = XEXP (condition, 1);
- if (!iv_analyze (insn, mode, op1, &iv1))
- goto fail;
-
- if (GET_MODE_BITSIZE (iv0.extend_mode) > HOST_BITS_PER_WIDE_INT
- || GET_MODE_BITSIZE (iv1.extend_mode) > HOST_BITS_PER_WIDE_INT)
- goto fail;
-
- /* Check condition and normalize it. */
-
- switch (cond)
- {
- case GE:
- case GT:
- case GEU:
- case GTU:
- std::swap (iv0, iv1);
- cond = swap_condition (cond);
- break;
- case NE:
- case LE:
- case LEU:
- case LT:
- case LTU:
- break;
- default:
- goto fail;
- }
-
- /* Handle extends. This is relatively nontrivial, so we only try in some
- easy cases, when we can canonicalize the ivs (possibly by adding some
- assumptions) to shape subreg (base + i * step). This function also fills
- in desc->mode and desc->signed_p. */
-
- if (!canonicalize_iv_subregs (&iv0, &iv1, cond, desc))
- goto fail;
-
- comp_mode = iv0.extend_mode;
- mode = iv0.mode;
- size = GET_MODE_PRECISION (mode);
- get_mode_bounds (mode, (cond == LE || cond == LT), comp_mode, &mmin, &mmax);
- mode_mmin = lowpart_subreg (mode, mmin, comp_mode);
- mode_mmax = lowpart_subreg (mode, mmax, comp_mode);
-
- if (!CONST_INT_P (iv0.step) || !CONST_INT_P (iv1.step))
- goto fail;
-
- /* We can take care of the case of two induction variables chasing each other
- if the test is NE. I have never seen a loop using it, but still it is
- cool. */
- if (iv0.step != const0_rtx && iv1.step != const0_rtx)
- {
- if (cond != NE)
- goto fail;
-
- iv0.step = simplify_gen_binary (MINUS, comp_mode, iv0.step, iv1.step);
- iv1.step = const0_rtx;
- }
-
- iv0.step = lowpart_subreg (mode, iv0.step, comp_mode);
- iv1.step = lowpart_subreg (mode, iv1.step, comp_mode);
-
- /* This is either infinite loop or the one that ends immediately, depending
- on initial values. Unswitching should remove this kind of conditions. */
- if (iv0.step == const0_rtx && iv1.step == const0_rtx)
- goto fail;
-
- if (cond != NE)
- {
- if (iv0.step == const0_rtx)
- step_val = -INTVAL (iv1.step);
- else
- step_val = INTVAL (iv0.step);
-
- /* Ignore loops of while (i-- < 10) type. */
- if (step_val < 0)
- goto fail;
-
- step_is_pow2 = !(step_val & (step_val - 1));
- }
- else
- {
- /* We do not care about whether the step is power of two in this
- case. */
- step_is_pow2 = false;
- step_val = 0;
- }
-
- /* Some more condition normalization. We must record some assumptions
- due to overflows. */
- switch (cond)
- {
- case LT:
- case LTU:
- /* We want to take care only of non-sharp relationals; this is easy,
- as in cases the overflow would make the transformation unsafe
- the loop does not roll. Seemingly it would make more sense to want
- to take care of sharp relationals instead, as NE is more similar to
- them, but the problem is that here the transformation would be more
- difficult due to possibly infinite loops. */
- if (iv0.step == const0_rtx)
- {
- tmp = lowpart_subreg (mode, iv0.base, comp_mode);
- assumption = simplify_gen_relational (EQ, SImode, mode, tmp,
- mode_mmax);
- if (assumption == const_true_rtx)
- goto zero_iter_simplify;
- iv0.base = simplify_gen_binary (PLUS, comp_mode,
- iv0.base, const1_rtx);
- }
- else
- {
- tmp = lowpart_subreg (mode, iv1.base, comp_mode);
- assumption = simplify_gen_relational (EQ, SImode, mode, tmp,
- mode_mmin);
- if (assumption == const_true_rtx)
- goto zero_iter_simplify;
- iv1.base = simplify_gen_binary (PLUS, comp_mode,
- iv1.base, constm1_rtx);
- }
-
- if (assumption != const0_rtx)
- desc->noloop_assumptions =
- alloc_EXPR_LIST (0, assumption, desc->noloop_assumptions);
- cond = (cond == LT) ? LE : LEU;
-
- /* It will be useful to be able to tell the difference once more in
- LE -> NE reduction. */
- was_sharp = true;
- break;
- default: ;
- }
-
- /* Take care of trivially infinite loops. */
- if (cond != NE)
- {
- if (iv0.step == const0_rtx)
- {
- tmp = lowpart_subreg (mode, iv0.base, comp_mode);
- if (rtx_equal_p (tmp, mode_mmin))
- {
- desc->infinite =
- alloc_EXPR_LIST (0, const_true_rtx, NULL_RTX);
- /* Fill in the remaining fields somehow. */
- goto zero_iter_simplify;
- }
- }
- else
- {
- tmp = lowpart_subreg (mode, iv1.base, comp_mode);
- if (rtx_equal_p (tmp, mode_mmax))
- {
- desc->infinite =
- alloc_EXPR_LIST (0, const_true_rtx, NULL_RTX);
- /* Fill in the remaining fields somehow. */
- goto zero_iter_simplify;
- }
- }
- }
-
- /* If we can we want to take care of NE conditions instead of size
- comparisons, as they are much more friendly (most importantly
- this takes care of special handling of loops with step 1). We can
- do it if we first check that upper bound is greater or equal to
- lower bound, their difference is constant c modulo step and that
- there is not an overflow. */
- if (cond != NE)
- {
- if (iv0.step == const0_rtx)
- step = simplify_gen_unary (NEG, comp_mode, iv1.step, comp_mode);
- else
- step = iv0.step;
- step = lowpart_subreg (mode, step, comp_mode);
- delta = simplify_gen_binary (MINUS, comp_mode, iv1.base, iv0.base);
- delta = lowpart_subreg (mode, delta, comp_mode);
- delta = simplify_gen_binary (UMOD, mode, delta, step);
- may_xform = const0_rtx;
- may_not_xform = const_true_rtx;
-
- if (CONST_INT_P (delta))
- {
- if (was_sharp && INTVAL (delta) == INTVAL (step) - 1)
- {
- /* A special case. We have transformed condition of type
- for (i = 0; i < 4; i += 4)
- into
- for (i = 0; i <= 3; i += 4)
- obviously if the test for overflow during that transformation
- passed, we cannot overflow here. Most importantly any
- loop with sharp end condition and step 1 falls into this
- category, so handling this case specially is definitely
- worth the troubles. */
- may_xform = const_true_rtx;
- }
- else if (iv0.step == const0_rtx)
- {
- bound = simplify_gen_binary (PLUS, comp_mode, mmin, step);
- bound = simplify_gen_binary (MINUS, comp_mode, bound, delta);
- bound = lowpart_subreg (mode, bound, comp_mode);
- tmp = lowpart_subreg (mode, iv0.base, comp_mode);
- may_xform = simplify_gen_relational (cond, SImode, mode,
- bound, tmp);
- may_not_xform = simplify_gen_relational (reverse_condition (cond),
- SImode, mode,
- bound, tmp);
- }
- else
- {
- bound = simplify_gen_binary (MINUS, comp_mode, mmax, step);
- bound = simplify_gen_binary (PLUS, comp_mode, bound, delta);
- bound = lowpart_subreg (mode, bound, comp_mode);
- tmp = lowpart_subreg (mode, iv1.base, comp_mode);
- may_xform = simplify_gen_relational (cond, SImode, mode,
- tmp, bound);
- may_not_xform = simplify_gen_relational (reverse_condition (cond),
- SImode, mode,
- tmp, bound);
- }
- }
-
- if (may_xform != const0_rtx)
- {
- /* We perform the transformation always provided that it is not
- completely senseless. This is OK, as we would need this assumption
- to determine the number of iterations anyway. */
- if (may_xform != const_true_rtx)
- {
- /* If the step is a power of two and the final value we have
- computed overflows, the cycle is infinite. Otherwise it
- is nontrivial to compute the number of iterations. */
- if (step_is_pow2)
- desc->infinite = alloc_EXPR_LIST (0, may_not_xform,
- desc->infinite);
- else
- desc->assumptions = alloc_EXPR_LIST (0, may_xform,
- desc->assumptions);
- }
-
- /* We are going to lose some information about upper bound on
- number of iterations in this step, so record the information
- here. */
- inc = INTVAL (iv0.step) - INTVAL (iv1.step);
- if (CONST_INT_P (iv1.base))
- up = INTVAL (iv1.base);
- else
- up = INTVAL (mode_mmax) - inc;
- down = INTVAL (CONST_INT_P (iv0.base)
- ? iv0.base
- : mode_mmin);
- max = (up - down) / inc + 1;
- if (!desc->infinite
- && !desc->assumptions)
- record_niter_bound (loop, max, false, true);
-
- if (iv0.step == const0_rtx)
- {
- iv0.base = simplify_gen_binary (PLUS, comp_mode, iv0.base, delta);
- iv0.base = simplify_gen_binary (MINUS, comp_mode, iv0.base, step);
- }
- else
- {
- iv1.base = simplify_gen_binary (MINUS, comp_mode, iv1.base, delta);
- iv1.base = simplify_gen_binary (PLUS, comp_mode, iv1.base, step);
- }
-
- tmp0 = lowpart_subreg (mode, iv0.base, comp_mode);
- tmp1 = lowpart_subreg (mode, iv1.base, comp_mode);
- assumption = simplify_gen_relational (reverse_condition (cond),
- SImode, mode, tmp0, tmp1);
- if (assumption == const_true_rtx)
- goto zero_iter_simplify;
- else if (assumption != const0_rtx)
- desc->noloop_assumptions =
- alloc_EXPR_LIST (0, assumption, desc->noloop_assumptions);
- cond = NE;
- }
- }
-
- /* Count the number of iterations. */
- if (cond == NE)
- {
- /* Everything we do here is just arithmetics modulo size of mode. This
- makes us able to do more involved computations of number of iterations
- than in other cases. First transform the condition into shape
- s * i <> c, with s positive. */
- iv1.base = simplify_gen_binary (MINUS, comp_mode, iv1.base, iv0.base);
- iv0.base = const0_rtx;
- iv0.step = simplify_gen_binary (MINUS, comp_mode, iv0.step, iv1.step);
- iv1.step = const0_rtx;
- if (INTVAL (iv0.step) < 0)
- {
- iv0.step = simplify_gen_unary (NEG, comp_mode, iv0.step, comp_mode);
- iv1.base = simplify_gen_unary (NEG, comp_mode, iv1.base, comp_mode);
- }
- iv0.step = lowpart_subreg (mode, iv0.step, comp_mode);
-
- /* Let nsd (s, size of mode) = d. If d does not divide c, the loop
- is infinite. Otherwise, the number of iterations is
- (inverse(s/d) * (c/d)) mod (size of mode/d). */
- s = INTVAL (iv0.step); d = 1;
- while (s % 2 != 1)
- {
- s /= 2;
- d *= 2;
- size--;
- }
- bound = GEN_INT (((uint64_t) 1 << (size - 1 ) << 1) - 1);
-
- tmp1 = lowpart_subreg (mode, iv1.base, comp_mode);
- tmp = simplify_gen_binary (UMOD, mode, tmp1, gen_int_mode (d, mode));
- assumption = simplify_gen_relational (NE, SImode, mode, tmp, const0_rtx);
- desc->infinite = alloc_EXPR_LIST (0, assumption, desc->infinite);
-
- tmp = simplify_gen_binary (UDIV, mode, tmp1, gen_int_mode (d, mode));
- inv = inverse (s, size);
- tmp = simplify_gen_binary (MULT, mode, tmp, gen_int_mode (inv, mode));
- desc->niter_expr = simplify_gen_binary (AND, mode, tmp, bound);
- }
- else
- {
- if (iv1.step == const0_rtx)
- /* Condition in shape a + s * i <= b
- We must know that b + s does not overflow and a <= b + s and then we
- can compute number of iterations as (b + s - a) / s. (It might
- seem that we in fact could be more clever about testing the b + s
- overflow condition using some information about b - a mod s,
- but it was already taken into account during LE -> NE transform). */
- {
- step = iv0.step;
- tmp0 = lowpart_subreg (mode, iv0.base, comp_mode);
- tmp1 = lowpart_subreg (mode, iv1.base, comp_mode);
-
- bound = simplify_gen_binary (MINUS, mode, mode_mmax,
- lowpart_subreg (mode, step,
- comp_mode));
- if (step_is_pow2)
- {
- rtx t0, t1;
-
- /* If s is power of 2, we know that the loop is infinite if
- a % s <= b % s and b + s overflows. */
- assumption = simplify_gen_relational (reverse_condition (cond),
- SImode, mode,
- tmp1, bound);
-
- t0 = simplify_gen_binary (UMOD, mode, copy_rtx (tmp0), step);
- t1 = simplify_gen_binary (UMOD, mode, copy_rtx (tmp1), step);
- tmp = simplify_gen_relational (cond, SImode, mode, t0, t1);
- assumption = simplify_gen_binary (AND, SImode, assumption, tmp);
- desc->infinite =
- alloc_EXPR_LIST (0, assumption, desc->infinite);
- }
- else
- {
- assumption = simplify_gen_relational (cond, SImode, mode,
- tmp1, bound);
- desc->assumptions =
- alloc_EXPR_LIST (0, assumption, desc->assumptions);
- }
-
- tmp = simplify_gen_binary (PLUS, comp_mode, iv1.base, iv0.step);
- tmp = lowpart_subreg (mode, tmp, comp_mode);
- assumption = simplify_gen_relational (reverse_condition (cond),
- SImode, mode, tmp0, tmp);
-
- delta = simplify_gen_binary (PLUS, mode, tmp1, step);
- delta = simplify_gen_binary (MINUS, mode, delta, tmp0);
- }
- else
- {
- /* Condition in shape a <= b - s * i
- We must know that a - s does not overflow and a - s <= b and then
- we can again compute number of iterations as (b - (a - s)) / s. */
- step = simplify_gen_unary (NEG, mode, iv1.step, mode);
- tmp0 = lowpart_subreg (mode, iv0.base, comp_mode);
- tmp1 = lowpart_subreg (mode, iv1.base, comp_mode);
-
- bound = simplify_gen_binary (PLUS, mode, mode_mmin,
- lowpart_subreg (mode, step, comp_mode));
- if (step_is_pow2)
- {
- rtx t0, t1;
-
- /* If s is power of 2, we know that the loop is infinite if
- a % s <= b % s and a - s overflows. */
- assumption = simplify_gen_relational (reverse_condition (cond),
- SImode, mode,
- bound, tmp0);
-
- t0 = simplify_gen_binary (UMOD, mode, copy_rtx (tmp0), step);
- t1 = simplify_gen_binary (UMOD, mode, copy_rtx (tmp1), step);
- tmp = simplify_gen_relational (cond, SImode, mode, t0, t1);
- assumption = simplify_gen_binary (AND, SImode, assumption, tmp);
- desc->infinite =
- alloc_EXPR_LIST (0, assumption, desc->infinite);
- }
- else
- {
- assumption = simplify_gen_relational (cond, SImode, mode,
- bound, tmp0);
- desc->assumptions =
- alloc_EXPR_LIST (0, assumption, desc->assumptions);
- }
-
- tmp = simplify_gen_binary (PLUS, comp_mode, iv0.base, iv1.step);
- tmp = lowpart_subreg (mode, tmp, comp_mode);
- assumption = simplify_gen_relational (reverse_condition (cond),
- SImode, mode,
- tmp, tmp1);
- delta = simplify_gen_binary (MINUS, mode, tmp0, step);
- delta = simplify_gen_binary (MINUS, mode, tmp1, delta);
- }
- if (assumption == const_true_rtx)
- goto zero_iter_simplify;
- else if (assumption != const0_rtx)
- desc->noloop_assumptions =
- alloc_EXPR_LIST (0, assumption, desc->noloop_assumptions);
- delta = simplify_gen_binary (UDIV, mode, delta, step);
- desc->niter_expr = delta;
- }
-
- old_niter = desc->niter_expr;
-
- simplify_using_initial_values (loop, AND, &desc->assumptions);
- if (desc->assumptions
- && XEXP (desc->assumptions, 0) == const0_rtx)
- goto fail;
- simplify_using_initial_values (loop, IOR, &desc->noloop_assumptions);
- simplify_using_initial_values (loop, IOR, &desc->infinite);
- simplify_using_initial_values (loop, UNKNOWN, &desc->niter_expr);
-
- /* Rerun the simplification. Consider code (created by copying loop headers)
-
- i = 0;
-
- if (0 < n)
- {
- do
- {
- i++;
- } while (i < n);
- }
-
- The first pass determines that i = 0, the second pass uses it to eliminate
- noloop assumption. */
-
- simplify_using_initial_values (loop, AND, &desc->assumptions);
- if (desc->assumptions
- && XEXP (desc->assumptions, 0) == const0_rtx)
- goto fail;
- simplify_using_initial_values (loop, IOR, &desc->noloop_assumptions);
- simplify_using_initial_values (loop, IOR, &desc->infinite);
- simplify_using_initial_values (loop, UNKNOWN, &desc->niter_expr);
-
- if (desc->noloop_assumptions
- && XEXP (desc->noloop_assumptions, 0) == const_true_rtx)
- goto zero_iter;
-
- if (CONST_INT_P (desc->niter_expr))
- {
- uint64_t val = INTVAL (desc->niter_expr);
-
- desc->const_iter = true;
- desc->niter = val & GET_MODE_MASK (desc->mode);
- if (!desc->infinite
- && !desc->assumptions)
- record_niter_bound (loop, desc->niter, false, true);
- }
- else
- {
- max = determine_max_iter (loop, desc, old_niter);
- if (!max)
- goto zero_iter_simplify;
- if (!desc->infinite
- && !desc->assumptions)
- record_niter_bound (loop, max, false, true);
-
- /* simplify_using_initial_values does a copy propagation on the registers
- in the expression for the number of iterations. This prolongs life
- ranges of registers and increases register pressure, and usually
- brings no gain (and if it happens to do, the cse pass will take care
- of it anyway). So prevent this behavior, unless it enabled us to
- derive that the number of iterations is a constant. */
- desc->niter_expr = old_niter;
- }
-
- return;
-
-zero_iter_simplify:
- /* Simplify the assumptions. */
- simplify_using_initial_values (loop, AND, &desc->assumptions);
- if (desc->assumptions
- && XEXP (desc->assumptions, 0) == const0_rtx)
- goto fail;
- simplify_using_initial_values (loop, IOR, &desc->infinite);
-
- /* Fallthru. */
-zero_iter:
- desc->const_iter = true;
- desc->niter = 0;
- record_niter_bound (loop, 0, true, true);
- desc->noloop_assumptions = NULL_RTX;
- desc->niter_expr = const0_rtx;
- return;
-
-fail:
- desc->simple_p = false;
- return;
-}
-
-/* Checks whether E is a simple exit from LOOP and stores its description
- into DESC. */
-
-static void
-check_simple_exit (class loop *loop, edge e, class niter_desc *desc)
-{
- basic_block exit_bb;
- rtx condition;
- rtx_insn *at;
- edge ein;
-
- exit_bb = e->src;
- desc->simple_p = false;
-
- /* It must belong directly to the loop. */
- if (exit_bb->loop_father != loop)
- return;
-
- /* It must be tested (at least) once during any iteration. */
- if (!dominated_by_p (CDI_DOMINATORS, loop->latch, exit_bb))
- return;
-
- /* It must end in a simple conditional jump. */
- if (!any_condjump_p (BB_END (exit_bb)) || !onlyjump_p (BB_END (exit_bb)))
- return;
-
- ein = EDGE_SUCC (exit_bb, 0);
- if (ein == e)
- ein = EDGE_SUCC (exit_bb, 1);
-
- desc->out_edge = e;
- desc->in_edge = ein;
-
- /* Test whether the condition is suitable. */
- if (!(condition = get_condition (BB_END (ein->src), &at, false, false)))
- return;
-
- if (ein->flags & EDGE_FALLTHRU)
- {
- condition = reversed_condition (condition);
- if (!condition)
- return;
- }
-
- /* Check that we are able to determine number of iterations and fill
- in information about it. */
- iv_number_of_iterations (loop, at, condition, desc);
-}
-
-/* Finds a simple exit of LOOP and stores its description into DESC. */
-
-static void
-find_simple_exit (class loop *loop, class niter_desc *desc)
-{
- unsigned i;
- basic_block *body;
- edge e;
- class niter_desc act;
- bool any = false;
- edge_iterator ei;
-
- desc->simple_p = false;
- body = get_loop_body (loop);
-
- for (i = 0; i < loop->num_nodes; i++)
- {
- FOR_EACH_EDGE (e, ei, body[i]->succs)
- {
- if (flow_bb_inside_loop_p (loop, e->dest))
- continue;
-
- check_simple_exit (loop, e, &act);
- if (!act.simple_p)
- continue;
-
- if (!any)
- any = true;
- else
- {
- /* Prefer constant iterations; the less the better. */
- if (!act.const_iter
- || (desc->const_iter && act.niter >= desc->niter))
- continue;
-
- /* Also if the actual exit may be infinite, while the old one
- not, prefer the old one. */
- if (act.infinite && !desc->infinite)
- continue;
- }
-
- *desc = act;
- }
- }
-
- if (dump_file)
- {
- if (desc->simple_p)
- {
- fprintf (dump_file, "Loop %d is simple:\n", loop->num);
- fprintf (dump_file, " simple exit %d -> %d\n",
- desc->out_edge->src->index,
- desc->out_edge->dest->index);
- if (desc->assumptions)
- {
- fprintf (dump_file, " assumptions: ");
- print_rtl (dump_file, desc->assumptions);
- fprintf (dump_file, "\n");
- }
- if (desc->noloop_assumptions)
- {
- fprintf (dump_file, " does not roll if: ");
- print_rtl (dump_file, desc->noloop_assumptions);
- fprintf (dump_file, "\n");
- }
- if (desc->infinite)
- {
- fprintf (dump_file, " infinite if: ");
- print_rtl (dump_file, desc->infinite);
- fprintf (dump_file, "\n");
- }
-
- fprintf (dump_file, " number of iterations: ");
- print_rtl (dump_file, desc->niter_expr);
- fprintf (dump_file, "\n");
-
- fprintf (dump_file, " upper bound: %li\n",
- (long)get_max_loop_iterations_int (loop));
- fprintf (dump_file, " likely upper bound: %li\n",
- (long)get_likely_max_loop_iterations_int (loop));
- fprintf (dump_file, " realistic bound: %li\n",
- (long)get_estimated_loop_iterations_int (loop));
- }
- else
- fprintf (dump_file, "Loop %d is not simple.\n", loop->num);
- }
-
- /* Fix up the finiteness if possible. We can only do it for single exit,
- since the loop is finite, but it's possible that we predicate one loop
- exit to be finite which can not be determined as finite in middle-end as
- well. It results in incorrect predicate information on the exit condition
- expression. For example, if says [(int) _1 + -8, + , -8] != 0 finite,
- it means _1 can exactly divide -8. */
- if (desc->infinite && single_exit (loop) && finite_loop_p (loop))
- {
- desc->infinite = NULL_RTX;
- if (dump_file)
- fprintf (dump_file, " infinite updated to finite.\n");
- }
-
- free (body);
-}
-
-/* Creates a simple loop description of LOOP if it was not computed
- already. */
-
-class niter_desc *
-get_simple_loop_desc (class loop *loop)
-{
- class niter_desc *desc = simple_loop_desc (loop);
-
- if (desc)
- return desc;
-
- /* At least desc->infinite is not always initialized by
- find_simple_loop_exit. */
- desc = ggc_cleared_alloc<niter_desc> ();
- iv_analysis_loop_init (loop);
- find_simple_exit (loop, desc);
- loop->simple_loop_desc = desc;
- return desc;
-}
-
-/* Releases simple loop description for LOOP. */
-
-void
-free_simple_loop_desc (class loop *loop)
-{
- class niter_desc *desc = simple_loop_desc (loop);
-
- if (!desc)
- return;
-
- ggc_free (desc);
- loop->simple_loop_desc = NULL;
-}