[gcc/devel/rust/master] Each intrinsic needs marked as const
Thomas Schwinge
tschwinge@gcc.gnu.org
Mon Aug 29 15:33:29 GMT 2022
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
More information about the Gcc-cvs
mailing list