2 Copyright (C) 2003, 2004, 2005, 2006, 2007
3 Free Software Foundation, Inc.
4 Contributed by Steven Bosscher
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, 51 Franklin Street, Fifth Floor, Boston, MA
24 /* Actually this is just a collection of routines that used to be
25 scattered around the sources. Now that they are all in a single
26 file, almost all of them can be static, and the other files don't
27 have this mess in them.
29 As a nice side-effect, this file can act as documentation of the
30 gfc_code and gfc_expr structures and all their friends and
38 /* Keep track of indentation for symbol tree dumps. */
39 static int show_level = 0;
41 /* Do indentation for a specific level. */
44 code_indent (int level, gfc_st_label *label)
49 gfc_status ("%-5d ", label->value);
53 for (i = 0; i < 2 * level; i++)
54 gfc_status_char (' ');
58 /* Simple indentation at the current level. This one
59 is used to show symbols. */
65 code_indent (show_level, NULL);
69 /* Show type-specific information. */
72 gfc_show_typespec (gfc_typespec *ts)
74 gfc_status ("(%s ", gfc_basic_typename (ts->type));
79 gfc_status ("%s", ts->derived->name);
83 gfc_show_expr (ts->cl->length);
87 gfc_status ("%d", ts->kind);
95 /* Show an actual argument list. */
98 gfc_show_actual_arglist (gfc_actual_arglist *a)
102 for (; a; a = a->next)
104 gfc_status_char ('(');
106 gfc_status ("%s = ", a->name);
108 gfc_show_expr (a->expr);
110 gfc_status ("(arg not-present)");
112 gfc_status_char (')');
121 /* Show a gfc_array_spec array specification structure. */
124 gfc_show_array_spec (gfc_array_spec *as)
135 gfc_status ("(%d", as->rank);
141 case AS_EXPLICIT: c = "AS_EXPLICIT"; break;
142 case AS_DEFERRED: c = "AS_DEFERRED"; break;
143 case AS_ASSUMED_SIZE: c = "AS_ASSUMED_SIZE"; break;
144 case AS_ASSUMED_SHAPE: c = "AS_ASSUMED_SHAPE"; break;
146 gfc_internal_error ("gfc_show_array_spec(): Unhandled array shape "
149 gfc_status (" %s ", c);
151 for (i = 0; i < as->rank; i++)
153 gfc_show_expr (as->lower[i]);
154 gfc_status_char (' ');
155 gfc_show_expr (as->upper[i]);
156 gfc_status_char (' ');
164 /* Show a gfc_array_ref array reference structure. */
167 gfc_show_array_ref (gfc_array_ref * ar)
171 gfc_status_char ('(');
180 for (i = 0; i < ar->dimen; i++)
182 /* There are two types of array sections: either the
183 elements are identified by an integer array ('vector'),
184 or by an index range. In the former case we only have to
185 print the start expression which contains the vector, in
186 the latter case we have to print any of lower and upper
187 bound and the stride, if they're present. */
189 if (ar->start[i] != NULL)
190 gfc_show_expr (ar->start[i]);
192 if (ar->dimen_type[i] == DIMEN_RANGE)
194 gfc_status_char (':');
196 if (ar->end[i] != NULL)
197 gfc_show_expr (ar->end[i]);
199 if (ar->stride[i] != NULL)
201 gfc_status_char (':');
202 gfc_show_expr (ar->stride[i]);
206 if (i != ar->dimen - 1)
212 for (i = 0; i < ar->dimen; i++)
214 gfc_show_expr (ar->start[i]);
215 if (i != ar->dimen - 1)
221 gfc_status ("UNKNOWN");
225 gfc_internal_error ("gfc_show_array_ref(): Unknown array reference");
228 gfc_status_char (')');
232 /* Show a list of gfc_ref structures. */
235 gfc_show_ref (gfc_ref *p)
237 for (; p; p = p->next)
241 gfc_show_array_ref (&p->u.ar);
245 gfc_status (" %% %s", p->u.c.component->name);
249 gfc_status_char ('(');
250 gfc_show_expr (p->u.ss.start);
251 gfc_status_char (':');
252 gfc_show_expr (p->u.ss.end);
253 gfc_status_char (')');
257 gfc_internal_error ("gfc_show_ref(): Bad component code");
262 /* Display a constructor. Works recursively for array constructors. */
265 gfc_show_constructor (gfc_constructor *c)
267 for (; c; c = c->next)
269 if (c->iterator == NULL)
270 gfc_show_expr (c->expr);
273 gfc_status_char ('(');
274 gfc_show_expr (c->expr);
276 gfc_status_char (' ');
277 gfc_show_expr (c->iterator->var);
278 gfc_status_char ('=');
279 gfc_show_expr (c->iterator->start);
280 gfc_status_char (',');
281 gfc_show_expr (c->iterator->end);
282 gfc_status_char (',');
283 gfc_show_expr (c->iterator->step);
285 gfc_status_char (')');
294 /* Show an expression. */
297 gfc_show_expr (gfc_expr *p)
308 switch (p->expr_type)
311 c = p->value.character.string;
313 for (i = 0; i < p->value.character.length; i++, c++)
318 gfc_status ("%c", *c);
321 gfc_show_ref (p->ref);
325 gfc_status ("%s(", p->ts.derived->name);
326 gfc_show_constructor (p->value.constructor);
327 gfc_status_char (')');
332 gfc_show_constructor (p->value.constructor);
335 gfc_show_ref (p->ref);
339 gfc_status ("NULL()");
343 if (p->from_H || p->ts.type == BT_HOLLERITH)
345 gfc_status ("%dH", p->value.character.length);
346 c = p->value.character.string;
347 for (i = 0; i < p->value.character.length; i++, c++)
349 gfc_status_char (*c);
356 mpz_out_str (stdout, 10, p->value.integer);
358 if (p->ts.kind != gfc_default_integer_kind)
359 gfc_status ("_%d", p->ts.kind);
363 if (p->value.logical)
364 gfc_status (".true.");
366 gfc_status (".false.");
370 mpfr_out_str (stdout, 10, 0, p->value.real, GFC_RND_MODE);
371 if (p->ts.kind != gfc_default_real_kind)
372 gfc_status ("_%d", p->ts.kind);
376 c = p->value.character.string;
378 gfc_status_char ('\'');
380 for (i = 0; i < p->value.character.length; i++, c++)
385 gfc_status_char (*c);
388 gfc_status_char ('\'');
393 gfc_status ("(complex ");
395 mpfr_out_str (stdout, 10, 0, p->value.complex.r, GFC_RND_MODE);
396 if (p->ts.kind != gfc_default_complex_kind)
397 gfc_status ("_%d", p->ts.kind);
401 mpfr_out_str (stdout, 10, 0, p->value.complex.i, GFC_RND_MODE);
402 if (p->ts.kind != gfc_default_complex_kind)
403 gfc_status ("_%d", p->ts.kind);
416 if (p->symtree->n.sym->ns && p->symtree->n.sym->ns->proc_name)
417 gfc_status ("%s:", p->symtree->n.sym->ns->proc_name->name);
418 gfc_status ("%s", p->symtree->n.sym->name);
419 gfc_show_ref (p->ref);
424 switch (p->value.op.operator)
426 case INTRINSIC_UPLUS:
429 case INTRINSIC_UMINUS:
435 case INTRINSIC_MINUS:
438 case INTRINSIC_TIMES:
441 case INTRINSIC_DIVIDE:
444 case INTRINSIC_POWER:
447 case INTRINSIC_CONCAT:
460 gfc_status ("NEQV ");
483 case INTRINSIC_PARENTHESES:
484 gfc_status ("parens");
489 ("gfc_show_expr(): Bad intrinsic in expression!");
492 gfc_show_expr (p->value.op.op1);
497 gfc_show_expr (p->value.op.op2);
504 if (p->value.function.name == NULL)
506 gfc_status ("%s[", p->symtree->n.sym->name);
507 gfc_show_actual_arglist (p->value.function.actual);
508 gfc_status_char (']');
512 gfc_status ("%s[[", p->value.function.name);
513 gfc_show_actual_arglist (p->value.function.actual);
514 gfc_status_char (']');
515 gfc_status_char (']');
521 gfc_internal_error ("gfc_show_expr(): Don't know how to show expr");
526 /* Show symbol attributes. The flavor and intent are followed by
527 whatever single bit attributes are present. */
530 gfc_show_attr (symbol_attribute *attr)
533 gfc_status ("(%s %s %s %s", gfc_code2string (flavors, attr->flavor),
534 gfc_intent_string (attr->intent),
535 gfc_code2string (access_types, attr->access),
536 gfc_code2string (procedures, attr->proc));
538 if (attr->allocatable)
539 gfc_status (" ALLOCATABLE");
541 gfc_status (" DIMENSION");
543 gfc_status (" EXTERNAL");
545 gfc_status (" INTRINSIC");
547 gfc_status (" OPTIONAL");
549 gfc_status (" POINTER");
551 gfc_status (" PROTECTED");
553 gfc_status (" SAVE");
555 gfc_status (" VALUE");
557 gfc_status (" VOLATILE");
558 if (attr->threadprivate)
559 gfc_status (" THREADPRIVATE");
561 gfc_status (" TARGET");
563 gfc_status (" DUMMY");
565 gfc_status (" RESULT");
567 gfc_status (" ENTRY");
570 gfc_status (" DATA");
572 gfc_status (" USE-ASSOC");
573 if (attr->in_namelist)
574 gfc_status (" IN-NAMELIST");
576 gfc_status (" IN-COMMON");
579 gfc_status (" FUNCTION");
580 if (attr->subroutine)
581 gfc_status (" SUBROUTINE");
582 if (attr->implicit_type)
583 gfc_status (" IMPLICIT-TYPE");
586 gfc_status (" SEQUENCE");
588 gfc_status (" ELEMENTAL");
590 gfc_status (" PURE");
592 gfc_status (" RECURSIVE");
598 /* Show components of a derived type. */
601 gfc_show_components (gfc_symbol *sym)
605 for (c = sym->components; c; c = c->next)
607 gfc_status ("(%s ", c->name);
608 gfc_show_typespec (&c->ts);
610 gfc_status (" POINTER");
612 gfc_status (" DIMENSION");
613 gfc_status_char (' ');
614 gfc_show_array_spec (c->as);
617 gfc_status_char (' ');
622 /* Show a symbol. If a symbol is an ENTRY, SUBROUTINE or FUNCTION, we
623 show the interface. Information needed to reconstruct the list of
624 specific interfaces associated with a generic symbol is done within
628 gfc_show_symbol (gfc_symbol *sym)
630 gfc_formal_arglist *formal;
638 gfc_status ("symbol %s ", sym->name);
639 gfc_show_typespec (&sym->ts);
640 gfc_show_attr (&sym->attr);
645 gfc_status ("value: ");
646 gfc_show_expr (sym->value);
652 gfc_status ("Array spec:");
653 gfc_show_array_spec (sym->as);
659 gfc_status ("Generic interfaces:");
660 for (intr = sym->generic; intr; intr = intr->next)
661 gfc_status (" %s", intr->sym->name);
667 gfc_status ("result: %s", sym->result->name);
673 gfc_status ("components: ");
674 gfc_show_components (sym);
680 gfc_status ("Formal arglist:");
682 for (formal = sym->formal; formal; formal = formal->next)
684 if (formal->sym != NULL)
685 gfc_status (" %s", formal->sym->name);
687 gfc_status (" [Alt Return]");
694 gfc_status ("Formal namespace");
695 gfc_show_namespace (sym->formal_ns);
698 gfc_status_char ('\n');
702 /* Show a user-defined operator. Just prints an operator
703 and the name of the associated subroutine, really. */
706 show_uop (gfc_user_op *uop)
711 gfc_status ("%s:", uop->name);
713 for (intr = uop->operator; intr; intr = intr->next)
714 gfc_status (" %s", intr->sym->name);
718 /* Workhorse function for traversing the user operator symtree. */
721 traverse_uop (gfc_symtree *st, void (*func) (gfc_user_op *))
728 traverse_uop (st->left, func);
729 traverse_uop (st->right, func);
733 /* Traverse the tree of user operator nodes. */
736 gfc_traverse_user_op (gfc_namespace *ns, void (*func) (gfc_user_op *))
738 traverse_uop (ns->uop_root, func);
742 /* Function to display a common block. */
745 show_common (gfc_symtree *st)
750 gfc_status ("common: /%s/ ", st->name);
752 s = st->n.common->head;
755 gfc_status ("%s", s->name);
760 gfc_status_char ('\n');
764 /* Worker function to display the symbol tree. */
767 show_symtree (gfc_symtree *st)
770 gfc_status ("symtree: %s Ambig %d", st->name, st->ambiguous);
772 if (st->n.sym->ns != gfc_current_ns)
773 gfc_status (" from namespace %s", st->n.sym->ns->proc_name->name);
775 gfc_show_symbol (st->n.sym);
779 /******************* Show gfc_code structures **************/
783 static void gfc_show_code_node (int, gfc_code *);
785 /* Show a list of code structures. Mutually recursive with
786 gfc_show_code_node(). */
789 gfc_show_code (int level, gfc_code *c)
791 for (; c; c = c->next)
792 gfc_show_code_node (level, c);
796 gfc_show_namelist (gfc_namelist *n)
798 for (; n->next; n = n->next)
799 gfc_status ("%s,", n->sym->name);
800 gfc_status ("%s", n->sym->name);
803 /* Show a single OpenMP directive node and everything underneath it
807 gfc_show_omp_node (int level, gfc_code *c)
809 gfc_omp_clauses *omp_clauses = NULL;
810 const char *name = NULL;
814 case EXEC_OMP_ATOMIC: name = "ATOMIC"; break;
815 case EXEC_OMP_BARRIER: name = "BARRIER"; break;
816 case EXEC_OMP_CRITICAL: name = "CRITICAL"; break;
817 case EXEC_OMP_FLUSH: name = "FLUSH"; break;
818 case EXEC_OMP_DO: name = "DO"; break;
819 case EXEC_OMP_MASTER: name = "MASTER"; break;
820 case EXEC_OMP_ORDERED: name = "ORDERED"; break;
821 case EXEC_OMP_PARALLEL: name = "PARALLEL"; break;
822 case EXEC_OMP_PARALLEL_DO: name = "PARALLEL DO"; break;
823 case EXEC_OMP_PARALLEL_SECTIONS: name = "PARALLEL SECTIONS"; break;
824 case EXEC_OMP_PARALLEL_WORKSHARE: name = "PARALLEL WORKSHARE"; break;
825 case EXEC_OMP_SECTIONS: name = "SECTIONS"; break;
826 case EXEC_OMP_SINGLE: name = "SINGLE"; break;
827 case EXEC_OMP_WORKSHARE: name = "WORKSHARE"; break;
831 gfc_status ("!$OMP %s", name);
835 case EXEC_OMP_PARALLEL:
836 case EXEC_OMP_PARALLEL_DO:
837 case EXEC_OMP_PARALLEL_SECTIONS:
838 case EXEC_OMP_SECTIONS:
839 case EXEC_OMP_SINGLE:
840 case EXEC_OMP_WORKSHARE:
841 case EXEC_OMP_PARALLEL_WORKSHARE:
842 omp_clauses = c->ext.omp_clauses;
844 case EXEC_OMP_CRITICAL:
846 gfc_status (" (%s)", c->ext.omp_name);
849 if (c->ext.omp_namelist)
852 gfc_show_namelist (c->ext.omp_namelist);
853 gfc_status_char (')');
856 case EXEC_OMP_BARRIER:
865 if (omp_clauses->if_expr)
868 gfc_show_expr (omp_clauses->if_expr);
869 gfc_status_char (')');
871 if (omp_clauses->num_threads)
873 gfc_status (" NUM_THREADS(");
874 gfc_show_expr (omp_clauses->num_threads);
875 gfc_status_char (')');
877 if (omp_clauses->sched_kind != OMP_SCHED_NONE)
880 switch (omp_clauses->sched_kind)
882 case OMP_SCHED_STATIC: type = "STATIC"; break;
883 case OMP_SCHED_DYNAMIC: type = "DYNAMIC"; break;
884 case OMP_SCHED_GUIDED: type = "GUIDED"; break;
885 case OMP_SCHED_RUNTIME: type = "RUNTIME"; break;
889 gfc_status (" SCHEDULE (%s", type);
890 if (omp_clauses->chunk_size)
892 gfc_status_char (',');
893 gfc_show_expr (omp_clauses->chunk_size);
895 gfc_status_char (')');
897 if (omp_clauses->default_sharing != OMP_DEFAULT_UNKNOWN)
900 switch (omp_clauses->default_sharing)
902 case OMP_DEFAULT_NONE: type = "NONE"; break;
903 case OMP_DEFAULT_PRIVATE: type = "PRIVATE"; break;
904 case OMP_DEFAULT_SHARED: type = "SHARED"; break;
905 case OMP_SCHED_RUNTIME: type = "RUNTIME"; break;
909 gfc_status (" DEFAULT(%s)", type);
911 if (omp_clauses->ordered)
912 gfc_status (" ORDERED");
913 for (list_type = 0; list_type < OMP_LIST_NUM; list_type++)
914 if (omp_clauses->lists[list_type] != NULL
915 && list_type != OMP_LIST_COPYPRIVATE)
918 if (list_type >= OMP_LIST_REDUCTION_FIRST)
922 case OMP_LIST_PLUS: type = "+"; break;
923 case OMP_LIST_MULT: type = "*"; break;
924 case OMP_LIST_SUB: type = "-"; break;
925 case OMP_LIST_AND: type = ".AND."; break;
926 case OMP_LIST_OR: type = ".OR."; break;
927 case OMP_LIST_EQV: type = ".EQV."; break;
928 case OMP_LIST_NEQV: type = ".NEQV."; break;
929 case OMP_LIST_MAX: type = "MAX"; break;
930 case OMP_LIST_MIN: type = "MIN"; break;
931 case OMP_LIST_IAND: type = "IAND"; break;
932 case OMP_LIST_IOR: type = "IOR"; break;
933 case OMP_LIST_IEOR: type = "IEOR"; break;
937 gfc_status (" REDUCTION(%s:", type);
943 case OMP_LIST_PRIVATE: type = "PRIVATE"; break;
944 case OMP_LIST_FIRSTPRIVATE: type = "FIRSTPRIVATE"; break;
945 case OMP_LIST_LASTPRIVATE: type = "LASTPRIVATE"; break;
946 case OMP_LIST_SHARED: type = "SHARED"; break;
947 case OMP_LIST_COPYIN: type = "COPYIN"; break;
951 gfc_status (" %s(", type);
953 gfc_show_namelist (omp_clauses->lists[list_type]);
954 gfc_status_char (')');
957 gfc_status_char ('\n');
958 if (c->op == EXEC_OMP_SECTIONS || c->op == EXEC_OMP_PARALLEL_SECTIONS)
960 gfc_code *d = c->block;
963 gfc_show_code (level + 1, d->next);
964 if (d->block == NULL)
966 code_indent (level, 0);
967 gfc_status ("!$OMP SECTION\n");
972 gfc_show_code (level + 1, c->block->next);
973 if (c->op == EXEC_OMP_ATOMIC)
975 code_indent (level, 0);
976 gfc_status ("!$OMP END %s", name);
977 if (omp_clauses != NULL)
979 if (omp_clauses->lists[OMP_LIST_COPYPRIVATE])
981 gfc_status (" COPYPRIVATE(");
982 gfc_show_namelist (omp_clauses->lists[OMP_LIST_COPYPRIVATE]);
983 gfc_status_char (')');
985 else if (omp_clauses->nowait)
986 gfc_status (" NOWAIT");
988 else if (c->op == EXEC_OMP_CRITICAL && c->ext.omp_name)
989 gfc_status (" (%s)", c->ext.omp_name);
993 /* Show a single code node and everything underneath it if necessary. */
996 gfc_show_code_node (int level, gfc_code *c)
998 gfc_forall_iterator *fa;
1008 code_indent (level, c->here);
1017 gfc_status ("CONTINUE");
1021 gfc_status ("ENTRY %s", c->ext.entry->sym->name);
1024 case EXEC_INIT_ASSIGN:
1026 gfc_status ("ASSIGN ");
1027 gfc_show_expr (c->expr);
1028 gfc_status_char (' ');
1029 gfc_show_expr (c->expr2);
1032 case EXEC_LABEL_ASSIGN:
1033 gfc_status ("LABEL ASSIGN ");
1034 gfc_show_expr (c->expr);
1035 gfc_status (" %d", c->label->value);
1038 case EXEC_POINTER_ASSIGN:
1039 gfc_status ("POINTER ASSIGN ");
1040 gfc_show_expr (c->expr);
1041 gfc_status_char (' ');
1042 gfc_show_expr (c->expr2);
1046 gfc_status ("GOTO ");
1048 gfc_status ("%d", c->label->value);
1051 gfc_show_expr (c->expr);
1056 for (; d; d = d ->block)
1058 code_indent (level, d->label);
1059 if (d->block != NULL)
1060 gfc_status_char (',');
1062 gfc_status_char (')');
1069 if (c->resolved_sym)
1070 gfc_status ("CALL %s ", c->resolved_sym->name);
1071 else if (c->symtree)
1072 gfc_status ("CALL %s ", c->symtree->name);
1074 gfc_status ("CALL ?? ");
1076 gfc_show_actual_arglist (c->ext.actual);
1080 gfc_status ("RETURN ");
1082 gfc_show_expr (c->expr);
1086 gfc_status ("PAUSE ");
1088 if (c->expr != NULL)
1089 gfc_show_expr (c->expr);
1091 gfc_status ("%d", c->ext.stop_code);
1096 gfc_status ("STOP ");
1098 if (c->expr != NULL)
1099 gfc_show_expr (c->expr);
1101 gfc_status ("%d", c->ext.stop_code);
1105 case EXEC_ARITHMETIC_IF:
1107 gfc_show_expr (c->expr);
1108 gfc_status (" %d, %d, %d",
1109 c->label->value, c->label2->value, c->label3->value);
1115 gfc_show_expr (d->expr);
1116 gfc_status_char ('\n');
1117 gfc_show_code (level + 1, d->next);
1120 for (; d; d = d->block)
1122 code_indent (level, 0);
1124 if (d->expr == NULL)
1125 gfc_status ("ELSE\n");
1128 gfc_status ("ELSE IF ");
1129 gfc_show_expr (d->expr);
1130 gfc_status_char ('\n');
1133 gfc_show_code (level + 1, d->next);
1136 code_indent (level, c->label);
1138 gfc_status ("ENDIF");
1143 gfc_status ("SELECT CASE ");
1144 gfc_show_expr (c->expr);
1145 gfc_status_char ('\n');
1147 for (; d; d = d->block)
1149 code_indent (level, 0);
1151 gfc_status ("CASE ");
1152 for (cp = d->ext.case_list; cp; cp = cp->next)
1154 gfc_status_char ('(');
1155 gfc_show_expr (cp->low);
1156 gfc_status_char (' ');
1157 gfc_show_expr (cp->high);
1158 gfc_status_char (')');
1159 gfc_status_char (' ');
1161 gfc_status_char ('\n');
1163 gfc_show_code (level + 1, d->next);
1166 code_indent (level, c->label);
1167 gfc_status ("END SELECT");
1171 gfc_status ("WHERE ");
1174 gfc_show_expr (d->expr);
1175 gfc_status_char ('\n');
1177 gfc_show_code (level + 1, d->next);
1179 for (d = d->block; d; d = d->block)
1181 code_indent (level, 0);
1182 gfc_status ("ELSE WHERE ");
1183 gfc_show_expr (d->expr);
1184 gfc_status_char ('\n');
1185 gfc_show_code (level + 1, d->next);
1188 code_indent (level, 0);
1189 gfc_status ("END WHERE");
1194 gfc_status ("FORALL ");
1195 for (fa = c->ext.forall_iterator; fa; fa = fa->next)
1197 gfc_show_expr (fa->var);
1198 gfc_status_char (' ');
1199 gfc_show_expr (fa->start);
1200 gfc_status_char (':');
1201 gfc_show_expr (fa->end);
1202 gfc_status_char (':');
1203 gfc_show_expr (fa->stride);
1205 if (fa->next != NULL)
1206 gfc_status_char (',');
1209 if (c->expr != NULL)
1211 gfc_status_char (',');
1212 gfc_show_expr (c->expr);
1214 gfc_status_char ('\n');
1216 gfc_show_code (level + 1, c->block->next);
1218 code_indent (level, 0);
1219 gfc_status ("END FORALL");
1225 gfc_show_expr (c->ext.iterator->var);
1226 gfc_status_char ('=');
1227 gfc_show_expr (c->ext.iterator->start);
1228 gfc_status_char (' ');
1229 gfc_show_expr (c->ext.iterator->end);
1230 gfc_status_char (' ');
1231 gfc_show_expr (c->ext.iterator->step);
1232 gfc_status_char ('\n');
1234 gfc_show_code (level + 1, c->block->next);
1236 code_indent (level, 0);
1237 gfc_status ("END DO");
1241 gfc_status ("DO WHILE ");
1242 gfc_show_expr (c->expr);
1243 gfc_status_char ('\n');
1245 gfc_show_code (level + 1, c->block->next);
1247 code_indent (level, c->label);
1248 gfc_status ("END DO");
1252 gfc_status ("CYCLE");
1254 gfc_status (" %s", c->symtree->n.sym->name);
1258 gfc_status ("EXIT");
1260 gfc_status (" %s", c->symtree->n.sym->name);
1264 gfc_status ("ALLOCATE ");
1267 gfc_status (" STAT=");
1268 gfc_show_expr (c->expr);
1271 for (a = c->ext.alloc_list; a; a = a->next)
1273 gfc_status_char (' ');
1274 gfc_show_expr (a->expr);
1279 case EXEC_DEALLOCATE:
1280 gfc_status ("DEALLOCATE ");
1283 gfc_status (" STAT=");
1284 gfc_show_expr (c->expr);
1287 for (a = c->ext.alloc_list; a; a = a->next)
1289 gfc_status_char (' ');
1290 gfc_show_expr (a->expr);
1296 gfc_status ("OPEN");
1301 gfc_status (" UNIT=");
1302 gfc_show_expr (open->unit);
1306 gfc_status (" IOMSG=");
1307 gfc_show_expr (open->iomsg);
1311 gfc_status (" IOSTAT=");
1312 gfc_show_expr (open->iostat);
1316 gfc_status (" FILE=");
1317 gfc_show_expr (open->file);
1321 gfc_status (" STATUS=");
1322 gfc_show_expr (open->status);
1326 gfc_status (" ACCESS=");
1327 gfc_show_expr (open->access);
1331 gfc_status (" FORM=");
1332 gfc_show_expr (open->form);
1336 gfc_status (" RECL=");
1337 gfc_show_expr (open->recl);
1341 gfc_status (" BLANK=");
1342 gfc_show_expr (open->blank);
1346 gfc_status (" POSITION=");
1347 gfc_show_expr (open->position);
1351 gfc_status (" ACTION=");
1352 gfc_show_expr (open->action);
1356 gfc_status (" DELIM=");
1357 gfc_show_expr (open->delim);
1361 gfc_status (" PAD=");
1362 gfc_show_expr (open->pad);
1366 gfc_status (" CONVERT=");
1367 gfc_show_expr (open->convert);
1369 if (open->err != NULL)
1370 gfc_status (" ERR=%d", open->err->value);
1375 gfc_status ("CLOSE");
1376 close = c->ext.close;
1380 gfc_status (" UNIT=");
1381 gfc_show_expr (close->unit);
1385 gfc_status (" IOMSG=");
1386 gfc_show_expr (close->iomsg);
1390 gfc_status (" IOSTAT=");
1391 gfc_show_expr (close->iostat);
1395 gfc_status (" STATUS=");
1396 gfc_show_expr (close->status);
1398 if (close->err != NULL)
1399 gfc_status (" ERR=%d", close->err->value);
1402 case EXEC_BACKSPACE:
1403 gfc_status ("BACKSPACE");
1407 gfc_status ("ENDFILE");
1411 gfc_status ("REWIND");
1415 gfc_status ("FLUSH");
1418 fp = c->ext.filepos;
1422 gfc_status (" UNIT=");
1423 gfc_show_expr (fp->unit);
1427 gfc_status (" IOMSG=");
1428 gfc_show_expr (fp->iomsg);
1432 gfc_status (" IOSTAT=");
1433 gfc_show_expr (fp->iostat);
1435 if (fp->err != NULL)
1436 gfc_status (" ERR=%d", fp->err->value);
1440 gfc_status ("INQUIRE");
1445 gfc_status (" UNIT=");
1446 gfc_show_expr (i->unit);
1450 gfc_status (" FILE=");
1451 gfc_show_expr (i->file);
1456 gfc_status (" IOMSG=");
1457 gfc_show_expr (i->iomsg);
1461 gfc_status (" IOSTAT=");
1462 gfc_show_expr (i->iostat);
1466 gfc_status (" EXIST=");
1467 gfc_show_expr (i->exist);
1471 gfc_status (" OPENED=");
1472 gfc_show_expr (i->opened);
1476 gfc_status (" NUMBER=");
1477 gfc_show_expr (i->number);
1481 gfc_status (" NAMED=");
1482 gfc_show_expr (i->named);
1486 gfc_status (" NAME=");
1487 gfc_show_expr (i->name);
1491 gfc_status (" ACCESS=");
1492 gfc_show_expr (i->access);
1496 gfc_status (" SEQUENTIAL=");
1497 gfc_show_expr (i->sequential);
1502 gfc_status (" DIRECT=");
1503 gfc_show_expr (i->direct);
1507 gfc_status (" FORM=");
1508 gfc_show_expr (i->form);
1512 gfc_status (" FORMATTED");
1513 gfc_show_expr (i->formatted);
1517 gfc_status (" UNFORMATTED=");
1518 gfc_show_expr (i->unformatted);
1522 gfc_status (" RECL=");
1523 gfc_show_expr (i->recl);
1527 gfc_status (" NEXTREC=");
1528 gfc_show_expr (i->nextrec);
1532 gfc_status (" BLANK=");
1533 gfc_show_expr (i->blank);
1537 gfc_status (" POSITION=");
1538 gfc_show_expr (i->position);
1542 gfc_status (" ACTION=");
1543 gfc_show_expr (i->action);
1547 gfc_status (" READ=");
1548 gfc_show_expr (i->read);
1552 gfc_status (" WRITE=");
1553 gfc_show_expr (i->write);
1557 gfc_status (" READWRITE=");
1558 gfc_show_expr (i->readwrite);
1562 gfc_status (" DELIM=");
1563 gfc_show_expr (i->delim);
1567 gfc_status (" PAD=");
1568 gfc_show_expr (i->pad);
1572 gfc_status (" CONVERT=");
1573 gfc_show_expr (i->convert);
1577 gfc_status (" ERR=%d", i->err->value);
1581 gfc_status ("IOLENGTH ");
1582 gfc_show_expr (c->expr);
1587 gfc_status ("READ");
1591 gfc_status ("WRITE");
1597 gfc_status (" UNIT=");
1598 gfc_show_expr (dt->io_unit);
1601 if (dt->format_expr)
1603 gfc_status (" FMT=");
1604 gfc_show_expr (dt->format_expr);
1607 if (dt->format_label != NULL)
1608 gfc_status (" FMT=%d", dt->format_label->value);
1610 gfc_status (" NML=%s", dt->namelist->name);
1614 gfc_status (" IOMSG=");
1615 gfc_show_expr (dt->iomsg);
1619 gfc_status (" IOSTAT=");
1620 gfc_show_expr (dt->iostat);
1624 gfc_status (" SIZE=");
1625 gfc_show_expr (dt->size);
1629 gfc_status (" REC=");
1630 gfc_show_expr (dt->rec);
1634 gfc_status (" ADVANCE=");
1635 gfc_show_expr (dt->advance);
1639 gfc_status_char ('\n');
1640 for (c = c->block->next; c; c = c->next)
1641 gfc_show_code_node (level + (c->next != NULL), c);
1645 gfc_status ("TRANSFER ");
1646 gfc_show_expr (c->expr);
1650 gfc_status ("DT_END");
1653 if (dt->err != NULL)
1654 gfc_status (" ERR=%d", dt->err->value);
1655 if (dt->end != NULL)
1656 gfc_status (" END=%d", dt->end->value);
1657 if (dt->eor != NULL)
1658 gfc_status (" EOR=%d", dt->eor->value);
1661 case EXEC_OMP_ATOMIC:
1662 case EXEC_OMP_BARRIER:
1663 case EXEC_OMP_CRITICAL:
1664 case EXEC_OMP_FLUSH:
1666 case EXEC_OMP_MASTER:
1667 case EXEC_OMP_ORDERED:
1668 case EXEC_OMP_PARALLEL:
1669 case EXEC_OMP_PARALLEL_DO:
1670 case EXEC_OMP_PARALLEL_SECTIONS:
1671 case EXEC_OMP_PARALLEL_WORKSHARE:
1672 case EXEC_OMP_SECTIONS:
1673 case EXEC_OMP_SINGLE:
1674 case EXEC_OMP_WORKSHARE:
1675 gfc_show_omp_node (level, c);
1679 gfc_internal_error ("gfc_show_code_node(): Bad statement code");
1682 gfc_status_char ('\n');
1686 /* Show an equivalence chain. */
1689 gfc_show_equiv (gfc_equiv *eq)
1692 gfc_status ("Equivalence: ");
1695 gfc_show_expr (eq->expr);
1703 /* Show a freakin' whole namespace. */
1706 gfc_show_namespace (gfc_namespace *ns)
1708 gfc_interface *intr;
1709 gfc_namespace *save;
1710 gfc_intrinsic_op op;
1714 save = gfc_current_ns;
1718 gfc_status ("Namespace:");
1726 while (i < GFC_LETTERS - 1
1727 && gfc_compare_types(&ns->default_type[i+1],
1728 &ns->default_type[l]))
1732 gfc_status(" %c-%c: ", l+'A', i+'A');
1734 gfc_status(" %c: ", l+'A');
1736 gfc_show_typespec(&ns->default_type[l]);
1738 } while (i < GFC_LETTERS);
1740 if (ns->proc_name != NULL)
1743 gfc_status ("procedure name = %s", ns->proc_name->name);
1746 gfc_current_ns = ns;
1747 gfc_traverse_symtree (ns->common_root, show_common);
1749 gfc_traverse_symtree (ns->sym_root, show_symtree);
1751 for (op = GFC_INTRINSIC_BEGIN; op != GFC_INTRINSIC_END; op++)
1753 /* User operator interfaces */
1754 intr = ns->operator[op];
1759 gfc_status ("Operator interfaces for %s:", gfc_op2string (op));
1761 for (; intr; intr = intr->next)
1762 gfc_status (" %s", intr->sym->name);
1765 if (ns->uop_root != NULL)
1768 gfc_status ("User operators:\n");
1769 gfc_traverse_user_op (ns, show_uop);
1773 for (eq = ns->equiv; eq; eq = eq->next)
1774 gfc_show_equiv (eq);
1776 gfc_status_char ('\n');
1777 gfc_status_char ('\n');
1779 gfc_show_code (0, ns->code);
1781 for (ns = ns->contained; ns; ns = ns->sibling)
1784 gfc_status ("CONTAINS\n");
1785 gfc_show_namespace (ns);
1789 gfc_status_char ('\n');
1790 gfc_current_ns = save;