2 Copyright (C) 2003-2013 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 3, 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 COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
22 /* Actually this is just a collection of routines that used to be
23 scattered around the sources. Now that they are all in a single
24 file, almost all of them can be static, and the other files don't
25 have this mess in them.
27 As a nice side-effect, this file can act as documentation of the
28 gfc_code and gfc_expr structures and all their friends and
35 #include "coretypes.h"
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 if (ts
->type
== BT_ASSUMED
)
99 fputs ("(TYPE(*))", dumpfile
);
103 fprintf (dumpfile
, "(%s ", gfc_basic_typename (ts
->type
));
109 fprintf (dumpfile
, "%s", ts
->u
.derived
->name
);
113 show_expr (ts
->u
.cl
->length
);
114 fprintf(dumpfile
, " %d", ts
->kind
);
118 fprintf (dumpfile
, "%d", ts
->kind
);
122 fputc (')', dumpfile
);
126 /* Show an actual argument list. */
129 show_actual_arglist (gfc_actual_arglist
*a
)
131 fputc ('(', dumpfile
);
133 for (; a
; a
= a
->next
)
135 fputc ('(', dumpfile
);
137 fprintf (dumpfile
, "%s = ", a
->name
);
141 fputs ("(arg not-present)", dumpfile
);
143 fputc (')', dumpfile
);
145 fputc (' ', dumpfile
);
148 fputc (')', dumpfile
);
152 /* Show a gfc_array_spec array specification structure. */
155 show_array_spec (gfc_array_spec
*as
)
162 fputs ("()", dumpfile
);
166 fprintf (dumpfile
, "(%d [%d]", as
->rank
, as
->corank
);
168 if (as
->rank
+ as
->corank
> 0 || as
->rank
== -1)
172 case AS_EXPLICIT
: c
= "AS_EXPLICIT"; break;
173 case AS_DEFERRED
: c
= "AS_DEFERRED"; break;
174 case AS_ASSUMED_SIZE
: c
= "AS_ASSUMED_SIZE"; break;
175 case AS_ASSUMED_SHAPE
: c
= "AS_ASSUMED_SHAPE"; break;
176 case AS_ASSUMED_RANK
: c
= "AS_ASSUMED_RANK"; break;
178 gfc_internal_error ("show_array_spec(): Unhandled array shape "
181 fprintf (dumpfile
, " %s ", c
);
183 for (i
= 0; i
< as
->rank
+ as
->corank
; i
++)
185 show_expr (as
->lower
[i
]);
186 fputc (' ', dumpfile
);
187 show_expr (as
->upper
[i
]);
188 fputc (' ', dumpfile
);
192 fputc (')', dumpfile
);
196 /* Show a gfc_array_ref array reference structure. */
199 show_array_ref (gfc_array_ref
* ar
)
203 fputc ('(', dumpfile
);
208 fputs ("FULL", dumpfile
);
212 for (i
= 0; i
< ar
->dimen
; i
++)
214 /* There are two types of array sections: either the
215 elements are identified by an integer array ('vector'),
216 or by an index range. In the former case we only have to
217 print the start expression which contains the vector, in
218 the latter case we have to print any of lower and upper
219 bound and the stride, if they're present. */
221 if (ar
->start
[i
] != NULL
)
222 show_expr (ar
->start
[i
]);
224 if (ar
->dimen_type
[i
] == DIMEN_RANGE
)
226 fputc (':', dumpfile
);
228 if (ar
->end
[i
] != NULL
)
229 show_expr (ar
->end
[i
]);
231 if (ar
->stride
[i
] != NULL
)
233 fputc (':', dumpfile
);
234 show_expr (ar
->stride
[i
]);
238 if (i
!= ar
->dimen
- 1)
239 fputs (" , ", dumpfile
);
244 for (i
= 0; i
< ar
->dimen
; i
++)
246 show_expr (ar
->start
[i
]);
247 if (i
!= ar
->dimen
- 1)
248 fputs (" , ", dumpfile
);
253 fputs ("UNKNOWN", dumpfile
);
257 gfc_internal_error ("show_array_ref(): Unknown array reference");
260 fputc (')', dumpfile
);
264 /* Show a list of gfc_ref structures. */
267 show_ref (gfc_ref
*p
)
269 for (; p
; p
= p
->next
)
273 show_array_ref (&p
->u
.ar
);
277 fprintf (dumpfile
, " %% %s", p
->u
.c
.component
->name
);
281 fputc ('(', dumpfile
);
282 show_expr (p
->u
.ss
.start
);
283 fputc (':', dumpfile
);
284 show_expr (p
->u
.ss
.end
);
285 fputc (')', dumpfile
);
289 gfc_internal_error ("show_ref(): Bad component code");
294 /* Display a constructor. Works recursively for array constructors. */
297 show_constructor (gfc_constructor_base base
)
300 for (c
= gfc_constructor_first (base
); c
; c
= gfc_constructor_next (c
))
302 if (c
->iterator
== NULL
)
306 fputc ('(', dumpfile
);
309 fputc (' ', dumpfile
);
310 show_expr (c
->iterator
->var
);
311 fputc ('=', dumpfile
);
312 show_expr (c
->iterator
->start
);
313 fputc (',', dumpfile
);
314 show_expr (c
->iterator
->end
);
315 fputc (',', dumpfile
);
316 show_expr (c
->iterator
->step
);
318 fputc (')', dumpfile
);
321 if (gfc_constructor_next (c
) != NULL
)
322 fputs (" , ", dumpfile
);
328 show_char_const (const gfc_char_t
*c
, int length
)
332 fputc ('\'', dumpfile
);
333 for (i
= 0; i
< length
; i
++)
336 fputs ("''", dumpfile
);
338 fputs (gfc_print_wide_char (c
[i
]), dumpfile
);
340 fputc ('\'', dumpfile
);
344 /* Show a component-call expression. */
347 show_compcall (gfc_expr
* p
)
349 gcc_assert (p
->expr_type
== EXPR_COMPCALL
);
351 fprintf (dumpfile
, "%s", p
->symtree
->n
.sym
->name
);
353 fprintf (dumpfile
, "%s", p
->value
.compcall
.name
);
355 show_actual_arglist (p
->value
.compcall
.actual
);
359 /* Show an expression. */
362 show_expr (gfc_expr
*p
)
369 fputs ("()", dumpfile
);
373 switch (p
->expr_type
)
376 show_char_const (p
->value
.character
.string
, p
->value
.character
.length
);
381 fprintf (dumpfile
, "%s(", p
->ts
.u
.derived
->name
);
382 show_constructor (p
->value
.constructor
);
383 fputc (')', dumpfile
);
387 fputs ("(/ ", dumpfile
);
388 show_constructor (p
->value
.constructor
);
389 fputs (" /)", dumpfile
);
395 fputs ("NULL()", dumpfile
);
402 mpz_out_str (stdout
, 10, p
->value
.integer
);
404 if (p
->ts
.kind
!= gfc_default_integer_kind
)
405 fprintf (dumpfile
, "_%d", p
->ts
.kind
);
409 if (p
->value
.logical
)
410 fputs (".true.", dumpfile
);
412 fputs (".false.", dumpfile
);
416 mpfr_out_str (stdout
, 10, 0, p
->value
.real
, GFC_RND_MODE
);
417 if (p
->ts
.kind
!= gfc_default_real_kind
)
418 fprintf (dumpfile
, "_%d", p
->ts
.kind
);
422 show_char_const (p
->value
.character
.string
,
423 p
->value
.character
.length
);
427 fputs ("(complex ", dumpfile
);
429 mpfr_out_str (stdout
, 10, 0, mpc_realref (p
->value
.complex),
431 if (p
->ts
.kind
!= gfc_default_complex_kind
)
432 fprintf (dumpfile
, "_%d", p
->ts
.kind
);
434 fputc (' ', dumpfile
);
436 mpfr_out_str (stdout
, 10, 0, mpc_imagref (p
->value
.complex),
438 if (p
->ts
.kind
!= gfc_default_complex_kind
)
439 fprintf (dumpfile
, "_%d", p
->ts
.kind
);
441 fputc (')', dumpfile
);
445 fprintf (dumpfile
, "%dH", p
->representation
.length
);
446 c
= p
->representation
.string
;
447 for (i
= 0; i
< p
->representation
.length
; i
++, c
++)
449 fputc (*c
, dumpfile
);
454 fputs ("???", dumpfile
);
458 if (p
->representation
.string
)
460 fputs (" {", dumpfile
);
461 c
= p
->representation
.string
;
462 for (i
= 0; i
< p
->representation
.length
; i
++, c
++)
464 fprintf (dumpfile
, "%.2x", (unsigned int) *c
);
465 if (i
< p
->representation
.length
- 1)
466 fputc (',', dumpfile
);
468 fputc ('}', dumpfile
);
474 if (p
->symtree
->n
.sym
->ns
&& p
->symtree
->n
.sym
->ns
->proc_name
)
475 fprintf (dumpfile
, "%s:", p
->symtree
->n
.sym
->ns
->proc_name
->name
);
476 fprintf (dumpfile
, "%s", p
->symtree
->n
.sym
->name
);
481 fputc ('(', dumpfile
);
482 switch (p
->value
.op
.op
)
484 case INTRINSIC_UPLUS
:
485 fputs ("U+ ", dumpfile
);
487 case INTRINSIC_UMINUS
:
488 fputs ("U- ", dumpfile
);
491 fputs ("+ ", dumpfile
);
493 case INTRINSIC_MINUS
:
494 fputs ("- ", dumpfile
);
496 case INTRINSIC_TIMES
:
497 fputs ("* ", dumpfile
);
499 case INTRINSIC_DIVIDE
:
500 fputs ("/ ", dumpfile
);
502 case INTRINSIC_POWER
:
503 fputs ("** ", dumpfile
);
505 case INTRINSIC_CONCAT
:
506 fputs ("// ", dumpfile
);
509 fputs ("AND ", dumpfile
);
512 fputs ("OR ", dumpfile
);
515 fputs ("EQV ", dumpfile
);
518 fputs ("NEQV ", dumpfile
);
521 case INTRINSIC_EQ_OS
:
522 fputs ("= ", dumpfile
);
525 case INTRINSIC_NE_OS
:
526 fputs ("/= ", dumpfile
);
529 case INTRINSIC_GT_OS
:
530 fputs ("> ", dumpfile
);
533 case INTRINSIC_GE_OS
:
534 fputs (">= ", dumpfile
);
537 case INTRINSIC_LT_OS
:
538 fputs ("< ", dumpfile
);
541 case INTRINSIC_LE_OS
:
542 fputs ("<= ", dumpfile
);
545 fputs ("NOT ", dumpfile
);
547 case INTRINSIC_PARENTHESES
:
548 fputs ("parens ", dumpfile
);
553 ("show_expr(): Bad intrinsic in expression!");
556 show_expr (p
->value
.op
.op1
);
560 fputc (' ', dumpfile
);
561 show_expr (p
->value
.op
.op2
);
564 fputc (')', dumpfile
);
568 if (p
->value
.function
.name
== NULL
)
570 fprintf (dumpfile
, "%s", p
->symtree
->n
.sym
->name
);
571 if (gfc_is_proc_ptr_comp (p
))
573 fputc ('[', dumpfile
);
574 show_actual_arglist (p
->value
.function
.actual
);
575 fputc (']', dumpfile
);
579 fprintf (dumpfile
, "%s", p
->value
.function
.name
);
580 if (gfc_is_proc_ptr_comp (p
))
582 fputc ('[', dumpfile
);
583 fputc ('[', dumpfile
);
584 show_actual_arglist (p
->value
.function
.actual
);
585 fputc (']', dumpfile
);
586 fputc (']', dumpfile
);
596 gfc_internal_error ("show_expr(): Don't know how to show expr");
600 /* Show symbol attributes. The flavor and intent are followed by
601 whatever single bit attributes are present. */
604 show_attr (symbol_attribute
*attr
, const char * module
)
606 if (attr
->flavor
!= FL_UNKNOWN
)
607 fprintf (dumpfile
, "(%s ", gfc_code2string (flavors
, attr
->flavor
));
608 if (attr
->access
!= ACCESS_UNKNOWN
)
609 fprintf (dumpfile
, "%s ", gfc_code2string (access_types
, attr
->access
));
610 if (attr
->proc
!= PROC_UNKNOWN
)
611 fprintf (dumpfile
, "%s ", gfc_code2string (procedures
, attr
->proc
));
612 if (attr
->save
!= SAVE_NONE
)
613 fprintf (dumpfile
, "%s", gfc_code2string (save_status
, attr
->save
));
615 if (attr
->artificial
)
616 fputs (" ARTIFICIAL", dumpfile
);
617 if (attr
->allocatable
)
618 fputs (" ALLOCATABLE", dumpfile
);
619 if (attr
->asynchronous
)
620 fputs (" ASYNCHRONOUS", dumpfile
);
621 if (attr
->codimension
)
622 fputs (" CODIMENSION", dumpfile
);
624 fputs (" DIMENSION", dumpfile
);
625 if (attr
->contiguous
)
626 fputs (" CONTIGUOUS", dumpfile
);
628 fputs (" EXTERNAL", dumpfile
);
630 fputs (" INTRINSIC", dumpfile
);
632 fputs (" OPTIONAL", dumpfile
);
634 fputs (" POINTER", dumpfile
);
635 if (attr
->is_protected
)
636 fputs (" PROTECTED", dumpfile
);
638 fputs (" VALUE", dumpfile
);
640 fputs (" VOLATILE", dumpfile
);
641 if (attr
->threadprivate
)
642 fputs (" THREADPRIVATE", dumpfile
);
644 fputs (" TARGET", dumpfile
);
647 fputs (" DUMMY", dumpfile
);
648 if (attr
->intent
!= INTENT_UNKNOWN
)
649 fprintf (dumpfile
, "(%s)", gfc_intent_string (attr
->intent
));
653 fputs (" RESULT", dumpfile
);
655 fputs (" ENTRY", dumpfile
);
657 fputs (" BIND(C)", dumpfile
);
660 fputs (" DATA", dumpfile
);
663 fputs (" USE-ASSOC", dumpfile
);
665 fprintf (dumpfile
, "(%s)", module
);
668 if (attr
->in_namelist
)
669 fputs (" IN-NAMELIST", dumpfile
);
671 fputs (" IN-COMMON", dumpfile
);
674 fputs (" ABSTRACT", dumpfile
);
676 fputs (" FUNCTION", dumpfile
);
677 if (attr
->subroutine
)
678 fputs (" SUBROUTINE", dumpfile
);
679 if (attr
->implicit_type
)
680 fputs (" IMPLICIT-TYPE", dumpfile
);
683 fputs (" SEQUENCE", dumpfile
);
685 fputs (" ELEMENTAL", dumpfile
);
687 fputs (" PURE", dumpfile
);
689 fputs (" RECURSIVE", dumpfile
);
691 fputc (')', dumpfile
);
695 /* Show components of a derived type. */
698 show_components (gfc_symbol
*sym
)
702 for (c
= sym
->components
; c
; c
= c
->next
)
704 fprintf (dumpfile
, "(%s ", c
->name
);
705 show_typespec (&c
->ts
);
706 if (c
->attr
.allocatable
)
707 fputs (" ALLOCATABLE", dumpfile
);
709 fputs (" POINTER", dumpfile
);
710 if (c
->attr
.proc_pointer
)
711 fputs (" PPC", dumpfile
);
712 if (c
->attr
.dimension
)
713 fputs (" DIMENSION", dumpfile
);
714 fputc (' ', dumpfile
);
715 show_array_spec (c
->as
);
717 fprintf (dumpfile
, " %s", gfc_code2string (access_types
, c
->attr
.access
));
718 fputc (')', dumpfile
);
720 fputc (' ', dumpfile
);
725 /* Show the f2k_derived namespace with procedure bindings. */
728 show_typebound_proc (gfc_typebound_proc
* tb
, const char* name
)
733 fputs ("GENERIC", dumpfile
);
736 fputs ("PROCEDURE, ", dumpfile
);
738 fputs ("NOPASS", dumpfile
);
742 fprintf (dumpfile
, "PASS(%s)", tb
->pass_arg
);
744 fputs ("PASS", dumpfile
);
746 if (tb
->non_overridable
)
747 fputs (", NON_OVERRIDABLE", dumpfile
);
750 if (tb
->access
== ACCESS_PUBLIC
)
751 fputs (", PUBLIC", dumpfile
);
753 fputs (", PRIVATE", dumpfile
);
755 fprintf (dumpfile
, " :: %s => ", name
);
760 for (g
= tb
->u
.generic
; g
; g
= g
->next
)
762 fputs (g
->specific_st
->name
, dumpfile
);
764 fputs (", ", dumpfile
);
768 fputs (tb
->u
.specific
->n
.sym
->name
, dumpfile
);
772 show_typebound_symtree (gfc_symtree
* st
)
774 gcc_assert (st
->n
.tb
);
775 show_typebound_proc (st
->n
.tb
, st
->name
);
779 show_f2k_derived (gfc_namespace
* f2k
)
785 fputs ("Procedure bindings:", dumpfile
);
788 /* Finalizer bindings. */
789 for (f
= f2k
->finalizers
; f
; f
= f
->next
)
792 fprintf (dumpfile
, "FINAL %s", f
->proc_tree
->n
.sym
->name
);
795 /* Type-bound procedures. */
796 gfc_traverse_symtree (f2k
->tb_sym_root
, &show_typebound_symtree
);
801 fputs ("Operator bindings:", dumpfile
);
804 /* User-defined operators. */
805 gfc_traverse_symtree (f2k
->tb_uop_root
, &show_typebound_symtree
);
807 /* Intrinsic operators. */
808 for (op
= GFC_INTRINSIC_BEGIN
; op
!= GFC_INTRINSIC_END
; ++op
)
810 show_typebound_proc (f2k
->tb_op
[op
],
811 gfc_op2string ((gfc_intrinsic_op
) op
));
817 /* Show a symbol. If a symbol is an ENTRY, SUBROUTINE or FUNCTION, we
818 show the interface. Information needed to reconstruct the list of
819 specific interfaces associated with a generic symbol is done within
823 show_symbol (gfc_symbol
*sym
)
825 gfc_formal_arglist
*formal
;
832 fprintf (dumpfile
, "|| symbol: '%s' ", sym
->name
);
833 len
= strlen (sym
->name
);
834 for (i
=len
; i
<12; i
++)
835 fputc(' ', dumpfile
);
840 fputs ("type spec : ", dumpfile
);
841 show_typespec (&sym
->ts
);
844 fputs ("attributes: ", dumpfile
);
845 show_attr (&sym
->attr
, sym
->module
);
850 fputs ("value: ", dumpfile
);
851 show_expr (sym
->value
);
857 fputs ("Array spec:", dumpfile
);
858 show_array_spec (sym
->as
);
864 fputs ("Generic interfaces:", dumpfile
);
865 for (intr
= sym
->generic
; intr
; intr
= intr
->next
)
866 fprintf (dumpfile
, " %s", intr
->sym
->name
);
872 fprintf (dumpfile
, "result: %s", sym
->result
->name
);
878 fputs ("components: ", dumpfile
);
879 show_components (sym
);
882 if (sym
->f2k_derived
)
886 fprintf (dumpfile
, "hash: %d", sym
->hash_value
);
887 show_f2k_derived (sym
->f2k_derived
);
893 fputs ("Formal arglist:", dumpfile
);
895 for (formal
= sym
->formal
; formal
; formal
= formal
->next
)
897 if (formal
->sym
!= NULL
)
898 fprintf (dumpfile
, " %s", formal
->sym
->name
);
900 fputs (" [Alt Return]", dumpfile
);
904 if (sym
->formal_ns
&& (sym
->formal_ns
->proc_name
!= sym
)
905 && sym
->attr
.proc
!= PROC_ST_FUNCTION
909 fputs ("Formal namespace", dumpfile
);
910 show_namespace (sym
->formal_ns
);
916 /* Show a user-defined operator. Just prints an operator
917 and the name of the associated subroutine, really. */
920 show_uop (gfc_user_op
*uop
)
925 fprintf (dumpfile
, "%s:", uop
->name
);
927 for (intr
= uop
->op
; intr
; intr
= intr
->next
)
928 fprintf (dumpfile
, " %s", intr
->sym
->name
);
932 /* Workhorse function for traversing the user operator symtree. */
935 traverse_uop (gfc_symtree
*st
, void (*func
) (gfc_user_op
*))
942 traverse_uop (st
->left
, func
);
943 traverse_uop (st
->right
, func
);
947 /* Traverse the tree of user operator nodes. */
950 gfc_traverse_user_op (gfc_namespace
*ns
, void (*func
) (gfc_user_op
*))
952 traverse_uop (ns
->uop_root
, func
);
956 /* Function to display a common block. */
959 show_common (gfc_symtree
*st
)
964 fprintf (dumpfile
, "common: /%s/ ", st
->name
);
966 s
= st
->n
.common
->head
;
969 fprintf (dumpfile
, "%s", s
->name
);
972 fputs (", ", dumpfile
);
974 fputc ('\n', dumpfile
);
978 /* Worker function to display the symbol tree. */
981 show_symtree (gfc_symtree
*st
)
987 len
= strlen(st
->name
);
988 fprintf (dumpfile
, "symtree: '%s'", st
->name
);
990 for (i
=len
; i
<12; i
++)
991 fputc(' ', dumpfile
);
994 fputs( " Ambiguous", dumpfile
);
996 if (st
->n
.sym
->ns
!= gfc_current_ns
)
997 fprintf (dumpfile
, "|| symbol: '%s' from namespace '%s'", st
->n
.sym
->name
,
998 st
->n
.sym
->ns
->proc_name
->name
);
1000 show_symbol (st
->n
.sym
);
1004 /******************* Show gfc_code structures **************/
1007 /* Show a list of code structures. Mutually recursive with
1008 show_code_node(). */
1011 show_code (int level
, gfc_code
*c
)
1013 for (; c
; c
= c
->next
)
1014 show_code_node (level
, c
);
1018 show_namelist (gfc_namelist
*n
)
1020 for (; n
->next
; n
= n
->next
)
1021 fprintf (dumpfile
, "%s,", n
->sym
->name
);
1022 fprintf (dumpfile
, "%s", n
->sym
->name
);
1025 /* Show a single OpenMP directive node and everything underneath it
1029 show_omp_node (int level
, gfc_code
*c
)
1031 gfc_omp_clauses
*omp_clauses
= NULL
;
1032 const char *name
= NULL
;
1036 case EXEC_OMP_ATOMIC
: name
= "ATOMIC"; break;
1037 case EXEC_OMP_BARRIER
: name
= "BARRIER"; break;
1038 case EXEC_OMP_CRITICAL
: name
= "CRITICAL"; break;
1039 case EXEC_OMP_FLUSH
: name
= "FLUSH"; break;
1040 case EXEC_OMP_DO
: name
= "DO"; break;
1041 case EXEC_OMP_MASTER
: name
= "MASTER"; break;
1042 case EXEC_OMP_ORDERED
: name
= "ORDERED"; break;
1043 case EXEC_OMP_PARALLEL
: name
= "PARALLEL"; break;
1044 case EXEC_OMP_PARALLEL_DO
: name
= "PARALLEL DO"; break;
1045 case EXEC_OMP_PARALLEL_SECTIONS
: name
= "PARALLEL SECTIONS"; break;
1046 case EXEC_OMP_PARALLEL_WORKSHARE
: name
= "PARALLEL WORKSHARE"; break;
1047 case EXEC_OMP_SECTIONS
: name
= "SECTIONS"; break;
1048 case EXEC_OMP_SINGLE
: name
= "SINGLE"; break;
1049 case EXEC_OMP_TASK
: name
= "TASK"; break;
1050 case EXEC_OMP_TASKWAIT
: name
= "TASKWAIT"; break;
1051 case EXEC_OMP_TASKYIELD
: name
= "TASKYIELD"; break;
1052 case EXEC_OMP_WORKSHARE
: name
= "WORKSHARE"; break;
1056 fprintf (dumpfile
, "!$OMP %s", name
);
1060 case EXEC_OMP_PARALLEL
:
1061 case EXEC_OMP_PARALLEL_DO
:
1062 case EXEC_OMP_PARALLEL_SECTIONS
:
1063 case EXEC_OMP_SECTIONS
:
1064 case EXEC_OMP_SINGLE
:
1065 case EXEC_OMP_WORKSHARE
:
1066 case EXEC_OMP_PARALLEL_WORKSHARE
:
1068 omp_clauses
= c
->ext
.omp_clauses
;
1070 case EXEC_OMP_CRITICAL
:
1071 if (c
->ext
.omp_name
)
1072 fprintf (dumpfile
, " (%s)", c
->ext
.omp_name
);
1074 case EXEC_OMP_FLUSH
:
1075 if (c
->ext
.omp_namelist
)
1077 fputs (" (", dumpfile
);
1078 show_namelist (c
->ext
.omp_namelist
);
1079 fputc (')', dumpfile
);
1082 case EXEC_OMP_BARRIER
:
1083 case EXEC_OMP_TASKWAIT
:
1084 case EXEC_OMP_TASKYIELD
:
1093 if (omp_clauses
->if_expr
)
1095 fputs (" IF(", dumpfile
);
1096 show_expr (omp_clauses
->if_expr
);
1097 fputc (')', dumpfile
);
1099 if (omp_clauses
->final_expr
)
1101 fputs (" FINAL(", dumpfile
);
1102 show_expr (omp_clauses
->final_expr
);
1103 fputc (')', dumpfile
);
1105 if (omp_clauses
->num_threads
)
1107 fputs (" NUM_THREADS(", dumpfile
);
1108 show_expr (omp_clauses
->num_threads
);
1109 fputc (')', dumpfile
);
1111 if (omp_clauses
->sched_kind
!= OMP_SCHED_NONE
)
1114 switch (omp_clauses
->sched_kind
)
1116 case OMP_SCHED_STATIC
: type
= "STATIC"; break;
1117 case OMP_SCHED_DYNAMIC
: type
= "DYNAMIC"; break;
1118 case OMP_SCHED_GUIDED
: type
= "GUIDED"; break;
1119 case OMP_SCHED_RUNTIME
: type
= "RUNTIME"; break;
1120 case OMP_SCHED_AUTO
: type
= "AUTO"; break;
1124 fprintf (dumpfile
, " SCHEDULE (%s", type
);
1125 if (omp_clauses
->chunk_size
)
1127 fputc (',', dumpfile
);
1128 show_expr (omp_clauses
->chunk_size
);
1130 fputc (')', dumpfile
);
1132 if (omp_clauses
->default_sharing
!= OMP_DEFAULT_UNKNOWN
)
1135 switch (omp_clauses
->default_sharing
)
1137 case OMP_DEFAULT_NONE
: type
= "NONE"; break;
1138 case OMP_DEFAULT_PRIVATE
: type
= "PRIVATE"; break;
1139 case OMP_DEFAULT_SHARED
: type
= "SHARED"; break;
1140 case OMP_DEFAULT_FIRSTPRIVATE
: type
= "FIRSTPRIVATE"; break;
1144 fprintf (dumpfile
, " DEFAULT(%s)", type
);
1146 if (omp_clauses
->ordered
)
1147 fputs (" ORDERED", dumpfile
);
1148 if (omp_clauses
->untied
)
1149 fputs (" UNTIED", dumpfile
);
1150 if (omp_clauses
->mergeable
)
1151 fputs (" MERGEABLE", dumpfile
);
1152 if (omp_clauses
->collapse
)
1153 fprintf (dumpfile
, " COLLAPSE(%d)", omp_clauses
->collapse
);
1154 for (list_type
= 0; list_type
< OMP_LIST_NUM
; list_type
++)
1155 if (omp_clauses
->lists
[list_type
] != NULL
1156 && list_type
!= OMP_LIST_COPYPRIVATE
)
1159 if (list_type
>= OMP_LIST_REDUCTION_FIRST
)
1163 case OMP_LIST_PLUS
: type
= "+"; break;
1164 case OMP_LIST_MULT
: type
= "*"; break;
1165 case OMP_LIST_SUB
: type
= "-"; break;
1166 case OMP_LIST_AND
: type
= ".AND."; break;
1167 case OMP_LIST_OR
: type
= ".OR."; break;
1168 case OMP_LIST_EQV
: type
= ".EQV."; break;
1169 case OMP_LIST_NEQV
: type
= ".NEQV."; break;
1170 case OMP_LIST_MAX
: type
= "MAX"; break;
1171 case OMP_LIST_MIN
: type
= "MIN"; break;
1172 case OMP_LIST_IAND
: type
= "IAND"; break;
1173 case OMP_LIST_IOR
: type
= "IOR"; break;
1174 case OMP_LIST_IEOR
: type
= "IEOR"; break;
1178 fprintf (dumpfile
, " REDUCTION(%s:", type
);
1184 case OMP_LIST_PRIVATE
: type
= "PRIVATE"; break;
1185 case OMP_LIST_FIRSTPRIVATE
: type
= "FIRSTPRIVATE"; break;
1186 case OMP_LIST_LASTPRIVATE
: type
= "LASTPRIVATE"; break;
1187 case OMP_LIST_SHARED
: type
= "SHARED"; break;
1188 case OMP_LIST_COPYIN
: type
= "COPYIN"; break;
1192 fprintf (dumpfile
, " %s(", type
);
1194 show_namelist (omp_clauses
->lists
[list_type
]);
1195 fputc (')', dumpfile
);
1198 fputc ('\n', dumpfile
);
1199 if (c
->op
== EXEC_OMP_SECTIONS
|| c
->op
== EXEC_OMP_PARALLEL_SECTIONS
)
1201 gfc_code
*d
= c
->block
;
1204 show_code (level
+ 1, d
->next
);
1205 if (d
->block
== NULL
)
1207 code_indent (level
, 0);
1208 fputs ("!$OMP SECTION\n", dumpfile
);
1213 show_code (level
+ 1, c
->block
->next
);
1214 if (c
->op
== EXEC_OMP_ATOMIC
)
1216 code_indent (level
, 0);
1217 fprintf (dumpfile
, "!$OMP END %s", name
);
1218 if (omp_clauses
!= NULL
)
1220 if (omp_clauses
->lists
[OMP_LIST_COPYPRIVATE
])
1222 fputs (" COPYPRIVATE(", dumpfile
);
1223 show_namelist (omp_clauses
->lists
[OMP_LIST_COPYPRIVATE
]);
1224 fputc (')', dumpfile
);
1226 else if (omp_clauses
->nowait
)
1227 fputs (" NOWAIT", dumpfile
);
1229 else if (c
->op
== EXEC_OMP_CRITICAL
&& c
->ext
.omp_name
)
1230 fprintf (dumpfile
, " (%s)", c
->ext
.omp_name
);
1234 /* Show a single code node and everything underneath it if necessary. */
1237 show_code_node (int level
, gfc_code
*c
)
1239 gfc_forall_iterator
*fa
;
1252 fputc ('\n', dumpfile
);
1253 code_indent (level
, c
->here
);
1260 case EXEC_END_PROCEDURE
:
1264 fputs ("NOP", dumpfile
);
1268 fputs ("CONTINUE", dumpfile
);
1272 fprintf (dumpfile
, "ENTRY %s", c
->ext
.entry
->sym
->name
);
1275 case EXEC_INIT_ASSIGN
:
1277 fputs ("ASSIGN ", dumpfile
);
1278 show_expr (c
->expr1
);
1279 fputc (' ', dumpfile
);
1280 show_expr (c
->expr2
);
1283 case EXEC_LABEL_ASSIGN
:
1284 fputs ("LABEL ASSIGN ", dumpfile
);
1285 show_expr (c
->expr1
);
1286 fprintf (dumpfile
, " %d", c
->label1
->value
);
1289 case EXEC_POINTER_ASSIGN
:
1290 fputs ("POINTER ASSIGN ", dumpfile
);
1291 show_expr (c
->expr1
);
1292 fputc (' ', dumpfile
);
1293 show_expr (c
->expr2
);
1297 fputs ("GOTO ", dumpfile
);
1299 fprintf (dumpfile
, "%d", c
->label1
->value
);
1302 show_expr (c
->expr1
);
1306 fputs (", (", dumpfile
);
1307 for (; d
; d
= d
->block
)
1309 code_indent (level
, d
->label1
);
1310 if (d
->block
!= NULL
)
1311 fputc (',', dumpfile
);
1313 fputc (')', dumpfile
);
1320 case EXEC_ASSIGN_CALL
:
1321 if (c
->resolved_sym
)
1322 fprintf (dumpfile
, "CALL %s ", c
->resolved_sym
->name
);
1323 else if (c
->symtree
)
1324 fprintf (dumpfile
, "CALL %s ", c
->symtree
->name
);
1326 fputs ("CALL ?? ", dumpfile
);
1328 show_actual_arglist (c
->ext
.actual
);
1332 fputs ("CALL ", dumpfile
);
1333 show_compcall (c
->expr1
);
1337 fputs ("CALL ", dumpfile
);
1338 show_expr (c
->expr1
);
1339 show_actual_arglist (c
->ext
.actual
);
1343 fputs ("RETURN ", dumpfile
);
1345 show_expr (c
->expr1
);
1349 fputs ("PAUSE ", dumpfile
);
1351 if (c
->expr1
!= NULL
)
1352 show_expr (c
->expr1
);
1354 fprintf (dumpfile
, "%d", c
->ext
.stop_code
);
1358 case EXEC_ERROR_STOP
:
1359 fputs ("ERROR ", dumpfile
);
1363 fputs ("STOP ", dumpfile
);
1365 if (c
->expr1
!= NULL
)
1366 show_expr (c
->expr1
);
1368 fprintf (dumpfile
, "%d", c
->ext
.stop_code
);
1373 fputs ("SYNC ALL ", dumpfile
);
1374 if (c
->expr2
!= NULL
)
1376 fputs (" stat=", dumpfile
);
1377 show_expr (c
->expr2
);
1379 if (c
->expr3
!= NULL
)
1381 fputs (" errmsg=", dumpfile
);
1382 show_expr (c
->expr3
);
1386 case EXEC_SYNC_MEMORY
:
1387 fputs ("SYNC MEMORY ", dumpfile
);
1388 if (c
->expr2
!= NULL
)
1390 fputs (" stat=", dumpfile
);
1391 show_expr (c
->expr2
);
1393 if (c
->expr3
!= NULL
)
1395 fputs (" errmsg=", dumpfile
);
1396 show_expr (c
->expr3
);
1400 case EXEC_SYNC_IMAGES
:
1401 fputs ("SYNC IMAGES image-set=", dumpfile
);
1402 if (c
->expr1
!= NULL
)
1403 show_expr (c
->expr1
);
1405 fputs ("* ", dumpfile
);
1406 if (c
->expr2
!= NULL
)
1408 fputs (" stat=", dumpfile
);
1409 show_expr (c
->expr2
);
1411 if (c
->expr3
!= NULL
)
1413 fputs (" errmsg=", dumpfile
);
1414 show_expr (c
->expr3
);
1420 if (c
->op
== EXEC_LOCK
)
1421 fputs ("LOCK ", dumpfile
);
1423 fputs ("UNLOCK ", dumpfile
);
1425 fputs ("lock-variable=", dumpfile
);
1426 if (c
->expr1
!= NULL
)
1427 show_expr (c
->expr1
);
1428 if (c
->expr4
!= NULL
)
1430 fputs (" acquired_lock=", dumpfile
);
1431 show_expr (c
->expr4
);
1433 if (c
->expr2
!= NULL
)
1435 fputs (" stat=", dumpfile
);
1436 show_expr (c
->expr2
);
1438 if (c
->expr3
!= NULL
)
1440 fputs (" errmsg=", dumpfile
);
1441 show_expr (c
->expr3
);
1445 case EXEC_ARITHMETIC_IF
:
1446 fputs ("IF ", dumpfile
);
1447 show_expr (c
->expr1
);
1448 fprintf (dumpfile
, " %d, %d, %d",
1449 c
->label1
->value
, c
->label2
->value
, c
->label3
->value
);
1454 fputs ("IF ", dumpfile
);
1455 show_expr (d
->expr1
);
1458 show_code (level
+ 1, d
->next
);
1462 for (; d
; d
= d
->block
)
1464 code_indent (level
, 0);
1466 if (d
->expr1
== NULL
)
1467 fputs ("ELSE", dumpfile
);
1470 fputs ("ELSE IF ", dumpfile
);
1471 show_expr (d
->expr1
);
1475 show_code (level
+ 1, d
->next
);
1480 code_indent (level
, c
->label1
);
1484 fputs ("ENDIF", dumpfile
);
1489 const char* blocktype
;
1490 gfc_namespace
*saved_ns
;
1492 if (c
->ext
.block
.assoc
)
1493 blocktype
= "ASSOCIATE";
1495 blocktype
= "BLOCK";
1497 fprintf (dumpfile
, "%s ", blocktype
);
1499 ns
= c
->ext
.block
.ns
;
1500 saved_ns
= gfc_current_ns
;
1501 gfc_current_ns
= ns
;
1502 gfc_traverse_symtree (ns
->sym_root
, show_symtree
);
1503 gfc_current_ns
= saved_ns
;
1504 show_code (show_level
, ns
->code
);
1507 fprintf (dumpfile
, "END %s ", blocktype
);
1513 fputs ("SELECT CASE ", dumpfile
);
1514 show_expr (c
->expr1
);
1515 fputc ('\n', dumpfile
);
1517 for (; d
; d
= d
->block
)
1519 code_indent (level
, 0);
1521 fputs ("CASE ", dumpfile
);
1522 for (cp
= d
->ext
.block
.case_list
; cp
; cp
= cp
->next
)
1524 fputc ('(', dumpfile
);
1525 show_expr (cp
->low
);
1526 fputc (' ', dumpfile
);
1527 show_expr (cp
->high
);
1528 fputc (')', dumpfile
);
1529 fputc (' ', dumpfile
);
1531 fputc ('\n', dumpfile
);
1533 show_code (level
+ 1, d
->next
);
1536 code_indent (level
, c
->label1
);
1537 fputs ("END SELECT", dumpfile
);
1541 fputs ("WHERE ", dumpfile
);
1544 show_expr (d
->expr1
);
1545 fputc ('\n', dumpfile
);
1547 show_code (level
+ 1, d
->next
);
1549 for (d
= d
->block
; d
; d
= d
->block
)
1551 code_indent (level
, 0);
1552 fputs ("ELSE WHERE ", dumpfile
);
1553 show_expr (d
->expr1
);
1554 fputc ('\n', dumpfile
);
1555 show_code (level
+ 1, d
->next
);
1558 code_indent (level
, 0);
1559 fputs ("END WHERE", dumpfile
);
1564 fputs ("FORALL ", dumpfile
);
1565 for (fa
= c
->ext
.forall_iterator
; fa
; fa
= fa
->next
)
1567 show_expr (fa
->var
);
1568 fputc (' ', dumpfile
);
1569 show_expr (fa
->start
);
1570 fputc (':', dumpfile
);
1571 show_expr (fa
->end
);
1572 fputc (':', dumpfile
);
1573 show_expr (fa
->stride
);
1575 if (fa
->next
!= NULL
)
1576 fputc (',', dumpfile
);
1579 if (c
->expr1
!= NULL
)
1581 fputc (',', dumpfile
);
1582 show_expr (c
->expr1
);
1584 fputc ('\n', dumpfile
);
1586 show_code (level
+ 1, c
->block
->next
);
1588 code_indent (level
, 0);
1589 fputs ("END FORALL", dumpfile
);
1593 fputs ("CRITICAL\n", dumpfile
);
1594 show_code (level
+ 1, c
->block
->next
);
1595 code_indent (level
, 0);
1596 fputs ("END CRITICAL", dumpfile
);
1600 fputs ("DO ", dumpfile
);
1602 fprintf (dumpfile
, " %-5d ", c
->label1
->value
);
1604 show_expr (c
->ext
.iterator
->var
);
1605 fputc ('=', dumpfile
);
1606 show_expr (c
->ext
.iterator
->start
);
1607 fputc (' ', dumpfile
);
1608 show_expr (c
->ext
.iterator
->end
);
1609 fputc (' ', dumpfile
);
1610 show_expr (c
->ext
.iterator
->step
);
1613 show_code (level
+ 1, c
->block
->next
);
1620 fputs ("END DO", dumpfile
);
1623 case EXEC_DO_CONCURRENT
:
1624 fputs ("DO CONCURRENT ", dumpfile
);
1625 for (fa
= c
->ext
.forall_iterator
; fa
; fa
= fa
->next
)
1627 show_expr (fa
->var
);
1628 fputc (' ', dumpfile
);
1629 show_expr (fa
->start
);
1630 fputc (':', dumpfile
);
1631 show_expr (fa
->end
);
1632 fputc (':', dumpfile
);
1633 show_expr (fa
->stride
);
1635 if (fa
->next
!= NULL
)
1636 fputc (',', dumpfile
);
1638 show_expr (c
->expr1
);
1640 show_code (level
+ 1, c
->block
->next
);
1641 code_indent (level
, c
->label1
);
1642 fputs ("END DO", dumpfile
);
1646 fputs ("DO WHILE ", dumpfile
);
1647 show_expr (c
->expr1
);
1648 fputc ('\n', dumpfile
);
1650 show_code (level
+ 1, c
->block
->next
);
1652 code_indent (level
, c
->label1
);
1653 fputs ("END DO", dumpfile
);
1657 fputs ("CYCLE", dumpfile
);
1659 fprintf (dumpfile
, " %s", c
->symtree
->n
.sym
->name
);
1663 fputs ("EXIT", dumpfile
);
1665 fprintf (dumpfile
, " %s", c
->symtree
->n
.sym
->name
);
1669 fputs ("ALLOCATE ", dumpfile
);
1672 fputs (" STAT=", dumpfile
);
1673 show_expr (c
->expr1
);
1678 fputs (" ERRMSG=", dumpfile
);
1679 show_expr (c
->expr2
);
1685 fputs (" MOLD=", dumpfile
);
1687 fputs (" SOURCE=", dumpfile
);
1688 show_expr (c
->expr3
);
1691 for (a
= c
->ext
.alloc
.list
; a
; a
= a
->next
)
1693 fputc (' ', dumpfile
);
1694 show_expr (a
->expr
);
1699 case EXEC_DEALLOCATE
:
1700 fputs ("DEALLOCATE ", dumpfile
);
1703 fputs (" STAT=", dumpfile
);
1704 show_expr (c
->expr1
);
1709 fputs (" ERRMSG=", dumpfile
);
1710 show_expr (c
->expr2
);
1713 for (a
= c
->ext
.alloc
.list
; a
; a
= a
->next
)
1715 fputc (' ', dumpfile
);
1716 show_expr (a
->expr
);
1722 fputs ("OPEN", dumpfile
);
1727 fputs (" UNIT=", dumpfile
);
1728 show_expr (open
->unit
);
1732 fputs (" IOMSG=", dumpfile
);
1733 show_expr (open
->iomsg
);
1737 fputs (" IOSTAT=", dumpfile
);
1738 show_expr (open
->iostat
);
1742 fputs (" FILE=", dumpfile
);
1743 show_expr (open
->file
);
1747 fputs (" STATUS=", dumpfile
);
1748 show_expr (open
->status
);
1752 fputs (" ACCESS=", dumpfile
);
1753 show_expr (open
->access
);
1757 fputs (" FORM=", dumpfile
);
1758 show_expr (open
->form
);
1762 fputs (" RECL=", dumpfile
);
1763 show_expr (open
->recl
);
1767 fputs (" BLANK=", dumpfile
);
1768 show_expr (open
->blank
);
1772 fputs (" POSITION=", dumpfile
);
1773 show_expr (open
->position
);
1777 fputs (" ACTION=", dumpfile
);
1778 show_expr (open
->action
);
1782 fputs (" DELIM=", dumpfile
);
1783 show_expr (open
->delim
);
1787 fputs (" PAD=", dumpfile
);
1788 show_expr (open
->pad
);
1792 fputs (" DECIMAL=", dumpfile
);
1793 show_expr (open
->decimal
);
1797 fputs (" ENCODING=", dumpfile
);
1798 show_expr (open
->encoding
);
1802 fputs (" ROUND=", dumpfile
);
1803 show_expr (open
->round
);
1807 fputs (" SIGN=", dumpfile
);
1808 show_expr (open
->sign
);
1812 fputs (" CONVERT=", dumpfile
);
1813 show_expr (open
->convert
);
1815 if (open
->asynchronous
)
1817 fputs (" ASYNCHRONOUS=", dumpfile
);
1818 show_expr (open
->asynchronous
);
1820 if (open
->err
!= NULL
)
1821 fprintf (dumpfile
, " ERR=%d", open
->err
->value
);
1826 fputs ("CLOSE", dumpfile
);
1827 close
= c
->ext
.close
;
1831 fputs (" UNIT=", dumpfile
);
1832 show_expr (close
->unit
);
1836 fputs (" IOMSG=", dumpfile
);
1837 show_expr (close
->iomsg
);
1841 fputs (" IOSTAT=", dumpfile
);
1842 show_expr (close
->iostat
);
1846 fputs (" STATUS=", dumpfile
);
1847 show_expr (close
->status
);
1849 if (close
->err
!= NULL
)
1850 fprintf (dumpfile
, " ERR=%d", close
->err
->value
);
1853 case EXEC_BACKSPACE
:
1854 fputs ("BACKSPACE", dumpfile
);
1858 fputs ("ENDFILE", dumpfile
);
1862 fputs ("REWIND", dumpfile
);
1866 fputs ("FLUSH", dumpfile
);
1869 fp
= c
->ext
.filepos
;
1873 fputs (" UNIT=", dumpfile
);
1874 show_expr (fp
->unit
);
1878 fputs (" IOMSG=", dumpfile
);
1879 show_expr (fp
->iomsg
);
1883 fputs (" IOSTAT=", dumpfile
);
1884 show_expr (fp
->iostat
);
1886 if (fp
->err
!= NULL
)
1887 fprintf (dumpfile
, " ERR=%d", fp
->err
->value
);
1891 fputs ("INQUIRE", dumpfile
);
1896 fputs (" UNIT=", dumpfile
);
1897 show_expr (i
->unit
);
1901 fputs (" FILE=", dumpfile
);
1902 show_expr (i
->file
);
1907 fputs (" IOMSG=", dumpfile
);
1908 show_expr (i
->iomsg
);
1912 fputs (" IOSTAT=", dumpfile
);
1913 show_expr (i
->iostat
);
1917 fputs (" EXIST=", dumpfile
);
1918 show_expr (i
->exist
);
1922 fputs (" OPENED=", dumpfile
);
1923 show_expr (i
->opened
);
1927 fputs (" NUMBER=", dumpfile
);
1928 show_expr (i
->number
);
1932 fputs (" NAMED=", dumpfile
);
1933 show_expr (i
->named
);
1937 fputs (" NAME=", dumpfile
);
1938 show_expr (i
->name
);
1942 fputs (" ACCESS=", dumpfile
);
1943 show_expr (i
->access
);
1947 fputs (" SEQUENTIAL=", dumpfile
);
1948 show_expr (i
->sequential
);
1953 fputs (" DIRECT=", dumpfile
);
1954 show_expr (i
->direct
);
1958 fputs (" FORM=", dumpfile
);
1959 show_expr (i
->form
);
1963 fputs (" FORMATTED", dumpfile
);
1964 show_expr (i
->formatted
);
1968 fputs (" UNFORMATTED=", dumpfile
);
1969 show_expr (i
->unformatted
);
1973 fputs (" RECL=", dumpfile
);
1974 show_expr (i
->recl
);
1978 fputs (" NEXTREC=", dumpfile
);
1979 show_expr (i
->nextrec
);
1983 fputs (" BLANK=", dumpfile
);
1984 show_expr (i
->blank
);
1988 fputs (" POSITION=", dumpfile
);
1989 show_expr (i
->position
);
1993 fputs (" ACTION=", dumpfile
);
1994 show_expr (i
->action
);
1998 fputs (" READ=", dumpfile
);
1999 show_expr (i
->read
);
2003 fputs (" WRITE=", dumpfile
);
2004 show_expr (i
->write
);
2008 fputs (" READWRITE=", dumpfile
);
2009 show_expr (i
->readwrite
);
2013 fputs (" DELIM=", dumpfile
);
2014 show_expr (i
->delim
);
2018 fputs (" PAD=", dumpfile
);
2023 fputs (" CONVERT=", dumpfile
);
2024 show_expr (i
->convert
);
2026 if (i
->asynchronous
)
2028 fputs (" ASYNCHRONOUS=", dumpfile
);
2029 show_expr (i
->asynchronous
);
2033 fputs (" DECIMAL=", dumpfile
);
2034 show_expr (i
->decimal
);
2038 fputs (" ENCODING=", dumpfile
);
2039 show_expr (i
->encoding
);
2043 fputs (" PENDING=", dumpfile
);
2044 show_expr (i
->pending
);
2048 fputs (" ROUND=", dumpfile
);
2049 show_expr (i
->round
);
2053 fputs (" SIGN=", dumpfile
);
2054 show_expr (i
->sign
);
2058 fputs (" SIZE=", dumpfile
);
2059 show_expr (i
->size
);
2063 fputs (" ID=", dumpfile
);
2068 fprintf (dumpfile
, " ERR=%d", i
->err
->value
);
2072 fputs ("IOLENGTH ", dumpfile
);
2073 show_expr (c
->expr1
);
2078 fputs ("READ", dumpfile
);
2082 fputs ("WRITE", dumpfile
);
2088 fputs (" UNIT=", dumpfile
);
2089 show_expr (dt
->io_unit
);
2092 if (dt
->format_expr
)
2094 fputs (" FMT=", dumpfile
);
2095 show_expr (dt
->format_expr
);
2098 if (dt
->format_label
!= NULL
)
2099 fprintf (dumpfile
, " FMT=%d", dt
->format_label
->value
);
2101 fprintf (dumpfile
, " NML=%s", dt
->namelist
->name
);
2105 fputs (" IOMSG=", dumpfile
);
2106 show_expr (dt
->iomsg
);
2110 fputs (" IOSTAT=", dumpfile
);
2111 show_expr (dt
->iostat
);
2115 fputs (" SIZE=", dumpfile
);
2116 show_expr (dt
->size
);
2120 fputs (" REC=", dumpfile
);
2121 show_expr (dt
->rec
);
2125 fputs (" ADVANCE=", dumpfile
);
2126 show_expr (dt
->advance
);
2130 fputs (" ID=", dumpfile
);
2135 fputs (" POS=", dumpfile
);
2136 show_expr (dt
->pos
);
2138 if (dt
->asynchronous
)
2140 fputs (" ASYNCHRONOUS=", dumpfile
);
2141 show_expr (dt
->asynchronous
);
2145 fputs (" BLANK=", dumpfile
);
2146 show_expr (dt
->blank
);
2150 fputs (" DECIMAL=", dumpfile
);
2151 show_expr (dt
->decimal
);
2155 fputs (" DELIM=", dumpfile
);
2156 show_expr (dt
->delim
);
2160 fputs (" PAD=", dumpfile
);
2161 show_expr (dt
->pad
);
2165 fputs (" ROUND=", dumpfile
);
2166 show_expr (dt
->round
);
2170 fputs (" SIGN=", dumpfile
);
2171 show_expr (dt
->sign
);
2175 for (c
= c
->block
->next
; c
; c
= c
->next
)
2176 show_code_node (level
+ (c
->next
!= NULL
), c
);
2180 fputs ("TRANSFER ", dumpfile
);
2181 show_expr (c
->expr1
);
2185 fputs ("DT_END", dumpfile
);
2188 if (dt
->err
!= NULL
)
2189 fprintf (dumpfile
, " ERR=%d", dt
->err
->value
);
2190 if (dt
->end
!= NULL
)
2191 fprintf (dumpfile
, " END=%d", dt
->end
->value
);
2192 if (dt
->eor
!= NULL
)
2193 fprintf (dumpfile
, " EOR=%d", dt
->eor
->value
);
2196 case EXEC_OMP_ATOMIC
:
2197 case EXEC_OMP_BARRIER
:
2198 case EXEC_OMP_CRITICAL
:
2199 case EXEC_OMP_FLUSH
:
2201 case EXEC_OMP_MASTER
:
2202 case EXEC_OMP_ORDERED
:
2203 case EXEC_OMP_PARALLEL
:
2204 case EXEC_OMP_PARALLEL_DO
:
2205 case EXEC_OMP_PARALLEL_SECTIONS
:
2206 case EXEC_OMP_PARALLEL_WORKSHARE
:
2207 case EXEC_OMP_SECTIONS
:
2208 case EXEC_OMP_SINGLE
:
2210 case EXEC_OMP_TASKWAIT
:
2211 case EXEC_OMP_TASKYIELD
:
2212 case EXEC_OMP_WORKSHARE
:
2213 show_omp_node (level
, c
);
2217 gfc_internal_error ("show_code_node(): Bad statement code");
2222 /* Show an equivalence chain. */
2225 show_equiv (gfc_equiv
*eq
)
2228 fputs ("Equivalence: ", dumpfile
);
2231 show_expr (eq
->expr
);
2234 fputs (", ", dumpfile
);
2239 /* Show a freakin' whole namespace. */
2242 show_namespace (gfc_namespace
*ns
)
2244 gfc_interface
*intr
;
2245 gfc_namespace
*save
;
2251 save
= gfc_current_ns
;
2254 fputs ("Namespace:", dumpfile
);
2260 while (i
< GFC_LETTERS
- 1
2261 && gfc_compare_types (&ns
->default_type
[i
+1],
2262 &ns
->default_type
[l
]))
2266 fprintf (dumpfile
, " %c-%c: ", l
+'A', i
+'A');
2268 fprintf (dumpfile
, " %c: ", l
+'A');
2270 show_typespec(&ns
->default_type
[l
]);
2272 } while (i
< GFC_LETTERS
);
2274 if (ns
->proc_name
!= NULL
)
2277 fprintf (dumpfile
, "procedure name = %s", ns
->proc_name
->name
);
2281 gfc_current_ns
= ns
;
2282 gfc_traverse_symtree (ns
->common_root
, show_common
);
2284 gfc_traverse_symtree (ns
->sym_root
, show_symtree
);
2286 for (op
= GFC_INTRINSIC_BEGIN
; op
!= GFC_INTRINSIC_END
; op
++)
2288 /* User operator interfaces */
2294 fprintf (dumpfile
, "Operator interfaces for %s:",
2295 gfc_op2string ((gfc_intrinsic_op
) op
));
2297 for (; intr
; intr
= intr
->next
)
2298 fprintf (dumpfile
, " %s", intr
->sym
->name
);
2301 if (ns
->uop_root
!= NULL
)
2304 fputs ("User operators:\n", dumpfile
);
2305 gfc_traverse_user_op (ns
, show_uop
);
2308 for (eq
= ns
->equiv
; eq
; eq
= eq
->next
)
2311 fputc ('\n', dumpfile
);
2313 fputs ("code:", dumpfile
);
2314 show_code (show_level
, ns
->code
);
2317 for (ns
= ns
->contained
; ns
; ns
= ns
->sibling
)
2319 fputs ("\nCONTAINS\n", dumpfile
);
2321 show_namespace (ns
);
2325 fputc ('\n', dumpfile
);
2326 gfc_current_ns
= save
;
2330 /* Main function for dumping a parse tree. */
2333 gfc_dump_parse_tree (gfc_namespace
*ns
, FILE *file
)
2336 show_namespace (ns
);