1/* Header file for Nested function decomposition for GIMPLE.
2 Copyright (C) 2013-2023 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef GCC_TREE_NESTED_H
21#define GCC_TREE_NESTED_H
22
23extern tree build_addr (tree);
24extern void insert_field_into_struct (tree, tree);
25extern void lower_nested_functions (tree);
26
27class nested_function_info
28{
29public:
30 /* Constructor. */
31 nested_function_info ()
32 : origin (NULL),
33 nested (NULL),
34 next_nested (NULL)
35 {
36 }
37 /* Copy constructor. We can not simply copy the structure,
38 because the linked lists would go wrong. However we should never
39 need that. */
40 nested_function_info (const nested_function_info &)
41 {
42 gcc_unreachable ();
43 }
44 ~nested_function_info ();
45
46 /* Return nested_function_info, if available. */
47 static nested_function_info *get (cgraph_node *node);
48
49 /* Return nested_function_info possibly creating new one. */
50 static nested_function_info *get_create (cgraph_node *node);
51
52 /* Release all nested_function_infos. */
53 static void release (void);
54
55 /* For nested functions points to function the node is nested in. */
56 cgraph_node *origin;
57 /* Points to first nested function, if any. */
58 cgraph_node *nested;
59 /* Pointer to the next function with same origin, if any. */
60 cgraph_node *next_nested;
61};
62
63extern void maybe_record_nested_function (cgraph_node *node);
64extern void unnest_function (cgraph_node *node);
65
66/* If there are functions nested in NODE, return first one. */
67inline cgraph_node *
68first_nested_function (cgraph_node *node)
69{
70 nested_function_info *info = nested_function_info::get (node);
71 return info ? info->nested : NULL;
72}
73
74/* Return next nested function (used to iterate from first_nested_function). */
75inline cgraph_node *
76next_nested_function (cgraph_node *node)
77{
78 return nested_function_info::get (node)->next_nested;
79}
80
81/* Return origin of nested function (and NULL otherwise). */
82inline cgraph_node *
83nested_function_origin (cgraph_node *node)
84{
85 nested_function_info *info = nested_function_info::get (node);
86 return info ? info->origin : NULL;
87}
88
89#endif /* GCC_TREE_NESTED_H */
90

source code of gcc/tree-nested.h