public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Merge commit 'ff7aeceb6b3a476c3bac66a7f39a5ef4240206fc' [#247, #906]
@ 2022-06-08 12:03 Thomas Schwinge
0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-08 12:03 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:7eef766dc5a8abda2ca2cf8d535cdf160f40b50c
commit 7eef766dc5a8abda2ca2cf8d535cdf160f40b50c
Merge: 5199ecb8519 ff7aeceb6b3
Author: Thomas Schwinge <thomas@codesourcery.com>
Date: Thu Feb 3 21:12:21 2022 +0100
Merge commit 'ff7aeceb6b3a476c3bac66a7f39a5ef4240206fc' [#247, #906]
Diff:
ChangeLog | 4 +
MAINTAINERS | 14 +-
contrib/ChangeLog | 14 +
contrib/filter-clang-warnings.py | 14 +-
contrib/gcc_update | 6 +-
contrib/git-backport.py | 48 +
contrib/header-tools/ChangeLog | 4 +
contrib/header-tools/README | 34 +-
contrib/paranoia.cc | 2 +-
gcc/ChangeLog | 2435 ++++++++++++++++++++
gcc/DATESTAMP | 2 +-
gcc/Makefile.in | 322 +--
gcc/ada/ChangeLog | 117 +
gcc/ada/gcc-interface/Make-lang.in | 6 +-
gcc/ada/gcc-interface/config-lang.in | 2 +-
gcc/ada/gcc-interface/{cuintp.c => cuintp.cc} | 0
gcc/ada/gcc-interface/{decl.c => decl.cc} | 4 +-
gcc/ada/gcc-interface/gigi.h | 16 +-
gcc/ada/gcc-interface/lang-specs.h | 2 +-
gcc/ada/gcc-interface/{misc.c => misc.cc} | 0
gcc/ada/gcc-interface/{targtyps.c => targtyps.cc} | 0
gcc/ada/gcc-interface/{trans.c => trans.cc} | 0
gcc/ada/gcc-interface/{utils.c => utils.cc} | 8 +-
gcc/ada/gcc-interface/{utils2.c => utils2.cc} | 8 +-
gcc/ada/init.c | 2 +-
gcc/ada/set_targ.ads | 4 +-
gcc/{adjust-alignment.c => adjust-alignment.cc} | 0
gcc/{alias.c => alias.cc} | 0
gcc/alias.h | 2 +-
gcc/{alloc-pool.c => alloc-pool.cc} | 0
gcc/analyzer/ChangeLog | 9 +
gcc/analyzer/analyzer.cc | 4 +-
gcc/analyzer/region-model-asm.cc | 2 +-
gcc/analyzer/region.cc | 2 +-
gcc/analyzer/sm-malloc.cc | 2 +-
gcc/analyzer/supergraph.cc | 2 +-
gcc/{asan.c => asan.cc} | 2 +-
gcc/{attribs.c => attribs.cc} | 0
gcc/{auto-inc-dec.c => auto-inc-dec.cc} | 0
gcc/{auto-profile.c => auto-profile.cc} | 0
gcc/auto-profile.h | 2 +-
gcc/basic-block.h | 2 +-
gcc/{bb-reorder.c => bb-reorder.cc} | 0
gcc/{bitmap.c => bitmap.cc} | 0
gcc/{btfout.c => btfout.cc} | 2 +-
gcc/{builtins.c => builtins.cc} | 8 +-
gcc/c-family/ChangeLog | 71 +
gcc/c-family/{c-ada-spec.c => c-ada-spec.cc} | 2 +-
gcc/c-family/c-ada-spec.h | 2 +-
gcc/c-family/{c-attribs.c => c-attribs.cc} | 0
gcc/c-family/{c-common.c => c-common.cc} | 4 +-
gcc/c-family/c-common.h | 30 +-
gcc/c-family/{c-cppbuiltin.c => c-cppbuiltin.cc} | 2 +-
gcc/c-family/{c-dump.c => c-dump.cc} | 0
gcc/c-family/{c-format.c => c-format.cc} | 2 +-
gcc/c-family/{c-gimplify.c => c-gimplify.cc} | 2 +-
gcc/c-family/{c-indentation.c => c-indentation.cc} | 0
gcc/c-family/c-indentation.h | 2 +-
gcc/c-family/{c-lex.c => c-lex.cc} | 0
gcc/c-family/c-objc.h | 2 +-
gcc/c-family/{c-omp.c => c-omp.cc} | 4 +-
gcc/c-family/{c-opts.c => c-opts.cc} | 4 +-
gcc/c-family/{c-pch.c => c-pch.cc} | 0
gcc/c-family/{c-ppoutput.c => c-ppoutput.cc} | 0
gcc/c-family/{c-pragma.c => c-pragma.cc} | 2 +-
.../{c-pretty-print.c => c-pretty-print.cc} | 0
gcc/c-family/c-pretty-print.h | 2 +-
gcc/c-family/{c-semantics.c => c-semantics.cc} | 0
gcc/c-family/{c-ubsan.c => c-ubsan.cc} | 0
gcc/c-family/{c-warn.c => c-warn.cc} | 0
gcc/c-family/{cppspec.c => cppspec.cc} | 0
gcc/c-family/{stub-objc.c => stub-objc.cc} | 0
gcc/c/ChangeLog | 49 +
gcc/c/Make-lang.in | 10 +-
gcc/c/{c-aux-info.c => c-aux-info.cc} | 0
gcc/c/{c-convert.c => c-convert.cc} | 10 +-
gcc/c/{c-decl.c => c-decl.cc} | 6 +-
gcc/c/{c-errors.c => c-errors.cc} | 0
gcc/c/{c-fold.c => c-fold.cc} | 0
gcc/c/{c-lang.c => c-lang.cc} | 0
gcc/c/{c-objc-common.c => c-objc-common.cc} | 0
gcc/c/c-objc-common.h | 2 +-
gcc/c/{c-parser.c => c-parser.cc} | 2 +-
gcc/c/c-parser.h | 2 +-
gcc/c/c-tree.h | 22 +-
gcc/c/{c-typeck.c => c-typeck.cc} | 4 +-
gcc/c/config-lang.in | 2 +-
gcc/c/{gccspec.c => gccspec.cc} | 0
gcc/c/{gimple-parser.c => gimple-parser.cc} | 0
gcc/{caller-save.c => caller-save.cc} | 4 +-
gcc/{calls.c => calls.cc} | 12 +-
gcc/{ccmp.c => ccmp.cc} | 0
gcc/cfg-flags.def | 6 +-
gcc/{cfg.c => cfg.cc} | 0
gcc/{cfganal.c => cfganal.cc} | 2 +-
gcc/{cfgbuild.c => cfgbuild.cc} | 0
gcc/{cfgcleanup.c => cfgcleanup.cc} | 12 +-
gcc/{cfgexpand.c => cfgexpand.cc} | 2 +-
gcc/{cfghooks.c => cfghooks.cc} | 4 +-
gcc/cfghooks.h | 4 +-
gcc/{cfgloop.c => cfgloop.cc} | 0
gcc/{cfgloopanal.c => cfgloopanal.cc} | 0
gcc/{cfgloopmanip.c => cfgloopmanip.cc} | 0
gcc/{cfgrtl.c => cfgrtl.cc} | 10 +-
gcc/{cgraph.c => cgraph.cc} | 4 +-
gcc/cgraph.h | 22 +-
gcc/{cgraphbuild.c => cgraphbuild.cc} | 0
gcc/{cgraphclones.c => cgraphclones.cc} | 2 +-
gcc/{cgraphunit.c => cgraphunit.cc} | 2 +-
gcc/{collect-utils.c => collect-utils.cc} | 0
gcc/collect-utils.h | 2 +-
gcc/{collect2-aix.c => collect2-aix.cc} | 0
gcc/collect2-aix.h | 2 +-
gcc/{collect2.c => collect2.cc} | 2 +-
gcc/{combine-stack-adj.c => combine-stack-adj.cc} | 2 +-
gcc/{combine.c => combine.cc} | 6 +-
gcc/common.opt | 2 +-
.../{common-targhooks.c => common-targhooks.cc} | 0
.../{aarch64-common.c => aarch64-common.cc} | 2 +-
.../alpha/{alpha-common.c => alpha-common.cc} | 0
.../config/arc/{arc-common.c => arc-common.cc} | 0
.../config/arm/{arm-common.c => arm-common.cc} | 2 +-
.../config/avr/{avr-common.c => avr-common.cc} | 2 +-
.../config/bfin/{bfin-common.c => bfin-common.cc} | 0
.../config/bpf/{bpf-common.c => bpf-common.cc} | 0
.../config/c6x/{c6x-common.c => c6x-common.cc} | 0
.../config/cr16/{cr16-common.c => cr16-common.cc} | 0
.../config/cris/{cris-common.c => cris-common.cc} | 0
.../config/csky/{csky-common.c => csky-common.cc} | 0
.../config/{default-common.c => default-common.cc} | 0
.../{epiphany-common.c => epiphany-common.cc} | 0
.../config/fr30/{fr30-common.c => fr30-common.cc} | 0
.../config/frv/{frv-common.c => frv-common.cc} | 0
.../config/gcn/{gcn-common.c => gcn-common.cc} | 0
.../h8300/{h8300-common.c => h8300-common.cc} | 0
.../config/i386/{i386-common.c => i386-common.cc} | 0
gcc/common/config/i386/i386-isas.h | 4 +-
.../config/ia64/{ia64-common.c => ia64-common.cc} | 0
.../iq2000/{iq2000-common.c => iq2000-common.cc} | 0
.../config/lm32/{lm32-common.c => lm32-common.cc} | 0
.../config/m32r/{m32r-common.c => m32r-common.cc} | 0
.../config/m68k/{m68k-common.c => m68k-common.cc} | 0
.../mcore/{mcore-common.c => mcore-common.cc} | 0
.../{microblaze-common.c => microblaze-common.cc} | 0
.../config/mips/{mips-common.c => mips-common.cc} | 0
.../config/mmix/{mmix-common.c => mmix-common.cc} | 0
.../{mn10300-common.c => mn10300-common.cc} | 0
.../msp430/{msp430-common.c => msp430-common.cc} | 0
.../nds32/{nds32-common.c => nds32-common.cc} | 0
.../nios2/{nios2-common.c => nios2-common.cc} | 0
.../nvptx/{nvptx-common.c => nvptx-common.cc} | 0
.../config/or1k/{or1k-common.c => or1k-common.cc} | 0
gcc/common/config/pa/{pa-common.c => pa-common.cc} | 0
.../pdp11/{pdp11-common.c => pdp11-common.cc} | 0
.../config/pru/{pru-common.c => pru-common.cc} | 0
.../riscv/{riscv-common.c => riscv-common.cc} | 0
.../rs6000/{rs6000-common.c => rs6000-common.cc} | 0
gcc/common/config/rx/{rx-common.c => rx-common.cc} | 0
.../config/s390/{s390-common.c => s390-common.cc} | 0
gcc/common/config/sh/{sh-common.c => sh-common.cc} | 0
.../sparc/{sparc-common.c => sparc-common.cc} | 0
.../tilegx/{tilegx-common.c => tilegx-common.cc} | 0
.../{tilepro-common.c => tilepro-common.cc} | 0
.../config/v850/{v850-common.c => v850-common.cc} | 0
.../config/vax/{vax-common.c => vax-common.cc} | 0
.../visium/{visium-common.c => visium-common.cc} | 0
.../{xstormy16-common.c => xstormy16-common.cc} | 0
.../xtensa/{xtensa-common.c => xtensa-common.cc} | 0
gcc/{compare-elim.c => compare-elim.cc} | 0
gcc/conditions.h | 2 +-
gcc/config.gcc | 42 +-
...{aarch64-bti-insert.c => aarch64-bti-insert.cc} | 0
.../{aarch64-builtins.c => aarch64-builtins.cc} | 2 +-
gcc/config/aarch64/{aarch64-c.c => aarch64-c.cc} | 0
gcc/config/aarch64/{aarch64-d.c => aarch64-d.cc} | 0
gcc/config/aarch64/aarch64-protos.h | 4 +-
gcc/config/aarch64/aarch64-sve-builtins.cc | 2 +-
gcc/config/aarch64/{aarch64.c => aarch64.cc} | 12 +-
gcc/config/aarch64/aarch64.h | 6 +-
...7-fma-steering.c => cortex-a57-fma-steering.cc} | 4 +-
.../{driver-aarch64.c => driver-aarch64.cc} | 2 +-
...oidance.c => falkor-tag-collision-avoidance.cc} | 0
...ost-aarch64-darwin.c => host-aarch64-darwin.cc} | 0
gcc/config/aarch64/t-aarch64 | 26 +-
gcc/config/aarch64/x-aarch64 | 2 +-
gcc/config/aarch64/x-darwin | 2 +-
gcc/config/alpha/alpha-protos.h | 2 +-
gcc/config/alpha/{alpha.c => alpha.cc} | 2 +-
gcc/config/alpha/alpha.h | 8 +-
gcc/config/alpha/alpha.md | 4 +-
.../alpha/{driver-alpha.c => driver-alpha.cc} | 2 +-
gcc/config/alpha/x-alpha | 2 +-
gcc/config/arc/{arc-c.c => arc-c.cc} | 0
gcc/config/arc/arc-protos.h | 2 +-
gcc/config/arc/{arc.c => arc.cc} | 12 +-
gcc/config/arc/arc.md | 8 +-
gcc/config/arc/builtins.def | 4 +-
gcc/config/arc/{driver-arc.c => driver-arc.cc} | 0
gcc/config/arc/t-arc | 6 +-
gcc/config/arm/{aarch-common.c => aarch-common.cc} | 0
gcc/config/arm/{arm-builtins.c => arm-builtins.cc} | 0
gcc/config/arm/{arm-c.c => arm-c.cc} | 4 +-
gcc/config/arm/{arm-d.c => arm-d.cc} | 0
gcc/config/arm/arm-protos.h | 8 +-
gcc/config/arm/{arm.c => arm.cc} | 12 +-
gcc/config/arm/arm.h | 8 +-
gcc/config/arm/arm.md | 2 +-
gcc/config/arm/{driver-arm.c => driver-arm.cc} | 2 +-
gcc/config/arm/symbian.h | 2 +-
gcc/config/arm/t-arm | 16 +-
gcc/config/arm/thumb1.md | 10 +-
gcc/config/arm/x-arm | 2 +-
gcc/config/avr/{avr-c.c => avr-c.cc} | 6 +-
gcc/config/avr/{avr-devices.c => avr-devices.cc} | 0
gcc/config/avr/avr-fixed.md | 2 +-
gcc/config/avr/{avr-log.c => avr-log.cc} | 2 +-
gcc/config/avr/avr-mcus.def | 2 +-
gcc/config/avr/avr-modes.def | 2 +-
gcc/config/avr/avr-passes.def | 2 +-
gcc/config/avr/avr-protos.h | 4 +-
gcc/config/avr/{avr.c => avr.cc} | 18 +-
gcc/config/avr/avr.h | 4 +-
gcc/config/avr/avr.md | 6 +-
gcc/config/avr/builtins.def | 4 +-
gcc/config/avr/{driver-avr.c => driver-avr.cc} | 0
...{gen-avr-mmcu-specs.c => gen-avr-mmcu-specs.cc} | 6 +-
.../{gen-avr-mmcu-texi.c => gen-avr-mmcu-texi.cc} | 6 +-
gcc/config/avr/t-avr | 18 +-
gcc/config/bfin/{bfin.c => bfin.cc} | 2 +-
gcc/config/bpf/bpf-protos.h | 2 +-
gcc/config/bpf/{bpf.c => bpf.cc} | 0
gcc/config/bpf/bpf.h | 2 +-
gcc/config/bpf/{coreout.c => coreout.cc} | 0
gcc/config/bpf/t-bpf | 2 +-
gcc/config/c6x/c6x-protos.h | 4 +-
gcc/config/c6x/{c6x.c => c6x.cc} | 0
gcc/config/cr16/cr16-protos.h | 2 +-
gcc/config/cr16/{cr16.c => cr16.cc} | 0
gcc/config/cris/{cris.c => cris.cc} | 8 +-
gcc/config/cris/cris.h | 8 +-
gcc/config/cris/cris.opt | 2 +-
gcc/config/cris/sync.md | 2 +-
gcc/config/csky/{csky.c => csky.cc} | 2 +-
gcc/config/{darwin-c.c => darwin-c.cc} | 2 +-
gcc/config/{darwin-d.c => darwin-d.cc} | 0
gcc/config/{darwin-driver.c => darwin-driver.cc} | 0
gcc/config/{darwin-f.c => darwin-f.cc} | 2 +-
gcc/config/darwin-sections.def | 8 +-
gcc/config/{darwin.c => darwin.cc} | 10 +-
gcc/config/darwin.h | 4 +-
gcc/config/{default-c.c => default-c.cc} | 0
gcc/config/{default-d.c => default-d.cc} | 0
gcc/config/{dragonfly-d.c => dragonfly-d.cc} | 0
gcc/config/elfos.h | 2 +-
gcc/config/epiphany/epiphany-sched.md | 2 +-
gcc/config/epiphany/{epiphany.c => epiphany.cc} | 2 +-
gcc/config/epiphany/epiphany.h | 6 +-
.../{mode-switch-use.c => mode-switch-use.cc} | 2 +-
gcc/config/epiphany/predicates.md | 2 +-
.../{resolve-sw-modes.c => resolve-sw-modes.cc} | 0
gcc/config/epiphany/t-epiphany | 4 +-
gcc/config/fr30/fr30-protos.h | 2 +-
gcc/config/fr30/{fr30.c => fr30.cc} | 0
gcc/config/{freebsd-d.c => freebsd-d.cc} | 0
gcc/config/frv/frv-protos.h | 2 +-
gcc/config/frv/{frv.c => frv.cc} | 2 +-
gcc/config/frv/frv.h | 2 +-
gcc/config/ft32/ft32-protos.h | 2 +-
gcc/config/ft32/{ft32.c => ft32.cc} | 0
gcc/config/gcn/{driver-gcn.c => driver-gcn.cc} | 0
gcc/config/gcn/gcn-hsa.h | 2 +-
gcc/config/gcn/{gcn-run.c => gcn-run.cc} | 0
gcc/config/gcn/{gcn-tree.c => gcn-tree.cc} | 0
gcc/config/gcn/{gcn.c => gcn.cc} | 2 +-
gcc/config/gcn/{mkoffload.c => mkoffload.cc} | 2 +-
gcc/config/gcn/t-gcn-hsa | 8 +-
gcc/config/gcn/t-omp-device | 2 +-
gcc/config/{glibc-c.c => glibc-c.cc} | 0
gcc/config/{glibc-d.c => glibc-d.cc} | 0
gcc/config/h8300/h8300-protos.h | 4 +-
gcc/config/h8300/{h8300.c => h8300.cc} | 4 +-
gcc/config/h8300/h8300.h | 6 +-
gcc/config/{host-darwin.c => host-darwin.cc} | 0
gcc/config/{host-hpux.c => host-hpux.cc} | 0
gcc/config/{host-linux.c => host-linux.cc} | 0
gcc/config/{host-netbsd.c => host-netbsd.cc} | 0
gcc/config/{host-openbsd.c => host-openbsd.cc} | 0
gcc/config/{host-solaris.c => host-solaris.cc} | 0
gcc/config/i386/cygming.h | 4 +-
gcc/config/i386/{djgpp.c => djgpp.cc} | 0
gcc/config/i386/djgpp.h | 2 +-
gcc/config/i386/dragonfly.h | 2 +-
gcc/config/i386/{driver-i386.c => driver-i386.cc} | 2 +-
.../i386/{driver-mingw32.c => driver-mingw32.cc} | 0
gcc/config/i386/freebsd.h | 2 +-
.../i386/{gnu-property.c => gnu-property.cc} | 0
gcc/config/i386/{host-cygwin.c => host-cygwin.cc} | 0
.../{host-i386-darwin.c => host-i386-darwin.cc} | 0
.../i386/{host-mingw32.c => host-mingw32.cc} | 0
.../i386/{i386-builtins.c => i386-builtins.cc} | 0
gcc/config/i386/{i386-c.c => i386-c.cc} | 2 +-
gcc/config/i386/{i386-d.c => i386-d.cc} | 0
gcc/config/i386/{i386-expand.c => i386-expand.cc} | 2 +-
.../i386/{i386-features.c => i386-features.cc} | 0
.../i386/{i386-options.c => i386-options.cc} | 2 +-
gcc/config/i386/i386-protos.h | 12 +-
gcc/config/i386/{i386.c => i386.cc} | 12 +-
gcc/config/i386/i386.h | 16 +-
gcc/config/i386/i386.md | 6 +-
...{intelmic-mkoffload.c => intelmic-mkoffload.cc} | 0
gcc/config/i386/lynx.h | 2 +-
gcc/config/i386/mmx.md | 8 +-
gcc/config/i386/{msformat-c.c => msformat-c.cc} | 0
gcc/config/i386/sse.md | 10 +-
gcc/config/i386/t-cygming | 18 +-
gcc/config/i386/t-djgpp | 4 +-
gcc/config/i386/t-gnu-property | 2 +-
gcc/config/i386/t-i386 | 20 +-
gcc/config/i386/t-intelmic | 2 +-
gcc/config/i386/t-omp-device | 4 +-
gcc/config/i386/{winnt-cxx.c => winnt-cxx.cc} | 4 +-
gcc/config/i386/{winnt-d.c => winnt-d.cc} | 0
gcc/config/i386/{winnt-stubs.c => winnt-stubs.cc} | 0
gcc/config/i386/{winnt.c => winnt.cc} | 8 +-
gcc/config/i386/x-cygwin | 4 +-
gcc/config/i386/x-darwin | 2 +-
gcc/config/i386/x-i386 | 2 +-
gcc/config/i386/x-mingw32 | 6 +-
...86-tune-sched-atom.c => x86-tune-sched-atom.cc} | 0
.../{x86-tune-sched-bd.c => x86-tune-sched-bd.cc} | 0
...86-tune-sched-core.c => x86-tune-sched-core.cc} | 2 +-
.../i386/{x86-tune-sched.c => x86-tune-sched.cc} | 0
gcc/config/i386/x86-tune.def | 4 +-
gcc/config/i386/xm-djgpp.h | 4 +-
gcc/config/ia64/freebsd.h | 4 +-
gcc/config/ia64/hpux.h | 2 +-
gcc/config/ia64/{ia64-c.c => ia64-c.cc} | 0
gcc/config/ia64/ia64-protos.h | 2 +-
gcc/config/ia64/{ia64.c => ia64.cc} | 6 +-
gcc/config/ia64/ia64.h | 2 +-
gcc/config/ia64/ia64.md | 4 +-
gcc/config/ia64/predicates.md | 2 +-
gcc/config/ia64/sysv4.h | 4 +-
gcc/config/ia64/t-ia64 | 6 +-
gcc/config/iq2000/{iq2000.c => iq2000.cc} | 0
gcc/config/iq2000/iq2000.h | 2 +-
gcc/config/iq2000/iq2000.md | 4 +-
gcc/config/{linux.c => linux.cc} | 0
gcc/config/linux.h | 4 +-
gcc/config/lm32/{lm32.c => lm32.cc} | 0
gcc/config/m32c/{m32c-pragma.c => m32c-pragma.cc} | 0
gcc/config/m32c/{m32c.c => m32c.cc} | 2 +-
gcc/config/m32c/m32c.h | 2 +-
gcc/config/m32c/t-m32c | 2 +-
gcc/config/m32r/m32r-protos.h | 2 +-
gcc/config/m32r/{m32r.c => m32r.cc} | 2 +-
gcc/config/m32r/m32r.h | 4 +-
gcc/config/m32r/m32r.md | 2 +-
gcc/config/m68k/m68k-isas.def | 2 +-
gcc/config/m68k/m68k-microarchs.def | 2 +-
gcc/config/m68k/m68k-protos.h | 6 +-
gcc/config/m68k/{m68k.c => m68k.cc} | 10 +-
gcc/config/m68k/m68k.h | 4 +-
gcc/config/m68k/m68k.md | 4 +-
gcc/config/m68k/m68kemb.h | 2 +-
gcc/config/m68k/uclinux.h | 2 +-
gcc/config/mcore/mcore-protos.h | 2 +-
gcc/config/mcore/{mcore.c => mcore.cc} | 4 +-
gcc/config/mcore/mcore.h | 4 +-
gcc/config/mcore/mcore.md | 2 +-
.../microblaze/{microblaze-c.c => microblaze-c.cc} | 0
gcc/config/microblaze/microblaze-protos.h | 2 +-
.../microblaze/{microblaze.c => microblaze.cc} | 12 +-
gcc/config/microblaze/microblaze.h | 2 +-
gcc/config/microblaze/microblaze.md | 4 +-
gcc/config/microblaze/t-microblaze | 4 +-
.../mips/{driver-native.c => driver-native.cc} | 2 +-
.../{frame-header-opt.c => frame-header-opt.cc} | 0
gcc/config/mips/loongson2ef.md | 2 +-
gcc/config/mips/{mips-d.c => mips-d.cc} | 0
gcc/config/mips/mips-protos.h | 2 +-
gcc/config/mips/{mips.c => mips.cc} | 10 +-
gcc/config/mips/mips.h | 2 +-
gcc/config/mips/mips.md | 2 +-
gcc/config/mips/t-mips | 4 +-
gcc/config/mips/x-native | 2 +-
gcc/config/mmix/mmix-protos.h | 2 +-
gcc/config/mmix/{mmix.c => mmix.cc} | 6 +-
gcc/config/mmix/mmix.h | 2 +-
gcc/config/mmix/mmix.md | 4 +-
gcc/config/mmix/predicates.md | 2 +-
gcc/config/mn10300/{mn10300.c => mn10300.cc} | 6 +-
gcc/config/mn10300/mn10300.h | 6 +-
gcc/config/moxie/moxie-protos.h | 2 +-
gcc/config/moxie/{moxie.c => moxie.cc} | 0
gcc/config/moxie/uclinux.h | 2 +-
.../msp430/{driver-msp430.c => driver-msp430.cc} | 0
gcc/config/msp430/{msp430-c.c => msp430-c.cc} | 0
.../msp430/{msp430-devices.c => msp430-devices.cc} | 2 +-
gcc/config/msp430/{msp430.c => msp430.cc} | 4 +-
gcc/config/msp430/msp430.h | 4 +-
gcc/config/msp430/t-msp430 | 6 +-
gcc/config/nds32/{nds32-cost.c => nds32-cost.cc} | 6 +-
gcc/config/nds32/nds32-doubleword.md | 2 +-
.../nds32/{nds32-fp-as-gp.c => nds32-fp-as-gp.cc} | 0
.../{nds32-intrinsic.c => nds32-intrinsic.cc} | 0
gcc/config/nds32/{nds32-isr.c => nds32-isr.cc} | 0
...{nds32-md-auxiliary.c => nds32-md-auxiliary.cc} | 0
...manipulation.c => nds32-memory-manipulation.cc} | 0
...es-auxiliary.c => nds32-pipelines-auxiliary.cc} | 0
.../{nds32-predicates.c => nds32-predicates.cc} | 0
.../{nds32-relax-opt.c => nds32-relax-opt.cc} | 0
gcc/config/nds32/{nds32-utils.c => nds32-utils.cc} | 0
gcc/config/nds32/{nds32.c => nds32.cc} | 4 +-
gcc/config/nds32/nds32.h | 10 +-
gcc/config/nds32/predicates.md | 12 +-
gcc/config/nds32/t-nds32 | 40 +-
gcc/config/{netbsd-d.c => netbsd-d.cc} | 0
gcc/config/{netbsd.c => netbsd.cc} | 0
gcc/config/nios2/{nios2.c => nios2.cc} | 2 +-
gcc/config/nvptx/{mkoffload.c => mkoffload.cc} | 0
gcc/config/nvptx/{nvptx-c.c => nvptx-c.cc} | 0
gcc/config/nvptx/nvptx-protos.h | 2 +-
gcc/config/nvptx/{nvptx.c => nvptx.cc} | 2 +-
gcc/config/nvptx/nvptx.h | 2 +-
gcc/config/nvptx/t-nvptx | 4 +-
gcc/config/nvptx/t-omp-device | 2 +-
gcc/config/{openbsd-d.c => openbsd-d.cc} | 0
gcc/config/or1k/{or1k.c => or1k.cc} | 0
gcc/config/pa/elf.h | 2 +-
gcc/config/pa/{pa-d.c => pa-d.cc} | 0
gcc/config/pa/pa-linux.h | 2 +-
gcc/config/pa/pa-netbsd.h | 2 +-
gcc/config/pa/pa-openbsd.h | 2 +-
gcc/config/pa/pa-protos.h | 10 +-
gcc/config/pa/{pa.c => pa.cc} | 8 +-
gcc/config/pa/pa.h | 8 +-
gcc/config/pa/pa.md | 8 +-
gcc/config/pa/som.h | 2 +-
gcc/config/pa/t-pa | 2 +-
gcc/config/pdp11/{pdp11.c => pdp11.cc} | 2 +-
gcc/config/pdp11/pdp11.h | 2 +-
gcc/config/pdp11/pdp11.md | 2 +-
gcc/config/pdp11/t-pdp11 | 2 +-
gcc/config/pru/{pru-passes.c => pru-passes.cc} | 0
gcc/config/pru/{pru-pragma.c => pru-pragma.cc} | 0
gcc/config/pru/{pru.c => pru.cc} | 0
gcc/config/pru/pru.md | 2 +-
gcc/config/pru/t-pru | 4 +-
.../riscv/{riscv-builtins.c => riscv-builtins.cc} | 0
gcc/config/riscv/{riscv-c.c => riscv-c.cc} | 0
gcc/config/riscv/{riscv-d.c => riscv-d.cc} | 0
gcc/config/riscv/riscv-protos.h | 10 +-
...-shorten-memrefs.c => riscv-shorten-memrefs.cc} | 0
gcc/config/riscv/{riscv-sr.c => riscv-sr.cc} | 0
gcc/config/riscv/{riscv.c => riscv.cc} | 2 +-
gcc/config/riscv/riscv.h | 4 +-
gcc/config/riscv/t-riscv | 16 +-
gcc/config/rl78/{rl78-c.c => rl78-c.cc} | 0
gcc/config/rl78/{rl78.c => rl78.cc} | 2 +-
gcc/config/rl78/t-rl78 | 2 +-
gcc/config/rs6000/aix.h | 4 +-
gcc/config/rs6000/aix71.h | 2 +-
gcc/config/rs6000/aix72.h | 2 +-
gcc/config/rs6000/aix73.h | 2 +-
gcc/config/rs6000/darwin.h | 6 +-
.../rs6000/{driver-rs6000.c => driver-rs6000.cc} | 2 +-
gcc/config/rs6000/freebsd.h | 4 +-
gcc/config/rs6000/freebsd64.h | 4 +-
.../rs6000/{host-darwin.c => host-darwin.cc} | 0
.../{host-ppc64-darwin.c => host-ppc64-darwin.cc} | 0
gcc/config/rs6000/lynx.h | 2 +-
gcc/config/rs6000/{rbtree.c => rbtree.cc} | 2 +-
gcc/config/rs6000/rbtree.h | 2 +-
gcc/config/rs6000/{rs6000-c.c => rs6000-c.cc} | 2 +-
.../rs6000/{rs6000-call.c => rs6000-call.cc} | 6 +-
gcc/config/rs6000/rs6000-cpus.def | 2 +-
gcc/config/rs6000/{rs6000-d.c => rs6000-d.cc} | 0
...s6000-gen-builtins.c => rs6000-gen-builtins.cc} | 2 +-
gcc/config/rs6000/rs6000-internal.h | 10 +-
.../rs6000/{rs6000-linux.c => rs6000-linux.cc} | 0
.../rs6000/{rs6000-logue.c => rs6000-logue.cc} | 4 +-
gcc/config/rs6000/rs6000-overload.def | 10 +-
.../rs6000/{rs6000-p8swap.c => rs6000-p8swap.cc} | 4 +-
.../{rs6000-pcrel-opt.c => rs6000-pcrel-opt.cc} | 0
gcc/config/rs6000/rs6000-protos.h | 6 +-
.../rs6000/{rs6000-string.c => rs6000-string.cc} | 0
gcc/config/rs6000/{rs6000.c => rs6000.cc} | 16 +-
gcc/config/rs6000/rs6000.h | 16 +-
gcc/config/rs6000/rs6000.md | 2 +-
gcc/config/rs6000/sysv4.h | 2 +-
gcc/config/rs6000/t-linux | 2 +-
gcc/config/rs6000/t-linux64 | 2 +-
gcc/config/rs6000/t-rs6000 | 34 +-
gcc/config/rs6000/x-darwin | 2 +-
gcc/config/rs6000/x-darwin64 | 2 +-
gcc/config/rs6000/x-rs6000 | 2 +-
gcc/config/rs6000/xcoff.h | 4 +-
gcc/config/rx/{rx.c => rx.cc} | 2 +-
gcc/config/s390/constraints.md | 8 +-
.../s390/{driver-native.c => driver-native.cc} | 2 +-
gcc/config/s390/htmxlintrin.h | 2 +-
gcc/config/s390/s390-builtins.def | 8 +-
gcc/config/s390/s390-builtins.h | 2 +-
gcc/config/s390/{s390-c.c => s390-c.cc} | 2 +-
gcc/config/s390/{s390-d.c => s390-d.cc} | 0
gcc/config/s390/s390-opts.h | 2 +-
gcc/config/s390/s390-protos.h | 10 +-
gcc/config/s390/{s390.c => s390.cc} | 12 +-
gcc/config/s390/s390.h | 8 +-
gcc/config/s390/s390.md | 8 +-
gcc/config/s390/t-s390 | 6 +-
gcc/config/s390/vx-builtins.md | 2 +-
gcc/config/s390/x-native | 2 +-
.../sh/{divtab-sh4-300.c => divtab-sh4-300.cc} | 2 +-
gcc/config/sh/{divtab-sh4.c => divtab-sh4.cc} | 2 +-
gcc/config/sh/{divtab.c => divtab.cc} | 2 +-
gcc/config/sh/elf.h | 2 +-
gcc/config/sh/{sh-c.c => sh-c.cc} | 0
gcc/config/sh/sh-protos.h | 2 +-
gcc/config/sh/{sh.c => sh.cc} | 6 +-
gcc/config/sh/sh.h | 8 +-
gcc/config/sh/t-sh | 4 +-
gcc/config/{sol2-c.c => sol2-c.cc} | 0
gcc/config/{sol2-cxx.c => sol2-cxx.cc} | 0
gcc/config/{sol2-d.c => sol2-d.cc} | 0
gcc/config/sol2-protos.h | 6 +-
gcc/config/{sol2-stubs.c => sol2-stubs.cc} | 0
gcc/config/{sol2.c => sol2.cc} | 0
gcc/config/sol2.h | 4 +-
.../sparc/{driver-sparc.c => driver-sparc.cc} | 2 +-
gcc/config/sparc/freebsd.h | 4 +-
gcc/config/sparc/{sparc-c.c => sparc-c.cc} | 0
gcc/config/sparc/{sparc-d.c => sparc-d.cc} | 0
gcc/config/sparc/sparc-protos.h | 2 +-
gcc/config/sparc/{sparc.c => sparc.cc} | 6 +-
gcc/config/sparc/sparc.h | 6 +-
gcc/config/sparc/sparc.md | 4 +-
gcc/config/sparc/t-sparc | 4 +-
gcc/config/sparc/x-sparc | 2 +-
gcc/config/stormy16/{stormy16.c => stormy16.cc} | 2 +-
gcc/config/t-darwin | 10 +-
gcc/config/t-dragonfly | 2 +-
gcc/config/t-freebsd | 2 +-
gcc/config/t-glibc | 4 +-
gcc/config/t-linux | 2 +-
gcc/config/t-netbsd | 4 +-
gcc/config/t-openbsd | 2 +-
gcc/config/t-pnt16-warn | 2 +-
gcc/config/t-sol2 | 10 +-
gcc/config/t-vxworks | 4 +-
gcc/config/t-winnt | 2 +-
gcc/config/tilegx/{mul-tables.c => mul-tables.cc} | 0
gcc/config/tilegx/t-tilegx | 6 +-
gcc/config/tilegx/{tilegx-c.c => tilegx-c.cc} | 2 +-
gcc/config/tilegx/tilegx-protos.h | 2 +-
gcc/config/tilegx/{tilegx.c => tilegx.cc} | 0
gcc/config/tilegx/tilegx.md | 2 +-
gcc/config/tilepro/{mul-tables.c => mul-tables.cc} | 0
gcc/config/tilepro/t-tilepro | 6 +-
gcc/config/tilepro/{tilepro-c.c => tilepro-c.cc} | 2 +-
gcc/config/tilepro/{tilepro.c => tilepro.cc} | 0
gcc/config/v850/t-v850 | 4 +-
gcc/config/v850/{v850-c.c => v850-c.cc} | 0
gcc/config/v850/v850-protos.h | 2 +-
gcc/config/v850/{v850.c => v850.cc} | 4 +-
gcc/config/v850/v850.h | 6 +-
gcc/config/vax/{vax.c => vax.cc} | 4 +-
gcc/config/vax/vax.h | 2 +-
gcc/config/vax/vax.md | 2 +-
gcc/config/visium/{visium.c => visium.cc} | 2 +-
gcc/config/visium/visium.h | 6 +-
gcc/config/vms/t-vms | 6 +-
gcc/config/vms/{vms-c.c => vms-c.cc} | 0
gcc/config/vms/vms-crtlmap.map | 2 +-
gcc/config/vms/{vms-f.c => vms-f.cc} | 0
gcc/config/vms/vms-protos.h | 4 +-
gcc/config/vms/{vms.c => vms.cc} | 0
gcc/config/vx-common.h | 2 +-
gcc/config/{vxworks-c.c => vxworks-c.cc} | 0
gcc/config/{vxworks.c => vxworks.cc} | 0
gcc/config/{winnt-c.c => winnt-c.cc} | 0
gcc/config/x-darwin | 2 +-
gcc/config/x-hpux | 4 +-
gcc/config/x-linux | 2 +-
gcc/config/x-netbsd | 4 +-
gcc/config/x-openbsd | 4 +-
gcc/config/x-solaris | 2 +-
gcc/config/xtensa/xtensa-protos.h | 2 +-
gcc/config/xtensa/{xtensa.c => xtensa.cc} | 4 +-
gcc/config/xtensa/xtensa.h | 2 +-
gcc/configure | 14 +-
gcc/configure.ac | 14 +-
gcc/{context.c => context.cc} | 2 +-
gcc/{convert.c => convert.cc} | 0
gcc/convert.h | 2 +-
gcc/coretypes.h | 2 +-
gcc/{coverage.c => coverage.cc} | 2 +-
gcc/coverage.h | 2 +-
gcc/cp/ChangeLog | 161 ++
gcc/cp/Make-lang.in | 8 +-
gcc/cp/{call.c => call.cc} | 0
gcc/cp/{class.c => class.cc} | 0
gcc/cp/config-lang.in | 34 +-
gcc/cp/{constexpr.c => constexpr.cc} | 2 +-
gcc/cp/coroutines.cc | 2 +-
gcc/cp/{cp-gimplify.c => cp-gimplify.cc} | 4 +-
gcc/cp/{cp-lang.c => cp-lang.cc} | 4 +-
gcc/cp/{cp-objcp-common.c => cp-objcp-common.cc} | 8 +-
gcc/cp/cp-objcp-common.h | 4 +-
gcc/cp/cp-tree.h | 84 +-
gcc/cp/{cp-ubsan.c => cp-ubsan.cc} | 0
gcc/cp/{cvt.c => cvt.cc} | 18 +-
gcc/cp/{cxx-pretty-print.c => cxx-pretty-print.cc} | 0
gcc/cp/{decl.c => decl.cc} | 8 +-
gcc/cp/{decl2.c => decl2.cc} | 2 +-
gcc/cp/{dump.c => dump.cc} | 0
gcc/cp/{error.c => error.cc} | 2 +-
gcc/cp/{except.c => except.cc} | 0
gcc/cp/{expr.c => expr.cc} | 0
gcc/cp/{friend.c => friend.cc} | 0
gcc/cp/{g++spec.c => g++spec.cc} | 0
gcc/cp/{init.c => init.cc} | 4 +-
gcc/cp/{lambda.c => lambda.cc} | 0
gcc/cp/lang-specs.h | 2 +-
gcc/cp/{lex.c => lex.cc} | 0
gcc/cp/{mangle.c => mangle.cc} | 0
gcc/cp/{method.c => method.cc} | 2 +-
gcc/cp/module.cc | 4 +-
gcc/cp/{name-lookup.c => name-lookup.cc} | 2 +-
gcc/cp/name-lookup.h | 2 +-
gcc/cp/{optimize.c => optimize.cc} | 0
gcc/cp/{parser.c => parser.cc} | 4 +-
gcc/cp/parser.h | 2 +-
gcc/cp/{pt.c => pt.cc} | 4 +-
gcc/cp/{ptree.c => ptree.cc} | 0
gcc/cp/{rtti.c => rtti.cc} | 0
gcc/cp/{search.c => search.cc} | 0
gcc/cp/{semantics.c => semantics.cc} | 6 +-
gcc/cp/{tree.c => tree.cc} | 4 +-
gcc/cp/{typeck.c => typeck.cc} | 8 +-
gcc/cp/{typeck2.c => typeck2.cc} | 0
...class-hierarchy.c => vtable-class-hierarchy.cc} | 2 +-
gcc/{cppbuiltin.c => cppbuiltin.cc} | 0
gcc/{cppdefault.c => cppdefault.cc} | 0
gcc/cppdefault.h | 2 +-
gcc/{cprop.c => cprop.cc} | 4 +-
gcc/{cse.c => cse.cc} | 4 +-
gcc/{cselib.c => cselib.cc} | 0
gcc/{ctfc.c => ctfc.cc} | 0
gcc/ctfc.h | 4 +-
gcc/{ctfout.c => ctfout.cc} | 0
gcc/d/ChangeLog | 6 +
gcc/d/d-gimplify.cc | 2 +-
gcc/d/d-incpath.cc | 2 +-
gcc/d/lang-specs.h | 2 +-
gcc/{data-streamer-in.c => data-streamer-in.cc} | 0
gcc/{data-streamer-out.c => data-streamer-out.cc} | 0
gcc/{data-streamer.c => data-streamer.cc} | 0
gcc/data-streamer.h | 6 +-
gcc/{dbgcnt.c => dbgcnt.cc} | 0
gcc/dbgcnt.def | 2 +-
gcc/{dbxout.c => dbxout.cc} | 4 +-
gcc/dbxout.h | 2 +-
gcc/{dce.c => dce.cc} | 0
gcc/{ddg.c => ddg.cc} | 0
gcc/{debug.c => debug.cc} | 0
gcc/debug.h | 8 +-
gcc/{df-core.c => df-core.cc} | 4 +-
gcc/{df-problems.c => df-problems.cc} | 0
gcc/{df-scan.c => df-scan.cc} | 4 +-
gcc/df.h | 8 +-
gcc/{dfp.c => dfp.cc} | 2 +-
gcc/{diagnostic-color.c => diagnostic-color.cc} | 2 +-
gcc/diagnostic-event-id.h | 2 +-
...ostic-show-locus.c => diagnostic-show-locus.cc} | 2 +-
gcc/{diagnostic-spec.c => diagnostic-spec.cc} | 0
gcc/{diagnostic.c => diagnostic.cc} | 8 +-
gcc/doc/avr-mmcu.texi | 4 +-
gcc/doc/cfg.texi | 2 +-
gcc/doc/contrib.texi | 2 +-
gcc/doc/cppinternals.texi | 6 +-
gcc/doc/extend.texi | 2 +-
gcc/doc/generic.texi | 8 +-
gcc/doc/gimple.texi | 8 +-
gcc/doc/gty.texi | 8 +-
gcc/doc/invoke.texi | 6 +-
gcc/doc/loop.texi | 2 +-
gcc/doc/lto.texi | 40 +-
gcc/doc/match-and-simplify.texi | 2 +-
gcc/doc/md.texi | 6 +-
gcc/doc/optinfo.texi | 4 +-
gcc/doc/options.texi | 2 +-
gcc/doc/passes.texi | 288 +--
gcc/doc/plugins.texi | 4 +-
gcc/doc/rtl.texi | 10 +-
gcc/doc/sourcebuild.texi | 6 +-
gcc/doc/tm.texi | 46 +-
gcc/doc/tm.texi.in | 28 +-
gcc/doc/tree-ssa.texi | 6 +-
gcc/{dojump.c => dojump.cc} | 2 +-
gcc/dojump.h | 2 +-
gcc/{dominance.c => dominance.cc} | 0
gcc/{domwalk.c => domwalk.cc} | 0
gcc/{double-int.c => double-int.cc} | 0
gcc/{dse.c => dse.cc} | 0
gcc/{dumpfile.c => dumpfile.cc} | 34 +-
gcc/dumpfile.h | 18 +-
gcc/{dwarf2asm.c => dwarf2asm.cc} | 2 +-
gcc/{dwarf2cfi.c => dwarf2cfi.cc} | 0
gcc/{dwarf2ctf.c => dwarf2ctf.cc} | 0
gcc/dwarf2ctf.h | 4 +-
gcc/{dwarf2out.c => dwarf2out.cc} | 24 +-
gcc/dwarf2out.h | 8 +-
gcc/{early-remat.c => early-remat.cc} | 0
gcc/{edit-context.c => edit-context.cc} | 0
gcc/{emit-rtl.c => emit-rtl.cc} | 6 +-
gcc/emit-rtl.h | 6 +-
gcc/{errors.c => errors.cc} | 8 +-
gcc/{et-forest.c => et-forest.cc} | 2 +-
gcc/{except.c => except.cc} | 18 +-
gcc/{explow.c => explow.cc} | 4 +-
gcc/explow.h | 2 +-
gcc/{expmed.c => expmed.cc} | 0
gcc/expmed.h | 2 +-
gcc/{expr.c => expr.cc} | 10 +-
gcc/{fibonacci_heap.c => fibonacci_heap.cc} | 0
gcc/{file-find.c => file-find.cc} | 0
gcc/{file-prefix-map.c => file-prefix-map.cc} | 2 +-
gcc/{final.c => final.cc} | 10 +-
gcc/{fixed-value.c => fixed-value.cc} | 0
gcc/fixed-value.h | 2 +-
gcc/flag-types.h | 20 +-
gcc/{fold-const-call.c => fold-const-call.cc} | 0
gcc/{fold-const.c => fold-const.cc} | 8 +-
gcc/fortran/ChangeLog | 233 ++
gcc/fortran/{arith.c => arith.cc} | 0
gcc/fortran/{array.c => array.cc} | 0
gcc/fortran/{bbt.c => bbt.cc} | 0
gcc/fortran/{check.c => check.cc} | 4 +-
gcc/fortran/{class.c => class.cc} | 4 +-
gcc/fortran/config-lang.in | 2 +-
gcc/fortran/{constructor.c => constructor.cc} | 0
gcc/fortran/{convert.c => convert.cc} | 0
gcc/fortran/{cpp.c => cpp.cc} | 4 +-
gcc/fortran/{data.c => data.cc} | 8 +-
gcc/fortran/{decl.c => decl.cc} | 20 +-
gcc/fortran/{dependency.c => dependency.cc} | 2 +-
.../{dump-parse-tree.c => dump-parse-tree.cc} | 0
gcc/fortran/{error.c => error.cc} | 2 +-
gcc/fortran/{expr.c => expr.cc} | 8 +-
gcc/fortran/{f95-lang.c => f95-lang.cc} | 2 +-
.../{frontend-passes.c => frontend-passes.cc} | 0
gcc/fortran/gfc-internals.texi | 12 +-
gcc/fortran/gfortran.h | 86 +-
gcc/fortran/{gfortranspec.c => gfortranspec.cc} | 4 +-
gcc/fortran/{interface.c => interface.cc} | 2 +-
gcc/fortran/{intrinsic.c => intrinsic.cc} | 4 +-
gcc/fortran/{io.c => io.cc} | 0
gcc/fortran/{iresolve.c => iresolve.cc} | 4 +-
gcc/fortran/iso-c-binding.def | 2 +-
gcc/fortran/lang-specs.h | 4 +-
gcc/fortran/libgfortran.h | 2 +-
gcc/fortran/{match.c => match.cc} | 16 +-
gcc/fortran/match.h | 28 +-
gcc/fortran/{matchexp.c => matchexp.cc} | 2 +-
gcc/fortran/mathbuiltins.def | 2 +-
gcc/fortran/{misc.c => misc.cc} | 0
gcc/fortran/{module.c => module.cc} | 2 +-
gcc/fortran/{openmp.c => openmp.cc} | 4 +-
gcc/fortran/{options.c => options.cc} | 0
gcc/fortran/{parse.c => parse.cc} | 6 +-
gcc/fortran/{primary.c => primary.cc} | 0
gcc/fortran/{resolve.c => resolve.cc} | 22 +-
gcc/fortran/{scanner.c => scanner.cc} | 0
gcc/fortran/{simplify.c => simplify.cc} | 2 +-
gcc/fortran/{st.c => st.cc} | 0
gcc/fortran/{symbol.c => symbol.cc} | 4 +-
gcc/fortran/{target-memory.c => target-memory.cc} | 2 +-
gcc/fortran/target-memory.h | 2 +-
gcc/fortran/{trans-array.c => trans-array.cc} | 12 +-
gcc/fortran/{trans-common.c => trans-common.cc} | 0
gcc/fortran/{trans-const.c => trans-const.cc} | 2 +-
gcc/fortran/{trans-decl.c => trans-decl.cc} | 12 +-
gcc/fortran/{trans-expr.c => trans-expr.cc} | 16 +-
.../{trans-intrinsic.c => trans-intrinsic.cc} | 8 +-
gcc/fortran/{trans-io.c => trans-io.cc} | 2 +-
gcc/fortran/{trans-openmp.c => trans-openmp.cc} | 8 +-
gcc/fortran/{trans-stmt.c => trans-stmt.cc} | 4 +-
gcc/fortran/trans-stmt.h | 8 +-
gcc/fortran/{trans-types.c => trans-types.cc} | 2 +-
gcc/fortran/trans-types.h | 2 +-
gcc/fortran/{trans.c => trans.cc} | 4 +-
gcc/fortran/trans.h | 14 +-
gcc/{fp-test.c => fp-test.cc} | 2 +-
gcc/{function-tests.c => function-tests.cc} | 0
gcc/{function.c => function.cc} | 4 +-
gcc/function.h | 2 +-
gcc/{fwprop.c => fwprop.cc} | 2 +-
gcc/{gcc-ar.c => gcc-ar.cc} | 0
gcc/{gcc-main.c => gcc-main.cc} | 4 +-
gcc/{gcc-rich-location.c => gcc-rich-location.cc} | 0
gcc/gcc-rich-location.h | 2 +-
gcc/gcc-symtab.h | 2 +-
gcc/{gcc.c => gcc.cc} | 16 +-
gcc/gcc.h | 6 +-
gcc/{gcov-dump.c => gcov-dump.cc} | 2 +-
gcc/{gcov-io.c => gcov-io.cc} | 0
gcc/{gcov-tool.c => gcov-tool.cc} | 0
gcc/{gcov.c => gcov.cc} | 10 +-
gcc/{gcse-common.c => gcse-common.cc} | 2 +-
gcc/{gcse.c => gcse.cc} | 4 +-
gcc/{genattr-common.c => genattr-common.cc} | 2 +-
gcc/{genattr.c => genattr.cc} | 0
gcc/{genattrtab.c => genattrtab.cc} | 6 +-
gcc/{genautomata.c => genautomata.cc} | 2 +-
gcc/{gencfn-macros.c => gencfn-macros.cc} | 0
gcc/{gencheck.c => gencheck.cc} | 0
gcc/{genchecksum.c => genchecksum.cc} | 0
gcc/{gencodes.c => gencodes.cc} | 0
gcc/{genconditions.c => genconditions.cc} | 2 +-
gcc/{genconfig.c => genconfig.cc} | 0
gcc/{genconstants.c => genconstants.cc} | 2 +-
gcc/{genemit.c => genemit.cc} | 4 +-
gcc/{genenums.c => genenums.cc} | 0
...{generic-match-head.c => generic-match-head.cc} | 2 +-
gcc/{genextract.c => genextract.cc} | 2 +-
gcc/{genflags.c => genflags.cc} | 0
gcc/{gengenrtl.c => gengenrtl.cc} | 2 +-
gcc/{gengtype-parse.c => gengtype-parse.cc} | 2 +-
gcc/{gengtype-state.c => gengtype-state.cc} | 8 +-
gcc/{gengtype.c => gengtype.cc} | 78 +-
gcc/gengtype.h | 8 +-
gcc/{genhooks.c => genhooks.cc} | 0
gcc/{genmatch.c => genmatch.cc} | 4 +-
gcc/{genmddeps.c => genmddeps.cc} | 2 +-
gcc/{genmddump.c => genmddump.cc} | 0
gcc/{genmodes.c => genmodes.cc} | 4 +-
gcc/{genopinit.c => genopinit.cc} | 0
gcc/{genoutput.c => genoutput.cc} | 0
gcc/{genpeep.c => genpeep.cc} | 2 +-
gcc/{genpreds.c => genpreds.cc} | 4 +-
gcc/{genrecog.c => genrecog.cc} | 18 +-
gcc/{gensupport.c => gensupport.cc} | 8 +-
gcc/gensupport.h | 12 +-
gcc/{gentarget-def.c => gentarget-def.cc} | 0
gcc/{genversion.c => genversion.cc} | 0
gcc/{ggc-common.c => ggc-common.cc} | 0
gcc/ggc-internal.h | 2 +-
gcc/{ggc-none.c => ggc-none.cc} | 0
gcc/{ggc-page.c => ggc-page.cc} | 0
gcc/{ggc-tests.c => ggc-tests.cc} | 0
gcc/{gimple-builder.c => gimple-builder.cc} | 0
gcc/{gimple-expr.c => gimple-expr.cc} | 0
gcc/{gimple-fold.c => gimple-fold.cc} | 6 +-
gcc/gimple-fold.h | 2 +-
gcc/{gimple-iterator.c => gimple-iterator.cc} | 0
gcc/{gimple-laddress.c => gimple-laddress.cc} | 0
gcc/{gimple-loop-jam.c => gimple-loop-jam.cc} | 0
gcc/{gimple-low.c => gimple-low.cc} | 2 +-
gcc/{gimple-match-head.c => gimple-match-head.cc} | 4 +-
...imple-pretty-print.c => gimple-pretty-print.cc} | 0
gcc/gimple-pretty-print.h | 2 +-
...imple-ssa-backprop.c => gimple-ssa-backprop.cc} | 0
...a-evrp-analyze.c => gimple-ssa-evrp-analyze.cc} | 0
gcc/{gimple-ssa-evrp.c => gimple-ssa-evrp.cc} | 0
...isolate-paths.c => gimple-ssa-isolate-paths.cc} | 0
...ull-compare.c => gimple-ssa-nonnull-compare.cc} | 0
...ssa-split-paths.c => gimple-ssa-split-paths.cc} | 0
...{gimple-ssa-sprintf.c => gimple-ssa-sprintf.cc} | 4 +-
...store-merging.c => gimple-ssa-store-merging.cc} | 0
...eduction.c => gimple-ssa-strength-reduction.cc} | 0
...ssa-warn-alloca.c => gimple-ssa-warn-alloca.cc} | 0
...warn-restrict.c => gimple-ssa-warn-restrict.cc} | 0
...{gimple-streamer-in.c => gimple-streamer-in.cc} | 0
...imple-streamer-out.c => gimple-streamer-out.cc} | 0
gcc/gimple-streamer.h | 4 +-
gcc/{gimple-walk.c => gimple-walk.cc} | 0
...e-warn-recursion.c => gimple-warn-recursion.cc} | 0
gcc/{gimple.c => gimple.cc} | 0
gcc/gimple.h | 4 +-
gcc/{gimplify-me.c => gimplify-me.cc} | 0
gcc/{gimplify.c => gimplify.cc} | 12 +-
gcc/go/ChangeLog | 17 +
gcc/go/config-lang.in | 2 +-
gcc/go/{go-backend.c => go-backend.cc} | 2 +-
gcc/go/{go-lang.c => go-lang.cc} | 2 +-
gcc/go/{gospec.c => gospec.cc} | 2 +-
gcc/go/lang-specs.h | 2 +-
gcc/{godump.c => godump.cc} | 0
gcc/{graph.c => graph.cc} | 0
gcc/{graphds.c => graphds.cc} | 0
...phite-dependences.c => graphite-dependences.cc} | 0
...t-to-gimple.c => graphite-isl-ast-to-gimple.cc} | 2 +-
...ite-optimize-isl.c => graphite-optimize-isl.cc} | 0
gcc/{graphite-poly.c => graphite-poly.cc} | 0
...scop-detection.c => graphite-scop-detection.cc} | 0
...ite-sese-to-poly.c => graphite-sese-to-poly.cc} | 0
gcc/{graphite.c => graphite.cc} | 0
gcc/{haifa-sched.c => haifa-sched.cc} | 20 +-
gcc/{hash-map-tests.c => hash-map-tests.cc} | 0
gcc/{hash-set-tests.c => hash-set-tests.cc} | 0
gcc/{hash-table.c => hash-table.cc} | 0
gcc/{hooks.c => hooks.cc} | 0
gcc/{host-default.c => host-default.cc} | 0
gcc/{hw-doloop.c => hw-doloop.cc} | 0
gcc/{hwint.c => hwint.cc} | 0
gcc/{ifcvt.c => ifcvt.cc} | 4 +-
gcc/{inchash.c => inchash.cc} | 0
gcc/inchash.h | 2 +-
gcc/{incpath.c => incpath.cc} | 2 +-
gcc/{init-regs.c => init-regs.cc} | 0
gcc/{input.c => input.cc} | 18 +-
gcc/input.h | 4 +-
gcc/{internal-fn.c => internal-fn.cc} | 4 +-
gcc/{intl.c => intl.cc} | 0
gcc/{ipa-comdats.c => ipa-comdats.cc} | 0
gcc/{ipa-cp.c => ipa-cp.cc} | 6 +-
gcc/{ipa-devirt.c => ipa-devirt.cc} | 0
gcc/{ipa-fnsummary.c => ipa-fnsummary.cc} | 6 +-
gcc/ipa-fnsummary.h | 6 +-
gcc/ipa-free-lang-data.cc | 4 +-
gcc/{ipa-icf-gimple.c => ipa-icf-gimple.cc} | 0
gcc/{ipa-icf.c => ipa-icf.cc} | 0
...pa-inline-analysis.c => ipa-inline-analysis.cc} | 0
...-inline-transform.c => ipa-inline-transform.cc} | 0
gcc/{ipa-inline.c => ipa-inline.cc} | 4 +-
gcc/ipa-inline.h | 6 +-
gcc/{ipa-modref-tree.c => ipa-modref-tree.cc} | 0
gcc/{ipa-modref.c => ipa-modref.cc} | 8 +-
...am-manipulation.c => ipa-param-manipulation.cc} | 4 +-
...-polymorphic-call.c => ipa-polymorphic-call.cc} | 0
gcc/{ipa-predicate.c => ipa-predicate.cc} | 0
gcc/{ipa-profile.c => ipa-profile.cc} | 0
gcc/{ipa-prop.c => ipa-prop.cc} | 2 +-
gcc/ipa-prop.h | 8 +-
gcc/{ipa-pure-const.c => ipa-pure-const.cc} | 0
gcc/{ipa-ref.c => ipa-ref.cc} | 0
gcc/{ipa-reference.c => ipa-reference.cc} | 2 +-
gcc/ipa-reference.h | 2 +-
gcc/{ipa-split.c => ipa-split.cc} | 2 +-
gcc/{ipa-sra.c => ipa-sra.cc} | 2 +-
gcc/{ipa-utils.c => ipa-utils.cc} | 0
gcc/ipa-utils.h | 8 +-
gcc/{ipa-visibility.c => ipa-visibility.cc} | 0
gcc/{ipa.c => ipa.cc} | 0
gcc/{ira-build.c => ira-build.cc} | 6 +-
gcc/{ira-color.c => ira-color.cc} | 4 +-
gcc/{ira-conflicts.c => ira-conflicts.cc} | 2 +-
gcc/{ira-costs.c => ira-costs.cc} | 0
gcc/{ira-emit.c => ira-emit.cc} | 0
gcc/ira-int.h | 20 +-
gcc/{ira-lives.c => ira-lives.cc} | 2 +-
gcc/{ira.c => ira.cc} | 32 +-
gcc/ira.h | 4 +-
gcc/jit/ChangeLog | 156 ++
gcc/jit/config-lang.in | 2 +-
gcc/jit/docs/_build/texinfo/libgccjit.texi | 18 +-
gcc/jit/docs/internals/index.rst | 12 +-
gcc/jit/{dummy-frontend.c => dummy-frontend.cc} | 0
gcc/jit/{jit-builtins.c => jit-builtins.cc} | 4 +-
gcc/jit/{jit-logging.c => jit-logging.cc} | 0
gcc/jit/{jit-playback.c => jit-playback.cc} | 68 +-
gcc/jit/{jit-recording.c => jit-recording.cc} | 2 +-
gcc/jit/jit-recording.h | 2 +-
gcc/jit/{jit-result.c => jit-result.cc} | 0
gcc/jit/{jit-spec.c => jit-spec.cc} | 0
gcc/jit/{jit-tempdir.c => jit-tempdir.cc} | 0
gcc/jit/{jit-w32.c => jit-w32.cc} | 0
gcc/jit/{libgccjit.c => libgccjit.cc} | 200 +-
gcc/jit/notes.txt | 6 +-
gcc/{jump.c => jump.cc} | 0
gcc/{langhooks.c => langhooks.cc} | 2 +-
gcc/langhooks.h | 12 +-
gcc/{lcm.c => lcm.cc} | 0
gcc/libfuncs.h | 2 +-
gcc/{lists.c => lists.cc} | 0
gcc/{loop-doloop.c => loop-doloop.cc} | 2 +-
gcc/{loop-init.c => loop-init.cc} | 2 +-
gcc/{loop-invariant.c => loop-invariant.cc} | 2 +-
gcc/{loop-iv.c => loop-iv.cc} | 0
gcc/{loop-unroll.c => loop-unroll.cc} | 0
gcc/{lower-subreg.c => lower-subreg.cc} | 0
gcc/lower-subreg.h | 2 +-
gcc/{lra-assigns.c => lra-assigns.cc} | 0
gcc/{lra-coalesce.c => lra-coalesce.cc} | 0
gcc/{lra-constraints.c => lra-constraints.cc} | 2 +-
gcc/{lra-eliminations.c => lra-eliminations.cc} | 0
gcc/lra-int.h | 24 +-
gcc/{lra-lives.c => lra-lives.cc} | 0
gcc/{lra-remat.c => lra-remat.cc} | 0
gcc/{lra-spills.c => lra-spills.cc} | 2 +-
gcc/{lra.c => lra.cc} | 2 +-
gcc/{lto-cgraph.c => lto-cgraph.cc} | 0
gcc/{lto-compress.c => lto-compress.cc} | 0
gcc/lto-compress.h | 2 +-
gcc/{lto-opts.c => lto-opts.cc} | 0
gcc/{lto-section-in.c => lto-section-in.cc} | 0
gcc/{lto-section-out.c => lto-section-out.cc} | 0
gcc/{lto-streamer-in.c => lto-streamer-in.cc} | 0
gcc/{lto-streamer-out.c => lto-streamer-out.cc} | 6 +-
gcc/{lto-streamer.c => lto-streamer.cc} | 0
gcc/lto-streamer.h | 22 +-
gcc/{lto-wrapper.c => lto-wrapper.cc} | 2 +-
gcc/lto/ChangeLog | 32 +
gcc/lto/{common.c => common.cc} | 0
gcc/lto/config-lang.in | 2 +-
gcc/lto/lang-specs.h | 2 +-
gcc/lto/{lto-common.c => lto-common.cc} | 2 +-
gcc/lto/lto-common.h | 2 +-
gcc/lto/{lto-dump.c => lto-dump.cc} | 2 +-
gcc/lto/{lto-lang.c => lto-lang.cc} | 6 +-
gcc/lto/{lto-object.c => lto-object.cc} | 0
gcc/lto/{lto-partition.c => lto-partition.cc} | 0
gcc/lto/{lto-symtab.c => lto-symtab.cc} | 0
gcc/lto/{lto.c => lto.cc} | 2 +-
gcc/lto/lto.h | 4 +-
gcc/machmode.def | 2 +-
gcc/machmode.h | 4 +-
gcc/{main.c => main.cc} | 2 +-
gcc/match.pd | 16 +-
gcc/{mcf.c => mcf.cc} | 0
gcc/{mode-switching.c => mode-switching.cc} | 0
gcc/{modulo-sched.c => modulo-sched.cc} | 0
gcc/{multiple_target.c => multiple_target.cc} | 0
gcc/objc/ChangeLog | 36 +
gcc/objc/Make-lang.in | 2 +-
gcc/objc/config-lang.in | 2 +-
gcc/objc/lang-specs.h | 2 +-
gcc/objc/{objc-act.c => objc-act.cc} | 12 +-
gcc/objc/objc-act.h | 4 +-
gcc/objc/{objc-encoding.c => objc-encoding.cc} | 0
...runtime-abi-01.c => objc-gnu-runtime-abi-01.cc} | 2 +-
gcc/objc/{objc-lang.c => objc-lang.cc} | 2 +-
gcc/objc/{objc-map.c => objc-map.cc} | 2 +-
...untime-abi-01.c => objc-next-runtime-abi-01.cc} | 4 +-
...untime-abi-02.c => objc-next-runtime-abi-02.cc} | 0
...ed-support.c => objc-runtime-shared-support.cc} | 2 +-
gcc/objc/objc-runtime-shared-support.h | 2 +-
gcc/objcp/ChangeLog | 15 +
gcc/objcp/Make-lang.in | 16 +-
gcc/objcp/config-lang.in | 16 +-
gcc/objcp/lang-specs.h | 2 +-
gcc/objcp/{objcp-decl.c => objcp-decl.cc} | 2 +-
gcc/objcp/{objcp-lang.c => objcp-lang.cc} | 2 +-
gcc/omp-builtins.def | 4 +-
gcc/{omp-expand.c => omp-expand.cc} | 4 +-
gcc/{omp-general.c => omp-general.cc} | 0
gcc/{omp-low.c => omp-low.cc} | 6 +-
gcc/omp-oacc-neuter-broadcast.cc | 12 +-
gcc/{omp-offload.c => omp-offload.cc} | 6 +-
gcc/{omp-simd-clone.c => omp-simd-clone.cc} | 0
gcc/{opt-suggestions.c => opt-suggestions.cc} | 0
gcc/{optabs-libfuncs.c => optabs-libfuncs.cc} | 0
gcc/{optabs-query.c => optabs-query.cc} | 2 +-
gcc/{optabs-tree.c => optabs-tree.cc} | 0
gcc/{optabs.c => optabs.cc} | 0
gcc/optc-gen.awk | 2 +-
gcc/optc-save-gen.awk | 2 +-
gcc/optinfo-emit-json.cc | 4 +-
gcc/{opts-common.c => opts-common.cc} | 2 +-
gcc/{opts-global.c => opts-global.cc} | 0
gcc/{opts.c => opts.cc} | 0
gcc/output.h | 16 +-
gcc/pass_manager.h | 2 +-
gcc/{passes.c => passes.cc} | 0
gcc/{plugin.c => plugin.cc} | 2 +-
gcc/plugin.def | 2 +-
gcc/plugin.h | 2 +-
gcc/po/ChangeLog | 4 +
gcc/po/EXCLUDES | 44 +-
gcc/pointer-query.cc | 2 +-
gcc/{postreload-gcse.c => postreload-gcse.cc} | 2 +-
gcc/{postreload.c => postreload.cc} | 0
gcc/{predict.c => predict.cc} | 0
gcc/predict.h | 4 +-
gcc/{prefix.c => prefix.cc} | 0
gcc/prefix.h | 2 +-
gcc/{pretty-print.c => pretty-print.cc} | 0
...{print-rtl-function.c => print-rtl-function.cc} | 0
gcc/{print-rtl.c => print-rtl.cc} | 0
gcc/{print-tree.c => print-tree.cc} | 0
gcc/{profile-count.c => profile-count.cc} | 0
gcc/{profile.c => profile.cc} | 0
gcc/profile.h | 2 +-
gcc/{read-md.c => read-md.cc} | 2 +-
gcc/read-md.h | 10 +-
gcc/{read-rtl-function.c => read-rtl-function.cc} | 8 +-
gcc/{read-rtl.c => read-rtl.cc} | 2 +-
gcc/{real.c => real.cc} | 2 +-
gcc/real.h | 8 +-
gcc/{realmpfr.c => realmpfr.cc} | 0
gcc/{recog.c => recog.cc} | 10 +-
gcc/recog.h | 8 +-
gcc/{ree.c => ree.cc} | 0
gcc/reg-notes.def | 2 +-
gcc/{reg-stack.c => reg-stack.cc} | 2 +-
gcc/{regcprop.c => regcprop.cc} | 0
gcc/{reginfo.c => reginfo.cc} | 0
gcc/{regrename.c => regrename.cc} | 0
gcc/regs.h | 2 +-
gcc/regset.h | 2 +-
gcc/{regstat.c => regstat.cc} | 0
gcc/{reload.c => reload.cc} | 16 +-
gcc/reload.h | 8 +-
gcc/{reload1.c => reload1.cc} | 4 +-
gcc/{reorg.c => reorg.cc} | 12 +-
gcc/{resource.c => resource.cc} | 0
gcc/{rtl-error.c => rtl-error.cc} | 0
gcc/{rtl-tests.c => rtl-tests.cc} | 0
gcc/{rtl.c => rtl.cc} | 0
gcc/rtl.def | 12 +-
gcc/rtl.h | 146 +-
gcc/{rtlanal.c => rtlanal.cc} | 10 +-
gcc/rtlanal.h | 4 +-
gcc/{rtlhash.c => rtlhash.cc} | 0
gcc/{rtlhooks.c => rtlhooks.cc} | 0
...{rtx-vector-builder.c => rtx-vector-builder.cc} | 0
gcc/{run-rtl-passes.c => run-rtl-passes.cc} | 4 +-
gcc/rust/backend/rust-compile-expr.cc | 4 +-
gcc/rust/backend/rust-compile-type.cc | 2 +-
gcc/rust/backend/rust-constexpr.cc | 4 +-
gcc/rust/lang-specs.h | 2 +-
gcc/rust/rust-lang.cc | 2 +-
gcc/{sancov.c => sancov.cc} | 0
gcc/sanitizer.def | 6 +-
gcc/{sanopt.c => sanopt.cc} | 0
gcc/{sbitmap.c => sbitmap.cc} | 0
gcc/{sched-deps.c => sched-deps.cc} | 2 +-
gcc/{sched-ebb.c => sched-ebb.cc} | 6 +-
gcc/sched-int.h | 28 +-
gcc/{sched-rgn.c => sched-rgn.cc} | 2 +-
gcc/{sel-sched-dump.c => sel-sched-dump.cc} | 2 +-
gcc/sel-sched-dump.h | 2 +-
gcc/{sel-sched-ir.c => sel-sched-ir.cc} | 16 +-
gcc/sel-sched-ir.h | 8 +-
gcc/{sel-sched.c => sel-sched.cc} | 20 +-
...elftest-diagnostic.c => selftest-diagnostic.cc} | 0
gcc/{selftest-rtl.c => selftest-rtl.cc} | 0
...{selftest-run-tests.c => selftest-run-tests.cc} | 4 +-
gcc/{selftest.c => selftest.cc} | 0
gcc/selftest.h | 4 +-
gcc/{sese.c => sese.cc} | 0
gcc/{shrink-wrap.c => shrink-wrap.cc} | 2 +-
gcc/shrink-wrap.h | 2 +-
gcc/{simplify-rtx.c => simplify-rtx.cc} | 8 +-
gcc/{sparseset.c => sparseset.cc} | 0
gcc/{spellcheck-tree.c => spellcheck-tree.cc} | 0
gcc/spellcheck-tree.h | 2 +-
gcc/{spellcheck.c => spellcheck.cc} | 0
gcc/spellcheck.h | 2 +-
gcc/{sreal.c => sreal.cc} | 0
gcc/{stack-ptr-mod.c => stack-ptr-mod.cc} | 0
gcc/{statistics.c => statistics.cc} | 0
gcc/statistics.h | 2 +-
gcc/{stmt.c => stmt.cc} | 4 +-
gcc/stmt.h | 2 +-
gcc/{stor-layout.c => stor-layout.cc} | 0
gcc/stor-layout.h | 2 +-
gcc/{store-motion.c => store-motion.cc} | 0
gcc/{streamer-hooks.c => streamer-hooks.cc} | 0
gcc/streamer-hooks.h | 2 +-
gcc/{stringpool.c => stringpool.cc} | 0
gcc/stringpool.h | 2 +-
...ubstring-locations.c => substring-locations.cc} | 0
gcc/{symtab.c => symtab.cc} | 2 +-
gcc/{target-globals.c => target-globals.cc} | 0
gcc/target.def | 24 +-
gcc/target.h | 6 +-
gcc/{targhooks.c => targhooks.cc} | 2 +-
gcc/testsuite/ChangeLog | 113 +
gcc/testsuite/g++.target/i386/pr103973-1.C | 4 +-
gcc/testsuite/g++.target/i386/pr103973-11.C | 4 +-
gcc/testsuite/g++.target/i386/pr103973-13.C | 4 +-
gcc/testsuite/g++.target/i386/pr103973-15.C | 4 +-
gcc/testsuite/g++.target/i386/pr103973-3.C | 4 +-
gcc/testsuite/g++.target/i386/pr103973-5.C | 4 +-
gcc/testsuite/g++.target/i386/pr103973-7.C | 4 +-
gcc/testsuite/g++.target/i386/pr103973-9.C | 4 +-
gcc/testsuite/gcc.misc-tests/options.exp | 2 +-
gcc/testsuite/gcc.src/maintainers.exp | 4 +-
gcc/testsuite/gcc.target/i386/pr103973-1.c | 4 +-
gcc/testsuite/gcc.target/i386/pr103973-11.c | 4 +-
gcc/testsuite/gcc.target/i386/pr103973-13.c | 4 +-
gcc/testsuite/gcc.target/i386/pr103973-15.c | 4 +-
gcc/testsuite/gcc.target/i386/pr103973-3.c | 4 +-
gcc/testsuite/gcc.target/i386/pr103973-5.c | 4 +-
gcc/testsuite/gcc.target/i386/pr103973-7.c | 4 +-
gcc/testsuite/gcc.target/i386/pr103973-9.c | 4 +-
gcc/testsuite/lib/target-supports.exp | 6 +-
gcc/{timevar.c => timevar.cc} | 0
gcc/timevar.def | 2 +-
gcc/timevar.h | 2 +-
gcc/{toplev.c => toplev.cc} | 0
gcc/toplev.h | 10 +-
gcc/{tracer.c => tracer.cc} | 0
gcc/{trans-mem.c => trans-mem.cc} | 4 +-
gcc/{tree-affine.c => tree-affine.cc} | 0
gcc/{tree-call-cdce.c => tree-call-cdce.cc} | 2 +-
gcc/{tree-cfg.c => tree-cfg.cc} | 8 +-
gcc/{tree-cfgcleanup.c => tree-cfgcleanup.cc} | 0
gcc/tree-cfgcleanup.h | 2 +-
gcc/{tree-chrec.c => tree-chrec.cc} | 0
gcc/{tree-complex.c => tree-complex.cc} | 4 +-
gcc/tree-core.h | 6 +-
gcc/{tree-data-ref.c => tree-data-ref.cc} | 0
gcc/{tree-dfa.c => tree-dfa.cc} | 0
gcc/{tree-diagnostic.c => tree-diagnostic.cc} | 0
gcc/{tree-dump.c => tree-dump.cc} | 0
gcc/{tree-eh.c => tree-eh.cc} | 2 +-
gcc/{tree-emutls.c => tree-emutls.cc} | 0
gcc/{tree-if-conv.c => tree-if-conv.cc} | 2 +-
gcc/{tree-inline.c => tree-inline.cc} | 2 +-
gcc/tree-inline.h | 2 +-
gcc/{tree-into-ssa.c => tree-into-ssa.cc} | 0
gcc/{tree-iterator.c => tree-iterator.cc} | 0
...op-distribution.c => tree-loop-distribution.cc} | 0
gcc/{tree-nested.c => tree-nested.cc} | 4 +-
gcc/{tree-nrv.c => tree-nrv.cc} | 0
gcc/{tree-object-size.c => tree-object-size.cc} | 0
gcc/tree-object-size.h | 2 +-
gcc/{tree-outof-ssa.c => tree-outof-ssa.cc} | 2 +-
gcc/{tree-parloops.c => tree-parloops.cc} | 2 +-
gcc/{tree-phinodes.c => tree-phinodes.cc} | 0
gcc/{tree-predcom.c => tree-predcom.cc} | 0
gcc/{tree-pretty-print.c => tree-pretty-print.cc} | 6 +-
gcc/{tree-profile.c => tree-profile.cc} | 4 +-
...scalar-evolution.c => tree-scalar-evolution.cc} | 0
gcc/{tree-sra.c => tree-sra.cc} | 2 +-
gcc/{tree-ssa-address.c => tree-ssa-address.cc} | 2 +-
gcc/{tree-ssa-alias.c => tree-ssa-alias.cc} | 2 +-
gcc/tree-ssa-alias.h | 4 +-
gcc/{tree-ssa-ccp.c => tree-ssa-ccp.cc} | 2 +-
gcc/{tree-ssa-coalesce.c => tree-ssa-coalesce.cc} | 0
gcc/tree-ssa-coalesce.h | 2 +-
gcc/{tree-ssa-copy.c => tree-ssa-copy.cc} | 0
gcc/{tree-ssa-dce.c => tree-ssa-dce.cc} | 0
gcc/{tree-ssa-dom.c => tree-ssa-dom.cc} | 0
gcc/{tree-ssa-dse.c => tree-ssa-dse.cc} | 0
gcc/{tree-ssa-forwprop.c => tree-ssa-forwprop.cc} | 0
...{tree-ssa-ifcombine.c => tree-ssa-ifcombine.cc} | 0
gcc/{tree-ssa-live.c => tree-ssa-live.cc} | 2 +-
gcc/{tree-ssa-loop-ch.c => tree-ssa-loop-ch.cc} | 0
gcc/{tree-ssa-loop-im.c => tree-ssa-loop-im.cc} | 0
...ssa-loop-ivcanon.c => tree-ssa-loop-ivcanon.cc} | 0
...e-ssa-loop-ivopts.c => tree-ssa-loop-ivopts.cc} | 0
...ree-ssa-loop-manip.c => tree-ssa-loop-manip.cc} | 2 +-
...ree-ssa-loop-niter.c => tree-ssa-loop-niter.cc} | 0
...a-loop-prefetch.c => tree-ssa-loop-prefetch.cc} | 0
...ree-ssa-loop-split.c => tree-ssa-loop-split.cc} | 0
...a-loop-unswitch.c => tree-ssa-loop-unswitch.cc} | 2 +-
gcc/{tree-ssa-loop.c => tree-ssa-loop.cc} | 0
...{tree-ssa-math-opts.c => tree-ssa-math-opts.cc} | 2 +-
gcc/{tree-ssa-operands.c => tree-ssa-operands.cc} | 2 +-
gcc/{tree-ssa-phiopt.c => tree-ssa-phiopt.cc} | 0
gcc/{tree-ssa-phiprop.c => tree-ssa-phiprop.cc} | 0
gcc/{tree-ssa-pre.c => tree-ssa-pre.cc} | 4 +-
...{tree-ssa-propagate.c => tree-ssa-propagate.cc} | 0
gcc/{tree-ssa-reassoc.c => tree-ssa-reassoc.cc} | 4 +-
gcc/{tree-ssa-sccvn.c => tree-ssa-sccvn.cc} | 2 +-
gcc/tree-ssa-sccvn.h | 2 +-
...ssa-scopedtables.c => tree-ssa-scopedtables.cc} | 4 +-
gcc/{tree-ssa-sink.c => tree-ssa-sink.cc} | 0
gcc/{tree-ssa-strlen.c => tree-ssa-strlen.cc} | 2 +-
gcc/tree-ssa-strlen.h | 2 +-
...e-ssa-structalias.c => tree-ssa-structalias.cc} | 0
...ree-ssa-tail-merge.c => tree-ssa-tail-merge.cc} | 2 +-
gcc/{tree-ssa-ter.c => tree-ssa-ter.cc} | 0
gcc/tree-ssa-ter.h | 2 +-
...threadbackward.c => tree-ssa-threadbackward.cc} | 0
...ree-ssa-threadedge.c => tree-ssa-threadedge.cc} | 0
...ssa-threadupdate.c => tree-ssa-threadupdate.cc} | 0
gcc/tree-ssa-threadupdate.h | 2 +-
gcc/{tree-ssa-uncprop.c => tree-ssa-uncprop.cc} | 0
gcc/{tree-ssa-uninit.c => tree-ssa-uninit.cc} | 0
gcc/{tree-ssa.c => tree-ssa.cc} | 0
gcc/{tree-ssanames.c => tree-ssanames.cc} | 0
gcc/{tree-stdarg.c => tree-stdarg.cc} | 0
gcc/{tree-streamer-in.c => tree-streamer-in.cc} | 2 +-
gcc/{tree-streamer-out.c => tree-streamer-out.cc} | 4 +-
gcc/{tree-streamer.c => tree-streamer.cc} | 0
gcc/tree-streamer.h | 6 +-
...itch-conversion.c => tree-switch-conversion.cc} | 0
gcc/{tree-tailcall.c => tree-tailcall.cc} | 0
...ree-vect-data-refs.c => tree-vect-data-refs.cc} | 0
gcc/{tree-vect-generic.c => tree-vect-generic.cc} | 0
...e-vect-loop-manip.c => tree-vect-loop-manip.cc} | 0
gcc/{tree-vect-loop.c => tree-vect-loop.cc} | 0
...{tree-vect-patterns.c => tree-vect-patterns.cc} | 4 +-
...ct-slp-patterns.c => tree-vect-slp-patterns.cc} | 0
gcc/{tree-vect-slp.c => tree-vect-slp.cc} | 0
gcc/{tree-vect-stmts.c => tree-vect-stmts.cc} | 2 +-
...ree-vector-builder.c => tree-vector-builder.cc} | 0
gcc/{tree-vectorizer.c => tree-vectorizer.cc} | 20 +-
gcc/tree-vectorizer.h | 20 +-
gcc/{tree-vrp.c => tree-vrp.cc} | 0
gcc/{tree.c => tree.cc} | 6 +-
gcc/tree.def | 2 +-
gcc/tree.h | 10 +-
gcc/{tsan.c => tsan.cc} | 0
gcc/{typed-splay-tree.c => typed-splay-tree.cc} | 0
gcc/{ubsan.c => ubsan.cc} | 0
gcc/{valtrack.c => valtrack.cc} | 0
gcc/{value-prof.c => value-prof.cc} | 4 +-
gcc/value-prof.h | 4 +-
gcc/value-range.cc | 2 +-
gcc/value-range.h | 2 +-
gcc/{var-tracking.c => var-tracking.cc} | 2 +-
gcc/{varasm.c => varasm.cc} | 10 +-
gcc/{varpool.c => varpool.cc} | 0
gcc/{vec-perm-indices.c => vec-perm-indices.cc} | 0
gcc/{vec.c => vec.cc} | 0
gcc/vec.h | 2 +-
gcc/{vmsdbgout.c => vmsdbgout.cc} | 2 +-
gcc/{vr-values.c => vr-values.cc} | 0
gcc/{vtable-verify.c => vtable-verify.cc} | 2 +-
gcc/vtable-verify.h | 2 +-
gcc/{web.c => web.cc} | 0
gcc/{xcoffout.c => xcoffout.cc} | 4 +-
gcc/xcoffout.h | 8 +-
libcpp/ChangeLog | 75 +
libcpp/Makefile.in | 10 +-
libcpp/{charset.c => charset.cc} | 4 +-
libcpp/{directives.c => directives.cc} | 6 +-
libcpp/{errors.c => errors.cc} | 0
libcpp/{expr.c => expr.cc} | 0
libcpp/{files.c => files.cc} | 0
libcpp/{identifiers.c => identifiers.cc} | 0
libcpp/include/cpplib.h | 22 +-
libcpp/include/line-map.h | 6 +-
libcpp/include/mkdeps.h | 2 +-
libcpp/{init.c => init.cc} | 6 +-
libcpp/internal.h | 32 +-
libcpp/{lex.c => lex.cc} | 0
libcpp/{line-map.c => line-map.cc} | 6 +-
libcpp/{macro.c => macro.cc} | 0
libcpp/{makeucnid.c => makeucnid.cc} | 0
libcpp/{mkdeps.c => mkdeps.cc} | 0
libcpp/{pch.c => pch.cc} | 0
libcpp/{symtab.c => symtab.cc} | 0
libcpp/{traditional.c => traditional.cc} | 2 +-
libgcc/ChangeLog | 4 +
libgcc/libgcov-driver.c | 2 +-
libgfortran/ChangeLog | 10 +
libgomp/ChangeLog | 13 +
libstdc++-v3/ChangeLog | 96 +
1346 files changed, 6472 insertions(+), 2756 deletions(-)
diff --cc gcc/Makefile.in
index f707a3587d0,31ff95500c9..d00c011fe72
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@@ -2797,16 -2768,16 +2797,16 @@@ s-gtype: $(EXTRA_GTYPE_DEPS) build/geng
-r gtype.state
$(STAMP) s-gtype
-generated_files = config.h tm.h $(TM_P_H) $(TM_D_H) $(TM_H) multilib.h \
- $(simple_generated_h) specs.h \
+generated_files = config.h tm.h $(TM_P_H) $(TM_D_H) $(TM_RUST_H) $(TM_H) \
+ multilib.h $(simple_generated_h) specs.h \
tree-check.h genrtl.h insn-modes.h insn-modes-inline.h \
tm-preds.h tm-constrs.h \
- $(ALL_GTFILES_H) gtype-desc.c gtype-desc.h version.h \
+ $(ALL_GTFILES_H) gtype-desc.cc gtype-desc.h version.h \
options.h target-hooks-def.h insn-opinit.h \
common/common-target-hooks-def.h pass-instances.def \
- gimple-match.c generic-match.c \
+ gimple-match.cc generic-match.cc \
c-family/c-target-hooks-def.h d/d-target-hooks-def.h \
- case-cfn-macros.h \
+ rust/rust-target-hooks-def.h case-cfn-macros.h \
cfn-operators.pd omp-device-properties.h
#\f
diff --cc gcc/config.gcc
index edc76529064,2c4266ce7b0..da06e41bd9b
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@@ -339,9 -329,8 +339,9 @@@ aarch64*-*-*
c_target_objs="aarch64-c.o"
cxx_target_objs="aarch64-c.o"
d_target_objs="aarch64-d.o"
+ rust_target_objs="aarch64-rust.o"
extra_objs="aarch64-builtins.o aarch-common.o aarch64-sve-builtins.o aarch64-sve-builtins-shapes.o aarch64-sve-builtins-base.o aarch64-sve-builtins-sve2.o cortex-a57-fma-steering.o aarch64-speculation.o falkor-tag-collision-avoidance.o aarch64-bti-insert.o aarch64-cc-fusion.o"
- target_gtfiles="\$(srcdir)/config/aarch64/aarch64-builtins.c \$(srcdir)/config/aarch64/aarch64-sve-builtins.h \$(srcdir)/config/aarch64/aarch64-sve-builtins.cc"
+ target_gtfiles="\$(srcdir)/config/aarch64/aarch64-builtins.cc \$(srcdir)/config/aarch64/aarch64-sve-builtins.h \$(srcdir)/config/aarch64/aarch64-sve-builtins.cc"
target_has_targetm_common=yes
;;
alpha*-*-*)
@@@ -372,9 -359,8 +372,9 @@@ arm*-*-*
c_target_objs="arm-c.o"
cxx_target_objs="arm-c.o"
d_target_objs="arm-d.o"
+ rust_target_objs="arm-rust.o"
extra_options="${extra_options} arm/arm-tables.opt"
- target_gtfiles="\$(srcdir)/config/arm/arm-builtins.c \$(srcdir)/config/arm/arm-mve-builtins.h \$(srcdir)/config/arm/arm-mve-builtins.cc"
+ target_gtfiles="\$(srcdir)/config/arm/arm-builtins.cc \$(srcdir)/config/arm/arm-mve-builtins.h \$(srcdir)/config/arm/arm-mve-builtins.cc"
;;
avr-*-*)
cpu_type=avr
@@@ -408,9 -392,8 +408,9 @@@ i[34567]86-*-* | x86_64-*-*
c_target_objs="i386-c.o"
cxx_target_objs="i386-c.o"
d_target_objs="i386-d.o"
+ rust_target_objs="i386-rust.o"
extra_objs="x86-tune-sched.o x86-tune-sched-bd.o x86-tune-sched-atom.o x86-tune-sched-core.o i386-options.o i386-builtins.o i386-expand.o i386-features.o"
- target_gtfiles="\$(srcdir)/config/i386/i386-builtins.c \$(srcdir)/config/i386/i386-expand.c \$(srcdir)/config/i386/i386-options.c"
+ target_gtfiles="\$(srcdir)/config/i386/i386-builtins.cc \$(srcdir)/config/i386/i386-expand.cc \$(srcdir)/config/i386/i386-options.cc"
extra_options="${extra_options} fused-madd.opt"
extra_headers="cpuid.h mmintrin.h mm3dnow.h xmmintrin.h emmintrin.h
pmmintrin.h tmmintrin.h ammintrin.h smmintrin.h
diff --cc gcc/config/aarch64/t-aarch64
index baf5bff4626,75b463d2f03..0fdcaf39b1e
--- a/gcc/config/aarch64/t-aarch64
+++ b/gcc/config/aarch64/t-aarch64
@@@ -118,13 -118,9 +118,13 @@@ aarch64-d.o: $(srcdir)/config/aarch64/a
$(COMPILE) $<
$(POSTCOMPILE)
+aarch64-rust.o: $(srcdir)/config/aarch64/aarch64-rust.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
PASSES_EXTRA += $(srcdir)/config/aarch64/aarch64-passes.def
- cortex-a57-fma-steering.o: $(srcdir)/config/aarch64/cortex-a57-fma-steering.c \
+ cortex-a57-fma-steering.o: $(srcdir)/config/aarch64/cortex-a57-fma-steering.cc \
$(CONFIG_H) $(SYSTEM_H) $(TM_H) $(REGS_H) insn-config.h $(RTL_BASE_H) \
dominance.h cfg.h cfganal.h $(BASIC_BLOCK_H) $(INSN_ATTR_H) $(RECOG_H) \
output.h hash-map.h $(DF_H) $(OBSTACK_H) $(TARGET_H) $(RTL_H) \
diff --cc gcc/config/arc/t-arc
index 2f374994cd5,9af2d2f3910..04c47fd1332
--- a/gcc/config/arc/t-arc
+++ b/gcc/config/arc/t-arc
@@@ -23,16 -23,11 +23,16 @@@ driver-arc.o: $(srcdir)/config/arc/driv
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
- arc-c.o: $(srcdir)/config/arc/arc-c.c $(CONFIG_H) $(SYSTEM_H) \
+ arc-c.o: $(srcdir)/config/arc/arc-c.cc $(CONFIG_H) $(SYSTEM_H) \
$(TREE_H) $(TM_H) $(TM_P_H) coretypes.h
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/arc/arc-c.c
+ $(srcdir)/config/arc/arc-c.cc
+arc-rust.o: $(srcdir)/config/arc/arc-rust.cc $(CONFIG_H) $(SYSTEM_H) \
+$(TREE_H) $(TM_H) $(TM_P_H) coretypes.h
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+ $(srcdir)/config/arc/arc-rust.cc
+
#Run `arc-cpus` if you changed something in arc-cpus.def
.PHONY: arc-cpus
diff --cc gcc/config/c6x/c6x-protos.h
index a8a14b41401,9cbe281c10e..480661ab5c0
--- a/gcc/config/c6x/c6x-protos.h
+++ b/gcc/config/c6x/c6x-protos.h
@@@ -21,10 -21,7 +21,10 @@@
#ifndef GCC_C6X_PROTOS_H
#define GCC_C6X_PROTOS_H
+/* Defined in c6x-rust.cc */
+extern void c6x_rust_target_cpu_info (void);
+
- /* Functions defined in c6x.c. */
+ /* Functions defined in c6x.cc. */
#ifdef RTX_CODE
extern void c6x_init_cumulative_args (CUMULATIVE_ARGS *, const_tree, rtx, int);
diff --cc gcc/config/i386/cygming.h
index f71ebcb49e7,45150458cc5..097592a4617
--- a/gcc/config/i386/cygming.h
+++ b/gcc/config/i386/cygming.h
@@@ -151,12 -151,7 +151,12 @@@ along with GCC; see the file COPYING3
} \
while (0)
+#define TARGET_RUST_OS_INFO() \
+ do { \
+ EXTRA_TARGET_RUST_OS_INFO (); \
+ } while (0)
+
- /* Get tree.c to declare a target-specific specialization of
+ /* Get tree.cc to declare a target-specific specialization of
merge_decl_attributes. */
#define TARGET_DLLIMPORT_DECL_ATTRIBUTES 1
diff --cc gcc/config/i386/i386-protos.h
index 8a9fe6ccd16,6b3c9516a7f..961f756e997
--- a/gcc/config/i386/i386-protos.h
+++ b/gcc/config/i386/i386-protos.h
@@@ -276,10 -276,7 +276,10 @@@ extern void ix86_d_target_versions (voi
extern void ix86_d_register_target_info (void);
extern bool ix86_d_has_stdcall_convention (unsigned int *, unsigned int *);
+/* In i386-rust.cc */
+extern void ix86_rust_target_cpu_info (void);
+
- /* In winnt.c */
+ /* In winnt.cc */
extern void i386_pe_unique_section (tree, int);
extern void i386_pe_declare_function_type (FILE *, const char *, int);
extern void i386_pe_record_external_function (tree, const char *);
diff --cc gcc/config/i386/t-i386
index 1203f2e77fa,4e2a0efc615..61ddfcab6ba
--- a/gcc/config/i386/t-i386
+++ b/gcc/config/i386/t-i386
@@@ -46,11 -46,7 +46,11 @@@ i386-d.o: $(srcdir)/config/i386/i386-d.
$(COMPILE) $<
$(POSTCOMPILE)
+i386-rust.o: $(srcdir)/config/i386/i386-rust.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
- i386-options.o: $(srcdir)/config/i386/i386-options.c
+ i386-options.o: $(srcdir)/config/i386/i386-options.cc
$(COMPILE) $<
$(POSTCOMPILE)
diff --cc gcc/config/ia64/t-ia64
index 79790bd2011,3fedb7b21c1..2206dc043be
--- a/gcc/config/ia64/t-ia64
+++ b/gcc/config/ia64/t-ia64
@@@ -16,15 -16,11 +16,15 @@@
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
- ia64-c.o: $(srcdir)/config/ia64/ia64-c.c $(CONFIG_H) $(SYSTEM_H) \
+ ia64-c.o: $(srcdir)/config/ia64/ia64-c.cc $(CONFIG_H) $(SYSTEM_H) \
coretypes.h $(TM_H) $(TREE_H) $(CPPLIB_H) $(C_COMMON_H) $(C_PRAGMA_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/ia64/ia64-c.c
+ $(srcdir)/config/ia64/ia64-c.cc
+ia64-rust.o: $(srcdir)/config/ia64/ia64-rust.cc \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
# genattrtab generates very long string literals.
insn-attrtab.o-warn = -Wno-error
diff --cc gcc/config/m68k/m68kemb.h
index ed55900ae3f,ee55faf6912..783c05c7e14
--- a/gcc/config/m68k/m68kemb.h
+++ b/gcc/config/m68k/m68kemb.h
@@@ -39,17 -39,7 +39,17 @@@
} \
while (0)
+#define TARGET_RUST_OS_INFO() \
+ do { \
+ /*TODO: assuming that embedded means "no operating system", at least by rustc terms*/ \
+ /*basing this all on embedinomicon sample targets*/ \
+ builtin_rust_info ("target_family", ""); \
+ builtin_rust_info ("target_os", "none"); \
+ builtin_rust_info ("target_vendor", ""); \
+ builtin_rust_info ("target_env", ""); \
+ } while (0)
+
- /* Override the default LIB_SPEC from gcc.c. We don't currently support
+ /* Override the default LIB_SPEC from gcc.cc. We don't currently support
profiling, or libg.a. */
#undef LIB_SPEC
diff --cc gcc/config/mips/t-mips
index 851dd55907f,d7a934f438c..22d77bc7cc9
--- a/gcc/config/mips/t-mips
+++ b/gcc/config/mips/t-mips
@@@ -25,10 -25,6 +25,10 @@@ frame-header-opt.o: $(srcdir)/config/mi
$(COMPILE) $<
$(POSTCOMPILE)
- mips-d.o: $(srcdir)/config/mips/mips-d.c
+ mips-d.o: $(srcdir)/config/mips/mips-d.cc
$(COMPILE) $<
$(POSTCOMPILE)
+
+mips-rust.o: $(srcdir)/config/mips/mips-rust.cc \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
diff --cc gcc/config/nds32/t-nds32
index 0afea637445,3833f3daceb..36c3da41933
--- a/gcc/config/nds32/t-nds32
+++ b/gcc/config/nds32/t-nds32
@@@ -143,8 -143,4 +143,8 @@@ nds32-utils.o:
$(TARGET_H) $(TARGET_DEF_H) debug.h langhooks.h $(DF_H) \
intl.h libfuncs.h $(PARAMS_H) $(OPTS_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/nds32/nds32-utils.c
+ $(srcdir)/config/nds32/nds32-utils.cc
+
+nds32-rust.o: $(srcdir)/config/nds32/nds32-rust.cc \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
diff --cc gcc/config/nvptx/nvptx.h
index 2bc3c9ccc11,9fda2f0d86c..9a52adec603
--- a/gcc/config/nvptx/nvptx.h
+++ b/gcc/config/nvptx/nvptx.h
@@@ -36,9 -36,7 +36,9 @@@
#define TARGET_CPU_CPP_BUILTINS() nvptx_cpu_cpp_builtins ()
+#define TARGET_RUST_CPU_INFO nvptx_rust_target_cpu_info
+
- /* Avoid the default in ../../gcc.c, which adds "-pthread", which is not
+ /* Avoid the default in ../../gcc.cc, which adds "-pthread", which is not
supported for nvptx. */
#define GOMP_SELF_SPECS ""
diff --cc gcc/config/pa/pa-protos.h
index 68a7c185449,d474d9efc91..96c4c8f121c
--- a/gcc/config/pa/pa-protos.h
+++ b/gcc/config/pa/pa-protos.h
@@@ -112,9 -112,6 +112,9 @@@ extern void hppa_profile_hook (int)
extern const int pa_magic_milli[];
- /* Routines implemented in pa-d.c */
+ /* Routines implemented in pa-d.cc */
extern void pa_d_target_versions (void);
extern void pa_d_register_target_info (void);
+
+/* Routines implemented in pa-rust.cc */
+extern void pa_rust_target_cpu_info (void);
diff --cc gcc/config/riscv/riscv-protos.h
index c641780ad09,20c2381c21a..92aa8674773
--- a/gcc/config/riscv/riscv-protos.h
+++ b/gcc/config/riscv/riscv-protos.h
@@@ -82,10 -82,7 +82,10 @@@ void riscv_cpu_cpp_builtins (cpp_reade
extern void riscv_d_target_versions (void);
extern void riscv_d_register_target_info (void);
+/* Routines implemented in riscv-rust.cc */
+extern void riscv_rust_target_cpu_info (void);
+
- /* Routines implemented in riscv-builtins.c. */
+ /* Routines implemented in riscv-builtins.cc. */
extern void riscv_atomic_assign_expand_fenv (tree *, tree *, tree *);
extern rtx riscv_expand_builtin (tree, rtx, rtx, machine_mode, int);
extern tree riscv_builtin_decl (unsigned int, bool);
diff --cc gcc/config/rs6000/t-rs6000
index d7447c45bb8,90079ced168..daf5e6a78ef
--- a/gcc/config/rs6000/t-rs6000
+++ b/gcc/config/rs6000/t-rs6000
@@@ -39,11 -39,7 +39,11 @@@ rs6000-d.o: $(srcdir)/config/rs6000/rs6
$(COMPILE) $<
$(POSTCOMPILE)
+rs6000-rust.o: $(srcdir)/config/rs6000/rs6000-rust.cc
+ $(COMPILE) $<
+ $(POSTCOMPILE)
+
- rs6000-logue.o: $(srcdir)/config/rs6000/rs6000-logue.c
+ rs6000-logue.o: $(srcdir)/config/rs6000/rs6000-logue.cc
$(COMPILE) $<
$(POSTCOMPILE)
diff --cc gcc/config/s390/t-s390
index 354d3c66ff1,767df107ccc..82b1d926323
--- a/gcc/config/s390/t-s390
+++ b/gcc/config/s390/t-s390
@@@ -25,12 -25,8 +25,12 @@@ s390-c.o: $(srcdir)/config/s390/s390-c.
$(TM_H) $(TREE_H) $(TM_P_H) $(FLAGS_H) $(C_COMMON_H) $(GGC_H) \
$(TARGET_H) $(TARGET_DEF_H) $(CPPLIB_H) $(C_PRAGMA_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/s390/s390-c.c
+ $(srcdir)/config/s390/s390-c.cc
- s390-d.o: $(srcdir)/config/s390/s390-d.c
+ s390-d.o: $(srcdir)/config/s390/s390-d.cc
$(COMPILE) $<
$(POSTCOMPILE)
+
+s390-rust.o: $(srcdir)/config/s390/s390-rust.cc \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
diff --cc gcc/config/sh/t-sh
index 682deb6bc41,dd5652e11bf..f994783ac9a
--- a/gcc/config/sh/t-sh
+++ b/gcc/config/sh/t-sh
@@@ -20,15 -20,11 +20,15 @@@ sh-mem.o: $(srcdir)/config/sh/sh-mem.c
$(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) $(TM_P_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
- sh-c.o: $(srcdir)/config/sh/sh-c.c \
+ sh-c.o: $(srcdir)/config/sh/sh-c.cc \
$(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) $(TM_P_H) coretypes.h
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/sh/sh-c.c
+ $(srcdir)/config/sh/sh-c.cc
+sh-rust.o: $(srcdir)/config/sh/sh-rust.cc \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
sh_treg_combine.o: $(srcdir)/config/sh/sh_treg_combine.cc \
$(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_H) $(TM_P_H) coretypes.h
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
diff --cc gcc/config/v850/t-v850
index 4a13d8cea27,275ee8fccb3..797d2528623
--- a/gcc/config/v850/t-v850
+++ b/gcc/config/v850/t-v850
@@@ -25,15 -25,11 +25,15 @@@ MULTILIB_DIRNAMES += v850e3v
TCFLAGS = -mno-app-regs -msmall-sld -Wa,-mwarn-signed-overflow -Wa,-mwarn-unsigned-overflow
- v850-c.o: $(srcdir)/config/v850/v850-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+ v850-c.o: $(srcdir)/config/v850/v850-c.cc $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(CPPLIB_H) $(TREE_H) $(C_PRAGMA_H) $(GGC_H) $(TM_P_H)
$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
- $(srcdir)/config/v850/v850-c.c
+ $(srcdir)/config/v850/v850-c.cc
+v850-rust.o: $(srcdir)/config/v850/v850-rust.cc \
+ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
+ $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
+
# Local Variables:
# mode: Makefile
# End:
diff --cc gcc/rust/backend/rust-compile-expr.cc
index ae4a841ad21,00000000000..d61a568f6a4
mode 100644,000000..100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@@ -1,1374 -1,0 +1,1374 @@@
+// Copyright (C) 2020-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/>.
+
+#include "rust-compile.h"
+#include "rust-compile-item.h"
+#include "rust-compile-expr.h"
+#include "rust-compile-struct-field-expr.h"
+#include "rust-hir-trait-resolve.h"
+#include "rust-hir-path-probe.h"
+#include "rust-hir-type-bounds.h"
+#include "rust-compile-pattern.h"
+#include "rust-constexpr.h"
+
+#include "fold-const.h"
+#include "realmpfr.h"
+#include "convert.h"
+#include "print-tree.h"
+
+namespace Rust {
+namespace Compile {
+
+void
+CompileExpr::visit (HIR::ArithmeticOrLogicalExpr &expr)
+{
+ auto op = expr.get_expr_type ();
+ auto lhs = CompileExpr::Compile (expr.get_lhs (), ctx);
+ auto rhs = CompileExpr::Compile (expr.get_rhs (), ctx);
+
+ // this might be an operator overload situation lets check
+ TyTy::FnType *fntype;
+ bool is_op_overload = ctx->get_tyctx ()->lookup_operator_overload (
+ expr.get_mappings ().get_hirid (), &fntype);
+ if (is_op_overload)
+ {
+ auto lang_item_type
+ = Analysis::RustLangItem::OperatorToLangItem (expr.get_expr_type ());
+ translated = resolve_operator_overload (lang_item_type, expr, lhs, rhs,
+ expr.get_lhs (), expr.get_rhs ());
+ return;
+ }
+
+ translated
+ = ctx->get_backend ()->arithmetic_or_logical_expression (op, lhs, rhs,
+ expr.get_locus ());
+}
+
+void
+CompileExpr::visit (HIR::CompoundAssignmentExpr &expr)
+{
+ fncontext fn = ctx->peek_fn ();
+
+ auto op = expr.get_expr_type ();
+ auto lhs = CompileExpr::Compile (expr.get_left_expr ().get (), ctx);
+ auto rhs = CompileExpr::Compile (expr.get_right_expr ().get (), ctx);
+
+ // this might be an operator overload situation lets check
+ TyTy::FnType *fntype;
+ bool is_op_overload = ctx->get_tyctx ()->lookup_operator_overload (
+ expr.get_mappings ().get_hirid (), &fntype);
+ if (is_op_overload)
+ {
+ auto lang_item_type
+ = Analysis::RustLangItem::CompoundAssignmentOperatorToLangItem (
+ expr.get_expr_type ());
+ auto compound_assignment
+ = resolve_operator_overload (lang_item_type, expr, lhs, rhs,
+ expr.get_left_expr ().get (),
+ expr.get_right_expr ().get ());
+ auto assignment
+ = ctx->get_backend ()->expression_statement (fn.fndecl,
+ compound_assignment);
+ ctx->add_statement (assignment);
+
+ return;
+ }
+
+ auto operator_expr
+ = ctx->get_backend ()->arithmetic_or_logical_expression (op, lhs, rhs,
+ expr.get_locus ());
+ tree assignment
+ = ctx->get_backend ()->assignment_statement (fn.fndecl, lhs, operator_expr,
+ expr.get_locus ());
+ ctx->add_statement (assignment);
+}
+
+void
+CompileExpr::visit (HIR::NegationExpr &expr)
+{
+ auto op = expr.get_expr_type ();
+ auto negated_expr = CompileExpr::Compile (expr.get_expr ().get (), ctx);
+ auto location = expr.get_locus ();
+
+ // this might be an operator overload situation lets check
+ TyTy::FnType *fntype;
+ bool is_op_overload = ctx->get_tyctx ()->lookup_operator_overload (
+ expr.get_mappings ().get_hirid (), &fntype);
+ if (is_op_overload)
+ {
+ auto lang_item_type
+ = Analysis::RustLangItem::NegationOperatorToLangItem (op);
+ translated
+ = resolve_operator_overload (lang_item_type, expr, negated_expr,
+ nullptr, expr.get_expr ().get (), nullptr);
+ return;
+ }
+
+ translated
+ = ctx->get_backend ()->negation_expression (op, negated_expr, location);
+}
+
+void
+CompileExpr::visit (HIR::DereferenceExpr &expr)
+{
+ TyTy::BaseType *tyty = nullptr;
+ if (!ctx->get_tyctx ()->lookup_type (expr.get_mappings ().get_hirid (),
+ &tyty))
+ {
+ rust_fatal_error (expr.get_locus (),
+ "did not resolve type for this TupleExpr");
+ return;
+ }
+
+ tree main_expr = CompileExpr::Compile (expr.get_expr ().get (), ctx);
+
+ // this might be an operator overload situation lets check
+ TyTy::FnType *fntype;
+ bool is_op_overload = ctx->get_tyctx ()->lookup_operator_overload (
+ expr.get_mappings ().get_hirid (), &fntype);
+ if (is_op_overload)
+ {
+ auto lang_item_type = Analysis::RustLangItem::ItemType::DEREF;
+ tree operator_overload_call
+ = resolve_operator_overload (lang_item_type, expr, main_expr, nullptr,
+ expr.get_expr ().get (), nullptr);
+
+ // rust deref always returns a reference from this overload then we can
+ // actually do the indirection
+ main_expr = operator_overload_call;
+ }
+
+ tree expected_type = TyTyResolveCompile::compile (ctx, tyty);
+ bool known_valid = true;
+ translated
+ = ctx->get_backend ()->indirect_expression (expected_type, main_expr,
+ known_valid, expr.get_locus ());
+}
+
+void
+CompileExpr::visit (HIR::MatchExpr &expr)
+{
+ // https://gcc.gnu.org/onlinedocs/gccint/Basic-Statements.html#Basic-Statements
+ // TODO
+ // SWITCH_ALL_CASES_P is true if the switch includes a default label or the
+ // case label ranges cover all possible values of the condition expression
+
+ /* Switch expression.
+
+ TREE_TYPE is the original type of the condition, before any
+ language required type conversions. It may be NULL, in which case
+ the original type and final types are assumed to be the same.
+
+ Operand 0 is the expression used to perform the branch,
+ Operand 1 is the body of the switch, which probably contains
+ CASE_LABEL_EXPRs. It may also be NULL, in which case operand 2
+ must not be NULL. */
+ // DEFTREECODE (SWITCH_EXPR, "switch_expr", tcc_statement, 2)
+
+ /* Used to represent a case label.
+
+ Operand 0 is CASE_LOW. It may be NULL_TREE, in which case the label
+ is a 'default' label.
+ Operand 1 is CASE_HIGH. If it is NULL_TREE, the label is a simple
+ (one-value) case label. If it is non-NULL_TREE, the case is a range.
+ Operand 2 is CASE_LABEL, which has the corresponding LABEL_DECL.
- Operand 3 is CASE_CHAIN. This operand is only used in tree-cfg.c to
++ Operand 3 is CASE_CHAIN. This operand is only used in tree-cfg.cc to
+ speed up the lookup of case labels which use a particular edge in
+ the control flow graph. */
+ // DEFTREECODE (CASE_LABEL_EXPR, "case_label_expr", tcc_statement, 4)
+
+ TyTy::BaseType *scrutinee_expr_tyty = nullptr;
+ if (!ctx->get_tyctx ()->lookup_type (
+ expr.get_scrutinee_expr ()->get_mappings ().get_hirid (),
+ &scrutinee_expr_tyty))
+ {
+ translated = ctx->get_backend ()->error_expression ();
+ return;
+ }
+
+ rust_assert (scrutinee_expr_tyty->get_kind () == TyTy::TypeKind::ADT);
+
+ // this will need to change but for now the first pass implementation, lets
+ // assert this is the case
+ TyTy::ADTType *adt = static_cast<TyTy::ADTType *> (scrutinee_expr_tyty);
+ rust_assert (adt->is_enum ());
+ rust_assert (adt->number_of_variants () > 0);
+
+ TyTy::BaseType *expr_tyty = nullptr;
+ if (!ctx->get_tyctx ()->lookup_type (expr.get_mappings ().get_hirid (),
+ &expr_tyty))
+ {
+ translated = ctx->get_backend ()->error_expression ();
+ return;
+ }
+
+ fncontext fnctx = ctx->peek_fn ();
+ Bvariable *tmp = NULL;
+ bool needs_temp = !expr_tyty->is_unit ();
+ if (needs_temp)
+ {
+ tree enclosing_scope = ctx->peek_enclosing_scope ();
+ tree block_type = TyTyResolveCompile::compile (ctx, expr_tyty);
+
+ bool is_address_taken = false;
+ tree ret_var_stmt = nullptr;
+ tmp = ctx->get_backend ()->temporary_variable (
+ fnctx.fndecl, enclosing_scope, block_type, NULL, is_address_taken,
+ expr.get_locus (), &ret_var_stmt);
+ ctx->add_statement (ret_var_stmt);
+ }
+
+ // lets compile the scrutinee expression
+ tree match_scrutinee_expr
+ = CompileExpr::Compile (expr.get_scrutinee_expr ().get (), ctx);
+
+ // need to access the qualifier field, if we use QUAL_UNION_TYPE this would be
+ // DECL_QUALIFIER i think. For now this will just access the first record
+ // field and its respective qualifier because it will always be set because
+ // this is all a big special union
+ tree scrutinee_first_record_expr
+ = ctx->get_backend ()->struct_field_expression (
+ match_scrutinee_expr, 0, expr.get_scrutinee_expr ()->get_locus ());
+ tree match_scrutinee_expr_qualifier_expr
+ = ctx->get_backend ()->struct_field_expression (
+ scrutinee_first_record_expr, 0, expr.get_scrutinee_expr ()->get_locus ());
+
+ // setup the end label so the cases can exit properly
+ tree fndecl = fnctx.fndecl;
+ Location end_label_locus = expr.get_locus (); // FIXME
+ tree end_label
+ = ctx->get_backend ()->label (fndecl,
+ "" /* empty creates an artificial label */,
+ end_label_locus);
+ tree end_label_decl_statement
+ = ctx->get_backend ()->label_definition_statement (end_label);
+
+ // setup the switch-body-block
+ Location start_location; // FIXME
+ Location end_location; // FIXME
+ tree enclosing_scope = ctx->peek_enclosing_scope ();
+ tree switch_body_block
+ = ctx->get_backend ()->block (fndecl, enclosing_scope, {}, start_location,
+ end_location);
+ ctx->push_block (switch_body_block);
+
+ for (auto &kase : expr.get_match_cases ())
+ {
+ // for now lets just get single pattern's working
+ HIR::MatchArm &kase_arm = kase.get_arm ();
+ rust_assert (kase_arm.get_patterns ().size () > 0);
+
+ // generate implicit label
+ Location arm_locus = kase_arm.get_patterns ().at (0)->get_locus ();
+ tree case_label = ctx->get_backend ()->label (
+ fndecl, "" /* empty creates an artificial label */, arm_locus);
+
+ // setup the bindings for the block
+ for (auto &kase_pattern : kase_arm.get_patterns ())
+ {
+ tree switch_kase_expr
+ = CompilePatternCaseLabelExpr::Compile (kase_pattern.get (),
+ case_label, ctx);
+ ctx->add_statement (switch_kase_expr);
+
+ CompilePatternBindings::Compile (kase_pattern.get (),
+ match_scrutinee_expr, ctx);
+ }
+
+ // compile the expr and setup the assignment if required when tmp != NULL
+ tree kase_expr_tree = CompileExpr::Compile (kase.get_expr ().get (), ctx);
+ if (tmp != NULL)
+ {
+ tree result_reference
+ = ctx->get_backend ()->var_expression (tmp, arm_locus);
+ tree assignment = ctx->get_backend ()->assignment_statement (
+ fnctx.fndecl, result_reference, kase_expr_tree, arm_locus);
+ ctx->add_statement (assignment);
+ }
+
+ // go to end label
+ tree goto_end_label = build1_loc (arm_locus.gcc_location (), GOTO_EXPR,
+ void_type_node, end_label);
+ ctx->add_statement (goto_end_label);
+ }
+
+ // setup the switch expression
+ tree match_body = ctx->pop_block ();
+ tree match_expr_stmt
+ = build2_loc (expr.get_locus ().gcc_location (), SWITCH_EXPR,
+ TREE_TYPE (match_scrutinee_expr_qualifier_expr),
+ match_scrutinee_expr_qualifier_expr, match_body);
+ ctx->add_statement (match_expr_stmt);
+ ctx->add_statement (end_label_decl_statement);
+
+ if (tmp != NULL)
+ {
+ translated = ctx->get_backend ()->var_expression (tmp, expr.get_locus ());
+ }
+}
+
+void
+CompileExpr::visit (HIR::CallExpr &expr)
+{
+ TyTy::BaseType *tyty = nullptr;
+ if (!ctx->get_tyctx ()->lookup_type (
+ expr.get_fnexpr ()->get_mappings ().get_hirid (), &tyty))
+ {
+ rust_error_at (expr.get_locus (), "unknown type");
+ return;
+ }
+
+ // must be a tuple constructor
+ bool is_fn = tyty->get_kind () == TyTy::TypeKind::FNDEF
+ || tyty->get_kind () == TyTy::TypeKind::FNPTR;
+ bool is_adt_ctor = !is_fn;
+ if (is_adt_ctor)
+ {
+ rust_assert (tyty->get_kind () == TyTy::TypeKind::ADT);
+ TyTy::ADTType *adt = static_cast<TyTy::ADTType *> (tyty);
+ tree compiled_adt_type = TyTyResolveCompile::compile (ctx, tyty);
+
+ // what variant is it?
+ int union_disriminator = -1;
+ TyTy::VariantDef *variant = nullptr;
+ if (!adt->is_enum ())
+ {
+ rust_assert (adt->number_of_variants () == 1);
+ variant = adt->get_variants ().at (0);
+ }
+ else
+ {
+ HirId variant_id;
+ bool ok = ctx->get_tyctx ()->lookup_variant_definition (
+ expr.get_fnexpr ()->get_mappings ().get_hirid (), &variant_id);
+ rust_assert (ok);
+
+ ok = adt->lookup_variant_by_id (variant_id, &variant,
+ &union_disriminator);
+ rust_assert (ok);
+ }
+
+ // this assumes all fields are in order from type resolution and if a
+ // base struct was specified those fields are filed via accesors
+ std::vector<tree> arguments;
+ for (size_t i = 0; i < expr.get_arguments ().size (); i++)
+ {
+ auto &argument = expr.get_arguments ().at (i);
+ auto rvalue = CompileExpr::Compile (argument.get (), ctx);
+
+ // assignments are coercion sites so lets convert the rvalue if
+ // necessary
+ auto respective_field = variant->get_field_at_index (i);
+ auto expected = respective_field->get_field_type ();
+
+ TyTy::BaseType *actual = nullptr;
+ bool ok = ctx->get_tyctx ()->lookup_type (
+ argument->get_mappings ().get_hirid (), &actual);
+ rust_assert (ok);
+
+ // coerce it if required
+ Location lvalue_locus
+ = ctx->get_mappings ()->lookup_location (expected->get_ty_ref ());
+ Location rvalue_locus = argument->get_locus ();
+ rvalue = coercion_site (rvalue, actual, expected, lvalue_locus,
+ rvalue_locus);
+
+ // add it to the list
+ arguments.push_back (rvalue);
+ }
+
+ // the constructor depends on whether this is actually an enum or not if
+ // its an enum we need to setup the discriminator
+ std::vector<tree> ctor_arguments;
+ if (adt->is_enum ())
+ {
+ HIR::Expr *discrim_expr = variant->get_discriminant ();
+ tree discrim_expr_node = CompileExpr::Compile (discrim_expr, ctx);
+ tree folded_discrim_expr = ConstCtx::fold (discrim_expr_node);
+ tree qualifier = folded_discrim_expr;
+
+ ctor_arguments.push_back (qualifier);
+ }
+ for (auto &arg : arguments)
+ ctor_arguments.push_back (arg);
+
+ translated = ctx->get_backend ()->constructor_expression (
+ compiled_adt_type, adt->is_enum (), ctor_arguments, union_disriminator,
+ expr.get_locus ());
+
+ return;
+ }
+
+ auto get_parameter_tyty_at_index
+ = [] (const TyTy::BaseType *base, size_t index,
+ TyTy::BaseType **result) -> bool {
+ bool is_fn = base->get_kind () == TyTy::TypeKind::FNDEF
+ || base->get_kind () == TyTy::TypeKind::FNPTR;
+ rust_assert (is_fn);
+
+ if (base->get_kind () == TyTy::TypeKind::FNPTR)
+ {
+ const TyTy::FnPtr *fn = static_cast<const TyTy::FnPtr *> (base);
+ *result = fn->param_at (index);
+
+ return true;
+ }
+
+ const TyTy::FnType *fn = static_cast<const TyTy::FnType *> (base);
+ auto param = fn->param_at (index);
+ *result = param.second;
+
+ return true;
+ };
+
+ bool is_varadic = false;
+ if (tyty->get_kind () == TyTy::TypeKind::FNDEF)
+ {
+ const TyTy::FnType *fn = static_cast<const TyTy::FnType *> (tyty);
+ is_varadic = fn->is_varadic ();
+ }
+
+ size_t required_num_args;
+ if (tyty->get_kind () == TyTy::TypeKind::FNDEF)
+ {
+ const TyTy::FnType *fn = static_cast<const TyTy::FnType *> (tyty);
+ required_num_args = fn->num_params ();
+ }
+ else
+ {
+ const TyTy::FnPtr *fn = static_cast<const TyTy::FnPtr *> (tyty);
+ required_num_args = fn->num_params ();
+ }
+
+ std::vector<tree> args;
+ for (size_t i = 0; i < expr.get_arguments ().size (); i++)
+ {
+ auto &argument = expr.get_arguments ().at (i);
+ auto rvalue = CompileExpr::Compile (argument.get (), ctx);
+
+ if (is_varadic && i >= required_num_args)
+ {
+ args.push_back (rvalue);
+ continue;
+ }
+
+ // assignments are coercion sites so lets convert the rvalue if
+ // necessary
+ bool ok;
+ TyTy::BaseType *expected = nullptr;
+ ok = get_parameter_tyty_at_index (tyty, i, &expected);
+ rust_assert (ok);
+
+ TyTy::BaseType *actual = nullptr;
+ ok = ctx->get_tyctx ()->lookup_type (
+ argument->get_mappings ().get_hirid (), &actual);
+ rust_assert (ok);
+
+ // coerce it if required
+ Location lvalue_locus
+ = ctx->get_mappings ()->lookup_location (expected->get_ty_ref ());
+ Location rvalue_locus = argument->get_locus ();
+ rvalue
+ = coercion_site (rvalue, actual, expected, lvalue_locus, rvalue_locus);
+
+ // add it to the list
+ args.push_back (rvalue);
+ }
+
+ // must be a call to a function
+ auto fn_address = CompileExpr::Compile (expr.get_fnexpr (), ctx);
+ auto fncontext = ctx->peek_fn ();
+ translated
+ = ctx->get_backend ()->call_expression (fncontext.fndecl, fn_address, args,
+ nullptr, expr.get_locus ());
+}
+
+void
+CompileExpr::visit (HIR::MethodCallExpr &expr)
+{
+ // method receiver
+ tree self = CompileExpr::Compile (expr.get_receiver ().get (), ctx);
+
+ // lookup the resolved name
+ NodeId resolved_node_id = UNKNOWN_NODEID;
+ if (!ctx->get_resolver ()->lookup_resolved_name (
+ expr.get_mappings ().get_nodeid (), &resolved_node_id))
+ {
+ rust_error_at (expr.get_locus (), "failed to lookup resolved MethodCall");
+ return;
+ }
+
+ // reverse lookup
+ HirId ref;
+ if (!ctx->get_mappings ()->lookup_node_to_hir (
+ expr.get_mappings ().get_crate_num (), resolved_node_id, &ref))
+ {
+ rust_fatal_error (expr.get_locus (), "reverse lookup failure");
+ return;
+ }
+
+ // lookup the expected function type
+ TyTy::BaseType *lookup_fntype = nullptr;
+ bool ok = ctx->get_tyctx ()->lookup_type (
+ expr.get_method_name ().get_mappings ().get_hirid (), &lookup_fntype);
+ rust_assert (ok);
+ rust_assert (lookup_fntype->get_kind () == TyTy::TypeKind::FNDEF);
+ TyTy::FnType *fntype = static_cast<TyTy::FnType *> (lookup_fntype);
+
+ TyTy::BaseType *receiver = nullptr;
+ ok = ctx->get_tyctx ()->lookup_receiver (expr.get_mappings ().get_hirid (),
+ &receiver);
+ rust_assert (ok);
+
+ bool is_dyn_dispatch
+ = receiver->get_root ()->get_kind () == TyTy::TypeKind::DYNAMIC;
+ bool is_generic_receiver = receiver->get_kind () == TyTy::TypeKind::PARAM;
+ if (is_generic_receiver)
+ {
+ TyTy::ParamType *p = static_cast<TyTy::ParamType *> (receiver);
+ receiver = p->resolve ();
+ }
+
+ if (is_dyn_dispatch)
+ {
+ const TyTy::DynamicObjectType *dyn
+ = static_cast<const TyTy::DynamicObjectType *> (receiver->get_root ());
+
+ std::vector<HIR::Expr *> arguments;
+ for (auto &arg : expr.get_arguments ())
+ arguments.push_back (arg.get ());
+
+ translated = compile_dyn_dispatch_call (dyn, receiver, fntype, self,
+ arguments, expr.get_locus ());
+ return;
+ }
+
+ // lookup compiled functions since it may have already been compiled
+ HIR::PathExprSegment method_name = expr.get_method_name ();
+ HIR::PathIdentSegment segment_name = method_name.get_segment ();
+ tree fn_expr
+ = resolve_method_address (fntype, ref, receiver, segment_name,
+ expr.get_mappings (), expr.get_locus ());
+
+ // lookup the autoderef mappings
+ std::vector<Resolver::Adjustment> *adjustments = nullptr;
+ ok = ctx->get_tyctx ()->lookup_autoderef_mappings (
+ expr.get_mappings ().get_hirid (), &adjustments);
+ rust_assert (ok);
+
+ // apply adjustments for the fn call
+ self = resolve_adjustements (*adjustments, self,
+ expr.get_receiver ()->get_locus ());
+
+ std::vector<tree> args;
+ args.push_back (self); // adjusted self
+
+ // normal args
+ for (size_t i = 0; i < expr.get_arguments ().size (); i++)
+ {
+ auto &argument = expr.get_arguments ().at (i);
+ auto rvalue = CompileExpr::Compile (argument.get (), ctx);
+
+ // assignments are coercion sites so lets convert the rvalue if
+ // necessary, offset from the already adjusted implicit self
+ bool ok;
+ TyTy::BaseType *expected = fntype->param_at (i + 1).second;
+
+ TyTy::BaseType *actual = nullptr;
+ ok = ctx->get_tyctx ()->lookup_type (
+ argument->get_mappings ().get_hirid (), &actual);
+ rust_assert (ok);
+
+ // coerce it if required
+ Location lvalue_locus
+ = ctx->get_mappings ()->lookup_location (expected->get_ty_ref ());
+ Location rvalue_locus = argument->get_locus ();
+ rvalue
+ = coercion_site (rvalue, actual, expected, lvalue_locus, rvalue_locus);
+
+ // add it to the list
+ args.push_back (rvalue);
+ }
+
+ auto fncontext = ctx->peek_fn ();
+ translated
+ = ctx->get_backend ()->call_expression (fncontext.fndecl, fn_expr, args,
+ nullptr, expr.get_locus ());
+}
+
+tree
+CompileExpr::compile_dyn_dispatch_call (const TyTy::DynamicObjectType *dyn,
+ TyTy::BaseType *receiver,
+ TyTy::FnType *fntype, tree receiver_ref,
+ std::vector<HIR::Expr *> &arguments,
+ Location expr_locus)
+{
+ size_t offs = 0;
+ const Resolver::TraitItemReference *ref = nullptr;
+ for (auto &bound : dyn->get_object_items ())
+ {
+ const Resolver::TraitItemReference *item = bound.first;
+ auto t = item->get_tyty ();
+ rust_assert (t->get_kind () == TyTy::TypeKind::FNDEF);
+ auto ft = static_cast<TyTy::FnType *> (t);
+
+ if (ft->get_id () == fntype->get_id ())
+ {
+ ref = item;
+ break;
+ }
+ offs++;
+ }
+
+ if (ref == nullptr)
+ return ctx->get_backend ()->error_expression ();
+
+ // get any indirection sorted out
+ if (receiver->get_kind () == TyTy::TypeKind::REF)
+ {
+ TyTy::ReferenceType *r = static_cast<TyTy::ReferenceType *> (receiver);
+ auto indirect_ty = r->get_base ();
+ tree indrect_compiled_tyty
+ = TyTyResolveCompile::compile (ctx, indirect_ty);
+
+ tree indirect
+ = ctx->get_backend ()->indirect_expression (indrect_compiled_tyty,
+ receiver_ref, true,
+ expr_locus);
+ receiver_ref = indirect;
+ }
+
+ // access the offs + 1 for the fnptr and offs=0 for the reciever obj
+ tree self_argument
+ = ctx->get_backend ()->struct_field_expression (receiver_ref, 0,
+ expr_locus);
+
+ // access the vtable for the fn
+ tree fn_vtable_access
+ = ctx->get_backend ()->struct_field_expression (receiver_ref, offs + 1,
+ expr_locus);
+
+ // cast it to the correct fntype
+ tree expected_fntype = TyTyResolveCompile::compile (ctx, fntype, true);
+ tree fn_convert_expr
+ = ctx->get_backend ()->convert_expression (expected_fntype,
+ fn_vtable_access, expr_locus);
+
+ fncontext fnctx = ctx->peek_fn ();
+ tree enclosing_scope = ctx->peek_enclosing_scope ();
+ bool is_address_taken = false;
+ tree ret_var_stmt = NULL_TREE;
+ Bvariable *fn_convert_expr_tmp
+ = ctx->get_backend ()->temporary_variable (fnctx.fndecl, enclosing_scope,
+ expected_fntype, fn_convert_expr,
+ is_address_taken, expr_locus,
+ &ret_var_stmt);
+ ctx->add_statement (ret_var_stmt);
+
+ std::vector<tree> args;
+ args.push_back (self_argument);
+ for (auto &argument : arguments)
+ {
+ tree compiled_expr = CompileExpr::Compile (argument, ctx);
+ args.push_back (compiled_expr);
+ }
+
+ tree fn_expr
+ = ctx->get_backend ()->var_expression (fn_convert_expr_tmp, expr_locus);
+
+ return ctx->get_backend ()->call_expression (fnctx.fndecl, fn_expr, args,
+ nullptr, expr_locus);
+}
+
+tree
+CompileExpr::resolve_method_address (TyTy::FnType *fntype, HirId ref,
+ TyTy::BaseType *receiver,
+ HIR::PathIdentSegment &segment,
+ Analysis::NodeMapping expr_mappings,
+ Location expr_locus)
+{
+ // lookup compiled functions since it may have already been compiled
+ tree fn = NULL_TREE;
+ if (ctx->lookup_function_decl (fntype->get_ty_ref (), &fn))
+ {
+ return ctx->get_backend ()->function_code_expression (fn, expr_locus);
+ }
+
+ // Now we can try and resolve the address since this might be a forward
+ // declared function, generic function which has not be compiled yet or
+ // its an not yet trait bound function
+ HIR::ImplItem *resolved_item
+ = ctx->get_mappings ()->lookup_hir_implitem (expr_mappings.get_crate_num (),
+ ref, nullptr);
+ if (resolved_item != nullptr)
+ {
+ if (!fntype->has_subsititions_defined ())
+ return CompileInherentImplItem::Compile (resolved_item, ctx);
+
+ return CompileInherentImplItem::Compile (resolved_item, ctx, fntype);
+ }
+
+ // it might be resolved to a trait item
+ HIR::TraitItem *trait_item = ctx->get_mappings ()->lookup_hir_trait_item (
+ expr_mappings.get_crate_num (), ref);
+ HIR::Trait *trait = ctx->get_mappings ()->lookup_trait_item_mapping (
+ trait_item->get_mappings ().get_hirid ());
+
+ Resolver::TraitReference *trait_ref
+ = &Resolver::TraitReference::error_node ();
+ bool ok = ctx->get_tyctx ()->lookup_trait_reference (
+ trait->get_mappings ().get_defid (), &trait_ref);
+ rust_assert (ok);
+
+ // the type resolver can only resolve type bounds to their trait
+ // item so its up to us to figure out if this path should resolve
+ // to an trait-impl-block-item or if it can be defaulted to the
+ // trait-impl-item's definition
+
+ auto root = receiver->get_root ();
+ std::vector<Resolver::PathProbeCandidate> candidates
+ = Resolver::PathProbeType::Probe (root, segment, true, false, true);
+
+ if (candidates.size () == 0)
+ {
+ // this means we are defaulting back to the trait_item if
+ // possible
+ Resolver::TraitItemReference *trait_item_ref = nullptr;
+ bool ok = trait_ref->lookup_hir_trait_item (*trait_item, &trait_item_ref);
+ rust_assert (ok); // found
+ rust_assert (trait_item_ref->is_optional ()); // has definition
+
+ // FIXME Optional means it has a definition and an associated
+ // block which can be a default implementation, if it does not
+ // contain an implementation we should actually return
+ // error_mark_node
+
+ return CompileTraitItem::Compile (receiver,
+ trait_item_ref->get_hir_trait_item (),
+ ctx, fntype, true, expr_locus);
+ }
+ else
+ {
+ // FIXME this will be a case to return error_mark_node, there is
+ // an error scenario where a Trait Foo has a method Bar, but this
+ // receiver does not implement this trait or has an incompatible
+ // implementation and we should just return error_mark_node
+
+ rust_assert (candidates.size () == 1);
+ auto &candidate = candidates.at (0);
+ rust_assert (candidate.is_impl_candidate ());
+
+ HIR::ImplItem *impl_item = candidate.item.impl.impl_item;
+ if (!fntype->has_subsititions_defined ())
+ return CompileInherentImplItem::Compile (impl_item, ctx);
+
+ return CompileInherentImplItem::Compile (impl_item, ctx, fntype);
+ }
+}
+
+tree
+CompileExpr::resolve_operator_overload (
+ Analysis::RustLangItem::ItemType lang_item_type, HIR::OperatorExpr &expr,
+ tree lhs, tree rhs, HIR::Expr *lhs_expr, HIR::Expr *rhs_expr)
+{
+ TyTy::FnType *fntype;
+ bool is_op_overload = ctx->get_tyctx ()->lookup_operator_overload (
+ expr.get_mappings ().get_hirid (), &fntype);
+ rust_assert (is_op_overload);
+
+ // lookup the resolved name
+ NodeId resolved_node_id = UNKNOWN_NODEID;
+ bool ok = ctx->get_resolver ()->lookup_resolved_name (
+ expr.get_mappings ().get_nodeid (), &resolved_node_id);
+ rust_assert (ok);
+
+ // reverse lookup
+ HirId ref;
+ ok = ctx->get_mappings ()->lookup_node_to_hir (
+ expr.get_mappings ().get_crate_num (), resolved_node_id, &ref);
+ rust_assert (ok);
+
+ TyTy::BaseType *receiver = nullptr;
+ ok = ctx->get_tyctx ()->lookup_receiver (expr.get_mappings ().get_hirid (),
+ &receiver);
+ rust_assert (ok);
+
+ bool is_dyn_dispatch
+ = receiver->get_root ()->get_kind () == TyTy::TypeKind::DYNAMIC;
+ bool is_generic_receiver = receiver->get_kind () == TyTy::TypeKind::PARAM;
+ if (is_generic_receiver)
+ {
+ TyTy::ParamType *p = static_cast<TyTy::ParamType *> (receiver);
+ receiver = p->resolve ();
+ }
+
+ if (is_dyn_dispatch)
+ {
+ const TyTy::DynamicObjectType *dyn
+ = static_cast<const TyTy::DynamicObjectType *> (receiver->get_root ());
+
+ std::vector<HIR::Expr *> arguments;
+ if (rhs_expr != nullptr) // can be null for negation_expr (unary ones)
+ arguments.push_back (rhs_expr);
+
+ return compile_dyn_dispatch_call (dyn, receiver, fntype, lhs, arguments,
+ expr.get_locus ());
+ }
+
+ // lookup compiled functions since it may have already been compiled
+ HIR::PathIdentSegment segment_name (
+ Analysis::RustLangItem::ToString (lang_item_type));
+ tree fn_expr
+ = resolve_method_address (fntype, ref, receiver, segment_name,
+ expr.get_mappings (), expr.get_locus ());
+
+ // lookup the autoderef mappings
+ std::vector<Resolver::Adjustment> *adjustments = nullptr;
+ ok = ctx->get_tyctx ()->lookup_autoderef_mappings (
+ expr.get_mappings ().get_hirid (), &adjustments);
+ rust_assert (ok);
+
+ // apply adjustments for the fn call
+ tree self = resolve_adjustements (*adjustments, lhs, lhs_expr->get_locus ());
+
+ std::vector<tree> args;
+ args.push_back (self); // adjusted self
+ if (rhs != nullptr) // can be null for negation_expr (unary ones)
+ args.push_back (rhs);
+
+ auto fncontext = ctx->peek_fn ();
+ return ctx->get_backend ()->call_expression (fncontext.fndecl, fn_expr, args,
+ nullptr, expr.get_locus ());
+}
+
+tree
+CompileExpr::compile_bool_literal (const HIR::LiteralExpr &expr,
+ const TyTy::BaseType *tyty)
+{
+ rust_assert (expr.get_lit_type () == HIR::Literal::BOOL);
+
+ const auto literal_value = expr.get_literal ();
+ bool bval = literal_value.as_string ().compare ("true") == 0;
+ return ctx->get_backend ()->boolean_constant_expression (bval);
+}
+
+tree
+CompileExpr::compile_integer_literal (const HIR::LiteralExpr &expr,
+ const TyTy::BaseType *tyty)
+{
+ rust_assert (expr.get_lit_type () == HIR::Literal::INT);
+ const auto literal_value = expr.get_literal ();
+
+ tree type = TyTyResolveCompile::compile (ctx, tyty);
+ rust_assert (TREE_CODE (type) == INTEGER_TYPE);
+
+ mpz_t ival;
+ if (mpz_init_set_str (ival, literal_value.as_string ().c_str (), 10) != 0)
+ {
+ rust_error_at (expr.get_locus (), "bad number in literal");
+ return error_mark_node;
+ }
+
+ mpz_t type_min;
+ mpz_t type_max;
+ mpz_init (type_min);
+ mpz_init (type_max);
+ get_type_static_bounds (type, type_min, type_max);
+
+ if (mpz_cmp (ival, type_min) < 0 || mpz_cmp (ival, type_max) > 0)
+ {
+ rust_error_at (expr.get_locus (),
+ "integer overflows the respective type %<%s%>",
+ tyty->get_name ().c_str ());
+ return error_mark_node;
+ }
+ return double_int_to_tree (type, mpz_get_double_int (type, ival, true));
+}
+
+tree
+CompileExpr::compile_float_literal (const HIR::LiteralExpr &expr,
+ const TyTy::BaseType *tyty)
+{
+ rust_assert (expr.get_lit_type () == HIR::Literal::FLOAT);
+ const auto literal_value = expr.get_literal ();
+
+ mpfr_t fval;
+ if (mpfr_init_set_str (fval, literal_value.as_string ().c_str (), 10,
+ MPFR_RNDN)
+ != 0)
+ {
+ rust_error_at (expr.get_locus (), "bad number in literal");
+ return error_mark_node;
+ }
+
+ tree type = TyTyResolveCompile::compile (ctx, tyty);
+
+ // taken from:
+ // see go/gofrontend/expressions.cc:check_float_type
+ mpfr_exp_t exp = mpfr_get_exp (fval);
+ bool real_value_overflow = exp > TYPE_PRECISION (type);
+
+ REAL_VALUE_TYPE r1;
+ real_from_mpfr (&r1, fval, type, GMP_RNDN);
+ REAL_VALUE_TYPE r2;
+ real_convert (&r2, TYPE_MODE (type), &r1);
+
+ tree real_value = build_real (type, r2);
+ if (TREE_OVERFLOW (real_value) || real_value_overflow)
+ {
+ rust_error_at (expr.get_locus (),
+ "decimal overflows the respective type %<%s%>",
+ tyty->get_name ().c_str ());
+ return error_mark_node;
+ }
+
+ return real_value;
+}
+
+tree
+CompileExpr::compile_char_literal (const HIR::LiteralExpr &expr,
+ const TyTy::BaseType *tyty)
+{
+ rust_assert (expr.get_lit_type () == HIR::Literal::CHAR);
+ const auto literal_value = expr.get_literal ();
+
+ // FIXME needs wchar_t
+ char c = literal_value.as_string ().c_str ()[0];
+ return ctx->get_backend ()->wchar_constant_expression (c);
+}
+
+tree
+CompileExpr::compile_byte_literal (const HIR::LiteralExpr &expr,
+ const TyTy::BaseType *tyty)
+{
+ rust_assert (expr.get_lit_type () == HIR::Literal::BYTE);
+ const auto literal_value = expr.get_literal ();
+
+ tree type = TyTyResolveCompile::compile (ctx, tyty);
+ char c = literal_value.as_string ().c_str ()[0];
+ return build_int_cst (type, c);
+}
+
+tree
+CompileExpr::compile_string_literal (const HIR::LiteralExpr &expr,
+ const TyTy::BaseType *tyty)
+{
+ rust_assert (expr.get_lit_type () == HIR::Literal::STRING);
+ const auto literal_value = expr.get_literal ();
+
+ auto base = ctx->get_backend ()->string_constant_expression (
+ literal_value.as_string ());
+ return ctx->get_backend ()->address_expression (base, expr.get_locus ());
+}
+
+tree
+CompileExpr::compile_byte_string_literal (const HIR::LiteralExpr &expr,
+ const TyTy::BaseType *tyty)
+{
+ rust_assert (expr.get_lit_type () == HIR::Literal::BYTE_STRING);
+
+ // the type here is &[ty; capacity]
+ rust_assert (tyty->get_kind () == TyTy::TypeKind::REF);
+ const auto ref_tyty = static_cast<const TyTy::ReferenceType *> (tyty);
+ auto base_tyty = ref_tyty->get_base ();
+ rust_assert (base_tyty->get_kind () == TyTy::TypeKind::ARRAY);
+ auto array_tyty = static_cast<TyTy::ArrayType *> (base_tyty);
+
+ std::string value_str = expr.get_literal ().as_string ();
+ std::vector<tree> vals;
+ std::vector<unsigned long> indexes;
+ for (size_t i = 0; i < value_str.size (); i++)
+ {
+ char b = value_str.at (i);
+ tree bb = ctx->get_backend ()->char_constant_expression (b);
+ vals.push_back (bb);
+ indexes.push_back (i);
+ }
+
+ tree array_type = TyTyResolveCompile::compile (ctx, array_tyty);
+ tree constructed
+ = ctx->get_backend ()->array_constructor_expression (array_type, indexes,
+ vals,
+ expr.get_locus ());
+
+ return ctx->get_backend ()->address_expression (constructed,
+ expr.get_locus ());
+}
+
+tree
+CompileExpr::type_cast_expression (tree type_to_cast_to, tree expr_tree,
+ Location location)
+{
+ if (type_to_cast_to == error_mark_node || expr_tree == error_mark_node
+ || TREE_TYPE (expr_tree) == error_mark_node)
+ return error_mark_node;
+
+ if (ctx->get_backend ()->type_size (type_to_cast_to) == 0
+ || TREE_TYPE (expr_tree) == void_type_node)
+ {
+ // Do not convert zero-sized types.
+ return expr_tree;
+ }
+ else if (TREE_CODE (type_to_cast_to) == INTEGER_TYPE)
+ {
+ tree cast = fold (convert_to_integer (type_to_cast_to, expr_tree));
+ // FIXME check for TREE_OVERFLOW?
+ return cast;
+ }
+ else if (TREE_CODE (type_to_cast_to) == REAL_TYPE)
+ {
+ tree cast = fold (convert_to_real (type_to_cast_to, expr_tree));
+ // FIXME
+ // We might need to check that the tree is MAX val and thusly saturate it
+ // to inf. we can get the bounds and check the value if its >= or <= to
+ // the min and max bounds
+ //
+ // https://github.com/Rust-GCC/gccrs/issues/635
+ return cast;
+ }
+ else if (TREE_CODE (type_to_cast_to) == COMPLEX_TYPE)
+ {
+ return fold (convert_to_complex (type_to_cast_to, expr_tree));
+ }
+ else if (TREE_CODE (type_to_cast_to) == POINTER_TYPE
+ && TREE_CODE (TREE_TYPE (expr_tree)) == INTEGER_TYPE)
+ {
+ return fold (convert_to_pointer (type_to_cast_to, expr_tree));
+ }
+ else if (TREE_CODE (type_to_cast_to) == RECORD_TYPE
+ || TREE_CODE (type_to_cast_to) == ARRAY_TYPE)
+ {
+ return fold_build1_loc (location.gcc_location (), VIEW_CONVERT_EXPR,
+ type_to_cast_to, expr_tree);
+ }
+
+ return fold_convert_loc (location.gcc_location (), type_to_cast_to,
+ expr_tree);
+}
+
+void
+CompileExpr::visit (HIR::ArrayExpr &expr)
+{
+ TyTy::BaseType *tyty = nullptr;
+ if (!ctx->get_tyctx ()->lookup_type (expr.get_mappings ().get_hirid (),
+ &tyty))
+ {
+ rust_fatal_error (expr.get_locus (),
+ "did not resolve type for this array expr");
+ return;
+ }
+
+ tree array_type = TyTyResolveCompile::compile (ctx, tyty);
+ if (TREE_CODE (array_type) != ARRAY_TYPE)
+ {
+ translated = error_mark_node;
+ return;
+ }
+
+ rust_assert (tyty->get_kind () == TyTy::TypeKind::ARRAY);
+ const TyTy::ArrayType &array_tyty
+ = static_cast<const TyTy::ArrayType &> (*tyty);
+
+ HIR::ArrayElems &elements = *expr.get_internal_elements ();
+ switch (elements.get_array_expr_type ())
+ {
+ case HIR::ArrayElems::ArrayExprType::VALUES: {
+ HIR::ArrayElemsValues &elems
+ = static_cast<HIR::ArrayElemsValues &> (elements);
+ translated
+ = array_value_expr (expr.get_locus (), array_tyty, array_type, elems);
+ }
+ return;
+
+ case HIR::ArrayElems::ArrayExprType::COPIED:
+ HIR::ArrayElemsCopied &elems
+ = static_cast<HIR::ArrayElemsCopied &> (elements);
+ translated
+ = array_copied_expr (expr.get_locus (), array_tyty, array_type, elems);
+ }
+}
+
+tree
+CompileExpr::array_value_expr (Location expr_locus,
+ const TyTy::ArrayType &array_tyty,
+ tree array_type, HIR::ArrayElemsValues &elems)
+{
+ std::vector<unsigned long> indexes;
+ std::vector<tree> constructor;
+ size_t i = 0;
+ for (auto &elem : elems.get_values ())
+ {
+ tree translated_expr = CompileExpr::Compile (elem.get (), ctx);
+ constructor.push_back (translated_expr);
+ indexes.push_back (i++);
+ }
+
+ return ctx->get_backend ()->array_constructor_expression (array_type, indexes,
+ constructor,
+ expr_locus);
+}
+
+tree
+CompileExpr::array_copied_expr (Location expr_locus,
+ const TyTy::ArrayType &array_tyty,
+ tree array_type, HIR::ArrayElemsCopied &elems)
+{
- // see gcc/cp/typeck2.c:1369-1401
++ // see gcc/cp/typeck2.cc:1369-1401
+ gcc_assert (TREE_CODE (array_type) == ARRAY_TYPE);
+ tree domain = TYPE_DOMAIN (array_type);
+ if (!domain)
+ return error_mark_node;
+
+ if (!TREE_CONSTANT (TYPE_MAX_VALUE (domain)))
+ {
+ rust_error_at (expr_locus, "non const capacity domain %qT", array_type);
+ return error_mark_node;
+ }
+
+ tree capacity_expr = CompileExpr::Compile (elems.get_num_copies_expr (), ctx);
+ if (!TREE_CONSTANT (capacity_expr))
+ {
+ rust_error_at (expr_locus, "non const num copies %qT", array_type);
+ return error_mark_node;
+ }
+
+ // get the compiled value
+ tree translated_expr = CompileExpr::Compile (elems.get_elem_to_copy (), ctx);
+
+ tree max_domain = TYPE_MAX_VALUE (domain);
+ tree min_domain = TYPE_MIN_VALUE (domain);
+
+ auto max = wi::to_offset (max_domain);
+ auto min = wi::to_offset (min_domain);
+ auto precision = TYPE_PRECISION (TREE_TYPE (domain));
+ auto sign = TYPE_SIGN (TREE_TYPE (domain));
+ unsigned HOST_WIDE_INT len
+ = wi::ext (max - min + 1, precision, sign).to_uhwi ();
+
+ // create the constructor
+ size_t idx = 0;
+ std::vector<unsigned long> indexes;
+ std::vector<tree> constructor;
+ for (unsigned HOST_WIDE_INT i = 0; i < len; i++)
+ {
+ constructor.push_back (translated_expr);
+ indexes.push_back (idx++);
+ }
+
+ return ctx->get_backend ()->array_constructor_expression (array_type, indexes,
+ constructor,
+ expr_locus);
+}
+
+tree
+HIRCompileBase::resolve_adjustements (
+ std::vector<Resolver::Adjustment> &adjustments, tree expression,
+ Location locus)
+{
+ tree e = expression;
+ for (auto &adjustment : adjustments)
+ {
+ switch (adjustment.get_type ())
+ {
+ case Resolver::Adjustment::AdjustmentType::ERROR:
+ return error_mark_node;
+
+ case Resolver::Adjustment::AdjustmentType::IMM_REF:
+ case Resolver::Adjustment::AdjustmentType::MUT_REF:
+ e = ctx->get_backend ()->address_expression (e, locus);
+ break;
+
+ case Resolver::Adjustment::AdjustmentType::DEREF_REF:
+ e = resolve_deref_adjustment (adjustment, e, locus);
+ break;
+ }
+ }
+
+ return e;
+}
+
+tree
+HIRCompileBase::resolve_deref_adjustment (Resolver::Adjustment &adjustment,
+ tree expression, Location locus)
+{
+ rust_assert (adjustment.is_deref_adjustment ());
+
+ tree expected_type
+ = TyTyResolveCompile::compile (ctx, adjustment.get_expected ());
+ if (!adjustment.has_operator_overload ())
+ {
+ return ctx->get_backend ()->indirect_expression (expected_type,
+ expression,
+ true, /* known_valid*/
+ locus);
+ }
+
+ TyTy::FnType *lookup = adjustment.get_deref_operator_fn ();
+ HIR::ImplItem *resolved_item = adjustment.get_deref_hir_item ();
+
+ tree fn_address = error_mark_node;
+ if (!lookup->has_subsititions_defined ())
+ fn_address = CompileInherentImplItem::Compile (resolved_item, ctx, nullptr,
+ true, locus);
+ else
+ fn_address = CompileInherentImplItem::Compile (resolved_item, ctx, lookup,
+ true, locus);
+
+ // does it need a reference to call
+ tree adjusted_argument = expression;
+ bool needs_borrow = adjustment.get_deref_adjustment_type ()
+ != Resolver::Adjustment::AdjustmentType::ERROR;
+ if (needs_borrow)
+ {
+ adjusted_argument
+ = ctx->get_backend ()->address_expression (expression, locus);
+ }
+
+ // make the call
+ auto fncontext = ctx->peek_fn ();
+ tree deref_call
+ = ctx->get_backend ()->call_expression (fncontext.fndecl, fn_address,
+ {adjusted_argument}, nullptr,
+ locus);
+
+ // do the indirect expression
+ return ctx->get_backend ()->indirect_expression (expected_type, deref_call,
+ true, /* known_valid*/
+ locus);
+}
+
+void
+CompileExpr::visit (HIR::IdentifierExpr &expr)
+{
+ NodeId ast_node_id = expr.get_mappings ().get_nodeid ();
+
+ bool is_value = false;
+ NodeId ref_node_id = UNKNOWN_NODEID;
+ if (ctx->get_resolver ()->lookup_resolved_name (ast_node_id, &ref_node_id))
+ {
+ // these ref_node_ids will resolve to a pattern declaration but we are
+ // interested in the definition that this refers to get the parent id
+ Resolver::Definition def;
+ if (!ctx->get_resolver ()->lookup_definition (ref_node_id, &def))
+ {
+ rust_error_at (expr.get_locus (),
+ "unknown reference for resolved name");
+ return;
+ }
+ ref_node_id = def.parent;
+ is_value = true;
+ }
+ else if (!ctx->get_resolver ()->lookup_resolved_type (ast_node_id,
+ &ref_node_id))
+ {
+ rust_error_at (expr.get_locus (),
+ "Failed to lookup type reference for node: %s",
+ expr.as_string ().c_str ());
+ return;
+ }
+
+ if (ref_node_id == UNKNOWN_NODEID)
+ {
+ rust_fatal_error (expr.get_locus (), "unresolved IdentifierExpr: %s",
+ expr.as_string ().c_str ());
+ return;
+ }
+
+ // node back to HIR
+ HirId ref;
+ if (!ctx->get_mappings ()->lookup_node_to_hir (
+ expr.get_mappings ().get_crate_num (), ref_node_id, &ref))
+ {
+ rust_error_at (expr.get_locus (), "reverse lookup failure");
+ return;
+ }
+
+ TyTy::BaseType *lookup = nullptr;
+ if (!ctx->get_tyctx ()->lookup_type (ref, &lookup))
+ {
+ rust_fatal_error (expr.get_locus (),
+ "failed to find type relevant to this context: %s",
+ expr.get_mappings ().as_string ().c_str ());
+ return;
+ }
+
+ bool is_type_ref = !is_value;
+ if (is_type_ref)
+ {
+ // this might be a case for
+ //
+ // struct S;
+ //
+ // fn main() {
+ // let s = S;
+ // }
+
+ if (lookup->is_unit ())
+ {
+ translated = ctx->get_backend ()->unit_expression ();
+ return;
+ }
+
+ // rust actually treats like this an fn call or structs with fields but
+ // unit structs are just the struct name lets catch it with an is-unit
+ // check
+ gcc_unreachable ();
+ }
+
+ tree fn = NULL_TREE;
+ Bvariable *var = nullptr;
+ if (ctx->lookup_const_decl (ref, &translated))
+ {
+ return;
+ }
+ else if (ctx->lookup_function_decl (ref, &fn))
+ {
+ translated
+ = ctx->get_backend ()->function_code_expression (fn, expr.get_locus ());
+ }
+ else if (ctx->lookup_var_decl (ref, &var))
+ {
+ translated = ctx->get_backend ()->var_expression (var, expr.get_locus ());
+ }
+ else if (ctx->lookup_pattern_binding (ref, &translated))
+ {
+ return;
+ }
+ else
+ {
+ // lets try and query compile it to an item/impl item
+ HIR::Item *resolved_item = ctx->get_mappings ()->lookup_hir_item (
+ expr.get_mappings ().get_crate_num (), ref);
+ bool is_hir_item = resolved_item != nullptr;
+ if (!is_hir_item)
+ {
+ translated = error_mark_node;
+ return;
+ }
+
+ if (!lookup->has_subsititions_defined ())
+ translated = CompileItem::compile (resolved_item, ctx, nullptr, true,
+ expr.get_locus ());
+ else
+ translated = CompileItem::compile (resolved_item, ctx, lookup, true,
+ expr.get_locus ());
+ }
+}
+
+} // namespace Compile
+} // namespace Rust
diff --cc gcc/rust/backend/rust-compile-type.cc
index 11784c99098,00000000000..6de063b7f6e
mode 100644,000000..100644
--- a/gcc/rust/backend/rust-compile-type.cc
+++ b/gcc/rust/backend/rust-compile-type.cc
@@@ -1,508 -1,0 +1,508 @@@
+// Copyright (C) 2020-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/>.
+
+#include "rust-compile-type.h"
+#include "rust-compile-expr.h"
+#include "rust-constexpr.h"
+
+#include "tree.h"
+#include "print-tree.h"
+
+namespace Rust {
+namespace Compile {
+
+static const std::string RUST_ENUM_DISR_FIELD_NAME = "RUST$ENUM$DISR";
+
- // see: gcc/c/c-decl.c:8230-8241
++// see: gcc/c/c-decl.cc:8230-8241
+// https://github.com/Rust-GCC/gccrs/blob/0024bc2f028369b871a65ceb11b2fddfb0f9c3aa/gcc/c/c-decl.c#L8229-L8241
+tree
+TyTyResolveCompile::get_implicit_enumeral_node_type (Context *ctx)
+{
+ // static tree enum_node = NULL_TREE;
+ // if (enum_node == NULL_TREE)
+ // {
+ // enum_node = make_node (ENUMERAL_TYPE);
+ // SET_TYPE_MODE (enum_node, TYPE_MODE (unsigned_type_node));
+ // SET_TYPE_ALIGN (enum_node, TYPE_ALIGN (unsigned_type_node));
+ // TYPE_USER_ALIGN (enum_node) = 0;
+ // TYPE_UNSIGNED (enum_node) = 1;
+ // TYPE_PRECISION (enum_node) = TYPE_PRECISION (unsigned_type_node);
+ // TYPE_MIN_VALUE (enum_node) = TYPE_MIN_VALUE (unsigned_type_node);
+ // TYPE_MAX_VALUE (enum_node) = TYPE_MAX_VALUE (unsigned_type_node);
+
+ // // tree identifier = ctx->get_backend ()->get_identifier_node
+ // // ("enumeral"); tree enum_decl
+ // // = build_decl (BUILTINS_LOCATION, TYPE_DECL, identifier,
+ // enum_node);
+ // // TYPE_NAME (enum_node) = enum_decl;
+ // }
+ // return enum_node;
+
+ static tree enum_node = NULL_TREE;
+ if (enum_node == NULL_TREE)
+ {
+ enum_node = ctx->get_backend ()->named_type (
+ "enumeral", ctx->get_backend ()->integer_type (false, 64),
+ Linemap::predeclared_location ());
+ }
+ return enum_node;
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::ErrorType &)
+{
+ translated = error_mark_node;
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::InferType &)
+{
+ translated = error_mark_node;
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::ClosureType &)
+{
+ gcc_unreachable ();
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::ProjectionType &type)
+{
+ type.get ()->accept_vis (*this);
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::PlaceholderType &type)
+{
+ type.resolve ()->accept_vis (*this);
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::ParamType ¶m)
+{
+ recursion_count++;
+ rust_assert (recursion_count < kDefaultRecusionLimit);
+
+ param.resolve ()->accept_vis (*this);
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::FnType &type)
+{
+ Backend::typed_identifier receiver;
+ std::vector<Backend::typed_identifier> parameters;
+ std::vector<Backend::typed_identifier> results;
+
+ if (!type.get_return_type ()->is_unit ())
+ {
+ auto hir_type = type.get_return_type ();
+ auto ret = TyTyResolveCompile::compile (ctx, hir_type, trait_object_mode);
+ results.push_back (Backend::typed_identifier (
+ "_", ret,
+ ctx->get_mappings ()->lookup_location (hir_type->get_ref ())));
+ }
+
+ for (auto ¶m_pair : type.get_params ())
+ {
+ auto param_tyty = param_pair.second;
+ auto compiled_param_type
+ = TyTyResolveCompile::compile (ctx, param_tyty, trait_object_mode);
+
+ auto compiled_param = Backend::typed_identifier (
+ param_pair.first->as_string (), compiled_param_type,
+ ctx->get_mappings ()->lookup_location (param_tyty->get_ref ()));
+
+ parameters.push_back (compiled_param);
+ }
+
+ if (!type.is_varadic ())
+ translated
+ = ctx->get_backend ()->function_type (receiver, parameters, results, NULL,
+ type.get_ident ().locus);
+ else
+ translated
+ = ctx->get_backend ()->function_type_varadic (receiver, parameters,
+ results, NULL,
+ type.get_ident ().locus);
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::FnPtr &type)
+{
+ tree result_type = TyTyResolveCompile::compile (ctx, type.get_return_type ());
+
+ std::vector<tree> parameters;
+ type.iterate_params ([&] (TyTy::BaseType *p) mutable -> bool {
+ tree pty = TyTyResolveCompile::compile (ctx, p);
+ parameters.push_back (pty);
+ return true;
+ });
+
+ translated = ctx->get_backend ()->function_ptr_type (result_type, parameters,
+ type.get_ident ().locus);
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::ADTType &type)
+{
+ if (ctx->lookup_compiled_types (type.get_ty_ref (), &translated, &type))
+ return;
+
+ tree type_record = error_mark_node;
+ if (!type.is_enum ())
+ {
+ rust_assert (type.number_of_variants () == 1);
+
+ TyTy::VariantDef &variant = *type.get_variants ().at (0);
+ std::vector<Backend::typed_identifier> fields;
+ for (size_t i = 0; i < variant.num_fields (); i++)
+ {
+ const TyTy::StructFieldType *field = variant.get_field_at_index (i);
+ tree compiled_field_ty
+ = TyTyResolveCompile::compile (ctx, field->get_field_type ());
+
+ Backend::typed_identifier f (field->get_name (), compiled_field_ty,
+ ctx->get_mappings ()->lookup_location (
+ type.get_ty_ref ()));
+ fields.push_back (std::move (f));
+ }
+
+ type_record = type.is_union ()
+ ? ctx->get_backend ()->union_type (fields)
+ : ctx->get_backend ()->struct_type (fields);
+ }
+ else
+ {
+ // see:
+ // https://github.com/bminor/binutils-gdb/blob/527b8861cd472385fa9160a91dd6d65a25c41987/gdb/dwarf2/read.c#L9010-L9241
+ //
+ // enums are actually a big union so for example the rust enum:
+ //
+ // enum AnEnum {
+ // A,
+ // B,
+ // C (char),
+ // D { x: i64, y: i64 },
+ // }
+ //
+ // we actually turn this into
+ //
+ // union {
+ // struct A { int RUST$ENUM$DISR; }; <- this is a data-less variant
+ // struct B { int RUST$ENUM$DISR; }; <- this is a data-less variant
+ // struct C { int RUST$ENUM$DISR; char __0; };
+ // struct D { int RUST$ENUM$DISR; i64 x; i64 y; };
+ // }
+ //
+ // Ada, qual_union_types might still work for this but I am not 100% sure.
+ // I ran into some issues lets reuse our normal union and ask Ada people
+ // about it.
+
+ std::vector<tree> variant_records;
+ for (auto &variant : type.get_variants ())
+ {
+ std::vector<Backend::typed_identifier> fields;
+
+ // add in the qualifier field for the variant
+ tree enumeral_type
+ = TyTyResolveCompile::get_implicit_enumeral_node_type (ctx);
+ Backend::typed_identifier f (RUST_ENUM_DISR_FIELD_NAME, enumeral_type,
+ ctx->get_mappings ()->lookup_location (
+ variant->get_id ()));
+ fields.push_back (std::move (f));
+
+ // compile the rest of the fields
+ for (size_t i = 0; i < variant->num_fields (); i++)
+ {
+ const TyTy::StructFieldType *field
+ = variant->get_field_at_index (i);
+ tree compiled_field_ty
+ = TyTyResolveCompile::compile (ctx, field->get_field_type ());
+
+ std::string field_name = field->get_name ();
+ if (variant->get_variant_type ()
+ == TyTy::VariantDef::VariantType::TUPLE)
+ field_name = "__" + field->get_name ();
+
+ Backend::typed_identifier f (
+ field_name, compiled_field_ty,
+ ctx->get_mappings ()->lookup_location (type.get_ty_ref ()));
+ fields.push_back (std::move (f));
+ }
+
+ tree variant_record = ctx->get_backend ()->struct_type (fields);
+ tree named_variant_record = ctx->get_backend ()->named_type (
+ variant->get_ident ().path.get (), variant_record,
+ variant->get_ident ().locus);
+
+ // set the qualifier to be a builtin
+ DECL_ARTIFICIAL (TYPE_FIELDS (variant_record)) = 1;
+
+ // add them to the list
+ variant_records.push_back (named_variant_record);
+ }
+
+ // now we need to make the actual union, but first we need to make
+ // named_type TYPE_DECL's out of the variants
+
+ size_t i = 0;
+ std::vector<Backend::typed_identifier> enum_fields;
+ for (auto &variant_record : variant_records)
+ {
+ TyTy::VariantDef *variant = type.get_variants ().at (i++);
+ std::string implicit_variant_name = variant->get_identifier ();
+
+ Backend::typed_identifier f (implicit_variant_name, variant_record,
+ ctx->get_mappings ()->lookup_location (
+ type.get_ty_ref ()));
+ enum_fields.push_back (std::move (f));
+ }
+
+ // finally make the union or the enum
+ type_record = ctx->get_backend ()->union_type (enum_fields);
+ }
+
+ std::string named_struct_str
+ = type.get_ident ().path.get () + type.subst_as_string ();
+ tree named_struct
+ = ctx->get_backend ()->named_type (named_struct_str, type_record,
+ type.get_ident ().locus);
+
+ ctx->push_type (named_struct);
+ translated = named_struct;
+
+ ctx->insert_compiled_type (type.get_ty_ref (), named_struct, &type);
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::TupleType &type)
+{
+ if (type.num_fields () == 0)
+ {
+ translated = ctx->get_backend ()->unit_type ();
+ return;
+ }
+
+ bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &translated, &type);
+ if (ok)
+ return;
+
+ // create implicit struct
+ std::vector<Backend::typed_identifier> fields;
+ for (size_t i = 0; i < type.num_fields (); i++)
+ {
+ TyTy::BaseType *field = type.get_field (i);
+ tree compiled_field_ty = TyTyResolveCompile::compile (ctx, field);
+
+ // rustc uses the convention __N, where N is an integer, to
+ // name the fields of a tuple. We follow this as well,
+ // because this is used by GDB. One further reason to prefer
+ // this, rather than simply emitting the integer, is that this
+ // approach makes it simpler to use a C-only debugger, or
+ // GDB's C mode, when debugging Rust.
+ Backend::typed_identifier f ("__" + std::to_string (i), compiled_field_ty,
+ ctx->get_mappings ()->lookup_location (
+ type.get_ty_ref ()));
+ fields.push_back (std::move (f));
+ }
+
+ tree struct_type_record = ctx->get_backend ()->struct_type (fields);
+ tree named_struct
+ = ctx->get_backend ()->named_type (type.as_string (), struct_type_record,
+ type.get_ident ().locus);
+
+ ctx->push_type (named_struct);
+ ctx->insert_compiled_type (type.get_ty_ref (), named_struct, &type);
+ translated = named_struct;
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::ArrayType &type)
+{
+ tree element_type
+ = TyTyResolveCompile::compile (ctx, type.get_element_type ());
+ tree capacity_expr = CompileExpr::Compile (&type.get_capacity_expr (), ctx);
+ tree folded_capacity_expr = ConstCtx::fold (capacity_expr);
+
+ translated
+ = ctx->get_backend ()->array_type (element_type, folded_capacity_expr);
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::BoolType &type)
+{
+ tree compiled_type = nullptr;
+ bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type);
+ rust_assert (ok);
+ translated = compiled_type;
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::IntType &type)
+{
+ tree compiled_type = nullptr;
+ bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type);
+ rust_assert (ok);
+ translated = compiled_type;
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::UintType &type)
+{
+ tree compiled_type = nullptr;
+ bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type);
+ rust_assert (ok);
+ translated = compiled_type;
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::FloatType &type)
+{
+ tree compiled_type = nullptr;
+ bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type);
+ rust_assert (ok);
+ translated = compiled_type;
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::USizeType &type)
+{
+ tree compiled_type = nullptr;
+ bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type);
+ rust_assert (ok);
+ translated = compiled_type;
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::ISizeType &type)
+{
+ tree compiled_type = nullptr;
+ bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type);
+ rust_assert (ok);
+ translated = compiled_type;
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::CharType &type)
+{
+ tree compiled_type = nullptr;
+ bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type);
+ rust_assert (ok);
+ translated = compiled_type;
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::ReferenceType &type)
+{
+ tree base_compiled_type
+ = TyTyResolveCompile::compile (ctx, type.get_base (), trait_object_mode);
+ if (type.is_mutable ())
+ {
+ translated = ctx->get_backend ()->reference_type (base_compiled_type);
+ }
+ else
+ {
+ auto base = ctx->get_backend ()->immutable_type (base_compiled_type);
+ translated = ctx->get_backend ()->reference_type (base);
+ }
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::PointerType &type)
+{
+ tree base_compiled_type
+ = TyTyResolveCompile::compile (ctx, type.get_base (), trait_object_mode);
+ if (type.is_mutable ())
+ {
+ translated = ctx->get_backend ()->pointer_type (base_compiled_type);
+ }
+ else
+ {
+ auto base = ctx->get_backend ()->immutable_type (base_compiled_type);
+ translated = ctx->get_backend ()->pointer_type (base);
+ }
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::StrType &type)
+{
+ tree compiled_type = nullptr;
+ bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &compiled_type);
+ rust_assert (ok);
+ translated = compiled_type;
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::NeverType &)
+{
+ translated = ctx->get_backend ()->unit_type ();
+}
+
+void
+TyTyResolveCompile::visit (const TyTy::DynamicObjectType &type)
+{
+ if (trait_object_mode)
+ {
+ translated = ctx->get_backend ()->integer_type (
+ true, ctx->get_backend ()->get_pointer_size ());
+ return;
+ }
+
+ if (ctx->lookup_compiled_types (type.get_ty_ref (), &translated, &type))
+ return;
+
+ // create implicit struct
+ auto items = type.get_object_items ();
+ std::vector<Backend::typed_identifier> fields;
+
+ tree uint = ctx->get_backend ()->integer_type (
+ true, ctx->get_backend ()->get_pointer_size ());
+ tree uintptr_ty = ctx->get_backend ()->pointer_type (uint);
+
+ Backend::typed_identifier f ("__receiver_trait_obj_ptr", uintptr_ty,
+ ctx->get_mappings ()->lookup_location (
+ type.get_ty_ref ()));
+ fields.push_back (std::move (f));
+
+ for (size_t i = 0; i < items.size (); i++)
+ {
+ // mrustc seems to make a vtable consisting of uintptr's
+ tree uint = ctx->get_backend ()->integer_type (
+ true, ctx->get_backend ()->get_pointer_size ());
+ tree uintptr_ty = ctx->get_backend ()->pointer_type (uint);
+
+ Backend::typed_identifier f ("__" + std::to_string (i), uintptr_ty,
+ ctx->get_mappings ()->lookup_location (
+ type.get_ty_ref ()));
+ fields.push_back (std::move (f));
+ }
+
+ tree type_record = ctx->get_backend ()->struct_type (fields);
+ tree named_struct
+ = ctx->get_backend ()->named_type (type.get_name (), type_record,
+ type.get_ident ().locus);
+
+ ctx->push_type (named_struct);
+ translated = named_struct;
+
+ ctx->insert_compiled_type (type.get_ty_ref (), named_struct, &type);
+}
+
+} // namespace Compile
+} // namespace Rust
diff --cc gcc/rust/backend/rust-constexpr.cc
index 293f1108d84,00000000000..f1f969c02de
mode 100644,000000..100644
--- a/gcc/rust/backend/rust-constexpr.cc
+++ b/gcc/rust/backend/rust-constexpr.cc
@@@ -1,428 -1,0 +1,428 @@@
+// This file is part of GCC.
+
+// GCC is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 3, or (at your option) any later
+// version.
+
+// GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with GCC; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include "rust-constexpr.h"
+#include "rust-location.h"
+#include "rust-diagnostics.h"
+
+#include "fold-const.h"
+#include "realmpfr.h"
+#include "convert.h"
+#include "print-tree.h"
+#include "gimplify.h"
+#include "tree-iterator.h"
+
+/* Returns true if NODE is a pointer. */
+#define TYPE_PTR_P(NODE) (TREE_CODE (NODE) == POINTER_TYPE)
+
+/* Returns true if NODE is a reference. */
+#define TYPE_REF_P(NODE) (TREE_CODE (NODE) == REFERENCE_TYPE)
+
+/* Returns true if NODE is a pointer or a reference. */
+#define INDIRECT_TYPE_P(NODE) (TYPE_PTR_P (NODE) || TYPE_REF_P (NODE))
+
+/* [basic.fundamental]
+
+ Types bool, char, wchar_t, and the signed and unsigned integer types
+ are collectively called integral types.
+
+ Note that INTEGRAL_TYPE_P, as defined in tree.h, allows enumeration
+ types as well, which is incorrect in C++. Keep these checks in
+ ascending code order. */
+#define RS_INTEGRAL_TYPE_P(TYPE) \
+ (TREE_CODE (TYPE) == BOOLEAN_TYPE || TREE_CODE (TYPE) == INTEGER_TYPE)
+
+/* [basic.fundamental]
+
+ Integral and floating types are collectively called arithmetic
+ types.
+
+ As a GNU extension, we also accept complex types.
+
+ Keep these checks in ascending code order. */
+#define ARITHMETIC_TYPE_P(TYPE) \
+ (RS_INTEGRAL_TYPE_P (TYPE) || TREE_CODE (TYPE) == REAL_TYPE \
+ || TREE_CODE (TYPE) == COMPLEX_TYPE)
+
+/* True iff TYPE is cv decltype(nullptr). */
+#define NULLPTR_TYPE_P(TYPE) (TREE_CODE (TYPE) == NULLPTR_TYPE)
+
+/* [basic.types]
+
+ Arithmetic types, enumeration types, pointer types,
+ pointer-to-member types, and std::nullptr_t are collectively called
+ scalar types.
+
+ Keep these checks in ascending code order. */
+#define SCALAR_TYPE_P(TYPE) \
+ (TREE_CODE (TYPE) == ENUMERAL_TYPE || ARITHMETIC_TYPE_P (TYPE) \
+ || TYPE_PTR_P (TYPE) || NULLPTR_TYPE_P (TYPE))
+
+namespace Rust {
+namespace Compile {
+
+static tree
+constant_value_1 (tree decl, bool strict_p, bool return_aggregate_cst_ok_p,
+ bool unshare_p);
+tree
+decl_constant_value (tree decl, bool unshare_p);
+
+static void
+non_const_var_error (location_t loc, tree r);
+
+static tree
+get_function_named_in_call (tree t);
+
+ConstCtx::ConstCtx () : constexpr_ops_count (0) {}
+
+tree
+ConstCtx::fold (tree expr)
+{
+ tree folded = ConstCtx ().constexpr_expression (expr);
+ rust_assert (folded != NULL_TREE);
+ return folded;
+}
+
+tree
+ConstCtx::constexpr_expression (tree t)
+{
+ location_t loc = EXPR_LOCATION (t);
+ if (CONSTANT_CLASS_P (t))
+ {
+ if (TREE_OVERFLOW (t))
+ {
+ rust_error_at (Location (loc), "overflow in constant expression");
+ return t;
+ }
+
+ if (TREE_CODE (t) == INTEGER_CST && TYPE_PTR_P (TREE_TYPE (t))
+ && !integer_zerop (t))
+ {
+ // FIXME check does this actually work to print out tree types
+ rust_error_at (Location (loc),
+ "value %qE of type %qT is not a constant expression",
+ t, TREE_TYPE (t));
+ return t;
+ }
+
+ return t;
+ }
+
+ // Avoid excessively long constexpr evaluations
+ if (++constexpr_ops_count >= constexpr_ops_limit)
+ {
+ rust_error_at (
+ Location (loc),
+ "%<constexpr%> evaluation operation count exceeds limit of "
+ "%wd (use %<-fconstexpr-ops-limit=%> to increase the limit)",
+ constexpr_ops_limit);
+
+ return t;
+ }
+
+ tree r = t;
+ tree_code tcode = TREE_CODE (t);
+ switch (tcode)
+ {
+ case CONST_DECL: {
+ r = decl_constant_value (t, /*unshare_p=*/false);
+ if (TREE_CODE (r) == TARGET_EXPR
+ && TREE_CODE (TARGET_EXPR_INITIAL (r)) == CONSTRUCTOR)
+ r = TARGET_EXPR_INITIAL (r);
+ if (DECL_P (r))
+ {
+ non_const_var_error (loc, r);
+ return r;
+ }
+ }
+ break;
+
+ case POINTER_PLUS_EXPR:
+ case POINTER_DIFF_EXPR:
+ case PLUS_EXPR:
+ case MINUS_EXPR:
+ case MULT_EXPR:
+ case TRUNC_DIV_EXPR:
+ case CEIL_DIV_EXPR:
+ case FLOOR_DIV_EXPR:
+ case ROUND_DIV_EXPR:
+ case TRUNC_MOD_EXPR:
+ case CEIL_MOD_EXPR:
+ case ROUND_MOD_EXPR:
+ case RDIV_EXPR:
+ case EXACT_DIV_EXPR:
+ case MIN_EXPR:
+ case MAX_EXPR:
+ case LSHIFT_EXPR:
+ case RSHIFT_EXPR:
+ case LROTATE_EXPR:
+ case RROTATE_EXPR:
+ case BIT_IOR_EXPR:
+ case BIT_XOR_EXPR:
+ case BIT_AND_EXPR:
+ case TRUTH_XOR_EXPR:
+ case LT_EXPR:
+ case LE_EXPR:
+ case GT_EXPR:
+ case GE_EXPR:
+ case EQ_EXPR:
+ case NE_EXPR:
+ case SPACESHIP_EXPR:
+ case UNORDERED_EXPR:
+ case ORDERED_EXPR:
+ case UNLT_EXPR:
+ case UNLE_EXPR:
+ case UNGT_EXPR:
+ case UNGE_EXPR:
+ case UNEQ_EXPR:
+ case LTGT_EXPR:
+ case RANGE_EXPR:
+ case COMPLEX_EXPR:
+ r = eval_binary_expression (t);
+ break;
+
+ case CALL_EXPR:
+ r = eval_call_expression (t);
+ break;
+
+ case RETURN_EXPR:
+ rust_assert (TREE_OPERAND (t, 0) != NULL_TREE);
+ r = constexpr_expression (TREE_OPERAND (t, 0));
+ break;
+
+ case MODIFY_EXPR:
+ r = eval_store_expression (t);
+ break;
+
+ default:
+ break;
+ }
+
+ return r;
+}
+
+tree
+ConstCtx::eval_store_expression (tree t)
+{
+ tree init = TREE_OPERAND (t, 1);
+ if (TREE_CLOBBER_P (init))
+ /* Just ignore clobbers. */
+ return void_node;
+
+ /* First we figure out where we're storing to. */
+ tree target = TREE_OPERAND (t, 0);
+
+ tree type = TREE_TYPE (target);
+ bool preeval = SCALAR_TYPE_P (type) || TREE_CODE (t) == MODIFY_EXPR;
+ if (preeval)
+ {
+ /* Evaluate the value to be stored without knowing what object it will be
+ stored in, so that any side-effects happen first. */
+ init = ConstCtx::fold (init);
+ }
+
+ bool evaluated = false;
+ tree object = NULL_TREE;
+ for (tree probe = target; object == NULL_TREE;)
+ {
+ switch (TREE_CODE (probe))
+ {
+ default:
+ if (evaluated)
+ object = probe;
+ else
+ {
+ probe = constexpr_expression (probe);
+ evaluated = true;
+ }
+ break;
+ }
+ }
+
+ return init;
+}
+
+/* Subroutine of cxx_eval_constant_expression.
+ Like cxx_eval_unary_expression, except for binary expressions. */
+
+tree
+ConstCtx::eval_binary_expression (tree t)
+{
+ tree orig_lhs = TREE_OPERAND (t, 0);
+ tree orig_rhs = TREE_OPERAND (t, 1);
+ tree lhs, rhs;
+
+ lhs = constexpr_expression (orig_lhs);
+ rhs = constexpr_expression (orig_rhs);
+
+ location_t loc = EXPR_LOCATION (t);
+ enum tree_code code = TREE_CODE (t);
+ tree type = TREE_TYPE (t);
+
+ return fold_binary_loc (loc, code, type, lhs, rhs);
+}
+
+// Subroutine of cxx_eval_constant_expression.
+// Evaluate the call expression tree T in the context of OLD_CALL expression
+// evaluation.
+tree
+ConstCtx::eval_call_expression (tree t)
+{
+ tree fun = get_function_named_in_call (t);
+ return constexpr_fn_retval (DECL_SAVED_TREE (fun));
+}
+
+// Subroutine of check_constexpr_fundef. BODY is the body of a function
+// declared to be constexpr, or a sub-statement thereof. Returns the
+// return value if suitable, error_mark_node for a statement not allowed in
+// a constexpr function, or NULL_TREE if no return value was found.
+tree
+ConstCtx::constexpr_fn_retval (tree body)
+{
+ switch (TREE_CODE (body))
+ {
+ case STATEMENT_LIST: {
+ tree expr = NULL_TREE;
+ for (tree stmt : tsi_range (body))
+ {
+ tree s = constexpr_fn_retval (stmt);
+ if (s == error_mark_node)
+ return error_mark_node;
+ else if (s == NULL_TREE)
+ /* Keep iterating. */;
+ else if (expr)
+ /* Multiple return statements. */
+ return error_mark_node;
+ else
+ expr = s;
+ }
+ return expr;
+ }
+
+ case RETURN_EXPR:
+ return constexpr_expression (body);
+
+ case DECL_EXPR: {
+ tree decl = DECL_EXPR_DECL (body);
+ if (TREE_CODE (decl) == USING_DECL
+ /* Accept __func__, __FUNCTION__, and __PRETTY_FUNCTION__. */
+ || DECL_ARTIFICIAL (decl))
+ return NULL_TREE;
+ return error_mark_node;
+ }
+
+ case CLEANUP_POINT_EXPR:
+ return constexpr_fn_retval (TREE_OPERAND (body, 0));
+
+ case BIND_EXPR: {
+ tree b = BIND_EXPR_BODY (body);
+ return constexpr_fn_retval (b);
+ }
+ break;
+
+ default:
+ return error_mark_node;
+ }
+ return error_mark_node;
+}
+
- // Taken from cp/constexpr.c
++// Taken from cp/constexpr.cc
+//
+// If DECL is a scalar enumeration constant or variable with a
+// constant initializer, return the initializer (or, its initializers,
+// recursively); otherwise, return DECL. If STRICT_P, the
+// initializer is only returned if DECL is a
+// constant-expression. If RETURN_AGGREGATE_CST_OK_P, it is ok to
+// return an aggregate constant. If UNSHARE_P, return an unshared
+// copy of the initializer.
+static tree
+constant_value_1 (tree decl, bool strict_p, bool return_aggregate_cst_ok_p,
+ bool unshare_p)
+{
+ while (TREE_CODE (decl) == CONST_DECL)
+ {
+ tree init;
+ /* If DECL is a static data member in a template
+ specialization, we must instantiate it here. The
+ initializer for the static data member is not processed
+ until needed; we need it now. */
+
+ init = DECL_INITIAL (decl);
+ if (init == error_mark_node)
+ {
+ if (TREE_CODE (decl) == CONST_DECL)
+ /* Treat the error as a constant to avoid cascading errors on
+ excessively recursive template instantiation (c++/9335). */
+ return init;
+ else
+ return decl;
+ }
+
+ decl = init;
+ }
+ return unshare_p ? unshare_expr (decl) : decl;
+}
+
+// A more relaxed version of decl_really_constant_value, used by the
+// common C/C++ code.
+tree
+decl_constant_value (tree decl, bool unshare_p)
+{
+ return constant_value_1 (decl, /*strict_p=*/false,
+ /*return_aggregate_cst_ok_p=*/true,
+ /*unshare_p=*/unshare_p);
+}
+
+static void
+non_const_var_error (location_t loc, tree r)
+{
+ error_at (loc,
+ "the value of %qD is not usable in a constant "
+ "expression",
+ r);
+ /* Avoid error cascade. */
+ if (DECL_INITIAL (r) == error_mark_node)
+ return;
+
- // more in cp/constexpr.c
++ // more in cp/constexpr.cc
+}
+
+static tree
+get_callee (tree call)
+{
+ if (call == NULL_TREE)
+ return call;
+ else if (TREE_CODE (call) == CALL_EXPR)
+ return CALL_EXPR_FN (call);
+
+ return NULL_TREE;
+}
+
+// We have an expression tree T that represents a call, either CALL_EXPR
+// or AGGR_INIT_EXPR. If the call is lexically to a named function,
+// return the _DECL for that function.
+static tree
+get_function_named_in_call (tree t)
+{
+ tree fun = get_callee (t);
+ if (fun && TREE_CODE (fun) == ADDR_EXPR
+ && TREE_CODE (TREE_OPERAND (fun, 0)) == FUNCTION_DECL)
+ fun = TREE_OPERAND (fun, 0);
+ return fun;
+}
+
+} // namespace Compile
+} // namespace Rust
diff --cc gcc/rust/lang-specs.h
index c3230e48675,00000000000..9b14a559dd6
mode 100644,000000..100644
--- a/gcc/rust/lang-specs.h
+++ b/gcc/rust/lang-specs.h
@@@ -1,26 -1,0 +1,26 @@@
+/* lang-specs.h -- gcc driver specs for Rust frontend.
+ Copyright (C) 2009-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 the contribution to the `default_compilers' array in gcc.c
++/* This is the contribution to the `default_compilers' array in gcc.cc
+ for the Rust language. */
+
+{".rs", "@rs", 0, 1, 0},
+ {"@rs",
+ "rust1 %i %(cc1_options) %{I*} %{L*} %D %{!fsyntax-only:%(invoke_as)}", 0, 1,
+ 0},
diff --cc gcc/rust/rust-lang.cc
index b1e69071f4e,00000000000..a0f14d405aa
mode 100644,000000..100644
--- a/gcc/rust/rust-lang.cc
+++ b/gcc/rust/rust-lang.cc
@@@ -1,442 -1,0 +1,442 @@@
+// Copyright (C) 2020-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/>.
+
+#include "rust-diagnostics.h"
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "target.h"
+#include "tree.h"
+#include "gimple-expr.h"
+#include "diagnostic.h"
+#include "opts.h"
+#include "fold-const.h"
+#include "gimplify.h"
+#include "stor-layout.h"
+#include "debug.h"
+#include "convert.h"
+#include "langhooks.h"
+#include "langhooks-def.h"
+
+#include <mpfr.h>
+// note: header files must be in this order or else forward declarations don't
+// work properly. Kinda dumb system, but have to live with it. clang-format
+// seems to mess it up
+/* Order: config, system, coretypes, target, tree, gimple-expr, diagnostic,
+ * opts, fold-const, gimplify, stor-layout, debug, convert, langhooks,
+ * langhooks-def */
+
+// FIXME: test saving intellisense
+#include "options.h"
+
+// version check to stop compiling if c++ isn't c++11 or higher
+#if __cplusplus < 201103
+#error \
+ "GCC Rust frontend requires C++11 or higher. You can compile the g++ frontend first and then compile the Rust frontend using that."
+#endif
+// TODO: is this best way to do it? Is it allowed? (should be)
+
+/* General TODOs:
+ * - convert all copies of expensive-to-copy (deep copy) AST objects into
+ * moves, if possible. Don't remove clone functionality - it may be required for
+ * e.g. HIR conversion.
+ */
+
+#include "rust-system.h"
+#include "rust-session-manager.h"
+
+// Language-dependent contents of a type. GTY() mark used for garbage collector.
+struct GTY (()) lang_type
+{
+ char dummy;
+};
+
+// Language-dependent contents of a decl.
+struct GTY (()) lang_decl
+{
+ char dummy;
+};
+
+// Language-dependent contents of an identifier. This must include a
+// tree_identifier.
+struct GTY (()) lang_identifier
+{
+ struct tree_identifier common;
+};
+
+// The resulting tree type.
+union GTY ((
+ desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
+ chain_next (
+ "CODE_CONTAINS_STRUCT (TREE_CODE (&%h.generic), "
+ "TS_COMMON) ? ((union lang_tree_node *) TREE_CHAIN (&%h.generic)) : NULL")))
+ lang_tree_node
+{
+ union tree_node GTY ((tag ("0"), desc ("tree_node_structure (&%h)"))) generic;
+ struct lang_identifier GTY ((tag ("1"))) identifier;
+};
+
+// We don't use language_function.
+struct GTY (()) language_function
+{
+ int dummy;
+};
+
+// has to be in same compilation unit as session, so here for now
+void
+rust_add_target_info (const char *key, const char *value)
+{
+ Rust::Session::get_instance ().options.target_data.insert_key_value_pair (
+ key, value);
+}
+
+/* Language hooks. */
+
+/* Initial lang hook called (possibly), used for initialisation.
+ * Must call build_common_tree_nodes, set_sizetype, build_common_tree_nodes_2,
+ * and build_common_builtin_nodes, as well as set global variable
+ * void_list_node. Apparently called after option handling? */
+static bool
+grs_langhook_init (void)
+{
+ /* Something to do with this:
+ This allows the code in d-builtins.cc to not have to worry about
+ converting (C signed char *) to (D char *) for string arguments of
+ built-in functions. The parameter (signed_char = false) specifies
+ whether char is signed. */
+ build_common_tree_nodes (false);
+
+ // Creates a new TREE_LIST node with purpose NULL_TREE and value
+ // void_type_node
+ void_list_node = build_tree_list (NULL_TREE, void_type_node);
+
+ // Builds built-ins for middle-end after all front-end built-ins are already
+ // instantiated
+ build_common_builtin_nodes ();
+
+ mpfr_set_default_prec (128);
+
+ using_eh_for_cleanups ();
+
+ // initialise compiler session
+ Rust::Session::get_instance ().init ();
+
+ return true;
+}
+
+/* The option mask (something to do with options for specific frontends or
+ * something). */
+static unsigned int
+grs_langhook_option_lang_mask (void)
+{
+ return CL_Rust;
+}
+
+/* Initialize the options structure. */
+static void
+grs_langhook_init_options_struct (struct gcc_options * /* opts */)
+{
+ // nothing yet - used by frontends to change specific options for the language
+ Rust::Session::get_instance ().init_options ();
+}
+
+/* Main entry point for front-end, apparently. Finds input file names in global
+ * vars in_fnames and num_in_fnames. From this, frontend can take over and do
+ * actual parsing and initial compilation. This function must create a complete
+ * parse tree in a global var, and then return.
+ *
+ * Some consider this the "start of compilation". */
+static void
+grs_langhook_parse_file (void)
+{
+ rust_debug ("Preparing to parse files. ");
+
+ Rust::Session::get_instance ().parse_files (num_in_fnames, in_fnames);
+}
+
+/* Seems to get the exact type for a specific type - e.g. for scalar float with
+ * 32-bit bitsize, it returns float, and for 64-bit bitsize, it returns double.
+ * Used to map RTL nodes to machine modes or something like that. */
+static tree
+grs_langhook_type_for_mode (machine_mode mode, int unsignedp)
+{
+ // TODO: change all this later to match rustc types
+ if (mode == TYPE_MODE (float_type_node))
+ return float_type_node;
+
+ if (mode == TYPE_MODE (double_type_node))
+ return double_type_node;
+
+ if (mode == TYPE_MODE (intQI_type_node)) // quarter integer mode - single byte
+ // treated as integer
+ return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
+ if (mode
+ == TYPE_MODE (intHI_type_node)) // half integer mode - two-byte integer
+ return unsignedp ? unsigned_intHI_type_node : intHI_type_node;
+ if (mode
+ == TYPE_MODE (intSI_type_node)) // single integer mode - four-byte integer
+ return unsignedp ? unsigned_intSI_type_node : intSI_type_node;
+ if (mode
+ == TYPE_MODE (
+ intDI_type_node)) // double integer mode - eight-byte integer
+ return unsignedp ? unsigned_intDI_type_node : intDI_type_node;
+ if (mode
+ == TYPE_MODE (intTI_type_node)) // tetra integer mode - 16-byte integer
+ return unsignedp ? unsigned_intTI_type_node : intTI_type_node;
+
+ if (mode == TYPE_MODE (integer_type_node))
+ return unsignedp ? unsigned_type_node : integer_type_node;
+
+ if (mode == TYPE_MODE (long_integer_type_node))
+ return unsignedp ? long_unsigned_type_node : long_integer_type_node;
+
+ if (mode == TYPE_MODE (long_long_integer_type_node))
+ return unsignedp ? long_long_unsigned_type_node
+ : long_long_integer_type_node;
+
+ if (COMPLEX_MODE_P (mode))
+ {
+ if (mode == TYPE_MODE (complex_float_type_node))
+ return complex_float_type_node;
+ if (mode == TYPE_MODE (complex_double_type_node))
+ return complex_double_type_node;
+ if (mode == TYPE_MODE (complex_long_double_type_node))
+ return complex_long_double_type_node;
+ if (mode == TYPE_MODE (complex_integer_type_node) && !unsignedp)
+ return complex_integer_type_node;
+ }
+ /* gcc_unreachable */
+ return NULL;
+}
+
+// Record a builtin function. We just ignore builtin functions.
+static tree
+grs_langhook_builtin_function (tree decl ATTRIBUTE_UNUSED)
+{
+ return decl;
+}
+
+/* Return true if we are in the global binding level (which is never,
+ * apparently). */
+static bool
+grs_langhook_global_bindings_p (void)
+{
+ // return current_function_decl == NULL_TREE;
+ // gcc_unreachable();
+ // return true;
+ return false;
+}
+
+/* Push a declaration into the current binding level. We can't
+ usefully implement this since we don't want to convert from tree
+ back to one of our internal data structures. I think the only way
+ this is used is to record a decl which is to be returned by
+ getdecls, and we could implement it for that purpose if
+ necessary. */
+static tree
+grs_langhook_pushdecl (tree decl ATTRIBUTE_UNUSED)
+{
+ gcc_unreachable ();
+ return NULL;
+}
+
+/* This hook is used to get the current list of declarations as trees.
+ We don't support that; instead we use the write_globals hook. This
+ can't simply crash because it is called by -gstabs. */
+static tree
+grs_langhook_getdecls (void)
+{
+ // gcc_unreachable();
+ return NULL;
+}
+
+// Handle Rust-specific options. Return false if nothing happened.
+static bool
+grs_langhook_handle_option (
+ size_t scode, const char *arg, HOST_WIDE_INT value, int kind ATTRIBUTE_UNUSED,
+ location_t loc ATTRIBUTE_UNUSED,
+ const struct cl_option_handlers *handlers ATTRIBUTE_UNUSED)
+{
+ // Convert integer code to lang.opt enum codes with names.
+ enum opt_code code = (enum opt_code) scode;
+ // used to store whether results of various stuff are successful
+ // bool ret = true;
+
+ // delegate to session manager
+ return Rust::Session::get_instance ().handle_option (code, arg, value, kind,
+ loc, handlers);
+
+ // Handles options as listed in lang.opt.
+ /*switch (code) {
+ case OPT_I:
+ // TODO: add search path
+ break;
+ case OPT_L:
+ // TODO: add library link path or something
+ break;
+ case OPT_frust_dump:
+ // enable dump and return whether this was successful
+ ret = rust_enable_dump(arg) ? true : false;
+ break;
+ // no option handling for -o
+ default:
+ // return 1 to indicate option is valid
+ break;
+ }
+
+ return ret;*/
+}
+
+/* Run after parsing options. */
+static bool
+grs_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED)
+{
+ // can be used to override other options if required
+
- // satisfies an assert in init_excess_precision in toplev.c
++ // satisfies an assert in init_excess_precision in toplev.cc
+ if (flag_excess_precision /*_cmdline*/ == EXCESS_PRECISION_DEFAULT)
+ flag_excess_precision /*_cmdline*/ = EXCESS_PRECISION_STANDARD;
+
+ /* Returning false means that the backend should be used. */
+ return false;
+}
+
+/* Rust-specific gimplification. May need to gimplify e.g.
+ * CALL_EXPR_STATIC_CHAIN */
+static int
+grs_langhook_gimplify_expr (tree *expr_p ATTRIBUTE_UNUSED,
+ gimple_seq *pre_p ATTRIBUTE_UNUSED,
+ gimple_seq *post_p ATTRIBUTE_UNUSED)
+{
+ if (TREE_CODE (*expr_p) == CALL_EXPR
+ && CALL_EXPR_STATIC_CHAIN (*expr_p) != NULL_TREE)
+ gimplify_expr (&CALL_EXPR_STATIC_CHAIN (*expr_p), pre_p, post_p,
+ is_gimple_val, fb_rvalue);
+ return GS_UNHANDLED;
+}
+
+static tree
+grs_langhook_eh_personality (void)
+{
+ static tree personality_decl;
+ if (personality_decl == NULL_TREE)
+ {
+ personality_decl = build_personality_function ("gccrs");
+ rust_preserve_from_gc (personality_decl);
+ }
+ return personality_decl;
+}
+
+tree
+convert (tree type, tree expr)
+{
+ if (type == error_mark_node || expr == error_mark_node
+ || TREE_TYPE (expr) == error_mark_node)
+ return error_mark_node;
+
+ if (type == TREE_TYPE (expr))
+ return expr;
+
+ if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (TREE_TYPE (expr)))
+ return fold_convert (type, expr);
+
+ switch (TREE_CODE (type))
+ {
+ case VOID_TYPE:
+ case BOOLEAN_TYPE:
+ return fold_convert (type, expr);
+ case INTEGER_TYPE:
+ return fold (convert_to_integer (type, expr));
+ case POINTER_TYPE:
+ return fold (convert_to_pointer (type, expr));
+ case REAL_TYPE:
+ return fold (convert_to_real (type, expr));
+ case COMPLEX_TYPE:
+ return fold (convert_to_complex (type, expr));
+ default:
+ break;
+ }
+
+ gcc_unreachable ();
+}
+
+/* FIXME: This is a hack to preserve trees that we create from the
+ garbage collector. */
+
+static GTY (()) tree rust_gc_root;
+
+void
+rust_preserve_from_gc (tree t)
+{
+ rust_gc_root = tree_cons (NULL_TREE, t, rust_gc_root);
+}
+
+/* Convert an identifier for use in an error message. */
+
+const char *
+rust_localize_identifier (const char *ident)
+{
+ return identifier_to_locale (ident);
+}
+
+/* The language hooks data structure. This is the main interface between the GCC
+ * front-end and the GCC middle-end/back-end. A list of language hooks could be
+ * found in <gcc>/langhooks.h
+ */
+#undef LANG_HOOKS_NAME
+#undef LANG_HOOKS_INIT
+#undef LANG_HOOKS_OPTION_LANG_MASK
+#undef LANG_HOOKS_INIT_OPTIONS_STRUCT
+#undef LANG_HOOKS_HANDLE_OPTION
+#undef LANG_HOOKS_POST_OPTIONS
+#undef LANG_HOOKS_PARSE_FILE
+#undef LANG_HOOKS_TYPE_FOR_MODE
+#undef LANG_HOOKS_BUILTIN_FUNCTION
+#undef LANG_HOOKS_GLOBAL_BINDINGS_P
+#undef LANG_HOOKS_PUSHDECL
+#undef LANG_HOOKS_GETDECLS
+#undef LANG_HOOKS_WRITE_GLOBALS
+#undef LANG_HOOKS_GIMPLIFY_EXPR
+#undef LANG_HOOKS_EH_PERSONALITY
+
+#define LANG_HOOKS_NAME "GNU Rust"
+#define LANG_HOOKS_INIT grs_langhook_init
+#define LANG_HOOKS_OPTION_LANG_MASK grs_langhook_option_lang_mask
+#define LANG_HOOKS_INIT_OPTIONS_STRUCT grs_langhook_init_options_struct
+#define LANG_HOOKS_HANDLE_OPTION grs_langhook_handle_option
+#define LANG_HOOKS_POST_OPTIONS grs_langhook_post_options
+/* Main lang-hook, apparently. Finds input file names in global vars in_fnames
+ * and num_in_fnames From this, frontend can take over and do actual parsing and
+ * initial compilation.
+ * This hook must create a complete parse tree in a global var, and then return.
+ */
+#define LANG_HOOKS_PARSE_FILE grs_langhook_parse_file
+#define LANG_HOOKS_TYPE_FOR_MODE grs_langhook_type_for_mode
+#define LANG_HOOKS_BUILTIN_FUNCTION grs_langhook_builtin_function
+#define LANG_HOOKS_GLOBAL_BINDINGS_P grs_langhook_global_bindings_p
+#define LANG_HOOKS_PUSHDECL grs_langhook_pushdecl
+#define LANG_HOOKS_GETDECLS grs_langhook_getdecls
+#define LANG_HOOKS_GIMPLIFY_EXPR grs_langhook_gimplify_expr
+#define LANG_HOOKS_EH_PERSONALITY grs_langhook_eh_personality
+
+// Expands all LANG_HOOKS_x of GCC
+struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
+
+// These are for GCC's garbage collector to work properly or something
+#include "gt-rust-rust-lang.h"
+#include "gtype-rust.h"
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-08 12:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-08 12:03 [gcc/devel/rust/master] Merge commit 'ff7aeceb6b3a476c3bac66a7f39a5ef4240206fc' [#247, #906] Thomas Schwinge
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).