2 Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
3 Contributed by Steven Bosscher
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING. If not, write to the Free
19 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
23 /* Actually this is just a collection of routines that used to be
24 scattered around the sources. Now that they are all in a single
25 file, almost all of them can be static, and the other files don't
26 have this mess in them.
28 As a nice side-effect, this file can act as documentation of the
29 gfc_code and gfc_expr structures and all their friends and
37 /* Keep track of indentation for symbol tree dumps. */
38 static int show_level = 0;
40 /* Do indentation for a specific level. */
43 code_indent (int level, gfc_st_label * label)
48 gfc_status ("%-5d ", label->value);
52 for (i = 0; i < 2 * level; i++)
53 gfc_status_char (' ');
57 /* Simple indentation at the current level. This one
58 is used to show symbols. */
64 code_indent (show_level, NULL);
68 /* Show type-specific information. */
71 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)
103 for (; a; a = a->next)
105 gfc_status_char ('(');
107 gfc_status ("%s = ", a->name);
109 gfc_show_expr (a->expr);
111 gfc_status ("(arg not-present)");
113 gfc_status_char (')');
122 /* Show a gfc_array_spec array specification structure. */
125 gfc_show_array_spec (gfc_array_spec * as)
136 gfc_status ("(%d", as->rank);
142 case AS_EXPLICIT: c = "AS_EXPLICIT"; break;
143 case AS_DEFERRED: c = "AS_DEFERRED"; break;
144 case AS_ASSUMED_SIZE: c = "AS_ASSUMED_SIZE"; break;
145 case AS_ASSUMED_SHAPE: c = "AS_ASSUMED_SHAPE"; break;
148 ("gfc_show_array_spec(): Unhandled array shape type.");
150 gfc_status (" %s ", c);
152 for (i = 0; i < as->rank; i++)
154 gfc_show_expr (as->lower[i]);
155 gfc_status_char (' ');
156 gfc_show_expr (as->upper[i]);
157 gfc_status_char (' ');
165 /* Show a gfc_array_ref array reference structure. */
168 gfc_show_array_ref (gfc_array_ref * ar)
172 gfc_status_char ('(');
181 for (i = 0; i < ar->dimen; i++)
183 /* There are two types of array sections: either the
184 elements are identified by an integer array ('vector'),
185 or by an index range. In the former case we only have to
186 print the start expression which contains the vector, in
187 the latter case we have to print any of lower and upper
188 bound and the stride, if they're present. */
190 if (ar->start[i] != NULL)
191 gfc_show_expr (ar->start[i]);
193 if (ar->dimen_type[i] == DIMEN_RANGE)
195 gfc_status_char (':');
197 if (ar->end[i] != NULL)
198 gfc_show_expr (ar->end[i]);
200 if (ar->stride[i] != NULL)
202 gfc_status_char (':');
203 gfc_show_expr (ar->stride[i]);
207 if (i != ar->dimen - 1)
213 for (i = 0; i < ar->dimen; i++)
215 gfc_show_expr (ar->start[i]);
216 if (i != ar->dimen - 1)
222 gfc_status ("UNKNOWN");
226 gfc_internal_error ("gfc_show_array_ref(): Unknown array reference");
229 gfc_status_char (')');
233 /* Show a list of gfc_ref structures. */
236 gfc_show_ref (gfc_ref * p)
239 for (; p; p = p->next)
243 gfc_show_array_ref (&p->u.ar);
247 gfc_status (" %% %s", p->u.c.component->name);
251 gfc_status_char ('(');
252 gfc_show_expr (p->u.ss.start);
253 gfc_status_char (':');
254 gfc_show_expr (p->u.ss.end);
255 gfc_status_char (')');
259 gfc_internal_error ("gfc_show_ref(): Bad component code");
264 /* Display a constructor. Works recursively for array constructors. */
267 gfc_show_constructor (gfc_constructor * c)
270 for (; c; c = c->next)
272 if (c->iterator == NULL)
273 gfc_show_expr (c->expr);
276 gfc_status_char ('(');
277 gfc_show_expr (c->expr);
279 gfc_status_char (' ');
280 gfc_show_expr (c->iterator->var);
281 gfc_status_char ('=');
282 gfc_show_expr (c->iterator->start);
283 gfc_status_char (',');
284 gfc_show_expr (c->iterator->end);
285 gfc_status_char (',');
286 gfc_show_expr (c->iterator->step);
288 gfc_status_char (')');
297 /* Show an expression. */
300 gfc_show_expr (gfc_expr * p)
311 switch (p->expr_type)
314 c = p->value.character.string;
316 for (i = 0; i < p->value.character.length; i++, c++)
321 gfc_status ("%c", *c);
324 gfc_show_ref (p->ref);
328 gfc_status ("%s(", p->ts.derived->name);
329 gfc_show_constructor (p->value.constructor);
330 gfc_status_char (')');
335 gfc_show_constructor (p->value.constructor);
338 gfc_show_ref (p->ref);
342 gfc_status ("NULL()");
346 if (p->from_H || p->ts.type == BT_HOLLERITH)
348 gfc_status ("%dH", p->value.character.length);
349 c = p->value.character.string;
350 for (i = 0; i < p->value.character.length; i++, c++)
352 gfc_status_char (*c);
359 mpz_out_str (stdout, 10, p->value.integer);
361 if (p->ts.kind != gfc_default_integer_kind)
362 gfc_status ("_%d", p->ts.kind);
366 if (p->value.logical)
367 gfc_status (".true.");
369 gfc_status (".false.");
373 mpfr_out_str (stdout, 10, 0, p->value.real, GFC_RND_MODE);
374 if (p->ts.kind != gfc_default_real_kind)
375 gfc_status ("_%d", p->ts.kind);
379 c = p->value.character.string;
381 gfc_status_char ('\'');
383 for (i = 0; i < p->value.character.length; i++, c++)
388 gfc_status_char (*c);
391 gfc_status_char ('\'');
396 gfc_status ("(complex ");
398 mpfr_out_str (stdout, 10, 0, p->value.complex.r, GFC_RND_MODE);
399 if (p->ts.kind != gfc_default_complex_kind)
400 gfc_status ("_%d", p->ts.kind);
404 mpfr_out_str (stdout, 10, 0, p->value.complex.i, GFC_RND_MODE);
405 if (p->ts.kind != gfc_default_complex_kind)
406 gfc_status ("_%d", p->ts.kind);
419 if (p->symtree->n.sym->ns && p->symtree->n.sym->ns->proc_name)
420 gfc_status ("%s:", p->symtree->n.sym->ns->proc_name->name);
421 gfc_status ("%s", p->symtree->n.sym->name);
422 gfc_show_ref (p->ref);
427 switch (p->value.op.operator)
429 case INTRINSIC_UPLUS:
432 case INTRINSIC_UMINUS:
438 case INTRINSIC_MINUS:
441 case INTRINSIC_TIMES:
444 case INTRINSIC_DIVIDE:
447 case INTRINSIC_POWER:
450 case INTRINSIC_CONCAT:
463 gfc_status ("NEQV ");
486 case INTRINSIC_PARENTHESES:
487 gfc_status ("parens");
492 ("gfc_show_expr(): Bad intrinsic in expression!");
495 gfc_show_expr (p->value.op.op1);
500 gfc_show_expr (p->value.op.op2);
507 if (p->value.function.name == NULL)
509 gfc_status ("%s[", p->symtree->n.sym->name);
510 gfc_show_actual_arglist (p->value.function.actual);
511 gfc_status_char (']');
515 gfc_status ("%s[[", p->value.function.name);
516 gfc_show_actual_arglist (p->value.function.actual);
517 gfc_status_char (']');
518 gfc_status_char (']');
524 gfc_internal_error ("gfc_show_expr(): Don't know how to show expr");
529 /* Show symbol attributes. The flavor and intent are followed by
530 whatever single bit attributes are present. */
533 gfc_show_attr (symbol_attribute * attr)
536 gfc_status ("(%s %s %s %s", gfc_code2string (flavors, attr->flavor),
537 gfc_intent_string (attr->intent),
538 gfc_code2string (access_types, attr->access),
539 gfc_code2string (procedures, attr->proc));
541 if (attr->allocatable)
542 gfc_status (" ALLOCATABLE");
544 gfc_status (" DIMENSION");
546 gfc_status (" EXTERNAL");
548 gfc_status (" INTRINSIC");
550 gfc_status (" OPTIONAL");
552 gfc_status (" POINTER");
554 gfc_status (" SAVE");
556 gfc_status (" VALUE");
558 gfc_status (" VOLATILE");
559 if (attr->threadprivate)
560 gfc_status (" THREADPRIVATE");
562 gfc_status (" TARGET");
564 gfc_status (" DUMMY");
566 gfc_status (" RESULT");
568 gfc_status (" ENTRY");
571 gfc_status (" DATA");
573 gfc_status (" USE-ASSOC");
574 if (attr->in_namelist)
575 gfc_status (" IN-NAMELIST");
577 gfc_status (" IN-COMMON");
580 gfc_status (" FUNCTION");
581 if (attr->subroutine)
582 gfc_status (" SUBROUTINE");
583 if (attr->implicit_type)
584 gfc_status (" IMPLICIT-TYPE");
587 gfc_status (" SEQUENCE");
589 gfc_status (" ELEMENTAL");
591 gfc_status (" PURE");
593 gfc_status (" RECURSIVE");
599 /* Show components of a derived type. */
602 gfc_show_components (gfc_symbol * sym)
606 for (c = sym->components; c; c = c->next)
608 gfc_status ("(%s ", c->name);
609 gfc_show_typespec (&c->ts);
611 gfc_status (" POINTER");
613 gfc_status (" DIMENSION");
614 gfc_status_char (' ');
615 gfc_show_array_spec (c->as);
618 gfc_status_char (' ');
623 /* Show a symbol. If a symbol is an ENTRY, SUBROUTINE or FUNCTION, we
624 show the interface. Information needed to reconstruct the list of
625 specific interfaces associated with a generic symbol is done within
629 gfc_show_symbol (gfc_symbol * sym)
631 gfc_formal_arglist *formal;
639 gfc_status ("symbol %s ", sym->name);
640 gfc_show_typespec (&sym->ts);
641 gfc_show_attr (&sym->attr);
646 gfc_status ("value: ");
647 gfc_show_expr (sym->value);
653 gfc_status ("Array spec:");
654 gfc_show_array_spec (sym->as);
660 gfc_status ("Generic interfaces:");
661 for (intr = sym->generic; intr; intr = intr->next)
662 gfc_status (" %s", intr->sym->name);
668 gfc_status ("result: %s", sym->result->name);
674 gfc_status ("components: ");
675 gfc_show_components (sym);
681 gfc_status ("Formal arglist:");
683 for (formal = sym->formal; formal; formal = formal->next)
685 if (formal->sym != NULL)
686 gfc_status (" %s", formal->sym->name);
688 gfc_status (" [Alt Return]");
695 gfc_status ("Formal namespace");
696 gfc_show_namespace (sym->formal_ns);
699 gfc_status_char ('\n');
703 /* Show a user-defined operator. Just prints an operator
704 and the name of the associated subroutine, really. */
707 show_uop (gfc_user_op * uop)
712 gfc_status ("%s:", uop->name);
714 for (intr = uop->operator; intr; intr = intr->next)
715 gfc_status (" %s", intr->sym->name);
719 /* Workhorse function for traversing the user operator symtree. */
722 traverse_uop (gfc_symtree * st, void (*func) (gfc_user_op *))
730 traverse_uop (st->left, func);
731 traverse_uop (st->right, func);
735 /* Traverse the tree of user operator nodes. */
738 gfc_traverse_user_op (gfc_namespace * ns, void (*func) (gfc_user_op *))
741 traverse_uop (ns->uop_root, func);
745 /* Function to display a common block. */
748 show_common (gfc_symtree * st)
753 gfc_status ("common: /%s/ ", st->name);
755 s = st->n.common->head;
758 gfc_status ("%s", s->name);
763 gfc_status_char ('\n');
767 /* Worker function to display the symbol tree. */
770 show_symtree (gfc_symtree * st)
774 gfc_status ("symtree: %s Ambig %d", st->name, st->ambiguous);
776 if (st->n.sym->ns != gfc_current_ns)
777 gfc_status (" from namespace %s", st->n.sym->ns->proc_name->name);
779 gfc_show_symbol (st->n.sym);
783 /******************* Show gfc_code structures **************/
787 static void gfc_show_code_node (int level, gfc_code * c);
789 /* Show a list of code structures. Mutually recursive with
790 gfc_show_code_node(). */
793 gfc_show_code (int level, gfc_code * c)
796 for (; c; c = c->next)
797 gfc_show_code_node (level, c);
801 gfc_show_namelist (gfc_namelist *n)
803 for (; n->next; n = n->next)
804 gfc_status ("%s,", n->sym->name);
805 gfc_status ("%s", n->sym->name);
808 /* Show a single OpenMP directive node and everything underneath it
812 gfc_show_omp_node (int level, gfc_code * c)
814 gfc_omp_clauses *omp_clauses = NULL;
815 const char *name = NULL;
819 case EXEC_OMP_ATOMIC: name = "ATOMIC"; break;
820 case EXEC_OMP_BARRIER: name = "BARRIER"; break;
821 case EXEC_OMP_CRITICAL: name = "CRITICAL"; break;
822 case EXEC_OMP_FLUSH: name = "FLUSH"; break;
823 case EXEC_OMP_DO: name = "DO"; break;
824 case EXEC_OMP_MASTER: name = "MASTER"; break;
825 case EXEC_OMP_ORDERED: name = "ORDERED"; break;
826 case EXEC_OMP_PARALLEL: name = "PARALLEL"; break;
827 case EXEC_OMP_PARALLEL_DO: name = "PARALLEL DO"; break;
828 case EXEC_OMP_PARALLEL_SECTIONS: name = "PARALLEL SECTIONS"; break;
829 case EXEC_OMP_PARALLEL_WORKSHARE: name = "PARALLEL WORKSHARE"; break;
830 case EXEC_OMP_SECTIONS: name = "SECTIONS"; break;
831 case EXEC_OMP_SINGLE: name = "SINGLE"; break;
832 case EXEC_OMP_WORKSHARE: name = "WORKSHARE"; break;
836 gfc_status ("!$OMP %s", name);
840 case EXEC_OMP_PARALLEL:
841 case EXEC_OMP_PARALLEL_DO:
842 case EXEC_OMP_PARALLEL_SECTIONS:
843 case EXEC_OMP_SECTIONS:
844 case EXEC_OMP_SINGLE:
845 case EXEC_OMP_WORKSHARE:
846 case EXEC_OMP_PARALLEL_WORKSHARE:
847 omp_clauses = c->ext.omp_clauses;
849 case EXEC_OMP_CRITICAL:
851 gfc_status (" (%s)", c->ext.omp_name);
854 if (c->ext.omp_namelist)
857 gfc_show_namelist (c->ext.omp_namelist);
858 gfc_status_char (')');
861 case EXEC_OMP_BARRIER:
870 if (omp_clauses->if_expr)
873 gfc_show_expr (omp_clauses->if_expr);
874 gfc_status_char (')');
876 if (omp_clauses->num_threads)
878 gfc_status (" NUM_THREADS(");
879 gfc_show_expr (omp_clauses->num_threads);
880 gfc_status_char (')');
882 if (omp_clauses->sched_kind != OMP_SCHED_NONE)
885 switch (omp_clauses->sched_kind)
887 case OMP_SCHED_STATIC: type = "STATIC"; break;
888 case OMP_SCHED_DYNAMIC: type = "DYNAMIC"; break;
889 case OMP_SCHED_GUIDED: type = "GUIDED"; break;
890 case OMP_SCHED_RUNTIME: type = "RUNTIME"; break;
894 gfc_status (" SCHEDULE (%s", type);
895 if (omp_clauses->chunk_size)
897 gfc_status_char (',');
898 gfc_show_expr (omp_clauses->chunk_size);
900 gfc_status_char (')');
902 if (omp_clauses->default_sharing != OMP_DEFAULT_UNKNOWN)
905 switch (omp_clauses->default_sharing)
907 case OMP_DEFAULT_NONE: type = "NONE"; break;
908 case OMP_DEFAULT_PRIVATE: type = "PRIVATE"; break;
909 case OMP_DEFAULT_SHARED: type = "SHARED"; break;
910 case OMP_SCHED_RUNTIME: type = "RUNTIME"; break;
914 gfc_status (" DEFAULT(%s)", type);
916 if (omp_clauses->ordered)
917 gfc_status (" ORDERED");
918 for (list_type = 0; list_type < OMP_LIST_NUM; list_type++)
919 if (omp_clauses->lists[list_type] != NULL
920 && list_type != OMP_LIST_COPYPRIVATE)
923 if (list_type >= OMP_LIST_REDUCTION_FIRST)
927 case OMP_LIST_PLUS: type = "+"; break;
928 case OMP_LIST_MULT: type = "*"; break;
929 case OMP_LIST_SUB: type = "-"; break;
930 case OMP_LIST_AND: type = ".AND."; break;
931 case OMP_LIST_OR: type = ".OR."; break;
932 case OMP_LIST_EQV: type = ".EQV."; break;
933 case OMP_LIST_NEQV: type = ".NEQV."; break;
934 case OMP_LIST_MAX: type = "MAX"; break;
935 case OMP_LIST_MIN: type = "MIN"; break;
936 case OMP_LIST_IAND: type = "IAND"; break;
937 case OMP_LIST_IOR: type = "IOR"; break;
938 case OMP_LIST_IEOR: type = "IEOR"; break;
942 gfc_status (" REDUCTION(%s:", type);
948 case OMP_LIST_PRIVATE: type = "PRIVATE"; break;
949 case OMP_LIST_FIRSTPRIVATE: type = "FIRSTPRIVATE"; break;
950 case OMP_LIST_LASTPRIVATE: type = "LASTPRIVATE"; break;
951 case OMP_LIST_SHARED: type = "SHARED"; break;
952 case OMP_LIST_COPYIN: type = "COPYIN"; break;
956 gfc_status (" %s(", type);
958 gfc_show_namelist (omp_clauses->lists[list_type]);
959 gfc_status_char (')');
962 gfc_status_char ('\n');
963 if (c->op == EXEC_OMP_SECTIONS || c->op == EXEC_OMP_PARALLEL_SECTIONS)
965 gfc_code *d = c->block;
968 gfc_show_code (level + 1, d->next);
969 if (d->block == NULL)
971 code_indent (level, 0);
972 gfc_status ("!$OMP SECTION\n");
977 gfc_show_code (level + 1, c->block->next);
978 if (c->op == EXEC_OMP_ATOMIC)
980 code_indent (level, 0);
981 gfc_status ("!$OMP END %s", name);
982 if (omp_clauses != NULL)
984 if (omp_clauses->lists[OMP_LIST_COPYPRIVATE])
986 gfc_status (" COPYPRIVATE(");
987 gfc_show_namelist (omp_clauses->lists[OMP_LIST_COPYPRIVATE]);
988 gfc_status_char (')');
990 else if (omp_clauses->nowait)
991 gfc_status (" NOWAIT");
993 else if (c->op == EXEC_OMP_CRITICAL && c->ext.omp_name)
994 gfc_status (" (%s)", c->ext.omp_name);
997 /* Show a single code node and everything underneath it if necessary. */
1000 gfc_show_code_node (int level, gfc_code * c)
1002 gfc_forall_iterator *fa;
1012 code_indent (level, c->here);
1021 gfc_status ("CONTINUE");
1025 gfc_status ("ENTRY %s", c->ext.entry->sym->name);
1028 case EXEC_INIT_ASSIGN:
1030 gfc_status ("ASSIGN ");
1031 gfc_show_expr (c->expr);
1032 gfc_status_char (' ');
1033 gfc_show_expr (c->expr2);
1036 case EXEC_LABEL_ASSIGN:
1037 gfc_status ("LABEL ASSIGN ");
1038 gfc_show_expr (c->expr);
1039 gfc_status (" %d", c->label->value);
1042 case EXEC_POINTER_ASSIGN:
1043 gfc_status ("POINTER ASSIGN ");
1044 gfc_show_expr (c->expr);
1045 gfc_status_char (' ');
1046 gfc_show_expr (c->expr2);
1050 gfc_status ("GOTO ");
1052 gfc_status ("%d", c->label->value);
1055 gfc_show_expr (c->expr);
1060 for (; d; d = d ->block)
1062 code_indent (level, d->label);
1063 if (d->block != NULL)
1064 gfc_status_char (',');
1066 gfc_status_char (')');
1073 if (c->resolved_sym)
1074 gfc_status ("CALL %s ", c->resolved_sym->name);
1075 else if (c->symtree)
1076 gfc_status ("CALL %s ", c->symtree->name);
1078 gfc_status ("CALL ?? ");
1080 gfc_show_actual_arglist (c->ext.actual);
1084 gfc_status ("RETURN ");
1086 gfc_show_expr (c->expr);
1090 gfc_status ("PAUSE ");
1092 if (c->expr != NULL)
1093 gfc_show_expr (c->expr);
1095 gfc_status ("%d", c->ext.stop_code);
1100 gfc_status ("STOP ");
1102 if (c->expr != NULL)
1103 gfc_show_expr (c->expr);
1105 gfc_status ("%d", c->ext.stop_code);
1109 case EXEC_ARITHMETIC_IF:
1111 gfc_show_expr (c->expr);
1112 gfc_status (" %d, %d, %d",
1113 c->label->value, c->label2->value, c->label3->value);
1119 gfc_show_expr (d->expr);
1120 gfc_status_char ('\n');
1121 gfc_show_code (level + 1, d->next);
1124 for (; d; d = d->block)
1126 code_indent (level, 0);
1128 if (d->expr == NULL)
1129 gfc_status ("ELSE\n");
1132 gfc_status ("ELSE IF ");
1133 gfc_show_expr (d->expr);
1134 gfc_status_char ('\n');
1137 gfc_show_code (level + 1, d->next);
1140 code_indent (level, c->label);
1142 gfc_status ("ENDIF");
1147 gfc_status ("SELECT CASE ");
1148 gfc_show_expr (c->expr);
1149 gfc_status_char ('\n');
1151 for (; d; d = d->block)
1153 code_indent (level, 0);
1155 gfc_status ("CASE ");
1156 for (cp = d->ext.case_list; cp; cp = cp->next)
1158 gfc_status_char ('(');
1159 gfc_show_expr (cp->low);
1160 gfc_status_char (' ');
1161 gfc_show_expr (cp->high);
1162 gfc_status_char (')');
1163 gfc_status_char (' ');
1165 gfc_status_char ('\n');
1167 gfc_show_code (level + 1, d->next);
1170 code_indent (level, c->label);
1171 gfc_status ("END SELECT");
1175 gfc_status ("WHERE ");
1178 gfc_show_expr (d->expr);
1179 gfc_status_char ('\n');
1181 gfc_show_code (level + 1, d->next);
1183 for (d = d->block; d; d = d->block)
1185 code_indent (level, 0);
1186 gfc_status ("ELSE WHERE ");
1187 gfc_show_expr (d->expr);
1188 gfc_status_char ('\n');
1189 gfc_show_code (level + 1, d->next);
1192 code_indent (level, 0);
1193 gfc_status ("END WHERE");
1198 gfc_status ("FORALL ");
1199 for (fa = c->ext.forall_iterator; fa; fa = fa->next)
1201 gfc_show_expr (fa->var);
1202 gfc_status_char (' ');
1203 gfc_show_expr (fa->start);
1204 gfc_status_char (':');
1205 gfc_show_expr (fa->end);
1206 gfc_status_char (':');
1207 gfc_show_expr (fa->stride);
1209 if (fa->next != NULL)
1210 gfc_status_char (',');
1213 if (c->expr != NULL)
1215 gfc_status_char (',');
1216 gfc_show_expr (c->expr);
1218 gfc_status_char ('\n');
1220 gfc_show_code (level + 1, c->block->next);
1222 code_indent (level, 0);
1223 gfc_status ("END FORALL");
1229 gfc_show_expr (c->ext.iterator->var);
1230 gfc_status_char ('=');
1231 gfc_show_expr (c->ext.iterator->start);
1232 gfc_status_char (' ');
1233 gfc_show_expr (c->ext.iterator->end);
1234 gfc_status_char (' ');
1235 gfc_show_expr (c->ext.iterator->step);
1236 gfc_status_char ('\n');
1238 gfc_show_code (level + 1, c->block->next);
1240 code_indent (level, 0);
1241 gfc_status ("END DO");
1245 gfc_status ("DO WHILE ");
1246 gfc_show_expr (c->expr);
1247 gfc_status_char ('\n');
1249 gfc_show_code (level + 1, c->block->next);
1251 code_indent (level, c->label);
1252 gfc_status ("END DO");
1256 gfc_status ("CYCLE");
1258 gfc_status (" %s", c->symtree->n.sym->name);
1262 gfc_status ("EXIT");
1264 gfc_status (" %s", c->symtree->n.sym->name);
1268 gfc_status ("ALLOCATE ");
1271 gfc_status (" STAT=");
1272 gfc_show_expr (c->expr);
1275 for (a = c->ext.alloc_list; a; a = a->next)
1277 gfc_status_char (' ');
1278 gfc_show_expr (a->expr);
1283 case EXEC_DEALLOCATE:
1284 gfc_status ("DEALLOCATE ");
1287 gfc_status (" STAT=");
1288 gfc_show_expr (c->expr);
1291 for (a = c->ext.alloc_list; a; a = a->next)
1293 gfc_status_char (' ');
1294 gfc_show_expr (a->expr);
1300 gfc_status ("OPEN");
1305 gfc_status (" UNIT=");
1306 gfc_show_expr (open->unit);
1310 gfc_status (" IOMSG=");
1311 gfc_show_expr (open->iomsg);
1315 gfc_status (" IOSTAT=");
1316 gfc_show_expr (open->iostat);
1320 gfc_status (" FILE=");
1321 gfc_show_expr (open->file);
1325 gfc_status (" STATUS=");
1326 gfc_show_expr (open->status);
1330 gfc_status (" ACCESS=");
1331 gfc_show_expr (open->access);
1335 gfc_status (" FORM=");
1336 gfc_show_expr (open->form);
1340 gfc_status (" RECL=");
1341 gfc_show_expr (open->recl);
1345 gfc_status (" BLANK=");
1346 gfc_show_expr (open->blank);
1350 gfc_status (" POSITION=");
1351 gfc_show_expr (open->position);
1355 gfc_status (" ACTION=");
1356 gfc_show_expr (open->action);
1360 gfc_status (" DELIM=");
1361 gfc_show_expr (open->delim);
1365 gfc_status (" PAD=");
1366 gfc_show_expr (open->pad);
1370 gfc_status (" CONVERT=");
1371 gfc_show_expr (open->convert);
1373 if (open->err != NULL)
1374 gfc_status (" ERR=%d", open->err->value);
1379 gfc_status ("CLOSE");
1380 close = c->ext.close;
1384 gfc_status (" UNIT=");
1385 gfc_show_expr (close->unit);
1389 gfc_status (" IOMSG=");
1390 gfc_show_expr (close->iomsg);
1394 gfc_status (" IOSTAT=");
1395 gfc_show_expr (close->iostat);
1399 gfc_status (" STATUS=");
1400 gfc_show_expr (close->status);
1402 if (close->err != NULL)
1403 gfc_status (" ERR=%d", close->err->value);
1406 case EXEC_BACKSPACE:
1407 gfc_status ("BACKSPACE");
1411 gfc_status ("ENDFILE");
1415 gfc_status ("REWIND");
1419 gfc_status ("FLUSH");
1422 fp = c->ext.filepos;
1426 gfc_status (" UNIT=");
1427 gfc_show_expr (fp->unit);
1431 gfc_status (" IOMSG=");
1432 gfc_show_expr (fp->iomsg);
1436 gfc_status (" IOSTAT=");
1437 gfc_show_expr (fp->iostat);
1439 if (fp->err != NULL)
1440 gfc_status (" ERR=%d", fp->err->value);
1444 gfc_status ("INQUIRE");
1449 gfc_status (" UNIT=");
1450 gfc_show_expr (i->unit);
1454 gfc_status (" FILE=");
1455 gfc_show_expr (i->file);
1460 gfc_status (" IOMSG=");
1461 gfc_show_expr (i->iomsg);
1465 gfc_status (" IOSTAT=");
1466 gfc_show_expr (i->iostat);
1470 gfc_status (" EXIST=");
1471 gfc_show_expr (i->exist);
1475 gfc_status (" OPENED=");
1476 gfc_show_expr (i->opened);
1480 gfc_status (" NUMBER=");
1481 gfc_show_expr (i->number);
1485 gfc_status (" NAMED=");
1486 gfc_show_expr (i->named);
1490 gfc_status (" NAME=");
1491 gfc_show_expr (i->name);
1495 gfc_status (" ACCESS=");
1496 gfc_show_expr (i->access);
1500 gfc_status (" SEQUENTIAL=");
1501 gfc_show_expr (i->sequential);
1506 gfc_status (" DIRECT=");
1507 gfc_show_expr (i->direct);
1511 gfc_status (" FORM=");
1512 gfc_show_expr (i->form);
1516 gfc_status (" FORMATTED");
1517 gfc_show_expr (i->formatted);
1521 gfc_status (" UNFORMATTED=");
1522 gfc_show_expr (i->unformatted);
1526 gfc_status (" RECL=");
1527 gfc_show_expr (i->recl);
1531 gfc_status (" NEXTREC=");
1532 gfc_show_expr (i->nextrec);
1536 gfc_status (" BLANK=");
1537 gfc_show_expr (i->blank);
1541 gfc_status (" POSITION=");
1542 gfc_show_expr (i->position);
1546 gfc_status (" ACTION=");
1547 gfc_show_expr (i->action);
1551 gfc_status (" READ=");
1552 gfc_show_expr (i->read);
1556 gfc_status (" WRITE=");
1557 gfc_show_expr (i->write);
1561 gfc_status (" READWRITE=");
1562 gfc_show_expr (i->readwrite);
1566 gfc_status (" DELIM=");
1567 gfc_show_expr (i->delim);
1571 gfc_status (" PAD=");
1572 gfc_show_expr (i->pad);
1576 gfc_status (" CONVERT=");
1577 gfc_show_expr (i->convert);
1581 gfc_status (" ERR=%d", i->err->value);
1585 gfc_status ("IOLENGTH ");
1586 gfc_show_expr (c->expr);
1591 gfc_status ("READ");
1595 gfc_status ("WRITE");
1601 gfc_status (" UNIT=");
1602 gfc_show_expr (dt->io_unit);
1605 if (dt->format_expr)
1607 gfc_status (" FMT=");
1608 gfc_show_expr (dt->format_expr);
1611 if (dt->format_label != NULL)
1612 gfc_status (" FMT=%d", dt->format_label->value);
1614 gfc_status (" NML=%s", dt->namelist->name);
1618 gfc_status (" IOMSG=");
1619 gfc_show_expr (dt->iomsg);
1623 gfc_status (" IOSTAT=");
1624 gfc_show_expr (dt->iostat);
1628 gfc_status (" SIZE=");
1629 gfc_show_expr (dt->size);
1633 gfc_status (" REC=");
1634 gfc_show_expr (dt->rec);
1638 gfc_status (" ADVANCE=");
1639 gfc_show_expr (dt->advance);
1643 gfc_status_char ('\n');
1644 for (c = c->block->next; c; c = c->next)
1645 gfc_show_code_node (level + (c->next != NULL), c);
1649 gfc_status ("TRANSFER ");
1650 gfc_show_expr (c->expr);
1654 gfc_status ("DT_END");
1657 if (dt->err != NULL)
1658 gfc_status (" ERR=%d", dt->err->value);
1659 if (dt->end != NULL)
1660 gfc_status (" END=%d", dt->end->value);
1661 if (dt->eor != NULL)
1662 gfc_status (" EOR=%d", dt->eor->value);
1665 case EXEC_OMP_ATOMIC:
1666 case EXEC_OMP_BARRIER:
1667 case EXEC_OMP_CRITICAL:
1668 case EXEC_OMP_FLUSH:
1670 case EXEC_OMP_MASTER:
1671 case EXEC_OMP_ORDERED:
1672 case EXEC_OMP_PARALLEL:
1673 case EXEC_OMP_PARALLEL_DO:
1674 case EXEC_OMP_PARALLEL_SECTIONS:
1675 case EXEC_OMP_PARALLEL_WORKSHARE:
1676 case EXEC_OMP_SECTIONS:
1677 case EXEC_OMP_SINGLE:
1678 case EXEC_OMP_WORKSHARE:
1679 gfc_show_omp_node (level, c);
1683 gfc_internal_error ("gfc_show_code_node(): Bad statement code");
1686 gfc_status_char ('\n');
1690 /* Show an equivalence chain. */
1693 gfc_show_equiv (gfc_equiv *eq)
1696 gfc_status ("Equivalence: ");
1699 gfc_show_expr (eq->expr);
1707 /* Show a freakin' whole namespace. */
1710 gfc_show_namespace (gfc_namespace * ns)
1712 gfc_interface *intr;
1713 gfc_namespace *save;
1714 gfc_intrinsic_op op;
1718 save = gfc_current_ns;
1722 gfc_status ("Namespace:");
1730 while (i < GFC_LETTERS - 1
1731 && gfc_compare_types(&ns->default_type[i+1],
1732 &ns->default_type[l]))
1736 gfc_status(" %c-%c: ", l+'A', i+'A');
1738 gfc_status(" %c: ", l+'A');
1740 gfc_show_typespec(&ns->default_type[l]);
1742 } while (i < GFC_LETTERS);
1744 if (ns->proc_name != NULL)
1747 gfc_status ("procedure name = %s", ns->proc_name->name);
1750 gfc_current_ns = ns;
1751 gfc_traverse_symtree (ns->common_root, show_common);
1753 gfc_traverse_symtree (ns->sym_root, show_symtree);
1755 for (op = GFC_INTRINSIC_BEGIN; op != GFC_INTRINSIC_END; op++)
1757 /* User operator interfaces */
1758 intr = ns->operator[op];
1763 gfc_status ("Operator interfaces for %s:", gfc_op2string (op));
1765 for (; intr; intr = intr->next)
1766 gfc_status (" %s", intr->sym->name);
1769 if (ns->uop_root != NULL)
1772 gfc_status ("User operators:\n");
1773 gfc_traverse_user_op (ns, show_uop);
1777 for (eq = ns->equiv; eq; eq = eq->next)
1778 gfc_show_equiv (eq);
1780 gfc_status_char ('\n');
1781 gfc_status_char ('\n');
1783 gfc_show_code (0, ns->code);
1785 for (ns = ns->contained; ns; ns = ns->sibling)
1788 gfc_status ("CONTAINS\n");
1789 gfc_show_namespace (ns);
1793 gfc_status_char ('\n');
1794 gfc_current_ns = save;