xref: /openbsd/gnu/usr.bin/gcc/gcc/f/storag.h (revision c87b03e5)
1 /* storag.h -- Public #include File (module.h template V1.0)
2    Copyright (C) 1995, 1996 Free Software Foundation, Inc.
3    Contributed by James Craig Burley.
4 
5 This file is part of GNU Fortran.
6 
7 GNU Fortran is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11 
12 GNU Fortran is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GNU Fortran; see the file COPYING.  If not, write to
19 the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA.
21 
22    Owning Modules:
23       storag.c
24 
25    Modifications:
26 */
27 
28 /* Allow multiple inclusion to work. */
29 
30 #ifndef GCC_F_STORAG_H
31 #define GCC_F_STORAG_H
32 
33 /* Simple definitions and enumerations. */
34 
35 typedef enum
36   {
37     FFESTORAG_typeNONE,
38     FFESTORAG_typeCBLOCK,	/* A COMMON block. */
39     FFESTORAG_typeCOMMON,	/* A COMMON variable. */
40     FFESTORAG_typeLOCAL,	/* A local entity (var/array/equivalence). */
41     FFESTORAG_typeEQUIV,	/* An entity equivalenced into a COMMON/LOCAL
42 				   entity. */
43     FFESTORAG_type
44   } ffestoragType;
45 
46 /* Typedefs. */
47 
48 typedef struct _ffestorag_ *ffestorag;
49 typedef struct _ffestorag_list_ *ffestoragList;
50 typedef struct _ffestorag_list_ ffestoragList_;
51 
52 /* Include files needed by this one. */
53 
54 #include "bld.h"
55 #include "info.h"
56 #include "symbol.h"
57 #include "target.h"
58 
59 /* Structure definitions. */
60 
61 struct _ffestorag_list_
62   {
63     ffestorag first;		/* First storage area in list. */
64     ffestorag last;		/* Last storage area in list. */
65   };
66 
67 struct _ffestorag_
68   {
69     ffestorag next;		/* Next storage area in list. */
70     ffestorag previous;		/* Previous storage area in list. */
71     ffestorag parent;		/* Parent who holds aggregate
72 				   initializations. */
73     ffebld init;		/* Initialization expression. */
74     ffebld accretion;		/* Initializations seen so far for aggregate. */
75     ffetargetOffset accretes;	/* # inits needed to fill entire aggregate. */
76     ffesymbol symbol;		/* NULL if typeLOCAL and non-NULL equivs
77 				   and the first "rooted" symbol not known. */
78     ffestoragList_ equivs_;	/* NULL if typeLOCAL and not an EQUIVALENCE
79 				   area. */
80     ffetargetOffset size;	/* Size of area. */
81     ffetargetOffset offset;	/* Offset of entity within area, 0 for CBLOCK
82 				   and non-equivalence LOCAL, <= 0 for equivalence
83 				   LOCAL. */
84     ffetargetAlign alignment;	/* Initial alignment for entity. */
85     ffetargetAlign modulo;	/* Modulo within alignment. */
86 #ifdef FFECOM_storageHOOK
87     ffecomStorage hook;		/* Whatever the backend needs here. */
88 #endif
89     ffestoragType type;
90     ffeinfoBasictype basic_type;/* NONE= >1 non-CHARACTER; ANY=
91 				   CHAR+non-CHAR. */
92     ffeinfoKindtype kind_type;	/* NONE= >1 kind type or NONE/ANY basic_type. */
93     ffesymbol type_symbol;	/* First symbol for basic_type/kind_type. */
94     bool is_save;		/* SAVE flag set for this storage area. */
95     bool is_init;		/* INIT flag set for this storage area. */
96   };
97 
98 /* Global objects accessed by users of this module. */
99 
100 extern ffestoragList_ ffestorag_list_;
101 
102 /* Declare functions with prototypes. */
103 
104 void ffestorag_drive (ffestoragList sl, void (*fn) (ffestorag mst, ffestorag st),
105 		      ffestorag mst);
106 void ffestorag_dump (ffestorag s);
107 void ffestorag_end_layout (ffesymbol s);
108 void ffestorag_exec_layout (ffesymbol s);
109 void ffestorag_init_2 (void);
110 ffestorag ffestorag_new (ffestoragList sl);
111 void ffestorag_report (void);
112 void ffestorag_update (ffestorag s, ffesymbol sym, ffeinfoBasictype bt,
113 		       ffeinfoKindtype kt);
114 void ffestorag_update_init (ffestorag s);
115 void ffestorag_update_save (ffestorag s);
116 
117 /* Define macros. */
118 
119 #define ffestorag_accretes(s) ((s)->accretes)
120 #define ffestorag_accretion(s) ((s)->accretion)
121 #define ffestorag_alignment(s) ((s)->alignment)
122 #define ffestorag_basictype(s) ((s)->basic_type)
123 #define ffestorag_hook(s) ((s)->hook)
124 #define ffestorag_init(s) ((s)->init)
125 #define ffestorag_init_0()
126 #define ffestorag_init_1()
127 #define ffestorag_init_3()
128 #define ffestorag_init_4()
129 #define ffestorag_is_init(s) ((s)->is_init)
130 #define ffestorag_is_save(s) ((s)->is_save)
131 #define ffestorag_kindtype(s) ((s)->kind_type)
132 #define ffestorag_list_equivs(s) (&(s)->equivs_)
133 #define ffestorag_list_master() (&ffestorag_list_)
134 #define ffestorag_modulo(s) ((s)->modulo)
135 #define ffestorag_offset(s) ((s)->offset)
136 #define ffestorag_parent(s) ((s)->parent)
137 #define ffestorag_ptr_to_alignment(s) (&(s)->alignment)
138 #define ffestorag_ptr_to_modulo(s) (&(s)->modulo)
139 #define ffestorag_set_accretes(s,a) ((s)->accretes = (a))
140 #define ffestorag_set_accretion(s,a) ((s)->accretion = (a))
141 #define ffestorag_set_alignment(s,a) ((s)->alignment = (a))
142 #define ffestorag_set_basictype(s,b) ((s)->basic_type = (b))
143 #define ffestorag_set_hook(s,h) ((s)->hook = (h))
144 #define ffestorag_set_init(s,i) ((s)->init = (i))
145 #define ffestorag_set_is_init(s,in) ((s)->is_init = (in))
146 #define ffestorag_set_is_save(s,sa) ((s)->is_save = (sa))
147 #define ffestorag_set_kindtype(s,k) ((s)->kind_type = (k))
148 #define ffestorag_set_modulo(s,m) ((s)->modulo = (m))
149 #define ffestorag_set_offset(s,o) ((s)->offset = (o))
150 #define ffestorag_set_parent(s,p) ((s)->parent = (p))
151 #define ffestorag_set_size(s,si) ((s)->size = (si))
152 #define ffestorag_set_symbol(s,sy) ((s)->symbol = (sy))
153 #define ffestorag_set_type(s,t) ((s)->type = (t))
154 #define ffestorag_set_typesymbol(s,sy) ((s)->type_symbol = (sy))
155 #define ffestorag_size(s) ((s)->size)
156 #define ffestorag_symbol(s) ((s)->symbol)
157 #define ffestorag_terminate_0()
158 #define ffestorag_terminate_1()
159 #define ffestorag_terminate_2()
160 #define ffestorag_terminate_3()
161 #define ffestorag_terminate_4()
162 #define ffestorag_type(s) ((s)->type)
163 #define ffestorag_typesymbol(s) ((s)->type_symbol)
164 
165 /* End of #include file. */
166 
167 #endif /* ! GCC_F_STORAG_H */
168