1 /* G95 Backend interface
2 Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation,
4 Contributed by Paul Brook.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 /* f95-lang.c-- GCC backend interface stuff */
25 /* declare required prototypes: */
30 #include "coretypes.h"
32 #include "tree-gimple.h"
34 #include "langhooks.h"
35 #include "langhooks-def.h"
43 #include "diagnostic.h"
44 #include "tree-dump.h"
49 #include "trans-types.h"
50 #include "trans-const.h"
55 /* Language-dependent contents of an identifier. */
57 struct lang_identifier
60 struct tree_identifier common
;
63 /* The resulting tree type. */
66 GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE")))
68 union tree_node
GTY((tag ("0"),
69 desc ("tree_node_structure (&%h)"))) generic
;
70 struct lang_identifier
GTY((tag ("1"))) identifier
;
73 /* Save and restore the variables in this file and elsewhere
74 that keep track of the progress of compilation of the current function.
75 Used for nested functions. */
77 struct language_function
80 /* struct gfc_language_function base; */
84 int returns_abnormally
;
85 int warn_about_return_type
;
87 struct binding_level
*binding_level
;
90 /* We don't have a lex/yacc lexer/parser, but toplev expects these to
92 void yyerror (const char *str
);
95 static void gfc_init_decl_processing (void);
96 static void gfc_init_builtin_functions (void);
98 /* Each front end provides its own. */
99 static bool gfc_init (void);
100 static void gfc_finish (void);
101 static void gfc_print_identifier (FILE *, tree
, int);
102 static bool gfc_mark_addressable (tree
);
103 void do_function_end (void);
104 int global_bindings_p (void);
105 void insert_block (tree
);
106 static void gfc_clear_binding_stack (void);
107 static void gfc_be_parse_file (int);
108 static void gfc_expand_function (tree
);
110 #undef LANG_HOOKS_NAME
111 #undef LANG_HOOKS_INIT
112 #undef LANG_HOOKS_FINISH
113 #undef LANG_HOOKS_INIT_OPTIONS
114 #undef LANG_HOOKS_HANDLE_OPTION
115 #undef LANG_HOOKS_POST_OPTIONS
116 #undef LANG_HOOKS_PRINT_IDENTIFIER
117 #undef LANG_HOOKS_PARSE_FILE
118 #undef LANG_HOOKS_TRUTHVALUE_CONVERSION
119 #undef LANG_HOOKS_MARK_ADDRESSABLE
120 #undef LANG_HOOKS_TYPE_FOR_MODE
121 #undef LANG_HOOKS_TYPE_FOR_SIZE
122 #undef LANG_HOOKS_UNSIGNED_TYPE
123 #undef LANG_HOOKS_SIGNED_TYPE
124 #undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
125 #undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
126 #undef LANG_HOOKS_CLEAR_BINDING_STACK
128 /* Define lang hooks. */
129 #define LANG_HOOKS_NAME "GNU F95"
130 #define LANG_HOOKS_INIT gfc_init
131 #define LANG_HOOKS_FINISH gfc_finish
132 #define LANG_HOOKS_INIT_OPTIONS gfc_init_options
133 #define LANG_HOOKS_HANDLE_OPTION gfc_handle_option
134 #define LANG_HOOKS_POST_OPTIONS gfc_post_options
135 #define LANG_HOOKS_PRINT_IDENTIFIER gfc_print_identifier
136 #define LANG_HOOKS_PARSE_FILE gfc_be_parse_file
137 #define LANG_HOOKS_TRUTHVALUE_CONVERSION gfc_truthvalue_conversion
138 #define LANG_HOOKS_MARK_ADDRESSABLE gfc_mark_addressable
139 #define LANG_HOOKS_TYPE_FOR_MODE gfc_type_for_mode
140 #define LANG_HOOKS_TYPE_FOR_SIZE gfc_type_for_size
141 #define LANG_HOOKS_UNSIGNED_TYPE gfc_unsigned_type
142 #define LANG_HOOKS_SIGNED_TYPE gfc_signed_type
143 #define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE gfc_signed_or_unsigned_type
144 #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION gfc_expand_function
145 #define LANG_HOOKS_CLEAR_BINDING_STACK gfc_clear_binding_stack
147 const struct lang_hooks lang_hooks
= LANG_HOOKS_INITIALIZER
;
149 /* A list (chain of TREE_LIST nodes) of all LABEL_DECLs in the function
150 that have names. Here so we can clear out their names' definitions
151 at the end of the function. */
153 /* Tree code classes. */
155 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE,
157 const char tree_code_type
[] = {
162 /* Table indexed by tree code giving number of expression
163 operands beyond the fixed part of the node structure.
164 Not used for types or decls. */
166 #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH,
168 const unsigned char tree_code_length
[] = {
173 /* Names of tree components.
174 Used for printing out the tree and error messages. */
175 #define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME,
177 const char *const tree_code_name
[] = {
182 static tree named_labels
;
184 #define NULL_BINDING_LEVEL (struct binding_level *) NULL
186 /* A chain of binding_level structures awaiting reuse. */
188 static GTY(()) struct binding_level
*free_binding_level
;
190 /* The elements of `ridpointers' are identifier nodes
191 for the reserved type names and storage classes.
192 It is indexed by a RID_... value. */
193 tree
*ridpointers
= NULL
;
195 /* language-specific flags. */
198 gfc_expand_function (tree fndecl
)
200 tree_rest_of_compilation (fndecl
, 0);
204 /* Prepare expr to be an argument of a TRUTH_NOT_EXPR,
205 or validate its data type for an `if' or `while' statement or ?..: exp.
207 This preparation consists of taking the ordinary
208 representation of an expression expr and producing a valid tree
209 boolean expression describing whether expr is nonzero. We could
210 simply always do build_binary_op (NE_EXPR, expr, boolean_false_node, 1),
211 but we optimize comparisons, &&, ||, and !.
213 The resulting type should always be `boolean_type_node'.
214 This is much simpler than the corresponding C version because we have a
215 distinct boolean type. */
218 gfc_truthvalue_conversion (tree expr
)
220 switch (TREE_CODE (TREE_TYPE (expr
)))
223 if (TREE_TYPE (expr
) == boolean_type_node
)
225 else if (TREE_CODE_CLASS (TREE_CODE (expr
)) == '<')
227 TREE_TYPE (expr
) = boolean_type_node
;
230 else if (TREE_CODE (expr
) == NOP_EXPR
)
231 return build1 (NOP_EXPR
, boolean_type_node
,
232 TREE_OPERAND (expr
, 0));
234 return build1 (NOP_EXPR
, boolean_type_node
, expr
);
237 if (TREE_CODE (expr
) == INTEGER_CST
)
238 return integer_zerop (expr
) ? boolean_false_node
: boolean_true_node
;
240 return build (NE_EXPR
, boolean_type_node
, expr
, integer_zero_node
);
243 internal_error ("Unexpected type in truthvalue_conversion");
248 gfc_create_decls (void)
251 gfc_init_builtin_functions ();
253 /* Runtime/IO library functions. */
254 gfc_build_builtin_function_decls ();
256 gfc_init_constants ();
260 gfc_be_parse_file (int set_yydebug ATTRIBUTE_UNUSED
)
267 gfc_generate_constructors ();
269 cgraph_finalize_compilation_unit ();
272 /* Tell the frontent about any errors. */
273 gfc_get_errors (&warnings
, &errors
);
274 errorcount
+= errors
;
275 warningcount
+= warnings
;
278 /* Initialize everything. */
283 /* First initialize the backend. */
284 gfc_init_decl_processing ();
285 gfc_static_ctors
= NULL_TREE
;
287 /* Then the frontend. */
290 if (gfc_new_file (gfc_option
.source
, gfc_option
.source_form
) != SUCCESS
)
291 fatal_error ("can't open input file: %s", gfc_option
.source
);
300 gfc_release_include_path ();
305 gfc_print_identifier (FILE * file ATTRIBUTE_UNUSED
,
306 tree node ATTRIBUTE_UNUSED
,
307 int indent ATTRIBUTE_UNUSED
)
313 /* These functions and variables deal with binding contours. We only
314 need these functions for the list of PARM_DECLs, but we leave the
315 functions more general; these are a simplified version of the
316 functions from GNAT. */
318 /* For each binding contour we allocate a binding_level structure which records
319 the entities defined or declared in that contour. Contours include:
322 one for each subprogram definition
323 one for each compound statement (declare block)
325 Binding contours are used to create GCC tree BLOCK nodes. */
330 /* A chain of ..._DECL nodes for all variables, constants, functions,
331 parameters and type declarations. These ..._DECL nodes are chained
332 through the TREE_CHAIN field. Note that these ..._DECL nodes are stored
333 in the reverse of the order supplied to be compatible with the
336 /* For each level (except the global one), a chain of BLOCK nodes for all
337 the levels that were entered and exited one level down from this one. */
339 /* The binding level containing this one (the enclosing binding level). */
340 struct binding_level
*level_chain
;
343 /* The binding level currently in effect. */
344 static GTY(()) struct binding_level
*current_binding_level
= NULL
;
346 /* The outermost binding level. This binding level is created when the
347 compiler is started and it will exist through the entire compilation. */
348 static GTY(()) struct binding_level
*global_binding_level
;
350 /* Binding level structures are initialized by copying this one. */
351 static struct binding_level clear_binding_level
= { NULL
, NULL
, NULL
};
353 /* Return non-zero if we are currently in the global binding level. */
356 global_bindings_p (void)
358 return current_binding_level
== global_binding_level
? -1 : 0;
364 return current_binding_level
->names
;
367 /* Enter a new binding level. The input parameter is ignored, but has to be
368 specified for back-end compatibility. */
371 pushlevel (int ignore ATTRIBUTE_UNUSED
)
373 struct binding_level
*newlevel
374 = (struct binding_level
*) ggc_alloc (sizeof (struct binding_level
));
376 *newlevel
= clear_binding_level
;
378 /* Add this level to the front of the chain (stack) of levels that are
380 newlevel
->level_chain
= current_binding_level
;
381 current_binding_level
= newlevel
;
384 /* Exit a binding level.
385 Pop the level off, and restore the state of the identifier-decl mappings
386 that were in effect when this level was entered.
388 If KEEP is nonzero, this level had explicit declarations, so
389 and create a "block" (a BLOCK node) for the level
390 to record its declarations and subblocks for symbol table output.
392 If FUNCTIONBODY is nonzero, this level is the body of a function,
393 so create a block as if KEEP were set and also clear out all
396 If REVERSE is nonzero, reverse the order of decls before putting
397 them into the BLOCK. */
400 poplevel (int keep
, int reverse
, int functionbody
)
402 /* Points to a BLOCK tree node. This is the BLOCK node construted for the
403 binding level that we are about to exit and which is returned by this
405 tree block_node
= NULL_TREE
;
407 tree subblock_chain
= current_binding_level
->blocks
;
410 /* Reverse the list of XXXX_DECL nodes if desired. Note that the ..._DECL
411 nodes chained through the `names' field of current_binding_level are in
412 reverse order except for PARM_DECL node, which are explicitely stored in
414 decl_chain
= (reverse
) ? nreverse (current_binding_level
->names
)
415 : current_binding_level
->names
;
417 /* If there were any declarations in the current binding level, or if this
418 binding level is a function body, or if there are any nested blocks then
419 create a BLOCK node to record them for the life of this function. */
420 if (keep
|| functionbody
)
421 block_node
= build_block (keep
? decl_chain
: 0, 0, subblock_chain
, 0, 0);
423 /* Record the BLOCK node just built as the subblock its enclosing scope. */
424 for (subblock_node
= subblock_chain
; subblock_node
;
425 subblock_node
= TREE_CHAIN (subblock_node
))
426 BLOCK_SUPERCONTEXT (subblock_node
) = block_node
;
428 /* Clear out the meanings of the local variables of this level. */
430 for (subblock_node
= decl_chain
; subblock_node
;
431 subblock_node
= TREE_CHAIN (subblock_node
))
432 if (DECL_NAME (subblock_node
) != 0)
433 /* If the identifier was used or addressed via a local extern decl,
434 don't forget that fact. */
435 if (DECL_EXTERNAL (subblock_node
))
437 if (TREE_USED (subblock_node
))
438 TREE_USED (DECL_NAME (subblock_node
)) = 1;
439 if (TREE_ADDRESSABLE (subblock_node
))
440 TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (subblock_node
)) = 1;
443 /* Pop the current level. */
444 current_binding_level
= current_binding_level
->level_chain
;
448 /* This is the top level block of a function. The ..._DECL chain stored
449 in BLOCK_VARS are the function's parameters (PARM_DECL nodes). Don't
450 leave them in the BLOCK because they are found in the FUNCTION_DECL
452 DECL_INITIAL (current_function_decl
) = block_node
;
453 BLOCK_VARS (block_node
) = 0;
457 current_binding_level
->blocks
458 = chainon (current_binding_level
->blocks
, block_node
);
461 /* If we did not make a block for the level just exited, any blocks made for
462 inner levels (since they cannot be recorded as subblocks in that level)
463 must be carried forward so they will later become subblocks of something
465 else if (subblock_chain
)
466 current_binding_level
->blocks
467 = chainon (current_binding_level
->blocks
, subblock_chain
);
469 TREE_USED (block_node
) = 1;
474 /* Insert BLOCK at the end of the list of subblocks of the
475 current binding level. This is used when a BIND_EXPR is expanded,
476 to handle the BLOCK node inside the BIND_EXPR. */
479 insert_block (tree block
)
481 TREE_USED (block
) = 1;
482 current_binding_level
->blocks
483 = chainon (current_binding_level
->blocks
, block
);
486 /* Records a ..._DECL node DECL as belonging to the current lexical scope.
487 Returns the ..._DECL node. */
492 /* External objects aren't nested, other objects may be. */
493 if ((DECL_EXTERNAL (decl
)) || (decl
== current_function_decl
))
494 DECL_CONTEXT (decl
) = 0;
496 DECL_CONTEXT (decl
) = current_function_decl
;
498 /* Put the declaration on the list. The list of declarations is in reverse
499 order. The list will be reversed later if necessary. This needs to be
500 this way for compatibility with the back-end. */
502 TREE_CHAIN (decl
) = current_binding_level
->names
;
503 current_binding_level
->names
= decl
;
505 /* For the declartion of a type, set its name if it is not already set. */
507 if (TREE_CODE (decl
) == TYPE_DECL
&& TYPE_NAME (TREE_TYPE (decl
)) == 0)
509 if (DECL_SOURCE_LINE (decl
) == 0)
510 TYPE_NAME (TREE_TYPE (decl
)) = decl
;
512 TYPE_NAME (TREE_TYPE (decl
)) = DECL_NAME (decl
);
519 /* Like pushdecl, only it places X in GLOBAL_BINDING_LEVEL. */
522 pushdecl_top_level (tree x
)
525 struct binding_level
*b
= current_binding_level
;
527 current_binding_level
= global_binding_level
;
529 current_binding_level
= b
;
534 /* Clear the binding stack. */
536 gfc_clear_binding_stack (void)
538 while (!global_bindings_p ())
543 #ifndef CHAR_TYPE_SIZE
544 #define CHAR_TYPE_SIZE BITS_PER_UNIT
547 #ifndef INT_TYPE_SIZE
548 #define INT_TYPE_SIZE BITS_PER_WORD
552 #define SIZE_TYPE "long unsigned int"
554 /* Create tree nodes for the basic scalar types of Fortran 95,
555 and some nodes representing standard constants (0, 1, (void *) 0).
556 Initialize the global binding level.
557 Make definitions for built-in primitive functions. */
559 gfc_init_decl_processing (void)
561 current_function_decl
= NULL
;
563 current_binding_level
= NULL_BINDING_LEVEL
;
564 free_binding_level
= NULL_BINDING_LEVEL
;
566 /* Make the binding_level structure for global names. We move all
567 variables that are in a COMMON block to this binding level. */
569 global_binding_level
= current_binding_level
;
571 /* Build common tree nodes. char_type_node is unsigned because we
572 only use it for actual characters, not for INTEGER(1). Also, we
573 want double_type_node to actually have double precision. */
574 build_common_tree_nodes (0);
575 set_sizetype (long_unsigned_type_node
);
576 build_common_tree_nodes_2 (0);
578 /* Set up F95 type nodes. */
582 /* Mark EXP saying that we need to be able to take the
583 address of it; it should not be allocated in a register.
584 In Fortran 95 this is only the case for variables with
585 the TARGET attribute, but we implement it here for a
586 likely future Cray pointer extension.
587 Value is 1 if successful. */
588 /* TODO: Check/fix mark_addressable. */
590 gfc_mark_addressable (tree exp
)
592 register tree x
= exp
;
594 switch (TREE_CODE (x
))
601 x
= TREE_OPERAND (x
, 0);
605 TREE_ADDRESSABLE (x
) = 1;
612 if (DECL_REGISTER (x
) && !TREE_ADDRESSABLE (x
) && DECL_NONLOCAL (x
))
617 ("global register variable `%s' used in nested function",
618 IDENTIFIER_POINTER (DECL_NAME (x
)));
621 pedwarn ("register variable `%s' used in nested function",
622 IDENTIFIER_POINTER (DECL_NAME (x
)));
624 else if (DECL_REGISTER (x
) && !TREE_ADDRESSABLE (x
))
628 error ("address of global register variable `%s' requested",
629 IDENTIFIER_POINTER (DECL_NAME (x
)));
634 /* If we are making this addressable due to its having
635 volatile components, give a different error message. Also
636 handle the case of an unnamed parameter by not trying
639 else if (C_TYPE_FIELDS_VOLATILE (TREE_TYPE (x
)))
641 error ("cannot put object with volatile field into register");
646 pedwarn ("address of register variable `%s' requested",
647 IDENTIFIER_POINTER (DECL_NAME (x
)));
652 TREE_ADDRESSABLE (x
) = 1;
659 /* press the big red button - garbage (ggc) collection is on */
663 /* Builtin function initialisation. */
665 /* Return a definition for a builtin function named NAME and whose data type
666 is TYPE. TYPE should be a function type with argument types.
667 FUNCTION_CODE tells later passes how to compile calls to this function.
668 See tree.h for its possible values.
670 If LIBRARY_NAME is nonzero, use that for DECL_ASSEMBLER_NAME,
671 the name to be called if we can't opencode the function. If
672 ATTRS is nonzero, use that for the function's attribute list. */
675 builtin_function (const char *name
,
678 enum built_in_class
class,
679 const char *library_name
,
680 tree attrs ATTRIBUTE_UNUSED
)
682 tree decl
= build_decl (FUNCTION_DECL
, get_identifier (name
), type
);
683 DECL_EXTERNAL (decl
) = 1;
684 TREE_PUBLIC (decl
) = 1;
686 SET_DECL_ASSEMBLER_NAME (decl
, get_identifier (library_name
));
687 make_decl_rtl (decl
);
689 DECL_BUILT_IN_CLASS (decl
) = class;
690 DECL_FUNCTION_CODE (decl
) = function_code
;
696 gfc_define_builtin (const char * name
,
699 const char * library_name
,
704 decl
= builtin_function (name
, type
, code
, BUILT_IN_NORMAL
,
705 library_name
, NULL_TREE
);
707 TREE_READONLY (decl
) = 1;
709 built_in_decls
[code
] = decl
;
710 implicit_built_in_decls
[code
] = decl
;
714 #define DEFINE_MATH_BUILTIN(code, name, nargs) \
715 gfc_define_builtin ("__builtin_" name, mfunc_double[nargs-1], \
716 BUILT_IN_ ## code, name, true); \
717 gfc_define_builtin ("__builtin_" name "f", mfunc_float[nargs-1], \
718 BUILT_IN_ ## code ## F, name "f", true);
720 /* Initialisation of builtin function nodes. */
722 gfc_init_builtin_functions (void)
725 tree mfunc_double
[2];
726 tree func_cfloat_float
;
727 tree func_cdouble_double
;
731 tmp
= tree_cons (NULL_TREE
, float_type_node
, void_list_node
);
732 mfunc_float
[0] = build_function_type (float_type_node
, tmp
);
733 tmp
= tree_cons (NULL_TREE
, float_type_node
, tmp
);
734 mfunc_float
[1] = build_function_type (float_type_node
, tmp
);
736 tmp
= tree_cons (NULL_TREE
, complex_float_type_node
, void_list_node
);
737 func_cfloat_float
= build_function_type (float_type_node
, tmp
);
740 tmp
= tree_cons (NULL_TREE
, double_type_node
, void_list_node
);
741 mfunc_double
[0] = build_function_type (double_type_node
, tmp
);
742 tmp
= tree_cons (NULL_TREE
, double_type_node
, tmp
);
743 mfunc_double
[1] = build_function_type (double_type_node
, tmp
);
746 tmp
= tree_cons (NULL_TREE
, complex_double_type_node
, void_list_node
);
747 func_cdouble_double
= build_function_type (double_type_node
, tmp
);
749 #include "mathbuiltins.def"
751 /* We define these seperately as the fortran versions have different
752 semantics (they return an integer type) */
753 gfc_define_builtin ("__builtin_floor", mfunc_double
[0],
754 BUILT_IN_FLOOR
, "floor", true);
755 gfc_define_builtin ("__builtin_floorf", mfunc_float
[0],
756 BUILT_IN_FLOORF
, "floorf", true);
757 gfc_define_builtin ("__builtin_round", mfunc_double
[0],
758 BUILT_IN_ROUND
, "round", true);
759 gfc_define_builtin ("__builtin_roundf", mfunc_float
[0],
760 BUILT_IN_ROUNDF
, "roundf", true);
762 gfc_define_builtin ("__builtin_cabs", func_cdouble_double
,
763 BUILT_IN_CABS
, "cabs", true);
764 gfc_define_builtin ("__builtin_cabsf", func_cfloat_float
,
765 BUILT_IN_CABSF
, "cabsf", true);
768 gfc_define_builtin ("__builtin_copysign", mfunc_double
[1],
769 BUILT_IN_COPYSIGN
, "copysign", true);
770 gfc_define_builtin ("__builtin_copysignf", mfunc_float
[1],
771 BUILT_IN_COPYSIGNF
, "copysignf", true);
773 /* These are used to implement the ** operator. */
774 gfc_define_builtin ("__builtin_pow", mfunc_double
[1],
775 BUILT_IN_POW
, "pow", true);
776 gfc_define_builtin ("__builtin_powf", mfunc_float
[1],
777 BUILT_IN_POWF
, "powf", true);
779 /* Other builtin functions we use. */
781 tmp
= tree_cons (NULL_TREE
, long_integer_type_node
, void_list_node
);
782 tmp
= tree_cons (NULL_TREE
, long_integer_type_node
, tmp
);
783 ftype
= build_function_type (long_integer_type_node
, tmp
);
784 gfc_define_builtin ("__builtin_expect", ftype
, BUILT_IN_EXPECT
,
785 "__builtin_expect", true);
787 tmp
= tree_cons (NULL_TREE
, size_type_node
, void_list_node
);
788 tmp
= tree_cons (NULL_TREE
, pvoid_type_node
, tmp
);
789 tmp
= tree_cons (NULL_TREE
, pvoid_type_node
, tmp
);
790 ftype
= build_function_type (pvoid_type_node
, tmp
);
791 gfc_define_builtin ("__builtin_memcpy", ftype
, BUILT_IN_MEMCPY
,
794 tmp
= tree_cons (NULL_TREE
, integer_type_node
, void_list_node
);
795 ftype
= build_function_type (integer_type_node
, tmp
);
796 gfc_define_builtin ("__builtin_clz", ftype
, BUILT_IN_CLZ
, "clz", true);
798 tmp
= tree_cons (NULL_TREE
, long_integer_type_node
, void_list_node
);
799 ftype
= build_function_type (integer_type_node
, tmp
);
800 gfc_define_builtin ("__builtin_clzl", ftype
, BUILT_IN_CLZL
, "clzl", true);
802 tmp
= tree_cons (NULL_TREE
, long_long_integer_type_node
, void_list_node
);
803 ftype
= build_function_type (integer_type_node
, tmp
);
804 gfc_define_builtin ("__builtin_clzll", ftype
, BUILT_IN_CLZLL
, "clzll", true);
806 tmp
= tree_cons (NULL_TREE
, pvoid_type_node
, void_list_node
);
807 tmp
= tree_cons (NULL_TREE
, pvoid_type_node
, tmp
);
808 tmp
= tree_cons (NULL_TREE
, pvoid_type_node
, tmp
);
809 ftype
= build_function_type (void_type_node
, tmp
);
810 gfc_define_builtin ("__builtin_init_trampoline", ftype
,
811 BUILT_IN_INIT_TRAMPOLINE
, "init_trampoline", false);
813 tmp
= tree_cons (NULL_TREE
, pvoid_type_node
, void_list_node
);
814 ftype
= build_function_type (pvoid_type_node
, tmp
);
815 gfc_define_builtin ("__builtin_adjust_trampoline", ftype
,
816 BUILT_IN_ADJUST_TRAMPOLINE
, "adjust_trampoline", true);
818 /* The stack_save, stack_restore, and alloca builtins aren't used directly.
819 They are inserted during gimplification to implement variable sized
822 ftype
= build_function_type (pvoid_type_node
, void_list_node
);
823 gfc_define_builtin ("__builtin_stack_save", ftype
, BUILT_IN_STACK_SAVE
,
824 "stack_save", false);
826 tmp
= tree_cons (NULL_TREE
, pvoid_type_node
, void_list_node
);
827 ftype
= build_function_type (void_type_node
, tmp
);
828 gfc_define_builtin ("__builtin_stack_restore", ftype
, BUILT_IN_STACK_RESTORE
,
829 "stack_restore", false);
831 tmp
= tree_cons (NULL_TREE
, size_type_node
, void_list_node
);
832 ftype
= build_function_type (pvoid_type_node
, tmp
);
833 gfc_define_builtin ("__builtin_alloca", ftype
, BUILT_IN_ALLOCA
,
837 #undef DEFINE_MATH_BUILTIN
839 #include "gt-fortran-f95-lang.h"
840 #include "gtype-fortran.h"