diff options
author | Iain Sandoe <iain@sandoe.co.uk> | 2019-11-29 20:47:39 +0000 |
---|---|---|
committer | Iain Sandoe <iain@sandoe.co.uk> | 2019-11-29 20:47:39 +0000 |
commit | 842e4c3d332b27ed4e3ceb1e9a8e2e4319a7e1d6 (patch) | |
tree | 93464485a618b815f891ce7e7eaa81d6961c8223 | |
parent | da55727d6140ea0a0fc5eaa9135c4ed3cbad73af (diff) |
c++-coroutines - Address review comments, use ptr_type_node.
Instead of building the equivalent.
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.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/c++-coroutines@278861 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | ChangeLog.coroutines | 6 | ||||
-rw-r--r-- | gcc/coroutine-passes.cc | 19 |
2 files changed, 15 insertions, 10 deletions
diff --git a/ChangeLog.coroutines b/ChangeLog.coroutines index 9d1d738beff..64a0ab88316 100644 --- a/ChangeLog.coroutines +++ b/ChangeLog.coroutines @@ -1,3 +1,9 @@ +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. + 2019-11-27 Iain Sandoe <iain@sandoe.co.uk> libstdc++-v3/ diff --git a/gcc/coroutine-passes.cc b/gcc/coroutine-passes.cc index 33e1d3840fc..310ff1eda48 100644 --- a/gcc/coroutine-passes.cc +++ b/gcc/coroutine-passes.cc @@ -107,15 +107,15 @@ lower_coro_builtin (gimple_stmt_iterator *gsi, bool *handled_ops_p, gcc_assert (TREE_CODE (align_t) == INTEGER_CST); gcc_assert (TREE_CODE (from) == INTEGER_CST); bool dir = wi::to_wide (from) != 0; - tree vptr = build_pointer_type (void_type_node); HOST_WIDE_INT promise_align = TREE_INT_CST_LOW (align_t); - HOST_WIDE_INT psize = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (vptr)); - HOST_WIDE_INT align = TYPE_ALIGN_UNIT (vptr); + HOST_WIDE_INT psize = + TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ptr_type_node)); + HOST_WIDE_INT align = TYPE_ALIGN_UNIT (ptr_type_node); align = MAX (align, promise_align); psize *= 2; /* Start with two pointers. */ psize = ROUND_UP (psize, align); HOST_WIDE_INT offs = dir ? -psize : psize; - tree repl = build2 (POINTER_PLUS_EXPR, vptr, ptr, + tree repl = build2 (POINTER_PLUS_EXPR, ptr_type_node, ptr, build_int_cst (sizetype, offs)); gassign *grpl = gimple_build_assign (lhs, repl); gsi_replace (gsi, grpl, true); @@ -128,8 +128,8 @@ lower_coro_builtin (gimple_stmt_iterator *gsi, bool *handled_ops_p, case BUILT_IN_CORO_RESUME: { tree ptr = gimple_call_arg (stmt, 0); /* frame ptr. */ - tree vptr = build_pointer_type (void_type_node); - HOST_WIDE_INT psize = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (vptr)); + HOST_WIDE_INT psize = + TREE_INT_CST_LOW (TYPE_SIZE_UNIT (ptr_type_node)); HOST_WIDE_INT offset = call_idx * psize; tree fntype = TREE_TYPE (decl); tree fntype_ptr = build_pointer_type (fntype); @@ -156,15 +156,14 @@ lower_coro_builtin (gimple_stmt_iterator *gsi, bool *handled_ops_p, } /* When we're done, the resume fn is set to NULL. */ tree ptr = gimple_call_arg (stmt, 0); /* frame ptr. */ - tree vptr = build_pointer_type (void_type_node); - tree vpp = build_pointer_type (vptr); + 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 (vptr)); + tree d_ptr_tmp = make_ssa_name (TYPE_MAIN_VARIANT (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 (vptr, 0)); + wide_int_to_tree (ptr_type_node, 0)); gassign *get_res = gimple_build_assign (lhs, done); gsi_replace (gsi, get_res, true); *handled_ops_p = true; |