]> git.ipfire.org Git - thirdparty/gcc.git/log
thirdparty/gcc.git
16 months agosesh: Add late name resolution 2.0
Arthur Cohen [Fri, 4 Aug 2023 09:11:13 +0000 (11:11 +0200)] 
sesh: Add late name resolution 2.0

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-manager.h (Session::expansion): Fix declaration.

16 months agonr2.0: Add new ImmutableNameResolutionCtx class.
Arthur Cohen [Thu, 24 Aug 2023 15:49:42 +0000 (17:49 +0200)] 
nr2.0: Add new ImmutableNameResolutionCtx class.

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.

16 months agoMerge commit 'f3f2065910a02b0099d3d5f2ad3389d0e479c782' into HEAD [#2926]
Thomas Schwinge [Mon, 25 Mar 2024 07:19:46 +0000 (08:19 +0100)] 
Merge commit 'f3f2065910a02b0099d3d5f2ad3389d0e479c782' into HEAD [#2926]

16 months agoMerge commit '2f334bb12e3ba947714771408b9d49d398abb5df' into HEAD
Thomas Schwinge [Sun, 24 Mar 2024 22:37:24 +0000 (23:37 +0100)] 
Merge commit '2f334bb12e3ba947714771408b9d49d398abb5df' into HEAD

16 months agoAdjust '.github/bors_log_expected_warnings'
Thomas Schwinge [Sun, 24 Mar 2024 22:25:31 +0000 (23:25 +0100)] 
Adjust '.github/bors_log_expected_warnings'

16 months agoPlacate clang-format re 'gcc/rust/lex/rust-lex.cc'
Thomas Schwinge [Sun, 24 Mar 2024 22:08:12 +0000 (23:08 +0100)] 
Placate clang-format re 'gcc/rust/lex/rust-lex.cc'

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.

16 months agoMerge commit '9f7afa99c67f039e43019ebd08d14a7f01e2d89c' into HEAD
Thomas Schwinge [Fri, 22 Mar 2024 09:07:29 +0000 (10:07 +0100)] 
Merge commit '9f7afa99c67f039e43019ebd08d14a7f01e2d89c' into HEAD

16 months agoMerge commit 'cde6f1085b7027f6a42fdb71c786d422606a8765' into HEAD
Thomas Schwinge [Fri, 22 Mar 2024 08:58:10 +0000 (09:58 +0100)] 
Merge commit 'cde6f1085b7027f6a42fdb71c786d422606a8765' into HEAD

16 months agoMerge commit 'cde6f1085b7027f6a42fdb71c786d422606a8765^' into HEAD
Thomas Schwinge [Fri, 22 Mar 2024 08:58:02 +0000 (09:58 +0100)] 
Merge commit 'cde6f1085b7027f6a42fdb71c786d422606a8765^' into HEAD

16 months agoMerge commit '00dea7e8c41b672730d6e2c891b6012a83d8842c' into HEAD [#2284]
Thomas Schwinge [Fri, 22 Mar 2024 08:55:35 +0000 (09:55 +0100)] 
Merge commit '00dea7e8c41b672730d6e2c891b6012a83d8842c' into HEAD [#2284]

16 months agoMerge commit '00dea7e8c41b672730d6e2c891b6012a83d8842c^' into HEAD
Thomas Schwinge [Fri, 22 Mar 2024 08:49:13 +0000 (09:49 +0100)] 
Merge commit '00dea7e8c41b672730d6e2c891b6012a83d8842c^' into HEAD

16 months agoMerge commit 'a945c346f57ba40fc80c14ac59be0d43624e559d' into HEAD [#2842]
Thomas Schwinge [Fri, 22 Mar 2024 08:34:13 +0000 (09:34 +0100)] 
Merge commit 'a945c346f57ba40fc80c14ac59be0d43624e559d' into HEAD [#2842]

16 months agoMerge commit 'a945c346f57ba40fc80c14ac59be0d43624e559d^' into HEAD
Thomas Schwinge [Fri, 22 Mar 2024 08:26:05 +0000 (09:26 +0100)] 
Merge commit 'a945c346f57ba40fc80c14ac59be0d43624e559d^' into HEAD

16 months agoMerge commit '725fb3595622a4ad8cd078a42fab1c395cbf90cb' into HEAD [#1913, #2288]
Thomas Schwinge [Fri, 22 Mar 2024 00:19:10 +0000 (01:19 +0100)] 
Merge commit '725fb3595622a4ad8cd078a42fab1c395cbf90cb' into HEAD [#1913, #2288]

16 months agoMerge commit 'f37c55c14bc1176ef9a15fe584fb6d1bf2e6162f' into HEAD [#1913]
Thomas Schwinge [Fri, 22 Mar 2024 00:04:40 +0000 (01:04 +0100)] 
Merge commit 'f37c55c14bc1176ef9a15fe584fb6d1bf2e6162f' into HEAD [#1913]

16 months agoMerge commit 'f37c55c14bc1176ef9a15fe584fb6d1bf2e6162f^' into HEAD
Thomas Schwinge [Thu, 21 Mar 2024 23:30:43 +0000 (00:30 +0100)] 
Merge commit 'f37c55c14bc1176ef9a15fe584fb6d1bf2e6162f^' into HEAD

16 months agoMerge commit 'e4f0eb725d836ef0eec780cbb9e7be0d31c6fe8b' into HEAD [#2690, #2692,...
Thomas Schwinge [Tue, 19 Mar 2024 15:48:09 +0000 (16:48 +0100)] 
Merge commit 'e4f0eb725d836ef0eec780cbb9e7be0d31c6fe8b' into HEAD [#2690, #2692, #2853]

16 months agoSplit up rust-macro-builtins.cc
jjasmine [Sun, 25 Feb 2024 11:10:37 +0000 (03:10 -0800)] 
Split up rust-macro-builtins.cc

Fixes issue #2855

gcc/rust/ChangeLog:

* Make-lang.in: add new .o builds for new .cc files
* expand/rust-cfg-strip.h (RUST_CFG_STRIP_H): Add include guards
for rust-cfg-strip
* expand/rust-macro-builtins.cc (make_macro_path_str): moved to new respective files
(make_token): moved to new respective files
(make_string): moved to new respective files
(macro_end_token): moved to new respective files
(try_extract_string_literal_from_fragment): moved to new respective files
(try_expand_many_expr): moved to new respective files
(parse_single_string_literal): moved to new respective files
(source_relative_path): moved to new respective files
(load_file_bytes): moved to new respective files
(MacroBuiltin::assert_handler): moved to new respective files
(MacroBuiltin::file_handler): moved to new respective files
(MacroBuiltin::column_handler): moved to new respective files
(MacroBuiltin::include_bytes_handler): moved to new respective files
(MacroBuiltin::include_str_handler): moved to new respective files
(MacroBuiltin::compile_error_handler): moved to new respective files
(MacroBuiltin::concat_handler): moved to new respective files
(MacroBuiltin::env_handler): moved to new respective files
(MacroBuiltin::cfg_handler): moved to new respective files
(MacroBuiltin::include_handler): moved to new respective files
(MacroBuiltin::line_handler): moved to new respective files
(MacroBuiltin::stringify_handler): moved to new respective files
(struct FormatArgsInput): moved to new respective files
(struct FormatArgsParseError): moved to new respective files
(format_args_parse_arguments): moved to new respective files
(MacroBuiltin::format_args_handler): moved to new respective files
* expand/rust-macro-builtins.h (builtin_macro_from_string):
merge tl::optional from master
* expand/rust-macro-builtins-asm.cc: New file.
* expand/rust-macro-builtins-format-args.cc: New file.
* expand/rust-macro-builtins-helpers.cc: New file.
* expand/rust-macro-builtins-helpers.h: New file.
* expand/rust-macro-builtins-include.cc: New file.
* expand/rust-macro-builtins-location.cc: New file.
* expand/rust-macro-builtins-log-debug.cc: New file.
* expand/rust-macro-builtins-test-bench.cc: New file.
* expand/rust-macro-builtins-trait.cc: New file.
* expand/rust-macro-builtins-utility.cc: New file.

16 months agoFix typo
Guillaume Gomez [Tue, 5 Mar 2024 19:24:30 +0000 (20:24 +0100)] 
Fix typo

gcc/rust/ChangeLog:

* expand/rust-derive.cc (DeriveVisitor::derive): Fix typo

16 months agofixed README.md , dump ast using correct option
zhanghe9702 [Sat, 16 Mar 2024 04:25:28 +0000 (12:25 +0800)] 
fixed README.md , dump ast using correct option

ChangeLog:

* README.md: remove error dump option.

Signed-off-by: Zhang He <zhanghe9702@163.com>
16 months agoStore visibility properly in ExternalTypeItem
jjasmine [Sat, 9 Mar 2024 22:16:34 +0000 (17:16 -0500)] 
Store visibility properly in ExternalTypeItem

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

16 months agoTyTy: Collect variance info from types
Jakub Dupak [Fri, 2 Feb 2024 13:12:13 +0000 (14:12 +0100)] 
TyTy: Collect variance info from types

gcc/rust/ChangeLog:

* typecheck/rust-hir-type-check-item.cc (TypeCheckItem::visit):
Collect variance info from types.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoTyTy: Variance analysis module
Jakub Dupak [Fri, 2 Feb 2024 13:09:38 +0000 (14:09 +0100)] 
TyTy: Variance analysis module

gcc/rust/ChangeLog:

* Make-lang.in: Add new .cc file.
* rust-session-manager.cc (Session::compile_crate): Run
analysis.
* typecheck/rust-tyty-variance-analysis-private.h: New file.
* typecheck/rust-tyty-variance-analysis.cc: New file.
* typecheck/rust-tyty-variance-analysis.h: New file.
* typecheck/rust-typecheck-context.cc
(TypeCheckContext::get_variance_analysis_ctx):
Variance analysis context.
* typecheck/rust-hir-type-check.h (TypeCheckItem::visit):
Variance analysis context.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoTyTy: add common SubstitutionRef API
Jakub Dupak [Fri, 2 Feb 2024 11:11:45 +0000 (12:11 +0100)] 
TyTy: add common SubstitutionRef API

gcc/rust/ChangeLog:

* typecheck/rust-tyty-subst.cc (SubstitutionRef::get_arg_at):
Add unified API.

Signed-off-by: Jakub Dupak <dev@jakubdupak.com>
16 months agoformat-args: Only pass the format string to the parser.
Arthur Cohen [Thu, 7 Mar 2024 13:57:54 +0000 (14:57 +0100)] 
format-args: Only pass the format string to the parser.

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_arguments): Transform format_expr into a format string
properly - add note for handling eager macro invocations later on.
(MacroBuiltin::format_args_handler): Parse the correct input, append
newline to format_str if necessary.

16 months agoformat-args: Add basic test case
Arthur Cohen [Thu, 29 Feb 2024 15:09:23 +0000 (16:09 +0100)] 
format-args: Add basic test case

gcc/testsuite/ChangeLog:

* rust/compile/format_args_basic_expansion.rs: New test.

16 months agoformat-args: Add basic expansion of unnamed Display::fmt arguments.
Arthur Cohen [Thu, 29 Feb 2024 13:53:05 +0000 (14:53 +0100)] 
format-args: Add basic expansion of unnamed Display::fmt arguments.

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 getters.
* expand/rust-expand-format-args.cc (format_arg): New.
(get_trait_name): New.
(expand_format_args): Properly expand basic format_args!() invocations.
* expand/rust-expand-format-args.h (expand_format_args): Fix signature.
* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler):
Call into expand_format_args().

16 months agoformat-args: Start storing string in Rust memory
Arthur Cohen [Thu, 22 Feb 2024 15:26:40 +0000 (16:26 +0100)] 
format-args: Start storing string in Rust memory

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): Add members.
(struct FormatArgsHandle): New.
(clone_pieces): Adapt for new FFI API.
(destroy_pieces): Likewise.
(struct Pieces): Store new FormatArgsHandle type.
* expand/rust-expand-format-args.cc (expand_format_args): Use proper
namespace.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): FormatArgs
nodes are already resolved, so do nothing.

libgrust/ChangeLog:

* libformat_parser/src/lib.rs: Use new Handle struct and expose it.

16 months agoformat-args: Add base for expanding FormatArgs nodes
Arthur Cohen [Thu, 29 Feb 2024 12:01:32 +0000 (13:01 +0100)] 
format-args: Add base for expanding FormatArgs nodes

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.

16 months agoMerge commit 'a857ec6aada08d8c334c389c7b682198d749b6c9^' into HEAD
Thomas Schwinge [Tue, 19 Mar 2024 15:47:48 +0000 (16:47 +0100)] 
Merge commit 'a857ec6aada08d8c334c389c7b682198d749b6c9^' into HEAD

16 months agoMerge commit '8fc4e6c397e1ce64bec6f9fed148950821cc79e7' into HEAD
Thomas Schwinge [Tue, 19 Mar 2024 15:45:47 +0000 (16:45 +0100)] 
Merge commit '8fc4e6c397e1ce64bec6f9fed148950821cc79e7' into HEAD

Accordingly also adjust #2086 "break rust đŸ’¥" code, to avoid:

    [...]/source-gcc/gcc/rust/resolve/rust-ast-resolve-expr.cc: In member function â€˜virtual void Rust::Resolver::ResolveExpr::visit(Rust::AST::IdentifierExpr&)’:
    [...]/source-gcc/gcc/rust/resolve/rust-ast-resolve-expr.cc:164:42: error: invalid conversion from â€˜void (*)(diagnostic_context*, diagnostic_info*, diagnostic_t)’ to â€˜diagnostic_finalizer_fn’ {aka â€˜void (*)(diagnostic_context*, con
iagnostic_info*, diagnostic_t)’} [-fpermissive]
      164 |       diagnostic_finalizer (global_dc) = funny_ice_finalizer;
          |                                          ^~~~~~~~~~~~~~~~~~~
          |                                          |
          |                                          void (*)(diagnostic_context*, diagnostic_info*, diagnostic_t)

16 months agoMerge commit '8fc4e6c397e1ce64bec6f9fed148950821cc79e7^' into HEAD
Thomas Schwinge [Tue, 19 Mar 2024 15:45:27 +0000 (16:45 +0100)] 
Merge commit '8fc4e6c397e1ce64bec6f9fed148950821cc79e7^' into HEAD

16 months agoMerge commit 'f7884f7673444b8a2c10ea0981d480f2e82dd16a'; commit 'adb56ef014effb17af27...
Thomas Schwinge [Tue, 19 Mar 2024 15:42:45 +0000 (16:42 +0100)] 
Merge commit 'f7884f7673444b8a2c10ea0981d480f2e82dd16a'; commit 'adb56ef014effb17af27ab7baf0d87bc8bc48a0c' into HEAD [#2916]

Merge "macro: Use MacroInvocation's node_id in ExternalItem constructor", to
avoid bootstrap failure:

    [...]
    In file included from [...]/source-gcc/gcc/rust/ast/rust-expr.h:6,
                     from [...]/source-gcc/gcc/rust/ast/rust-ast-full.h:24,
                     from [...]/source-gcc/gcc/rust/ast/rust-ast.cc:24:
    In copy constructor â€˜Rust::AST::MacroInvocation::MacroInvocation(const Rust::AST::MacroInvocation&)’,
        inlined from â€˜Rust::AST::MacroInvocation* Rust::AST::MacroInvocation::clone_macro_invocation_impl() const’ at [...]/source-gcc/gcc/rust/ast/rust-\
    macro.h:798:38:
    [...]/source-gcc/gcc/rust/ast/rust-macro.h:734:39: error: â€˜*(Rust::AST::MacroInvocation*)<unknown>.Rust::AST::MacroInvocation::Rust::AST::ExprWithout\
    Block.Rust::AST::ExprWithoutBlock::Rust::AST::Expr.Rust::AST::Expr::node_id’ is used uninitialized [-Werror=uninitialized]
      734 |       builtin_kind (other.builtin_kind)
          |                                       ^
    cc1plus: all warnings being treated as errors
    make[3]: *** [[...]/source-gcc/gcc/rust/Make-lang.in:423: rust/rust-ast.o] Error 1
    [...]
    In file included from [...]/source-gcc/gcc/rust/ast/rust-expr.h:6,
                     from [...]/source-gcc/gcc/rust/ast/rust-item.h:27,
                     from [...]/source-gcc/gcc/rust/parse/rust-parse.h:20,
                     from [...]/source-gcc/gcc/rust/expand/rust-macro-expand.h:24,
                     from [...]/source-gcc/gcc/rust/expand/rust-macro-expand.cc:19:
    In copy constructor â€˜Rust::AST::MacroInvocation::MacroInvocation(const Rust::AST::MacroInvocation&)’,
        inlined from â€˜Rust::AST::MacroInvocation* Rust::AST::MacroInvocation::clone_macro_invocation_impl() const’ at [...]/source-gcc/gcc/rust/ast/rust-\
    macro.h:798:38:
    [...]/source-gcc/gcc/rust/ast/rust-macro.h:734:39: error: â€˜*(Rust::AST::MacroInvocation*)<unknown>.Rust::AST::MacroInvocation::Rust::AST::ExprWithout\
    Block.Rust::AST::ExprWithoutBlock::Rust::AST::Expr.Rust::AST::Expr::node_id’ is used uninitialized [-Werror=uninitialized]
      734 |       builtin_kind (other.builtin_kind)
          |                                       ^
    cc1plus: all warnings being treated as errors
    make[3]: *** [[...]/source-gcc/gcc/rust/Make-lang.in:433: rust/rust-macro-expand.o] Error 1
    [...]

16 months agoMerge commit 'f7884f7673444b8a2c10ea0981d480f2e82dd16a^' into HEAD
Thomas Schwinge [Tue, 19 Mar 2024 15:37:35 +0000 (16:37 +0100)] 
Merge commit 'f7884f7673444b8a2c10ea0981d480f2e82dd16a^' into HEAD

16 months agomacro: Use MacroInvocation's node_id in ExternalItem constructor.
Arthur Cohen [Tue, 19 Mar 2024 12:12:20 +0000 (13:12 +0100)] 
macro: Use MacroInvocation's node_id in ExternalItem constructor.

gcc/rust/ChangeLog:

* ast/rust-macro.h: Use proper node id instead of the one in the base
Expr class - which is uninitialized.

16 months agoci: Install Rust directly from rustup instead of apt
Arthur Cohen [Mon, 18 Mar 2024 14:10:43 +0000 (15:10 +0100)] 
ci: Install Rust directly from rustup instead of apt

ChangeLog:

* .github/workflows/ccpp.yml: Install Rust manually.

16 months agomacro: Use MacroInvocation's node_id in ExternalItem constructor.
Arthur Cohen [Tue, 19 Mar 2024 12:12:20 +0000 (13:12 +0100)] 
macro: Use MacroInvocation's node_id in ExternalItem constructor.

gcc/rust/ChangeLog:

* ast/rust-macro.h: Use proper node id instead of the one in the base
Expr class - which is uninitialized.

16 months agotree-optimization/112653 - PTA and return
Richard Biener [Mon, 27 Nov 2023 09:20:02 +0000 (10:20 +0100)] 
tree-optimization/112653 - PTA and return

The following separates the escape solution for return stmts not
only during points-to solving but also for later querying.  This
requires adjusting the points-to-global tests to include escapes
through returns.  Technically the patch replaces the existing
post-processing which computes the transitive closure of the
returned value solution by a proper artificial variable with
transitive closure constraints.  Instead of adding the solution
to escaped we track it separately.

PR tree-optimization/112653
* gimple-ssa.h (gimple_df): Add escaped_return solution.
* tree-ssa.cc (init_tree_ssa): Reset it.
(delete_tree_ssa): Likewise.
* tree-ssa-structalias.cc (escaped_return_id): New.
(find_func_aliases): Handle non-IPA return stmts by
adding to ESCAPED_RETURN.
(set_uids_in_ptset): Adjust HEAP escaping to also cover
escapes through return.
(init_base_vars): Initialize ESCAPED_RETURN.
(compute_points_to_sets): Replace ESCAPED post-processing
with recording the ESCAPED_RETURN solution.
* tree-ssa-alias.cc (ref_may_alias_global_p_1): Check
the ESCAPED_RETUNR solution.
(dump_alias_info): Dump it.
* cfgexpand.cc (update_alias_info_with_stack_vars): Update it.
* ipa-icf.cc (sem_item_optimizer::fixup_points_to_sets):
Likewise.
* tree-inline.cc (expand_call_inline): Reset it.
* tree-parloops.cc (parallelize_loops): Likewise.
* tree-sra.cc (maybe_add_sra_candidate): Check it.

* gcc.dg/tree-ssa/pta-return-1.c: New testcase.

(cherry picked from commit f7884f7673444b8a2c10ea0981d480f2e82dd16a)

16 months agosra: SRA of non-escaped aggregates passed by reference to calls
Martin Jambor [Fri, 24 Nov 2023 16:32:35 +0000 (17:32 +0100)] 
sra: SRA of non-escaped aggregates passed by reference to calls

PR109849 shows that a loop that heavily pushes and pops from a stack
implemented by a C++ std::vec results in slow code, mainly because the
vector structure is not split by SRA and so we end up in many loads
and stores into it.  This is because it is passed by reference
to (re)allocation methods and so needs to live in memory, even though
it does not escape from them and so we could SRA it if we
re-constructed it before the call and then separated it to distinct
replacements afterwards.

This patch does exactly that, first relaxing the selection of
candidates to also include those which are addressable but do not
escape and then adding code to deal with the calls.  The
micro-benchmark that is also the (scan-dump) testcase in this patch
runs twice as fast with it than with current trunk.  Honza measured
its effect on the libjxl benchmark and it almost closes the
performance gap between Clang and GCC while not requiring excessive
inlining and thus code growth.

The patch disallows creation of replacements for such aggregates which
are also accessed with a precision smaller than their size because I
have observed that this led to excessive zero-extending of data
leading to slow-downs of perlbench (on some CPUs).  Apart from this
case I have not noticed any regressions, at least not so far.

Gimple call argument flags can tell if an argument is unused (and then
we do not need to generate any statements for it) or if it is not
written to and then we do not need to generate statements loading
replacements from the original aggregate after the call statement.
Unfortunately, we cannot symmetrically use flags that an aggregate is
not read because to avoid re-constructing the aggregate before the
call because flags don't tell which what parts of aggregates were not
written to, so we load all replacements, and so all need to have the
correct value before the call.

This version of the patch also takes care to avoid attempts to modify
abnormal edges, something which was missing in the previosu version.

gcc/ChangeLog:

2023-11-23  Martin Jambor  <mjambor@suse.cz>

PR middle-end/109849
* tree-sra.cc (passed_by_ref_in_call): New.
(sra_initialize): Allocate passed_by_ref_in_call.
(sra_deinitialize): Free passed_by_ref_in_call.
(create_access): Add decl pool candidates only if they are not
already candidates.
(build_access_from_expr_1): Bail out on ADDR_EXPRs.
(build_access_from_call_arg): New function.
(asm_visit_addr): Rename to scan_visit_addr, change the
disqualification dump message.
(scan_function): Check taken addresses for all non-call statements,
including phi nodes.  Process all call arguments, including the static
chain, build_access_from_call_arg.
(maybe_add_sra_candidate): Relax need_to_live_in_memory check to allow
non-escaped local variables.
(sort_and_splice_var_accesses): Disallow smaller-than-precision
replacements for aggregates passed by reference to functions.
(sra_modify_expr): Use a separate stmt iterator for adding satements
before the processed statement and after it.
(enum out_edge_check): New type.
(abnormal_edge_after_stmt_p): New function.
(sra_modify_call_arg): New function.
(sra_modify_assign): Adjust calls to sra_modify_expr.
(sra_modify_function_body): Likewise, use sra_modify_call_arg to
process call arguments, including the static chain.

gcc/testsuite/ChangeLog:

2023-11-23  Martin Jambor  <mjambor@suse.cz>

PR middle-end/109849
* g++.dg/tree-ssa/pr109849.C: New test.
* g++.dg/tree-ssa/sra-eh-1.C: Likewise.
* gcc.dg/tree-ssa/pr109849.c: Likewise.
* gcc.dg/tree-ssa/sra-longjmp-1.c: Likewise.
* gfortran.dg/pr43984.f90: Added -fno-tree-sra to dg-options.

(cherry picked from commit aae723d360ca26cd9fd0b039fb0a616bd0eae363)

16 months agoMerge commit '56ca59a03150cf44cea340f58967c990ed6bf43c' into HEAD
Thomas Schwinge [Sat, 16 Mar 2024 23:10:10 +0000 (00:10 +0100)] 
Merge commit '56ca59a03150cf44cea340f58967c990ed6bf43c' into HEAD

16 months agoMerge commit '56ca59a03150cf44cea340f58967c990ed6bf43c^' into HEAD
Thomas Schwinge [Sat, 16 Mar 2024 23:10:04 +0000 (00:10 +0100)] 
Merge commit '56ca59a03150cf44cea340f58967c990ed6bf43c^' into HEAD

16 months agoMerge commit 'db50aea62595452db12565186cb520728540d987' into HEAD
Thomas Schwinge [Sat, 16 Mar 2024 23:06:54 +0000 (00:06 +0100)] 
Merge commit 'db50aea62595452db12565186cb520728540d987' into HEAD

16 months agoMerge commit 'db50aea62595452db12565186cb520728540d987^' into HEAD
Thomas Schwinge [Sat, 16 Mar 2024 22:57:22 +0000 (23:57 +0100)] 
Merge commit 'db50aea62595452db12565186cb520728540d987^' into HEAD

16 months agoMerge commit '4968e4844a3ce30143ae2e267895c418f5c636a1' into HEAD
Thomas Schwinge [Sat, 16 Mar 2024 22:55:02 +0000 (23:55 +0100)] 
Merge commit '4968e4844a3ce30143ae2e267895c418f5c636a1' into HEAD

16 months agoMerge commit '28064d6430f3fa71e79d11ac9d4bf3e6adf52145' into HEAD
Thomas Schwinge [Sat, 16 Mar 2024 22:54:33 +0000 (23:54 +0100)] 
Merge commit '28064d6430f3fa71e79d11ac9d4bf3e6adf52145' into HEAD

16 months agoRevert "Add files to discourage submissions of PRs to the GitHub mirror."
Thomas Schwinge [Sat, 16 Mar 2024 22:32:57 +0000 (23:32 +0100)] 
Revert "Add files to discourage submissions of PRs to the GitHub mirror."

This is not applicable for GCC/Rust, which does use GitHub.

This reverts commit 2b9778c8d9d33174de63716b74b2f114d700e104.

16 months agoMerge commit '2b9778c8d9d33174de63716b74b2f114d700e104^' into HEAD
Thomas Schwinge [Sat, 16 Mar 2024 22:32:07 +0000 (23:32 +0100)] 
Merge commit '2b9778c8d9d33174de63716b74b2f114d700e104^' into HEAD

16 months agoMerge commit '6a6d3817afa02bbcd2388c8e005da6faf88932f1' into HEAD [#2714]
Thomas Schwinge [Sat, 16 Mar 2024 22:06:45 +0000 (23:06 +0100)] 
Merge commit '6a6d3817afa02bbcd2388c8e005da6faf88932f1' into HEAD [#2714]

16 months agoMerge commit '6a6d3817afa02bbcd2388c8e005da6faf88932f1^' into HEAD
Thomas Schwinge [Sat, 16 Mar 2024 22:03:21 +0000 (23:03 +0100)] 
Merge commit '6a6d3817afa02bbcd2388c8e005da6faf88932f1^' into HEAD

16 months agoReplace unique_ptr references with references
Pierre-Emmanuel Patry [Thu, 22 Feb 2024 17:55:53 +0000 (18:55 +0100)] 
Replace unique_ptr references with references

This kind of double indirection is pointless and prone to error. This
commit change the api of all getters from the AST to use references
directly instead of references to unique pointers.

gcc/rust/ChangeLog:

* ast/rust-ast-collector.cc (TokenCollector::visit): Remove reference
to unique pointer and replace it with a direct reference to the wrapped
data.
* ast/rust-ast.cc (VariadicParam::as_string): Likewise.
(BlockExpr::normalize_tail_expr): Likewise.
* ast/rust-expr.h: Likewise and add pointer getter in order to allow
pointer reseat.
* ast/rust-item.h: Likewise and add pointer getter for reseat.
* ast/rust-path.h: Likewise.
* ast/rust-pattern.h: Likewise.
* ast/rust-stmt.h: Likewise.
* ast/rust-type.h: Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::maybe_strip_struct_fields):
Remove references to unique pointers and replace it with direct
references to the wrapped object.
(CfgStrip::maybe_strip_tuple_fields): Likewise.
(CfgStrip::maybe_strip_generic_args): Likewise.
(CfgStrip::maybe_strip_qualified_path_type): Likewise.
(CfgStrip::visit): Likewise.
* expand/rust-expand-visitor.cc (ExpandVisitor::maybe_expand_expr):
Likewise.
(ExpandVisitor::maybe_expand_type): Likewise.
(ExpandVisitor::visit): Likewise.
* expand/rust-expand-visitor.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_binding):
Likewise.
(ASTLoweringBase::lower_generic_args): Likewise.
(ASTLoweringBase::lower_self): Likewise.
(ASTLoweringBase::lower_type_no_bounds): Likewise.
(ASTLoweringBase::lower_bound): Likewise.
(ASTLoweringBase::lower_range_pattern_bound): Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* hir/rust-ast-lower-block.h: Likewise.
* hir/rust-ast-lower-enumitem.h: Likewise.
* hir/rust-ast-lower-expr.cc (ASTLoweringExpr::translate): Likewise.
(ASTLoweringExpr::visit): Likewise.
* hir/rust-ast-lower-expr.h: Likewise.
* hir/rust-ast-lower-extern.h: Likewise.
* hir/rust-ast-lower-implitem.cc (ASTLowerImplItem::translate):
Likewise.
(ASTLowerImplItem::visit): Likewise.
(ASTLowerTraitItem::translate): Likewise.
(ASTLowerTraitItem::visit): Likewise.
* hir/rust-ast-lower-implitem.h: Likewise.
* hir/rust-ast-lower-item.cc (ASTLoweringItem::translate): Likewise.
(ASTLoweringItem::visit): Likewise.
* hir/rust-ast-lower-item.h: Likewise.
* hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::translate):
Likewise.
(ASTLoweringPattern::visit): Likewise.
* hir/rust-ast-lower-pattern.h: Likewise.
* hir/rust-ast-lower-stmt.cc (ASTLoweringStmt::visit): Likewise.
* hir/rust-ast-lower-struct-field-expr.h: Likewise.
* hir/rust-ast-lower-type.cc (ASTLowerTypePath::visit): Likewise.
(ASTLowerQualifiedPathInType::visit): Likewise.
(ASTLoweringType::translate): Likewise.
(ASTLoweringType::visit): Likewise.
(ASTLowerGenericParam::translate): Likewise.
(ASTLowerGenericParam::visit): Likewise.
(ASTLoweringTypeBounds::translate): Likewise.
(ASTLoweringTypeBounds::visit): Likewise.
(ASTLowerWhereClauseItem::visit): Likewise.
* hir/rust-ast-lower-type.h: Likewise.
* hir/rust-ast-lower.cc (ASTLowering::go): Likewise.
(ASTLoweringBlock::visit): Likewise.
(ASTLoweringIfBlock::visit): Likewise.
(ASTLoweringIfLetBlock::visit): Likewise.
(ASTLowerStructExprField::visit): Likewise.
(ASTLoweringExprWithBlock::visit): Likewise.
(ASTLoweringBase::lower_qual_path_type): Likewise.
(ASTLoweringBase::lower_closure_param): Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::resolve_visibility):
Likewise.
* resolve/rust-ast-resolve-expr.cc (ResolveExpr::go): Likewise.
(ResolveExpr::visit): Likewise.
(ResolveExpr::resolve_closure_param): Likewise.
* resolve/rust-ast-resolve-expr.h: Likewise.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit):
Likewise.
(ResolveItem::go): Likewise.
(ResolveItem::visit): Likewise.
(ResolveItem::resolve_impl_item): Likewise.
(ResolveItem::resolve_extern_item): Likewise.
(ResolveImplItems::go): Likewise.
(ResolveExternItem::go): Likewise.
(ResolveExternItem::visit): Likewise.
* resolve/rust-ast-resolve-item.h: Likewise.
* resolve/rust-ast-resolve-path.cc (ResolvePath::go): Likewise.
(ResolvePath::resolve_path): Likewise.
* resolve/rust-ast-resolve-path.h: Likewise.
* resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::go):
Likewise.
(PatternDeclaration::visit): Likewise.
(resolve_range_pattern_bound): Likewise.
* resolve/rust-ast-resolve-pattern.h: Likewise.
* resolve/rust-ast-resolve-stmt.cc (ResolveStmt::visit): Likewise.
* resolve/rust-ast-resolve-stmt.h: Likewise.
* resolve/rust-ast-resolve-struct-expr-field.cc (ResolveStructExprField::go):
Likewise.
(ResolveStructExprField::visit): Likewise.
* resolve/rust-ast-resolve-struct-expr-field.h: Likewise.
* resolve/rust-ast-resolve-toplevel.h: Likewise.
* resolve/rust-ast-resolve-type.cc (ResolveType::visit): Likewise.
(ResolveRelativeTypePath::go): Likewise.
(ResolveRelativeQualTypePath::resolve_qual_seg): Likewise.
(ResolveTypeToCanonicalPath::go): Likewise.
(ResolveTypeToCanonicalPath::visit): Likewise.
(ResolveGenericArgs::resolve_disambiguated_generic): Likewise.
(ResolveGenericArgs::go): Likewise.
* resolve/rust-ast-resolve-type.h: Likewise.
* resolve/rust-ast-resolve.cc (NameResolution::go): Likewise.
* resolve/rust-default-resolver.cc (DefaultResolver::visit): Likewise.
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::resolve_qualified_path_type):
Likewise.
(EarlyNameResolver::visit): Likewise.
* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
Likewise.
* checks/errors/rust-ast-validation.cc: Likewise.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
16 months agoReplace reference to unique pointer with reference
Pierre-Emmanuel Patry [Wed, 21 Feb 2024 15:45:18 +0000 (16:45 +0100)] 
Replace reference to unique pointer with reference

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 reference to the wrapper type.
* checks/errors/rust-ast-validation.cc (ASTValidation::visit): Fix
the code to accept references instead.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_self): Change
function implementation to return a reference.
* hir/rust-ast-lower-base.h: Accept a reference instead of a unique
pointer reference.
* resolve/rust-ast-resolve-item.cc (ResolveItem::visit): Adapt the code
to a reference instead of a unique pointer.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
16 months agoMerge commit '1a9974d08bc1478a98f52b2ea95475a583747724' into HEAD [#2912]
Thomas Schwinge [Tue, 12 Mar 2024 08:41:55 +0000 (09:41 +0100)] 
Merge commit '1a9974d08bc1478a98f52b2ea95475a583747724' into HEAD [#2912]

16 months agoPlacate clang-format re 'gcc/rust/backend/rust-tree.cc'
Thomas Schwinge [Tue, 12 Mar 2024 08:36:43 +0000 (09:36 +0100)] 
Placate clang-format re 'gcc/rust/backend/rust-tree.cc'

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_mode): Placate clang-format.

16 months agoAdjust '.github/bors_log_expected_warnings'
Thomas Schwinge [Mon, 11 Mar 2024 22:44:18 +0000 (23:44 +0100)] 
Adjust '.github/bors_log_expected_warnings'

16 months agocse: Workaround GCC < 5 bug in cse_insn [PR111852]
Jakub Jelinek [Wed, 18 Oct 2023 15:01:26 +0000 (17:01 +0200)] 
cse: Workaround GCC < 5 bug in cse_insn [PR111852]

Before the r5-3834 commit for PR63362, GCC 4.8-4.9 refuses to compile
cse.cc which contains a variable with rtx_def type, because rtx_def
contains a union with poly_uint16 element.  poly_int template has
defaulted default constructor and a variadic template constructor which
could have empty parameter pack. GCC < 5 treated it as non-trivially
constructible class and deleted rtunion and rtx_def default constructors.

For the cse_insn purposes, all we need is a variable with size and alignment
of rtx_def, not necessarily rtx_def itself, which we then memset to 0 and
fill in like rtx is normally allocated from heap, so this patch for
GCC_VERSION < 5000 uses an unsigned char array of the right size/alignment.

2023-10-18  Jakub Jelinek  <jakub@redhat.com>

PR bootstrap/111852
* cse.cc (cse_insn): Add workaround for GCC 4.8-4.9, instead of
using rtx_def type for memory_extend_buf, use unsigned char
arrayy with size of rtx_def and its alignment.

(cherry picked from commit bc4bd69faf986326f6b0fd0400cdd6871577afd1)

16 months agoMerge commit 'af4bb221153359f5948da917d5ef2df738bb1e61' into HEAD
Thomas Schwinge [Mon, 11 Mar 2024 21:51:28 +0000 (22:51 +0100)] 
Merge commit 'af4bb221153359f5948da917d5ef2df738bb1e61' into HEAD

16 months agoMerge commit '46595ce72e5855189e3c60a140c3ca5aaddfb58c' into HEAD
Thomas Schwinge [Mon, 11 Mar 2024 21:43:19 +0000 (22:43 +0100)] 
Merge commit '46595ce72e5855189e3c60a140c3ca5aaddfb58c' into HEAD

16 months agoMerge commit '46595ce72e5855189e3c60a140c3ca5aaddfb58c^' into HEAD
Thomas Schwinge [Mon, 11 Mar 2024 21:38:33 +0000 (22:38 +0100)] 
Merge commit '46595ce72e5855189e3c60a140c3ca5aaddfb58c^' into HEAD

16 months agoMerge commit '7439f40dc17f47480620beadf5b2f5784b59aefe' into HEAD [#1543]
Thomas Schwinge [Mon, 11 Mar 2024 00:05:15 +0000 (01:05 +0100)] 
Merge commit '7439f40dc17f47480620beadf5b2f5784b59aefe' into HEAD [#1543]

16 months agoMerge commit 'b1c06fd9723453dd2b2ec306684cb806dc2b4fbb^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:59:26 +0000 (00:59 +0100)] 
Merge commit 'b1c06fd9723453dd2b2ec306684cb806dc2b4fbb^' into HEAD

16 months agoMerge commit 'ce7a757fd9ecb99c4f54cfde5cf5ef9a9e7819fc' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:58:39 +0000 (00:58 +0100)] 
Merge commit 'ce7a757fd9ecb99c4f54cfde5cf5ef9a9e7819fc' into HEAD

16 months agoMerge commit 'ce7a757fd9ecb99c4f54cfde5cf5ef9a9e7819fc^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:57:51 +0000 (00:57 +0100)] 
Merge commit 'ce7a757fd9ecb99c4f54cfde5cf5ef9a9e7819fc^' into HEAD

16 months agoMerge commit 'af91934c2f6b8efc67d625c99068b4761ae5edd0' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:56:06 +0000 (00:56 +0100)] 
Merge commit 'af91934c2f6b8efc67d625c99068b4761ae5edd0' into HEAD

16 months agoMerge commit 'af91934c2f6b8efc67d625c99068b4761ae5edd0^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:47:49 +0000 (00:47 +0100)] 
Merge commit 'af91934c2f6b8efc67d625c99068b4761ae5edd0^' into HEAD

16 months agoMerge commit '1aee5d2ace9ea8f35baf5b18e36caf44fe018ea3' into HEAD [#1408]
Thomas Schwinge [Sun, 10 Mar 2024 23:45:13 +0000 (00:45 +0100)] 
Merge commit '1aee5d2ace9ea8f35baf5b18e36caf44fe018ea3' into HEAD [#1408]

16 months agoMerge commit '1ad5ae5a45f2e3fc6948b35a3b052fdd48453704' into HEAD [#1408]
Thomas Schwinge [Sun, 10 Mar 2024 23:34:47 +0000 (00:34 +0100)] 
Merge commit '1ad5ae5a45f2e3fc6948b35a3b052fdd48453704' into HEAD [#1408]

16 months agoMerge commit '1ad5ae5a45f2e3fc6948b35a3b052fdd48453704^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:34:22 +0000 (00:34 +0100)] 
Merge commit '1ad5ae5a45f2e3fc6948b35a3b052fdd48453704^' into HEAD

16 months agoMerge commit 'f3f6ff7b16861cd0651eccff14689536550762ae' into HEAD [#2414]
Thomas Schwinge [Sun, 10 Mar 2024 23:33:08 +0000 (00:33 +0100)] 
Merge commit 'f3f6ff7b16861cd0651eccff14689536550762ae' into HEAD [#2414]

16 months agoMerge commit 'f3f6ff7b16861cd0651eccff14689536550762ae^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:26:50 +0000 (00:26 +0100)] 
Merge commit 'f3f6ff7b16861cd0651eccff14689536550762ae^' into HEAD

16 months agoMerge commit 'dc17ceb3055f56aa3a59c6ef3ae32043d58502d1' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:25:25 +0000 (00:25 +0100)] 
Merge commit 'dc17ceb3055f56aa3a59c6ef3ae32043d58502d1' into HEAD

16 months agoMerge commit 'dc17ceb3055f56aa3a59c6ef3ae32043d58502d1^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:25:10 +0000 (00:25 +0100)] 
Merge commit 'dc17ceb3055f56aa3a59c6ef3ae32043d58502d1^' into HEAD

16 months agoMerge commit '9fc0ae6033f3e41c9b4605531a6a8543414b0d2d' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:24:32 +0000 (00:24 +0100)] 
Merge commit '9fc0ae6033f3e41c9b4605531a6a8543414b0d2d' into HEAD

16 months agoMerge commit '9fc0ae6033f3e41c9b4605531a6a8543414b0d2d^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:24:01 +0000 (00:24 +0100)] 
Merge commit '9fc0ae6033f3e41c9b4605531a6a8543414b0d2d^' into HEAD

16 months agoMerge commit 'ead5103cc6f526bcc5a30c8c7185e9dd5de73d55' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:21:19 +0000 (00:21 +0100)] 
Merge commit 'ead5103cc6f526bcc5a30c8c7185e9dd5de73d55' into HEAD

16 months agoMerge commit 'f330710912229678b65def1f6f52765baa3d0f7a' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:20:06 +0000 (00:20 +0100)] 
Merge commit 'f330710912229678b65def1f6f52765baa3d0f7a' into HEAD

16 months agoMerge commit 'ab422974567ae73926c2308c3400b5974d6e09f1' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:18:11 +0000 (00:18 +0100)] 
Merge commit 'ab422974567ae73926c2308c3400b5974d6e09f1' into HEAD

16 months agoMerge commit 'ab422974567ae73926c2308c3400b5974d6e09f1^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:17:15 +0000 (00:17 +0100)] 
Merge commit 'ab422974567ae73926c2308c3400b5974d6e09f1^' into HEAD

16 months agoMerge commit '9c7797a8c2d707ba4516d3d96d8dff6201476fb6' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 23:15:40 +0000 (00:15 +0100)] 
Merge commit '9c7797a8c2d707ba4516d3d96d8dff6201476fb6' into HEAD

16 months agoMerge commit '126f707efbb5184178701cbdc753a10fd831374e' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:58:16 +0000 (23:58 +0100)] 
Merge commit '126f707efbb5184178701cbdc753a10fd831374e' into HEAD

16 months agoMerge commit '126f707efbb5184178701cbdc753a10fd831374e^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:54:17 +0000 (23:54 +0100)] 
Merge commit '126f707efbb5184178701cbdc753a10fd831374e^' into HEAD

16 months agoMerge commit 'f4a2ae2338962208b8039f154f5912402e94c378' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:42:52 +0000 (23:42 +0100)] 
Merge commit 'f4a2ae2338962208b8039f154f5912402e94c378' into HEAD

16 months agoMerge commit 'f4a2ae2338962208b8039f154f5912402e94c378^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:42:46 +0000 (23:42 +0100)] 
Merge commit 'f4a2ae2338962208b8039f154f5912402e94c378^' into HEAD

16 months agoMerge commit '8a30775b0d3037123ee540f7b65a736ad49e05ce' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:38:46 +0000 (23:38 +0100)] 
Merge commit '8a30775b0d3037123ee540f7b65a736ad49e05ce' into HEAD

16 months agoMerge commit '8a30775b0d3037123ee540f7b65a736ad49e05ce^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:38:38 +0000 (23:38 +0100)] 
Merge commit '8a30775b0d3037123ee540f7b65a736ad49e05ce^' into HEAD

16 months agoMerge commit '33ebb0dff9bb022f1e0709e0e73faabfc3df7931' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:34:31 +0000 (23:34 +0100)] 
Merge commit '33ebb0dff9bb022f1e0709e0e73faabfc3df7931' into HEAD

