public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] intrinsics: Add `sorry_handler` intrinsic handler Date: Tue, 25 Oct 2022 19:14:06 +0000 (GMT) [thread overview] Message-ID: <20221025191406.820A63857803@sourceware.org> (raw) https://gcc.gnu.org/g:83e5265d6af48e1572cbe019b4b7f7a5603086a9 commit 83e5265d6af48e1572cbe019b4b7f7a5603086a9 Author: Arthur Cohen <arthur.cohen@embecosm.com> Date: Tue Oct 25 10:48:43 2022 +0200 intrinsics: Add `sorry_handler` intrinsic handler This allows us to define intrinsics without implementing their body. This will be useful for atomic intrinsics for example, as there are a lot of them and we should work on implementing them one by one properly and slowly Diff: --- gcc/rust/backend/rust-compile-intrinsic.cc | 10 ++++++++++ gcc/testsuite/rust/compile/torture/intrinsics-3.rs | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/gcc/rust/backend/rust-compile-intrinsic.cc b/gcc/rust/backend/rust-compile-intrinsic.cc index a418b863210..2a2091ccc25 100644 --- a/gcc/rust/backend/rust-compile-intrinsic.cc +++ b/gcc/rust/backend/rust-compile-intrinsic.cc @@ -93,6 +93,15 @@ prefetch_write_data (Context *ctx, TyTy::FnType *fntype) return prefetch_data_handler (ctx, fntype, Prefetch::Write); } +static inline tree +sorry_handler (Context *ctx, TyTy::FnType *fntype) +{ + rust_sorry_at (fntype->get_locus (), "intrinsic %qs is not yet implemented", + fntype->get_identifier ().c_str ()); + + return error_mark_node; +} + static const std::map<std::string, std::function<tree (Context *, TyTy::FnType *)>> generic_intrinsics = { @@ -107,6 +116,7 @@ static const std::map<std::string, {"copy_nonoverlapping", ©_nonoverlapping_handler}, {"prefetch_read_data", &prefetch_read_data}, {"prefetch_write_data", &prefetch_write_data}, + {"atomic_load", &sorry_handler}, }; Intrinsics::Intrinsics (Context *ctx) : ctx (ctx) {} diff --git a/gcc/testsuite/rust/compile/torture/intrinsics-3.rs b/gcc/testsuite/rust/compile/torture/intrinsics-3.rs new file mode 100644 index 00000000000..1acb3533c08 --- /dev/null +++ b/gcc/testsuite/rust/compile/torture/intrinsics-3.rs @@ -0,0 +1,9 @@ +extern "rust-intrinsic" { + fn not_an_intrinsic(); + fn atomic_load(); // { dg-message "sorry, unimplemented: intrinsic .atomic_load. is not yet implemented" } +} + +fn main() { + unsafe { not_an_intrinsic() }; // { dg-error "unknown builtin intrinsic: not_an_intrinsic" } + unsafe { atomic_load() }; +}
reply other threads:[~2022-10-25 19:14 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=20221025191406.820A63857803@sourceware.org \ --to=tschwinge@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).