summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2014-10-31 14:13:57 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2014-10-31 14:13:57 -0400
commitb919459eb114d5136b03ef6251db10f57817d561 (patch)
treeacc6469ad3a5bef2f6c26c8e9623fbf17b556daa /gcc
parenteafdc6694dc896fb72b50c255fbdcb24988065d9 (diff)
downloadgcc-b919459eb114d5136b03ef6251db10f57817d561.tar.gz
gimple-low.c: Use gcall * in a few places
gcc/ChangeLog.gimple-classes: * gimple-low.c (lower_builtin_setjmp): Strengthen local "stmt" from gimple to gcall *, via a checked cast. (lower_builtin_posix_memalign): Likewise for local "call". Strengthen local "cond" from gimple to gcond *. Split local gimple "stmt" into new locals "assign_stmt1", "call_stmt", and "assign_stmt2", of appropriate types.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog.gimple-classes9
-rw-r--r--gcc/gimple-low.c36
2 files changed, 29 insertions, 16 deletions
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index a47c47176c8..5b408e3956e 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,3 +1,12 @@
+2014-10-31 David Malcolm <dmalcolm@redhat.com>
+
+ * gimple-low.c (lower_builtin_setjmp): Strengthen local "stmt"
+ from gimple to gcall *, via a checked cast.
+ (lower_builtin_posix_memalign): Likewise for local "call".
+ Strengthen local "cond" from gimple to gcond *.
+ Split local gimple "stmt" into new locals "assign_stmt1",
+ "call_stmt", and "assign_stmt2", of appropriate types.
+
2014-10-30 David Malcolm <dmalcolm@redhat.com>
* gimple-fold.c (replace_call_with_call_and_fold): Strengthen
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index a30fae52e4a..f817e25b765 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -738,7 +738,7 @@ lower_gimple_return (gimple_stmt_iterator *gsi, struct lower_data *data)
static void
lower_builtin_setjmp (gimple_stmt_iterator *gsi)
{
- gimple stmt = gsi_stmt (*gsi);
+ gcall *stmt = as_a <gcall *> (gsi_stmt (*gsi));
location_t loc = gimple_location (stmt);
tree cont_label = create_artificial_label (loc);
tree next_label = create_artificial_label (loc);
@@ -823,7 +823,8 @@ lower_builtin_setjmp (gimple_stmt_iterator *gsi)
static void
lower_builtin_posix_memalign (gimple_stmt_iterator *gsi)
{
- gimple stmt, call = gsi_stmt (*gsi);
+ gassign *assign_stmt1;
+ gcall *call = as_a <gcall *> (gsi_stmt (*gsi));
tree pptr = gimple_call_arg (call, 0);
tree align = gimple_call_arg (call, 1);
tree res = gimple_call_lhs (call);
@@ -833,12 +834,13 @@ lower_builtin_posix_memalign (gimple_stmt_iterator *gsi)
tree tem = create_tmp_var (ptr_type_node, NULL);
TREE_ADDRESSABLE (tem) = 1;
gimple_call_set_arg (call, 0, build_fold_addr_expr (tem));
- stmt = gimple_build_assign (ptr, tem);
+ assign_stmt1 = gimple_build_assign (ptr, tem);
}
else
- stmt = gimple_build_assign (ptr,
- fold_build2 (MEM_REF, ptr_type_node, pptr,
- build_int_cst (ptr_type_node, 0)));
+ assign_stmt1 =
+ gimple_build_assign (ptr,
+ fold_build2 (MEM_REF, ptr_type_node, pptr,
+ build_int_cst (ptr_type_node, 0)));
if (res == NULL_TREE)
{
res = create_tmp_reg (integer_type_node, NULL);
@@ -846,19 +848,21 @@ lower_builtin_posix_memalign (gimple_stmt_iterator *gsi)
}
tree align_label = create_artificial_label (UNKNOWN_LOCATION);
tree noalign_label = create_artificial_label (UNKNOWN_LOCATION);
- gimple cond = gimple_build_cond (EQ_EXPR, res, integer_zero_node,
+ gcond *cond = gimple_build_cond (EQ_EXPR, res, integer_zero_node,
align_label, noalign_label);
gsi_insert_after (gsi, cond, GSI_NEW_STMT);
gsi_insert_after (gsi, gimple_build_label (align_label), GSI_NEW_STMT);
- gsi_insert_after (gsi, stmt, GSI_NEW_STMT);
- stmt = gimple_build_call (builtin_decl_implicit (BUILT_IN_ASSUME_ALIGNED),
- 2, ptr, align);
- gimple_call_set_lhs (stmt, ptr);
- gsi_insert_after (gsi, stmt, GSI_NEW_STMT);
- stmt = gimple_build_assign (fold_build2 (MEM_REF, ptr_type_node, pptr,
- build_int_cst (ptr_type_node, 0)),
- ptr);
- gsi_insert_after (gsi, stmt, GSI_NEW_STMT);
+ gsi_insert_after (gsi, assign_stmt1, GSI_NEW_STMT);
+ gcall *call_stmt =
+ gimple_build_call (builtin_decl_implicit (BUILT_IN_ASSUME_ALIGNED),
+ 2, ptr, align);
+ gimple_call_set_lhs (call_stmt, ptr);
+ gsi_insert_after (gsi, call_stmt, GSI_NEW_STMT);
+ gassign *assign_stmt2 =
+ gimple_build_assign (fold_build2 (MEM_REF, ptr_type_node, pptr,
+ build_int_cst (ptr_type_node, 0)),
+ ptr);
+ gsi_insert_after (gsi, assign_stmt2, GSI_NEW_STMT);
gsi_insert_after (gsi, gimple_build_label (noalign_label), GSI_NEW_STMT);
}