-
Notifications
You must be signed in to change notification settings - Fork 152
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
Constant folding in gccrs: port over rest of the code from CP frontend #1499
Conversation
c0e0d3e
to
817b12e
Compare
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.
Thank you for all this work. I think overall if this doesn't cause any regression, we should merge it and then start adding test cases and fixing stuff. This is a really good start in my opinion
Looks like we have 1 failure for -m32 tests let me know how you get on with that assertion. |
I found the solution to the regression test case:
This was a small mistake in the porting. The reason this only happens on 32bit mode is because of: ba75fe3 On 32bit mode floats have to be handled slightly differently, resulting in this NOP conversion going on. |
I will leave it up to @abbasfaisal to apply that diff and @CohenArthur to fix up the bors warnings list. I will get back to you with an example test case tomorrow. |
250953f
to
7f5ee85
Compare
…ion_1() This changeset ports cp_global_trees structure which is used throughout the cp constexpr.cc code. I am not sure what it's purpose is but it seems it is used to add and manipulate tree information during the c++ compilation process. It is possible this is not needed in the Rust code and may be taken out later. Also, the initialization function isn't being called from anywhere yet, so we will need to find a suitable point for it. Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
…ion_1() Following functions are ported in this changeset: - var_in_constexpr_fn - member_vec_linear_search - member_vec_binary_search - is_overloaded_fn - ovl_make - lookup_add - ovl_first - type_unknown_p Following structs, classes and enums are ported in this changeset: - tree_overload - ovl_iterator - tsubst_flags - cp_identifier_kind - tag_types
…ion_1() Following functions are ported in this changeset: - type_memfn_quals - find_parameter_pack_data - conv_type_hasher - make_conv_op_name - builtin_pack_fn_p - builtin_pack_call_p - has_extra_args_mechanism_p - find_parameter_packs_r - type_memfn_rqual - maybe_add_lang_type_raw - type_of_this_parm - class_of_this_parm Following structs, classes and enums are ported in this changeset: - cxx_binding - c_common_identifier - lang_identifier - cp_ref_qualifier - find_parameter_pack_data - conv_type_hasher Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
…ion_1() Following functions are ported in this changeset: - get_fileinfo - cxx_make_type - build_min_array_type - identifier_p Following structs are ported in this changeset: - c_fileinfo Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
…ion_1() Following functions are ported in this changeset: - fields_linear_search - nothrow_spec_p - maybe_get_fns - get_fns - get_first_fn - dependent_name - called_fns_equal - canonical_eh_spec - rs_tree_code_length - rs_tree_operand_length - rs_tree_equal - publicly_uniquely_derived_p - comp_except_types - comp_except_specs - compparms - rs_build_qualified_type_real - vector_targets_convertible_p - comp_array_types - same_type_ignoring_top_level_qualifiers_p - comp_ptr_ttypes_const - similar_type_p - structural_comptypes - comptypes - gnu_vector_type_p - set_array_type_canon - is_byte_access_type - build_cplus_array_type Following structs, classes and enums are ported in this changeset: - named_decl_hash - lang_decl_selector - lang_decl_base - lang_decl_min - lang_decl_fn - lang_decl_ns - lang_decl_parm - lang_decl_decomp - lang_decl - lkp_iterator - compare_bounds_t - cplus_array_info - cplus_array_hasher Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
…ion_1() Following functions are ported in this changeset: - next_initializable_field - sufficient_parms_p - default_ctor_p - user_provided_p - type_has_non_user_provided_default_constructor - default_init_uninitialized_part - extract_conversion_operator - get_class_binding_direct - lang_check_failed - skip_artificial_parms_for - in_class_defaulted_default_constructor - is_instantiation_of_constexpr - check_for_uninitialized_const_var Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
Following functions are ported in this changeset: - array_index_cmp - unshare_constructor - find_array_ctor_elt - reduced_constant_expression_p - verify_constant - diag_array_subscript - get_array_or_vector_nelts - eval_and_check_array_index - extract_string_elt - free_constructor - cv_unqualified - make_tree_vector - release_tree_vector - vec_safe_push Following structs, classes and enums are ported in this changeset: - releasing_vec Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
…ion_1() Following functions are ported in this changeset: - find_heap_var_refs - find_immediate_fndecl - instantiation_dependent_expression_p - cp_get_callee - build_nop - scalarish_type_p - type_has_nontrivial_copy_init - build_local_temp - is_normal_capture_proxy - reject_gcc_builtin - is_bitfield_expr_with_lowered_type - maybe_undo_parenthesized_ref - fold_offsetof - char_type_p - resolve_nondeduced_context - null_node_p Following structs, classes and enums are ported in this changeset: - c_tree_index - warning_sentinel - uid_sensitive_constexpr_evaluation_checker - iloc_sentinel - ptrmem_cst This changeset puts c_global_trees and cp_global_trees outside Rust and Compile namespaces because keeping them inside is causing build issues. This is possibly because rust-tree.cc contains only Rust namespace while rust-constexpr.cc is Rust+Compile namespace. This causes issues when trying to use them inside both files. Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
…ion_1() Following functions are ported in this changeset: - resolve_nondeduced_context - instantiate_non_dependent_or_null - resolve_nondeduced_context_or_error - really_overloaded_fn - invalid_nonstatic_memfn_p - strip_top_quals - cxx_incomplete_type_inform - cxx_incomplete_type_diagnostic - cxx_incomplete_type_error Following structs, classes and enums are ported in this changeset: - stmt_tree_s - c_language_function - omp_declare_target_attr - cxx_binding - cxx_saved_binding - saved_scope - named_label_hash - language_function - ref_operator Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
…ion_1() Following functions are ported in this changeset: - decl_constant_var_p - undeduced_auto_decl - require_deduced_type Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
- cxx_bind_parameters_in_call - addr_of_non_const_var - adjust_temp_type There is alot of cleanup we can do when we get more of this working but for now its best to keep porting like this.
Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
It still needs potential_constant_expression_1() which will be continued to be ported over. Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
cxx_eval_component_reference. Some important parts are commented out and marked such. These will need revisiting.
…bits Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
- error in handling of NOP_EXPR which results in failure in make check-rust - DECL not being marked constant inside finalize_intrinsic_block Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
NOP_EXPR should fall through into convert and view_convert_exprs.
7a4f608
to
7a444e3
Compare
Lets see if this builds now :D |
This adds in missed ported code for handling VAR_DECLS and jump's within statement lists.
I think i have a new fix for the warnings incoming :D |
c537901
to
1056521
Compare
const A: usize = 123; | ||
const B: [i32; 5] = [1, 2, 3, 4, 5]; | ||
const C: i32 = B[A]; | ||
// { dg-error "array subscript value .123. is outside the bounds of array" "" { target *-*-* } .-1 } |
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.
here is another cool feature :D @abbasfaisal
1056521
to
43b7dd9
Compare
woohoo looks like its worked! |
bors r+ |
Build succeeded: |
No description provided.