[PATCH] libstdc++: Limit allocations in _Rb_tree 2/2

2023-02-21 Thread François Dumont via Gcc-patches
This one is a refinement for multimap/multiset. It allows to have share the same key if managed with ref counting like the cow string.     libstdc++: [_Rb_tree] Limit allocations on equal insertions [PR 96088]     When inserting the same key several times prefer to insert the new entry using

[PATCH] libstdc++: Limit allocations in _Rb_tree 1/2

2023-02-21 Thread François Dumont via Gcc-patches
Here is eventually a working proposal. Compared to the unordered container approach we need to find out what type is going to be used to call the comparer. Otherwise we might reinstantiate a temporary each time we call the comparer. For example in case of const char* insertion with a less comp

Re: [PATCH 1/2] c++: factor out TYPENAME_TYPE substitution

2023-02-21 Thread Patrick Palka via Gcc-patches
On Sun, 19 Feb 2023, Jason Merrill wrote: > On 2/15/23 12:11, Patrick Palka wrote: > > On Wed, 15 Feb 2023, Jason Merrill wrote: > > > > > On 2/15/23 09:21, Patrick Palka wrote: > > > > On Tue, 14 Feb 2023, Jason Merrill wrote: > > > > > > > > > On 2/13/23 09:23, Patrick Palka wrote: > > > > > >

Re: [PING, v2] Add '-Wno-complain-wrong-lang', and use it in 'gcc/testsuite/lib/target-supports.exp:check_compile' and elsewhere

2023-02-21 Thread Joseph Myers
On Tue, 21 Feb 2023, Thomas Schwinge wrote: > Is the attached v2 > "Add '-Wno-complain-wrong-lang', and use it in > 'gcc/testsuite/lib/target-supports.exp:check_compile' and elsewhere" > OK? OK. -- Joseph S. Myers jos...@codesourcery.com

[PATCH] vect: Check that vector factor is a compile-time constant

2023-02-21 Thread Michael Collison
While working on autovectorizing for the RISCV port I encountered an issue where vect_do_peeling assumes that the vectorization factor is a compile-time constant. The vectorization is not a compile-time constant on RISCV. Tested on RISCV and x86_64-linux-gnu. Okay? Michael gcc/     * tree-v

Re: C++ modules and AAPCS/ARM EABI clash on inline key methods

2023-02-21 Thread Nathan Sidwell via Gcc-patches
On 2/21/23 11:31, Richard Earnshaw wrote: I started looking at this a few weeks back, but I was a bit confused by the testcase and then never got around to following up. The Arm C++ binding rules normally exclude using an inline function definition from being chosen as the key function becaus

[pushed] analyzer: stop exploring the path after certain diagnostics [PR108830]

2023-02-21 Thread David Malcolm via Gcc-patches
PR analyzer/108830 reports a situation in which there are lots of followup -Wanalyzer-null-dereference warnings after the first access of a NULL pointer, leading to very noisy output from -fanalyzer. The analyzer's logic for stopping emitting multiple warnings from a state machine doesn't quite wo

Re: [PATCH] Fortran: reject invalid CHARACTER length of derived type components [PR96024]

2023-02-21 Thread Steve Kargl via Gcc-patches
On Tue, Feb 21, 2023 at 10:18:58PM +0100, Harald Anlauf via Fortran wrote: > Dear all, > > the attached simple patch detects and rejects CHARACTER components > of derived types whose length specification is non-integer. > > Regtested on x86_64-pc-linux-gnu. OK for mainline? > > This PR is also

[COMMITTED] gcc: xtensa: fix PR target/108876

2023-02-21 Thread Max Filippov via Gcc-patches
gcc/ PR target/108876 * config/xtensa/xtensa.cc (xtensa_expand_epilogue): Drop emit_use for A0_REG. * config/xtensa/xtensa.md (sibcall, sibcall_internal) (sibcall_value, sibcall_value_internal): Add 'use' expression for A0_REG. --- gcc/config/xtensa/

[PATCH] Fortran: reject invalid CHARACTER length of derived type components [PR96024]

