summaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-19 14:01:59 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-19 14:01:59 +0000
commit2cc66f2ad8d743ca03465d67871cf157cf3d7124 (patch)
tree2530edff8e2622a26913a15b62d707dad7e5b286 /gcc/java
parent8618a9e7d1c95a2e71cb31cbcfcd1c61e07fb264 (diff)
downloadgcc-2cc66f2ad8d743ca03465d67871cf157cf3d7124.tar.gz
2011-07-19 Richard Guenther <rguenther@suse.de>
* tree.h (fold_build_pointer_plus_loc): New helper function. (fold_build_pointer_plus_hwi_loc): Likewise. (fold_build_pointer_plus): Define. (fold_build_pointer_plus_hwi): Likewise. * builtins.c (std_gimplify_va_arg_expr): Use fold_build_pointer_plus. (fold_builtin_memory_op): Likewise. (fold_builtin_stpcpy): Likewise. (fold_builtin_memchr): Likewise. (fold_builtin_strstr): Likewise. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (expand_builtin_memory_chk): Likewise. (fold_builtin_memory_chk): Likewise. * c-typeck.c (build_unary_op): Likewise. * cgraphunit.c (thunk_adjust): Likewise. * fold-const.c (build_range_check): Likewise. (fold_binary_loc): Likewise. * omp-low.c (extract_omp_for_data): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_for_static_chunk): Likewise. * tree-affine.c (add_elt_to_tree): Likewise. * tree-data-ref.c (split_constant_offset_1): Likewise. * tree-loop-distribution.c (generate_memset_zero): Likewise. * tree-mudflap.c (mf_xform_derefs_1): Likewise. * tree-predcom.c (ref_at_iteration): Likewise. * tree-ssa-address.c (tree_mem_ref_addr): Likewise. (add_to_parts): Likewise. (create_mem_ref): Likewise. * tree-ssa-loop-ivopts.c (force_expr_to_var_cost): Likewise. * tree-ssa-loop-niter.c (number_of_iterations_lt_to_ne): Likewise. (number_of_iterations_le): Likewise. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Likewise. * tree-vect-data-refs.c (vect_analyze_data_refs): Likewise. (vect_create_addr_base_for_vector_ref): Likewise. * tree-vect-loop-manip.c (vect_update_ivs_after_vectorizer): Likewise. (vect_create_cond_for_alias_checks): Likewise. * tree-vrp.c (extract_range_from_assert): Likewise. * config/alpha/alpha.c (alpha_va_start): Likewise. (alpha_gimplify_va_arg_1): Likewise. * config/i386/i386.c (ix86_va_start): Likewise. (ix86_gimplify_va_arg): Likewise. * config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise. * config/mep/mep.c (mep_expand_va_start): Likewise. (mep_gimplify_va_arg_expr): Likewise. * config/mips/mips.c (mips_va_start): Likewise. (mips_gimplify_va_arg_expr): Likewise. * config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise. * config/rs6000/rs6000.c (rs6000_va_start): Likewise. (rs6000_gimplify_va_arg): Likewise. * config/s390/s390.c (s390_va_start): Likewise. (s390_gimplify_va_arg): Likewise. * config/sh/sh.c (sh_va_start): Likewise. (sh_gimplify_va_arg_expr): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Likewise. * config/spu/spu.c (spu_va_start): Likewise. (spu_gimplify_va_arg_expr): Likewise. * config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start): Likewise. (xstormy16_gimplify_va_arg_expr): Likewise. * config/xtensa/xtensa.c (xtensa_va_start): Likewise. (xtensa_gimplify_va_arg_expr): Likewise. c-family/ * c-common.c (pointer_int_sum): Use fold_build_pointer_plus. * c-omp.c (c_finish_omp_for): Likewise. cp/ * call.c (build_special_member_call): Use fold_build_pointer_plus. * class.c (build_base_path): Likewise. (convert_to_base_statically): Likewise. (dfs_accumulate_vtbl_inits): Likewise. * cp-gimplify.c (cxx_omp_clause_apply_fn): Likewise. * except.c (expand_start_catch_block): Likewise. * init.c (expand_virtual_init): Likewise. (build_new_1): Likewise. (build_vec_delete_1): Likewise. (build_vec_delete): Likewise. * rtti.c (build_headof): Likewise. (tinfo_base_init): Likewise. * typeck.c (get_member_function_from_ptrfunc): Likewise. (cp_build_addr_expr_1): Likewise. * typeck2.c (build_m_component_ref): Likewise. fortran/ * trans-expr.c (fill_with_spaces): Use fold_build_pointer_plus. (gfc_trans_string_copy): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_repeat): Likewise. * trans-types.c (gfc_get_array_descr_info): Likewise. * trans.c (gfc_build_array_ref): Likewise. java/ * builtins.c (static): Use fold_build_pointer_plus. * class.c (make_class_data): Likewise. (build_symbol_entry): Likewise. * except.c (build_exception_object_ref): Likewise. * expr.c (build_java_arrayaccess): Likewise. (build_field_ref): Likewise. (build_known_method_ref): Likewise. (build_invokevirtual): Likewise. objc/ * objc-next-runtime-abi-02.c (objc_v2_build_ivar_ref): Use fold_build_pointer_plus. (objc2_build_ehtype_initializer): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@176461 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog11
-rw-r--r--gcc/java/builtins.c5
-rw-r--r--gcc/java/class.c19
-rw-r--r--gcc/java/except.c2
-rw-r--r--gcc/java/expr.c14
5 files changed, 26 insertions, 25 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index b3e3ec66c83..6f3aee6ee68 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,14 @@
+2011-07-19 Richard Guenther <rguenther@suse.de>
+
+ * builtins.c (static): Use fold_build_pointer_plus.
+ * class.c (make_class_data): Likewise.
+ (build_symbol_entry): Likewise.
+ * except.c (build_exception_object_ref): Likewise.
+ * expr.c (build_java_arrayaccess): Likewise.
+ (build_field_ref): Likewise.
+ (build_known_method_ref): Likewise.
+ (build_invokevirtual): Likewise.
+
2011-07-06 Richard Guenther <rguenther@suse.de>
* decl.c (java_init_decl_processing):
diff --git a/gcc/java/builtins.c b/gcc/java/builtins.c
index 817f8628c77..1e94bcab4d2 100644
--- a/gcc/java/builtins.c
+++ b/gcc/java/builtins.c
@@ -283,10 +283,7 @@ static tree
build_addr_sum (tree type, tree addr, tree offset)
{
tree ptr_type = build_pointer_type (type);
- return fold_build2 (POINTER_PLUS_EXPR,
- ptr_type,
- fold_convert (ptr_type, addr),
- fold_convert (sizetype, offset));
+ return fold_build_pointer_plus (fold_convert (ptr_type, addr), offset);
}
/* Make sure that this-arg is non-NULL. This is a security check. */
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 92091f9e9cf..3bb5ff44f6e 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -2085,10 +2085,10 @@ make_class_data (tree type)
PUSH_FIELD_VALUE (v1, "vtable",
(flag_indirect_classes
? null_pointer_node
- : build2 (POINTER_PLUS_EXPR, dtable_ptr_type,
- build1 (ADDR_EXPR, dtable_ptr_type,
- class_dtable_decl),
- dtable_start_offset)));
+ : fold_build_pointer_plus
+ (build1 (ADDR_EXPR, dtable_ptr_type,
+ class_dtable_decl),
+ dtable_start_offset)));
if (! flag_hash_synchronization)
PUSH_FIELD_VALUE (v1, "sync_info", null_pointer_node);
FINISH_RECORD_CONSTRUCTOR (temp, v1, object_type_node);
@@ -2131,10 +2131,10 @@ make_class_data (tree type)
PUSH_FIELD_VALUE (v2, "vtable",
(flag_indirect_dispatch || dtable_decl == NULL_TREE
? null_pointer_node
- : build2 (POINTER_PLUS_EXPR, dtable_ptr_type,
- build1 (ADDR_EXPR, dtable_ptr_type,
- dtable_decl),
- dtable_start_offset)));
+ : fold_build_pointer_plus
+ (build1 (ADDR_EXPR, dtable_ptr_type,
+ dtable_decl),
+ dtable_start_offset)));
add_table_and_syms (&v2, TYPE_OTABLE_METHODS (type),
"otable", TYPE_OTABLE_DECL (type), otable_ptr_type,
"otable_syms", TYPE_OTABLE_SYMS_DECL (type));
@@ -2896,8 +2896,7 @@ build_symbol_entry (tree decl, tree special)
system that this is a "special" symbol, i.e. one that should
bypass access controls. */
if (special != NULL_TREE)
- signature = build2 (POINTER_PLUS_EXPR, TREE_TYPE (signature), signature,
- fold_convert (sizetype, special));
+ signature = fold_build_pointer_plus (signature, special);
return build_symbol_table_entry (clname, name, signature);
}
diff --git a/gcc/java/except.c b/gcc/java/except.c
index 1705106c4d9..f5e5bb9e664 100644
--- a/gcc/java/except.c
+++ b/gcc/java/except.c
@@ -488,7 +488,7 @@ build_exception_object_ref (tree type)
The java object is immediately before the generic exception header. */
obj = build_exception_object_var ();
obj = fold_convert (build_pointer_type (type), obj);
- obj = build2 (POINTER_PLUS_EXPR, TREE_TYPE (obj), obj,
+ obj = fold_build_pointer_plus (obj,
fold_build1 (NEGATE_EXPR, sizetype,
TYPE_SIZE_UNIT (TREE_TYPE (obj))));
obj = build1 (INDIRECT_REF, type, obj);
diff --git a/gcc/java/expr.c b/gcc/java/expr.c
index 3bf983a2bca..4686f30309b 100644
--- a/gcc/java/expr.c
+++ b/gcc/java/expr.c
@@ -936,7 +936,7 @@ build_java_arrayaccess (tree array, tree type, tree index)
size_exp);
/* Sum the byte offset and the address of the data field. */
- node = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (node), node, index);
+ node = fold_build_pointer_plus (node, index);
/* Finally, return
@@ -1743,12 +1743,8 @@ build_field_ref (tree self_value, tree self_class, tree name)
1, otable_index),
field_offset);
- field_offset = fold (convert (sizetype, field_offset));
self_value = java_check_reference (self_value, check);
- address
- = fold_build2 (POINTER_PLUS_EXPR,
- TREE_TYPE (self_value),
- self_value, field_offset);
+ address = fold_build_pointer_plus (self_value, field_offset);
address = fold_convert (build_pointer_type (TREE_TYPE (field_decl)),
address);
return fold_build1 (INDIRECT_REF, TREE_TYPE (field_decl), address);
@@ -2255,8 +2251,7 @@ build_known_method_ref (tree method, tree method_type ATTRIBUTE_UNUSED,
method_index++;
}
method_index *= int_size_in_bytes (method_type_node);
- ref = fold_build2 (POINTER_PLUS_EXPR, method_ptr_type_node,
- ref, size_int (method_index));
+ ref = fold_build_pointer_plus_hwi (ref, method_index);
ref = build1 (INDIRECT_REF, method_type_node, ref);
func = build3 (COMPONENT_REF, nativecode_ptr_type_node,
ref, lookup_field (&method_type_node, ncode_ident),
@@ -2349,8 +2344,7 @@ build_invokevirtual (tree dtable, tree method, tree special)
size_int (TARGET_VTABLE_USES_DESCRIPTORS));
}
- func = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (dtable), dtable,
- convert (sizetype, method_index));
+ func = fold_build_pointer_plus (dtable, method_index);
if (TARGET_VTABLE_USES_DESCRIPTORS)
func = build1 (NOP_EXPR, nativecode_ptr_type_node, func);