aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
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 b3e3ec6..6f3aee6 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 817f862..1e94bca 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 92091f9..3bb5ff4 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 1705106..f5e5bb9 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 3bf983a..4686f30 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);