2023-02-21 Thread Harald Anlauf via Gcc-patches
Dear all, the attached simple patch detects and rejects CHARACTER components of derived types whose length specification is non-integer. Regtested on x86_64-pc-linux-gnu. OK for mainline? This PR is also marked as a 10/11/12/13 regression, so I would like to backport this as far as it seems rea

Re: [PATCH] c++: constant non-copy-init is manifestly constant [PR108243]

2023-02-21 Thread Patrick Palka via Gcc-patches
On Mon, 20 Feb 2023, Patrick Palka wrote: > According to [basic.start.static]/2 and [expr.const]/2, a variable > with static storage duration initialized with a constant initializer > has constant initialization, and such an initializer is manifestly > constant-evaluated. > > We're already gettin

[PATCH] c++: more mce_false folding from cp_fully_fold_init [PR108243]

2023-02-21 Thread Patrick Palka via Gcc-patches
We should also fold the overall initializer passed to cp_fully_fold_init with mce_false, which enables folding of the copy-initialization of 'a1' in the below testcase (the initializer here is an AGGR_INIT_EXPR). Unfortunately this doesn't help with direct- or default-initialization because we don

Re: [PATCH] Fortran: improve checking of character length specification [PR96025]

2023-02-21 Thread Harald Anlauf via Gcc-patches
Hi Thomas, Am 21.02.23 um 08:19 schrieb Thomas Koenig via Gcc-patches: Hi Harald, the attached patch fixes an ICE on invalid (non-integer) specification expressions for character length in function declarations.  It appears that the error handling was already in place (mostly) and we need to e

Re: C++ modules and AAPCS/ARM EABI clash on inline key methods

2023-02-21 Thread Richard Earnshaw via Gcc-patches
On 21/02/2023 16:31, Richard Earnshaw via Gcc-patches wrote: On 17/02/2023 06:09, Alexandre Oliva via Gcc-patches wrote: On Apr  5, 2022, Alexandre Oliva wrote: Would something like this be acceptable/desirable?  It's overreaching, in that not all arm platforms are expected to fail, but th

Re: C++ modules and AAPCS/ARM EABI clash on inline key methods

2023-02-21 Thread Richard Earnshaw via Gcc-patches
On 17/02/2023 06:09, Alexandre Oliva via Gcc-patches wrote: On Apr 5, 2022, Alexandre Oliva wrote: Would something like this be acceptable/desirable? It's overreaching, in that not all arm platforms are expected to fail, but the result on them will be an unexpected pass, which is not quite a

Re: [PATCH] Fix RTL simplifications of FFS, POPCOUNT and PARITY.

2023-02-21 Thread Jakub Jelinek via Gcc-patches
On Sun, Jan 01, 2023 at 03:55:26PM -, Roger Sayle wrote: > In 2011, the rtl.texi documentation was updated to reflect that the > modes of the RTX unary operations FFS, POPCOUNT and PARITY must > match those of their operands. Unfortunately, some of the transformations > in simplify-rtx.cc pred

Ping^2: [PATCH+wwwdocs 0/8] A small Texinfo refinement

2023-02-21 Thread Arsen Arsenović via Gcc-patches
Ping. Like last time, I rebased the series. The first two times around, I did not notice there's dedicated maintainers for the documentation component, and so, I am adding Gerald, Joseph and Sandra to CC this time. Apologies for the omission. Range-diff since last ping: 1: 6eba1548dfe = 1: b

[V2][PATCH] Fixing PR107411

2023-02-21 Thread Qing Zhao via Gcc-patches
This is the 2nd version of the patch. compared to the first version, the major change is: use sprintf to replace xasprintf per Jacub's suggestion. bootstrapped and regression tested on both x86 and aarch64. Okay for committing? thanks. Qing === This is a bug in tree-ssa-

[PATCH 2/2] ipa-cp: Improve updating behavior when profile counts have gone bad

2023-02-21 Thread Martin Jambor
Hi, Looking into the behavior of profile count updating in PR 107925, I noticed that an option not considered possible was actually happening, and - with the guesswork in place to distribute unexplained counts - it simply can happen. Currently it is handled by dropping the counts to local estimat

[PATCH 1/2] ipa-cp: Fix various issues in update_specialized_profile (PR 107925)