16 months agoMerge commit '33ebb0dff9bb022f1e0709e0e73faabfc3df7931^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:34:09 +0000 (23:34 +0100)] 
Merge commit '33ebb0dff9bb022f1e0709e0e73faabfc3df7931^' into HEAD

16 months agoMerge commit '4f01ae3761ca1f8dd7a33b833ae30624f047ac9c' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:24:35 +0000 (23:24 +0100)] 
Merge commit '4f01ae3761ca1f8dd7a33b833ae30624f047ac9c' into HEAD

16 months agoMerge commit '4f01ae3761ca1f8dd7a33b833ae30624f047ac9c^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:22:34 +0000 (23:22 +0100)] 
Merge commit '4f01ae3761ca1f8dd7a33b833ae30624f047ac9c^' into HEAD

16 months agoMerge commit 'ea1cd66f2200839d46a8b4dc140d18c00b849c82' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:19:06 +0000 (23:19 +0100)] 
Merge commit 'ea1cd66f2200839d46a8b4dc140d18c00b849c82' into HEAD

16 months agoMerge commit 'ea1cd66f2200839d46a8b4dc140d18c00b849c82^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:18:49 +0000 (23:18 +0100)] 
Merge commit 'ea1cd66f2200839d46a8b4dc140d18c00b849c82^' into HEAD

