diff options
author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-06-16 05:42:36 +0000 |
---|---|---|
committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-06-16 05:42:36 +0000 |
commit | 0de36bdb2d7fa28a41b67b7ab3f8ccb92e1d2e03 (patch) | |
tree | a412e70be6f1d8732a8f791392c918ebc475f3e0 /gcc/cp | |
parent | 2e76978a5a65d6b6643a5f7045585379ecf92fdb (diff) | |
download | gcc-0de36bdb2d7fa28a41b67b7ab3f8ccb92e1d2e03.tar.gz |
2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
Zdenek Dvorak <dvorakz@suse.cz>
Richard Guenther <rguenther@suse.de>
Kaz Kojima <kkojima@gcc.gnu.org>
* tree-vrp.c (compare_values_warnv): Convert val2 to
the type of val1.
(extract_range_from_assert): Create
POINTER_PLUS_EXPR for pointer types.
(extract_range_from_binary_expr): Handle
only POINTER_PLUS_EXPR, MIN_EXPR, and MAX_EXPR
for pointer types.
* doc/c-tree.texi (POINTER_PLUS_EXPR): Document.
* tree-ssa-loop-niter.c (split_to_var_and_offset): Handle
POINTER_PLUS_EXPR as PLUS_EXPR.
(number_of_iterations_lt_to_ne):
For pointer types, use sizetype when
creating MINUS_EXPR/PLUS_EXPRs.
(assert_loop_rolls_lt): For pointer types, use sizetype when
creating MINUS_EXPR/PLUS_EXPRs.
(number_of_iterations_le): Likewise.
(expand_simple_operations): POINTER_PLUS_EXPR are simple also.
(derive_constant_upper_bound): Handle POINTER_PLUS_EXPR just
like PLUS_EXPR and MINUS_EXPR.
* tree-pretty-print.c (dump_generic_node): Handle
POINTER_PLUS_EXPR.
(op_prio): Likewise.
(op_symbol_1): Likewise.
* optabs.c (optab_for_tree_code): Likewise.
* tree-ssa-loop-manip.c (create_iv): Handle pointer base
specially.
* tree-tailcall.c (process_assignment): Mention
POINTER_PLUS_EXPR in a TODO comment.
* tree.c (build2_stat): Assert when trying to use PLUS_EXPR or
MINUS_EXPR with a pointer. Also assert for POINTER_PLUS_EXPR
not used with a pointer and an integer type.
* tree-scalar-evolution.c (add_to_evolution_1): Convert the
increment using chrec_convert_rhs instead of chrec_convert.
(follow_ssa_edge_in_rhs): Handle POINTER_PLUS_EXPR like
PLUS_EXPR except for the right hand side's type will be
sizetype.
(interpret_rhs_modify_stmt): Handle POINTER_PLUS_EXPR.
(fold_used_pointer_cast): Kill.
(pointer_offset_p): Kill.
(fold_used_pointer): Kill.
(pointer_used_p): Kill.
(analyze_scalar_evolution_1 <case GIMPLE_MODIFY_STMT>): Don't
call fold_used_pointer.
(instantiate_parameters_1): Convert the increment
using chrec_convert_rhs instead of chrec_convert.
Handle POINTER_PLUS_EXPR as PLUS_EXPR.
* builtins.c (get_pointer_alignment): Handle POINTER_PLUS_EXPR
instead of PLUS_EXPR.
(expand_builtin_strcat): Create a POINTER_PLUS_EXPR instead of
PLUS_EXPR for pointers.
(std_gimplify_va_arg_expr): Likewise.
(fold_builtin_memory_op): Likewise.
(fold_builtin_strstr): Likewise.
(fold_builtin_strchr): Likewise.
(fold_builtin_strrchr): Likewise.
(fold_builtin_strpbrk): Likewise.
(expand_builtin_memory_chk): Likewise.
(fold_builtin_memory_chk): Likewise.
(std_expand_builtin_va_start): Use
sizetype for the call to make_tree and then convert
to the pointer type.
(fold_builtin_memchr): Use POINTER_PLUS_EXPR
instead of PLUS_EXPR for adding to a pointer.
(std_gimplify_va_arg_expr): Use fold_build2 for
the creating of POINTER_PLUS_EXPR. For the BIT_AND_EXPR, cast
the operands to sizetype first and then cast the BIT_AND_EXPR
back to the pointer type.
* fold-const.c (build_range_check): Handle pointer types
specially.
(extract_array_ref): Look for POINTER_PLUS_EXPR instead
of PLUS_EXPR's. Make sure the offset is converted to
sizetype.
(try_move_mult_to_index): Strip the NOPs from the offset.
Remove code argument and replace all uses with PLUS_EXPR.
(fold_to_nonsharp_ineq_using_bound): Handle pointer types
specially. Don't use a pointer type for MINUS_EXPR.
(fold_unary): Handle for (T1)(X op Y),
only p+ as that is the only as that can be handled for
binary operators now.
(fold_binary <case POINTER_PLUS_EXPR>): Add folding of
POINTER_PLUS_EXPR.
<case PLUS_EXPR>: Add folding of PTR+INT into
PTR p+ INT.
Don't call try_move_mult_to_index.
<case MINUS_EXPR>: Fold (PTR0 p+ A) - (PTR1 p+ B)
into (PTR0 - PTR1) + (A - B). Fold (PTR0 p+ A) - PTR1 into
(PTR0 - PTR1) + A iff (PTR0 - PTR1) simplifies.
Don't call try_move_mult_to_index.
(tree_expr_nonnegative_warnv_p): Handle POINTER_PLUS_EXPR.
(tree_expr_nonzero_p): Likewise.
(fold_indirect_ref_1): Look at POINTER_PLUS_EXPR instead
of PLUS_EXPR for the complex expression folding.
* tree-chrec.c (chrec_fold_plus_poly_poly): If the
first chrec is a pointer type, then the second should
be sizetype and not the first's type.
For POINTER_PLUS_EXPR, use a different right hand side type.
Handle POINTER_PLUS_EXPR like PLUS_EXPR.
(chrec_fold_plus_1): For POINTER_PLUS_EXPR, use a
different right hand side type.
Handle POINTER_PLUS_EXPR like PLUS_EXPR.
(chrec_fold_plus): For pointer types, use POINTER_PLUS_EXPR
instead of PLUS_EXPR.
When either operand is zero, convert the other operand.
(chrec_apply): Use chrec_convert_rhs
on the argument x instead of chrec_convert.
(reset_evolution_in_loop): For pointer types, the new_evol
should be sizetype.
(convert_affine_scev): For POINTER_PLUS_EXPR, use a
different right hand side type.
Handle POINTER_PLUS_EXPR like PLUS_EXPR.
(chrec_convert_rhs): New function.
(chrec_convert_aggressive): For POINTER_PLUS_EXPR, use a
different right hand side type.
Handle POINTER_PLUS_EXPR like PLUS_EXPR.
* tree-chrec.h (chrec_convert_rhs): New prototype.
(build_polynomial_chrec): For pointer types, the right hand
* tree-ssa-ccp.c (maybe_fold_stmt_indirect): Look for
POINTER_PLUS_EXPR instead of PLUS_EXPR's.
Remove subtraction case as it is always addition now.
Make sure the offset is converted to sizetype.
(fold_stmt_r): Don't handle PLUS_EXPR/MINUS_EXPR specially.
Handle POINTER_PLUS_EXPR like PLUS_EXPR was handled before.
* tree-ssa-loop-ivopts.c (determine_base_object): Abort for
PLUS_EXPR in pointer type.
Handle POINTER_PLUS_EXPR.
(tree_to_aff_combination): Likewise.
(force_expr_to_var_cost): Likewise.
(force_expr_to_var_cost): Likewise. Create a POINTER_PLUS_EXPR
instead of PLUS_EXPR for pointers.
* c-format.c (check_format_arg): Handle POINTER_PLUS_EXPR
instead of PLUS_EXPR of pointer types.
* tree-stdarg.c (va_list_counter_bump): Handle POINTER_PLUS_EXPR
as PLUS_EXPR.
(check_va_list_escapes): Likewise.
(check_all_va_list_escapes): Likewise.
* dwarf2out.c (loc_descriptor_from_tree_1):
Handle POINT_PLUS_EXPR as a PLUS_EXPR.
* expr.c (expand_expr_real_1): Handle POINTER_PLUS_EXPR.
(string_constant): Likewise.
* tree-ssa-address.c (tree_mem_ref_addr): When adding
the offset to the base, use POINTER_PLUS_EXPR.
(add_to_parts): Convert the index to sizetype.
(create_mem_ref): Create A POINTER_PLUS_EXPR for the one case.
* matrix-reorg.c (collect_data_for_malloc_call): Stmt
will now only be either INDIRECT_REF and POINTER_PLUS_EXPR.
Offset only holds something for PLUS_EXPR.
(ssa_accessed_in_tree): Handle POINTER_PLUS_EXPR just as
a PLUS_EXPR.
(analyze_transpose): POINTER_PLUS_EXPR will only show up now
and not PLUS_EXPR.
(analyze_accesses_for_modify_stmt): Likewise.
Remove comment about the type being integral type as it is
wrong now.
(can_calculate_expr_before_stmt): Handle POINTER_PLUS_EXPR as
PLUS_EXPR.
(transform_access_sites): POINTER_PLUS_EXPR will only show up now
and not PLUS_EXPR.
Correct the type which the artimentic is done in (is now
sizetype).
Reindent one loop.
* tree-data-ref.c (split_constant_offset): Handle
POINTER_PLUS_EXPR
* tree-affine.c (tree_to_aff_combination): Likewise.
* c-typeck.c (build_unary_op): For pointers create the increment
as a sizetype. Create a POINTER_PLUS_EXPR instead of PLUS_EXPR
for pointers.
* gimplify.c (gimplify_self_mod_expr): Create a
POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers.
(gimplify_omp_atomic_fetch_op): Handle POINTER_PLUS_EXPR.
* tree.def (POINTER_PLUS_EXPR): New tree code.
* tree-predcom.c (ref_at_iteration): If we have a pointer
type do the multiplication in sizetype.
* tree-mudflap.c (mf_xform_derefs_1): Create a
POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers.
* tree-ssa-forwprop.c
(forward_propagate_addr_into_variable_array_index):
Don't expect there to be a cast for the index as that
does not exist anymore.
(forward_propagate_addr_expr_1): Check for POINTER_PLUS_EXPR
instead of PLUS_EXPR.
Don't check for the first operand of the POINTER_PLUS_EXPR
was the index as it cannot be.
Call forward_propagate_addr_into_variable_array_index with
the SSA_NAME instead of the statement.
* varasm.c (const_hash_1): Handle POINTER_PLUS_EXPR.
(compare_constant): Likewise.
(copy_constant): Likewise.
(compute_reloc_for_constant): Likewise.
(output_addressed_constants): Likewise.
(initializer_constant_valid_p): Likewise.
* tree-ssa.c (tree_ssa_useless_type_conversion_1):
Convert the MIN/MAX of the inner type to the outer
type before comparing them.
* tree-ssa-loop-prefetch.c (idx_analyze_ref): Handle
POINTER_PLUS_EXPR instead of PLUS_EXPR.
(issue_prefetch_ref): Create a POINTER_PLUS_EXPR instead
of PLUS_EXPR for pointers.
* tree-inline.c (estimate_num_insns_1): Handle
POINTER_PLUS_EXPR.
* tree-vect-transform.c (vect_create_addr_base_for_vector_ref):
Create a POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers.
(bump_vector_ptr): Create a POINTER_PLUS_EXPR
instead of PLUS_EXPR for the pointer increment statement.
(vect_update_ivs_after_vectorizer): For pointer types, create
POINTER_PLUS_EXPR instead of PLUS_EXPR and also create
MULT_EXPR in sizetype.
(vect_gen_niters_for_prolog_loop): Add a cast when creating
byte_misalign.
* tree-object-size.c (plus_expr_object_size): Handle
POINTER_PLUS_EXPR instead of PLUS_EXPR. Removing all the extra
code which is trying to figure out which side is a pointer and
is the index.
(check_for_plus_in_loops_1): Likewise.
(check_for_plus_in_loops): Likewise.
* c-common.c (pointer_int_sum): Create a
POINTER_PLUS_EXPR instead of PLUS_EXPR for pointers.
* tree-ssa-structalias.c (handle_ptr_arith): Handle
only POINTER_PLUS_EXPR. Removing all the extra
code which is trying to figure out which side is a pointer and
is the index.
* tree-cfg.c (verify_expr): Add extra checking for pointers and
PLUS_EXPR and MINUS_EXPR.
Also add checking to make sure the operands of POINTER_PLUS_EXPR
are correct.
* config/frv/frv.c (frv_expand_builtin_va_start): Use sizetype
with make_tree, instead of a pointer type.
* config/s390/s390.c (s390_va_start): Use POINTER_PLUS_EXPR
for pointers instead of PLUS_EXPR.
(s390_gimplify_va_arg): Likewise.
* config/spu/spu.c (spu_va_start): Create POINTER_PLUS_EXPR
instead of PLUS_EXPR when doing addition on pointer
types. Use sizetype for the second operand.
(spu_gimplify_va_arg_expr): Likewise.
* config/sparc/sparc.c (sparc_gimplify_va_arg): Use
POINTER_PLUS_EXPR instead of PLUS_EXPR when the operand was
a pointer. Don't create a BIT_AND_EXPR for pointer types.
* config/i386/i386.c (ix86_va_start): Use POINTER_PLUS_EXPR
for the pointer addition and also use size_int/sizetype
for the offset.
(ix86_gimplify_va_arg): Likewise.
Perform BIT_AND_EXPR on sizetype arguments.
* config/sh/sh.c (sh_va_start): Call make_tree with sizetype
and convert its result to a pointer type. Use POINTER_PLUS_EXPR
for the pointer additions and also use size_int for the offsets.
(sh_gimplify_va_arg_expr): Use POINTER_PLUS_EXPR for the pointer
additions and also use size_int for the offsets. Perform
BIT_AND_EXPR on sizetype arguments.
* config/ia64/ia64.c (ia64_gimplify_va_arg): Use
POINTER_PLUS_EXPR for pointers and create the
BIT_AND_EXPR in sizetype.
* config/rs6000/rs6000.c (rs6000_va_start): Use POINTER_PLUS_EXPR
instead of PLUS_EXPR for pointer addition.
(rs6000_va_start): Likewise.
Also use sizetype for the offset.
* config/pa/pa.c (reloc_needed): Handle POINTER_PLUS_EXPR
as PLUS_EXPR/MINUS_EXPR.
(hppa_gimplify_va_arg_expr): Don't create MINUS_EXPR or
PLUS_EXPR for pointers, instead use POINTER_PLUS_EXPR.
Don't use BIT_AND_EXPR on a pointer type, convert the
expression to sizetype first.
* config/mips/mips.c (mips_va_start): Use POINTER_PLUS_EXPR
for pointers.
(mips_gimplify_va_arg_expr): Likewise.
Don't create BIT_AND_EXPR in a pointer type.
2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
* trans-intrinsic.c (gfc_conv_intrinsic_repeat): Use
POINTER_PLUS_EXPR instead of PLUS_EXPR for pointer addition.
* trans-expr.c (gfc_trans_string_copy): Create
POINTER_PLUS_EXPR instead of a PLUS_EXPR
for pointer types.
2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
* typeck.c (build_binary_op): For templates build the
expression in pieces to avoid the assert in build2_stat.
(get_member_function_from_ptrfunc):
Change over to using POINTER_PLUS_EXPR and convert
the second operand to sizetype.
* typeck2.c (build_m_component_ref): Likewise.
* init.c (expand_virtual_init): Create a POINTER_PLUS_EXPR
instead of PLUS_EXPR for pointers.
(build_new_1): Likewise.
(build_vec_delete_1): Likewise.
(build_vec_delete): Likewise.
* class.c (build_base_path): Likewise.
(build_base_path): Likewise.
(convert_to_base_statically): Likewise.
(fixed_type_or_null): Handle POINTER_PLUS_EXPR.
(get_vtbl_decl_for_binfo): Handle POINTER_PLUS_EXPR
instead of PLUS_EXPR.
(dfs_accumulate_vtbl_inits): Create a POINTER_PLUS_EXPR
instead of PLUS_EXPR for pointers.
* call.c (build_special_member_call): Likewise.
* rtti.c (build_headof): Likewise.
Use sizetype instead of ptrdiff_type_node.
(tinfo_base_init): Create a POINTER_PLUS_EXPR
instead of PLUS_EXPR for pointers.
* except.c (expand_start_catch_block): Do a
NEGATIVE and then a POINTER_PLUS_EXPR instead
of a MINUS_EXPR.
* cp-gimplify.c (cxx_omp_clause_apply_fn): Convert
PLUS_EXPR on pointer types over to use
POINTER_PLUS_EXPR and remove the conversion
to the pointer types.
* method.c (thunk_adjust): Use POINTER_PLUS_EXPR for
adding to a pointer type. Use size_int instead of
ssize_int. Convert the index to sizetype before
adding it to the pointer.
2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
* trans.c (Attribute_to_gnu): When subtracting an
offset from a pointer, use POINTER_PLUS_EXPR with
NEGATE_EXPR instead of MINUS_EXPR.
(gnat_to_gnu): Likewise.
* utils.c (convert): When converting between
thin pointers, use POINTER_PLUS_EXPR and sizetype
for the offset.
* utils2.c (known_alignment): POINTER_PLUS_EXPR
have the same semantics as PLUS_EXPR for alignment.
(build_binary_op): Add support for the semantics of
POINTER_PLUS_EXPR's operands.
When adding an offset to a pointer, use POINTER_PLUS_EXPR.
2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
* class.c (make_class_data): Build the index in sizetype.
Use POINTER_PLUS_EXPR instead of PLUS_EXPR when
adding to a pointer type.
(build_symbol_entry): Likewise.
* expr.c (build_java_arrayaccess): Likewise.
(build_field_ref): Likewise.
(build_known_method_ref): Likewise.
(build_invokevirtual): Likewise.
* except.c (build_exception_object_ref): Do a
NEGATIVE and then a POINTER_PLUS_EXPR instead
of a MINUS_EXPR.
2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR tree-opt/32225
* gcc.c-torture/compile/20070605-1.c: New test.
* gcc.c-torture/compile/20070603-1.c: New testcase.
* gcc.c-torture/compile/20070603-2.c: New testcase.
* gcc.c-torture/compile/20070531-1.c: New test.
PR tree-opt/32167
* gcc.c-torture/compile/20070531-2.c: New test.
PR tree-opt/32144
* gcc.c-torture/compile/20070529-1.c: New test.
PR tree-opt/32145
* gcc.c-torture/compile/20070529-2.c: New test.
PR tree-opt/32015
* gcc.c-torture/compile/20070520-1.c: New test.
* g++.dg/ext/java-1.C: New test.
* gcc.dg/vect/vect-106.c: We are now able to vectorize two
loops instead of one. Remove the "can't determine dependence"
check.
* gcc.dg/tree-ssa/20030815-1.c: Remove testcase which is no longer
needed as the cast is gone in the first place.
* gcc.dg/max-1.c: Change local variable a to be a global one.
* gcc.dg/tree-ssa/ssa-pre-8.c: Update testcase since we don't
have a cast which is PREd.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125755 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 44 | ||||
-rw-r--r-- | gcc/cp/ChangeLog.ptr | 68 | ||||
-rw-r--r-- | gcc/cp/call.c | 2 | ||||
-rw-r--r-- | gcc/cp/class.c | 20 | ||||
-rw-r--r-- | gcc/cp/cp-gimplify.c | 11 | ||||
-rw-r--r-- | gcc/cp/except.c | 5 | ||||
-rw-r--r-- | gcc/cp/init.c | 20 | ||||
-rw-r--r-- | gcc/cp/method.c | 14 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 21 | ||||
-rw-r--r-- | gcc/cp/typeck2.c | 4 |
11 files changed, 171 insertions, 44 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 2eeff3ce272..5360fce063f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,41 @@ +2007-06-15 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * typeck.c (build_binary_op): For templates build the + expression in pieces to avoid the assert in build2_stat. + (get_member_function_from_ptrfunc): + Change over to using POINTER_PLUS_EXPR and convert + the second operand to sizetype. + * typeck2.c (build_m_component_ref): Likewise. + * init.c (expand_virtual_init): Create a POINTER_PLUS_EXPR + instead of PLUS_EXPR for pointers. + (build_new_1): Likewise. + (build_vec_delete_1): Likewise. + (build_vec_delete): Likewise. + * class.c (build_base_path): Likewise. + (build_base_path): Likewise. + (convert_to_base_statically): Likewise. + (fixed_type_or_null): Handle POINTER_PLUS_EXPR. + (get_vtbl_decl_for_binfo): Handle POINTER_PLUS_EXPR + instead of PLUS_EXPR. + (dfs_accumulate_vtbl_inits): Create a POINTER_PLUS_EXPR + instead of PLUS_EXPR for pointers. + * call.c (build_special_member_call): Likewise. + * rtti.c (build_headof): Likewise. + Use sizetype instead of ptrdiff_type_node. + (tinfo_base_init): Create a POINTER_PLUS_EXPR + instead of PLUS_EXPR for pointers. + * except.c (expand_start_catch_block): Do a + NEGATIVE and then a POINTER_PLUS_EXPR instead + of a MINUS_EXPR. + * cp-gimplify.c (cxx_omp_clause_apply_fn): Convert + PLUS_EXPR on pointer types over to use + POINTER_PLUS_EXPR and remove the conversion + to the pointer types. + * method.c (thunk_adjust): Use POINTER_PLUS_EXPR for + adding to a pointer type. Use size_int instead of + ssize_int. Convert the index to sizetype before + adding it to the pointer. + 2007-06-15 Mark Mitchell <mark@codesourcery.com> * cp-tree.h (DECL_VAR_MARKED_P): Remove. @@ -109,7 +147,7 @@ (copy_fn_p): Don't consider constructors taking rvalue references to be copy constructors. (move_fn_p): New. - * call.c (conversion): New "rvaluedness_matches_p" member. + * call.c (conversion): New "rvaluedness_matches_p" member. (convert_class_to_reference): Require reference type as first parameter instead of base type. (reference_binding): Add logic to handle rvalue references. @@ -161,7 +199,7 @@ 2007-05-28 Andrew Pinski <Andrew_pinski@playstation.sony.com> - PR c++/31339 + PR c++/31339 * typeck.c (build_unary_op <case PREINCREMENT_EXPR, case POSTINCREMENT_EXPR, case PREDECREMENT_EXPR, case POSTDECREMENT_EXPR>): Return the error_mark_node @@ -1072,7 +1110,7 @@ PR C++/30158 * semantics.c (finish_stmt_expr_expr): Set TREE_TYPE of the statement expression if we had an error mark node. - + 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> diff --git a/gcc/cp/ChangeLog.ptr b/gcc/cp/ChangeLog.ptr new file mode 100644 index 00000000000..7df0cad53e5 --- /dev/null +++ b/gcc/cp/ChangeLog.ptr @@ -0,0 +1,68 @@ +2007-06-14 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * init.c (build_new_1): Use fold_build1 instead + of build1 for NEGATE_EXPR. + (build_vec_delete_1): Likewise. + * class.c (build_base_path): Likewise. + * except.c (expand_start_catch_block): Likewise. + +2007-05-28 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * typeck.c (build_binary_op): Add a comment on why creating + the tree in pieces while processing templates. + +2007-05-12 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * except.c (expand_start_catch_block): Do a + NEGATIVE and then a POINTER_PLUS_EXPR instead + of a MINUS_EXPR. + +2007-05-06 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * cp-gimplify.c (cxx_omp_clause_apply_fn): Convert + PLUS_EXPR on pointer types over to use + POINTER_PLUS_EXPR and remove the conversion + to the pointer types. + +2007-05-06 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * typeck.c (build_unary_op): Remove code that used to + handle non lvalue increments/decrements as we now error + out all ways. + +2007-05-06 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * typeck.c (get_member_function_from_ptrfunc): + Change over to using POINTER_PLUS_EXPR and convert + the second operand to sizetype. + * typeck2.c (build_m_component_ref): Likewise. + * rtti.c (build_headof): Use sizetype instead of + ptrdiff_type_node. + +2007-05-06 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * method.c (thunk_adjust): Use POINTER_PLUS_EXPR for + adding to a pointer type. Use size_int instead of + ssize_int. Convert the index to sizetype before + adding it to the pointer. + +2006-11-23 Andrew Pinski <andrew_pinski@playstation.sony.com> + + * typeck.c (build_binary_op): For templates build the + expression in pieces to avoid the assert in build2_stat. + * init.c (expand_virtual_init): Create a POINTER_PLUS_EXPR + instead of PLUS_EXPR for pointers. + (build_new_1): Likewise. + (build_vec_delete_1): Likewise. + (build_vec_delete): Likewise. + * class.c (build_base_path): Likewise. + (build_base_path): Likewise. + (convert_to_base_statically): Likewise. + (fixed_type_or_null): Handle POINTER_PLUS_EXPR. + (get_vtbl_decl_for_binfo): Handle POINTER_PLUS_EXPR + instead of PLUS_EXPR. + (dfs_accumulate_vtbl_inits): Create a POINTER_PLUS_EXPR + instead of PLUS_EXPR for pointers. + * call.c (build_special_member_call): Likewise. + * rtti.c (build_headof): Likewise. + (tinfo_base_init): Likewise. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 6e6be645d6e..86d5fbccd10 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5321,7 +5321,7 @@ build_special_member_call (tree instance, tree name, tree args, current_vtt_parm, vtt); gcc_assert (BINFO_SUBVTT_INDEX (binfo)); - sub_vtt = build2 (PLUS_EXPR, TREE_TYPE (vtt), vtt, + sub_vtt = build2 (POINTER_PLUS_EXPR, TREE_TYPE (vtt), vtt, BINFO_SUBVTT_INDEX (binfo)); args = tree_cons (NULL_TREE, sub_vtt, args); diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 0314df3adc3..67cf63db1bd 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -367,8 +367,8 @@ build_base_path (enum tree_code code, v_offset = build_vfield_ref (build_indirect_ref (expr, NULL), TREE_TYPE (TREE_TYPE (expr))); - v_offset = build2 (PLUS_EXPR, TREE_TYPE (v_offset), - v_offset, BINFO_VPTR_FIELD (v_binfo)); + v_offset = build2 (POINTER_PLUS_EXPR, TREE_TYPE (v_offset), + v_offset, fold_convert (sizetype, BINFO_VPTR_FIELD (v_binfo))); v_offset = build1 (NOP_EXPR, build_pointer_type (ptrdiff_type_node), v_offset); @@ -406,7 +406,12 @@ build_base_path (enum tree_code code, expr = build1 (NOP_EXPR, ptr_target_type, expr); if (!integer_zerop (offset)) - expr = build2 (code, ptr_target_type, expr, offset); + { + offset = fold_convert (sizetype, offset); + if (code == MINUS_EXPR) + offset = fold_build1 (NEGATE_EXPR, sizetype, offset); + expr = build2 (POINTER_PLUS_EXPR, ptr_target_type, expr, offset); + } else null_test = NULL; @@ -539,8 +544,8 @@ convert_to_base_statically (tree expr, tree base) gcc_assert (!processing_template_decl); expr = build_unary_op (ADDR_EXPR, expr, /*noconvert=*/1); if (!integer_zerop (BINFO_OFFSET (base))) - expr = fold_build2 (PLUS_EXPR, pointer_type, expr, - fold_convert (pointer_type, BINFO_OFFSET (base))); + expr = fold_build2 (POINTER_PLUS_EXPR, pointer_type, expr, + fold_convert (sizetype, BINFO_OFFSET (base))); expr = fold_convert (build_pointer_type (BINFO_TYPE (base)), expr); expr = build_fold_indirect_ref (expr); } @@ -5276,6 +5281,7 @@ fixed_type_or_null (tree instance, int *nonnull, int *cdtorp) } return RECUR (TREE_OPERAND (instance, 0)); + case POINTER_PLUS_EXPR: case PLUS_EXPR: case MINUS_EXPR: if (TREE_CODE (TREE_OPERAND (instance, 0)) == ADDR_EXPR) @@ -6340,7 +6346,7 @@ get_vtbl_decl_for_binfo (tree binfo) tree decl; decl = BINFO_VTABLE (binfo); - if (decl && TREE_CODE (decl) == PLUS_EXPR) + if (decl && TREE_CODE (decl) == POINTER_PLUS_EXPR) { gcc_assert (TREE_CODE (TREE_OPERAND (decl, 0)) == ADDR_EXPR); decl = TREE_OPERAND (TREE_OPERAND (decl, 0), 0); @@ -7126,7 +7132,7 @@ dfs_accumulate_vtbl_inits (tree binfo, index = size_binop (MULT_EXPR, TYPE_SIZE_UNIT (vtable_entry_type), index); - vtbl = build2 (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, index); + vtbl = build2 (POINTER_PLUS_EXPR, TREE_TYPE (vtbl), vtbl, index); } if (ctor_vtbl_p) diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index bd67ad1b819..9d9cc4d388a 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -802,8 +802,7 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2) start2 = build_fold_addr_expr (start2); end1 = TYPE_SIZE_UNIT (TREE_TYPE (arg1)); - end1 = fold_convert (TREE_TYPE (start1), end1); - end1 = build2 (PLUS_EXPR, TREE_TYPE (start1), start1, end1); + end1 = build2 (POINTER_PLUS_EXPR, TREE_TYPE (start1), start1, end1); p1 = create_tmp_var (TREE_TYPE (start1), NULL); t = build2 (GIMPLE_MODIFY_STMT, void_type_node, p1, start1); @@ -830,15 +829,15 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2) t = build_call_a (fn, i, argarray); append_to_statement_list (t, &ret); - t = fold_convert (TREE_TYPE (p1), TYPE_SIZE_UNIT (inner_type)); - t = build2 (PLUS_EXPR, TREE_TYPE (p1), p1, t); + t = TYPE_SIZE_UNIT (inner_type); + t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (p1), p1, t); t = build2 (GIMPLE_MODIFY_STMT, void_type_node, p1, t); append_to_statement_list (t, &ret); if (arg2) { - t = fold_convert (TREE_TYPE (p2), TYPE_SIZE_UNIT (inner_type)); - t = build2 (PLUS_EXPR, TREE_TYPE (p2), p2, t); + t = TYPE_SIZE_UNIT (inner_type); + t = build2 (POINTER_PLUS_EXPR, TREE_TYPE (p2), p2, t); t = build2 (GIMPLE_MODIFY_STMT, void_type_node, p2, t); append_to_statement_list (t, &ret); } diff --git a/gcc/cp/except.c b/gcc/cp/except.c index 059754f36cd..887b0f17ef0 100644 --- a/gcc/cp/except.c +++ b/gcc/cp/except.c @@ -426,8 +426,9 @@ expand_start_catch_block (tree decl) generic exception header. */ exp = build_exc_ptr (); exp = build1 (NOP_EXPR, build_pointer_type (type), exp); - exp = build2 (MINUS_EXPR, TREE_TYPE (exp), exp, - TYPE_SIZE_UNIT (TREE_TYPE (exp))); + exp = build2 (POINTER_PLUS_EXPR, TREE_TYPE (exp), exp, + fold_build1 (NEGATE_EXPR, sizetype, + TYPE_SIZE_UNIT (TREE_TYPE (exp)))); exp = build_indirect_ref (exp, NULL); initialize_handler_parm (decl, exp); return type; diff --git a/gcc/cp/init.c b/gcc/cp/init.c index aecbed96795..6ca072ca5d4 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -786,7 +786,7 @@ expand_virtual_init (tree binfo, tree decl) /* Compute the value to use, when there's a VTT. */ vtt_parm = current_vtt_parm; - vtbl2 = build2 (PLUS_EXPR, + vtbl2 = build2 (POINTER_PLUS_EXPR, TREE_TYPE (vtt_parm), vtt_parm, vtt_index); @@ -1919,14 +1919,15 @@ build_new_1 (tree placement, tree type, tree nelts, tree init, tree cookie_ptr; /* Adjust so we're pointing to the start of the object. */ - data_addr = get_target_expr (build2 (PLUS_EXPR, full_pointer_type, + data_addr = get_target_expr (build2 (POINTER_PLUS_EXPR, full_pointer_type, alloc_node, cookie_size)); /* Store the number of bytes allocated so that we can know how many elements to destroy later. We use the last sizeof (size_t) bytes to store the number of elements. */ - cookie_ptr = build2 (MINUS_EXPR, build_pointer_type (sizetype), - data_addr, size_in_bytes (sizetype)); + cookie_ptr = fold_build1 (NEGATE_EXPR, sizetype, size_in_bytes (sizetype)); + cookie_ptr = build2 (POINTER_PLUS_EXPR, build_pointer_type (sizetype), + data_addr, cookie_ptr); cookie = build_indirect_ref (cookie_ptr, NULL); cookie_expr = build2 (MODIFY_EXPR, sizetype, cookie, nelts); @@ -2301,6 +2302,7 @@ build_vec_delete_1 (tree base, tree maxindex, tree type, executing any other code in the loop. This is also the containing expression returned by this function. */ tree controller = NULL_TREE; + tree tmp; /* We should only have 1-D arrays here. */ gcc_assert (TREE_CODE (type) != ARRAY_TYPE); @@ -2314,7 +2316,7 @@ build_vec_delete_1 (tree base, tree maxindex, tree type, tbase = create_temporary_var (ptype); tbase_init = build_modify_expr (tbase, NOP_EXPR, - fold_build2 (PLUS_EXPR, ptype, + fold_build2 (POINTER_PLUS_EXPR, ptype, base, virtual_size)); DECL_REGISTER (tbase) = 1; @@ -2325,9 +2327,10 @@ build_vec_delete_1 (tree base, tree maxindex, tree type, body = build1 (EXIT_EXPR, void_type_node, build2 (EQ_EXPR, boolean_type_node, tbase, fold_convert (ptype, base))); + tmp = fold_build1 (NEGATE_EXPR, sizetype, size_exp); body = build_compound_expr (body, build_modify_expr (tbase, NOP_EXPR, - build2 (MINUS_EXPR, ptype, tbase, size_exp))); + build2 (POINTER_PLUS_EXPR, ptype, tbase, tmp))); body = build_compound_expr (body, build_delete (ptype, tbase, sfk_complete_destructor, LOOKUP_NORMAL|LOOKUP_DESTRUCTOR, 1)); @@ -3048,10 +3051,11 @@ build_vec_delete (tree base, tree maxindex, base = TARGET_EXPR_SLOT (base_init); } type = strip_array_types (TREE_TYPE (type)); - cookie_addr = build2 (MINUS_EXPR, + cookie_addr = fold_build1 (NEGATE_EXPR, sizetype, TYPE_SIZE_UNIT (sizetype)); + cookie_addr = build2 (POINTER_PLUS_EXPR, build_pointer_type (sizetype), base, - TYPE_SIZE_UNIT (sizetype)); + cookie_addr); maxindex = build_indirect_ref (cookie_addr, NULL); } else if (TREE_CODE (type) == ARRAY_TYPE) diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 03078a3f017..03f49088451 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -220,8 +220,8 @@ thunk_adjust (tree ptr, bool this_adjusting, { if (this_adjusting) /* Adjust the pointer by the constant. */ - ptr = fold_build2 (PLUS_EXPR, TREE_TYPE (ptr), ptr, - ssize_int (fixed_offset)); + ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr, + size_int (fixed_offset)); /* If there's a virtual offset, look up that value in the vtable and adjust the pointer again. */ @@ -238,17 +238,19 @@ thunk_adjust (tree ptr, bool this_adjusting, /* Form the vtable address. */ vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable); /* Find the entry with the vcall offset. */ - vtable = build2 (PLUS_EXPR, TREE_TYPE (vtable), vtable, virtual_offset); + vtable = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (vtable), vtable, + fold_convert (sizetype, virtual_offset)); /* Get the offset itself. */ vtable = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (vtable)), vtable); /* Adjust the `this' pointer. */ - ptr = fold_build2 (PLUS_EXPR, TREE_TYPE (ptr), ptr, vtable); + ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr, + fold_convert (sizetype, vtable)); } if (!this_adjusting) /* Adjust the pointer by the constant. */ - ptr = fold_build2 (PLUS_EXPR, TREE_TYPE (ptr), ptr, - ssize_int (fixed_offset)); + ptr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (ptr), ptr, + size_int (fixed_offset)); return ptr; } diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 1891f3b4833..2870b9ff415 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -180,8 +180,8 @@ build_headof (tree exp) type = build_qualified_type (ptr_type_node, cp_type_quals (TREE_TYPE (exp))); - return build2 (PLUS_EXPR, type, exp, - convert_to_integer (ptrdiff_type_node, offset)); + return build2 (POINTER_PLUS_EXPR, type, exp, + convert_to_integer (sizetype, offset)); } /* Get a bad_cast node for the program to throw... @@ -856,7 +856,7 @@ tinfo_base_init (tinfo_s *ti, tree target) /* We need to point into the middle of the vtable. */ vtable_ptr = build2 - (PLUS_EXPR, TREE_TYPE (vtable_ptr), vtable_ptr, + (POINTER_PLUS_EXPR, TREE_TYPE (vtable_ptr), vtable_ptr, size_binop (MULT_EXPR, size_int (2 * TARGET_VTABLE_DATA_ENTRY_DISTANCE), TYPE_SIZE_UNIT (vtable_entry_type))); diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index f17aa807de4..7985d853ed1 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2627,8 +2627,8 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function) return error_mark_node; } /* ...and then the delta in the PMF. */ - instance_ptr = build2 (PLUS_EXPR, TREE_TYPE (instance_ptr), - instance_ptr, delta); + instance_ptr = build2 (POINTER_PLUS_EXPR, TREE_TYPE (instance_ptr), + instance_ptr, fold_convert (sizetype, delta)); /* Hand back the adjusted 'this' argument to our caller. */ *instance_ptrptr = instance_ptr; @@ -2639,7 +2639,8 @@ get_member_function_from_ptrfunc (tree *instance_ptrptr, tree function) vtbl = build_indirect_ref (vtbl, NULL); /* Finally, extract the function pointer from the vtable. */ - e2 = fold_build2 (PLUS_EXPR, TREE_TYPE (vtbl), vtbl, idx); + e2 = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (vtbl), vtbl, + fold_convert (sizetype, idx)); e2 = build_indirect_ref (e2, NULL); TREE_CONSTANT (e2) = 1; TREE_INVARIANT (e2) = 1; @@ -3578,9 +3579,17 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1, /* If we're in a template, the only thing we need to know is the RESULT_TYPE. */ if (processing_template_decl) - return build2 (resultcode, - build_type ? build_type : result_type, - op0, op1); + { + /* Since the middle-end checks the type when doing a build2, we + need to build the tree in pieces. This built tree will never + get out of the front-end as we replace it when instantiating + the template. */ + tree tmp = build2 (resultcode, + build_type ? build_type : result_type, + NULL_TREE, op1); + TREE_OPERAND (tmp, 0) = op0; + return tmp; + } if (arithmetic_types_p) { diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 9ded7bbf864..66c8b9c4feb 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1277,8 +1277,8 @@ build_m_component_ref (tree datum, tree component) /* Build an expression for "object + offset" where offset is the value stored in the pointer-to-data-member. */ - datum = build2 (PLUS_EXPR, build_pointer_type (type), - datum, build_nop (ptrdiff_type_node, component)); + datum = build2 (POINTER_PLUS_EXPR, build_pointer_type (type), + datum, build_nop (sizetype, component)); return build_indirect_ref (datum, 0); } else |