2 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
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 #include "constructor.h"
39 /* Keep track of indentation for symbol tree dumps. */
40 static int show_level = 0;
42 /* The file handle we're dumping to is kept in a static variable. This
43 is not too cool, but it avoids a lot of passing it around. */
44 static FILE *dumpfile;
46 /* Forward declaration of some of the functions. */
47 static void show_expr (gfc_expr *p);
48 static void show_code_node (int, gfc_code *);
49 static void show_namespace (gfc_namespace *ns);
52 /* Allow dumping of an expression in the debugger. */
53 void gfc_debug_expr (gfc_expr *);
56 gfc_debug_expr (gfc_expr *e)
61 fputc ('\n', dumpfile);
66 /* Do indentation for a specific level. */
69 code_indent (int level, gfc_st_label *label)
74 fprintf (dumpfile, "%-5d ", label->value);
76 for (i = 0; i < (2 * level - (label ? 6 : 0)); i++)
77 fputc (' ', dumpfile);
81 /* Simple indentation at the current level. This one
82 is used to show symbols. */
87 fputc ('\n', dumpfile);
88 code_indent (show_level, NULL);
92 /* Show type-specific information. */
95 show_typespec (gfc_typespec *ts)
97 fprintf (dumpfile, "(%s ", gfc_basic_typename (ts->type));
103 fprintf (dumpfile, "%s", ts->u.derived->name);
108 show_expr (ts->u.cl->length);
109 fprintf(dumpfile, " %d", ts->kind);
113 fprintf (dumpfile, "%d", ts->kind);
117 fputc (')', dumpfile);
121 /* Show an actual argument list. */
124 show_actual_arglist (gfc_actual_arglist *a)
126 fputc ('(', dumpfile);
128 for (; a; a = a->next)
130 fputc ('(', dumpfile);
132 fprintf (dumpfile, "%s = ", a->name);
136 fputs ("(arg not-present)", dumpfile);
138 fputc (')', dumpfile);
140 fputc (' ', dumpfile);
143 fputc (')', dumpfile);
147 /* Show a gfc_array_spec array specification structure. */
150 show_array_spec (gfc_array_spec *as)
157 fputs ("()", dumpfile);
161 fprintf (dumpfile, "(%d [%d]", as->rank, as->corank);
163 if (as->rank + as->corank > 0)
167 case AS_EXPLICIT: c = "AS_EXPLICIT"; break;
168 case AS_DEFERRED: c = "AS_DEFERRED"; break;
169 case AS_ASSUMED_SIZE: c = "AS_ASSUMED_SIZE"; break;
170 case AS_ASSUMED_SHAPE: c = "AS_ASSUMED_SHAPE"; break;
172 gfc_internal_error ("show_array_spec(): Unhandled array shape "
175 fprintf (dumpfile, " %s ", c);
177 for (i = 0; i < as->rank + as->corank; i++)
179 show_expr (as->lower[i]);
180 fputc (' ', dumpfile);
181 show_expr (as->upper[i]);
182 fputc (' ', dumpfile);
186 fputc (')', dumpfile);
190 /* Show a gfc_array_ref array reference structure. */
193 show_array_ref (gfc_array_ref * ar)
197 fputc ('(', dumpfile);
202 fputs ("FULL", dumpfile);
206 for (i = 0; i < ar->dimen; i++)
208 /* There are two types of array sections: either the
209 elements are identified by an integer array ('vector'),
210 or by an index range. In the former case we only have to
211 print the start expression which contains the vector, in
212 the latter case we have to print any of lower and upper
213 bound and the stride, if they're present. */
215 if (ar->start[i] != NULL)
216 show_expr (ar->start[i]);
218 if (ar->dimen_type[i] == DIMEN_RANGE)
220 fputc (':', dumpfile);
222 if (ar->end[i] != NULL)
223 show_expr (ar->end[i]);
225 if (ar->stride[i] != NULL)
227 fputc (':', dumpfile);
228 show_expr (ar->stride[i]);
232 if (i != ar->dimen - 1)
233 fputs (" , ", dumpfile);
238 for (i = 0; i < ar->dimen; i++)
240 show_expr (ar->start[i]);
241 if (i != ar->dimen - 1)
242 fputs (" , ", dumpfile);
247 fputs ("UNKNOWN", dumpfile);
251 gfc_internal_error ("show_array_ref(): Unknown array reference");
254 fputc (')', dumpfile);
258 /* Show a list of gfc_ref structures. */
261 show_ref (gfc_ref *p)
263 for (; p; p = p->next)
267 show_array_ref (&p->u.ar);
271 fprintf (dumpfile, " %% %s", p->u.c.component->name);
275 fputc ('(', dumpfile);
276 show_expr (p->u.ss.start);
277 fputc (':', dumpfile);
278 show_expr (p->u.ss.end);
279 fputc (')', dumpfile);
283 gfc_internal_error ("show_ref(): Bad component code");
288 /* Display a constructor. Works recursively for array constructors. */
291 show_constructor (gfc_constructor_base base)
294 for (c = gfc_constructor_first (base); c; c = gfc_constructor_next (c))
296 if (c->iterator == NULL)
300 fputc ('(', dumpfile);
303 fputc (' ', dumpfile);
304 show_expr (c->iterator->var);
305 fputc ('=', dumpfile);
306 show_expr (c->iterator->start);
307 fputc (',', dumpfile);
308 show_expr (c->iterator->end);
309 fputc (',', dumpfile);
310 show_expr (c->iterator->step);
312 fputc (')', dumpfile);
315 if (gfc_constructor_next (c) != NULL)
316 fputs (" , ", dumpfile);
322 show_char_const (const gfc_char_t *c, int length)
326 fputc ('\'', dumpfile);
327 for (i = 0; i < length; i++)
330 fputs ("''", dumpfile);
332 fputs (gfc_print_wide_char (c[i]), dumpfile);
334 fputc ('\'', dumpfile);
338 /* Show a component-call expression. */
341 show_compcall (gfc_expr* p)
343 gcc_assert (p->expr_type == EXPR_COMPCALL);
345 fprintf (dumpfile, "%s", p->symtree->n.sym->name);
347 fprintf (dumpfile, "%s", p->value.compcall.name);
349 show_actual_arglist (p->value.compcall.actual);
353 /* Show an expression. */
356 show_expr (gfc_expr *p)
363 fputs ("()", dumpfile);
367 switch (p->expr_type)
370 show_char_const (p->value.character.string, p->value.character.length);
375 fprintf (dumpfile, "%s(", p->ts.u.derived->name);
376 show_constructor (p->value.constructor);
377 fputc (')', dumpfile);
381 fputs ("(/ ", dumpfile);
382 show_constructor (p->value.constructor);
383 fputs (" /)", dumpfile);
389 fputs ("NULL()", dumpfile);
396 mpz_out_str (stdout, 10, p->value.integer);
398 if (p->ts.kind != gfc_default_integer_kind)
399 fprintf (dumpfile, "_%d", p->ts.kind);
403 if (p->value.logical)
404 fputs (".true.", dumpfile);
406 fputs (".false.", dumpfile);
410 mpfr_out_str (stdout, 10, 0, p->value.real, GFC_RND_MODE);
411 if (p->ts.kind != gfc_default_real_kind)
412 fprintf (dumpfile, "_%d", p->ts.kind);
416 show_char_const (p->value.character.string,
417 p->value.character.length);
421 fputs ("(complex ", dumpfile);
423 mpfr_out_str (stdout, 10, 0, mpc_realref (p->value.complex),
425 if (p->ts.kind != gfc_default_complex_kind)
426 fprintf (dumpfile, "_%d", p->ts.kind);
428 fputc (' ', dumpfile);
430 mpfr_out_str (stdout, 10, 0, mpc_imagref (p->value.complex),
432 if (p->ts.kind != gfc_default_complex_kind)
433 fprintf (dumpfile, "_%d", p->ts.kind);
435 fputc (')', dumpfile);
439 fprintf (dumpfile, "%dH", p->representation.length);
440 c = p->representation.string;
441 for (i = 0; i < p->representation.length; i++, c++)
443 fputc (*c, dumpfile);
448 fputs ("???", dumpfile);
452 if (p->representation.string)
454 fputs (" {", dumpfile);
455 c = p->representation.string;
456 for (i = 0; i < p->representation.length; i++, c++)
458 fprintf (dumpfile, "%.2x", (unsigned int) *c);
459 if (i < p->representation.length - 1)
460 fputc (',', dumpfile);
462 fputc ('}', dumpfile);
468 if (p->symtree->n.sym->ns && p->symtree->n.sym->ns->proc_name)
469 fprintf (dumpfile, "%s:", p->symtree->n.sym->ns->proc_name->name);
470 fprintf (dumpfile, "%s", p->symtree->n.sym->name);
475 fputc ('(', dumpfile);
476 switch (p->value.op.op)
478 case INTRINSIC_UPLUS:
479 fputs ("U+ ", dumpfile);
481 case INTRINSIC_UMINUS:
482 fputs ("U- ", dumpfile);
485 fputs ("+ ", dumpfile);
487 case INTRINSIC_MINUS:
488 fputs ("- ", dumpfile);
490 case INTRINSIC_TIMES:
491 fputs ("* ", dumpfile);
493 case INTRINSIC_DIVIDE:
494 fputs ("/ ", dumpfile);
496 case INTRINSIC_POWER:
497 fputs ("** ", dumpfile);
499 case INTRINSIC_CONCAT:
500 fputs ("// ", dumpfile);
503 fputs ("AND ", dumpfile);
506 fputs ("OR ", dumpfile);
509 fputs ("EQV ", dumpfile);
512 fputs ("NEQV ", dumpfile);
515 case INTRINSIC_EQ_OS:
516 fputs ("= ", dumpfile);
519 case INTRINSIC_NE_OS:
520 fputs ("/= ", dumpfile);
523 case INTRINSIC_GT_OS:
524 fputs ("> ", dumpfile);
527 case INTRINSIC_GE_OS:
528 fputs (">= ", dumpfile);
531 case INTRINSIC_LT_OS:
532 fputs ("< ", dumpfile);
535 case INTRINSIC_LE_OS:
536 fputs ("<= ", dumpfile);
539 fputs ("NOT ", dumpfile);
541 case INTRINSIC_PARENTHESES:
542 fputs ("parens ", dumpfile);
547 ("show_expr(): Bad intrinsic in expression!");
550 show_expr (p->value.op.op1);
554 fputc (' ', dumpfile);
555 show_expr (p->value.op.op2);
558 fputc (')', dumpfile);
562 if (p->value.function.name == NULL)
564 fprintf (dumpfile, "%s", p->symtree->n.sym->name);
565 if (gfc_is_proc_ptr_comp (p, NULL))
567 fputc ('[', dumpfile);
568 show_actual_arglist (p->value.function.actual);
569 fputc (']', dumpfile);
573 fprintf (dumpfile, "%s", p->value.function.name);
574 if (gfc_is_proc_ptr_comp (p, NULL))
576 fputc ('[', dumpfile);
577 fputc ('[', dumpfile);
578 show_actual_arglist (p->value.function.actual);
579 fputc (']', dumpfile);
580 fputc (']', dumpfile);
590 gfc_internal_error ("show_expr(): Don't know how to show expr");
594 /* Show symbol attributes. The flavor and intent are followed by
595 whatever single bit attributes are present. */
598 show_attr (symbol_attribute *attr, const char * module)
600 if (attr->flavor != FL_UNKNOWN)
601 fprintf (dumpfile, "(%s ", gfc_code2string (flavors, attr->flavor));
602 if (attr->access != ACCESS_UNKNOWN)
603 fprintf (dumpfile, "%s ", gfc_code2string (access_types, attr->access));
604 if (attr->proc != PROC_UNKNOWN)
605 fprintf (dumpfile, "%s ", gfc_code2string (procedures, attr->proc));
606 if (attr->save != SAVE_NONE)
607 fprintf (dumpfile, "%s", gfc_code2string (save_status, attr->save));
609 if (attr->allocatable)
610 fputs (" ALLOCATABLE", dumpfile);
611 if (attr->asynchronous)
612 fputs (" ASYNCHRONOUS", dumpfile);
613 if (attr->codimension)
614 fputs (" CODIMENSION", dumpfile);
616 fputs (" DIMENSION", dumpfile);
617 if (attr->contiguous)
618 fputs (" CONTIGUOUS", dumpfile);
620 fputs (" EXTERNAL", dumpfile);
622 fputs (" INTRINSIC", dumpfile);
624 fputs (" OPTIONAL", dumpfile);
626 fputs (" POINTER", dumpfile);
627 if (attr->is_protected)
628 fputs (" PROTECTED", dumpfile);
630 fputs (" VALUE", dumpfile);
632 fputs (" VOLATILE", dumpfile);
633 if (attr->threadprivate)
634 fputs (" THREADPRIVATE", dumpfile);
636 fputs (" TARGET", dumpfile);
639 fputs (" DUMMY", dumpfile);
640 if (attr->intent != INTENT_UNKNOWN)
641 fprintf (dumpfile, "(%s)", gfc_intent_string (attr->intent));
645 fputs (" RESULT", dumpfile);
647 fputs (" ENTRY", dumpfile);
649 fputs (" BIND(C)", dumpfile);
652 fputs (" DATA", dumpfile);
655 fputs (" USE-ASSOC", dumpfile);
657 fprintf (dumpfile, "(%s)", module);
660 if (attr->in_namelist)
661 fputs (" IN-NAMELIST", dumpfile);
663 fputs (" IN-COMMON", dumpfile);
666 fputs (" ABSTRACT", dumpfile);
668 fputs (" FUNCTION", dumpfile);
669 if (attr->subroutine)
670 fputs (" SUBROUTINE", dumpfile);
671 if (attr->implicit_type)
672 fputs (" IMPLICIT-TYPE", dumpfile);
675 fputs (" SEQUENCE", dumpfile);
677 fputs (" ELEMENTAL", dumpfile);
679 fputs (" PURE", dumpfile);
681 fputs (" RECURSIVE", dumpfile);
683 fputc (')', dumpfile);
687 /* Show components of a derived type. */
690 show_components (gfc_symbol *sym)
694 for (c = sym->components; c; c = c->next)
696 fprintf (dumpfile, "(%s ", c->name);
697 show_typespec (&c->ts);
698 if (c->attr.allocatable)
699 fputs (" ALLOCATABLE", dumpfile);
701 fputs (" POINTER", dumpfile);
702 if (c->attr.proc_pointer)
703 fputs (" PPC", dumpfile);
704 if (c->attr.dimension)
705 fputs (" DIMENSION", dumpfile);
706 fputc (' ', dumpfile);
707 show_array_spec (c->as);
709 fprintf (dumpfile, " %s", gfc_code2string (access_types, c->attr.access));
710 fputc (')', dumpfile);
712 fputc (' ', dumpfile);
717 /* Show the f2k_derived namespace with procedure bindings. */
720 show_typebound_proc (gfc_typebound_proc* tb, const char* name)
725 fputs ("GENERIC", dumpfile);
728 fputs ("PROCEDURE, ", dumpfile);
730 fputs ("NOPASS", dumpfile);
734 fprintf (dumpfile, "PASS(%s)", tb->pass_arg);
736 fputs ("PASS", dumpfile);
738 if (tb->non_overridable)
739 fputs (", NON_OVERRIDABLE", dumpfile);
742 if (tb->access == ACCESS_PUBLIC)
743 fputs (", PUBLIC", dumpfile);
745 fputs (", PRIVATE", dumpfile);
747 fprintf (dumpfile, " :: %s => ", name);
752 for (g = tb->u.generic; g; g = g->next)
754 fputs (g->specific_st->name, dumpfile);
756 fputs (", ", dumpfile);
760 fputs (tb->u.specific->n.sym->name, dumpfile);
764 show_typebound_symtree (gfc_symtree* st)
766 gcc_assert (st->n.tb);
767 show_typebound_proc (st->n.tb, st->name);
771 show_f2k_derived (gfc_namespace* f2k)
777 fputs ("Procedure bindings:", dumpfile);
780 /* Finalizer bindings. */
781 for (f = f2k->finalizers; f; f = f->next)
784 fprintf (dumpfile, "FINAL %s", f->proc_sym->name);
787 /* Type-bound procedures. */
788 gfc_traverse_symtree (f2k->tb_sym_root, &show_typebound_symtree);
793 fputs ("Operator bindings:", dumpfile);
796 /* User-defined operators. */
797 gfc_traverse_symtree (f2k->tb_uop_root, &show_typebound_symtree);
799 /* Intrinsic operators. */
800 for (op = GFC_INTRINSIC_BEGIN; op != GFC_INTRINSIC_END; ++op)
802 show_typebound_proc (f2k->tb_op[op],
803 gfc_op2string ((gfc_intrinsic_op) op));
809 /* Show a symbol. If a symbol is an ENTRY, SUBROUTINE or FUNCTION, we
810 show the interface. Information needed to reconstruct the list of
811 specific interfaces associated with a generic symbol is done within
815 show_symbol (gfc_symbol *sym)
817 gfc_formal_arglist *formal;
824 fprintf (dumpfile, "|| symbol: '%s' ", sym->name);
825 len = strlen (sym->name);
826 for (i=len; i<12; i++)
827 fputc(' ', dumpfile);
832 fputs ("type spec : ", dumpfile);
833 show_typespec (&sym->ts);
836 fputs ("attributes: ", dumpfile);
837 show_attr (&sym->attr, sym->module);
842 fputs ("value: ", dumpfile);
843 show_expr (sym->value);
849 fputs ("Array spec:", dumpfile);
850 show_array_spec (sym->as);
856 fputs ("Generic interfaces:", dumpfile);
857 for (intr = sym->generic; intr; intr = intr->next)
858 fprintf (dumpfile, " %s", intr->sym->name);
864 fprintf (dumpfile, "result: %s", sym->result->name);
870 fputs ("components: ", dumpfile);
871 show_components (sym);
874 if (sym->f2k_derived)
878 fprintf (dumpfile, "hash: %d", sym->hash_value);
879 show_f2k_derived (sym->f2k_derived);
885 fputs ("Formal arglist:", dumpfile);
887 for (formal = sym->formal; formal; formal = formal->next)
889 if (formal->sym != NULL)
890 fprintf (dumpfile, " %s", formal->sym->name);
892 fputs (" [Alt Return]", dumpfile);
896 if (sym->formal_ns && (sym->formal_ns->proc_name != sym)
897 && sym->attr.proc != PROC_ST_FUNCTION
901 fputs ("Formal namespace", dumpfile);
902 show_namespace (sym->formal_ns);
908 /* Show a user-defined operator. Just prints an operator
909 and the name of the associated subroutine, really. */
912 show_uop (gfc_user_op *uop)
917 fprintf (dumpfile, "%s:", uop->name);
919 for (intr = uop->op; intr; intr = intr->next)
920 fprintf (dumpfile, " %s", intr->sym->name);
924 /* Workhorse function for traversing the user operator symtree. */
927 traverse_uop (gfc_symtree *st, void (*func) (gfc_user_op *))
934 traverse_uop (st->left, func);
935 traverse_uop (st->right, func);
939 /* Traverse the tree of user operator nodes. */
942 gfc_traverse_user_op (gfc_namespace *ns, void (*func) (gfc_user_op *))
944 traverse_uop (ns->uop_root, func);
948 /* Function to display a common block. */
951 show_common (gfc_symtree *st)
956 fprintf (dumpfile, "common: /%s/ ", st->name);
958 s = st->n.common->head;
961 fprintf (dumpfile, "%s", s->name);
964 fputs (", ", dumpfile);
966 fputc ('\n', dumpfile);
970 /* Worker function to display the symbol tree. */
973 show_symtree (gfc_symtree *st)
979 len = strlen(st->name);
980 fprintf (dumpfile, "symtree: '%s'", st->name);
982 for (i=len; i<12; i++)
983 fputc(' ', dumpfile);
986 fputs( " Ambiguous", dumpfile);
988 if (st->n.sym->ns != gfc_current_ns)
989 fprintf (dumpfile, "|| symbol: '%s' from namespace '%s'", st->n.sym->name,
990 st->n.sym->ns->proc_name->name);
992 show_symbol (st->n.sym);
996 /******************* Show gfc_code structures **************/
999 /* Show a list of code structures. Mutually recursive with
1000 show_code_node(). */
1003 show_code (int level, gfc_code *c)
1005 for (; c; c = c->next)
1006 show_code_node (level, c);
1010 show_namelist (gfc_namelist *n)
1012 for (; n->next; n = n->next)
1013 fprintf (dumpfile, "%s,", n->sym->name);
1014 fprintf (dumpfile, "%s", n->sym->name);
1017 /* Show a single OpenMP directive node and everything underneath it
1021 show_omp_node (int level, gfc_code *c)
1023 gfc_omp_clauses *omp_clauses = NULL;
1024 const char *name = NULL;
1028 case EXEC_OMP_ATOMIC: name = "ATOMIC"; break;
1029 case EXEC_OMP_BARRIER: name = "BARRIER"; break;
1030 case EXEC_OMP_CRITICAL: name = "CRITICAL"; break;
1031 case EXEC_OMP_FLUSH: name = "FLUSH"; break;
1032 case EXEC_OMP_DO: name = "DO"; break;
1033 case EXEC_OMP_MASTER: name = "MASTER"; break;
1034 case EXEC_OMP_ORDERED: name = "ORDERED"; break;
1035 case EXEC_OMP_PARALLEL: name = "PARALLEL"; break;
1036 case EXEC_OMP_PARALLEL_DO: name = "PARALLEL DO"; break;
1037 case EXEC_OMP_PARALLEL_SECTIONS: name = "PARALLEL SECTIONS"; break;
1038 case EXEC_OMP_PARALLEL_WORKSHARE: name = "PARALLEL WORKSHARE"; break;
1039 case EXEC_OMP_SECTIONS: name = "SECTIONS"; break;
1040 case EXEC_OMP_SINGLE: name = "SINGLE"; break;
1041 case EXEC_OMP_TASK: name = "TASK"; break;
1042 case EXEC_OMP_TASKWAIT: name = "TASKWAIT"; break;
1043 case EXEC_OMP_TASKYIELD: name = "TASKYIELD"; break;
1044 case EXEC_OMP_WORKSHARE: name = "WORKSHARE"; break;
1048 fprintf (dumpfile, "!$OMP %s", name);
1052 case EXEC_OMP_PARALLEL:
1053 case EXEC_OMP_PARALLEL_DO:
1054 case EXEC_OMP_PARALLEL_SECTIONS:
1055 case EXEC_OMP_SECTIONS:
1056 case EXEC_OMP_SINGLE:
1057 case EXEC_OMP_WORKSHARE:
1058 case EXEC_OMP_PARALLEL_WORKSHARE:
1060 omp_clauses = c->ext.omp_clauses;
1062 case EXEC_OMP_CRITICAL:
1063 if (c->ext.omp_name)
1064 fprintf (dumpfile, " (%s)", c->ext.omp_name);
1066 case EXEC_OMP_FLUSH:
1067 if (c->ext.omp_namelist)
1069 fputs (" (", dumpfile);
1070 show_namelist (c->ext.omp_namelist);
1071 fputc (')', dumpfile);
1074 case EXEC_OMP_BARRIER:
1075 case EXEC_OMP_TASKWAIT:
1076 case EXEC_OMP_TASKYIELD:
1085 if (omp_clauses->if_expr)
1087 fputs (" IF(", dumpfile);
1088 show_expr (omp_clauses->if_expr);
1089 fputc (')', dumpfile);
1091 if (omp_clauses->final_expr)
1093 fputs (" FINAL(", dumpfile);
1094 show_expr (omp_clauses->final_expr);
1095 fputc (')', dumpfile);
1097 if (omp_clauses->num_threads)
1099 fputs (" NUM_THREADS(", dumpfile);
1100 show_expr (omp_clauses->num_threads);
1101 fputc (')', dumpfile);
1103 if (omp_clauses->sched_kind != OMP_SCHED_NONE)
1106 switch (omp_clauses->sched_kind)
1108 case OMP_SCHED_STATIC: type = "STATIC"; break;
1109 case OMP_SCHED_DYNAMIC: type = "DYNAMIC"; break;
1110 case OMP_SCHED_GUIDED: type = "GUIDED"; break;
1111 case OMP_SCHED_RUNTIME: type = "RUNTIME"; break;
1112 case OMP_SCHED_AUTO: type = "AUTO"; break;
1116 fprintf (dumpfile, " SCHEDULE (%s", type);
1117 if (omp_clauses->chunk_size)
1119 fputc (',', dumpfile);
1120 show_expr (omp_clauses->chunk_size);
1122 fputc (')', dumpfile);
1124 if (omp_clauses->default_sharing != OMP_DEFAULT_UNKNOWN)
1127 switch (omp_clauses->default_sharing)
1129 case OMP_DEFAULT_NONE: type = "NONE"; break;
1130 case OMP_DEFAULT_PRIVATE: type = "PRIVATE"; break;
1131 case OMP_DEFAULT_SHARED: type = "SHARED"; break;
1132 case OMP_DEFAULT_FIRSTPRIVATE: type = "FIRSTPRIVATE"; break;
1136 fprintf (dumpfile, " DEFAULT(%s)", type);
1138 if (omp_clauses->ordered)
1139 fputs (" ORDERED", dumpfile);
1140 if (omp_clauses->untied)
1141 fputs (" UNTIED", dumpfile);
1142 if (omp_clauses->mergeable)
1143 fputs (" MERGEABLE", dumpfile);
1144 if (omp_clauses->collapse)
1145 fprintf (dumpfile, " COLLAPSE(%d)", omp_clauses->collapse);
1146 for (list_type = 0; list_type < OMP_LIST_NUM; list_type++)
1147 if (omp_clauses->lists[list_type] != NULL
1148 && list_type != OMP_LIST_COPYPRIVATE)
1151 if (list_type >= OMP_LIST_REDUCTION_FIRST)
1155 case OMP_LIST_PLUS: type = "+"; break;
1156 case OMP_LIST_MULT: type = "*"; break;
1157 case OMP_LIST_SUB: type = "-"; break;
1158 case OMP_LIST_AND: type = ".AND."; break;
1159 case OMP_LIST_OR: type = ".OR."; break;
1160 case OMP_LIST_EQV: type = ".EQV."; break;
1161 case OMP_LIST_NEQV: type = ".NEQV."; break;
1162 case OMP_LIST_MAX: type = "MAX"; break;
1163 case OMP_LIST_MIN: type = "MIN"; break;
1164 case OMP_LIST_IAND: type = "IAND"; break;
1165 case OMP_LIST_IOR: type = "IOR"; break;
1166 case OMP_LIST_IEOR: type = "IEOR"; break;
1170 fprintf (dumpfile, " REDUCTION(%s:", type);
1176 case OMP_LIST_PRIVATE: type = "PRIVATE"; break;
1177 case OMP_LIST_FIRSTPRIVATE: type = "FIRSTPRIVATE"; break;
1178 case OMP_LIST_LASTPRIVATE: type = "LASTPRIVATE"; break;
1179 case OMP_LIST_SHARED: type = "SHARED"; break;
1180 case OMP_LIST_COPYIN: type = "COPYIN"; break;
1184 fprintf (dumpfile, " %s(", type);
1186 show_namelist (omp_clauses->lists[list_type]);
1187 fputc (')', dumpfile);
1190 fputc ('\n', dumpfile);
1191 if (c->op == EXEC_OMP_SECTIONS || c->op == EXEC_OMP_PARALLEL_SECTIONS)
1193 gfc_code *d = c->block;
1196 show_code (level + 1, d->next);
1197 if (d->block == NULL)
1199 code_indent (level, 0);
1200 fputs ("!$OMP SECTION\n", dumpfile);
1205 show_code (level + 1, c->block->next);
1206 if (c->op == EXEC_OMP_ATOMIC)
1208 code_indent (level, 0);
1209 fprintf (dumpfile, "!$OMP END %s", name);
1210 if (omp_clauses != NULL)
1212 if (omp_clauses->lists[OMP_LIST_COPYPRIVATE])
1214 fputs (" COPYPRIVATE(", dumpfile);
1215 show_namelist (omp_clauses->lists[OMP_LIST_COPYPRIVATE]);
1216 fputc (')', dumpfile);
1218 else if (omp_clauses->nowait)
1219 fputs (" NOWAIT", dumpfile);
1221 else if (c->op == EXEC_OMP_CRITICAL && c->ext.omp_name)
1222 fprintf (dumpfile, " (%s)", c->ext.omp_name);
1226 /* Show a single code node and everything underneath it if necessary. */
1229 show_code_node (int level, gfc_code *c)
1231 gfc_forall_iterator *fa;
1244 fputc ('\n', dumpfile);
1245 code_indent (level, c->here);
1252 case EXEC_END_PROCEDURE:
1256 fputs ("NOP", dumpfile);
1260 fputs ("CONTINUE", dumpfile);
1264 fprintf (dumpfile, "ENTRY %s", c->ext.entry->sym->name);
1267 case EXEC_INIT_ASSIGN:
1269 fputs ("ASSIGN ", dumpfile);
1270 show_expr (c->expr1);
1271 fputc (' ', dumpfile);
1272 show_expr (c->expr2);
1275 case EXEC_LABEL_ASSIGN:
1276 fputs ("LABEL ASSIGN ", dumpfile);
1277 show_expr (c->expr1);
1278 fprintf (dumpfile, " %d", c->label1->value);
1281 case EXEC_POINTER_ASSIGN:
1282 fputs ("POINTER ASSIGN ", dumpfile);
1283 show_expr (c->expr1);
1284 fputc (' ', dumpfile);
1285 show_expr (c->expr2);
1289 fputs ("GOTO ", dumpfile);
1291 fprintf (dumpfile, "%d", c->label1->value);
1294 show_expr (c->expr1);
1298 fputs (", (", dumpfile);
1299 for (; d; d = d ->block)
1301 code_indent (level, d->label1);
1302 if (d->block != NULL)
1303 fputc (',', dumpfile);
1305 fputc (')', dumpfile);
1312 case EXEC_ASSIGN_CALL:
1313 if (c->resolved_sym)
1314 fprintf (dumpfile, "CALL %s ", c->resolved_sym->name);
1315 else if (c->symtree)
1316 fprintf (dumpfile, "CALL %s ", c->symtree->name);
1318 fputs ("CALL ?? ", dumpfile);
1320 show_actual_arglist (c->ext.actual);
1324 fputs ("CALL ", dumpfile);
1325 show_compcall (c->expr1);
1329 fputs ("CALL ", dumpfile);
1330 show_expr (c->expr1);
1331 show_actual_arglist (c->ext.actual);
1335 fputs ("RETURN ", dumpfile);
1337 show_expr (c->expr1);
1341 fputs ("PAUSE ", dumpfile);
1343 if (c->expr1 != NULL)
1344 show_expr (c->expr1);
1346 fprintf (dumpfile, "%d", c->ext.stop_code);
1350 case EXEC_ERROR_STOP:
1351 fputs ("ERROR ", dumpfile);
1355 fputs ("STOP ", dumpfile);
1357 if (c->expr1 != NULL)
1358 show_expr (c->expr1);
1360 fprintf (dumpfile, "%d", c->ext.stop_code);
1365 fputs ("SYNC ALL ", dumpfile);
1366 if (c->expr2 != NULL)
1368 fputs (" stat=", dumpfile);
1369 show_expr (c->expr2);
1371 if (c->expr3 != NULL)
1373 fputs (" errmsg=", dumpfile);
1374 show_expr (c->expr3);
1378 case EXEC_SYNC_MEMORY:
1379 fputs ("SYNC MEMORY ", dumpfile);
1380 if (c->expr2 != NULL)
1382 fputs (" stat=", dumpfile);
1383 show_expr (c->expr2);
1385 if (c->expr3 != NULL)
1387 fputs (" errmsg=", dumpfile);
1388 show_expr (c->expr3);
1392 case EXEC_SYNC_IMAGES:
1393 fputs ("SYNC IMAGES image-set=", dumpfile);
1394 if (c->expr1 != NULL)
1395 show_expr (c->expr1);
1397 fputs ("* ", dumpfile);
1398 if (c->expr2 != NULL)
1400 fputs (" stat=", dumpfile);
1401 show_expr (c->expr2);
1403 if (c->expr3 != NULL)
1405 fputs (" errmsg=", dumpfile);
1406 show_expr (c->expr3);
1412 if (c->op == EXEC_LOCK)
1413 fputs ("LOCK ", dumpfile);
1415 fputs ("UNLOCK ", dumpfile);
1417 fputs ("lock-variable=", dumpfile);
1418 if (c->expr1 != NULL)
1419 show_expr (c->expr1);
1420 if (c->expr4 != NULL)
1422 fputs (" acquired_lock=", dumpfile);
1423 show_expr (c->expr4);
1425 if (c->expr2 != NULL)
1427 fputs (" stat=", dumpfile);
1428 show_expr (c->expr2);
1430 if (c->expr3 != NULL)
1432 fputs (" errmsg=", dumpfile);
1433 show_expr (c->expr3);
1437 case EXEC_ARITHMETIC_IF:
1438 fputs ("IF ", dumpfile);
1439 show_expr (c->expr1);
1440 fprintf (dumpfile, " %d, %d, %d",
1441 c->label1->value, c->label2->value, c->label3->value);
1446 fputs ("IF ", dumpfile);
1447 show_expr (d->expr1);
1450 show_code (level + 1, d->next);
1454 for (; d; d = d->block)
1456 code_indent (level, 0);
1458 if (d->expr1 == NULL)
1459 fputs ("ELSE", dumpfile);
1462 fputs ("ELSE IF ", dumpfile);
1463 show_expr (d->expr1);
1467 show_code (level + 1, d->next);
1472 code_indent (level, c->label1);
1476 fputs ("ENDIF", dumpfile);
1481 const char* blocktype;
1482 gfc_namespace *saved_ns;
1484 if (c->ext.block.assoc)
1485 blocktype = "ASSOCIATE";
1487 blocktype = "BLOCK";
1489 fprintf (dumpfile, "%s ", blocktype);
1491 ns = c->ext.block.ns;
1492 saved_ns = gfc_current_ns;
1493 gfc_current_ns = ns;
1494 gfc_traverse_symtree (ns->sym_root, show_symtree);
1495 gfc_current_ns = saved_ns;
1496 show_code (show_level, ns->code);
1499 fprintf (dumpfile, "END %s ", blocktype);
1505 fputs ("SELECT CASE ", dumpfile);
1506 show_expr (c->expr1);
1507 fputc ('\n', dumpfile);
1509 for (; d; d = d->block)
1511 code_indent (level, 0);
1513 fputs ("CASE ", dumpfile);
1514 for (cp = d->ext.block.case_list; cp; cp = cp->next)
1516 fputc ('(', dumpfile);
1517 show_expr (cp->low);
1518 fputc (' ', dumpfile);
1519 show_expr (cp->high);
1520 fputc (')', dumpfile);
1521 fputc (' ', dumpfile);
1523 fputc ('\n', dumpfile);
1525 show_code (level + 1, d->next);
1528 code_indent (level, c->label1);
1529 fputs ("END SELECT", dumpfile);
1533 fputs ("WHERE ", dumpfile);
1536 show_expr (d->expr1);
1537 fputc ('\n', dumpfile);
1539 show_code (level + 1, d->next);
1541 for (d = d->block; d; d = d->block)
1543 code_indent (level, 0);
1544 fputs ("ELSE WHERE ", dumpfile);
1545 show_expr (d->expr1);
1546 fputc ('\n', dumpfile);
1547 show_code (level + 1, d->next);
1550 code_indent (level, 0);
1551 fputs ("END WHERE", dumpfile);
1556 fputs ("FORALL ", dumpfile);
1557 for (fa = c->ext.forall_iterator; fa; fa = fa->next)
1559 show_expr (fa->var);
1560 fputc (' ', dumpfile);
1561 show_expr (fa->start);
1562 fputc (':', dumpfile);
1563 show_expr (fa->end);
1564 fputc (':', dumpfile);
1565 show_expr (fa->stride);
1567 if (fa->next != NULL)
1568 fputc (',', dumpfile);
1571 if (c->expr1 != NULL)
1573 fputc (',', dumpfile);
1574 show_expr (c->expr1);
1576 fputc ('\n', dumpfile);
1578 show_code (level + 1, c->block->next);
1580 code_indent (level, 0);
1581 fputs ("END FORALL", dumpfile);
1585 fputs ("CRITICAL\n", dumpfile);
1586 show_code (level + 1, c->block->next);
1587 code_indent (level, 0);
1588 fputs ("END CRITICAL", dumpfile);
1592 fputs ("DO ", dumpfile);
1594 fprintf (dumpfile, " %-5d ", c->label1->value);
1596 show_expr (c->ext.iterator->var);
1597 fputc ('=', dumpfile);
1598 show_expr (c->ext.iterator->start);
1599 fputc (' ', dumpfile);
1600 show_expr (c->ext.iterator->end);
1601 fputc (' ', dumpfile);
1602 show_expr (c->ext.iterator->step);
1605 show_code (level + 1, c->block->next);
1612 fputs ("END DO", dumpfile);
1615 case EXEC_DO_CONCURRENT:
1616 fputs ("DO CONCURRENT ", dumpfile);
1617 for (fa = c->ext.forall_iterator; fa; fa = fa->next)
1619 show_expr (fa->var);
1620 fputc (' ', dumpfile);
1621 show_expr (fa->start);
1622 fputc (':', dumpfile);
1623 show_expr (fa->end);
1624 fputc (':', dumpfile);
1625 show_expr (fa->stride);
1627 if (fa->next != NULL)
1628 fputc (',', dumpfile);
1630 show_expr (c->expr1);
1632 show_code (level + 1, c->block->next);
1633 code_indent (level, c->label1);
1634 fputs ("END DO", dumpfile);
1638 fputs ("DO WHILE ", dumpfile);
1639 show_expr (c->expr1);
1640 fputc ('\n', dumpfile);
1642 show_code (level + 1, c->block->next);
1644 code_indent (level, c->label1);
1645 fputs ("END DO", dumpfile);
1649 fputs ("CYCLE", dumpfile);
1651 fprintf (dumpfile, " %s", c->symtree->n.sym->name);
1655 fputs ("EXIT", dumpfile);
1657 fprintf (dumpfile, " %s", c->symtree->n.sym->name);
1661 fputs ("ALLOCATE ", dumpfile);
1664 fputs (" STAT=", dumpfile);
1665 show_expr (c->expr1);
1670 fputs (" ERRMSG=", dumpfile);
1671 show_expr (c->expr2);
1677 fputs (" MOLD=", dumpfile);
1679 fputs (" SOURCE=", dumpfile);
1680 show_expr (c->expr3);
1683 for (a = c->ext.alloc.list; a; a = a->next)
1685 fputc (' ', dumpfile);
1686 show_expr (a->expr);
1691 case EXEC_DEALLOCATE:
1692 fputs ("DEALLOCATE ", dumpfile);
1695 fputs (" STAT=", dumpfile);
1696 show_expr (c->expr1);
1701 fputs (" ERRMSG=", dumpfile);
1702 show_expr (c->expr2);
1705 for (a = c->ext.alloc.list; a; a = a->next)
1707 fputc (' ', dumpfile);
1708 show_expr (a->expr);
1714 fputs ("OPEN", dumpfile);
1719 fputs (" UNIT=", dumpfile);
1720 show_expr (open->unit);
1724 fputs (" IOMSG=", dumpfile);
1725 show_expr (open->iomsg);
1729 fputs (" IOSTAT=", dumpfile);
1730 show_expr (open->iostat);
1734 fputs (" FILE=", dumpfile);
1735 show_expr (open->file);
1739 fputs (" STATUS=", dumpfile);
1740 show_expr (open->status);
1744 fputs (" ACCESS=", dumpfile);
1745 show_expr (open->access);
1749 fputs (" FORM=", dumpfile);
1750 show_expr (open->form);
1754 fputs (" RECL=", dumpfile);
1755 show_expr (open->recl);
1759 fputs (" BLANK=", dumpfile);
1760 show_expr (open->blank);
1764 fputs (" POSITION=", dumpfile);
1765 show_expr (open->position);
1769 fputs (" ACTION=", dumpfile);
1770 show_expr (open->action);
1774 fputs (" DELIM=", dumpfile);
1775 show_expr (open->delim);
1779 fputs (" PAD=", dumpfile);
1780 show_expr (open->pad);
1784 fputs (" DECIMAL=", dumpfile);
1785 show_expr (open->decimal);
1789 fputs (" ENCODING=", dumpfile);
1790 show_expr (open->encoding);
1794 fputs (" ROUND=", dumpfile);
1795 show_expr (open->round);
1799 fputs (" SIGN=", dumpfile);
1800 show_expr (open->sign);
1804 fputs (" CONVERT=", dumpfile);
1805 show_expr (open->convert);
1807 if (open->asynchronous)
1809 fputs (" ASYNCHRONOUS=", dumpfile);
1810 show_expr (open->asynchronous);
1812 if (open->err != NULL)
1813 fprintf (dumpfile, " ERR=%d", open->err->value);
1818 fputs ("CLOSE", dumpfile);
1819 close = c->ext.close;
1823 fputs (" UNIT=", dumpfile);
1824 show_expr (close->unit);
1828 fputs (" IOMSG=", dumpfile);
1829 show_expr (close->iomsg);
1833 fputs (" IOSTAT=", dumpfile);
1834 show_expr (close->iostat);
1838 fputs (" STATUS=", dumpfile);
1839 show_expr (close->status);
1841 if (close->err != NULL)
1842 fprintf (dumpfile, " ERR=%d", close->err->value);
1845 case EXEC_BACKSPACE:
1846 fputs ("BACKSPACE", dumpfile);
1850 fputs ("ENDFILE", dumpfile);
1854 fputs ("REWIND", dumpfile);
1858 fputs ("FLUSH", dumpfile);
1861 fp = c->ext.filepos;
1865 fputs (" UNIT=", dumpfile);
1866 show_expr (fp->unit);
1870 fputs (" IOMSG=", dumpfile);
1871 show_expr (fp->iomsg);
1875 fputs (" IOSTAT=", dumpfile);
1876 show_expr (fp->iostat);
1878 if (fp->err != NULL)
1879 fprintf (dumpfile, " ERR=%d", fp->err->value);
1883 fputs ("INQUIRE", dumpfile);
1888 fputs (" UNIT=", dumpfile);
1889 show_expr (i->unit);
1893 fputs (" FILE=", dumpfile);
1894 show_expr (i->file);
1899 fputs (" IOMSG=", dumpfile);
1900 show_expr (i->iomsg);
1904 fputs (" IOSTAT=", dumpfile);
1905 show_expr (i->iostat);
1909 fputs (" EXIST=", dumpfile);
1910 show_expr (i->exist);
1914 fputs (" OPENED=", dumpfile);
1915 show_expr (i->opened);
1919 fputs (" NUMBER=", dumpfile);
1920 show_expr (i->number);
1924 fputs (" NAMED=", dumpfile);
1925 show_expr (i->named);
1929 fputs (" NAME=", dumpfile);
1930 show_expr (i->name);
1934 fputs (" ACCESS=", dumpfile);
1935 show_expr (i->access);
1939 fputs (" SEQUENTIAL=", dumpfile);
1940 show_expr (i->sequential);
1945 fputs (" DIRECT=", dumpfile);
1946 show_expr (i->direct);
1950 fputs (" FORM=", dumpfile);
1951 show_expr (i->form);
1955 fputs (" FORMATTED", dumpfile);
1956 show_expr (i->formatted);
1960 fputs (" UNFORMATTED=", dumpfile);
1961 show_expr (i->unformatted);
1965 fputs (" RECL=", dumpfile);
1966 show_expr (i->recl);
1970 fputs (" NEXTREC=", dumpfile);
1971 show_expr (i->nextrec);
1975 fputs (" BLANK=", dumpfile);
1976 show_expr (i->blank);
1980 fputs (" POSITION=", dumpfile);
1981 show_expr (i->position);
1985 fputs (" ACTION=", dumpfile);
1986 show_expr (i->action);
1990 fputs (" READ=", dumpfile);
1991 show_expr (i->read);
1995 fputs (" WRITE=", dumpfile);
1996 show_expr (i->write);
2000 fputs (" READWRITE=", dumpfile);
2001 show_expr (i->readwrite);
2005 fputs (" DELIM=", dumpfile);
2006 show_expr (i->delim);
2010 fputs (" PAD=", dumpfile);
2015 fputs (" CONVERT=", dumpfile);
2016 show_expr (i->convert);
2018 if (i->asynchronous)
2020 fputs (" ASYNCHRONOUS=", dumpfile);
2021 show_expr (i->asynchronous);
2025 fputs (" DECIMAL=", dumpfile);
2026 show_expr (i->decimal);
2030 fputs (" ENCODING=", dumpfile);
2031 show_expr (i->encoding);
2035 fputs (" PENDING=", dumpfile);
2036 show_expr (i->pending);
2040 fputs (" ROUND=", dumpfile);
2041 show_expr (i->round);
2045 fputs (" SIGN=", dumpfile);
2046 show_expr (i->sign);
2050 fputs (" SIZE=", dumpfile);
2051 show_expr (i->size);
2055 fputs (" ID=", dumpfile);
2060 fprintf (dumpfile, " ERR=%d", i->err->value);
2064 fputs ("IOLENGTH ", dumpfile);
2065 show_expr (c->expr1);
2070 fputs ("READ", dumpfile);
2074 fputs ("WRITE", dumpfile);
2080 fputs (" UNIT=", dumpfile);
2081 show_expr (dt->io_unit);
2084 if (dt->format_expr)
2086 fputs (" FMT=", dumpfile);
2087 show_expr (dt->format_expr);
2090 if (dt->format_label != NULL)
2091 fprintf (dumpfile, " FMT=%d", dt->format_label->value);
2093 fprintf (dumpfile, " NML=%s", dt->namelist->name);
2097 fputs (" IOMSG=", dumpfile);
2098 show_expr (dt->iomsg);
2102 fputs (" IOSTAT=", dumpfile);
2103 show_expr (dt->iostat);
2107 fputs (" SIZE=", dumpfile);
2108 show_expr (dt->size);
2112 fputs (" REC=", dumpfile);
2113 show_expr (dt->rec);
2117 fputs (" ADVANCE=", dumpfile);
2118 show_expr (dt->advance);
2122 fputs (" ID=", dumpfile);
2127 fputs (" POS=", dumpfile);
2128 show_expr (dt->pos);
2130 if (dt->asynchronous)
2132 fputs (" ASYNCHRONOUS=", dumpfile);
2133 show_expr (dt->asynchronous);
2137 fputs (" BLANK=", dumpfile);
2138 show_expr (dt->blank);
2142 fputs (" DECIMAL=", dumpfile);
2143 show_expr (dt->decimal);
2147 fputs (" DELIM=", dumpfile);
2148 show_expr (dt->delim);
2152 fputs (" PAD=", dumpfile);
2153 show_expr (dt->pad);
2157 fputs (" ROUND=", dumpfile);
2158 show_expr (dt->round);
2162 fputs (" SIGN=", dumpfile);
2163 show_expr (dt->sign);
2167 for (c = c->block->next; c; c = c->next)
2168 show_code_node (level + (c->next != NULL), c);
2172 fputs ("TRANSFER ", dumpfile);
2173 show_expr (c->expr1);
2177 fputs ("DT_END", dumpfile);
2180 if (dt->err != NULL)
2181 fprintf (dumpfile, " ERR=%d", dt->err->value);
2182 if (dt->end != NULL)
2183 fprintf (dumpfile, " END=%d", dt->end->value);
2184 if (dt->eor != NULL)
2185 fprintf (dumpfile, " EOR=%d", dt->eor->value);
2188 case EXEC_OMP_ATOMIC:
2189 case EXEC_OMP_BARRIER:
2190 case EXEC_OMP_CRITICAL:
2191 case EXEC_OMP_FLUSH:
2193 case EXEC_OMP_MASTER:
2194 case EXEC_OMP_ORDERED:
2195 case EXEC_OMP_PARALLEL:
2196 case EXEC_OMP_PARALLEL_DO:
2197 case EXEC_OMP_PARALLEL_SECTIONS:
2198 case EXEC_OMP_PARALLEL_WORKSHARE:
2199 case EXEC_OMP_SECTIONS:
2200 case EXEC_OMP_SINGLE:
2202 case EXEC_OMP_TASKWAIT:
2203 case EXEC_OMP_TASKYIELD:
2204 case EXEC_OMP_WORKSHARE:
2205 show_omp_node (level, c);
2209 gfc_internal_error ("show_code_node(): Bad statement code");
2214 /* Show an equivalence chain. */
2217 show_equiv (gfc_equiv *eq)
2220 fputs ("Equivalence: ", dumpfile);
2223 show_expr (eq->expr);
2226 fputs (", ", dumpfile);
2231 /* Show a freakin' whole namespace. */
2234 show_namespace (gfc_namespace *ns)
2236 gfc_interface *intr;
2237 gfc_namespace *save;
2242 save = gfc_current_ns;
2245 fputs ("Namespace:", dumpfile);
2253 while (i < GFC_LETTERS - 1
2254 && gfc_compare_types(&ns->default_type[i+1],
2255 &ns->default_type[l]))
2259 fprintf (dumpfile, " %c-%c: ", l+'A', i+'A');
2261 fprintf (dumpfile, " %c: ", l+'A');
2263 show_typespec(&ns->default_type[l]);
2265 } while (i < GFC_LETTERS);
2267 if (ns->proc_name != NULL)
2270 fprintf (dumpfile, "procedure name = %s", ns->proc_name->name);
2274 gfc_current_ns = ns;
2275 gfc_traverse_symtree (ns->common_root, show_common);
2277 gfc_traverse_symtree (ns->sym_root, show_symtree);
2279 for (op = GFC_INTRINSIC_BEGIN; op != GFC_INTRINSIC_END; op++)
2281 /* User operator interfaces */
2287 fprintf (dumpfile, "Operator interfaces for %s:",
2288 gfc_op2string ((gfc_intrinsic_op) op));
2290 for (; intr; intr = intr->next)
2291 fprintf (dumpfile, " %s", intr->sym->name);
2294 if (ns->uop_root != NULL)
2297 fputs ("User operators:\n", dumpfile);
2298 gfc_traverse_user_op (ns, show_uop);
2304 for (eq = ns->equiv; eq; eq = eq->next)
2307 fputc ('\n', dumpfile);
2309 fputs ("code:", dumpfile);
2310 show_code (show_level, ns->code);
2313 for (ns = ns->contained; ns; ns = ns->sibling)
2315 fputs ("\nCONTAINS\n", dumpfile);
2317 show_namespace (ns);
2321 fputc ('\n', dumpfile);
2322 gfc_current_ns = save;
2326 /* Main function for dumping a parse tree. */
2329 gfc_dump_parse_tree (gfc_namespace *ns, FILE *file)
2332 show_namespace (ns);