1/* This file contains the definitions and documentation for the
2   coroutines builtins used in GCC.
3
4   Copyright (C) 2018-2021 Free Software Foundation, Inc.
5
6 Contributed by Iain Sandoe <iain@sandoe.co.uk> under contract to Facebook.
7
8This file is part of GCC.
9
10GCC is free software; you can redistribute it and/or modify it under
11the terms of the GNU General Public License as published by the Free
12Software Foundation; either version 3, or (at your option) any later
13version.
14
15GCC is distributed in the hope that it will be useful, but WITHOUT ANY
16WARRANTY; without even the implied warranty of MERCHANTABILITY or
17FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
18for more details.
19
20You should have received a copy of the GNU General Public License
21along with GCC; see the file COPYING3.  If not see
22<http://www.gnu.org/licenses/>.  */
23
24/* Before including this file, you should define a macro:
25
26     DEF_BUILTIN_STUB(ENUM, NAME)
27     DEF_COROUTINE_BUILTIN (ENUM, NAME, TYPE, ATTRS)
28
29   See builtins.def for details.
30   The builtins are created used by library implementations of C++
31   coroutines.  */
32
33/* This has to come before all the coroutine builtins.  */
34DEF_BUILTIN_STUB (BEGIN_COROUTINE_BUILTINS, (const char *) 0)
35
36/* These are the builtins that are externally-visible and used by the
37   standard library implementation of the coroutine header.  */
38
39DEF_COROUTINE_BUILTIN (BUILT_IN_CORO_PROMISE, "promise",
40		       BT_FN_PTR_PTR_CONST_SIZE_BOOL,
41		       ATTR_CONST_NOTHROW_LEAF_LIST)
42
43DEF_COROUTINE_BUILTIN (BUILT_IN_CORO_RESUME, "resume", BT_FN_VOID_PTR,
44		       ATTR_NULL)
45
46DEF_COROUTINE_BUILTIN (BUILT_IN_CORO_DESTROY, "destroy", BT_FN_VOID_PTR,
47		       ATTR_NULL)
48
49DEF_COROUTINE_BUILTIN (BUILT_IN_CORO_DONE, "done", BT_FN_BOOL_PTR,
50		       ATTR_NOTHROW_LEAF_LIST)
51
52/* This has to come after all the coroutine builtins.  */
53DEF_BUILTIN_STUB (END_COROUTINE_BUILTINS, (const char *) 0)
54