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 3, 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 COPYING3. If not see
20 <http://www.gnu.org/licenses/>. */
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)
73 gfc_status ("(%s ", gfc_basic_typename (ts->type));
78 gfc_status ("%s", ts->derived->name);
82 gfc_show_expr (ts->cl->length);
86 gfc_status ("%d", ts->kind);
94 /* Show an actual argument list. */
97 gfc_show_actual_arglist (gfc_actual_arglist *a)
101 for (; a; a = a->next)
103 gfc_status_char ('(');
105 gfc_status ("%s = ", a->name);
107 gfc_show_expr (a->expr);
109 gfc_status ("(arg not-present)");
111 gfc_status_char (')');
120 /* Show a gfc_array_spec array specification structure. */
123 gfc_show_array_spec (gfc_array_spec *as)
134 gfc_status ("(%d", as->rank);
140 case AS_EXPLICIT: c = "AS_EXPLICIT"; break;
141 case AS_DEFERRED: c = "AS_DEFERRED"; break;
142 case AS_ASSUMED_SIZE: c = "AS_ASSUMED_SIZE"; break;
143 case AS_ASSUMED_SHAPE: c = "AS_ASSUMED_SHAPE"; break;
145 gfc_internal_error ("gfc_show_array_spec(): Unhandled array shape "
148 gfc_status (" %s ", c);
150 for (i = 0; i < as->rank; i++)
152 gfc_show_expr (as->lower[i]);
153 gfc_status_char (' ');
154 gfc_show_expr (as->upper[i]);
155 gfc_status_char (' ');
163 /* Show a gfc_array_ref array reference structure. */
166 gfc_show_array_ref (gfc_array_ref * ar)
170 gfc_status_char ('(');
179 for (i = 0; i < ar->dimen; i++)
181 /* There are two types of array sections: either the
182 elements are identified by an integer array ('vector'),
183 or by an index range. In the former case we only have to
184 print the start expression which contains the vector, in
185 the latter case we have to print any of lower and upper
186 bound and the stride, if they're present. */
188 if (ar->start[i] != NULL)
189 gfc_show_expr (ar->start[i]);
191 if (ar->dimen_type[i] == DIMEN_RANGE)
193 gfc_status_char (':');
195 if (ar->end[i] != NULL)
196 gfc_show_expr (ar->end[i]);
198 if (ar->stride[i] != NULL)
200 gfc_status_char (':');
201 gfc_show_expr (ar->stride[i]);
205 if (i != ar->dimen - 1)
211 for (i = 0; i < ar->dimen; i++)
213 gfc_show_expr (ar->start[i]);
214 if (i != ar->dimen - 1)
220 gfc_status ("UNKNOWN");
224 gfc_internal_error ("gfc_show_array_ref(): Unknown array reference");
227 gfc_status_char (')');
231 /* Show a list of gfc_ref structures. */
234 gfc_show_ref (gfc_ref *p)
236 for (; p; p = p->next)
240 gfc_show_array_ref (&p->u.ar);
244 gfc_status (" %% %s", p->u.c.component->name);
248 gfc_status_char ('(');
249 gfc_show_expr (p->u.ss.start);
250 gfc_status_char (':');
251 gfc_show_expr (p->u.ss.end);
252 gfc_status_char (')');
256 gfc_internal_error ("gfc_show_ref(): Bad component code");
261 /* Display a constructor. Works recursively for array constructors. */
264 gfc_show_constructor (gfc_constructor *c)
266 for (; c; c = c->next)
268 if (c->iterator == NULL)
269 gfc_show_expr (c->expr);
272 gfc_status_char ('(');
273 gfc_show_expr (c->expr);
275 gfc_status_char (' ');
276 gfc_show_expr (c->iterator->var);
277 gfc_status_char ('=');
278 gfc_show_expr (c->iterator->start);
279 gfc_status_char (',');
280 gfc_show_expr (c->iterator->end);
281 gfc_status_char (',');
282 gfc_show_expr (c->iterator->step);
284 gfc_status_char (')');
293 /* Show an expression. */
296 gfc_show_expr (gfc_expr *p)
307 switch (p->expr_type)
310 c = p->value.character.string;
312 for (i = 0; i < p->value.character.length; i++, c++)
317 gfc_status ("%c", *c);
320 gfc_show_ref (p->ref);
324 gfc_status ("%s(", p->ts.derived->name);
325 gfc_show_constructor (p->value.constructor);
326 gfc_status_char (')');
331 gfc_show_constructor (p->value.constructor);
334 gfc_show_ref (p->ref);
338 gfc_status ("NULL()");
345 mpz_out_str (stdout, 10, p->value.integer);
347 if (p->ts.kind != gfc_default_integer_kind)
348 gfc_status ("_%d", p->ts.kind);
352 if (p->value.logical)
353 gfc_status (".true.");
355 gfc_status (".false.");
359 mpfr_out_str (stdout, 10, 0, p->value.real, GFC_RND_MODE);
360 if (p->ts.kind != gfc_default_real_kind)
361 gfc_status ("_%d", p->ts.kind);
365 c = p->value.character.string;
367 gfc_status_char ('\'');
369 for (i = 0; i < p->value.character.length; i++, c++)
374 gfc_status_char (*c);
377 gfc_status_char ('\'');
382 gfc_status ("(complex ");
384 mpfr_out_str (stdout, 10, 0, p->value.complex.r, GFC_RND_MODE);
385 if (p->ts.kind != gfc_default_complex_kind)
386 gfc_status ("_%d", p->ts.kind);
390 mpfr_out_str (stdout, 10, 0, p->value.complex.i, GFC_RND_MODE);
391 if (p->ts.kind != gfc_default_complex_kind)
392 gfc_status ("_%d", p->ts.kind);
398 gfc_status ("%dH", p->representation.length);
399 c = p->representation.string;
400 for (i = 0; i < p->representation.length; i++, c++)
402 gfc_status_char (*c);
411 if (p->representation.string)
414 c = p->representation.string;
415 for (i = 0; i < p->representation.length; i++, c++)
417 gfc_status ("%.2x", (unsigned int) *c);
418 if (i < p->representation.length - 1)
419 gfc_status_char (',');
421 gfc_status_char ('}');
427 if (p->symtree->n.sym->ns && p->symtree->n.sym->ns->proc_name)
428 gfc_status ("%s:", p->symtree->n.sym->ns->proc_name->name);
429 gfc_status ("%s", p->symtree->n.sym->name);
430 gfc_show_ref (p->ref);
435 switch (p->value.op.operator)
437 case INTRINSIC_UPLUS:
440 case INTRINSIC_UMINUS:
446 case INTRINSIC_MINUS:
449 case INTRINSIC_TIMES:
452 case INTRINSIC_DIVIDE:
455 case INTRINSIC_POWER:
458 case INTRINSIC_CONCAT:
471 gfc_status ("NEQV ");
474 case INTRINSIC_EQ_OS:
478 case INTRINSIC_NE_OS:
482 case INTRINSIC_GT_OS:
486 case INTRINSIC_GE_OS:
490 case INTRINSIC_LT_OS:
494 case INTRINSIC_LE_OS:
500 case INTRINSIC_PARENTHESES:
501 gfc_status ("parens");
506 ("gfc_show_expr(): Bad intrinsic in expression!");
509 gfc_show_expr (p->value.op.op1);
514 gfc_show_expr (p->value.op.op2);
521 if (p->value.function.name == NULL)
523 gfc_status ("%s[", p->symtree->n.sym->name);
524 gfc_show_actual_arglist (p->value.function.actual);
525 gfc_status_char (']');
529 gfc_status ("%s[[", p->value.function.name);
530 gfc_show_actual_arglist (p->value.function.actual);
531 gfc_status_char (']');
532 gfc_status_char (']');
538 gfc_internal_error ("gfc_show_expr(): Don't know how to show expr");
543 /* Show symbol attributes. The flavor and intent are followed by
544 whatever single bit attributes are present. */
547 gfc_show_attr (symbol_attribute *attr)
550 gfc_status ("(%s %s %s %s %s", gfc_code2string (flavors, attr->flavor),
551 gfc_intent_string (attr->intent),
552 gfc_code2string (access_types, attr->access),
553 gfc_code2string (procedures, attr->proc),
554 gfc_code2string (save_status, attr->save));
556 if (attr->allocatable)
557 gfc_status (" ALLOCATABLE");
559 gfc_status (" DIMENSION");
561 gfc_status (" EXTERNAL");
563 gfc_status (" INTRINSIC");
565 gfc_status (" OPTIONAL");
567 gfc_status (" POINTER");
569 gfc_status (" PROTECTED");
571 gfc_status (" VALUE");
573 gfc_status (" VOLATILE");
574 if (attr->threadprivate)
575 gfc_status (" THREADPRIVATE");
577 gfc_status (" TARGET");
579 gfc_status (" DUMMY");
581 gfc_status (" RESULT");
583 gfc_status (" ENTRY");
586 gfc_status (" DATA");
588 gfc_status (" USE-ASSOC");
589 if (attr->in_namelist)
590 gfc_status (" IN-NAMELIST");
592 gfc_status (" IN-COMMON");
595 gfc_status (" FUNCTION");
596 if (attr->subroutine)
597 gfc_status (" SUBROUTINE");
598 if (attr->implicit_type)
599 gfc_status (" IMPLICIT-TYPE");
602 gfc_status (" SEQUENCE");
604 gfc_status (" ELEMENTAL");
606 gfc_status (" PURE");
608 gfc_status (" RECURSIVE");
614 /* Show components of a derived type. */
617 gfc_show_components (gfc_symbol *sym)
621 for (c = sym->components; c; c = c->next)
623 gfc_status ("(%s ", c->name);
624 gfc_show_typespec (&c->ts);
626 gfc_status (" POINTER");
628 gfc_status (" DIMENSION");
629 gfc_status_char (' ');
630 gfc_show_array_spec (c->as);
632 gfc_status (" %s", gfc_code2string (access_types, c->access));
635 gfc_status_char (' ');
640 /* Show a symbol. If a symbol is an ENTRY, SUBROUTINE or FUNCTION, we
641 show the interface. Information needed to reconstruct the list of
642 specific interfaces associated with a generic symbol is done within
646 gfc_show_symbol (gfc_symbol *sym)
648 gfc_formal_arglist *formal;
656 gfc_status ("symbol %s ", sym->name);
657 gfc_show_typespec (&sym->ts);
658 gfc_show_attr (&sym->attr);
663 gfc_status ("value: ");
664 gfc_show_expr (sym->value);
670 gfc_status ("Array spec:");
671 gfc_show_array_spec (sym->as);
677 gfc_status ("Generic interfaces:");
678 for (intr = sym->generic; intr; intr = intr->next)
679 gfc_status (" %s", intr->sym->name);
685 gfc_status ("result: %s", sym->result->name);
691 gfc_status ("components: ");
692 gfc_show_components (sym);
698 gfc_status ("Formal arglist:");
700 for (formal = sym->formal; formal; formal = formal->next)
702 if (formal->sym != NULL)
703 gfc_status (" %s", formal->sym->name);
705 gfc_status (" [Alt Return]");
712 gfc_status ("Formal namespace");
713 gfc_show_namespace (sym->formal_ns);
716 gfc_status_char ('\n');
720 /* Show a user-defined operator. Just prints an operator
721 and the name of the associated subroutine, really. */
724 show_uop (gfc_user_op *uop)
729 gfc_status ("%s:", uop->name);
731 for (intr = uop->operator; intr; intr = intr->next)
732 gfc_status (" %s", intr->sym->name);
736 /* Workhorse function for traversing the user operator symtree. */
739 traverse_uop (gfc_symtree *st, void (*func) (gfc_user_op *))
746 traverse_uop (st->left, func);
747 traverse_uop (st->right, func);
751 /* Traverse the tree of user operator nodes. */
754 gfc_traverse_user_op (gfc_namespace *ns, void (*func) (gfc_user_op *))
756 traverse_uop (ns->uop_root, func);
760 /* Function to display a common block. */
763 show_common (gfc_symtree *st)
768 gfc_status ("common: /%s/ ", st->name);
770 s = st->n.common->head;
773 gfc_status ("%s", s->name);
778 gfc_status_char ('\n');
782 /* Worker function to display the symbol tree. */
785 show_symtree (gfc_symtree *st)
788 gfc_status ("symtree: %s Ambig %d", st->name, st->ambiguous);
790 if (st->n.sym->ns != gfc_current_ns)
791 gfc_status (" from namespace %s", st->n.sym->ns->proc_name->name);
793 gfc_show_symbol (st->n.sym);
797 /******************* Show gfc_code structures **************/
801 static void gfc_show_code_node (int, gfc_code *);
803 /* Show a list of code structures. Mutually recursive with
804 gfc_show_code_node(). */
807 gfc_show_code (int level, gfc_code *c)
809 for (; c; c = c->next)
810 gfc_show_code_node (level, c);
814 gfc_show_namelist (gfc_namelist *n)
816 for (; n->next; n = n->next)
817 gfc_status ("%s,", n->sym->name);
818 gfc_status ("%s", n->sym->name);
821 /* Show a single OpenMP directive node and everything underneath it
825 gfc_show_omp_node (int level, gfc_code *c)
827 gfc_omp_clauses *omp_clauses = NULL;
828 const char *name = NULL;
832 case EXEC_OMP_ATOMIC: name = "ATOMIC"; break;
833 case EXEC_OMP_BARRIER: name = "BARRIER"; break;
834 case EXEC_OMP_CRITICAL: name = "CRITICAL"; break;
835 case EXEC_OMP_FLUSH: name = "FLUSH"; break;
836 case EXEC_OMP_DO: name = "DO"; break;
837 case EXEC_OMP_MASTER: name = "MASTER"; break;
838 case EXEC_OMP_ORDERED: name = "ORDERED"; break;
839 case EXEC_OMP_PARALLEL: name = "PARALLEL"; break;
840 case EXEC_OMP_PARALLEL_DO: name = "PARALLEL DO"; break;
841 case EXEC_OMP_PARALLEL_SECTIONS: name = "PARALLEL SECTIONS"; break;
842 case EXEC_OMP_PARALLEL_WORKSHARE: name = "PARALLEL WORKSHARE"; break;
843 case EXEC_OMP_SECTIONS: name = "SECTIONS"; break;
844 case EXEC_OMP_SINGLE: name = "SINGLE"; break;
845 case EXEC_OMP_WORKSHARE: name = "WORKSHARE"; break;
849 gfc_status ("!$OMP %s", name);
853 case EXEC_OMP_PARALLEL:
854 case EXEC_OMP_PARALLEL_DO:
855 case EXEC_OMP_PARALLEL_SECTIONS:
856 case EXEC_OMP_SECTIONS:
857 case EXEC_OMP_SINGLE:
858 case EXEC_OMP_WORKSHARE:
859 case EXEC_OMP_PARALLEL_WORKSHARE:
860 omp_clauses = c->ext.omp_clauses;
862 case EXEC_OMP_CRITICAL:
864 gfc_status (" (%s)", c->ext.omp_name);
867 if (c->ext.omp_namelist)
870 gfc_show_namelist (c->ext.omp_namelist);
871 gfc_status_char (')');
874 case EXEC_OMP_BARRIER:
883 if (omp_clauses->if_expr)
886 gfc_show_expr (omp_clauses->if_expr);
887 gfc_status_char (')');
889 if (omp_clauses->num_threads)
891 gfc_status (" NUM_THREADS(");
892 gfc_show_expr (omp_clauses->num_threads);
893 gfc_status_char (')');
895 if (omp_clauses->sched_kind != OMP_SCHED_NONE)
898 switch (omp_clauses->sched_kind)
900 case OMP_SCHED_STATIC: type = "STATIC"; break;
901 case OMP_SCHED_DYNAMIC: type = "DYNAMIC"; break;
902 case OMP_SCHED_GUIDED: type = "GUIDED"; break;
903 case OMP_SCHED_RUNTIME: type = "RUNTIME"; break;
907 gfc_status (" SCHEDULE (%s", type);
908 if (omp_clauses->chunk_size)
910 gfc_status_char (',');
911 gfc_show_expr (omp_clauses->chunk_size);
913 gfc_status_char (')');
915 if (omp_clauses->default_sharing != OMP_DEFAULT_UNKNOWN)
918 switch (omp_clauses->default_sharing)
920 case OMP_DEFAULT_NONE: type = "NONE"; break;
921 case OMP_DEFAULT_PRIVATE: type = "PRIVATE"; break;
922 case OMP_DEFAULT_SHARED: type = "SHARED"; break;
923 case OMP_SCHED_RUNTIME: type = "RUNTIME"; break;
927 gfc_status (" DEFAULT(%s)", type);
929 if (omp_clauses->ordered)
930 gfc_status (" ORDERED");
931 for (list_type = 0; list_type < OMP_LIST_NUM; list_type++)
932 if (omp_clauses->lists[list_type] != NULL
933 && list_type != OMP_LIST_COPYPRIVATE)
936 if (list_type >= OMP_LIST_REDUCTION_FIRST)
940 case OMP_LIST_PLUS: type = "+"; break;
941 case OMP_LIST_MULT: type = "*"; break;
942 case OMP_LIST_SUB: type = "-"; break;
943 case OMP_LIST_AND: type = ".AND."; break;
944 case OMP_LIST_OR: type = ".OR."; break;
945 case OMP_LIST_EQV: type = ".EQV."; break;
946 case OMP_LIST_NEQV: type = ".NEQV."; break;
947 case OMP_LIST_MAX: type = "MAX"; break;
948 case OMP_LIST_MIN: type = "MIN"; break;
949 case OMP_LIST_IAND: type = "IAND"; break;
950 case OMP_LIST_IOR: type = "IOR"; break;
951 case OMP_LIST_IEOR: type = "IEOR"; break;
955 gfc_status (" REDUCTION(%s:", type);
961 case OMP_LIST_PRIVATE: type = "PRIVATE"; break;
962 case OMP_LIST_FIRSTPRIVATE: type = "FIRSTPRIVATE"; break;
963 case OMP_LIST_LASTPRIVATE: type = "LASTPRIVATE"; break;
964 case OMP_LIST_SHARED: type = "SHARED"; break;
965 case OMP_LIST_COPYIN: type = "COPYIN"; break;
969 gfc_status (" %s(", type);
971 gfc_show_namelist (omp_clauses->lists[list_type]);
972 gfc_status_char (')');
975 gfc_status_char ('\n');
976 if (c->op == EXEC_OMP_SECTIONS || c->op == EXEC_OMP_PARALLEL_SECTIONS)
978 gfc_code *d = c->block;
981 gfc_show_code (level + 1, d->next);
982 if (d->block == NULL)
984 code_indent (level, 0);
985 gfc_status ("!$OMP SECTION\n");
990 gfc_show_code (level + 1, c->block->next);
991 if (c->op == EXEC_OMP_ATOMIC)
993 code_indent (level, 0);
994 gfc_status ("!$OMP END %s", name);
995 if (omp_clauses != NULL)
997 if (omp_clauses->lists[OMP_LIST_COPYPRIVATE])
999 gfc_status (" COPYPRIVATE(");
1000 gfc_show_namelist (omp_clauses->lists[OMP_LIST_COPYPRIVATE]);
1001 gfc_status_char (')');
1003 else if (omp_clauses->nowait)
1004 gfc_status (" NOWAIT");
1006 else if (c->op == EXEC_OMP_CRITICAL && c->ext.omp_name)
1007 gfc_status (" (%s)", c->ext.omp_name);
1011 /* Show a single code node and everything underneath it if necessary. */
1014 gfc_show_code_node (int level, gfc_code *c)
1016 gfc_forall_iterator *fa;
1026 code_indent (level, c->here);
1035 gfc_status ("CONTINUE");
1039 gfc_status ("ENTRY %s", c->ext.entry->sym->name);
1042 case EXEC_INIT_ASSIGN:
1044 gfc_status ("ASSIGN ");
1045 gfc_show_expr (c->expr);
1046 gfc_status_char (' ');
1047 gfc_show_expr (c->expr2);
1050 case EXEC_LABEL_ASSIGN:
1051 gfc_status ("LABEL ASSIGN ");
1052 gfc_show_expr (c->expr);
1053 gfc_status (" %d", c->label->value);
1056 case EXEC_POINTER_ASSIGN:
1057 gfc_status ("POINTER ASSIGN ");
1058 gfc_show_expr (c->expr);
1059 gfc_status_char (' ');
1060 gfc_show_expr (c->expr2);
1064 gfc_status ("GOTO ");
1066 gfc_status ("%d", c->label->value);
1069 gfc_show_expr (c->expr);
1074 for (; d; d = d ->block)
1076 code_indent (level, d->label);
1077 if (d->block != NULL)
1078 gfc_status_char (',');
1080 gfc_status_char (')');
1087 if (c->resolved_sym)
1088 gfc_status ("CALL %s ", c->resolved_sym->name);
1089 else if (c->symtree)
1090 gfc_status ("CALL %s ", c->symtree->name);
1092 gfc_status ("CALL ?? ");
1094 gfc_show_actual_arglist (c->ext.actual);
1098 gfc_status ("RETURN ");
1100 gfc_show_expr (c->expr);
1104 gfc_status ("PAUSE ");
1106 if (c->expr != NULL)
1107 gfc_show_expr (c->expr);
1109 gfc_status ("%d", c->ext.stop_code);
1114 gfc_status ("STOP ");
1116 if (c->expr != NULL)
1117 gfc_show_expr (c->expr);
1119 gfc_status ("%d", c->ext.stop_code);
1123 case EXEC_ARITHMETIC_IF:
1125 gfc_show_expr (c->expr);
1126 gfc_status (" %d, %d, %d",
1127 c->label->value, c->label2->value, c->label3->value);
1133 gfc_show_expr (d->expr);
1134 gfc_status_char ('\n');
1135 gfc_show_code (level + 1, d->next);
1138 for (; d; d = d->block)
1140 code_indent (level, 0);
1142 if (d->expr == NULL)
1143 gfc_status ("ELSE\n");
1146 gfc_status ("ELSE IF ");
1147 gfc_show_expr (d->expr);
1148 gfc_status_char ('\n');
1151 gfc_show_code (level + 1, d->next);
1154 code_indent (level, c->label);
1156 gfc_status ("ENDIF");
1161 gfc_status ("SELECT CASE ");
1162 gfc_show_expr (c->expr);
1163 gfc_status_char ('\n');
1165 for (; d; d = d->block)
1167 code_indent (level, 0);
1169 gfc_status ("CASE ");
1170 for (cp = d->ext.case_list; cp; cp = cp->next)
1172 gfc_status_char ('(');
1173 gfc_show_expr (cp->low);
1174 gfc_status_char (' ');
1175 gfc_show_expr (cp->high);
1176 gfc_status_char (')');
1177 gfc_status_char (' ');
1179 gfc_status_char ('\n');
1181 gfc_show_code (level + 1, d->next);
1184 code_indent (level, c->label);
1185 gfc_status ("END SELECT");
1189 gfc_status ("WHERE ");
1192 gfc_show_expr (d->expr);
1193 gfc_status_char ('\n');
1195 gfc_show_code (level + 1, d->next);
1197 for (d = d->block; d; d = d->block)
1199 code_indent (level, 0);
1200 gfc_status ("ELSE WHERE ");
1201 gfc_show_expr (d->expr);
1202 gfc_status_char ('\n');
1203 gfc_show_code (level + 1, d->next);
1206 code_indent (level, 0);
1207 gfc_status ("END WHERE");
1212 gfc_status ("FORALL ");
1213 for (fa = c->ext.forall_iterator; fa; fa = fa->next)
1215 gfc_show_expr (fa->var);
1216 gfc_status_char (' ');
1217 gfc_show_expr (fa->start);
1218 gfc_status_char (':');
1219 gfc_show_expr (fa->end);
1220 gfc_status_char (':');
1221 gfc_show_expr (fa->stride);
1223 if (fa->next != NULL)
1224 gfc_status_char (',');
1227 if (c->expr != NULL)
1229 gfc_status_char (',');
1230 gfc_show_expr (c->expr);
1232 gfc_status_char ('\n');
1234 gfc_show_code (level + 1, c->block->next);
1236 code_indent (level, 0);
1237 gfc_status ("END FORALL");
1243 gfc_show_expr (c->ext.iterator->var);
1244 gfc_status_char ('=');
1245 gfc_show_expr (c->ext.iterator->start);
1246 gfc_status_char (' ');
1247 gfc_show_expr (c->ext.iterator->end);
1248 gfc_status_char (' ');
1249 gfc_show_expr (c->ext.iterator->step);
1250 gfc_status_char ('\n');
1252 gfc_show_code (level + 1, c->block->next);
1254 code_indent (level, 0);
1255 gfc_status ("END DO");
1259 gfc_status ("DO WHILE ");
1260 gfc_show_expr (c->expr);
1261 gfc_status_char ('\n');
1263 gfc_show_code (level + 1, c->block->next);
1265 code_indent (level, c->label);
1266 gfc_status ("END DO");
1270 gfc_status ("CYCLE");
1272 gfc_status (" %s", c->symtree->n.sym->name);
1276 gfc_status ("EXIT");
1278 gfc_status (" %s", c->symtree->n.sym->name);
1282 gfc_status ("ALLOCATE ");
1285 gfc_status (" STAT=");
1286 gfc_show_expr (c->expr);
1289 for (a = c->ext.alloc_list; a; a = a->next)
1291 gfc_status_char (' ');
1292 gfc_show_expr (a->expr);
1297 case EXEC_DEALLOCATE:
1298 gfc_status ("DEALLOCATE ");
1301 gfc_status (" STAT=");
1302 gfc_show_expr (c->expr);
1305 for (a = c->ext.alloc_list; a; a = a->next)
1307 gfc_status_char (' ');
1308 gfc_show_expr (a->expr);
1314 gfc_status ("OPEN");
1319 gfc_status (" UNIT=");
1320 gfc_show_expr (open->unit);
1324 gfc_status (" IOMSG=");
1325 gfc_show_expr (open->iomsg);
1329 gfc_status (" IOSTAT=");
1330 gfc_show_expr (open->iostat);
1334 gfc_status (" FILE=");
1335 gfc_show_expr (open->file);
1339 gfc_status (" STATUS=");
1340 gfc_show_expr (open->status);
1344 gfc_status (" ACCESS=");
1345 gfc_show_expr (open->access);
1349 gfc_status (" FORM=");
1350 gfc_show_expr (open->form);
1354 gfc_status (" RECL=");
1355 gfc_show_expr (open->recl);
1359 gfc_status (" BLANK=");
1360 gfc_show_expr (open->blank);
1364 gfc_status (" POSITION=");
1365 gfc_show_expr (open->position);
1369 gfc_status (" ACTION=");
1370 gfc_show_expr (open->action);
1374 gfc_status (" DELIM=");
1375 gfc_show_expr (open->delim);
1379 gfc_status (" PAD=");
1380 gfc_show_expr (open->pad);
1384 gfc_status (" CONVERT=");
1385 gfc_show_expr (open->convert);
1387 if (open->err != NULL)
1388 gfc_status (" ERR=%d", open->err->value);
1393 gfc_status ("CLOSE");
1394 close = c->ext.close;
1398 gfc_status (" UNIT=");
1399 gfc_show_expr (close->unit);
1403 gfc_status (" IOMSG=");
1404 gfc_show_expr (close->iomsg);
1408 gfc_status (" IOSTAT=");
1409 gfc_show_expr (close->iostat);
1413 gfc_status (" STATUS=");
1414 gfc_show_expr (close->status);
1416 if (close->err != NULL)
1417 gfc_status (" ERR=%d", close->err->value);
1420 case EXEC_BACKSPACE:
1421 gfc_status ("BACKSPACE");
1425 gfc_status ("ENDFILE");
1429 gfc_status ("REWIND");
1433 gfc_status ("FLUSH");
1436 fp = c->ext.filepos;
1440 gfc_status (" UNIT=");
1441 gfc_show_expr (fp->unit);
1445 gfc_status (" IOMSG=");
1446 gfc_show_expr (fp->iomsg);
1450 gfc_status (" IOSTAT=");
1451 gfc_show_expr (fp->iostat);
1453 if (fp->err != NULL)
1454 gfc_status (" ERR=%d", fp->err->value);
1458 gfc_status ("INQUIRE");
1463 gfc_status (" UNIT=");
1464 gfc_show_expr (i->unit);
1468 gfc_status (" FILE=");
1469 gfc_show_expr (i->file);
1474 gfc_status (" IOMSG=");
1475 gfc_show_expr (i->iomsg);
1479 gfc_status (" IOSTAT=");
1480 gfc_show_expr (i->iostat);
1484 gfc_status (" EXIST=");
1485 gfc_show_expr (i->exist);
1489 gfc_status (" OPENED=");
1490 gfc_show_expr (i->opened);
1494 gfc_status (" NUMBER=");
1495 gfc_show_expr (i->number);
1499 gfc_status (" NAMED=");
1500 gfc_show_expr (i->named);
1504 gfc_status (" NAME=");
1505 gfc_show_expr (i->name);
1509 gfc_status (" ACCESS=");
1510 gfc_show_expr (i->access);
1514 gfc_status (" SEQUENTIAL=");
1515 gfc_show_expr (i->sequential);
1520 gfc_status (" DIRECT=");
1521 gfc_show_expr (i->direct);
1525 gfc_status (" FORM=");
1526 gfc_show_expr (i->form);
1530 gfc_status (" FORMATTED");
1531 gfc_show_expr (i->formatted);
1535 gfc_status (" UNFORMATTED=");
1536 gfc_show_expr (i->unformatted);
1540 gfc_status (" RECL=");
1541 gfc_show_expr (i->recl);
1545 gfc_status (" NEXTREC=");
1546 gfc_show_expr (i->nextrec);
1550 gfc_status (" BLANK=");
1551 gfc_show_expr (i->blank);
1555 gfc_status (" POSITION=");
1556 gfc_show_expr (i->position);
1560 gfc_status (" ACTION=");
1561 gfc_show_expr (i->action);
1565 gfc_status (" READ=");
1566 gfc_show_expr (i->read);
1570 gfc_status (" WRITE=");
1571 gfc_show_expr (i->write);
1575 gfc_status (" READWRITE=");
1576 gfc_show_expr (i->readwrite);
1580 gfc_status (" DELIM=");
1581 gfc_show_expr (i->delim);
1585 gfc_status (" PAD=");
1586 gfc_show_expr (i->pad);
1590 gfc_status (" CONVERT=");
1591 gfc_show_expr (i->convert);
1595 gfc_status (" ERR=%d", i->err->value);
1599 gfc_status ("IOLENGTH ");
1600 gfc_show_expr (c->expr);
1605 gfc_status ("READ");
1609 gfc_status ("WRITE");
1615 gfc_status (" UNIT=");
1616 gfc_show_expr (dt->io_unit);
1619 if (dt->format_expr)
1621 gfc_status (" FMT=");
1622 gfc_show_expr (dt->format_expr);
1625 if (dt->format_label != NULL)
1626 gfc_status (" FMT=%d", dt->format_label->value);
1628 gfc_status (" NML=%s", dt->namelist->name);
1632 gfc_status (" IOMSG=");
1633 gfc_show_expr (dt->iomsg);
1637 gfc_status (" IOSTAT=");
1638 gfc_show_expr (dt->iostat);
1642 gfc_status (" SIZE=");
1643 gfc_show_expr (dt->size);
1647 gfc_status (" REC=");
1648 gfc_show_expr (dt->rec);
1652 gfc_status (" ADVANCE=");
1653 gfc_show_expr (dt->advance);
1657 gfc_status_char ('\n');
1658 for (c = c->block->next; c; c = c->next)
1659 gfc_show_code_node (level + (c->next != NULL), c);
1663 gfc_status ("TRANSFER ");
1664 gfc_show_expr (c->expr);
1668 gfc_status ("DT_END");
1671 if (dt->err != NULL)
1672 gfc_status (" ERR=%d", dt->err->value);
1673 if (dt->end != NULL)
1674 gfc_status (" END=%d", dt->end->value);
1675 if (dt->eor != NULL)
1676 gfc_status (" EOR=%d", dt->eor->value);
1679 case EXEC_OMP_ATOMIC:
1680 case EXEC_OMP_BARRIER:
1681 case EXEC_OMP_CRITICAL:
1682 case EXEC_OMP_FLUSH:
1684 case EXEC_OMP_MASTER:
1685 case EXEC_OMP_ORDERED:
1686 case EXEC_OMP_PARALLEL:
1687 case EXEC_OMP_PARALLEL_DO:
1688 case EXEC_OMP_PARALLEL_SECTIONS:
1689 case EXEC_OMP_PARALLEL_WORKSHARE:
1690 case EXEC_OMP_SECTIONS:
1691 case EXEC_OMP_SINGLE:
1692 case EXEC_OMP_WORKSHARE:
1693 gfc_show_omp_node (level, c);
1697 gfc_internal_error ("gfc_show_code_node(): Bad statement code");
1700 gfc_status_char ('\n');
1704 /* Show an equivalence chain. */
1707 gfc_show_equiv (gfc_equiv *eq)
1710 gfc_status ("Equivalence: ");
1713 gfc_show_expr (eq->expr);
1721 /* Show a freakin' whole namespace. */
1724 gfc_show_namespace (gfc_namespace *ns)
1726 gfc_interface *intr;
1727 gfc_namespace *save;
1728 gfc_intrinsic_op op;
1732 save = gfc_current_ns;
1736 gfc_status ("Namespace:");
1744 while (i < GFC_LETTERS - 1
1745 && gfc_compare_types(&ns->default_type[i+1],
1746 &ns->default_type[l]))
1750 gfc_status(" %c-%c: ", l+'A', i+'A');
1752 gfc_status(" %c: ", l+'A');
1754 gfc_show_typespec(&ns->default_type[l]);
1756 } while (i < GFC_LETTERS);
1758 if (ns->proc_name != NULL)
1761 gfc_status ("procedure name = %s", ns->proc_name->name);
1764 gfc_current_ns = ns;
1765 gfc_traverse_symtree (ns->common_root, show_common);
1767 gfc_traverse_symtree (ns->sym_root, show_symtree);
1769 for (op = GFC_INTRINSIC_BEGIN; op != GFC_INTRINSIC_END; op++)
1771 /* User operator interfaces */
1772 intr = ns->operator[op];
1777 gfc_status ("Operator interfaces for %s:", gfc_op2string (op));
1779 for (; intr; intr = intr->next)
1780 gfc_status (" %s", intr->sym->name);
1783 if (ns->uop_root != NULL)
1786 gfc_status ("User operators:\n");
1787 gfc_traverse_user_op (ns, show_uop);
1791 for (eq = ns->equiv; eq; eq = eq->next)
1792 gfc_show_equiv (eq);
1794 gfc_status_char ('\n');
1795 gfc_status_char ('\n');
1797 gfc_show_code (0, ns->code);
1799 for (ns = ns->contained; ns; ns = ns->sibling)
1802 gfc_status ("CONTAINS\n");
1803 gfc_show_namespace (ns);
1807 gfc_status_char ('\n');
1808 gfc_current_ns = save;