16 months agoMerge commit 'bc45e18d433f879a02e369d027829f90f9e85724' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:16:21 +0000 (23:16 +0100)] 
Merge commit 'bc45e18d433f879a02e369d027829f90f9e85724' into HEAD

16 months agoMerge commit 'bc45e18d433f879a02e369d027829f90f9e85724^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 22:15:52 +0000 (23:15 +0100)] 
Merge commit 'bc45e18d433f879a02e369d027829f90f9e85724^' into HEAD

16 months agoMerge commit '0a85544e1aaeca41133ecfc438cda913dbc0f122' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 21:57:58 +0000 (22:57 +0100)] 
Merge commit '0a85544e1aaeca41133ecfc438cda913dbc0f122' into HEAD

16 months agoMerge commit '0a85544e1aaeca41133ecfc438cda913dbc0f122^' into HEAD
Thomas Schwinge [Sun, 10 Mar 2024 21:56:03 +0000 (22:56 +0100)] 
Merge commit '0a85544e1aaeca41133ecfc438cda913dbc0f122^' into HEAD

17 months agoRemove dead code associated with `AST::ExternalFunctionItem`
0xn4utilus [Wed, 28 Feb 2024 14:05:30 +0000 (19:35 +0530)] 
Remove dead code associated with `AST::ExternalFunctionItem`

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 (DefaultASTVisitor::visit):
Likewise.
* ast/rust-ast-visitor.h: Likewise.
* ast/rust-ast.cc (ExternalFunctionItem::as_string): Likewise.
(ExternalFunctionItem::accept_vis): Likewise.
* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
Likewise.
* checks/errors/rust-ast-validation.h: Likewise.
* checks/errors/rust-feature-gate.h: Likewise.
* expand/rust-cfg-strip.cc (CfgStrip::visit):
Likewise.
* expand/rust-cfg-strip.h: Likewise.
* expand/rust-derive.h: Likewise.
* expand/rust-expand-visitor.cc (ExpandVisitor::visit):
Likewise.
* expand/rust-expand-visitor.h: Likewise.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit):
Likewise.
* hir/rust-ast-lower-base.h: Likewise.
* metadata/rust-export-metadata.cc (ExportContext::emit_function):
Likewise.
* parse/rust-parse-impl.h: Likewise.
* parse/rust-parse.h: Likewise.
* resolve/rust-ast-resolve-base.cc (ResolverBase::visit):
Likewise.
* resolve/rust-ast-resolve-base.h: Likewise.
* resolve/rust-default-resolver.cc (DefaultResolver::visit):
Likewise.
* resolve/rust-default-resolver.h: Likewise.
* util/rust-attributes.cc (AttributeChecker::visit): Likewise.
* util/rust-attributes.h: Likewise.

