aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-07-25 12:59:15 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-08-25 12:40:25 +0100
commitd4e80fd645a9b4cac48957283e820f23d6e18aab (patch)
treea58728652d53be12d273cbacadb8ce3e32a8072f
parent4fe7b96c2726322191c0eadd2c1c712afb3d0299 (diff)
downloadgcc-d4e80fd645a9b4cac48957283e820f23d6e18aab.zip
gcc-d4e80fd645a9b4cac48957283e820f23d6e18aab.tar.gz
gcc-d4e80fd645a9b4cac48957283e820f23d6e18aab.tar.bz2
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.
-rw-r--r--gcc/rust/backend/rust-compile-base.cc2
-rw-r--r--gcc/rust/backend/rust-compile-intrinsic.cc8
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 ab330c4..cde0f08 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 61084b9..ae50c8a 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