aboutsummaryrefslogtreecommitdiff
path: root/gcc
AgeCommit message (Collapse)AuthorFilesLines
2022-08-26backend: Add overflow checks to every arithmetic operationArthur Cohen8-38/+223
2022-08-25builtins: Add add_overflow builtin and refactor classArthur Cohen1-15/+36
2022-08-25backend: Expose Bvariable class through rust-gcc headerArthur Cohen2-29/+59
2022-08-25Merge #1499bors[bot]8-41/+14261
1499: Constant folding in gccrs: port over rest of the code from CP frontend r=philberty a=abbasfaisal Co-authored-by: Faisal Abbas <90.abbasfaisal@gmail.com> Co-authored-by: Philip Herron <philip.herron@embecosm.com>
2022-08-25Fix warnings on diagnosticsPhilip Herron2-49/+54
2022-08-25Add testcase for const array index expressionsPhilip Herron1-0/+5
2022-08-25Fix up missing jump_target handlingPhilip Herron2-37/+157
This adds in missed ported code for handling VAR_DECLS and jump's within statement lists.
2022-08-25Fix port of NOP_EXPRPhilip Herron1-9/+1
NOP_EXPR should fall through into convert and view_convert_exprs.
2022-08-25rust-constexpr.cc: fixesFaisal Abbas3-9/+3
- 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>
2022-08-25rust-constexpr.cc: fix warnings for unused variables for unsupported bitsFaisal Abbas3-156/+143
Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
2022-08-25rust-constexpr.cc: fix build errorFaisal Abbas1-3/+2
2022-08-25rust-tree.cc: comment some important code instead of removing it.Faisal Abbas1-0/+7
2022-08-25rust-constexpr.cc: port over cxx_eval_array_reference andFaisal Abbas3-26/+388
cxx_eval_component_reference. Some important parts are commented out and marked such. These will need revisiting.
2022-08-25rust-constexpr.cc: port over potential_constant_expression_1()Faisal Abbas3-16/+1646
2022-08-25rust constexpr: port over cxx_eval_builtin_function_call().Faisal Abbas3-0/+519
It still needs potential_constant_expression_1() which will be continued to be ported over. Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
2022-08-25rust constexpr: porting cxx_eval_builtin_function_callFaisal Abbas2-0/+735
Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
2022-08-25rust constexpr: conttinue porting cxx_eval_builtin_function_callFaisal Abbas3-3/+232
Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
2022-08-25rust constexpr: conttinue porting cxx_eval_builtin_function_callFaisal Abbas2-0/+170
Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
2022-08-25rust constexprC: start porting cxx_eval_builtin_function_callFaisal Abbas2-0/+818
Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
2022-08-25rust-constexpr.cc: port over more cases to eval_constant_expressionFaisal Abbas2-15/+122
2022-08-25rust-constexpr.cc: port over more cases to eval_constant_expressionFaisal Abbas1-0/+46
2022-08-25rust-constexpr.cc: port over cxx_eval_outermost_constant_exprFaisal Abbas3-4/+429
2022-08-25rust-constexpr.cc: add few more cases to eval_constant_expression()Faisal Abbas1-0/+60
2022-08-25rust-constexpr.cc: port over cxx_eval_vector_conditional_expressionFaisal Abbas1-0/+45
2022-08-25rust-constexpr.cc: port over cxx_eval_bare_aggregate. Comments out ↵Faisal Abbas3-224/+503
build_ctor_subob_ref inside init_subob_ctx.
2022-08-25rust-constexpr.cc: port over more cases to eval_constant_expression().Faisal Abbas2-0/+116
Its possible many of them are not useful for Rust so we can remove them in the clean up expected later.
2022-08-25rust-constexpr.cc: port over cxx_eval_logical_expressionFaisal Abbas1-0/+42
2022-08-25rust-constexpr.cc: port MEF_REF and INDIRECT_REF cases to ↵Faisal Abbas1-126/+331
eval_constant_expression().
2022-08-25rust-constexpr.cc: port VIEW_CONVERT_EXPR and CONVERT_EXPR cases toFaisal Abbas3-0/+204
eval_constant_expression(). Throws away code under UNARY_PLUS_EXPR and PTRMEM_CST as those tree codes come from cp-tree.def.
2022-08-25rust-constexpr.cc: port over NOP_EXPR case and fold_indrect_ref_1()Faisal Abbas2-0/+153
2022-08-25rust-constexpr.cc: port over cxx_eval_unary_expressionFaisal Abbas1-0/+62
2022-08-25rust-constexpr.cc: port over cxx_eval_switch_exprFaisal Abbas2-0/+61
2022-08-25rust-constexpr.cc: add more cases to eval_constant_expression()Faisal Abbas2-0/+178
Following cases have been added in this changeset: - LOOP_EXPR - WHILE_STMT - FOR_STMT These need following supporting functions which are also ported: - eval_loop_expr - returns - breaks - continues - switches
2022-08-25rust-constexpr.cc: port over cxx_eval_bit_field_refFaisal Abbas1-1/+92
Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
2022-08-25gccrs constant folding port: ports overFaisal Abbas1-36/+125
- more cases into constexpr_expression. - cxx_eval_condtional_expression. Note that COND_EXPR and IF_STMT are defined in cp-tree.def Also renames constexpr_expression to eval_constant_expression. Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
2022-08-25Each intrinsic needs marked as constPhilip Herron2-2/+8
These intrinsics and builtin's need to be marked as const in order for the const eval code to generate copy's to cache their results and folded function bodies.
2022-08-25Const functions need to be marked as DECL_DECLARED_CONSTEXPR_PPhilip Herron5-32/+1392
This signifys in the GCC generic that this is a constant function and should be foldable in the constexpr evaluation. This also ports over the correct eval_store_expression which updates the context tables. CPP consteval seems pretty powerful but overall the algorithm is fairly simple at least for simple types. When we encounter a CALL_EXPR we must "bind" the arguments. So when we encourter a PARAM_DECL the associated argument for this parameter is bound to this parameter in a map of map<tree, tree> using their pointer as the key to value. So when folding a function body every usage of the parameter decl is then updated in the context with the apropriate value fomr the context. When we hit assignment operations a similar context store occurs for VAR_DECLS. While walking the tree We finally hit the RESULT_DECL with the folded result. The complex pieces remaining are aggregate, record and union types so that we have zero allocation required to find the result. We also need to support walking conditionals and loop expressions which require porting a few more functions and using the jump_target tree.
2022-08-25Port over:Philip Herron1-0/+134
- 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.
2022-08-25Port over context structuresPhilip Herron1-13/+107
2022-08-25gccrs const folding port: continue porting potential_constant_expression_1()Faisal Abbas2-0/+52
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>
2022-08-25gccrs const folding port: continue porting potential_constant_expression_1()Faisal Abbas2-18/+628
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>
2022-08-25gccrs const folding port: continue porting potential_constant_expression_1()Faisal Abbas3-11/+899
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>
2022-08-25gccrs const folding port: start porting cxx_eval_array_reference()Faisal Abbas3-17/+653
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>
2022-08-25gccrs const folding port: continue porting potential_constant_expression_1()Faisal Abbas2-17/+506
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>
2022-08-25gccrs const folding port: continue porting potential_constant_expression_1()Faisal Abbas2-0/+1708
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>
2022-08-25gccrs const folding port: continue porting potential_constant_expression_1()Faisal Abbas2-1/+150
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>
2022-08-25gccrs const folding port: continue porting potential_constant_expression_1()Faisal Abbas2-14/+439
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>
2022-08-25gccrs const folding port: continue porting potential_constant_expression_1()Faisal Abbas2-0/+561
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
2022-08-25gccrs const folding port: continue porting potential_constant_expression_1()Faisal Abbas2-0/+373
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>
2022-08-25session-manager: Add ast-pretty-expanded dumpArthur Cohen2-3/+9