aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2019-11-29 21:30:01 +0000
committerIain Sandoe <iain@sandoe.co.uk>2019-11-29 21:30:01 +0000
commitc014c4d953cfa3bfb4eea48f576b1364142ab97e (patch)
treeb6d99c459d4048c832c984af634d1ad42d1b090b
parent842e4c3d332b27ed4e3ceb1e9a8e2e4319a7e1d6 (diff)
c++-coroutines - Address review comments, use mode standard nodes.
Use nodes and APIs consistent with other places in the middle end. 2019-11-29 Iain Sandoe <iain@sandoe.co.uk> gcc/ * coroutine-passes.cc (lower_coro_builtin): Use nodes and APIs consistent with other places in the middle end. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/c++-coroutines@278864 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--ChangeLog.coroutines6
-rw-r--r--gcc/coroutine-passes.cc10
2 files changed, 11 insertions, 5 deletions
diff --git a/ChangeLog.coroutines b/ChangeLog.coroutines
index 64a0ab88316..089244cba33 100644
--- a/ChangeLog.coroutines
+++ b/ChangeLog.coroutines
@@ -1,6 +1,12 @@
2019-11-29 Iain Sandoe <iain@sandoe.co.uk>
gcc/
+ * coroutine-passes.cc (lower_coro_builtin): Use nodes and APIs
+ consistent with other places in the middle end.
+
+2019-11-29 Iain Sandoe <iain@sandoe.co.uk>
+
+ gcc/
* coroutine-passes.cc (lower_coro_builtin): Use ptr_type_node
throughout instead of building nodes each time.
diff --git a/gcc/coroutine-passes.cc b/gcc/coroutine-passes.cc
index 310ff1eda48..6d01e27c212 100644
--- a/gcc/coroutine-passes.cc
+++ b/gcc/coroutine-passes.cc
@@ -116,7 +116,7 @@ lower_coro_builtin (gimple_stmt_iterator *gsi, bool *handled_ops_p,
psize = ROUND_UP (psize, align);
HOST_WIDE_INT offs = dir ? -psize : psize;
tree repl = build2 (POINTER_PLUS_EXPR, ptr_type_node, ptr,
- build_int_cst (sizetype, offs));
+ size_int (offs));
gassign *grpl = gimple_build_assign (lhs, repl);
gsi_replace (gsi, grpl, true);
*handled_ops_p = true;
@@ -135,7 +135,7 @@ lower_coro_builtin (gimple_stmt_iterator *gsi, bool *handled_ops_p,
tree fntype_ptr = build_pointer_type (fntype);
tree fntype_ppp = build_pointer_type (fntype_ptr);
tree indirect = fold_build2 (MEM_REF, fntype_ptr, ptr,
- wide_int_to_tree (fntype_ppp, offset));
+ build_int_cst (fntype_ppp, offset));
tree f_ptr_tmp = make_ssa_name (TYPE_MAIN_VARIANT (fntype_ptr));
gassign *get_fptr = gimple_build_assign (f_ptr_tmp, indirect);
gsi_insert_before (gsi, get_fptr, GSI_SAME_STMT);
@@ -158,12 +158,12 @@ lower_coro_builtin (gimple_stmt_iterator *gsi, bool *handled_ops_p,
tree ptr = gimple_call_arg (stmt, 0); /* frame ptr. */
tree vpp = build_pointer_type (ptr_type_node);
tree indirect
- = fold_build2 (MEM_REF, vpp, ptr, wide_int_to_tree (vpp, 0));
- tree d_ptr_tmp = make_ssa_name (TYPE_MAIN_VARIANT (ptr_type_node));
+ = fold_build2 (MEM_REF, vpp, ptr, build_int_cst (vpp, 0));
+ tree d_ptr_tmp = make_ssa_name (ptr_type_node);
gassign *get_dptr = gimple_build_assign (d_ptr_tmp, indirect);
gsi_insert_before (gsi, get_dptr, GSI_SAME_STMT);
tree done = fold_build2 (EQ_EXPR, boolean_type_node, d_ptr_tmp,
- wide_int_to_tree (ptr_type_node, 0));
+ null_pointer_node);
gassign *get_res = gimple_build_assign (lhs, done);
gsi_replace (gsi, get_res, true);
*handled_ops_p = true;