2023-02-21 Thread Martin Jambor
Hi, the patch below fixes various issues in function update_specialized_profile. The main is removal of the assert which is bogus in the case of recursive cloning. The division of unexplained counts is guesswork, which then leads to updates of counts of recursive edges, which then can be redirec

Re: [PATCH] gimplify size expressions in parameters for all types [PR107557] [PR108423]

2023-02-21 Thread Martin Uecker via Gcc-patches
Am Dienstag, dem 21.02.2023 um 14:21 + schrieb Richard Biener: > On Tue, 21 Feb 2023, Martin Uecker wrote: > > > > > > > Hi Richard, > > > > can you look at this middle-end patch? It fixes two regressions. > > But gimplify_type_sizes recurses itself, but in particular _not_ > for pointer t

[committed] d: Only handle the left-to-right evaluation of a call expression during gimplify

2023-02-21 Thread Iain Buclaw via Gcc-patches
This patch removes an unnecessary rewriting of the front-end AST during lowering. As all functions regardless of their linkage are evaluated strictly left-to-right now, there's no point trying to handle all temp saving during the code generation pass. Bootstrapped and regression tested on x86_64-l

Re: [PATCH] gimplify size expressions in parameters for all types [PR107557] [PR108423]

2023-02-21 Thread Richard Biener via Gcc-patches
On Tue, 21 Feb 2023, Martin Uecker wrote: > > > Hi Richard, > > can you look at this middle-end patch? It fixes two regressions. But gimplify_type_sizes recurses itself, but in particular _not_ for pointer types. Iff recursing in parameter context is necessary and safe I'd rather have gimplif

[committed] d: Set doing_semantic_analysis_p before calling functionSemantic3

