-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respin the builtin PR #2693
Respin the builtin PR #2693
Conversation
9d0ec98
to
a7eaf19
Compare
ah, while doing a quick review I noticed that this commit also includes some of the new intrinsics I was adding at the time @dkm. I have no idea if these are correct or not, and you can probably drop them if you'd like to avoid some headache |
I'll try to add some test for said intrinsics (I didn't notice them while adjusting the patch, but I guess I'll find them easily?). Would be better to have them in now, while I'm at it :) |
3166894
to
712d6df
Compare
@CohenArthur can you elaborate a bit on which intrinsics you were trying to add? |
e7d2cd2
to
e487afd
Compare
ce3a3cb
to
336ca8f
Compare
336ca8f
to
4907f4d
Compare
@CohenArthur should be in a good enough state. Haven't touched too much at your code, but fixed some shortcoming (mainly the attributes that were dropped when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @dkm! Thank you for taking the time :) I'll run a bootstrap build on it if you want before we merge it
I've already tested the bootstrap build on x86_64-linux, but feel free to test again, we don't want to introduce any bootstrap issues :) |
Let me first squash everything! |
eec212d
to
f05b149
Compare
Hmmm, there are issues on gcc 4.8 and MacOS. |
Strangely, the compiler doesn't ICE locally, will try with a gcc 4.8.
|
That's fun, valgrind output loads of error with a gccrs built using gcc-4.8 as the base compiler, but it's clean with a gccrs built using a more recent base compiler. |
yuuuuuuumm :) C++almost11 strikes again!! |
But it seems it's not related to C++11.
with But the "real" argument being passed is an
See SO post about that: https://stackoverflow.com/questions/24580503/error-when-pass-enum-in-a-function-with-variable-arguments |
f05b149
to
3369b90
Compare
MacOS 😭 |
ok, easy fix... |
This commit performs builtin initialization in a more "GCC-y" way, similarly to what the D frontend is doing. This way, we no longer have to worry about invalid attributes or types when initializing them by hand. Also add attributes support through LANG_HOOKS_COMMON_ATTRIBUTE_TABLE lang hook. Most of these changes are based on D frontend. gcc/rust/ChangeLog: * Make-lang.in (GRS_OBJS): Add rust-attribs.o. * backend/rust-builtins.cc (builtin_const, builtin_noreturn) (builtin_novops): Remove. (BuiltinsContext::lookup_simple_builtin): Adjust. (BuiltinsContext::setup_overflow_fns): Remove. (BuiltinsContext::define_function_type): Set builtin type to errormark so the builtin is considered unavailable. (BuiltinsContext::setup_math_fns): Remove. (BuiltinsContext::setup_atomic_fns): Remove. (build_c_type_nodes): Refactor based on D frontend. (BuiltinsContext::define_builtin_types): Likewise. (DEF_PRIMITIVE_TYPE): New. (DEF_FUNCTION_TYPE_0): New. (DEF_FUNCTION_TYPE_1): New. (DEF_FUNCTION_TYPE_2): New. (DEF_FUNCTION_TYPE_3): New. (DEF_FUNCTION_TYPE_4): New. (DEF_FUNCTION_TYPE_5): New. (DEF_FUNCTION_TYPE_6): New. (DEF_FUNCTION_TYPE_7): New. (DEF_FUNCTION_TYPE_8): New. (DEF_FUNCTION_TYPE_9): New. (DEF_FUNCTION_TYPE_10): New. (DEF_FUNCTION_TYPE_11): New. (DEF_FUNCTION_TYPE_VAR_0): New. (DEF_FUNCTION_TYPE_VAR_1): New. (DEF_FUNCTION_TYPE_VAR_2): New. (DEF_FUNCTION_TYPE_VAR_3): New. (DEF_FUNCTION_TYPE_VAR_4): New. (DEF_FUNCTION_TYPE_VAR_5): New. (DEF_FUNCTION_TYPE_VAR_6): New. (DEF_FUNCTION_TYPE_VAR_7): New. (DEF_FUNCTION_TYPE_VAR_11): New. (DEF_POINTER_TYPE): New. (BuiltinsContext::setup): Adjust. (BuiltinsContext::define_builtin_attributes): New. (DEF_ATTR_NULL_TREE): New. (DEF_ATTR_INT): New. (DEF_ATTR_STRING): New. (DEF_ATTR_IDENT): New. (DEF_ATTR_TREE_LIST): New. (handle_flags): Remove. (BuiltinsContext::define_builtins): New. (DEF_BUILTIN): New. (BuiltinsContext::define_builtin): Remove. (BuiltinsContext::register_rust_mappings): New. Add all missing builtins. (BuiltinsContext::lookup_gcc_builtin): Adjust. * backend/rust-builtins.h (DEF_PRIMITIVE_TYPE): New. (DEF_FUNCTION_TYPE_0): New. (DEF_FUNCTION_TYPE_1): New. (DEF_FUNCTION_TYPE_2): New. (DEF_FUNCTION_TYPE_3): New. (DEF_FUNCTION_TYPE_4): New. (DEF_FUNCTION_TYPE_5): New. (DEF_FUNCTION_TYPE_6): New. (DEF_FUNCTION_TYPE_7): New. (DEF_FUNCTION_TYPE_8): New. (DEF_FUNCTION_TYPE_9): New. (DEF_FUNCTION_TYPE_10): New. (DEF_FUNCTION_TYPE_11): New. (DEF_FUNCTION_TYPE_VAR_0): New. (DEF_FUNCTION_TYPE_VAR_1): New. (DEF_FUNCTION_TYPE_VAR_2): New. (DEF_FUNCTION_TYPE_VAR_3): New. (DEF_FUNCTION_TYPE_VAR_4): New. (DEF_FUNCTION_TYPE_VAR_5): New. (DEF_FUNCTION_TYPE_VAR_6): New. (DEF_FUNCTION_TYPE_VAR_7): New. (DEF_FUNCTION_TYPE_VAR_11): New. (DEF_POINTER_TYPE): New. (DEF_ATTR_NULL_TREE): New. (DEF_ATTR_INT): New. (DEF_ATTR_STRING): New. (DEF_ATTR_IDENT): New. (DEF_ATTR_TREE_LIST): New. * backend/rust-compile-intrinsic.cc (Intrinsics::compile): Add comment. (op_with_overflow_inner): Adjust. (copy_handler_inner): Adjust. (prefetch_data_handler): Adjust. (build_atomic_builtin_name): Adjust. (atomic_load_handler_inner): Adjust. (uninit_handler): Adjust. (move_val_init_handler): Adjust. (expect_handler_inner): Adjust. * rust-gcc.cc (fetch_overflow_builtins): Adjust. * rust-lang.cc (rust_localize_identifier): Adjust. (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): New. * rust-attribs.cc: New file. gcc/testsuite/ChangeLog: * rust/compile/torture/intrinsics-4.rs: Adjust. * rust/compile/torture/intrinsics-math.rs: Adjust. * rust/execute/torture/atomic_load.rs: Adjust. * rust/execute/torture/atomic_store.rs: Adjust. * rust/compile/torture/intrinsics-1.rs: Removed. * rust/compile/torture/builtin_abort.rs: New test. * rust/execute/torture/builtin_abort.rs: New test. Signed-off-by: Marc Poulhiès <[email protected]> Co-authored-by: Arthur Cohen <[email protected]>
ac2557f
to
4554090
Compare
Add 1 extra on top of previous PR from Arthur that
adds attribute support.
Must be squashed with the original to get a working change.