From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1643) id 943163856241; Mon, 29 Aug 2022 15:33:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 943163856241 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661787209; bh=OuOVBGf0z6YUKo1Avlt0PpsgSNmo5hCJYFhGKkUHEcM=; h=From:To:Subject:Date:From; b=dLn7eCLu3kqqA34jLHBejawdek88pARhTkYl0Qjb2jz3+8RNtH/yjH9DOA5LF8Uig ZznWH4OtcCRxZ+n/T5PTMRMZQgX6Vd/AzTmIUnb01KAEa1lAxSerrtpLih6lNEstuc MVBbwNm7tdfpw2mBuRIpUuDdXJvKP+8Trp96wRKw= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Thomas Schwinge To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] Each intrinsic needs marked as const X-Act-Checkin: gcc X-Git-Author: Philip Herron X-Git-Refname: refs/heads/devel/rust/master X-Git-Oldrev: 4fe7b96c2726322191c0eadd2c1c712afb3d0299 X-Git-Newrev: d4e80fd645a9b4cac48957283e820f23d6e18aab Message-Id: <20220829153329.943163856241@sourceware.org> Date: Mon, 29 Aug 2022 15:33:29 +0000 (GMT) List-Id: https://gcc.gnu.org/g:d4e80fd645a9b4cac48957283e820f23d6e18aab commit d4e80fd645a9b4cac48957283e820f23d6e18aab Author: Philip Herron Date: Mon Jul 25 12:59:15 2022 +0100 Each intrinsic needs marked as const These intrinsics and builtin's need to be marked as const in order for the const eval code to generate copy's to cache their results and folded function bodies. Diff: --- gcc/rust/backend/rust-compile-base.cc | 2 ++ gcc/rust/backend/rust-compile-intrinsic.cc | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/rust/backend/rust-compile-base.cc b/gcc/rust/backend/rust-compile-base.cc index ab330c45668..cde0f085307 100644 --- a/gcc/rust/backend/rust-compile-base.cc +++ b/gcc/rust/backend/rust-compile-base.cc @@ -701,6 +701,8 @@ HIRCompileBase::compile_constant_item ( gcc_assert (TREE_CODE (bind_tree) == BIND_EXPR); DECL_SAVED_TREE (fndecl) = bind_tree; + DECL_DECLARED_CONSTEXPR_P (fndecl); + maybe_save_constexpr_fundef (fndecl); ctx->pop_fn (); diff --git a/gcc/rust/backend/rust-compile-intrinsic.cc b/gcc/rust/backend/rust-compile-intrinsic.cc index 61084b90f33..ae50c8a3c02 100644 --- a/gcc/rust/backend/rust-compile-intrinsic.cc +++ b/gcc/rust/backend/rust-compile-intrinsic.cc @@ -15,17 +15,18 @@ // . #include "rust-compile-intrinsic.h" -#include "fold-const.h" -#include "langhooks.h" #include "rust-compile-context.h" #include "rust-compile-type.h" #include "rust-compile-fnparam.h" #include "rust-builtins.h" #include "rust-diagnostics.h" #include "rust-location.h" +#include "rust-constexpr.h" #include "rust-tree.h" #include "tree-core.h" #include "print-tree.h" +#include "fold-const.h" +#include "langhooks.h" namespace Rust { namespace Compile { @@ -213,6 +214,9 @@ finalize_intrinsic_block (Context *ctx, tree fndecl) DECL_SAVED_TREE (fndecl) = bind_tree; ctx->push_function (fndecl); + + DECL_DECLARED_CONSTEXPR_P (fndecl); + maybe_save_constexpr_fundef (fndecl); } static tree