1 /* com.h -- Public #include File (module.h template V1.0)
2 Copyright (C) 1995-1997 Free Software Foundation, Inc.
3 Contributed by James Craig Burley (burley@gnu.org).
5 This file is part of GNU Fortran.
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)
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.
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
28 /* Allow multiple inclusion to work. */
33 /* Simple definitions and enumerations. */
35 #define FFECOM_dimensionsMAX 7 /* Max # dimensions (quick hack). */
37 #define FFECOM_targetFFE 1
38 #define FFECOM_targetGCC 2
40 #ifndef FFE_STANDALONE
41 #define FFECOM_targetCURRENT FFECOM_targetGCC /* Backend! */
42 #define FFECOM_ONEPASS 0
44 #define FFECOM_targetCURRENT FFECOM_targetFFE
45 #define FFECOM_ONEPASS 0
49 #define FFECOM_TWOPASS 0
51 #define FFECOM_TWOPASS 1
54 #define FFECOM_SIZE_UNIT "byte" /* Singular form. */
55 #define FFECOM_SIZE_UNITS "bytes" /* Plural form. */
57 #if FFECOM_targetCURRENT == FFECOM_targetGCC
58 #define FFECOM_constantNULL NULL_TREE
59 #define FFECOM_globalNULL NULL_TREE
60 #define FFECOM_labelNULL NULL_TREE
61 #define FFECOM_storageNULL NULL_TREE
62 #define FFECOM_symbolNULL ffecom_symbol_null_
64 /* Shorthand for types used in f2c.h and that g77 perhaps allows some
65 flexibility regarding in the section below. I.e. the actual numbers
66 below aren't important, as long as they're unique. */
68 #define FFECOM_f2ccodeCHAR 1
69 #define FFECOM_f2ccodeSHORT 2
70 #define FFECOM_f2ccodeINT 3
71 #define FFECOM_f2ccodeLONG 4
72 #define FFECOM_f2ccodeLONGLONG 5
73 #define FFECOM_f2ccodeCHARPTR 6 /* char * */
74 #define FFECOM_f2ccodeFLOAT 7
75 #define FFECOM_f2ccodeDOUBLE 8
76 #define FFECOM_f2ccodeLONGDOUBLE 9
77 #define FFECOM_f2ccodeTWOREALS 10
78 #define FFECOM_f2ccodeTWODOUBLEREALS 11
80 #if FFECOM_DETERMINE_TYPES /* only for com.c and configure */
82 /* Begin f2c.h information. This must match the info in the f2c.h used
83 to build the libf2c with which g77-generated code is linked, or there
84 will probably be bugs, some of them difficult to detect or even trigger. */
88 /* Do we need int (for 32-bit or 64-bit systems) or long (16-bit or
89 normally 32-bit) for f2c-type integers? */
92 #define BITS_PER_WORD 32
95 #ifndef CHAR_TYPE_SIZE
96 #define CHAR_TYPE_SIZE BITS_PER_UNIT
99 #ifndef SHORT_TYPE_SIZE
100 #define SHORT_TYPE_SIZE (BITS_PER_UNIT * MIN ((UNITS_PER_WORD + 1) / 2, 2))
103 #ifndef INT_TYPE_SIZE
104 #define INT_TYPE_SIZE BITS_PER_WORD
107 #ifndef LONG_TYPE_SIZE
108 #define LONG_TYPE_SIZE BITS_PER_WORD
111 #ifndef LONG_LONG_TYPE_SIZE
112 #define LONG_LONG_TYPE_SIZE (BITS_PER_WORD * 2)
115 #ifndef WCHAR_UNSIGNED
116 #define WCHAR_UNSIGNED 0
119 #ifndef FLOAT_TYPE_SIZE
120 #define FLOAT_TYPE_SIZE BITS_PER_WORD
123 #ifndef DOUBLE_TYPE_SIZE
124 #define DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
127 #ifndef LONG_DOUBLE_TYPE_SIZE
128 #define LONG_DOUBLE_TYPE_SIZE (BITS_PER_WORD * 2)
131 #if LONG_TYPE_SIZE == FLOAT_TYPE_SIZE
132 # define FFECOM_f2cINTEGER FFECOM_f2ccodeLONG
133 # define FFECOM_f2cLOGICAL FFECOM_f2ccodeLONG
134 #elif INT_TYPE_SIZE == FLOAT_TYPE_SIZE
135 # define FFECOM_f2cINTEGER FFECOM_f2ccodeINT
136 # define FFECOM_f2cLOGICAL FFECOM_f2ccodeINT
138 # error Cannot find a suitable type for FFECOM_f2cINTEGER
141 #if LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2)
142 # define FFECOM_f2cLONGINT FFECOM_f2ccodeLONG
143 #elif LONG_LONG_TYPE_SIZE == (FLOAT_TYPE_SIZE * 2)
144 # define FFECOM_f2cLONGINT FFECOM_f2ccodeLONGLONG
146 # error Cannot find a suitable type for FFECOM_f2cLONGINT
149 #define FFECOM_f2cADDRESS FFECOM_f2ccodeCHARPTR
150 #define FFECOM_f2cSHORTINT FFECOM_f2ccodeSHORT
151 #define FFECOM_f2cREAL FFECOM_f2ccodeFLOAT
152 #define FFECOM_f2cDOUBLEREAL FFECOM_f2ccodeDOUBLE
153 #define FFECOM_f2cCOMPLEX FFECOM_f2ccodeTWOREALS
154 #define FFECOM_f2cDOUBLECOMPLEX FFECOM_f2ccodeTWODOUBLEREALS
155 #define FFECOM_f2cSHORTLOGICAL FFECOM_f2ccodeSHORT
156 #define FFECOM_f2cLOGICAL1 FFECOM_f2ccodeCHAR
157 #define FFECOM_f2cINTEGER1 FFECOM_f2ccodeCHAR
159 /* These must be f2c's INTEGER type, to match runtime/f2c.h.in. */
161 #define FFECOM_f2cFLAG FFECOM_f2cINTEGER
162 #define FFECOM_f2cFTNINT FFECOM_f2cINTEGER
163 #define FFECOM_f2cFTNLEN FFECOM_f2cINTEGER
165 #endif /* #if FFECOM_DETERMINE_TYPES */
167 /* Everything else in f2c.h, specifically the structures used in
168 interfacing compiled code with the library, must remain exactly
169 as delivered, or g77 internals (mostly com.c and ste.c) must
170 be modified accordingly to compensate. Or there will be...trouble. */
174 #define DEFGFRT(CODE,NAME,TYPE,ARGS,VOLATILE,COMPLEX) CODE,
175 #include "com-rt.def"
180 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
184 #if FFECOM_targetCURRENT == FFECOM_targetGCC
189 #ifndef BUILT_FOR_270
190 #ifdef DECL_STATIC_CONSTRUCTOR /* In gcc/tree.h. */
191 #define BUILT_FOR_270 1
193 #define BUILT_FOR_270 0
195 #endif /* !defined (BUILT_FOR_270) */
197 #ifndef BUILT_FOR_280
198 #ifdef DECL_ONE_ONLY /* In gcc/tree.h. */
199 #define BUILT_FOR_280 1
201 #define BUILT_FOR_280 0
203 #endif /* !defined (BUILT_FOR_280) */
205 typedef tree ffecomConstant
;
206 #define FFECOM_constantHOOK
207 typedef tree ffecomLabel
;
208 #define FFECOM_globalHOOK
209 typedef tree ffecomGlobal
;
210 #define FFECOM_labelHOOK
211 typedef tree ffecomStorage
;
212 #define FFECOM_storageHOOK
213 typedef struct _ffecom_symbol_ ffecomSymbol
;
214 #define FFECOM_symbolHOOK
216 struct _ffecom_symbol_
219 tree length_tree
; /* For CHARACTER dummies. */
220 tree vardesc_tree
; /* For NAMELIST. */
221 tree assign_tree
; /* For ASSIGN'ed vars. */
222 bool addr
; /* Is address of item instead of item. */
224 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
226 /* Include files needed by this one. */
234 /* Structure definitions. */
237 /* Global objects accessed by users of this module. */
239 #if FFECOM_targetCURRENT == FFECOM_targetGCC
240 extern tree long_integer_type_node
;
241 extern tree complex_double_type_node
;
242 extern tree string_type_node
;
243 extern tree ffecom_integer_type_node
;
244 extern tree ffecom_integer_zero_node
;
245 extern tree ffecom_integer_one_node
;
246 extern tree ffecom_tree_type
[FFEINFO_basictype
][FFEINFO_kindtype
];
247 extern ffecomSymbol ffecom_symbol_null_
;
248 extern ffeinfoKindtype ffecom_pointer_kind_
;
249 extern ffeinfoKindtype ffecom_label_kind_
;
251 extern int ffecom_f2c_typecode_
[FFEINFO_basictype
][FFEINFO_kindtype
];
252 extern tree ffecom_f2c_integer_type_node
;
253 extern tree ffecom_f2c_address_type_node
;
254 extern tree ffecom_f2c_real_type_node
;
255 extern tree ffecom_f2c_doublereal_type_node
;
256 extern tree ffecom_f2c_complex_type_node
;
257 extern tree ffecom_f2c_doublecomplex_type_node
;
258 extern tree ffecom_f2c_longint_type_node
;
259 extern tree ffecom_f2c_logical_type_node
;
260 extern tree ffecom_f2c_flag_type_node
;
261 extern tree ffecom_f2c_ftnlen_type_node
;
262 extern tree ffecom_f2c_ftnlen_zero_node
;
263 extern tree ffecom_f2c_ftnlen_one_node
;
264 extern tree ffecom_f2c_ftnlen_two_node
;
265 extern tree ffecom_f2c_ptr_to_ftnlen_type_node
;
266 extern tree ffecom_f2c_ftnint_type_node
;
267 extern tree ffecom_f2c_ptr_to_ftnint_type_node
;
268 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
270 /* Declare functions with prototypes. */
272 #if FFECOM_targetCURRENT == FFECOM_targetGCC
273 tree
ffecom_1 (enum tree_code code
, tree type
, tree node
);
274 tree
ffecom_1_fn (tree node
);
275 tree
ffecom_2 (enum tree_code code
, tree type
, tree node1
, tree node2
);
276 bool ffecom_2pass_advise_entrypoint (ffesymbol entry
);
277 void ffecom_2pass_do_entrypoint (ffesymbol entry
);
278 tree
ffecom_2s (enum tree_code code
, tree type
, tree node1
, tree node2
);
279 tree
ffecom_3 (enum tree_code code
, tree type
, tree node1
, tree node2
,
281 tree
ffecom_3s (enum tree_code code
, tree type
, tree node1
, tree node2
,
283 tree
ffecom_arg_expr (ffebld expr
, tree
*length
);
284 tree
ffecom_arg_ptr_to_expr (ffebld expr
, tree
*length
);
285 tree
ffecom_call_gfrt (ffecomGfrt ix
, tree args
);
286 tree
ffecom_constantunion (ffebldConstantUnion
*cu
, ffeinfoBasictype bt
,
287 ffeinfoKindtype kt
, tree tree_type
);
288 tree
ffecom_decl_field (tree context
, tree prevfield
, char *name
,
290 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
291 void ffecom_close_include (FILE *f
);
292 int ffecom_decode_include_option (char *spec
);
293 void ffecom_end_transition (void);
294 void ffecom_exec_transition (void);
295 void ffecom_expand_let_stmt (ffebld dest
, ffebld source
);
296 #if FFECOM_targetCURRENT == FFECOM_targetGCC
297 tree
ffecom_expr (ffebld expr
);
298 tree
ffecom_expr_assign (ffebld expr
);
299 tree
ffecom_expr_assign_w (ffebld expr
);
300 tree
ffecom_expr_rw (ffebld expr
);
301 void ffecom_finish_compile (void);
302 void ffecom_finish_decl (tree decl
, tree init
, bool is_top_level
);
303 void ffecom_finish_progunit (void);
304 tree
ffecom_get_invented_identifier (char *pattern
, char *text
,
306 ffeinfoKindtype
ffecom_gfrt_basictype (ffecomGfrt ix
);
307 ffeinfoKindtype
ffecom_gfrt_kindtype (ffecomGfrt ix
);
308 void ffecom_init_0 (void);
309 void ffecom_init_2 (void);
310 tree
ffecom_list_expr (ffebld list
);
311 tree
ffecom_list_ptr_to_expr (ffebld list
);
312 tree
ffecom_lookup_label (ffelab label
);
313 tree
ffecom_modify (tree newtype
, tree lhs
, tree rhs
);
314 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
315 void ffecom_file (char *name
);
316 void ffecom_notify_init_storage (ffestorag st
);
317 void ffecom_notify_init_symbol (ffesymbol s
);
318 void ffecom_notify_primary_entry (ffesymbol fn
);
319 FILE *ffecom_open_include (char *name
, ffewhereLine l
, ffewhereColumn c
);
320 #if FFECOM_targetCURRENT == FFECOM_targetGCC
321 void ffecom_pop_calltemps (void);
322 void ffecom_pop_tempvar (tree var
);
323 tree
ffecom_ptr_to_expr (ffebld expr
);
324 void ffecom_push_calltemps (void);
325 tree
ffecom_push_tempvar (tree type
, ffetargetCharacterSize size
,
326 int elements
, bool auto_pop
);
327 tree
ffecom_return_expr (ffebld expr
);
328 tree
ffecom_save_tree (tree t
);
329 tree
ffecom_start_decl (tree decl
, bool is_init
);
330 void ffecom_sym_commit (ffesymbol s
);
331 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
332 ffesymbol
ffecom_sym_end_transition (ffesymbol s
);
333 ffesymbol
ffecom_sym_exec_transition (ffesymbol s
);
334 ffesymbol
ffecom_sym_learned (ffesymbol s
);
335 #if FFECOM_targetCURRENT == FFECOM_targetGCC
336 void ffecom_sym_retract (ffesymbol s
);
337 tree
ffecom_temp_label (void);
338 tree
ffecom_truth_value (tree expr
);
339 tree
ffecom_truth_value_invert (tree expr
);
340 tree
ffecom_which_entrypoint_decl (void);
341 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
343 /* ~~~Eliminate these when possible, since the back end should be
344 declaring them in some .h file. */
346 #if FFECOM_targetCURRENT == FFECOM_targetGCC
347 extern int flag_pedantic_errors
;
348 void emit_nop (void);
349 void announce_function (tree decl
);
350 extern FILE *asm_out_file
;
351 void assemble_string (char *, int);
352 void assemble_variable (tree decl
, int top_level
, int at_end
,
353 int dont_output_data
);
354 void assemble_zeros (int size
);
355 int count_error (int warningp
);
356 void error (char *s
, ...);
357 void expand_decl (tree decl
);
358 void expand_computed_goto (tree exp
);
359 void expand_function_end (char *filename
, int line
, int end_bindings
);
360 void expand_function_start (tree subr
, int parms_have_cleanups
);
361 void expand_main_function (void);
362 void fatal (char *s
, ...);
363 void init_function_start (tree subr
, char *filename
, int line
);
364 void make_function_rtl (tree decl
);
365 void make_decl_rtl (tree decl
, char *asmspec
, int top_level
);
366 void make_var_volatile (tree var
);
367 int mark_addressable (tree expr
);
368 void output_inline_function (tree fndecl
);
369 void pedwarn (char *s
, ...);
370 void pop_function_context (void);
371 void pop_momentary_nofree (void);
372 void preserve_initializer (void);
373 void print_node (FILE *file
, char *prefix
, tree node
, int indent
);
374 void push_function_context (void);
375 void push_obstacks (struct obstack
*current
, struct obstack
*saveable
);
376 void put_var_into_stack (tree decl
);
377 void remember_end_note (tree block
);
378 void report_error_function (char *file
);
379 void rest_of_compilation (tree decl
);
380 void rest_of_decl_compilation (tree decl
, char *asmspec
, int top_level
,
382 void resume_temporary_allocation (void);
383 void set_identifier_size (int size
);
384 void temporary_allocation (void);
385 tree
truthvalue_conversion (tree expr
);
386 void warning_with_decl (tree decl
, char *s
, ...);
387 void warning (char *s
, ...);
388 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
392 #if FFECOM_targetCURRENT == FFECOM_targetFFE
393 #define ffecom_expr(e) (e)
394 #define ffecom_init_0()
395 #define ffecom_init_2()
396 #define ffecom_label_kind() FFEINFO_kindtypeINTEGERDEFAULT
397 #define ffecom_pointer_kind() FFEINFO_kindtypeINTEGERDEFAULT
398 #define ffecom_ptr_to_expr(e) (e)
399 #define ffecom_sym_commit(s)
400 #define ffecom_sym_retract(s)
401 #endif /* FFECOM_targetCURRENT == FFECOM_targetFFE */
403 #if FFECOM_targetCURRENT == FFECOM_targetGCC
404 #define ffecom_f2c_typecode(bt,kt) ffecom_f2c_typecode_[(bt)][(kt)]
405 #define ffecom_label_kind() ffecom_label_kind_
406 #define ffecom_pointer_kind() ffecom_pointer_kind_
407 #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
409 #define ffecom_init_1()
410 #define ffecom_init_3()
411 #define ffecom_init_4()
412 #define ffecom_terminate_0()
413 #define ffecom_terminate_1()
414 #define ffecom_terminate_2()
415 #define ffecom_terminate_3()
416 #define ffecom_terminate_4()
418 /* End of #include file. */