Re: [PATCH] testsuite: Adjust fam-in-union-alone-in-struct-2.c to support BE [PR116148]

2024-08-01 Thread Richard Biener
On Wed, Jul 31, 2024 at 9:00 PM Qing Zhao wrote: > > Hi, Kewen, > > Thanks a lot for fixing this testing case issue. > Yes, the change LGTM though I can’t approve it. OK. Richard. > Qing > > > On Jul 31, 2024, at 05:22, Kewen.Lin wrote: > > > > Hi, > > > > As Andrew pointed out in PR116148, fa

Re: [PATCH v2] match: Fix wrong code due to `(a ? e : f) !=/== (b ? e : f)` patterns [PR116120]

2024-08-01 Thread Richard Biener
On Thu, Aug 1, 2024 at 12:30 AM Andrew Pinski wrote: > > When this pattern was converted from being only dealing with 0/-1, we missed > that if `e == f` is true > then the optimization is wrong and needs an extra check for that. > > This changes the patterns to be: > /* (a ? x : y) != (b ? x : y)

Re: [PATCH] middle-end/114563 - improve release_pages

2024-08-01 Thread Richard Biener
On Wed, Jul 31, 2024 at 5:37 PM Andi Kleen wrote: > > On Wed, Jul 31, 2024 at 04:02:22PM +0200, Richard Biener wrote: > > The following improves release_pages when using the madvise path > > to sort the freelist to get more page entries contiguous and possibly > > release them. This populates the

Re: [committed] Fix compilation error in 2 1_neg.cc tests

2024-08-01 Thread Jonathan Wakely
On Thu, 1 Aug 2024 at 06:09, François Dumont wrote: > > Do you want me to take care of those 2 tests ? Yes please. > > You seem to have started something on the review of dg-error patterns in > use. > > Here I kept the test variable because I fear to potentially have a > diagnostic about unused

[PATCH 0/1] Initial support for AVX10.2

2024-08-01 Thread Haochen Jiang
Hi all, AVX10.2 tech details has been just published on July 31st in the following link: https://cdrdv2.intel.com/v1/dl/getContent/828965 For new features and instructions, we could divide them into two parts. One is ymm rounding control, the other is the new instructions. In the following week

[PATCH 1/1] Initial support for AVX10.2

2024-08-01 Thread Haochen Jiang
gcc/ChangeLog: * common/config/i386/cpuinfo.h (get_available_features): Handle avx10.2. * common/config/i386/i386-common.cc (OPTION_MASK_ISA2_AVX10_2_256_SET): New. (OPTION_MASK_ISA2_AVX10_2_512_SET): Ditto. (OPTION_MASK_ISA2_AVX10_1_256_UNSET):

Re: [PATCH] Fix mismatch between constraint and predicate for ashl3_doubleword.

2024-08-01 Thread Uros Bizjak
On Tue, Jul 30, 2024 at 5:05 AM liuhongt wrote: > > (insn 98 94 387 2 (parallel [ > (set (reg:TI 337 [ _32 ]) > (ashift:TI (reg:TI 329) > (reg:QI 521))) > (clobber (reg:CC 17 flags)) > ]) "test.c":11:13 953 {ashlti3_doubleword} >

Re: [Patch] libgomp: Device load_image - minor num-funcs/vars check improvement

2024-08-01 Thread Tobias Burnus
I have sent the following page in February (Stage 4) and didn't want to commit it back then. But for Stage 1, it should be fine ... I like to commit it tomorrow, unless there are comments suggesting other. Attached is the unchanged patch and I also added a "diff -w -U1" patch as that makes it

[patch,avr,applied] Tweak comparisons with constant

2024-08-01 Thread Georg-Johann Lay
Applied this tweak to the 16-bit and 32-bit comparisons. Johann -- gcc/ * config/avr/constraints.md (YMM): New constraint. * config/avr/avr.md (cmp3, *cmp3) (cbranch4_insn): Allow YMM where M is allowed. (cbranch4_insn): Split to a test of the high part a

[committed] i386: Fix up *_vinsert_0 [PR115981]

2024-08-01 Thread Jakub Jelinek
Hi! The r14-537 change started canonicalizing VEC_MERGE operands based on swap_commutative_operands_p or if they have the same precedence least significant bit of the third operand. The *_vinsert_0 pattern was added for combine matching and no longer triggers after that change, as it used the reg_

[PATCH] arm: Fix testism with mve/ivopts-3.c testcase

2024-08-01 Thread Andre Vieira (lists)
Hi, This patch ensures this testcase is ran for armv8.1-m.main+mve as this is testing that doloops with function calls that aren't intrinsics get rejected as potential doloop targets during ivopts. For other targets this loop gets rejected for different reasons. gcc/testsuite/ChangeLog:

RE: [PATCH 8/8]AArch64: take gather/scatter decode overhead into account

2024-08-01 Thread Tamar Christina
> -Original Message- > From: Richard Sandiford > Sent: Wednesday, July 31, 2024 7:17 PM > To: Tamar Christina > Cc: Kyrylo Tkachov ; gcc-patches@gcc.gnu.org; nd > ; Richard Earnshaw ; Marcus > Shawcroft ; ktkac...@gcc.gnu.org > Subject: Re: [PATCH 8/8]AArch64: take gather/scatter decode o

[PATCH] fortran: Fix up paste in gfc_get_array_descr_info

2024-08-01 Thread Jakub Jelinek
Hi! A static analyzer found a pasto in gfc_get_array_descr_info. The code does t = base_decl; if (!integer_zerop (dtype_off)) t = fold_build_pointer_plus (t, dtype_off); dtype = TYPE_MAIN_VARIANT (get_dtype_type_node ()); field = gfc_advance_chain (TYPE_FIELDS (dtyp

RE: [PATCH 8/8]AArch64: take gather/scatter decode overhead into account

2024-08-01 Thread Tamar Christina
> -Original Message- > From: Tamar Christina > Sent: Thursday, August 1, 2024 9:51 AM > To: Richard Sandiford > Cc: Kyrylo Tkachov ; gcc-patches@gcc.gnu.org; nd > ; Richard Earnshaw ; Marcus > Shawcroft ; ktkac...@gcc.gnu.org > Subject: RE: [PATCH 8/8]AArch64: take gather/scatter decode o

[PATCH] aarch64: Add support for AdvSIMD faminmax

2024-08-01 Thread Saurabh
The AArch64 FEAT_FAMINMAX extension is optional from Armv9.2-a and mandatory from Armv9.5-a. It introduces instructions for computing the floating point absolute maximum and minimum of the two vectors element-wise. This patch does three things: 1. Introduces AdvSIMD faminmax intrinsics. 2. Adds c

[PATCH 2/2] gdbhooks: Add attempt to invoke on-gcc-hooks-load

2024-08-01 Thread Alex Coplan
This extends GCC's GDB hooks to attempt invoking the user-defined command "on-gcc-hooks-load". The idea is that users can define the command in their .gdbinit to override the default values of parameters defined by GCC's GDB extensions. For example, together with the previous patch, I can add the

[PATCH 1/2] gdbhooks: Make dot viewer configurable

2024-08-01 Thread Alex Coplan
Hi, This adds a new GDB parameter 'gcc-dot-cmd' which allows the user to configure the command used to render the CFG within dot-fn. E.g. with this patch the user can change their dot viewer like so: (gdb) show gcc-dot-cmd The current value of 'gcc-dot-cmd' is "dot -Tx11". (gdb) set gcc-dot-cmd

[PATCH] aarch64: Add support for AdvSIMD faminmax

2024-08-01 Thread saurabh.jha
The AArch64 FEAT_FAMINMAX extension is optional from Armv9.2-a and mandatory from Armv9.5-a. It introduces instructions for computing the floating point absolute maximum and minimum of the two vectors element-wise. This patch does three things: 1. Introduces AdvSIMD faminmax intrinsics. 2. Adds c

Re: [PATCH] arm: Fix testism with mve/ivopts-3.c testcase

2024-08-01 Thread Christophe Lyon
Hi Andre On 8/1/24 10:46, Andre Vieira (lists) wrote: Hi, This patch ensures this testcase is ran for armv8.1-m.main+mve as this is testing that doloops with function calls that aren't intrinsics get rejected as potential doloop targets during ivopts.  For other targets this loop gets reject

Re: [PATCH] aarch64: Add ACLE intrinsics for AdvSIMD faminmax

2024-08-01 Thread Saurabh Jha
Hi Kyrill, Thank you for the review. I have addressed all the comments here: https://gcc.gnu.org/pipermail/gcc-patches/2024-August/658968.html Thanks, Saurabh On 7/22/2024 12:57 PM, Kyrylo Tkachov wrote: Hi Saurabh, On 22 Jul 2024, at 13:39, saurabh@arm.com wrote: External email: Use

[PATCH] fortran: Fix a pasto in gfc_check_dependency

2024-08-01 Thread Jakub Jelinek
Hi! A static analyzer found what seems like a pasto in the PR45019 changes, the second branch of || only accesses sym2 while the first one sym1 except for this one spot. Not sure I'm able to construct a testcase for this though. In any case, bootstrapped/regtested on x86_64-linux and i686-linux

Re: [PATCH] arm: Fix testism with mve/ivopts-3.c testcase

2024-08-01 Thread Andre Vieira (lists)
On 01/08/2024 10:09, Christophe Lyon wrote: It seems your attachment contains only the commit message but lacks the actual patch? I blame lack of coffee... Thanks.diff --git a/gcc/testsuite/gcc.target/arm/mve/ivopts-3.c b/gcc/testsuite/gcc.target/arm/mve/ivopts-3.c index 19b2442ef12cbf

[PATCH] lra: emit caller-save register spills before call insn [PR116028]

2024-08-01 Thread Surya Kumari Jangala
lra: emit caller-save register spills before call insn [PR116028] LRA emits insns to save caller-save registers in the inheritance/splitting pass. In this pass, LRA builds EBBs (Extended Basic Block) and traverses the insns in the EBBs in reverse order from the last insn to the first insn. When LR

Re: [PATCH] fortran: Fix up paste in gfc_get_array_descr_info

2024-08-01 Thread Mikael Morin
Hello, Le 01/08/2024 à 10:53, Jakub Jelinek a écrit : Hi! A static analyzer found a pasto in gfc_get_array_descr_info. The code does t = base_decl; if (!integer_zerop (dtype_off)) t = fold_build_pointer_plus (t, dtype_off); dtype = TYPE_MAIN_VARIANT (get_dtype_type

[PATCH] fortran, v2: Fix up pasto in gfc_get_array_descr_info

2024-08-01 Thread Jakub Jelinek
On Thu, Aug 01, 2024 at 12:12:38PM +0200, Mikael Morin wrote: > Yes, I've always wondered how much of a win these integer_zerop checks were, > probably not that much. In the cases we know they are useless, let's remove > them (patch pre-approved for gfc_get_array_descr_info). > > > Anyway, the fo

Re: [PATCH] fortran, v2: Fix up pasto in gfc_get_array_descr_info

2024-08-01 Thread Mikael Morin
Le 01/08/2024 à 12:30, Jakub Jelinek a écrit : On Thu, Aug 01, 2024 at 12:12:38PM +0200, Mikael Morin wrote: Yes, I've always wondered how much of a win these integer_zerop checks were, probably not that much. In the cases we know they are useless, let's remove them (patch pre-approved for gfc_

[PATCH v2] [libstdc++] [testsuite] avoid async.cc loss of precision [PR91486]

2024-08-01 Thread Alexandre Oliva
When we get to test_pr91486_wait_until(), we're about 10s past the float_steady_clock epoch. This is enough for the 1s delta for the timeout to come out slightly lower when the futex-less wait_until converts the deadline from float_steady_clock to __clock_t. So we may wake up a little too early,

Re: [PATCH, v2] OpenMP: Constructors and destructors for "declare target" static aggregates

2024-08-01 Thread Jakub Jelinek
On Tue, Jul 30, 2024 at 10:51:56PM +0200, Tobias Burnus wrote: > static tree > -start_partial_init_fini_fn (bool initp, unsigned priority, unsigned count) > +start_partial_init_fini_fn (bool initp, unsigned priority, unsigned count, > + bool omp_target) > { > - char id[si

[PATCH v2] RISC-V: Add support to vector stack-clash protection

2024-08-01 Thread Raphael Moreira Zinsly
Changes since v1: - Changed RISCV_STACK_CLASH_VECTOR_CFA_REGNUM to t3. -- >8 -- Adds basic support to vector stack-clash protection using a loop to do the probing and stack adjustments. gcc/ChangeLog: * config/riscv/riscv.cc (riscv_allocate_and_probe_stack_loop): New func

RE: [PATCH v2] Internal-fn: Handle vector bool type for type strict match mode [PR116103]

2024-08-01 Thread Li, Pan2
> Still OK. Thanks Richard, let me wait the final confirmation from Richard S. Pan -Original Message- From: Richard Biener Sent: Tuesday, July 30, 2024 5:03 PM To: Li, Pan2 Cc: gcc-patches@gcc.gnu.org; juzhe.zh...@rivai.ai; kito.ch...@gmail.com; tamar.christ...@arm.com; jeffreya...@g

Re: [PATCH] MATCH: add abs support for half float

2024-08-01 Thread Richard Biener
On Thu, Aug 1, 2024 at 5:31 AM Kugan Vivekanandarajah wrote: > > > On Mon, Jul 29, 2024 at 10:11 AM Andrew Pinski wrote: > > > > On Mon, Jul 29, 2024 at 12:57 AM Kugan Vivekanandarajah > > wrote: > > > > > > On Thu, Jul 25, 2024 at 10:19 PM Richard Biener > > > wrote: > > > > > > > > On Thu, Ju

Re: [PATCH] Make may_trap_p_1 return false for constant pool references [PR116145]

2024-08-01 Thread Richard Biener
On Wed, Jul 31, 2024 at 6:41 PM Richard Sandiford wrote: > > The testcase contains the constant: > > arr2 = svreinterpret_u8(svdup_u32(0x0a0d5c3f)); > > which was initially hoisted by hand, but which gimple optimisers later > propagated to each use (as expected). The constant was then expanded

Re: [PATCH] arm: Fix testism with mve/ivopts-3.c testcase

2024-08-01 Thread Christophe Lyon
On 8/1/24 12:02, Andre Vieira (lists) wrote: On 01/08/2024 10:09, Christophe Lyon wrote: It seems your attachment contains only the commit message but lacks the actual patch? I blame lack of coffee... Thanks. The patch LGTM. It seems patchwork didn't recognize it, so Linaro CI wi

[PATCH v2] aarch64: Add support for AdvSIMD faminmax

2024-08-01 Thread saurabh.jha
The AArch64 FEAT_FAMINMAX extension is optional from Armv9.2-a and mandatory from Armv9.5-a. It introduces instructions for computing the floating point absolute maximum and minimum of the two vectors element-wise. This patch does three things: 1. Introduces AdvSIMD faminmax intrinsics. 2. Adds c

Re: [RFC] RISC-V: Add support for Profiles RVA/B23.

2024-08-01 Thread Christoph Müllner
On Mon, Jul 29, 2024 at 5:26 AM Jiawei wrote: > > This patch adds support for RISC-V RVA23 and RVB23 Profiles[1], > which depend on the base RISC-V Profiles support[2]. > > [1] > https://github.com/riscv/riscv-profiles/releases/tag/rva23-v0.4-rvb23-v0.1-internal-review > [2] https://gcc.gnu.org/p

Re: [committed, v4] libstdc++: Handle encodings in localized chrono formatting [PR109162]

2024-08-01 Thread Dimitar Dimitrov
On Wed, Jul 31, 2024 at 09:26:43PM +0100, Jonathan Wakely wrote: > On Wed, 31 Jul 2024 at 19:18, Jonathan Wakely wrote: > > > > On Wed, 31 Jul 2024 at 19:17, Dimitar Dimitrov wrote: > > > > > > On Wed, Jul 31, 2024 at 05:09:52PM +0100, Jonathan Wakely wrote: > > > > It took a while, but I was fin

[PATCH 001/125] Rust: Make 'tree'-level 'MAIN_NAME_P' work

2024-08-01 Thread Arthur Cohen
From: Thomas Schwinge 'gcc/tree.h': #define main_identifier_nodeglobal_trees[TI_MAIN_IDENTIFIER] #define MAIN_NAME_P(NODE) \ (IDENTIFIER_NODE_CHECK (NODE) == main_identifier_node) ..., which is not initialized by default, but has to be set up by every front end ind

[PATCH 002/125] gccrs: Fix false positive for top-level AltPattern

2024-08-01 Thread Arthur Cohen
From: Owen Avery gcc/rust/ChangeLog: * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Reset is_let_top_level while visiting GroupedPattern. gcc/testsuite/ChangeLog: * rust/compile/let_alt.rs: Check for false positive. Signed-off-by: Owen Avery ---

[PATCH 003/125] gccrs: minor cleanup in langhook.type_for_mode

2024-08-01 Thread Arthur Cohen
From: Marc Poulhiès gcc/rust/ChangeLog: * rust-lang.cc (grs_langhook_type_for_mode): simplify code for xImode. Add missing long_double_type_node. Signed-off-by: Marc Poulhiès --- gcc/rust/rust-lang.cc | 39 +++ 1 file changed, 15 insertions(

[PATCH 004/125] gccrs: fmt: Start working on format_args!() parser

2024-08-01 Thread Arthur Cohen
This commit adds a base class for parsing the various constructs of a Rust format string, according to the grammar in the reference: https://doc.rust-lang.org/std/fmt/index.html#syntax gcc/rust/ChangeLog: * Make-lang.in: Compile rust-fmt object * ast/rust-fmt.cc: New file.

[PATCH 006/125] gccrs: Add 'gcc/rust/Make-lang.in:LIBFORMAT_PARSER'

2024-08-01 Thread Arthur Cohen
From: Thomas Schwinge ... to avoid verbatim repetition. gcc/rust/ * Make-lang.in (LIBPROC_MACRO_INTERNAL): New. (RUST_LIBDEPS, crab1$(exeext), rust/libformat_parser.a): Use it. --- gcc/rust/Make-lang.in | 12 1 file changed, 8 insertions(+), 4 deletions(-)

[PATCH 008/125] Rust: Don't cache 'libformat_parser.a'

2024-08-01 Thread Arthur Cohen
From: Thomas Schwinge gcc/rust/ * Make-lang.in (LIBFORMAT_PARSER): Point to the actual build artifact. ($(LIBFORMAT_PARSER)): Don't cache it. --- gcc/rust/Make-lang.in | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gcc/rust/Make-lang.in b/gcc/rust/M

[PATCH 012/125] gccrs: libformat_parser: Start experimenting with cbindgen

2024-08-01 Thread Arthur Cohen
libgrust/ChangeLog: * libformat_parser/cbindgen.toml: New file. * libformat_parser/libformat-parser.h: New file. gcc/rust/ChangeLog: * ast/rust-fmt.h: Add remaining FFI types. --- gcc/rust/ast/rust-fmt.h | 4 +- libgrust/libformat_parser/cbindgen.t

[PATCH 005/125] gccrs: libgrust: Add format_parser library

2024-08-01 Thread Arthur Cohen
Compile libformat_parser and link to it. gcc/rust/ChangeLog: * Make-lang.in: Compile libformat_parser. * ast/rust-fmt.cc: New FFI definitions. * ast/rust-fmt.h: Likewise. * expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Call into libfor

[PATCH 009/125] Rust: Move 'libformat_parser' build into the GCC build directory

2024-08-01 Thread Arthur Cohen
From: Thomas Schwinge Fixes #2883. gcc/rust/ChangeLog: * Make-lang.in (LIBFORMAT_PARSER): Point to the GCC build directory. * ($(LIBFORMAT_PARSER)): Build in the GCC build directory. --- gcc/rust/Make-lang.in | 11 +-- 1 file changed, 9 insertions(+), 2 deletions

[PATCH 013/125] gccrs: libformat_parser: Update header and remove old interface

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * ast/rust-fmt.cc (Pieces::collect): Use new Pieces API. * ast/rust-fmt.h: Update interface with new FFI bindings. libgrust/ChangeLog: * libformat_parser/src/lib.rs: Add IntoFFI trait. * libformat_parser/libformat-parser.h: Removed. --- gcc/ru

[PATCH 011/125] gccrs: libformat_parser: Add FFI safe interface

2024-08-01 Thread Arthur Cohen
libgrust/ChangeLog: * libformat_parser/generic_format_parser/src/lib.rs: Add generic library. * libformat_parser/src/lib.rs: Add base for FFI interface. --- .../generic_format_parser/src/lib.rs | 2 +- libgrust/libformat_parser/src/lib.rs | 301

[PATCH 010/125] Rust: Move 'libformat_parser' build into libgrust

2024-08-01 Thread Arthur Cohen
From: Thomas Schwinge Addresses #2883. contrib/ * gcc_update (files_and_dependencies): Update for 'libformat_parser' in libgrust. gcc/rust/ * Make-lang.in (LIBFORMAT_PARSER): Point to 'libformat_parser' build in libgrust. (%.toml:, $(LIBFOR

[PATCH 017/125] gccrs: rust-fmt: Store parsed string in Pieces struct

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * ast/rust-fmt.cc (Pieces::collect): Fix signature to take ownership of the given string. * ast/rust-fmt.h (struct Pieces): Store parsed string in the struct. libgrust/ChangeLog: * libformat_parser/src/lib.rs: Add debug prompt. --- gcc/rust/as

[PATCH 016/125] gccrs: format_args: Parse entire token invocation

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Transform entire invocation token stream into string for the parser. --- gcc/rust/expand/rust-macro-builtins.cc | 40 ++ 1 file changed, 22 insertions(+), 18 deletions(

[PATCH 014/125] gccrs: libformat_parser: Send boxed values across FFI properly

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * ast/rust-fmt.cc (Pieces::~Pieces): Call libformat_parser's release function in destructor. * ast/rust-fmt.h (struct PieceSlice): Add capacity. (destroy_pieces): New. (struct Pieces): Add destructor. libgrust/ChangeLog: * libfo

[PATCH 024/125] gccrs: extern-types: Declare external types in name resolver.

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * resolve/rust-ast-resolve-implitem.h: Declare external types as new types. --- gcc/rust/resolve/rust-ast-resolve-implitem.h | 19 +++ 1 file changed, 19 insertions(+) diff --git a/gcc/rust/resolve/rust-ast-resolve-implitem.h b/gcc/rust/resolv

[PATCH 018/125] gccrs: libformat_parser: Fix Rust warnings.

2024-08-01 Thread Arthur Cohen
libgrust/ChangeLog: * libformat_parser/generic_format_parser/src/lib.rs: Remove unused deprecated attribute and unused import. * libformat_parser/src/lib.rs: Remove unused import. --- libgrust/libformat_parser/generic_format_parser/src/lib.rs | 2 -- libgrust/libformat_par

[PATCH 026/125] gccrs: extern-types: Lower to HIR::ExternalTypeItem properly

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * hir/rust-ast-lower-extern.h: Lower to HIR::ExternalTypeItem nodes. * hir/tree/rust-hir-item.h (class ExternalTypeItem): Create private visibility by default as extern types have no visibility - add a comment about the correctness of this. ---

[PATCH 029/125] gccrs: macro-builtins: Add newline generic format_args!() handler

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (format_args_maker): New function. (try_expand_many_expr): Add comment about reworking function. (MacroBuiltin::format_args_handler): Add newline parameter. * expand/rust-macro-builtins.h: Likewise. --- gcc/rust/e

[PATCH 019/125] gccrs: format-parser: Add `is_some_and` method for Option

2024-08-01 Thread Arthur Cohen
Workaround for Ubuntu 18.04, since we still use it for the GCC 4.8 CI. The default Rust package is 1.65 (and unlikely to change I assume?), but the generic format parser library uses `is_some_and` which was introduced in 1.70. So this is a simple reimplementation, directly taken from the standard l

[PATCH 015/125] gccrs: format_args: Parse format string properly

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Construct string to parser properly. --- gcc/rust/expand/rust-macro-builtins.cc | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/gcc/rust/expand/rust-mac

[PATCH 035/125] gccrs: Add curly brackets, formatted clang

2024-08-01 Thread Arthur Cohen
From: jjasmine gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting --- gcc/rust/resolve/rust-late-name-resolver-2.0.cc | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/gcc/rust/resolve/rust-late-name-resol

[PATCH 028/125] gccrs: ast: Add base nodes for FormatArgs

2024-08-01 Thread Arthur Cohen
This commit adds a base for creating AST FormatArgs nodes after expanding invocations of `format_args!()`. These nodes will then be expanded to the proper runtime function calls (to core::fmt::rt) during the AST lowering. gcc/rust/ChangeLog: * ast/rust-builtin-ast-nodes.h: New file.

[PATCH 027/125] gccrs: Make DefaultResolver visit more of the AST

2024-08-01 Thread Arthur Cohen
From: Owen Avery gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Visit inner AST nodes of ClosureExprInner, ClosureExprInnerTyped, IfExpr, IfExprConseqElse, MatchExpr, PathInExpression, EnumItemTuple, EnumItemStruct, and En

[PATCH 025/125] gccrs: hir: Add ExternalTypeItem node

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * hir/tree/rust-hir-item.h (class ExternalTypeItem): New class. * hir/tree/rust-hir.cc (ExternalTypeItem::as_string): Likewise. * backend/rust-compile-extern.h: Add base for handling HIR::ExternalTypeItem node. * checks/errors/borrowck/r

[PATCH 020/125] gccrs: Adjust error checks to match name resolution 2.0

2024-08-01 Thread Arthur Cohen
From: Owen Avery gcc/testsuite/ChangeLog: * rust/compile/bad_stmt_enums.rs: Adjust redefinition error. * rust/compile/bad_toplevel_enums.rs: Likewise. * rust/compile/redef_error1.rs: Likewise. * rust/compile/redef_error3.rs: Likewise. * rust/compile/redef_

[PATCH 030/125] gccrs: parser: Add peek(n) method to parser

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * parse/rust-parse.h: New method. --- gcc/rust/parse/rust-parse.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h index 1614d19e4a5..8c8bf96eb8d 100644 --- a/gcc/rust/parse/rust-parse.h +++ b/gcc/rust/parse/

[PATCH 032/125] gccrs: lower: Add base for lowering FormatArgs nodes

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * Make-lang.in: Compile the new source file. * ast/rust-ast-collector.cc (TokenCollector::visit): Error out when visiting FormatArgs nodes. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * hir/rust-ast-lower-expr.cc (

[PATCH 021/125] gccrs: Fix small FixMe task in rust macro builtins

2024-08-01 Thread Arthur Cohen
From: jjasmine gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc: Change BuiltinMacro in builtin_macro_from_string to tl::optional<> * expand/rust-macro-builtins.h (enum class): Change BuiltinMacro in builtin_macro_from_string to tl::optional<> * resolve

[PATCH 036/125] gccrs: Ensure TupleStructPattern and TuplePattern have items

2024-08-01 Thread Arthur Cohen
From: Owen Avery Note that instances of both classes which have been moved from will have (items == nullptr). gcc/rust/ChangeLog: * ast/rust-pattern.h (class TupleStructPattern): Assert that items != nullptr. (class TuplePattern): Likewise. (TupleStructPattern::h

[PATCH 033/125] gccrs: format-args: Add documentation for future expansion of function

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Add documentation regarding future tasks. --- gcc/rust/expand/rust-macro-builtins.cc | 26 +- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/gcc/rust/ex

[PATCH 037/125] gccrs: Clean BiMap to use tl::optional for lookups

2024-08-01 Thread Arthur Cohen
From: Sourabh Jaiswal gcc/rust/Changelog: * expand/rust-expand-visitor.cc (ExpandVisitor::expand_inner_items): Adjust to use has_value () (ExpandVisitor::expand_inner_stmts): Likewise * expand/rust-macro-builtins.cc (builtin_macro_from_string): Likewise (m

[PATCH 022/125] gccrs: lang-items: Cleanup parsing and lookups of lang items.

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * Make-lang.in: Compile new rust-lang-item.o. * util/rust-lang-item.h: Split into header and source. * util/rust-lang-item.cc: Cleanup parsing of lang items by using a hashmap and returning optional values, cleanup handling of exhaustive lang it

[PATCH 039/125] gccrs: Add get_pattern_kind to Pattern

2024-08-01 Thread Arthur Cohen
From: 0xn4utilus gcc/rust/ChangeLog: * ast/rust-ast.h: Add Kind Enum to Pattern. * ast/rust-macro.h: Add get_pattern_kind(). * ast/rust-path.h: Likewise. * ast/rust-pattern.h: Likewise. Signed-off-by: 0xn4utilus --- gcc/rust/ast/rust-ast.h | 20

[PATCH 041/125] gccrs: Update resolver to use `AST::Function` instead of `AST::ExternalFunctionItem`

2024-08-01 Thread Arthur Cohen
From: 0xn4utilus gcc/rust/ChangeLog: * checks/errors/rust-feature-gate.cc (FeatureGate::visit): Check if function is_external or not. * hir/rust-ast-lower-extern.h: Use AST::Function instead of AST::ExternalFunctionItem. * parse/rust-parse-impl.h (Parser::

[PATCH 042/125] gccrs: Remove dead code associated with `AST::ExternalFunctionItem`

2024-08-01 Thread Arthur Cohen
From: 0xn4utilus gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Remove dead code. * ast/rust-ast-collector.h: Likewise. * ast/rust-ast-full-decls.h (class ExternalFunctionItem): Likewise. * ast/rust-ast-visitor.cc (Default

[PATCH 051/125] gccrs: format-args: Only pass the format string to the parser.

2024-08-01 Thread Arthur Cohen
This fixes an issue we had where the generated code ended with more static pieces than its rustc counterpart. gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (struct FormatArgsInput): Store the format_str as a string instead of an AST::Expr. (format_args_parse_argumen

[PATCH 023/125] gccrs: lang-items: Make lang items enum stronger, rename class, cleanup ns.

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * util/rust-lang-item.h (class RustLangItem): Renamed to... (class LangItem): ...this. Rename ItemType enum to Kind * util/rust-lang-item.cc: Rename methods to use new class name. * backend/rust-compile-expr.cc (CompileExpr::visit): Use new lang-

[PATCH 040/125] gccrs: Unify ASTValidation::visit for ExternalFunctionItem and Function

2024-08-01 Thread Arthur Cohen
From: 0xn4utilus gcc/rust/ChangeLog: * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add external function validation support. Add ErrorCode::E0130. * parse/rust-parse-impl.h (Parser::parse_function): Parse external functions from `parse_function`.

[PATCH 046/125] gccrs: macro: Use MacroInvocation's node_id in ExternalItem constructor.

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * ast/rust-macro.h: Use proper node id instead of the one in the base Expr class - which is uninitialized. --- gcc/rust/ast/rust-macro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h in

[PATCH 047/125] gccrs: format-args: Add base for expanding FormatArgs nodes

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * Make-lang.in: Add new object. * hir/rust-ast-lower-expr.cc (ASTLoweringExpr::visit): Remove calls to FormatArgsLowering. * expand/rust-expand-format-args.cc: New file. * expand/rust-expand-format-args.h: New file. --- gcc/rust/Make-lan

[PATCH 055/125] gccrs: Store visibility properly in ExternalTypeItem

2024-08-01 Thread Arthur Cohen
From: jjasmine Fix issue 2897 gcc/rust/ChangeLog: * hir/rust-ast-lower-extern.h: Add translate_visiblity * hir/tree/rust-hir-item.h: Fix constructor of ExternalTypeItem --- gcc/rust/hir/rust-ast-lower-extern.h | 4 +++- gcc/rust/hir/tree/rust-hir-item.h| 4 ++-- 2 files cha

[PATCH 043/125] gccrs: Placate clang-format re 'gcc/rust/backend/rust-tree.cc'

2024-08-01 Thread Arthur Cohen
From: Thomas Schwinge Reformat the upstream GCC commit f4a2ae2338962208b8039f154f5912402e94c378 "Change MODE_BITSIZE to MODE_PRECISION for MODE_VECTOR_BOOL" change to 'gcc/rust/backend/rust-tree.cc' to clang-format's liking. gcc/rust/ * backend/rust-tree.cc (c_common_type_for_mod

[PATCH 049/125] gccrs: format-args: Add basic expansion of unnamed Display::fmt arguments.

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * ast/rust-ast-builder.h: Rename AST::AstBuilder -> AST::Builder * ast/rust-ast-builder.cc: Likewise. * expand/rust-derive.cc: Use new AST::Builder name. * expand/rust-derive.h: Likewise. * ast/rust-builtin-ast-nodes.h: Add required gette

[PATCH 031/125] gccrs: format-args: Fix Rust interface and add input parsing.

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * ast/rust-ast.cc: Make FormatArgs inherit from AST::Expr * ast/rust-builtin-ast-nodes.h: Improve FormatArg* nodes and helpers. * ast/rust-fmt.cc (Pieces::collect): Fix interface to match FFI function. * ast/rust-fmt.h (collect_pieces): Likewise

[PATCH 050/125] gccrs: format-args: Add basic test case

2024-08-01 Thread Arthur Cohen
gcc/testsuite/ChangeLog: * rust/compile/format_args_basic_expansion.rs: New test. --- .../compile/format_args_basic_expansion.rs| 47 +++ 1 file changed, 47 insertions(+) create mode 100644 gcc/testsuite/rust/compile/format_args_basic_expansion.rs diff --git a/gcc/te

[PATCH 058/125] gccrs: Placate clang-format re 'gcc/rust/lex/rust-lex.cc'

2024-08-01 Thread Arthur Cohen
From: Thomas Schwinge Reformat the upstream GCC commit 61644aea34c4623d16273ff705f8b8b1ff2d87f0 "gccrs: tokenize Unicode identifiers" change to 'gcc/rust/lex/rust-lex.cc' to clang-format's liking. gcc/rust/ * lex/rust-lex.cc (is_identifier_start): Placate clang-format. --- gcc/r

[PATCH 044/125] gccrs: Replace reference to unique pointer with reference

2024-08-01 Thread Arthur Cohen
From: Pierre-Emmanuel Patry Reference to unique pointers are a known anti pattern, only the element shall be taken by reference instead of the whole wrapper. gcc/rust/ChangeLog: * ast/rust-item.h: Change getter function prototype to return a reference directly instead of a refer

[PATCH 034/125] gccrs: Add error emitting when we can't resolve id expr

2024-08-01 Thread Arthur Cohen
From: jjasmine gcc/rust/ChangeLog: * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Add error emitting --- gcc/rust/resolve/rust-late-name-resolver-2.0.cc | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/rust/resolve/rust-late-name-resolver-2.0.cc b/g

[PATCH 054/125] gccrs: TyTy: Collect variance info from types

2024-08-01 Thread Arthur Cohen
From: Jakub Dupak gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Collect variance info from types. Signed-off-by: Jakub Dupak --- gcc/rust/typecheck/rust-hir-type-check-item.cc | 17 + 1 file changed, 13 insertions(+), 4 del

[PATCH 062/125] gccrs: session manager: Init Immutable name resolver.

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * rust-session-manager.cc (Session::compile_crate): Create an immutable view of the name resolution context. --- gcc/rust/rust-session-manager.cc | 4 1 file changed, 4 insertions(+) diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-ma

[PATCH 059/125] gccrs: nr2.0: Add new ImmutableNameResolutionCtx class.

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * Make-lang.in: Compile it. * resolve/rust-immutable-name-resolution-context.cc: New file. * resolve/rust-immutable-name-resolution-context.h: New file. --- gcc/rust/Make-lang.in | 1 + .../rust-immutable-name-resolution-context

[PATCH 052/125] gccrs: TyTy: add common SubstitutionRef API

2024-08-01 Thread Arthur Cohen
From: Jakub Dupak gcc/rust/ChangeLog: * typecheck/rust-tyty-subst.cc (SubstitutionRef::get_arg_at): Add unified API. Signed-off-by: Jakub Dupak --- gcc/rust/typecheck/rust-tyty-subst.cc | 11 +++ 1 file changed, 11 insertions(+) diff --git a/gcc/rust/typecheck/rust-ty

[PATCH 056/125] gccrs: Fix typo

2024-08-01 Thread Arthur Cohen
From: Guillaume Gomez gcc/rust/ChangeLog: * expand/rust-derive.cc (DeriveVisitor::derive): Fix typo --- gcc/rust/expand/rust-derive.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/rust/expand/rust-derive.cc b/gcc/rust/expand/rust-derive.cc index 4177004eccf..e

[PATCH 063/125] gccrs: nr2.0: Add lookup of resolved nodes.

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * resolve/rust-name-resolution-context.cc (NameResolutionContext::lookup): Add lookup function. * resolve/rust-name-resolution-context.h: Include mappings and optional. --- gcc/rust/resolve/rust-name-resolution-context.cc | 13 + gcc/rust/r

[PATCH 038/125] gccrs: Add support for external functions

2024-08-01 Thread Arthur Cohen
From: 0xn4utilus gcc/rust/ChangeLog: * ast/rust-ast.cc (Function::Function): Add `is_external_function` field. (Function::operator=): Likewise. * ast/rust-ast.h: New constructor for ExternalItem. * ast/rust-item.h (class Function): Add `is_external_function`

[PATCH 081/125] gccrs: Visit function return type in default resolver

2024-08-01 Thread Arthur Cohen
From: Pierre-Emmanuel Patry Function return type was not properly visited in the default resolver visitor pattern. gcc/rust/ChangeLog: * resolve/rust-default-resolver.cc (DefaultResolver::visit): Visit function return type. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/re

[PATCH 064/125] gccrs: typecheck: Start using nr2.0 properly

2024-08-01 Thread Arthur Cohen
Fetch the ImmutableNrCtx in order to access name resolver during typechecking. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit): Start fetching name resolution information in the typechecker. * typecheck/rust-hir-type-check-type.cc (TypeC

[PATCH 060/125] gccrs: sesh: Add late name resolution 2.0

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * rust-session-manager.cc (Session::compile_crate): Create name resolution context for Session::expansion and subsequent name resolution passes. (Session::expansion): Take name resolution context as a parameter instead. * rust-session-ma

[PATCH 069/125] gccrs: Emit error on identical use declarations

2024-08-01 Thread Arthur Cohen
From: Pierre-Emmanuel Patry The compiler did not emit any warning when a same target was declared from different sources. gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::handle_use_dec): Use the new dict to track down already resolved use declarations

[PATCH 048/125] gccrs: format-args: Start storing string in Rust memory

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * ast/rust-fmt.cc (ffi::RustHamster::to_string): New. (Pieces::collect): Adapt to use new handle API. (Pieces::~Pieces): Likewise. (Pieces::Pieces): Likewise. (Pieces::operator=): Likewise. * ast/rust-fmt.h (struct RustString): Ad

[PATCH 086/125] gccrs: Add tuple struct to the type namespace

2024-08-01 Thread Arthur Cohen
From: Pierre-Emmanuel Patry Only tuple struct constructor was added to the resolver. gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit): Add tuple struct type to the resolver's context. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/r

[PATCH 061/125] gccrs: session-manager: Dump name resolution pass.

2024-08-01 Thread Arthur Cohen
gcc/rust/ChangeLog: * rust-session-manager.cc: Add files for dumping name resolution, call name resolution dump function. (Session::dump_name_resolution): New. * rust-session-manager.h: New declaration. --- gcc/rust/rust-session-manager.cc | 30

[PATCH 070/125] gccrs: Change error message on unresolved import

2024-08-01 Thread Arthur Cohen
From: Pierre-Emmanuel Patry The error message did not match rustc's. gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit): Change error message. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | 3 +--

  1   2   3   >