public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Arthur Cohen <cohenarthur@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-7969] gccrs: Move function-related methods into base class Backend Date: Tue, 16 Jan 2024 18:09:43 +0000 (GMT) [thread overview] Message-ID: <20240116180943.19CDB385802E@sourceware.org> (raw) https://gcc.gnu.org/g:5728f2bf0a583309178a9fbdcc7187d274326c34 commit r14-7969-g5728f2bf0a583309178a9fbdcc7187d274326c34 Author: Owen Avery <powerboat9.gamer@gmail.com> Date: Thu Aug 31 14:39:27 2023 -0400 gccrs: Move function-related methods into base class Backend gcc/rust/ChangeLog: * rust-backend.h (Backend::function): Make non-virtual. (Backend::function_defer_statement): Likewise. (Backend::function_set_parameters): Likewise. (Backend::write_global_definitions): Likewise. (Backend::write_export_data): Likewise. (Gcc_backend::function): Remove. (Gcc_backend::function_defer_statement): Remove. (Gcc_backend::function_set_parameters): Remove. (Gcc_backend::write_global_definitions): Remove. (Gcc_backend::write_export_data): Remove. * rust-gcc.cc (Gcc_backend::function): Rename to ... (Backend::function): ... here. (Gcc_backend::function_defer_statement): Fix a qualified lookup of Backend::label and rename to ... (Backend::function_defer_statement): ... here. (Gcc_backend::function_set_parameters) Rename to ... (Backend::function_set_parameters): ... here. (Gcc_backend::write_global_definitions): Rename to ... (Backend::write_global_definitions): ... here. (Gcc_backend::write_export_data): Rename to ... (Backend::write_export_data): ... here. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com> Diff: --- gcc/rust/rust-backend.h | 42 +++++++++--------------------------------- gcc/rust/rust-gcc.cc | 20 ++++++++++---------- 2 files changed, 19 insertions(+), 43 deletions(-) diff --git a/gcc/rust/rust-backend.h b/gcc/rust/rust-backend.h index 0633d005d87..81fd1304dba 100644 --- a/gcc/rust/rust-backend.h +++ b/gcc/rust/rust-backend.h @@ -449,41 +449,35 @@ public: // string, is the name that should be used in the symbol table; this // will be non-empty if a magic extern comment is used. FLAGS is // bit flags described above. - virtual tree function (tree fntype, const std::string &name, - const std::string &asm_name, unsigned int flags, - location_t) - = 0; + tree function (tree fntype, const std::string &name, + const std::string &asm_name, unsigned int flags, location_t); // Create a statement that runs all deferred calls for FUNCTION. This should // be a statement that looks like this in C++: // finish: // try { DEFER_RETURN; } catch { CHECK_DEFER; goto finish; } - virtual tree function_defer_statement (tree function, tree undefer, - tree check_defer, location_t) - = 0; + tree function_defer_statement (tree function, tree undefer, tree check_defer, + location_t); // Record PARAM_VARS as the variables to use for the parameters of FUNCTION. // This will only be called for a function definition. Returns true on // success, false on failure. - virtual bool - function_set_parameters (tree function, - const std::vector<Bvariable *> ¶m_vars) - = 0; + bool function_set_parameters (tree function, + const std::vector<Bvariable *> ¶m_vars); // Utility. // Write the definitions for all TYPE_DECLS, CONSTANT_DECLS, // FUNCTION_DECLS, and VARIABLE_DECLS declared globally. - virtual void + void write_global_definitions (const std::vector<tree> &type_decls, const std::vector<tree> &constant_decls, const std::vector<tree> &function_decls, - const std::vector<Bvariable *> &variable_decls) - = 0; + const std::vector<Bvariable *> &variable_decls); // Write SIZE bytes of export data from BYTES to the proper // section in the output object file. - virtual void write_export_data (const char *bytes, unsigned int size) = 0; + void write_export_data (const char *bytes, unsigned int size); protected: tree fill_in_fields (tree, const std::vector<typed_identifier> &); @@ -573,24 +567,6 @@ public: location_t); void block_add_statements (tree, const std::vector<tree> &); - - // Functions. - - tree function (tree fntype, const std::string &name, - const std::string &asm_name, unsigned int flags, location_t); - - tree function_defer_statement (tree function, tree undefer, tree defer, - location_t); - - bool function_set_parameters (tree function, - const std::vector<Bvariable *> &); - - void write_global_definitions (const std::vector<tree> &, - const std::vector<tree> &, - const std::vector<tree> &, - const std::vector<Bvariable *> &); - - void write_export_data (const char *bytes, unsigned int size); }; #endif // RUST_BACKEND_H diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc index 2e3612f45c5..23c2f215771 100644 --- a/gcc/rust/rust-gcc.cc +++ b/gcc/rust/rust-gcc.cc @@ -2297,9 +2297,9 @@ Backend::label_address (tree label, location_t location) // Declare or define a new function. tree -Gcc_backend::function (tree functype, const std::string &name, - const std::string &asm_name, unsigned int flags, - location_t location) +Backend::function (tree functype, const std::string &name, + const std::string &asm_name, unsigned int flags, + location_t location) { if (functype != error_mark_node) { @@ -2342,8 +2342,8 @@ Gcc_backend::function (tree functype, const std::string &name, // try { UNDEFER; } catch { CHECK_DEFER; goto finish; } tree -Gcc_backend::function_defer_statement (tree function, tree undefer_tree, - tree defer_tree, location_t location) +Backend::function_defer_statement (tree function, tree undefer_tree, + tree defer_tree, location_t location) { if (undefer_tree == error_mark_node || defer_tree == error_mark_node || function == error_mark_node) @@ -2355,7 +2355,7 @@ Gcc_backend::function_defer_statement (tree function, tree undefer_tree, push_cfun (DECL_STRUCT_FUNCTION (function)); tree stmt_list = NULL; - tree label = Gcc_backend::label (function, "", location); + tree label = Backend::label (function, "", location); tree label_def = label_definition_statement (label); append_to_statement_list (label_def, &stmt_list); @@ -2375,8 +2375,8 @@ Gcc_backend::function_defer_statement (tree function, tree undefer_tree, // This will only be called for a function definition. bool -Gcc_backend::function_set_parameters ( - tree function, const std::vector<Bvariable *> ¶m_vars) +Backend::function_set_parameters (tree function, + const std::vector<Bvariable *> ¶m_vars) { if (function == error_mark_node) return false; @@ -2400,7 +2400,7 @@ Gcc_backend::function_set_parameters ( // emit early debugging information. void -Gcc_backend::write_global_definitions ( +Backend::write_global_definitions ( const std::vector<tree> &type_decls, const std::vector<tree> &constant_decls, const std::vector<tree> &function_decls, const std::vector<Bvariable *> &variable_decls) @@ -2471,7 +2471,7 @@ Gcc_backend::write_global_definitions ( } void -Gcc_backend::write_export_data (const char *bytes, unsigned int size) +Backend::write_export_data (const char *bytes, unsigned int size) { rust_write_export_data (bytes, size); }
reply other threads:[~2024-01-16 18:09 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240116180943.19CDB385802E@sourceware.org \ --to=cohenarthur@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).