Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
|
|
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>
|
|
|
|
|
|
This adds in missed ported code for handling VAR_DECLS and jump's within
statement lists.
|
|
NOP_EXPR should fall through into convert and view_convert_exprs.
|
|
- 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>
|
|
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.
|
|
|
|
It still needs potential_constant_expression_1() which will be continued
to be ported over.
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>
|
|
Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
build_ctor_subob_ref
inside init_subob_ctx.
|
|
Its possible many of them are not useful for Rust so we can remove them
in the clean up expected later.
|
|
|
|
eval_constant_expression().
|
|
eval_constant_expression(). Throws away code under UNARY_PLUS_EXPR
and PTRMEM_CST as those tree codes come from cp-tree.def.
|
|
|
|
|
|
|
|
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
|
|
Signed-off-by: Faisal Abbas <90.abbasfaisal@gmail.com>
|
|
- 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>
|
|
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.
|
|
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.
|
|
- 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.
|
|
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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:
- 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>
|
|
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>
|
|
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>
|
|
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
|
|
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>
|
|
|