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