public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Each intrinsic needs marked as const
@ 2022-08-29 15:33 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-08-29 15:33 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d4e80fd645a9b4cac48957283e820f23d6e18aab

commit d4e80fd645a9b4cac48957283e820f23d6e18aab
Author: Philip Herron <philip.herron@embecosm.com>
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 @@
 // <http://www.gnu.org/licenses/>.
 
 #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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-29 15:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-29 15:33 [gcc/devel/rust/master] Each intrinsic needs marked as const Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).