PR rtl-optimization/43520
[official-gcc.git] / gcc / fortran / constructor.h
blob1f7d78388f8bea011d05466f7c80bed470e8e5d3
1 /* Array and structure constructors
2 Copyright (C) 2009, 2010
3 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 #ifndef GFC_CONSTRUCTOR_H
22 #define GFC_CONSTRUCTOR_H
24 #include "gfortran.h"
25 #include "splay-tree.h"
28 /* Get a new constructor structure. */
29 gfc_constructor *gfc_constructor_get (void);
31 gfc_constructor_base gfc_constructor_get_base (void);
33 /* Copy a constructor structure. */
34 gfc_constructor_base gfc_constructor_copy (gfc_constructor_base base);
37 /* Free a gfc_constructor structure. */
38 void gfc_constructor_free (gfc_constructor_base base);
41 /* Given an constructor structure, append the expression node onto
42 the constructor. Returns the constructor node appended. */
43 gfc_constructor *gfc_constructor_append (gfc_constructor_base *base,
44 gfc_constructor *c);
46 gfc_constructor *gfc_constructor_append_expr (gfc_constructor_base *base,
47 gfc_expr *e, locus *where);
50 /* Given an constructor structure, place the expression node at position.
51 Returns the constructor node inserted. */
52 gfc_constructor *gfc_constructor_insert (gfc_constructor_base *base,
53 gfc_constructor *c, int n);
55 gfc_constructor *gfc_constructor_insert_expr (gfc_constructor_base *base,
56 gfc_expr *e, locus *where,
57 int n);
59 /* Given an array constructor expression and an element number (starting
60 at zero), return a pointer to the array element. NULL is returned if
61 the size of the array has been exceeded. The expression node returned
62 remains a part of the array and should not be freed. */
64 gfc_constructor *gfc_constructor_lookup (gfc_constructor_base base, int n);
66 /* Convenience function. Same as ...
67 gfc_constructor *c = gfc_constructor_lookup (base, n);
68 gfc_expr *e = c ? c->expr : NULL;
70 gfc_expr *gfc_constructor_lookup_expr (gfc_constructor_base base, int n);
73 int gfc_constructor_expr_foreach (gfc_constructor *ctor, int(*)(gfc_expr *));
76 void gfc_constructor_swap (gfc_constructor *ctor, int n, int m);
80 /* Get the first constructor node in the constructure structure.
81 Returns NULL if there is no such expression. */
82 gfc_constructor *gfc_constructor_first (gfc_constructor_base base);
84 /* Get the next constructor node in the constructure structure.
85 Returns NULL if there is no next expression. */
86 gfc_constructor *gfc_constructor_next (gfc_constructor *ctor);
88 gfc_constructor *gfc_constructor_advance (gfc_constructor *ctor, int n);
90 #endif /* GFC_CONSTRUCTOR_H */