2023-02-21 Thread Iain Buclaw via Gcc-patches
Hi, This patch fixes a problem seen where functions which have semantic analysis ran late may still require the use of CTFE built-ins to be evaluated. Bootstrapped and regression tested on x86_64-linux-gnu, committed to mainline. Regards, Iain. --- gcc/d/ChangeLog: * decl.cc (DeclVisit

[committed] libphobos: Add @nogc to gcc.backtrace and gcc.libbacktrace modules.

2023-02-21 Thread Iain Buclaw via Gcc-patches
Hi, This patch annotated the LibBacktrace class and the libbacktrace C bindings it uses with `@nogc' in preparation for a `Throwable.TraceInfo' becoming `@nogc' itself. Bootstrapped and regression tested on x86_64-linux-gnu, committed to mainline. Regards, Iain. --- libphobos/ChangeLog:

Re: [PATCH] gimplify size expressions in parameters for all types [PR107557] [PR108423]

2023-02-21 Thread Martin Uecker via Gcc-patches
Hi Richard, can you look at this middle-end patch? It fixes two regressions. Martin PS: I happy to do something about at variably_modified_type_p  in the middle-end, if you have a recommendation. Am Mittwoch, dem 08.02.2023 um 13:02 +0100 schrieb Martin Uecker: > > Here is a fix for PR1

Re: [PATCH] rs6000: fmr gets used instead of faster xxlor [PR93571]

2023-02-21 Thread Segher Boessenkool
On Tue, Feb 21, 2023 at 06:00:52PM +0530, Ajit Agarwal wrote: > On 21/02/23 4:34 pm, Segher Boessenkool wrote: > > Please domn't use a switch, it isn't needed. Instead use the "isa" > > attribute (with p7v here), and put the preferred alternative first. > > I am not sure how this is possible with

Re: [PATCH] LoongArch: Change the value of macro TRY_EMPTY_VM_SPACE from 0x8000000000 to 0x1000000000.

2023-02-21 Thread WANG Xuerui
Hi, On 2023/2/21 21:03, Lulu Cheng wrote: 在 2023/2/21 下午3:41, Xi Ruoyao 写道: On Tue, 2023-02-21 at 15:20 +0800, Lulu Cheng wrote: Like la264 only has 40 effective bits of virtual address space. I'm OK with the change.  But the VA length is configurable building the kernel.  Is there any speci

Re: [PATCH] LoongArch: Change the value of macro TRY_EMPTY_VM_SPACE from 0x8000000000 to 0x1000000000.

2023-02-21 Thread Lulu Cheng
在 2023/2/21 下午3:41, Xi Ruoyao 写道: On Tue, 2023-02-21 at 15:20 +0800, Lulu Cheng wrote: Like la264 only has 40 effective bits of virtual address space. I'm OK with the change. But the VA length is configurable building the kernel. Is there any specific reason LA264 has to use the 40-bit conf

Re: [PATCH] tree-optimization/108691 - remove trigger-happy assert

2023-02-21 Thread Jakub Jelinek via Gcc-patches
On Tue, Feb 21, 2023 at 01:47:59PM +0100, Richard Biener wrote: > The following gets rid of the idea that we should prevent setjmp > like calls from popping up in uncontrolled way in the IL for now. > The solution is probably to handle it similar as noreturn has > the ctrl-altering flag on stmts, b

Update copyright years. (was: [committed 003/103] gccrs: dump: Emit visibility when dumping items)

2023-02-21 Thread Thomas Schwinge
Hi! On 2023-02-21T13:00:53+0100, arthur.co...@embecosm.com wrote: > --- a/gcc/rust/ast/rust-ast-dump.cc > +++ b/gcc/rust/ast/rust-ast-dump.cc > @@ -1,4 +1,4 @@ > -// Copyright (C) 2020-2023 Free Software Foundation, Inc. > +// Copyright (C) 2020-2022 Free Software Foundation, Inc. > --- a/gcc/rus

[PATCH] tree-optimization/108691 - remove trigger-happy assert

2023-02-21 Thread Richard Biener via Gcc-patches
The following gets rid of the idea that we should prevent setjmp like calls from popping up in uncontrolled way in the IL for now. The solution is probably to handle it similar as noreturn has the ctrl-altering flag on stmts, but use another flag, for example ctrl-receiving which would also make su

Re: [PATCH] rs6000: fmr gets used instead of faster xxlor [PR93571]

2023-02-21 Thread Ajit Agarwal via Gcc-patches
Hello Segher: On 21/02/23 4:34 pm, Segher Boessenkool wrote: > Hi! > > On Tue, Feb 21, 2023 at 02:18:25PM +0530, Ajit Agarwal wrote: >> This patch replaces fmr instruction 6 cycles with 2 cycles xxlor instruction >> for p7 and p8 architecture. >> >> I have implemented with switch and cases other

[committed 098/103] gccrs: Fix undefined behaviour issues on macos

2023-02-21 Thread arthur . cohen
From: Philip Herron This adds missing copy constructors to HIR::PathExprSegment which were wrongly defaulting to empty vectors when apply specified generic arguments to method calls. gcc/rust/ChangeLog: * hir/tree/rust-hir-expr.h: Add const `get_method_name`. * hir/tree/rust-hir

[committed 096/103] gccrs: Add capture tracking to the type info for closures

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Pass captures properly to `TyTy::ClosureType` constructor. * typecheck/rust-tyty.cc (ClosureType::as_string): Fix string representation. (ClosureType::clone):

[committed 092/103] gccrs: Improve lexer dump

2023-02-21 Thread arthur . cohen
From: Raiki Tamura gcc/rust/ChangeLog: * lex/rust-lex.cc (Lexer::Lexer): Add `dump_lex` boolean flag. (Lexer::skip_token): Dump tokens if flag is enabled. (Lexer::dump_and_skip): New function. * lex/rust-lex.h: Include optional.h and declare functions. * p

[committed 088/103] gccrs: ast: Remove unused include in rust-ast-dump.cc

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc: Remove unused include. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index 03a57d416c4..477805f

[committed 087/103] gccrs: ast: Dump generic parameters

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. * ast/rust-ast-dump.h: Likewise. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 129 +++--- gcc/rust/ast/rust-ast-dump.h | 3 + 2 fil

[committed 102/103] gccrs: const evaluator: Remove get_nth_callarg

2023-02-21 Thread arthur . cohen
From: Arthur Cohen We only used one path of the C++ folder's get_nth_callarg function: CALL_EXPR_ARG. Replace all calls to get_nth_callarg by macro calls to CALL_EXPR_ARG gcc/rust/ChangeLog: * backend/rust-constexpr.cc (get_nth_callarg): Remove function. (rs_bind_parameters_in_c

[committed 081/103] gccrs: ast: Dump impl trait type one bound

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rus

[committed 101/103] gccrs: Repair 'gcc/rust/lang.opt' comment

2023-02-21 Thread arthur . cohen
From: Thomas Schwinge ... lost in #1527 commit 138a6260124740208b8f3aff2e38617f43b05fe8 "rust: Add -frust-compile-until option". gcc/rust/ChangeLog: * lang.opt: Fix ordering of file. --- gcc/rust/lang.opt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gcc/rust/l

[committed 099/103] gccrs: Skip this debug test case which is failing on the latest mac-os devtools and its only for debug info

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/testsuite/ChangeLog: * rust/debug/chartype.rs: Skip testcases on Darwin architectures. --- gcc/testsuite/rust/debug/chartype.rs | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gcc/testsuite/rust/debug/chartype.rs b/gcc/testsui

[committed 078/103] gccrs: ast: Dump tuple type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing tuple type visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.c

[committed 074/103] gccrs: ast: Dump slice type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing slice visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 5 + 1 file changed, 5 insertions(+) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc in

[committed 091/103] gccrs: Remove default location. Add visibility location to create_* functions

2023-02-21 Thread arthur . cohen
From: Dave gcc/rust/ChangeLog: * ast/rust-item.h: Remoe default location for Visibility class. * parse/rust-parse-impl.h (Parser::parse_visibility): Pass proper location when instantiating visibilities. --- gcc/rust/ast/rust-item.h | 33 ++---

[committed 100/103] gccrs: Cleanup unused parameters to fix the bootstrap build

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * backend/rust-compile-type.cc (TyTyResolveCompile::visit): Remove unused parameters. * backend/rust-constexpr.cc (constant_value_1): Likewise. (fold_non_dependent_init): Likewise. * backend/rust-tree.cc (publicly_uniquely_

[committed 071/103] gccrs: typecheck: Fix overzealous `delete` call

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Fix extra call to `delete`. --- gcc/rust/typecheck/rust-tyty-call.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/gcc/rust/typecheck/rust-tyty-call.cc b/gcc/rust/typecheck/rus

[committed 089/103] gccrs: ast: Dump remove /* stmp */ comment to not clutter the dump

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Remove extraneous string when dumping statements. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gcc/rust/ast/rust-as

[committed 069/103] gccrs: add lang item "phantom_data"

2023-02-21 Thread arthur . cohen
From: Raiki Tamura gcc/rust/ChangeLog: * util/rust-lang-item.h: Add handling for `phantom_data` lang item. gcc/testsuite/ChangeLog: * rust/compile/torture/phantom_data.rs: New test. --- gcc/rust/util/rust-lang-item.h | 9 + gcc/testsuite/rust/compi

[committed 103/103] gccrs: add math intrinsics

2023-02-21 Thread arthur . cohen
From: Raiki Tamura gcc/rust/ChangeLog: * backend/rust-builtins.cc (BuiltinsContext::setup_math_fns): New functions. gcc/testsuite/ChangeLog: * rust/compile/torture/intrinsics-math.rs: New test. --- gcc/rust/backend/rust-builtins.cc | 122 +++- .../rust/com

[committed 086/103] gccrs: ast: Dump type param type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast

[committed 094/103] gccrs: Refactor name resolver to take a Rib::ItemType

2023-02-21 Thread arthur . cohen
From: Philip Herron This allows us to track the type of declaration that is stored within a Rib. gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Add Rib argument. (ResolveExpr::resolve_closure_param): Likewise. * resolve/rust-ast-resolve-imp

[committed 067/103] gccrs: ast: refer correctly to arguments in docs-strings

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.h: Fix documentation. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.h b/gcc/rust/ast/rust-ast-dump.h index 7a805

[committed 084/103] gccrs: ast: Dump parenthesised type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/ru

[committed 097/103] gccrs: Add initial support for argument capture of closures

2023-02-21 Thread arthur . cohen
From: Philip Herron When we have a closure expression that captures a parent function's variable we must setup the closure data to contain this. Ignoring moveability and mutability requires for now, this patch creates the closure structure with fields for each of the captured variables. When it c

[committed 095/103] gccrs: Add closure binding's tracking to name resolution

2023-02-21 Thread arthur . cohen
From: Philip Herron When we have a closure block referencing variables in a parent function, we must track what these are. We do this by having a context of closures so if we have a variable reference and its declared in a rib whose node id is less than the node id of the closure's node id we kno

[committed 062/103] gccrs: intrinsics: Use lambdas for wrapping_ intrinsics

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (wrapping_op_handler): Refactor to return an `std::function`. (wrapping_op_handler_inner): Rename. (wrapping_add_handler): Remove function. (wrapping_sub_handler): Likewise.

[committed 079/103] gccrs: ast: Dump inferred type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index 9393

[committed 093/103] gccrs: Get rid of make builtin macro

2023-02-21 Thread arthur . cohen
From: Philip Herron This macro is a mess and a helper method is much better for this case. gcc/rust/ChangeLog: * resolve/rust-name-resolver.cc (MKBUILTIN_TYPE): Remove macro. (Rib::Rib): Remove `mappings` field. (Resolver::generate_builtins): Use `setup_builtin` instead

[committed 090/103] gccrs: ast: Dump no comma after self in fn params if it is the last one

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Fix dumping of fn params. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/

[committed 077/103] gccrs: ast: Dump never type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing never type visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/a

[committed 085/103] gccrs: ast: Dump trait object type one bound

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/ru

[committed 055/103] gccrs: Implement the inline visitor

2023-02-21 Thread arthur . cohen
From: YizhePKU gcc/rust/ChangeLog: * util/rust-inline-visitor.h: New file. --- gcc/rust/util/rust-inline-visitor.h | 95 + 1 file changed, 95 insertions(+) create mode 100644 gcc/rust/util/rust-inline-visitor.h diff --git a/gcc/rust/util/rust-inline-visitor

[committed 080/103] gccrs: ast: Dump bare function type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak + Return FunctionQualifiers as ref to work in ast dump gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. * ast/rust-ast-dump.h: Add missing getter declaration. * ast/rust-ast-full-test.cc (BareFunctionType::as_string): Fix b

[committed 075/103] gccrs: ast: Dump array type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing array visitor Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 7 +++ 1 file changed, 7 insertions(+) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc i

[committed 083/103] gccrs: ast: Dump trait object type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust

[committed 056/103] gccrs: rust: Allow gccrs to build on x86_64-apple-darwin with clang/libc++

2023-02-21 Thread arthur . cohen
From: Simon Cook gcc/rust/ChangeLog: * util/rust-inline-visitor.h: Remove some offending system includes. --- gcc/rust/util/rust-inline-visitor.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/gcc/rust/util/rust-inline-visitor.h b/gcc/rust/util/rust-inline-visitor.h index 18920d

[committed 068/103] gccrs: ast: Dump unit struct

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add handling for unit structures. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/a

[committed 072/103] gccrs: ast: add visit overload for references

2023-02-21 Thread arthur . cohen
From: Jakub Dupak This is currently needed for lifetimes to use the existing infrastructure. gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add new reference visitor wrapper. * ast/rust-ast-dump.h: Declare it. * ast/rust-item.h: Add mutable visibility getters.

[committed 082/103] gccrs: ast: Dump impl trait type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/

[committed 050/103] gccrs: Closure support at CallExpr

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * backend/rust-compile-context.h: Add new functions: `insert_closure_decl` and `lookup_closure_decl`. * backend/rust-compile-expr.cc (CompileExpr::visit): Start compiling Closures properly. (CompileExpr::generate_closure_f

[committed 064/103] gccrs: intrinsics: Implement atomic_load intrinsics

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-builtins.cc (BuiltinsContext::setup_atomic_fns): Declare atomic load intrinsics. * backend/rust-compile-intrinsic.cc (atomic_load_handler_inner): New handler. (atomic_load_handler): Likewise. (uncheck

[committed 070/103] gccrs: add Location to AST::Visibility

2023-02-21 Thread arthur . cohen
From: Dave gcc/rust/ChangeLog: * ast/rust-item.h: Add location member. * hir/rust-ast-lower.cc (translate_visibility): Pass location argument. * hir/tree/rust-hir-item.h: Fix constructor to accept Location argument. --- gcc/rust/ast/rust-item.h | 19

[committed 049/103] gccrs: Initial Type resolution for closures

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * hir/tree/rust-hir-expr.h: Add `get_params` method. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Typecheck closure nodes. (TypeCheckExpr::resolve_fn_trait_call): New function. * typecheck/rust-hir-type-c

[committed 065/103] gccrs: ast: visitor pattern -> overload syntax compatibility layer

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add new visit function for overloading. * ast/rust-ast-dump.h: Add documentation for layer. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 7 +++ gcc/rust/ast/rust-ast-dump.h | 8

[committed 076/103] gccrs: ast: Dump raw pointer type

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing RawPointer visitor. Signed-off-by: Jakub Dupak --- gcc/rust/ast/rust-ast-dump.cc | 200 +++--- 1 file changed, 112 insertions(+), 88 deletions(-) diff --git a/gcc/rust/

[committed 066/103] gccrs: ast: transform helper methods to visits and add methods to simplify repeated patterns

2023-02-21 Thread arthur . cohen
From: Jakub Dupak gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::go): Use new API. (Dump::format_function_param): Refactor. (Dump::visit_items_joined_by_separator): New function. (Dump::emit_attrib): Refactor. (Dump::visit_as_line): New function.

[committed 041/103] gccrs: rust: Replace uses of ASTFragment -> Fragment

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast.h (class ASTFragment): Remove old ASTFragment class. * ast/rust-macro.h (class MacroRulesDefinition): Use new Fragment API. * expand/rust-attribute-visitor.h: Likewise. * expand/rust-macro-builtins.cc (macro_en

[committed 057/103] gccrs: builtins: Rename all bang macro handlers

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * expand/rust-macro-builtins.cc (MacroBuiltin::assert): Rename to... (MacroBuiltin::assert_handler): ..this. (MacroBuiltin::file): Rename to... (MacroBuiltin::file_handler): ..this. (MacroBuiltin::column): Rename to..

[committed 073/103] gccrs: ast: Dump where clause and recursively needed nodes

2023-02-21 Thread arthur . cohen
From: Jakub Dupak This is currently needed for lifetimes to use the existing infrastructure. gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add missing visitors. * ast/rust-ast-dump.h: Likewise. * ast/rust-ast.h: Add `get_lifetime_bounds` method. * ast

[committed 063/103] gccrs: intrinsics: Cleanup error handling around atomic_store_*

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (check_for_basic_integer_type): New function. (build_atomic_builtin_name): Use HIR Type instead of `tree`. (atomic_store_handler_inner): Cleanup error handling. (unchecked_op_inner): Likew

[committed 039/103] gccrs: Add check for recursive trait cycles

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): Check if a trait query is currently in progress. * typecheck/rust-hir-type-check.h (class TraitQueryGuard): Add helpers around checking for trait querie

[committed 052/103] gccrs: Add missing hir lowering to function type-path segments

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * Make-lang.in: Compile rust-ast-lower-type.cc. * ast/rust-path.h: Add `get_locus` method to `TypePathFunction`. * hir/rust-ast-lower-base.cc (ASTLowerTypePath::visit): Move implementation to rust-ast-lower-type.cc.

[committed 059/103] gccrs: constexpr: Add `rust_sorry_at` in places relying on init values

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-constexpr.cc (build_anon_member_initialization): Workaround uninitialized values. (build_data_member_initialization): Likewise. --- gcc/rust/backend/rust-constexpr.cc | 96 +++--- 1 file chang

[committed 060/103] gccrs: intrinsics: Add early implementation for atomic_store_{seqcst, relaxed, release}

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-builtins.cc (BuiltinsContext::setup_atomic_fns): New function. (BuiltinsContext::setup): Call `setup_atomic_fns`. * backend/rust-builtins.h: Declare `setup_atomic_fns`. * backend/rust-compile-intrinsic.cc (ato

[committed 036/103] gccrs: dump: Fix module dumping

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Fix formatting when dumping modules. --- gcc/rust/ast/rust-ast-dump.cc | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc

[committed 051/103] gccrs: Add missing name resolution to Function type-path segments

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Add missing handling of function case. --- gcc/rust/resolve/rust-ast-resolve-type.cc | 15 ++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gcc

[committed 058/103] gccrs: intrinsics: Add `sorry_handler` intrinsic handler

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (sorry_handler): New intrinsic handler. gcc/testsuite/ChangeLog: * rust/compile/torture/intrinsics-3.rs: New test. --- gcc/rust/backend/rust-compile-intrinsic.cc | 10 ++ gcc/testsuite/

[committed 034/103] gccrs: dump: Emit visibility when dumping items

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-dump.cc: Emit visibility when dumping items. --- gcc/rust/ast/rust-ast-dump.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dump.cc index fdcd97561bb..b7557bdee0c 100644 --

[committed 046/103] gccrs: Add name resolution for closures

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): Visit closure properly when name resolving. (ResolveExpr::resolve_closure_param): Implement closure name resolving. * resolve/rust-ast-resolve-expr.h: Declare visitor

[committed 061/103] gccrs: intrinsics: Add unchecked operation intrinsics

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * backend/rust-compile-intrinsic.cc (is_basic_integer_type): New function. (unchecked_op_inner): New handler. (unchecked_op_handler): New handler. gcc/testsuite/ChangeLog: * rust/compile/torture/intrinsics-6.rs: New test.

[committed 044/103] gccrs: Refactor expression hir lowering into cc file

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * Make-lang.in: Add new object file for expression lowering. * ast/rust-expr.h: Move implementation of expr lowering to source file. * backend/rust-compile-block.h: Likewise. * backend/rust-compile-expr.cc (CompileExpr::visi

[committed 054/103] gccrs: Support Closure calls as generic trait bounds

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * backend/rust-compile-expr.cc (CompileExpr::visit): Refactor checking of closures. (CompileExpr::generate_possible_fn_trait_call): New function. * backend/rust-compile-expr.h: Declare `generate_possible_fn_trait_call`. gcc/tests

[committed 030/103] gccrs: ast: dump: RangeExprs

2023-02-21 Thread arthur . cohen
From: David Faust gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add dump for RangeExprs. --- gcc/rust/ast/rust-ast-dump.cc | 31 +-- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-a

[committed 035/103] gccrs: dump: Dump items within modules

2023-02-21 Thread arthur . cohen
From: Arthur Cohen gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Dump items in modules properly. --- gcc/rust/ast/rust-ast-dump.cc | 18 +- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/rust-ast-dum

[committed 047/103] gccrs: Refactor method call type checking

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Simplify method call type checking by removing visitor and instead using one static cast. Use the new interface. * typecheck/rust-tyty-call.cc (TypeCheck

[committed 053/103] gccrs: Add missing type resolution for function type segments

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * typecheck/rust-tyty-bounds.cc (TypeCheckBase::get_predicate_from_bound): Add missing implementation. --- gcc/rust/typecheck/rust-tyty-bounds.cc | 69 +++--- 1 file changed, 62 insertions(+), 7 deletions(-) diff --gi

[committed 028/103] gccrs: ast: dump: ArrayExpr

2023-02-21 Thread arthur . cohen
From: David Faust gcc/rust/ChangeLog: * ast/rust-ast-dump.cc (Dump::visit): Add dump code for ArrayExpr. --- gcc/rust/ast/rust-ast-dump.cc | 32 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/gcc/rust/ast/rust-ast-dump.cc b/gcc/rust/ast/r

[committed 033/103] gccrs: Support outer attribute handling on trait items just like normal items

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * hir/rust-ast-lower-base.h (class ItemWrapper): New class. * hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_outer_attributes): Use `ItemWrapper` class. (ASTLoweringBase::handle_doc_item_attribute): Likewise. (

[committed 045/103] gccrs: Formatting cleanup in HIR lowering pattern

2023-02-21 Thread arthur . cohen
From: Philip Herron gcc/rust/ChangeLog: * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::ASTLoweringPattern): Improve formatting. (ASTLoweringPattern::translate): Likewise. * hir/rust-ast-lower-pattern.h: Likewise. * resolve/rust-ast-resolve-expr.h: L

  1   2   >