gcc/testsuite/ChangeLog:

* rust/compile/extern_func_with_body.rs: New test.

Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
17 months agoUpdate resolver to use `AST::Function` instead of `AST::ExternalFunctionItem`
0xn4utilus [Sun, 25 Feb 2024 23:09:43 +0000 (04:39 +0530)] 
Update resolver to use `AST::Function` instead of `AST::ExternalFunctionItem`

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::parse_external_item):
Likewise.
(Parser::parse_pattern): Fix clang format.
* resolve/rust-ast-resolve-implitem.h: Likewise.
* resolve/rust-ast-resolve-item.cc (ResolveExternItem::visit):
Likewise.
* resolve/rust-ast-resolve-item.h: Likewise.
* resolve/rust-default-resolver.cc (DefaultResolver::visit):
Check if param has_pattern before using get_pattern.

Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
17 months agoUnify ASTValidation::visit for ExternalFunctionItem and Function
0xn4utilus [Sun, 25 Feb 2024 13:33:55 +0000 (19:03 +0530)] 
Unify ASTValidation::visit for ExternalFunctionItem and Function

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`.
(Parser::parse_external_item): Clang format.
(Parser::parse_pattern): Clang format.
* parse/rust-parse.h: Add default parameter
`is_external` in `parse_function`.

Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
17 months agoAdd get_pattern_kind to Pattern
0xn4utilus [Sun, 25 Feb 2024 00:50:51 +0000 (06:20 +0530)] 
Add get_pattern_kind to Pattern

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 <gyanendrabanjare8@gmail.com>
17 months agoAdd support for external functions
0xn4utilus [Sun, 25 Feb 2024 00:02:26 +0000 (05:32 +0530)] 
Add support for external functions

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`
field. Update `get_node_id`.
* ast/rust-macro.h: Update copy constructor.

Signed-off-by: 0xn4utilus <gyanendrabanjare8@gmail.com>
17 months agoClean BiMap to use tl::optional for lookups
Sourabh Jaiswal [Fri, 1 Mar 2024 11:46:23 +0000 (19:46 +0800)] 
Clean BiMap to use tl::optional for lookups

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
(make_macro_path_str): Likewise
* util/rust-hir-map.cc (Mappings::insert_macro_def): Likewise
* util/rust-lang-item.cc (LangItem::Parse): Adjust to return tl::optional
(LangItem::toString) Likewise
* util/rust-token-converter.cc (handle_suffix): Adjust to use value.or ()
(from_literal) Likewise
* util/bi-map.h (BiMap::lookup): Adjust to use tl::optional for
lookups

Signed-off-by: Sourabh Jaiswal <sourabhrj31@gmail.com>