1 /* Implement grant-file output & seize-file input for CHILL.
2 Copyright (C) 1992, 93-96, 98, 99, 2000 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 GNU CC is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
34 #define APPEND(X,Y) X = append (X, Y)
35 #define PREPEND(X,Y) X = prepend (X, Y);
36 #define FREE(x) strfree (x)
37 #define ALLOCAMOUNT 10000
38 /* may be we can handle this in a more exciting way,
39 but this also should work for the moment */
40 #define MAYBE_NEWLINE(X) \
43 if (X->len && X->str[X->len - 1] != '\n') \
47 extern tree process_type;
48 extern char *asm_file_name;
49 extern char *dump_base_name;
51 /* forward declarations */
53 /* variable indicates compilation at module level */
54 int chill_at_module_level = 0;
57 /* mark that a SPEC MODULE was generated */
58 static int spec_module_generated = 0;
60 /* define version strings */
61 extern char *version_string;
63 /* define a faster string handling */
71 /* structure used for handling multiple grant files */
72 char *grant_file_name;
73 MYSTRING *gstring = NULL;
74 MYSTRING *selective_gstring = NULL;
76 static MYSTRING *decode_decl PARAMS ((tree));
77 static MYSTRING *decode_constant PARAMS ((tree));
78 static void grant_one_decl PARAMS ((tree));
79 static MYSTRING *get_type PARAMS ((tree));
80 static MYSTRING *decode_mode PARAMS ((tree));
81 static MYSTRING *decode_prefix_rename PARAMS ((tree));
82 static MYSTRING *decode_constant_selective PARAMS ((tree, tree));
83 static MYSTRING *decode_mode_selective PARAMS ((tree, tree));
84 static MYSTRING *get_type_selective PARAMS ((tree, tree));
85 static MYSTRING *decode_decl_selective PARAMS ((tree, tree));
86 static MYSTRING *newstring PARAMS ((const char *));
87 static void strfree PARAMS ((MYSTRING *));
88 static MYSTRING *append PARAMS ((MYSTRING *, const char *));
89 static MYSTRING *prepend PARAMS ((MYSTRING *, const char *));
90 static void grant_use_seizefile PARAMS ((const char *));
91 static MYSTRING *decode_layout PARAMS ((tree));
92 static MYSTRING *grant_array_type PARAMS ((tree));
93 static MYSTRING *grant_array_type_selective PARAMS ((tree, tree));
94 static MYSTRING *get_tag_value PARAMS ((tree));
95 static MYSTRING *get_tag_value_selective PARAMS ((tree, tree));
96 static MYSTRING *print_enumeral PARAMS ((tree));
97 static MYSTRING *print_enumeral_selective PARAMS ((tree, tree));
98 static MYSTRING *print_integer_type PARAMS ((tree));
99 static tree find_enum_parent PARAMS ((tree, tree));
100 static MYSTRING *print_integer_selective PARAMS ((tree, tree));
101 static MYSTRING *print_struct PARAMS ((tree));
102 static MYSTRING *print_struct_selective PARAMS ((tree, tree));
103 static MYSTRING *print_proc_exceptions PARAMS ((tree));
104 static MYSTRING *print_proc_tail PARAMS ((tree, tree, int));
105 static MYSTRING *print_proc_tail_selective PARAMS ((tree, tree, tree));
106 static tree find_in_decls PARAMS ((tree, tree));
107 static int in_ridpointers PARAMS ((tree));
108 static void grant_seized_identifier PARAMS ((tree));
109 static void globalize_decl PARAMS ((tree));
110 static void grant_one_decl_selective PARAMS ((tree, tree));
111 static int compare_memory_file PARAMS ((const char *, const char *));
112 static int search_in_list PARAMS ((tree, tree));
113 static int really_grant_this PARAMS ((tree, tree));
115 /* list of the VAR_DECLs of the module initializer entries */
116 tree module_init_list = NULL_TREE;
118 /* handle different USE_SEIZE_FILE's in case of selective granting */
119 typedef struct SEIZEFILELIST
121 struct SEIZEFILELIST *next;
126 static seizefile_list *selective_seizes = 0;
133 MYSTRING *tmp = (MYSTRING *) xmalloc (sizeof (MYSTRING));
134 unsigned len = strlen (str);
136 tmp->allocated = len + ALLOCAMOUNT;
137 tmp->str = xmalloc ((unsigned)tmp->allocated);
138 strcpy (tmp->str, str);
156 int inlen = strlen (in);
157 int amount = ALLOCAMOUNT;
161 if ((inout->len + inlen) >= inout->allocated)
162 inout->str = xrealloc (inout->str, inout->allocated += amount);
163 strcpy (inout->str + inout->len, in);
173 MYSTRING *res = inout;
176 res = newstring (in);
177 res = APPEND (res, inout->str);
184 grant_use_seizefile (seize_filename)
185 const char *seize_filename;
187 APPEND (gstring, "<> USE_SEIZE_FILE \"");
188 APPEND (gstring, seize_filename);
189 APPEND (gstring, "\" <>\n");
193 decode_layout (layout)
197 tree stepsize = NULL_TREE;
199 MYSTRING *result = newstring ("");
202 if (layout == integer_zero_node) /* NOPACK */
204 APPEND (result, " NOPACK");
208 if (layout == integer_one_node) /* PACK */
210 APPEND (result, " PACK");
214 APPEND (result, " ");
216 if (TREE_PURPOSE (temp) == NULL_TREE)
218 APPEND (result, "STEP(");
220 temp = TREE_VALUE (temp);
221 stepsize = TREE_VALUE (temp);
223 APPEND (result, "POS(");
225 /* Get the starting word */
226 temp = TREE_PURPOSE (temp);
227 work = decode_constant (TREE_PURPOSE (temp));
228 APPEND (result, work->str);
231 temp = TREE_VALUE (temp);
232 if (temp != NULL_TREE)
234 /* Get the starting bit */
235 APPEND (result, ", ");
236 work = decode_constant (TREE_PURPOSE (temp));
237 APPEND (result, work->str);
240 temp = TREE_VALUE (temp);
241 if (temp != NULL_TREE)
243 /* Get the length or the ending bit */
244 tree what = TREE_PURPOSE (temp);
245 if (what == integer_zero_node) /* length */
247 APPEND (result, ", ");
251 APPEND (result, ":");
253 work = decode_constant (TREE_VALUE (temp));
254 APPEND (result, work->str);
258 APPEND (result, ")");
262 if (stepsize != NULL_TREE)
264 APPEND (result, ", ");
265 work = decode_constant (stepsize);
266 APPEND (result, work->str);
269 APPEND (result, ")");
276 grant_array_type (type)
279 MYSTRING *result = newstring ("");
280 MYSTRING *mode_string;
284 if (chill_varying_type_p (type))
287 type = CH_VARYING_ARRAY_TYPE (type);
289 if (CH_STRING_TYPE_P (type))
291 tree fields = TYPE_DOMAIN (type);
292 tree maxval = TYPE_MAX_VALUE (fields);
294 if (TREE_CODE (TREE_TYPE (type)) == CHAR_TYPE)
295 APPEND (result, "CHARS (");
297 APPEND (result, "BOOLS (");
298 if (TREE_CODE (maxval) == INTEGER_CST)
301 sprintf (wrk, HOST_WIDE_INT_PRINT_DEC,
302 TREE_INT_CST_LOW (maxval) + 1);
303 APPEND (result, wrk);
305 else if (TREE_CODE (maxval) == MINUS_EXPR
306 && TREE_OPERAND (maxval, 1) == integer_one_node)
308 mode_string = decode_constant (TREE_OPERAND (maxval, 0));
309 APPEND (result, mode_string->str);
314 mode_string = decode_constant (maxval);
315 APPEND (result, mode_string->str);
317 APPEND (result, "+1");
319 APPEND (result, ")");
321 APPEND (result, " VARYING");
325 APPEND (result, "ARRAY (");
326 if (TREE_CODE (TYPE_DOMAIN (type)) == INTEGER_TYPE
327 && TREE_TYPE (TYPE_DOMAIN (type)) == ridpointers[(int) RID_RANGE])
329 mode_string = decode_constant (TYPE_MIN_VALUE (TYPE_DOMAIN (type)));
330 APPEND (result, mode_string->str);
333 APPEND (result, ":");
334 mode_string = decode_constant (TYPE_MAX_VALUE (TYPE_DOMAIN (type)));
335 APPEND (result, mode_string->str);
340 mode_string = decode_mode (TYPE_DOMAIN (type));
341 APPEND (result, mode_string->str);
344 APPEND (result, ") ");
346 APPEND (result, "VARYING ");
348 mode_string = get_type (TREE_TYPE (type));
349 APPEND (result, mode_string->str);
352 layout = TYPE_ATTRIBUTES (type);
353 if (layout != NULL_TREE)
355 mode_string = decode_layout (layout);
356 APPEND (result, mode_string->str);
364 grant_array_type_selective (type, all_decls)
368 MYSTRING *result = newstring ("");
369 MYSTRING *mode_string;
372 if (chill_varying_type_p (type))
375 type = CH_VARYING_ARRAY_TYPE (type);
377 if (CH_STRING_TYPE_P (type))
379 tree fields = TYPE_DOMAIN (type);
380 tree maxval = TYPE_MAX_VALUE (fields);
382 if (TREE_CODE (maxval) != INTEGER_CST)
384 if (TREE_CODE (maxval) == MINUS_EXPR
385 && TREE_OPERAND (maxval, 1) == integer_one_node)
387 mode_string = decode_constant_selective (TREE_OPERAND (maxval, 0), all_decls);
388 if (mode_string->len)
389 APPEND (result, mode_string->str);
394 mode_string = decode_constant_selective (maxval, all_decls);
395 if (mode_string->len)
396 APPEND (result, mode_string->str);
403 if (TREE_CODE (TYPE_DOMAIN (type)) == INTEGER_TYPE
404 && TREE_TYPE (TYPE_DOMAIN (type)) == ridpointers[(int) RID_RANGE])
406 mode_string = decode_constant_selective (TYPE_MIN_VALUE (TYPE_DOMAIN (type)), all_decls);
407 if (mode_string->len)
408 APPEND (result, mode_string->str);
411 mode_string = decode_constant_selective (TYPE_MAX_VALUE (TYPE_DOMAIN (type)), all_decls);
412 if (mode_string->len)
414 MAYBE_NEWLINE (result);
415 APPEND (result, mode_string->str);
421 mode_string = decode_mode_selective (TYPE_DOMAIN (type), all_decls);
422 if (mode_string->len)
423 APPEND (result, mode_string->str);
427 mode_string = get_type_selective (TREE_TYPE (type), all_decls);
428 if (mode_string->len)
430 MAYBE_NEWLINE (result);
431 APPEND (result, mode_string->str);
444 if (TREE_CODE (val) == CONST_DECL && DECL_NAME (val))
446 result = newstring (IDENTIFIER_POINTER (DECL_NAME (val)));
448 else if (TREE_CODE (val) == CONST_DECL)
450 /* it's a synonym -- get the value */
451 result = decode_constant (DECL_INITIAL (val));
455 result = decode_constant (val);
461 get_tag_value_selective (val, all_decls)
467 if (TREE_CODE (val) == CONST_DECL && DECL_NAME (val))
468 result = newstring ("");
469 else if (TREE_CODE (val) == CONST_DECL)
471 /* it's a synonym -- get the value */
472 result = decode_constant_selective (DECL_INITIAL (val), all_decls);
476 result = decode_constant_selective (val, all_decls);
482 print_enumeral (type)
485 MYSTRING *result = newstring ("");
489 if (TYPE_LANG_SPECIFIC (type) == NULL)
493 APPEND (result, "SET (");
494 for (fields = TYPE_VALUES (type);
496 fields = TREE_CHAIN (fields))
498 if (TREE_PURPOSE (fields) == NULL_TREE)
499 APPEND (result, "*");
502 tree decl = TREE_VALUE (fields);
503 APPEND (result, IDENTIFIER_POINTER (TREE_PURPOSE (fields)));
504 if (TREE_CODE (decl) == CONST_DECL && DECL_INITIAL (decl))
506 MYSTRING *val_string = decode_constant (DECL_INITIAL (decl));
507 APPEND (result, " = ");
508 APPEND (result, val_string->str);
512 if (TREE_CHAIN (fields) != NULL_TREE)
513 APPEND (result, ",\n ");
515 APPEND (result, ")");
521 print_enumeral_selective (type, all_decls)
525 MYSTRING *result = newstring ("");
528 for (fields = TYPE_VALUES (type);
530 fields = TREE_CHAIN (fields))
532 if (TREE_PURPOSE (fields) != NULL_TREE)
534 tree decl = TREE_VALUE (fields);
535 if (TREE_CODE (decl) == CONST_DECL && DECL_INITIAL (decl))
537 MYSTRING *val_string = decode_constant_selective (DECL_INITIAL (decl), all_decls);
539 APPEND (result, val_string->str);
548 print_integer_type (type)
551 MYSTRING *result = newstring ("");
552 MYSTRING *mode_string;
553 const char *name_ptr;
556 if (TREE_TYPE (type))
558 mode_string = decode_mode (TREE_TYPE (type));
559 APPEND (result, mode_string->str);
562 APPEND (result, "(");
563 mode_string = decode_constant (TYPE_MIN_VALUE (type));
564 APPEND (result, mode_string->str);
567 if (TREE_TYPE (type) != ridpointers[(int) RID_BIN])
569 APPEND (result, ":");
570 mode_string = decode_constant (TYPE_MAX_VALUE (type));
571 APPEND (result, mode_string->str);
575 APPEND (result, ")");
578 /* We test TYPE_MAIN_VARIANT because pushdecl often builds
579 a copy of a built-in type node, which is logically id-
580 entical but has a different address, and the same
581 TYPE_MAIN_VARIANT. */
582 /* FIXME this should not be needed! */
584 base_type = TREE_TYPE (type) ? TREE_TYPE (type) : type;
586 if (TREE_UNSIGNED (base_type))
588 if (base_type == chill_unsigned_type_node
589 || TYPE_MAIN_VARIANT(base_type) ==
590 TYPE_MAIN_VARIANT (chill_unsigned_type_node))
592 else if (base_type == long_integer_type_node
593 || TYPE_MAIN_VARIANT(base_type) ==
594 TYPE_MAIN_VARIANT (long_unsigned_type_node))
596 else if (type == unsigned_char_type_node
597 || TYPE_MAIN_VARIANT(base_type) ==
598 TYPE_MAIN_VARIANT (unsigned_char_type_node))
600 else if (type == duration_timing_type_node
601 || TYPE_MAIN_VARIANT (base_type) ==
602 TYPE_MAIN_VARIANT (duration_timing_type_node))
603 name_ptr = "DURATION";
604 else if (type == abs_timing_type_node
605 || TYPE_MAIN_VARIANT (base_type) ==
606 TYPE_MAIN_VARIANT (abs_timing_type_node))
613 if (base_type == chill_integer_type_node
614 || TYPE_MAIN_VARIANT (base_type) ==
615 TYPE_MAIN_VARIANT (chill_integer_type_node))
617 else if (base_type == long_integer_type_node
618 || TYPE_MAIN_VARIANT (base_type) ==
619 TYPE_MAIN_VARIANT (long_integer_type_node))
621 else if (type == signed_char_type_node
622 || TYPE_MAIN_VARIANT (base_type) ==
623 TYPE_MAIN_VARIANT (signed_char_type_node))
629 APPEND (result, name_ptr);
631 /* see if we have a range */
632 if (TREE_TYPE (type) != NULL)
634 mode_string = decode_constant (TYPE_MIN_VALUE (type));
635 APPEND (result, mode_string->str);
637 APPEND (result, ":");
638 mode_string = decode_constant (TYPE_MAX_VALUE (type));
639 APPEND (result, mode_string->str);
647 find_enum_parent (enumname, all_decls)
653 for (wrk = all_decls; wrk != NULL_TREE; wrk = TREE_CHAIN (wrk))
655 if (TREE_TYPE (wrk) != NULL_TREE && TREE_CODE (wrk) != CONST_DECL &&
656 TREE_CODE (TREE_TYPE (wrk)) == ENUMERAL_TYPE)
659 for (list = TYPE_VALUES (TREE_TYPE (wrk)); list != NULL_TREE; list = TREE_CHAIN (list))
661 if (DECL_NAME (TREE_VALUE (list)) == enumname)
670 print_integer_selective (type, all_decls)
674 MYSTRING *result = newstring ("");
675 MYSTRING *mode_string;
677 if (TREE_TYPE (type))
679 mode_string = decode_mode_selective (TREE_TYPE (type), all_decls);
680 if (mode_string->len)
681 APPEND (result, mode_string->str);
684 if (TREE_TYPE (type) == ridpointers[(int)RID_RANGE] &&
685 TREE_CODE (TYPE_MIN_VALUE (type)) == IDENTIFIER_NODE &&
686 TREE_CODE (TYPE_MAX_VALUE (type)) == IDENTIFIER_NODE)
688 /* we have a range of a set. Find parant mode and write it
689 to SPEC MODULE. This will loose if the parent mode was SEIZED from
691 tree minparent = find_enum_parent (TYPE_MIN_VALUE (type), all_decls);
692 tree maxparent = find_enum_parent (TYPE_MAX_VALUE (type), all_decls);
694 if (minparent != NULL_TREE)
696 if (! CH_ALREADY_GRANTED (minparent))
698 mode_string = decode_decl (minparent);
699 if (mode_string->len)
700 APPEND (result, mode_string->str);
702 CH_ALREADY_GRANTED (minparent) = 1;
705 if (minparent != maxparent && maxparent != NULL_TREE)
707 if (!CH_ALREADY_GRANTED (maxparent))
709 mode_string = decode_decl (maxparent);
710 if (mode_string->len)
712 MAYBE_NEWLINE (result);
713 APPEND (result, mode_string->str);
716 CH_ALREADY_GRANTED (maxparent) = 1;
722 mode_string = decode_constant_selective (TYPE_MIN_VALUE (type), all_decls);
723 if (mode_string->len)
725 MAYBE_NEWLINE (result);
726 APPEND (result, mode_string->str);
730 mode_string = decode_constant_selective (TYPE_MAX_VALUE (type), all_decls);
731 if (mode_string->len)
733 MAYBE_NEWLINE (result);
734 APPEND (result, mode_string->str);
741 /* see if we have a range */
742 if (TREE_TYPE (type) != NULL)
744 mode_string = decode_constant_selective (TYPE_MIN_VALUE (type), all_decls);
745 if (mode_string->len)
746 APPEND (result, mode_string->str);
749 mode_string = decode_constant_selective (TYPE_MAX_VALUE (type), all_decls);
750 if (mode_string->len)
752 MAYBE_NEWLINE (result);
753 APPEND (result, mode_string->str);
765 MYSTRING *result = newstring ("");
766 MYSTRING *mode_string;
769 if (chill_varying_type_p (type))
771 mode_string = grant_array_type (type);
772 APPEND (result, mode_string->str);
777 fields = TYPE_FIELDS (type);
779 APPEND (result, "STRUCT (");
780 while (fields != NULL_TREE)
782 if (TREE_CODE (TREE_TYPE (fields)) == UNION_TYPE)
785 /* Format a tagged variant record type. */
786 APPEND (result, " CASE ");
787 if (TYPE_TAGFIELDS (TREE_TYPE (fields)) != NULL_TREE)
789 tree tag_list = TYPE_TAGFIELDS (TREE_TYPE (fields));
792 tree tag_name = DECL_NAME (TREE_VALUE (tag_list));
793 APPEND (result, IDENTIFIER_POINTER (tag_name));
794 tag_list = TREE_CHAIN (tag_list);
795 if (tag_list == NULL_TREE)
797 APPEND (result, ", ");
800 APPEND (result, " OF\n");
801 variants = TYPE_FIELDS (TREE_TYPE (fields));
803 /* Each variant is a FIELD_DECL whose type is an anonymous
804 struct within the anonymous union. */
805 while (variants != NULL_TREE)
807 tree tag_list = TYPE_TAG_VALUES (TREE_TYPE (variants));
808 tree struct_elts = TYPE_FIELDS (TREE_TYPE (variants));
810 while (tag_list != NULL_TREE)
812 tree tag_values = TREE_VALUE (tag_list);
813 APPEND (result, " (");
814 while (tag_values != NULL_TREE)
816 mode_string = get_tag_value (TREE_VALUE (tag_values));
817 APPEND (result, mode_string->str);
819 if (TREE_CHAIN (tag_values) != NULL_TREE)
821 APPEND (result, ",\n ");
822 tag_values = TREE_CHAIN (tag_values);
826 APPEND (result, ")");
827 tag_list = TREE_CHAIN (tag_list);
829 APPEND (result, ",");
833 APPEND (result, " : ");
835 while (struct_elts != NULL_TREE)
837 mode_string = decode_decl (struct_elts);
838 APPEND (result, mode_string->str);
841 if (TREE_CHAIN (struct_elts) != NULL_TREE)
842 APPEND (result, ",\n ");
843 struct_elts = TREE_CHAIN (struct_elts);
846 variants = TREE_CHAIN (variants);
847 if (variants != NULL_TREE
848 && TREE_CHAIN (variants) == NULL_TREE
849 && DECL_NAME (variants) == ELSE_VARIANT_NAME)
851 tree else_elts = TYPE_FIELDS (TREE_TYPE (variants));
852 APPEND (result, "\n ELSE ");
853 while (else_elts != NULL_TREE)
855 mode_string = decode_decl (else_elts);
856 APPEND (result, mode_string->str);
858 if (TREE_CHAIN (else_elts) != NULL_TREE)
859 APPEND (result, ",\n ");
860 else_elts = TREE_CHAIN (else_elts);
864 if (variants != NULL_TREE)
865 APPEND (result, ",\n");
868 APPEND (result, "\n ESAC");
872 mode_string = decode_decl (fields);
873 APPEND (result, mode_string->str);
877 fields = TREE_CHAIN (fields);
878 if (fields != NULL_TREE)
879 APPEND (result, ",\n ");
881 APPEND (result, ")");
887 print_struct_selective (type, all_decls)
891 MYSTRING *result = newstring ("");
892 MYSTRING *mode_string;
895 if (chill_varying_type_p (type))
897 mode_string = grant_array_type_selective (type, all_decls);
898 if (mode_string->len)
899 APPEND (result, mode_string->str);
904 fields = TYPE_FIELDS (type);
906 while (fields != NULL_TREE)
908 if (TREE_CODE (TREE_TYPE (fields)) == UNION_TYPE)
911 /* Format a tagged variant record type. */
913 variants = TYPE_FIELDS (TREE_TYPE (fields));
915 /* Each variant is a FIELD_DECL whose type is an anonymous
916 struct within the anonymous union. */
917 while (variants != NULL_TREE)
919 tree tag_list = TYPE_TAG_VALUES (TREE_TYPE (variants));
920 tree struct_elts = TYPE_FIELDS (TREE_TYPE (variants));
922 while (tag_list != NULL_TREE)
924 tree tag_values = TREE_VALUE (tag_list);
925 while (tag_values != NULL_TREE)
927 mode_string = get_tag_value_selective (TREE_VALUE (tag_values),
929 if (mode_string->len)
931 MAYBE_NEWLINE (result);
932 APPEND (result, mode_string->str);
935 if (TREE_CHAIN (tag_values) != NULL_TREE)
936 tag_values = TREE_CHAIN (tag_values);
939 tag_list = TREE_CHAIN (tag_list);
944 while (struct_elts != NULL_TREE)
946 mode_string = decode_decl_selective (struct_elts, all_decls);
947 if (mode_string->len)
949 MAYBE_NEWLINE (result);
950 APPEND (result, mode_string->str);
954 struct_elts = TREE_CHAIN (struct_elts);
957 variants = TREE_CHAIN (variants);
958 if (variants != NULL_TREE
959 && TREE_CHAIN (variants) == NULL_TREE
960 && DECL_NAME (variants) == ELSE_VARIANT_NAME)
962 tree else_elts = TYPE_FIELDS (TREE_TYPE (variants));
963 while (else_elts != NULL_TREE)
965 mode_string = decode_decl_selective (else_elts, all_decls);
966 if (mode_string->len)
968 MAYBE_NEWLINE (result);
969 APPEND (result, mode_string->str);
972 else_elts = TREE_CHAIN (else_elts);
980 mode_string = decode_decl_selective (fields, all_decls);
981 APPEND (result, mode_string->str);
985 fields = TREE_CHAIN (fields);
992 print_proc_exceptions (ex)
995 MYSTRING *result = newstring ("");
999 APPEND (result, "\n EXCEPTIONS (");
1000 for ( ; ex != NULL_TREE; ex = TREE_CHAIN (ex))
1002 APPEND (result, IDENTIFIER_POINTER (TREE_VALUE (ex)));
1003 if (TREE_CHAIN (ex) != NULL_TREE)
1004 APPEND (result, ",\n ");
1006 APPEND (result, ")");
1012 print_proc_tail (type, args, print_argnames)
1017 MYSTRING *result = newstring ("");
1018 MYSTRING *mode_string;
1020 int stopat = list_length (args) - 3;
1022 /* do the argument modes */
1023 for ( ; args != NULL_TREE;
1024 args = TREE_CHAIN (args), count++)
1027 tree argmode = TREE_VALUE (args);
1028 tree attribute = TREE_PURPOSE (args);
1030 if (argmode == void_type_node)
1033 /* if we have exceptions don't print last 2 arguments */
1034 if (TYPE_RAISES_EXCEPTIONS (type) && count == stopat)
1038 APPEND (result, ",\n ");
1041 sprintf(buf, "arg%d ", count);
1042 APPEND (result, buf);
1045 if (attribute == ridpointers[(int) RID_LOC])
1046 argmode = TREE_TYPE (argmode);
1047 mode_string = get_type (argmode);
1048 APPEND (result, mode_string->str);
1051 if (attribute != NULL_TREE)
1053 sprintf (buf, " %s", IDENTIFIER_POINTER (attribute));
1054 APPEND (result, buf);
1057 APPEND (result, ")");
1061 tree retn_type = TREE_TYPE (type);
1063 if (retn_type != NULL_TREE
1064 && TREE_CODE (retn_type) != VOID_TYPE)
1066 mode_string = get_type (retn_type);
1067 APPEND (result, "\n RETURNS (");
1068 APPEND (result, mode_string->str);
1070 if (TREE_CODE (retn_type) == REFERENCE_TYPE)
1071 APPEND (result, " LOC");
1072 APPEND (result, ")");
1076 mode_string = print_proc_exceptions (TYPE_RAISES_EXCEPTIONS (type));
1077 APPEND (result, mode_string->str);
1084 print_proc_tail_selective (type, args, all_decls)
1089 MYSTRING *result = newstring ("");
1090 MYSTRING *mode_string;
1092 int stopat = list_length (args) - 3;
1094 /* do the argument modes */
1095 for ( ; args != NULL_TREE;
1096 args = TREE_CHAIN (args), count++)
1098 tree argmode = TREE_VALUE (args);
1099 tree attribute = TREE_PURPOSE (args);
1101 if (argmode == void_type_node)
1104 /* if we have exceptions don't process last 2 arguments */
1105 if (TYPE_RAISES_EXCEPTIONS (type) && count == stopat)
1108 if (attribute == ridpointers[(int) RID_LOC])
1109 argmode = TREE_TYPE (argmode);
1110 mode_string = get_type_selective (argmode, all_decls);
1111 if (mode_string->len)
1113 MAYBE_NEWLINE (result);
1114 APPEND (result, mode_string->str);
1121 tree retn_type = TREE_TYPE (type);
1123 if (retn_type != NULL_TREE
1124 && TREE_CODE (retn_type) != VOID_TYPE)
1126 mode_string = get_type_selective (retn_type, all_decls);
1127 if (mode_string->len)
1129 MAYBE_NEWLINE (result);
1130 APPEND (result, mode_string->str);
1139 /* output a mode (or type). */
1145 MYSTRING *result = newstring ("");
1146 MYSTRING *mode_string;
1148 switch ((enum chill_tree_code)TREE_CODE (type))
1151 if (DECL_NAME (type))
1153 APPEND (result, IDENTIFIER_POINTER (DECL_NAME (type)));
1156 type = TREE_TYPE (type);
1159 case IDENTIFIER_NODE:
1160 APPEND (result, IDENTIFIER_POINTER (type));
1164 /* LANG_TYPE are only used until satisfy is done,
1165 as place-holders for 'READ T', NEWMODE/SYNMODE modes,
1166 parameterised modes, and old-fashioned CHAR(N). */
1167 if (TYPE_READONLY (type))
1168 APPEND (result, "READ ");
1170 mode_string = get_type (TREE_TYPE (type));
1171 APPEND (result, mode_string->str);
1172 if (TYPE_DOMAIN (type) != NULL_TREE)
1174 /* Parameterized mode,
1175 or old-fashioned CHAR(N) string declaration.. */
1176 APPEND (result, "(");
1177 mode_string = decode_constant (TYPE_DOMAIN (type));
1178 APPEND (result, mode_string->str);
1179 APPEND (result, ")");
1185 mode_string = grant_array_type (type);
1186 APPEND (result, mode_string->str);
1191 APPEND (result, "BOOL");
1195 APPEND (result, "CHAR");
1199 mode_string = print_enumeral (type);
1200 APPEND (result, mode_string->str);
1206 tree args = TYPE_ARG_TYPES (type);
1208 APPEND (result, "PROC (");
1210 mode_string = print_proc_tail (type, args, 0);
1211 APPEND (result, mode_string->str);
1217 mode_string = print_integer_type (type);
1218 APPEND (result, mode_string->str);
1223 if (CH_IS_INSTANCE_MODE (type))
1225 APPEND (result, "INSTANCE");
1228 else if (CH_IS_BUFFER_MODE (type) || CH_IS_EVENT_MODE (type))
1229 { tree bufsize = max_queue_size (type);
1230 APPEND (result, CH_IS_BUFFER_MODE (type) ? "BUFFER " : "EVENT ");
1231 if (bufsize != NULL_TREE)
1233 APPEND (result, "(");
1234 mode_string = decode_constant (bufsize);
1235 APPEND (result, mode_string->str);
1236 APPEND (result, ") ");
1239 if (CH_IS_BUFFER_MODE (type))
1241 mode_string = decode_mode (buffer_element_mode (type));
1242 APPEND (result, mode_string->str);
1247 else if (CH_IS_ACCESS_MODE (type))
1249 tree indexmode, recordmode, dynamic;
1251 APPEND (result, "ACCESS");
1252 recordmode = access_recordmode (type);
1253 indexmode = access_indexmode (type);
1254 dynamic = access_dynamic (type);
1256 if (indexmode != void_type_node)
1258 mode_string = decode_mode (indexmode);
1259 APPEND (result, " (");
1260 APPEND (result, mode_string->str);
1261 APPEND (result, ")");
1264 if (recordmode != void_type_node)
1266 mode_string = decode_mode (recordmode);
1267 APPEND (result, " ");
1268 APPEND (result, mode_string->str);
1271 if (dynamic != integer_zero_node)
1272 APPEND (result, " DYNAMIC");
1275 else if (CH_IS_TEXT_MODE (type))
1277 tree indexmode, dynamic, length;
1279 APPEND (result, "TEXT (");
1280 length = text_length (type);
1281 indexmode = text_indexmode (type);
1282 dynamic = text_dynamic (type);
1284 mode_string = decode_constant (length);
1285 APPEND (result, mode_string->str);
1287 APPEND (result, ")");
1288 if (indexmode != void_type_node)
1290 APPEND (result, " ");
1291 mode_string = decode_mode (indexmode);
1292 APPEND (result, mode_string->str);
1295 if (dynamic != integer_zero_node)
1296 APPEND (result, " DYNAMIC");
1299 mode_string = print_struct (type);
1300 APPEND (result, mode_string->str);
1305 if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE)
1306 APPEND (result, "PTR");
1309 if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
1311 mode_string = get_type (TREE_TYPE (type));
1312 APPEND (result, mode_string->str);
1317 APPEND (result, "REF ");
1318 mode_string = get_type (TREE_TYPE (type));
1319 APPEND (result, mode_string->str);
1326 if (TREE_INT_CST_LOW (TYPE_SIZE (type)) == 32)
1327 APPEND (result, "REAL");
1329 APPEND (result, "LONG_REAL");
1333 if (CH_BOOLS_TYPE_P (type))
1334 mode_string = grant_array_type (type);
1337 APPEND (result, "POWERSET ");
1338 mode_string = get_type (TYPE_DOMAIN (type));
1340 APPEND (result, mode_string->str);
1344 case REFERENCE_TYPE:
1345 mode_string = get_type (TREE_TYPE (type));
1346 APPEND (result, mode_string->str);
1351 APPEND (result, "/* ---- not implemented ---- */");
1359 find_in_decls (id, all_decls)
1365 for (wrk = all_decls; wrk != NULL_TREE; wrk = TREE_CHAIN (wrk))
1367 if (DECL_NAME (wrk) == id || DECL_POSTFIX (wrk) == id)
1378 for (i = RID_UNUSED; i < RID_MAX; i++)
1380 if (id == ridpointers[i])
1387 grant_seized_identifier (decl)
1390 seizefile_list *wrk = selective_seizes;
1391 MYSTRING *mode_string;
1393 CH_ALREADY_GRANTED (decl) = 1;
1395 /* comes from a SPEC MODULE in the module */
1396 if (DECL_SEIZEFILE (decl) == NULL_TREE)
1399 /* search file already in process */
1402 if (wrk->filename == DECL_SEIZEFILE (decl))
1408 wrk = (seizefile_list *)xmalloc (sizeof (seizefile_list));
1409 wrk->next = selective_seizes;
1410 selective_seizes = wrk;
1411 wrk->filename = DECL_SEIZEFILE (decl);
1412 wrk->seizes = newstring ("<> USE_SEIZE_FILE \"");
1413 APPEND (wrk->seizes, IDENTIFIER_POINTER (DECL_SEIZEFILE (decl)));
1414 APPEND (wrk->seizes, "\" <>\n");
1416 APPEND (wrk->seizes, "SEIZE ");
1417 mode_string = decode_prefix_rename (decl);
1418 APPEND (wrk->seizes, mode_string->str);
1420 APPEND (wrk->seizes, ";\n");
1424 decode_mode_selective (type, all_decls)
1428 MYSTRING *result = newstring ("");
1429 MYSTRING *mode_string;
1432 switch ((enum chill_tree_code)TREE_CODE (type))
1435 /* FIXME: could this ever happen ?? */
1436 if (DECL_NAME (type))
1439 result = decode_mode_selective (DECL_NAME (type), all_decls);
1444 case IDENTIFIER_NODE:
1445 if (in_ridpointers (type))
1446 /* it's a predefined, we must not search the whole list */
1449 decl = find_in_decls (type, all_decls);
1450 if (decl != NULL_TREE)
1452 if (CH_ALREADY_GRANTED (decl))
1453 /* already processed */
1456 if (TREE_CODE (decl) == ALIAS_DECL && DECL_POSTFIX (decl) != NULL_TREE)
1458 /* If CH_DECL_GRANTED, decl was granted into this scope, and
1459 so wasn't in the source code. */
1460 if (!CH_DECL_GRANTED (decl))
1462 grant_seized_identifier (decl);
1467 result = decode_decl (decl);
1468 mode_string = decode_decl_selective (decl, all_decls);
1469 if (mode_string->len)
1471 PREPEND (result, mode_string->str);
1479 mode_string = get_type_selective (TREE_TYPE (type), all_decls);
1480 APPEND (result, mode_string->str);
1485 mode_string = grant_array_type_selective (type, all_decls);
1486 APPEND (result, mode_string->str);
1499 mode_string = print_enumeral_selective (type, all_decls);
1500 if (mode_string->len)
1501 APPEND (result, mode_string->str);
1507 tree args = TYPE_ARG_TYPES (type);
1509 mode_string = print_proc_tail_selective (type, args, all_decls);
1510 if (mode_string->len)
1511 APPEND (result, mode_string->str);
1517 mode_string = print_integer_selective (type, all_decls);
1518 if (mode_string->len)
1519 APPEND (result, mode_string->str);
1524 if (CH_IS_INSTANCE_MODE (type))
1528 else if (CH_IS_BUFFER_MODE (type) || CH_IS_EVENT_MODE (type))
1530 tree bufsize = max_queue_size (type);
1531 if (bufsize != NULL_TREE)
1533 mode_string = decode_constant_selective (bufsize, all_decls);
1534 if (mode_string->len)
1535 APPEND (result, mode_string->str);
1538 if (CH_IS_BUFFER_MODE (type))
1540 mode_string = decode_mode_selective (buffer_element_mode (type), all_decls);
1541 if (mode_string->len)
1543 MAYBE_NEWLINE (result);
1544 APPEND (result, mode_string->str);
1550 else if (CH_IS_ACCESS_MODE (type))
1552 tree indexmode = access_indexmode (type);
1553 tree recordmode = access_recordmode (type);
1555 if (indexmode != void_type_node)
1557 mode_string = decode_mode_selective (indexmode, all_decls);
1558 if (mode_string->len)
1560 if (result->len && result->str[result->len - 1] != '\n')
1561 APPEND (result, ";\n");
1562 APPEND (result, mode_string->str);
1566 if (recordmode != void_type_node)
1568 mode_string = decode_mode_selective (recordmode, all_decls);
1569 if (mode_string->len)
1571 if (result->len && result->str[result->len - 1] != '\n')
1572 APPEND (result, ";\n");
1573 APPEND (result, mode_string->str);
1579 else if (CH_IS_TEXT_MODE (type))
1581 tree indexmode = text_indexmode (type);
1582 tree length = text_length (type);
1584 mode_string = decode_constant_selective (length, all_decls);
1585 if (mode_string->len)
1586 APPEND (result, mode_string->str);
1588 if (indexmode != void_type_node)
1590 mode_string = decode_mode_selective (indexmode, all_decls);
1591 if (mode_string->len)
1593 if (result->len && result->str[result->len - 1] != '\n')
1594 APPEND (result, ";\n");
1595 APPEND (result, mode_string->str);
1601 mode_string = print_struct_selective (type, all_decls);
1602 if (mode_string->len)
1604 MAYBE_NEWLINE (result);
1605 APPEND (result, mode_string->str);
1611 if (TREE_CODE (TREE_TYPE (type)) == VOID_TYPE)
1615 if (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
1617 mode_string = get_type_selective (TREE_TYPE (type), all_decls);
1618 if (mode_string->len)
1619 APPEND (result, mode_string->str);
1624 mode_string = get_type_selective (TREE_TYPE (type), all_decls);
1625 if (mode_string->len)
1626 APPEND (result, mode_string->str);
1637 if (CH_BOOLS_TYPE_P (type))
1638 mode_string = grant_array_type_selective (type, all_decls);
1640 mode_string = get_type_selective (TYPE_DOMAIN (type), all_decls);
1641 if (mode_string->len)
1642 APPEND (result, mode_string->str);
1646 case REFERENCE_TYPE:
1647 mode_string = get_type_selective (TREE_TYPE (type), all_decls);
1648 if (mode_string->len)
1649 APPEND (result, mode_string->str);
1654 APPEND (result, "/* ---- not implemented ---- */");
1665 if (type == NULL_TREE || TREE_CODE (type) == ERROR_MARK)
1666 return newstring ("");
1668 return (decode_mode (type));
1672 get_type_selective (type, all_decls)
1676 if (type == NULL_TREE || TREE_CODE (type) == ERROR_MARK)
1677 return newstring ("");
1679 return (decode_mode_selective (type, all_decls));
1684 is_forbidden (str, forbid)
1688 if (forbid == NULL_TREE)
1691 if (TREE_CODE (forbid) == INTEGER_CST)
1694 while (forbid != NULL_TREE)
1696 if (TREE_VALUE (forbid) == str)
1698 forbid = TREE_CHAIN (forbid);
1706 decode_constant (init)
1709 MYSTRING *result = newstring ("");
1710 MYSTRING *tmp_string;
1711 tree type = TREE_TYPE (init);
1715 MYSTRING *mode_string;
1717 switch ((enum chill_tree_code)TREE_CODE (val))
1720 tmp_string = decode_constant (TREE_OPERAND (val, 0));
1721 APPEND (result, tmp_string->str);
1723 val = TREE_OPERAND (val, 1); /* argument list */
1724 if (val != NULL_TREE && TREE_CODE (val) != TREE_LIST)
1726 APPEND (result, " ");
1727 tmp_string = decode_constant (val);
1728 APPEND (result, tmp_string->str);
1733 APPEND (result, " (");
1734 if (val != NULL_TREE)
1738 tmp_string = decode_constant (TREE_VALUE (val));
1739 APPEND (result, tmp_string->str);
1741 val = TREE_CHAIN (val);
1742 if (val == NULL_TREE)
1744 APPEND (result, ", ");
1747 APPEND (result, ")");
1752 /* Generate an "expression conversion" expression (a cast). */
1753 tmp_string = decode_mode (type);
1755 APPEND (result, tmp_string->str);
1757 APPEND (result, "(");
1758 val = TREE_OPERAND (val, 0);
1759 type = TREE_TYPE (val);
1761 /* If the coercee is a tuple, make sure it is prefixed by its mode. */
1762 if (TREE_CODE (val) == CONSTRUCTOR
1763 && !CH_BOOLS_TYPE_P (type) && !chill_varying_type_p (type))
1765 tmp_string = decode_mode (type);
1766 APPEND (result, tmp_string->str);
1768 APPEND (result, " ");
1771 tmp_string = decode_constant (val);
1772 APPEND (result, tmp_string->str);
1774 APPEND (result, ")");
1777 case IDENTIFIER_NODE:
1778 APPEND (result, IDENTIFIER_POINTER (val));
1782 APPEND (result, "(");
1783 tmp_string = decode_constant (TREE_OPERAND (val, 0));
1784 APPEND (result, tmp_string->str);
1786 APPEND (result, ")");
1789 case UNDEFINED_EXPR:
1790 APPEND (result, "*");
1793 case PLUS_EXPR: op = "+"; goto binary;
1794 case MINUS_EXPR: op = "-"; goto binary;
1795 case MULT_EXPR: op = "*"; goto binary;
1796 case TRUNC_DIV_EXPR: op = "/"; goto binary;
1797 case FLOOR_MOD_EXPR: op = " MOD "; goto binary;
1798 case TRUNC_MOD_EXPR: op = " REM "; goto binary;
1799 case CONCAT_EXPR: op = "//"; goto binary;
1800 case BIT_IOR_EXPR: op = " OR "; goto binary;
1801 case BIT_XOR_EXPR: op = " XOR "; goto binary;
1802 case TRUTH_ORIF_EXPR: op = " ORIF "; goto binary;
1803 case BIT_AND_EXPR: op = " AND "; goto binary;
1804 case TRUTH_ANDIF_EXPR: op = " ANDIF "; goto binary;
1805 case GT_EXPR: op = ">"; goto binary;
1806 case GE_EXPR: op = ">="; goto binary;
1807 case SET_IN_EXPR: op = " IN "; goto binary;
1808 case LT_EXPR: op = "<"; goto binary;
1809 case LE_EXPR: op = "<="; goto binary;
1810 case EQ_EXPR: op = "="; goto binary;
1811 case NE_EXPR: op = "/="; goto binary;
1813 if (TREE_OPERAND (val, 0) == NULL_TREE)
1815 APPEND (result, TREE_OPERAND (val, 1) == NULL_TREE ? "*" : "ELSE");
1818 op = ":"; goto binary;
1820 tmp_string = decode_constant (TREE_OPERAND (val, 0));
1821 APPEND (result, tmp_string->str);
1823 APPEND (result, op);
1824 tmp_string = decode_constant (TREE_OPERAND (val, 1));
1825 APPEND (result, tmp_string->str);
1829 case REPLICATE_EXPR:
1830 APPEND (result, "(");
1831 tmp_string = decode_constant (TREE_OPERAND (val, 0));
1832 APPEND (result, tmp_string->str);
1834 APPEND (result, ")");
1835 tmp_string = decode_constant (TREE_OPERAND (val, 1));
1836 APPEND (result, tmp_string->str);
1840 case NEGATE_EXPR: op = "-"; goto unary;
1841 case BIT_NOT_EXPR: op = " NOT "; goto unary;
1842 case ADDR_EXPR: op = "->"; goto unary;
1844 APPEND (result, op);
1845 tmp_string = decode_constant (TREE_OPERAND (val, 0));
1846 APPEND (result, tmp_string->str);
1851 APPEND (result, display_int_cst (val));
1855 #ifndef REAL_IS_NOT_DOUBLE
1856 sprintf (wrk, "%.20g", TREE_REAL_CST (val));
1858 REAL_VALUE_TO_DECIMAL (TREE_REAL_CST (val), "%.20g", wrk);
1860 APPEND (result, wrk);
1865 const char *ptr = TREE_STRING_POINTER (val);
1866 int i = TREE_STRING_LENGTH (val);
1867 APPEND (result, "\"");
1871 unsigned char c = *ptr++;
1873 APPEND (result, "^^");
1875 APPEND (result, "\"\"");
1877 APPEND (result, "^J");
1878 else if (c < ' ' || c > '~')
1880 sprintf (buf, "^(%u)", c);
1881 APPEND (result, buf);
1887 APPEND (result, buf);
1890 APPEND (result, "\"");
1895 val = TREE_OPERAND (val, 1);
1896 if (type != NULL && TREE_CODE (type) == SET_TYPE
1897 && CH_BOOLS_TYPE_P (type))
1899 /* It's a bitstring. */
1900 tree domain = TYPE_DOMAIN (type);
1901 tree domain_max = TYPE_MAX_VALUE (domain);
1905 if (TREE_CODE (domain_max) != INTEGER_CST
1906 || (val && TREE_CODE (val) != TREE_LIST))
1909 len = TREE_INT_CST_LOW (domain_max) + 1;
1910 if (TREE_CODE (init) != CONSTRUCTOR)
1912 buf = (char *) alloca (len + 10);
1917 if (get_set_constructor_bits (init, ptr, len))
1919 for (; --len >= 0; ptr++)
1923 APPEND (result, buf);
1927 { /* It's some kind of tuple */
1928 if (type != NULL_TREE)
1930 mode_string = get_type (type);
1931 APPEND (result, mode_string->str);
1933 APPEND (result, " ");
1935 if (val == NULL_TREE
1936 || TREE_CODE (val) == ERROR_MARK)
1937 APPEND (result, "[ ]");
1938 else if (TREE_CODE (val) != TREE_LIST)
1942 APPEND (result, "[");
1945 tree lo_val = TREE_PURPOSE (val);
1946 tree hi_val = TREE_VALUE (val);
1947 MYSTRING *val_string;
1948 if (TUPLE_NAMED_FIELD (val))
1949 APPEND(result, ".");
1950 if (lo_val != NULL_TREE)
1952 val_string = decode_constant (lo_val);
1953 APPEND (result, val_string->str);
1955 APPEND (result, ":");
1957 val_string = decode_constant (hi_val);
1958 APPEND (result, val_string->str);
1960 val = TREE_CHAIN (val);
1961 if (val == NULL_TREE)
1963 APPEND (result, ", ");
1965 APPEND (result, "]");
1973 mode_string = decode_constant (TREE_OPERAND (init, 0));
1974 APPEND (result, mode_string->str);
1976 op1 = TREE_OPERAND (init, 1);
1977 if (TREE_CODE (op1) != IDENTIFIER_NODE)
1979 error ("decode_constant: invalid component_ref");
1982 APPEND (result, ".");
1983 APPEND (result, IDENTIFIER_POINTER (op1));
1987 error ("decode_constant: mode and value mismatch");
1990 error ("decode_constant: cannot decode this mode");
1997 decode_constant_selective (init, all_decls)
2001 MYSTRING *result = newstring ("");
2002 MYSTRING *tmp_string;
2003 tree type = TREE_TYPE (init);
2005 MYSTRING *mode_string;
2007 switch ((enum chill_tree_code)TREE_CODE (val))
2010 tmp_string = decode_constant_selective (TREE_OPERAND (val, 0), all_decls);
2011 if (tmp_string->len)
2012 APPEND (result, tmp_string->str);
2014 val = TREE_OPERAND (val, 1); /* argument list */
2015 if (val != NULL_TREE && TREE_CODE (val) != TREE_LIST)
2017 tmp_string = decode_constant_selective (val, all_decls);
2018 if (tmp_string->len)
2020 MAYBE_NEWLINE (result);
2021 APPEND (result, tmp_string->str);
2027 if (val != NULL_TREE)
2031 tmp_string = decode_constant_selective (TREE_VALUE (val), all_decls);
2032 if (tmp_string->len)
2034 MAYBE_NEWLINE (result);
2035 APPEND (result, tmp_string->str);
2038 val = TREE_CHAIN (val);
2039 if (val == NULL_TREE)
2047 /* Generate an "expression conversion" expression (a cast). */
2048 tmp_string = decode_mode_selective (type, all_decls);
2049 if (tmp_string->len)
2050 APPEND (result, tmp_string->str);
2052 val = TREE_OPERAND (val, 0);
2053 type = TREE_TYPE (val);
2055 /* If the coercee is a tuple, make sure it is prefixed by its mode. */
2056 if (TREE_CODE (val) == CONSTRUCTOR
2057 && !CH_BOOLS_TYPE_P (type) && !chill_varying_type_p (type))
2059 tmp_string = decode_mode_selective (type, all_decls);
2060 if (tmp_string->len)
2061 APPEND (result, tmp_string->str);
2065 tmp_string = decode_constant_selective (val, all_decls);
2066 if (tmp_string->len)
2067 APPEND (result, tmp_string->str);
2071 case IDENTIFIER_NODE:
2072 tmp_string = decode_mode_selective (val, all_decls);
2073 if (tmp_string->len)
2074 APPEND (result, tmp_string->str);
2079 tmp_string = decode_constant_selective (TREE_OPERAND (val, 0), all_decls);
2080 if (tmp_string->len)
2081 APPEND (result, tmp_string->str);
2085 case UNDEFINED_EXPR:
2091 case TRUNC_DIV_EXPR:
2092 case FLOOR_MOD_EXPR:
2093 case TRUNC_MOD_EXPR:
2097 case TRUTH_ORIF_EXPR:
2099 case TRUTH_ANDIF_EXPR:
2109 if (TREE_OPERAND (val, 0) == NULL_TREE)
2113 tmp_string = decode_constant_selective (TREE_OPERAND (val, 0), all_decls);
2114 if (tmp_string->len)
2115 APPEND (result, tmp_string->str);
2117 tmp_string = decode_constant_selective (TREE_OPERAND (val, 1), all_decls);
2118 if (tmp_string->len)
2120 MAYBE_NEWLINE (result);
2121 APPEND (result, tmp_string->str);
2126 case REPLICATE_EXPR:
2127 tmp_string = decode_constant_selective (TREE_OPERAND (val, 0), all_decls);
2128 if (tmp_string->len)
2129 APPEND (result, tmp_string->str);
2131 tmp_string = decode_constant_selective (TREE_OPERAND (val, 1), all_decls);
2132 if (tmp_string->len)
2134 MAYBE_NEWLINE (result);
2135 APPEND (result, tmp_string->str);
2143 tmp_string = decode_constant_selective (TREE_OPERAND (val, 0), all_decls);
2144 if (tmp_string->len)
2145 APPEND (result, tmp_string->str);
2159 val = TREE_OPERAND (val, 1);
2160 if (type != NULL && TREE_CODE (type) == SET_TYPE
2161 && CH_BOOLS_TYPE_P (type))
2162 /* It's a bitstring. */
2165 { /* It's some kind of tuple */
2166 if (type != NULL_TREE)
2168 mode_string = get_type_selective (type, all_decls);
2169 if (mode_string->len)
2170 APPEND (result, mode_string->str);
2173 if (val == NULL_TREE
2174 || TREE_CODE (val) == ERROR_MARK)
2176 else if (TREE_CODE (val) != TREE_LIST)
2182 tree lo_val = TREE_PURPOSE (val);
2183 tree hi_val = TREE_VALUE (val);
2184 MYSTRING *val_string;
2185 if (lo_val != NULL_TREE)
2187 val_string = decode_constant_selective (lo_val, all_decls);
2188 if (val_string->len)
2189 APPEND (result, val_string->str);
2192 val_string = decode_constant_selective (hi_val, all_decls);
2193 if (val_string->len)
2195 MAYBE_NEWLINE (result);
2196 APPEND (result, val_string->str);
2199 val = TREE_CHAIN (val);
2200 if (val == NULL_TREE)
2208 mode_string = decode_constant_selective (TREE_OPERAND (init, 0), all_decls);
2209 if (mode_string->len)
2210 APPEND (result, mode_string->str);
2215 error ("decode_constant_selective: mode and value mismatch");
2218 error ("decode_constant_selective: cannot decode this mode");
2224 /* Assuming DECL is an ALIAS_DECL, return its prefix rename clause. */
2227 decode_prefix_rename (decl)
2230 MYSTRING *result = newstring ("");
2231 if (DECL_OLD_PREFIX (decl) || DECL_NEW_PREFIX (decl))
2233 APPEND (result, "(");
2234 if (DECL_OLD_PREFIX (decl))
2235 APPEND (result, IDENTIFIER_POINTER (DECL_OLD_PREFIX (decl)));
2236 APPEND (result, "->");
2237 if (DECL_NEW_PREFIX (decl))
2238 APPEND (result, IDENTIFIER_POINTER (DECL_NEW_PREFIX (decl)));
2239 APPEND (result, ")!");
2241 if (DECL_POSTFIX_ALL (decl))
2242 APPEND (result, "ALL");
2244 APPEND (result, IDENTIFIER_POINTER (DECL_POSTFIX (decl)));
2252 MYSTRING *result = newstring ("");
2253 MYSTRING *mode_string;
2256 switch ((enum chill_tree_code)TREE_CODE (decl))
2260 APPEND (result, "DCL ");
2261 APPEND (result, IDENTIFIER_POINTER (DECL_NAME (decl)));
2262 APPEND (result, " ");
2263 mode_string = get_type (TREE_TYPE (decl));
2264 APPEND (result, mode_string->str);
2266 if ((enum chill_tree_code)TREE_CODE (decl) == BASED_DECL)
2268 APPEND (result, " BASED (");
2269 APPEND (result, IDENTIFIER_POINTER (DECL_ABSTRACT_ORIGIN (decl)));
2270 APPEND (result, ")");
2275 if (CH_DECL_SIGNAL (decl))
2277 /* this is really a signal */
2278 tree fields = TYPE_FIELDS (TREE_TYPE (decl));
2279 tree signame = DECL_NAME (decl);
2282 APPEND (result, "SIGNAL ");
2283 APPEND (result, IDENTIFIER_POINTER (signame));
2284 if (IDENTIFIER_SIGNAL_DATA (signame))
2286 APPEND (result, " = (");
2287 for ( ; fields != NULL_TREE;
2288 fields = TREE_CHAIN (fields))
2290 MYSTRING *mode_string;
2292 mode_string = get_type (TREE_TYPE (fields));
2293 APPEND (result, mode_string->str);
2295 if (TREE_CHAIN (fields) != NULL_TREE)
2296 APPEND (result, ", ");
2298 APPEND (result, ")");
2300 sigdest = IDENTIFIER_SIGNAL_DEST (signame);
2301 if (sigdest != NULL_TREE)
2303 APPEND (result, " TO ");
2304 APPEND (result, IDENTIFIER_POINTER (DECL_NAME (sigdest)));
2309 /* avoid defining a mode as itself */
2310 if (CH_NOVELTY (TREE_TYPE (decl)) == decl)
2311 APPEND (result, "NEWMODE ");
2313 APPEND (result, "SYNMODE ");
2314 APPEND (result, IDENTIFIER_POINTER (DECL_NAME (decl)));
2315 APPEND (result, " = ");
2316 mode_string = decode_mode (TREE_TYPE (decl));
2317 APPEND (result, mode_string->str);
2326 type = TREE_TYPE (decl);
2327 args = TYPE_ARG_TYPES (type);
2329 APPEND (result, IDENTIFIER_POINTER (DECL_NAME (decl)));
2331 if (CH_DECL_PROCESS (decl))
2332 APPEND (result, ": PROCESS (");
2334 APPEND (result, ": PROC (");
2336 args = TYPE_ARG_TYPES (type);
2338 mode_string = print_proc_tail (type, args, 1);
2339 APPEND (result, mode_string->str);
2343 if (CH_DECL_GENERAL (decl))
2344 APPEND (result, " GENERAL");
2345 if (CH_DECL_SIMPLE (decl))
2346 APPEND (result, " SIMPLE");
2347 if (DECL_INLINE (decl))
2348 APPEND (result, " INLINE");
2349 if (CH_DECL_RECURSIVE (decl))
2350 APPEND (result, " RECURSIVE");
2351 APPEND (result, " END");
2356 APPEND (result, IDENTIFIER_POINTER (DECL_NAME (decl)));
2357 APPEND (result, " ");
2358 mode_string = get_type (TREE_TYPE (decl));
2359 APPEND (result, mode_string->str);
2361 if (DECL_INITIAL (decl) != NULL_TREE)
2363 mode_string = decode_layout (DECL_INITIAL (decl));
2364 APPEND (result, mode_string->str);
2368 if (is_forbidden (DECL_NAME (decl), forbid))
2369 APPEND (result, " FORBID");
2374 if (DECL_INITIAL (decl) == NULL_TREE
2375 || TREE_CODE (DECL_INITIAL (decl)) == ERROR_MARK)
2377 APPEND (result, "SYN ");
2378 APPEND (result, IDENTIFIER_POINTER (DECL_NAME (decl)));
2379 APPEND (result, " ");
2380 mode_string = get_type (TREE_TYPE (decl));
2381 APPEND (result, mode_string->str);
2383 APPEND (result, " = ");
2384 mode_string = decode_constant (DECL_INITIAL (decl));
2385 APPEND (result, mode_string->str);
2390 /* If CH_DECL_GRANTED, decl was granted into this scope, and
2391 so wasn't in the source code. */
2392 if (!CH_DECL_GRANTED (decl))
2394 static int restricted = 0;
2396 if (DECL_SEIZEFILE (decl) != use_seizefile_name
2397 && DECL_SEIZEFILE (decl))
2399 use_seizefile_name = DECL_SEIZEFILE (decl);
2400 restricted = use_seizefile_name == NULL_TREE ? 0 : CH_USE_SEIZEFILE_RESTRICTED (use_seizefile_name);
2402 grant_use_seizefile (IDENTIFIER_POINTER (use_seizefile_name));
2403 mark_use_seizefile_written (use_seizefile_name);
2407 APPEND (result, "SEIZE ");
2408 mode_string = decode_prefix_rename (decl);
2409 APPEND (result, mode_string->str);
2416 APPEND (result, "----- not implemented ------");
2423 decode_decl_selective (decl, all_decls)
2427 MYSTRING *result = newstring ("");
2428 MYSTRING *mode_string;
2431 if (CH_ALREADY_GRANTED (decl))
2435 CH_ALREADY_GRANTED (decl) = 1;
2437 switch ((int)TREE_CODE (decl))
2441 mode_string = get_type_selective (TREE_TYPE (decl), all_decls);
2442 if (mode_string->len)
2443 APPEND (result, mode_string->str);
2445 if ((enum chill_tree_code)TREE_CODE (decl) == BASED_DECL)
2447 mode_string = decode_mode_selective (DECL_ABSTRACT_ORIGIN (decl), all_decls);
2448 if (mode_string->len)
2449 PREPEND (result, mode_string->str);
2455 if (CH_DECL_SIGNAL (decl))
2457 /* this is really a signal */
2458 tree fields = TYPE_FIELDS (TREE_TYPE (decl));
2459 tree signame = DECL_NAME (decl);
2462 if (IDENTIFIER_SIGNAL_DATA (signame))
2464 for ( ; fields != NULL_TREE;
2465 fields = TREE_CHAIN (fields))
2467 MYSTRING *mode_string;
2469 mode_string = get_type_selective (TREE_TYPE (fields),
2471 if (mode_string->len)
2472 APPEND (result, mode_string->str);
2476 sigdest = IDENTIFIER_SIGNAL_DEST (signame);
2477 if (sigdest != NULL_TREE)
2479 mode_string = decode_mode_selective (DECL_NAME (sigdest), all_decls);
2480 if (mode_string->len)
2482 MAYBE_NEWLINE (result);
2483 APPEND (result, mode_string->str);
2490 /* avoid defining a mode as itself */
2491 mode_string = decode_mode_selective (TREE_TYPE (decl), all_decls);
2492 APPEND (result, mode_string->str);
2501 type = TREE_TYPE (decl);
2502 args = TYPE_ARG_TYPES (type);
2504 args = TYPE_ARG_TYPES (type);
2506 mode_string = print_proc_tail_selective (type, args, all_decls);
2507 if (mode_string->len)
2508 APPEND (result, mode_string->str);
2514 mode_string = get_type_selective (TREE_TYPE (decl), all_decls);
2515 if (mode_string->len)
2516 APPEND (result, mode_string->str);
2521 if (DECL_INITIAL (decl) == NULL_TREE
2522 || TREE_CODE (DECL_INITIAL (decl)) == ERROR_MARK)
2524 mode_string = get_type_selective (TREE_TYPE (decl), all_decls);
2525 if (mode_string->len)
2526 APPEND (result, mode_string->str);
2528 mode_string = decode_constant_selective (DECL_INITIAL (decl), all_decls);
2529 if (mode_string->len)
2531 MAYBE_NEWLINE (result);
2532 APPEND (result, mode_string->str);
2538 MAYBE_NEWLINE (result);
2543 globalize_decl (decl)
2546 if (!TREE_PUBLIC (decl) && DECL_NAME (decl) &&
2547 (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL))
2549 extern FILE *asm_out_file;
2550 extern char *first_global_object_name;
2551 char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
2553 if (!first_global_object_name)
2554 first_global_object_name = name + (name[0] == '*');
2555 ASM_GLOBALIZE_LABEL (asm_out_file, name);
2561 grant_one_decl (decl)
2566 if (DECL_SOURCE_LINE (decl) == 0)
2568 result = decode_decl (decl);
2571 APPEND (result, ";\n");
2572 APPEND (gstring, result->str);
2578 grant_one_decl_selective (decl, all_decls)
2585 tree d = DECL_ABSTRACT_ORIGIN (decl);
2587 if (CH_ALREADY_GRANTED (d))
2591 result = decode_decl (d);
2599 APPEND (result, ";\n");
2601 /* now process all undefined items in the decl */
2602 fixups = decode_decl_selective (d, all_decls);
2605 PREPEND (result, fixups->str);
2609 /* we have finished a decl */
2610 APPEND (selective_gstring, result->str);
2615 compare_memory_file (fname, buf)
2622 /* check if we have something to write */
2623 if (!buf || !strlen (buf))
2626 if ((fb = fopen (fname, "r")) == NULL)
2629 while ((c = getc (fb)) != EOF)
2638 return (*buf ? 1 : 0);
2646 /* We only write out the grant file if it has changed,
2647 to avoid changing its time-stamp and triggering an
2648 unnecessary 'make' action. Return if no change. */
2649 if (gstring == NULL || !spec_module_generated ||
2650 !compare_memory_file (grant_file_name, gstring->str))
2653 fb = fopen (grant_file_name, "w");
2655 pfatal_with_name (grant_file_name);
2657 /* write file. Due to problems with record sizes on VAX/VMS
2658 write string to '\n' */
2660 /* do it this way for VMS, cause of problems with
2665 p1 = strchr (p, '\n');
2668 fprintf (fb, "%s", p);
2673 /* faster way to write */
2674 if (write (fileno (fb), gstring->str, gstring->len) < 0)
2676 int save_errno = errno;
2677 unlink (grant_file_name);
2679 pfatal_with_name (grant_file_name);
2686 /* handle grant statement */
2689 set_default_grant_file ()
2691 char *p, *tmp, *fname;
2694 fname = dump_base_name; /* Probably invoked via gcc */
2696 { /* Probably invoked directly (not via gcc) */
2697 fname = asm_file_name;
2699 fname = main_input_filename ? main_input_filename : input_filename;
2704 p = strrchr (fname, '.');
2707 tmp = (char *) alloca (strlen (fname) + 10);
2708 strcpy (tmp, fname);
2714 tmp = (char *) alloca (i + 10);
2715 strncpy (tmp, fname, i);
2718 strcat (tmp, ".grt");
2719 default_grant_file = build_string (strlen (tmp), tmp);
2721 grant_file_name = TREE_STRING_POINTER (default_grant_file);
2723 if (gstring == NULL)
2724 gstring = newstring ("");
2725 if (selective_gstring == NULL)
2726 selective_gstring = newstring ("");
2729 /* Make DECL visible under the name NAME in the (fake) outermost scope. */
2732 push_granted (name, decl)
2733 tree name ATTRIBUTE_UNUSED, decl ATTRIBUTE_UNUSED;
2736 IDENTIFIER_GRANTED_VALUE (name) = decl;
2737 granted_decls = tree_cons (name, decl, granted_decls);
2742 chill_grant (old_prefix, new_prefix, postfix, forbid)
2751 tree old_name = old_prefix == NULL_TREE ? postfix
2752 : get_identifier3 (IDENTIFIER_POINTER (old_prefix),
2753 "!", IDENTIFIER_POINTER (postfix));
2754 tree new_name = new_prefix == NULL_TREE ? postfix
2755 : get_identifier3 (IDENTIFIER_POINTER (new_prefix),
2756 "!", IDENTIFIER_POINTER (postfix));
2758 tree alias = build_alias_decl (old_prefix, new_prefix, postfix);
2759 CH_DECL_GRANTED (alias) = 1;
2760 DECL_SEIZEFILE (alias) = current_seizefile_name;
2761 TREE_CHAIN (alias) = current_module->granted_decls;
2762 current_module->granted_decls = alias;
2765 warning ("FORBID is not yet implemented"); /* FIXME */
2769 /* flag GRANT ALL only once. Avoids search in case of GRANT ALL. */
2770 static int grant_all_seen = 0;
2772 /* check if a decl is in the list of granted decls. */
2774 search_in_list (name, granted_decls)
2780 for (vars = granted_decls; vars != NULL_TREE; vars = TREE_CHAIN (vars))
2781 if (DECL_SOURCE_LINE (vars))
2783 if (DECL_POSTFIX_ALL (vars))
2788 else if (name == DECL_NAME (vars))
2796 really_grant_this (decl, granted_decls)
2800 /* we never grant labels at module level */
2801 if ((enum chill_tree_code)TREE_CODE (decl) == LABEL_DECL)
2807 switch ((enum chill_tree_code)TREE_CODE (decl))
2812 return search_in_list (DECL_NAME (decl), granted_decls);
2817 if (CH_DECL_SIGNAL (decl))
2818 return search_in_list (DECL_NAME (decl), granted_decls);
2825 /* this nerver should happen */
2826 error_with_decl (decl, "function \"really_grant_this\" called for `%s'.");
2830 /* Write a SPEC MODULE using the declarations in the list DECLS. */
2831 static int header_written = 0;
2832 #define HEADER_TEMPLATE "--\n-- WARNING: this file was generated by\n\
2833 -- GNUCHILL version %s\n-- based on gcc version %s\n--\n"
2836 write_spec_module (decls, granted_decls)
2843 if (granted_decls == NULL_TREE)
2846 use_seizefile_name = NULL_TREE;
2848 if (!header_written)
2850 hdr = (char*) alloca (strlen (gnuchill_version)
2851 + strlen (version_string)
2852 + sizeof (HEADER_TEMPLATE) /* includes \0 */);
2853 sprintf (hdr, HEADER_TEMPLATE, gnuchill_version, version_string);
2854 APPEND (gstring, hdr);
2857 APPEND (gstring, IDENTIFIER_POINTER (current_module->name));
2858 APPEND (gstring, ": SPEC MODULE\n");
2860 /* first of all we look for GRANT ALL specified */
2861 search_in_list (NULL_TREE, granted_decls);
2863 if (grant_all_seen != 0)
2865 /* write all identifiers to grant file */
2866 for (vars = decls; vars != NULL_TREE; vars = TREE_CHAIN (vars))
2868 if (DECL_SOURCE_LINE (vars))
2870 if (DECL_NAME (vars))
2872 if ((TREE_CODE (vars) != CONST_DECL || !CH_DECL_ENUM (vars)) &&
2873 really_grant_this (vars, granted_decls))
2874 grant_one_decl (vars);
2876 else if (DECL_POSTFIX_ALL (vars))
2878 static int restricted = 0;
2880 if (DECL_SEIZEFILE (vars) != use_seizefile_name
2881 && DECL_SEIZEFILE (vars))
2883 use_seizefile_name = DECL_SEIZEFILE (vars);
2884 restricted = use_seizefile_name == NULL_TREE ? 0 : CH_USE_SEIZEFILE_RESTRICTED (use_seizefile_name);
2886 grant_use_seizefile (IDENTIFIER_POINTER (use_seizefile_name));
2887 mark_use_seizefile_written (use_seizefile_name);
2891 APPEND (gstring, "SEIZE ALL;\n");
2899 seizefile_list *wrk, *x;
2901 /* do a selective write to the grantfile. This will reduce the
2902 size of a grantfile and speed up compilation of
2903 modules depending on this grant file */
2905 if (selective_gstring == 0)
2906 selective_gstring = newstring ("");
2908 /* first of all process all SEIZE ALL's */
2909 for (vars = decls; vars != NULL_TREE; vars = TREE_CHAIN (vars))
2911 if (DECL_SOURCE_LINE (vars)
2912 && DECL_POSTFIX_ALL (vars))
2913 grant_seized_identifier (vars);
2916 /* now walk through granted decls */
2917 granted_decls = nreverse (granted_decls);
2918 for (vars = granted_decls; vars != NULL_TREE; vars = TREE_CHAIN (vars))
2920 grant_one_decl_selective (vars, decls);
2922 granted_decls = nreverse (granted_decls);
2924 /* append all SEIZES */
2925 wrk = selective_seizes;
2929 APPEND (gstring, wrk->seizes->str);
2934 selective_seizes = 0;
2936 /* append generated string to grant file */
2937 APPEND (gstring, selective_gstring->str);
2938 FREE (selective_gstring);
2939 selective_gstring = NULL;
2942 for (vars = granted_decls; vars != NULL_TREE; vars = TREE_CHAIN (vars))
2943 if (DECL_SOURCE_LINE (vars))
2945 MYSTRING *mode_string = decode_prefix_rename (vars);
2946 APPEND (gstring, "GRANT ");
2947 APPEND (gstring, mode_string->str);
2949 APPEND (gstring, ";\n");
2952 APPEND (gstring, "END;\n");
2953 spec_module_generated = 1;
2955 /* initialize this for next spec module */
2960 * after the dark comes, after all of the modules are at rest,
2961 * we tuck the compilation unit to bed... A story in pass 1
2962 * and a hug-and-a-kiss goodnight in pass 2.
2965 chill_finish_compile ()
2968 tree chill_init_function;
2971 build_enum_tables ();
2973 /* We only need an initializer function for the source file if
2974 a) there's module-level code to be called, or
2975 b) tasking-related stuff to be initialized. */
2976 if (module_init_list != NULL_TREE || tasking_list != NULL_TREE)
2978 extern tree initializer_type;
2979 static tree chill_init_name;
2981 /* declare the global initializer list */
2982 global_list = do_decl (get_identifier ("_ch_init_list"),
2983 build_chill_pointer_type (initializer_type), 1, 0,
2986 /* Now, we're building the function which is the *real*
2987 constructor - if there's any module-level code in this
2988 source file, the compiler puts the file's initializer entry
2989 onto the global initializer list, so each module's body code
2990 will eventually get called, after all of the processes have
2993 /* This is better done in pass 2 (when first_global_object_name
2994 may have been set), but that is too late.
2995 Perhaps rewrite this so nothing is done in pass 1. */
2998 extern char *first_global_object_name;
2999 /* If we don't do this spoof, we get the name of the first
3000 tasking_code variable, and not the file name. */
3001 char *tmp = first_global_object_name;
3003 first_global_object_name = NULL;
3004 chill_init_name = get_file_function_name ('I');
3005 first_global_object_name = tmp;
3006 /* strip off the file's extension, if any. */
3007 tmp = strrchr (IDENTIFIER_POINTER (chill_init_name), '.');
3012 start_chill_function (chill_init_name, void_type_node, NULL_TREE,
3013 NULL_TREE, NULL_TREE);
3014 TREE_PUBLIC (current_function_decl) = 1;
3015 chill_init_function = current_function_decl;
3017 /* For each module that we've compiled, that had module-level
3018 code to be called, add its entry to the global initializer
3025 for (module_init = module_init_list;
3026 module_init != NULL_TREE;
3027 module_init = TREE_CHAIN (module_init))
3029 tree init_entry = TREE_VALUE (module_init);
3031 /* assign module_entry.next := _ch_init_list; */
3033 build_chill_modify_expr (
3034 build_component_ref (init_entry,
3035 get_identifier ("__INIT_NEXT")),
3038 /* assign _ch_init_list := &module_entry; */
3040 build_chill_modify_expr (global_list,
3041 build1 (ADDR_EXPR, ptr_type_node, init_entry)));
3045 tasking_registry ();
3047 make_decl_rtl (current_function_decl, NULL, 1);
3049 finish_chill_function ();
3053 assemble_constructor (IDENTIFIER_POINTER (chill_init_name));
3054 globalize_decl (chill_init_function);
3057 /* ready now to link decls onto this list in pass 2. */
3058 module_init_list = NULL_TREE;
3059 tasking_list = NULL_TREE;