aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-mudflap.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-mudflap.c')
-rw-r--r--gcc/tree-mudflap.c44
1 files changed, 16 insertions, 28 deletions
diff --git a/gcc/tree-mudflap.c b/gcc/tree-mudflap.c
index 7b5ed4b..26ef23e1 100644
--- a/gcc/tree-mudflap.c
+++ b/gcc/tree-mudflap.c
@@ -843,9 +843,8 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
elt = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (elt)),
elt);
addr = fold_convert_loc (location, ptr_type_node, elt ? elt : base);
- addr = fold_build2_loc (location, POINTER_PLUS_EXPR, ptr_type_node,
- addr, fold_convert_loc (location, sizetype,
- byte_position (field)));
+ addr = fold_build_pointer_plus_loc (location,
+ addr, byte_position (field));
}
else
addr = build1 (ADDR_EXPR, build_pointer_type (type), t);
@@ -861,33 +860,25 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
case INDIRECT_REF:
addr = TREE_OPERAND (t, 0);
base = addr;
- limit = fold_build2_loc (location, POINTER_PLUS_EXPR, ptr_type_node,
- fold_build2_loc (location,
- POINTER_PLUS_EXPR, ptr_type_node, base,
- size),
- size_int (-1));
+ limit = fold_build_pointer_plus_hwi_loc
+ (location, fold_build_pointer_plus_loc (location, base, size), -1);
break;
case MEM_REF:
- addr = fold_build2_loc (location, POINTER_PLUS_EXPR, TREE_TYPE (TREE_OPERAND (t, 0)),
- TREE_OPERAND (t, 0),
- fold_convert (sizetype, TREE_OPERAND (t, 1)));
+ addr = fold_build_pointer_plus_loc (location, TREE_OPERAND (t, 0),
+ TREE_OPERAND (t, 1));
base = addr;
- limit = fold_build2_loc (location, POINTER_PLUS_EXPR, ptr_type_node,
- fold_build2_loc (location,
- POINTER_PLUS_EXPR, ptr_type_node, base,
- size),
- size_int (-1));
+ limit = fold_build_pointer_plus_hwi_loc (location,
+ fold_build_pointer_plus_loc (location,
+ base, size), -1);
break;
case TARGET_MEM_REF:
addr = tree_mem_ref_addr (ptr_type_node, t);
base = addr;
- limit = fold_build2_loc (location, POINTER_PLUS_EXPR, ptr_type_node,
- fold_build2_loc (location,
- POINTER_PLUS_EXPR, ptr_type_node, base,
- size),
- size_int (-1));
+ limit = fold_build_pointer_plus_hwi_loc (location,
+ fold_build_pointer_plus_loc (location,
+ base, size), -1);
break;
case ARRAY_RANGE_REF:
@@ -920,15 +911,12 @@ mf_xform_derefs_1 (gimple_stmt_iterator *iter, tree *tp,
addr = TREE_OPERAND (TREE_OPERAND (t, 0), 0);
addr = convert (ptr_type_node, addr);
- addr = fold_build2_loc (location, POINTER_PLUS_EXPR,
- ptr_type_node, addr, ofs);
+ addr = fold_build_pointer_plus_loc (location, addr, ofs);
base = addr;
- limit = fold_build2_loc (location, POINTER_PLUS_EXPR, ptr_type_node,
- fold_build2_loc (location,
- POINTER_PLUS_EXPR, ptr_type_node,
- base, size),
- size_int (-1));
+ limit = fold_build_pointer_plus_hwi_loc (location,
+ fold_build_pointer_plus_loc (location,
+ base, size), -1);
}
break;