diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-02-10 16:07:28 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-02-10 16:07:28 +0000 |
commit | 1b487d72cd2ba46671f5a1bcc20970f2dad1b759 (patch) | |
tree | a1c1a61fd3031416ca3bc600212cd13e51f727b8 /gcc | |
parent | e49dd22fc233f3b7b7dcca4bd1ba2e7ea6dea71c (diff) | |
download | gcc-1b487d72cd2ba46671f5a1bcc20970f2dad1b759.zip gcc-1b487d72cd2ba46671f5a1bcc20970f2dad1b759.tar.gz gcc-1b487d72cd2ba46671f5a1bcc20970f2dad1b759.tar.bz2 |
Remove tree addressable flags from back-end local and fnparm decl creation
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/backend/rust-compile-fnparam.h | 14 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-var-decl.h | 11 | ||||
-rw-r--r-- | gcc/rust/rust-backend.h | 5 | ||||
-rw-r--r-- | gcc/rust/rust-gcc.cc | 15 |
4 files changed, 15 insertions, 30 deletions
diff --git a/gcc/rust/backend/rust-compile-fnparam.h b/gcc/rust/backend/rust-compile-fnparam.h index 137bcad..4ca26ec 100644 --- a/gcc/rust/backend/rust-compile-fnparam.h +++ b/gcc/rust/backend/rust-compile-fnparam.h @@ -43,19 +43,18 @@ public: if (!pattern.is_mut ()) decl_type = ctx->get_backend ()->immutable_type (decl_type); - bool address_taken = false; - compiled_param = ctx->get_backend ()->parameter_variable ( - fndecl, pattern.get_identifier (), decl_type, address_taken, locus); + compiled_param + = ctx->get_backend ()->parameter_variable (fndecl, + pattern.get_identifier (), + decl_type, locus); } void visit (HIR::WildcardPattern &pattern) override { decl_type = ctx->get_backend ()->immutable_type (decl_type); - bool address_taken = false; compiled_param - = ctx->get_backend ()->parameter_variable (fndecl, "_", decl_type, - address_taken, locus); + = ctx->get_backend ()->parameter_variable (fndecl, "_", decl_type, locus); } private: @@ -82,9 +81,8 @@ public: if (is_immutable) decl_type = ctx->get_backend ()->immutable_type (decl_type); - bool address_taken = false; return ctx->get_backend ()->parameter_variable (fndecl, "self", decl_type, - address_taken, locus); + locus); } }; diff --git a/gcc/rust/backend/rust-compile-var-decl.h b/gcc/rust/backend/rust-compile-var-decl.h index 1da6cd4..7bc37eb 100644 --- a/gcc/rust/backend/rust-compile-var-decl.h +++ b/gcc/rust/backend/rust-compile-var-decl.h @@ -55,26 +55,19 @@ public: if (!pattern.is_mut ()) translated_type = ctx->get_backend ()->immutable_type (translated_type); - // this gets updated when the compilation _actually_ wants to take an - // address - bool address_taken = false; compiled_variable = ctx->get_backend ()->local_variable (fndecl, pattern.get_identifier (), translated_type, NULL /*decl_var*/, - address_taken, locus); + locus); } void visit (HIR::WildcardPattern &pattern) override { translated_type = ctx->get_backend ()->immutable_type (translated_type); - // this gets updated when the compilation _actually_ wants to take an - // address - bool address_taken = false; compiled_variable = ctx->get_backend ()->local_variable (fndecl, "_", translated_type, - NULL /*decl_var*/, address_taken, - locus); + NULL /*decl_var*/, locus); } private: diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h index ca41575..f7a1ac6 100644 --- a/gcc/rust/rust-backend.h +++ b/gcc/rust/rust-backend.h @@ -458,15 +458,14 @@ public: // the frontend will call init_statement to set the initial value. virtual Bvariable *local_variable (tree function, const std::string &name, tree type, Bvariable *decl_var, - bool is_address_taken, Location location) + Location location) = 0; // Create a function parameter. This is an incoming parameter, not // a result parameter (result parameters are treated as local // variables). The arguments are as for local_variable. virtual Bvariable *parameter_variable (tree function, const std::string &name, - tree type, bool is_address_taken, - Location location) + tree type, Location location) = 0; // Create a static chain parameter. This is the closure parameter. diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index 22a1df6..86a4106 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -310,11 +310,10 @@ public: void global_variable_set_init (Bvariable *, tree); - Bvariable *local_variable (tree, const std::string &, tree, Bvariable *, bool, + Bvariable *local_variable (tree, const std::string &, tree, Bvariable *, Location); - Bvariable *parameter_variable (tree, const std::string &, tree, bool, - Location); + Bvariable *parameter_variable (tree, const std::string &, tree, Location); Bvariable *static_chain_variable (tree, const std::string &, tree, Location); @@ -2464,7 +2463,7 @@ Gcc_backend::global_variable_set_init (Bvariable *var, tree expr_tree) Bvariable * Gcc_backend::local_variable (tree function, const std::string &name, tree type_tree, Bvariable *decl_var, - bool is_address_taken, Location location) + Location location) { if (type_tree == error_mark_node) return this->error_variable (); @@ -2472,8 +2471,7 @@ Gcc_backend::local_variable (tree function, const std::string &name, get_identifier_from_string (name), type_tree); DECL_CONTEXT (decl) = function; TREE_USED (decl) = 1; - if (is_address_taken) - TREE_ADDRESSABLE (decl) = 1; + if (decl_var != NULL) { DECL_HAS_VALUE_EXPR_P (decl) = 1; @@ -2487,8 +2485,7 @@ Gcc_backend::local_variable (tree function, const std::string &name, Bvariable * Gcc_backend::parameter_variable (tree function, const std::string &name, - tree type_tree, bool is_address_taken, - Location location) + tree type_tree, Location location) { if (type_tree == error_mark_node) return this->error_variable (); @@ -2497,8 +2494,6 @@ Gcc_backend::parameter_variable (tree function, const std::string &name, DECL_CONTEXT (decl) = function; DECL_ARG_TYPE (decl) = type_tree; TREE_USED (decl) = 1; - if (is_address_taken) - TREE_ADDRESSABLE (decl) = 1; rust_preserve_from_gc (decl); return new Bvariable (decl); } |