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
);
107 show_expr (ts
->u
.cl
->length
);
111 fprintf (dumpfile
, "%d", ts
->kind
);
115 fputc (')', dumpfile
);
119 /* Show an actual argument list. */
122 show_actual_arglist (gfc_actual_arglist
*a
)
124 fputc ('(', dumpfile
);
126 for (; a
; a
= a
->next
)
128 fputc ('(', dumpfile
);
130 fprintf (dumpfile
, "%s = ", a
->name
);
134 fputs ("(arg not-present)", dumpfile
);
136 fputc (')', dumpfile
);
138 fputc (' ', dumpfile
);
141 fputc (')', dumpfile
);
145 /* Show a gfc_array_spec array specification structure. */
148 show_array_spec (gfc_array_spec
*as
)
155 fputs ("()", dumpfile
);
159 fprintf (dumpfile
, "(%d [%d]", as
->rank
, as
->corank
);
161 if (as
->rank
+ as
->corank
> 0)
165 case AS_EXPLICIT
: c
= "AS_EXPLICIT"; break;
166 case AS_DEFERRED
: c
= "AS_DEFERRED"; break;
167 case AS_ASSUMED_SIZE
: c
= "AS_ASSUMED_SIZE"; break;
168 case AS_ASSUMED_SHAPE
: c
= "AS_ASSUMED_SHAPE"; break;
170 gfc_internal_error ("show_array_spec(): Unhandled array shape "
173 fprintf (dumpfile
, " %s ", c
);
175 for (i
= 0; i
< as
->rank
+ as
->corank
; i
++)
177 show_expr (as
->lower
[i
]);
178 fputc (' ', dumpfile
);
179 show_expr (as
->upper
[i
]);
180 fputc (' ', dumpfile
);
184 fputc (')', dumpfile
);
188 /* Show a gfc_array_ref array reference structure. */
191 show_array_ref (gfc_array_ref
* ar
)
195 fputc ('(', dumpfile
);
200 fputs ("FULL", dumpfile
);
204 for (i
= 0; i
< ar
->dimen
; i
++)
206 /* There are two types of array sections: either the
207 elements are identified by an integer array ('vector'),
208 or by an index range. In the former case we only have to
209 print the start expression which contains the vector, in
210 the latter case we have to print any of lower and upper
211 bound and the stride, if they're present. */
213 if (ar
->start
[i
] != NULL
)
214 show_expr (ar
->start
[i
]);
216 if (ar
->dimen_type
[i
] == DIMEN_RANGE
)
218 fputc (':', dumpfile
);
220 if (ar
->end
[i
] != NULL
)
221 show_expr (ar
->end
[i
]);
223 if (ar
->stride
[i
] != NULL
)
225 fputc (':', dumpfile
);
226 show_expr (ar
->stride
[i
]);
230 if (i
!= ar
->dimen
- 1)
231 fputs (" , ", dumpfile
);
236 for (i
= 0; i
< ar
->dimen
; i
++)
238 show_expr (ar
->start
[i
]);
239 if (i
!= ar
->dimen
- 1)
240 fputs (" , ", dumpfile
);
245 fputs ("UNKNOWN", dumpfile
);
249 gfc_internal_error ("show_array_ref(): Unknown array reference");
252 fputc (')', dumpfile
);
256 /* Show a list of gfc_ref structures. */
259 show_ref (gfc_ref
*p
)
261 for (; p
; p
= p
->next
)
265 show_array_ref (&p
->u
.ar
);
269 fprintf (dumpfile
, " %% %s", p
->u
.c
.component
->name
);
273 fputc ('(', dumpfile
);
274 show_expr (p
->u
.ss
.start
);
275 fputc (':', dumpfile
);
276 show_expr (p
->u
.ss
.end
);
277 fputc (')', dumpfile
);
281 gfc_internal_error ("show_ref(): Bad component code");
286 /* Display a constructor. Works recursively for array constructors. */
289 show_constructor (gfc_constructor_base base
)
292 for (c
= gfc_constructor_first (base
); c
; c
= gfc_constructor_next (c
))
294 if (c
->iterator
== NULL
)
298 fputc ('(', dumpfile
);
301 fputc (' ', dumpfile
);
302 show_expr (c
->iterator
->var
);
303 fputc ('=', dumpfile
);
304 show_expr (c
->iterator
->start
);
305 fputc (',', dumpfile
);
306 show_expr (c
->iterator
->end
);
307 fputc (',', dumpfile
);
308 show_expr (c
->iterator
->step
);
310 fputc (')', dumpfile
);
313 if (gfc_constructor_next (c
) != NULL
)
314 fputs (" , ", dumpfile
);
320 show_char_const (const gfc_char_t
*c
, int length
)
324 fputc ('\'', dumpfile
);
325 for (i
= 0; i
< length
; i
++)
328 fputs ("''", dumpfile
);
330 fputs (gfc_print_wide_char (c
[i
]), dumpfile
);
332 fputc ('\'', dumpfile
);
336 /* Show a component-call expression. */
339 show_compcall (gfc_expr
* p
)
341 gcc_assert (p
->expr_type
== EXPR_COMPCALL
);
343 fprintf (dumpfile
, "%s", p
->symtree
->n
.sym
->name
);
345 fprintf (dumpfile
, "%s", p
->value
.compcall
.name
);
347 show_actual_arglist (p
->value
.compcall
.actual
);
351 /* Show an expression. */
354 show_expr (gfc_expr
*p
)
361 fputs ("()", dumpfile
);
365 switch (p
->expr_type
)
368 show_char_const (p
->value
.character
.string
, p
->value
.character
.length
);
373 fprintf (dumpfile
, "%s(", p
->ts
.u
.derived
->name
);
374 show_constructor (p
->value
.constructor
);
375 fputc (')', dumpfile
);
379 fputs ("(/ ", dumpfile
);
380 show_constructor (p
->value
.constructor
);
381 fputs (" /)", dumpfile
);
387 fputs ("NULL()", dumpfile
);
394 mpz_out_str (stdout
, 10, p
->value
.integer
);
396 if (p
->ts
.kind
!= gfc_default_integer_kind
)
397 fprintf (dumpfile
, "_%d", p
->ts
.kind
);
401 if (p
->value
.logical
)
402 fputs (".true.", dumpfile
);
404 fputs (".false.", dumpfile
);
408 mpfr_out_str (stdout
, 10, 0, p
->value
.real
, GFC_RND_MODE
);
409 if (p
->ts
.kind
!= gfc_default_real_kind
)
410 fprintf (dumpfile
, "_%d", p
->ts
.kind
);
414 show_char_const (p
->value
.character
.string
,
415 p
->value
.character
.length
);
419 fputs ("(complex ", dumpfile
);
421 mpfr_out_str (stdout
, 10, 0, mpc_realref (p
->value
.complex),
423 if (p
->ts
.kind
!= gfc_default_complex_kind
)
424 fprintf (dumpfile
, "_%d", p
->ts
.kind
);
426 fputc (' ', dumpfile
);
428 mpfr_out_str (stdout
, 10, 0, mpc_imagref (p
->value
.complex),
430 if (p
->ts
.kind
!= gfc_default_complex_kind
)
431 fprintf (dumpfile
, "_%d", p
->ts
.kind
);
433 fputc (')', dumpfile
);
437 fprintf (dumpfile
, "%dH", p
->representation
.length
);
438 c
= p
->representation
.string
;
439 for (i
= 0; i
< p
->representation
.length
; i
++, c
++)
441 fputc (*c
, dumpfile
);
446 fputs ("???", dumpfile
);
450 if (p
->representation
.string
)
452 fputs (" {", dumpfile
);
453 c
= p
->representation
.string
;
454 for (i
= 0; i
< p
->representation
.length
; i
++, c
++)
456 fprintf (dumpfile
, "%.2x", (unsigned int) *c
);
457 if (i
< p
->representation
.length
- 1)
458 fputc (',', dumpfile
);
460 fputc ('}', dumpfile
);
466 if (p
->symtree
->n
.sym
->ns
&& p
->symtree
->n
.sym
->ns
->proc_name
)
467 fprintf (dumpfile
, "%s:", p
->symtree
->n
.sym
->ns
->proc_name
->name
);
468 fprintf (dumpfile
, "%s", p
->symtree
->n
.sym
->name
);
473 fputc ('(', dumpfile
);
474 switch (p
->value
.op
.op
)
476 case INTRINSIC_UPLUS
:
477 fputs ("U+ ", dumpfile
);
479 case INTRINSIC_UMINUS
:
480 fputs ("U- ", dumpfile
);
483 fputs ("+ ", dumpfile
);
485 case INTRINSIC_MINUS
:
486 fputs ("- ", dumpfile
);
488 case INTRINSIC_TIMES
:
489 fputs ("* ", dumpfile
);
491 case INTRINSIC_DIVIDE
:
492 fputs ("/ ", dumpfile
);
494 case INTRINSIC_POWER
:
495 fputs ("** ", dumpfile
);
497 case INTRINSIC_CONCAT
:
498 fputs ("// ", dumpfile
);
501 fputs ("AND ", dumpfile
);
504 fputs ("OR ", dumpfile
);
507 fputs ("EQV ", dumpfile
);
510 fputs ("NEQV ", dumpfile
);
513 case INTRINSIC_EQ_OS
:
514 fputs ("= ", dumpfile
);
517 case INTRINSIC_NE_OS
:
518 fputs ("/= ", dumpfile
);
521 case INTRINSIC_GT_OS
:
522 fputs ("> ", dumpfile
);
525 case INTRINSIC_GE_OS
:
526 fputs (">= ", dumpfile
);
529 case INTRINSIC_LT_OS
:
530 fputs ("< ", dumpfile
);
533 case INTRINSIC_LE_OS
:
534 fputs ("<= ", dumpfile
);
537 fputs ("NOT ", dumpfile
);
539 case INTRINSIC_PARENTHESES
:
540 fputs ("parens", dumpfile
);
545 ("show_expr(): Bad intrinsic in expression!");
548 show_expr (p
->value
.op
.op1
);
552 fputc (' ', dumpfile
);
553 show_expr (p
->value
.op
.op2
);
556 fputc (')', dumpfile
);
560 if (p
->value
.function
.name
== NULL
)
562 fprintf (dumpfile
, "%s", p
->symtree
->n
.sym
->name
);
563 if (gfc_is_proc_ptr_comp (p
, NULL
))
565 fputc ('[', dumpfile
);
566 show_actual_arglist (p
->value
.function
.actual
);
567 fputc (']', dumpfile
);
571 fprintf (dumpfile
, "%s", p
->value
.function
.name
);
572 if (gfc_is_proc_ptr_comp (p
, NULL
))
574 fputc ('[', dumpfile
);
575 fputc ('[', dumpfile
);
576 show_actual_arglist (p
->value
.function
.actual
);
577 fputc (']', dumpfile
);
578 fputc (']', dumpfile
);
588 gfc_internal_error ("show_expr(): Don't know how to show expr");
592 /* Show symbol attributes. The flavor and intent are followed by
593 whatever single bit attributes are present. */
596 show_attr (symbol_attribute
*attr
, const char * module
)
598 if (attr
->flavor
!= FL_UNKNOWN
)
599 fprintf (dumpfile
, "(%s ", gfc_code2string (flavors
, attr
->flavor
));
600 if (attr
->access
!= ACCESS_UNKNOWN
)
601 fprintf (dumpfile
, "%s ", gfc_code2string (access_types
, attr
->access
));
602 if (attr
->proc
!= PROC_UNKNOWN
)
603 fprintf (dumpfile
, "%s ", gfc_code2string (procedures
, attr
->proc
));
604 if (attr
->save
!= SAVE_NONE
)
605 fprintf (dumpfile
, "%s", gfc_code2string (save_status
, attr
->save
));
607 if (attr
->allocatable
)
608 fputs (" ALLOCATABLE", dumpfile
);
609 if (attr
->asynchronous
)
610 fputs (" ASYNCHRONOUS", dumpfile
);
611 if (attr
->codimension
)
612 fputs (" CODIMENSION", dumpfile
);
614 fputs (" DIMENSION", dumpfile
);
615 if (attr
->contiguous
)
616 fputs (" CONTIGUOUS", dumpfile
);
618 fputs (" EXTERNAL", dumpfile
);
620 fputs (" INTRINSIC", dumpfile
);
622 fputs (" OPTIONAL", dumpfile
);
624 fputs (" POINTER", dumpfile
);
625 if (attr
->is_protected
)
626 fputs (" PROTECTED", dumpfile
);
628 fputs (" VALUE", dumpfile
);
630 fputs (" VOLATILE", dumpfile
);
631 if (attr
->threadprivate
)
632 fputs (" THREADPRIVATE", dumpfile
);
634 fputs (" TARGET", dumpfile
);
637 fputs (" DUMMY", dumpfile
);
638 if (attr
->intent
!= INTENT_UNKNOWN
)
639 fprintf (dumpfile
, "(%s)", gfc_intent_string (attr
->intent
));
643 fputs (" RESULT", dumpfile
);
645 fputs (" ENTRY", dumpfile
);
647 fputs (" BIND(C)", dumpfile
);
650 fputs (" DATA", dumpfile
);
653 fputs (" USE-ASSOC", dumpfile
);
655 fprintf (dumpfile
, "(%s)", module
);
658 if (attr
->in_namelist
)
659 fputs (" IN-NAMELIST", dumpfile
);
661 fputs (" IN-COMMON", dumpfile
);
664 fputs (" ABSTRACT", dumpfile
);
666 fputs (" FUNCTION", dumpfile
);
667 if (attr
->subroutine
)
668 fputs (" SUBROUTINE", dumpfile
);
669 if (attr
->implicit_type
)
670 fputs (" IMPLICIT-TYPE", dumpfile
);
673 fputs (" SEQUENCE", dumpfile
);
675 fputs (" ELEMENTAL", dumpfile
);
677 fputs (" PURE", dumpfile
);
679 fputs (" RECURSIVE", dumpfile
);
681 fputc (')', dumpfile
);
685 /* Show components of a derived type. */
688 show_components (gfc_symbol
*sym
)
692 for (c
= sym
->components
; c
; c
= c
->next
)
694 fprintf (dumpfile
, "(%s ", c
->name
);
695 show_typespec (&c
->ts
);
697 fputs (" POINTER", dumpfile
);
698 if (c
->attr
.proc_pointer
)
699 fputs (" PPC", dumpfile
);
700 if (c
->attr
.dimension
)
701 fputs (" DIMENSION", dumpfile
);
702 fputc (' ', dumpfile
);
703 show_array_spec (c
->as
);
705 fprintf (dumpfile
, " %s", gfc_code2string (access_types
, c
->attr
.access
));
706 fputc (')', dumpfile
);
708 fputc (' ', dumpfile
);
713 /* Show the f2k_derived namespace with procedure bindings. */
716 show_typebound_proc (gfc_typebound_proc
* tb
, const char* name
)
721 fputs ("GENERIC", dumpfile
);
724 fputs ("PROCEDURE, ", dumpfile
);
726 fputs ("NOPASS", dumpfile
);
730 fprintf (dumpfile
, "PASS(%s)", tb
->pass_arg
);
732 fputs ("PASS", dumpfile
);
734 if (tb
->non_overridable
)
735 fputs (", NON_OVERRIDABLE", dumpfile
);
738 if (tb
->access
== ACCESS_PUBLIC
)
739 fputs (", PUBLIC", dumpfile
);
741 fputs (", PRIVATE", dumpfile
);
743 fprintf (dumpfile
, " :: %s => ", name
);
748 for (g
= tb
->u
.generic
; g
; g
= g
->next
)
750 fputs (g
->specific_st
->name
, dumpfile
);
752 fputs (", ", dumpfile
);
756 fputs (tb
->u
.specific
->n
.sym
->name
, dumpfile
);
760 show_typebound_symtree (gfc_symtree
* st
)
762 gcc_assert (st
->n
.tb
);
763 show_typebound_proc (st
->n
.tb
, st
->name
);
767 show_f2k_derived (gfc_namespace
* f2k
)
773 fputs ("Procedure bindings:", dumpfile
);
776 /* Finalizer bindings. */
777 for (f
= f2k
->finalizers
; f
; f
= f
->next
)
780 fprintf (dumpfile
, "FINAL %s", f
->proc_sym
->name
);
783 /* Type-bound procedures. */
784 gfc_traverse_symtree (f2k
->tb_sym_root
, &show_typebound_symtree
);
789 fputs ("Operator bindings:", dumpfile
);
792 /* User-defined operators. */
793 gfc_traverse_symtree (f2k
->tb_uop_root
, &show_typebound_symtree
);
795 /* Intrinsic operators. */
796 for (op
= GFC_INTRINSIC_BEGIN
; op
!= GFC_INTRINSIC_END
; ++op
)
798 show_typebound_proc (f2k
->tb_op
[op
],
799 gfc_op2string ((gfc_intrinsic_op
) op
));
805 /* Show a symbol. If a symbol is an ENTRY, SUBROUTINE or FUNCTION, we
806 show the interface. Information needed to reconstruct the list of
807 specific interfaces associated with a generic symbol is done within
811 show_symbol (gfc_symbol
*sym
)
813 gfc_formal_arglist
*formal
;
820 fprintf (dumpfile
, "|| symbol: '%s' ", sym
->name
);
821 len
= strlen (sym
->name
);
822 for (i
=len
; i
<12; i
++)
823 fputc(' ', dumpfile
);
828 fputs ("type spec : ", dumpfile
);
829 show_typespec (&sym
->ts
);
832 fputs ("attributes: ", dumpfile
);
833 show_attr (&sym
->attr
, sym
->module
);
838 fputs ("value: ", dumpfile
);
839 show_expr (sym
->value
);
845 fputs ("Array spec:", dumpfile
);
846 show_array_spec (sym
->as
);
852 fputs ("Generic interfaces:", dumpfile
);
853 for (intr
= sym
->generic
; intr
; intr
= intr
->next
)
854 fprintf (dumpfile
, " %s", intr
->sym
->name
);
860 fprintf (dumpfile
, "result: %s", sym
->result
->name
);
866 fputs ("components: ", dumpfile
);
867 show_components (sym
);
870 if (sym
->f2k_derived
)
874 fprintf (dumpfile
, "hash: %d", sym
->hash_value
);
875 show_f2k_derived (sym
->f2k_derived
);
881 fputs ("Formal arglist:", dumpfile
);
883 for (formal
= sym
->formal
; formal
; formal
= formal
->next
)
885 if (formal
->sym
!= NULL
)
886 fprintf (dumpfile
, " %s", formal
->sym
->name
);
888 fputs (" [Alt Return]", dumpfile
);
892 if (sym
->formal_ns
&& (sym
->formal_ns
->proc_name
!= sym
))
895 fputs ("Formal namespace", dumpfile
);
896 show_namespace (sym
->formal_ns
);
902 /* Show a user-defined operator. Just prints an operator
903 and the name of the associated subroutine, really. */
906 show_uop (gfc_user_op
*uop
)
911 fprintf (dumpfile
, "%s:", uop
->name
);
913 for (intr
= uop
->op
; intr
; intr
= intr
->next
)
914 fprintf (dumpfile
, " %s", intr
->sym
->name
);
918 /* Workhorse function for traversing the user operator symtree. */
921 traverse_uop (gfc_symtree
*st
, void (*func
) (gfc_user_op
*))
928 traverse_uop (st
->left
, func
);
929 traverse_uop (st
->right
, func
);
933 /* Traverse the tree of user operator nodes. */
936 gfc_traverse_user_op (gfc_namespace
*ns
, void (*func
) (gfc_user_op
*))
938 traverse_uop (ns
->uop_root
, func
);
942 /* Function to display a common block. */
945 show_common (gfc_symtree
*st
)
950 fprintf (dumpfile
, "common: /%s/ ", st
->name
);
952 s
= st
->n
.common
->head
;
955 fprintf (dumpfile
, "%s", s
->name
);
958 fputs (", ", dumpfile
);
960 fputc ('\n', dumpfile
);
964 /* Worker function to display the symbol tree. */
967 show_symtree (gfc_symtree
*st
)
973 len
= strlen(st
->name
);
974 fprintf (dumpfile
, "symtree: '%s'", st
->name
);
976 for (i
=len
; i
<12; i
++)
977 fputc(' ', dumpfile
);
980 fputs( " Ambiguous", dumpfile
);
982 if (st
->n
.sym
->ns
!= gfc_current_ns
)
983 fprintf (dumpfile
, "|| symbol: '%s' from namespace '%s'", st
->n
.sym
->name
,
984 st
->n
.sym
->ns
->proc_name
->name
);
986 show_symbol (st
->n
.sym
);
990 /******************* Show gfc_code structures **************/
993 /* Show a list of code structures. Mutually recursive with
997 show_code (int level
, gfc_code
*c
)
999 for (; c
; c
= c
->next
)
1000 show_code_node (level
, c
);
1004 show_namelist (gfc_namelist
*n
)
1006 for (; n
->next
; n
= n
->next
)
1007 fprintf (dumpfile
, "%s,", n
->sym
->name
);
1008 fprintf (dumpfile
, "%s", n
->sym
->name
);
1011 /* Show a single OpenMP directive node and everything underneath it
1015 show_omp_node (int level
, gfc_code
*c
)
1017 gfc_omp_clauses
*omp_clauses
= NULL
;
1018 const char *name
= NULL
;
1022 case EXEC_OMP_ATOMIC
: name
= "ATOMIC"; break;
1023 case EXEC_OMP_BARRIER
: name
= "BARRIER"; break;
1024 case EXEC_OMP_CRITICAL
: name
= "CRITICAL"; break;
1025 case EXEC_OMP_FLUSH
: name
= "FLUSH"; break;
1026 case EXEC_OMP_DO
: name
= "DO"; break;
1027 case EXEC_OMP_MASTER
: name
= "MASTER"; break;
1028 case EXEC_OMP_ORDERED
: name
= "ORDERED"; break;
1029 case EXEC_OMP_PARALLEL
: name
= "PARALLEL"; break;
1030 case EXEC_OMP_PARALLEL_DO
: name
= "PARALLEL DO"; break;
1031 case EXEC_OMP_PARALLEL_SECTIONS
: name
= "PARALLEL SECTIONS"; break;
1032 case EXEC_OMP_PARALLEL_WORKSHARE
: name
= "PARALLEL WORKSHARE"; break;
1033 case EXEC_OMP_SECTIONS
: name
= "SECTIONS"; break;
1034 case EXEC_OMP_SINGLE
: name
= "SINGLE"; break;
1035 case EXEC_OMP_TASK
: name
= "TASK"; break;
1036 case EXEC_OMP_TASKWAIT
: name
= "TASKWAIT"; break;
1037 case EXEC_OMP_WORKSHARE
: name
= "WORKSHARE"; break;
1041 fprintf (dumpfile
, "!$OMP %s", name
);
1045 case EXEC_OMP_PARALLEL
:
1046 case EXEC_OMP_PARALLEL_DO
:
1047 case EXEC_OMP_PARALLEL_SECTIONS
:
1048 case EXEC_OMP_SECTIONS
:
1049 case EXEC_OMP_SINGLE
:
1050 case EXEC_OMP_WORKSHARE
:
1051 case EXEC_OMP_PARALLEL_WORKSHARE
:
1053 omp_clauses
= c
->ext
.omp_clauses
;
1055 case EXEC_OMP_CRITICAL
:
1056 if (c
->ext
.omp_name
)
1057 fprintf (dumpfile
, " (%s)", c
->ext
.omp_name
);
1059 case EXEC_OMP_FLUSH
:
1060 if (c
->ext
.omp_namelist
)
1062 fputs (" (", dumpfile
);
1063 show_namelist (c
->ext
.omp_namelist
);
1064 fputc (')', dumpfile
);
1067 case EXEC_OMP_BARRIER
:
1068 case EXEC_OMP_TASKWAIT
:
1077 if (omp_clauses
->if_expr
)
1079 fputs (" IF(", dumpfile
);
1080 show_expr (omp_clauses
->if_expr
);
1081 fputc (')', dumpfile
);
1083 if (omp_clauses
->num_threads
)
1085 fputs (" NUM_THREADS(", dumpfile
);
1086 show_expr (omp_clauses
->num_threads
);
1087 fputc (')', dumpfile
);
1089 if (omp_clauses
->sched_kind
!= OMP_SCHED_NONE
)
1092 switch (omp_clauses
->sched_kind
)
1094 case OMP_SCHED_STATIC
: type
= "STATIC"; break;
1095 case OMP_SCHED_DYNAMIC
: type
= "DYNAMIC"; break;
1096 case OMP_SCHED_GUIDED
: type
= "GUIDED"; break;
1097 case OMP_SCHED_RUNTIME
: type
= "RUNTIME"; break;
1098 case OMP_SCHED_AUTO
: type
= "AUTO"; break;
1102 fprintf (dumpfile
, " SCHEDULE (%s", type
);
1103 if (omp_clauses
->chunk_size
)
1105 fputc (',', dumpfile
);
1106 show_expr (omp_clauses
->chunk_size
);
1108 fputc (')', dumpfile
);
1110 if (omp_clauses
->default_sharing
!= OMP_DEFAULT_UNKNOWN
)
1113 switch (omp_clauses
->default_sharing
)
1115 case OMP_DEFAULT_NONE
: type
= "NONE"; break;
1116 case OMP_DEFAULT_PRIVATE
: type
= "PRIVATE"; break;
1117 case OMP_DEFAULT_SHARED
: type
= "SHARED"; break;
1118 case OMP_DEFAULT_FIRSTPRIVATE
: type
= "FIRSTPRIVATE"; break;
1122 fprintf (dumpfile
, " DEFAULT(%s)", type
);
1124 if (omp_clauses
->ordered
)
1125 fputs (" ORDERED", dumpfile
);
1126 if (omp_clauses
->untied
)
1127 fputs (" UNTIED", dumpfile
);
1128 if (omp_clauses
->collapse
)
1129 fprintf (dumpfile
, " COLLAPSE(%d)", omp_clauses
->collapse
);
1130 for (list_type
= 0; list_type
< OMP_LIST_NUM
; list_type
++)
1131 if (omp_clauses
->lists
[list_type
] != NULL
1132 && list_type
!= OMP_LIST_COPYPRIVATE
)
1135 if (list_type
>= OMP_LIST_REDUCTION_FIRST
)
1139 case OMP_LIST_PLUS
: type
= "+"; break;
1140 case OMP_LIST_MULT
: type
= "*"; break;
1141 case OMP_LIST_SUB
: type
= "-"; break;
1142 case OMP_LIST_AND
: type
= ".AND."; break;
1143 case OMP_LIST_OR
: type
= ".OR."; break;
1144 case OMP_LIST_EQV
: type
= ".EQV."; break;
1145 case OMP_LIST_NEQV
: type
= ".NEQV."; break;
1146 case OMP_LIST_MAX
: type
= "MAX"; break;
1147 case OMP_LIST_MIN
: type
= "MIN"; break;
1148 case OMP_LIST_IAND
: type
= "IAND"; break;
1149 case OMP_LIST_IOR
: type
= "IOR"; break;
1150 case OMP_LIST_IEOR
: type
= "IEOR"; break;
1154 fprintf (dumpfile
, " REDUCTION(%s:", type
);
1160 case OMP_LIST_PRIVATE
: type
= "PRIVATE"; break;
1161 case OMP_LIST_FIRSTPRIVATE
: type
= "FIRSTPRIVATE"; break;
1162 case OMP_LIST_LASTPRIVATE
: type
= "LASTPRIVATE"; break;
1163 case OMP_LIST_SHARED
: type
= "SHARED"; break;
1164 case OMP_LIST_COPYIN
: type
= "COPYIN"; break;
1168 fprintf (dumpfile
, " %s(", type
);
1170 show_namelist (omp_clauses
->lists
[list_type
]);
1171 fputc (')', dumpfile
);
1174 fputc ('\n', dumpfile
);
1175 if (c
->op
== EXEC_OMP_SECTIONS
|| c
->op
== EXEC_OMP_PARALLEL_SECTIONS
)
1177 gfc_code
*d
= c
->block
;
1180 show_code (level
+ 1, d
->next
);
1181 if (d
->block
== NULL
)
1183 code_indent (level
, 0);
1184 fputs ("!$OMP SECTION\n", dumpfile
);
1189 show_code (level
+ 1, c
->block
->next
);
1190 if (c
->op
== EXEC_OMP_ATOMIC
)
1192 code_indent (level
, 0);
1193 fprintf (dumpfile
, "!$OMP END %s", name
);
1194 if (omp_clauses
!= NULL
)
1196 if (omp_clauses
->lists
[OMP_LIST_COPYPRIVATE
])
1198 fputs (" COPYPRIVATE(", dumpfile
);
1199 show_namelist (omp_clauses
->lists
[OMP_LIST_COPYPRIVATE
]);
1200 fputc (')', dumpfile
);
1202 else if (omp_clauses
->nowait
)
1203 fputs (" NOWAIT", dumpfile
);
1205 else if (c
->op
== EXEC_OMP_CRITICAL
&& c
->ext
.omp_name
)
1206 fprintf (dumpfile
, " (%s)", c
->ext
.omp_name
);
1210 /* Show a single code node and everything underneath it if necessary. */
1213 show_code_node (int level
, gfc_code
*c
)
1215 gfc_forall_iterator
*fa
;
1228 fputc ('\n', dumpfile
);
1229 code_indent (level
, c
->here
);
1236 case EXEC_END_PROCEDURE
:
1240 fputs ("NOP", dumpfile
);
1244 fputs ("CONTINUE", dumpfile
);
1248 fprintf (dumpfile
, "ENTRY %s", c
->ext
.entry
->sym
->name
);
1251 case EXEC_INIT_ASSIGN
:
1253 fputs ("ASSIGN ", dumpfile
);
1254 show_expr (c
->expr1
);
1255 fputc (' ', dumpfile
);
1256 show_expr (c
->expr2
);
1259 case EXEC_LABEL_ASSIGN
:
1260 fputs ("LABEL ASSIGN ", dumpfile
);
1261 show_expr (c
->expr1
);
1262 fprintf (dumpfile
, " %d", c
->label1
->value
);
1265 case EXEC_POINTER_ASSIGN
:
1266 fputs ("POINTER ASSIGN ", dumpfile
);
1267 show_expr (c
->expr1
);
1268 fputc (' ', dumpfile
);
1269 show_expr (c
->expr2
);
1273 fputs ("GOTO ", dumpfile
);
1275 fprintf (dumpfile
, "%d", c
->label1
->value
);
1278 show_expr (c
->expr1
);
1282 fputs (", (", dumpfile
);
1283 for (; d
; d
= d
->block
)
1285 code_indent (level
, d
->label1
);
1286 if (d
->block
!= NULL
)
1287 fputc (',', dumpfile
);
1289 fputc (')', dumpfile
);
1296 case EXEC_ASSIGN_CALL
:
1297 if (c
->resolved_sym
)
1298 fprintf (dumpfile
, "CALL %s ", c
->resolved_sym
->name
);
1299 else if (c
->symtree
)
1300 fprintf (dumpfile
, "CALL %s ", c
->symtree
->name
);
1302 fputs ("CALL ?? ", dumpfile
);
1304 show_actual_arglist (c
->ext
.actual
);
1308 fputs ("CALL ", dumpfile
);
1309 show_compcall (c
->expr1
);
1313 fputs ("CALL ", dumpfile
);
1314 show_expr (c
->expr1
);
1315 show_actual_arglist (c
->ext
.actual
);
1319 fputs ("RETURN ", dumpfile
);
1321 show_expr (c
->expr1
);
1325 fputs ("PAUSE ", dumpfile
);
1327 if (c
->expr1
!= NULL
)
1328 show_expr (c
->expr1
);
1330 fprintf (dumpfile
, "%d", c
->ext
.stop_code
);
1334 case EXEC_ERROR_STOP
:
1335 fputs ("ERROR ", dumpfile
);
1339 fputs ("STOP ", dumpfile
);
1341 if (c
->expr1
!= NULL
)
1342 show_expr (c
->expr1
);
1344 fprintf (dumpfile
, "%d", c
->ext
.stop_code
);
1349 fputs ("SYNC ALL ", dumpfile
);
1350 if (c
->expr2
!= NULL
)
1352 fputs (" stat=", dumpfile
);
1353 show_expr (c
->expr2
);
1355 if (c
->expr3
!= NULL
)
1357 fputs (" errmsg=", dumpfile
);
1358 show_expr (c
->expr3
);
1362 case EXEC_SYNC_MEMORY
:
1363 fputs ("SYNC MEMORY ", dumpfile
);
1364 if (c
->expr2
!= NULL
)
1366 fputs (" stat=", dumpfile
);
1367 show_expr (c
->expr2
);
1369 if (c
->expr3
!= NULL
)
1371 fputs (" errmsg=", dumpfile
);
1372 show_expr (c
->expr3
);
1376 case EXEC_SYNC_IMAGES
:
1377 fputs ("SYNC IMAGES image-set=", dumpfile
);
1378 if (c
->expr1
!= NULL
)
1379 show_expr (c
->expr1
);
1381 fputs ("* ", dumpfile
);
1382 if (c
->expr2
!= NULL
)
1384 fputs (" stat=", dumpfile
);
1385 show_expr (c
->expr2
);
1387 if (c
->expr3
!= NULL
)
1389 fputs (" errmsg=", dumpfile
);
1390 show_expr (c
->expr3
);
1394 case EXEC_ARITHMETIC_IF
:
1395 fputs ("IF ", dumpfile
);
1396 show_expr (c
->expr1
);
1397 fprintf (dumpfile
, " %d, %d, %d",
1398 c
->label1
->value
, c
->label2
->value
, c
->label3
->value
);
1403 fputs ("IF ", dumpfile
);
1404 show_expr (d
->expr1
);
1407 show_code (level
+ 1, d
->next
);
1411 for (; d
; d
= d
->block
)
1413 code_indent (level
, 0);
1415 if (d
->expr1
== NULL
)
1416 fputs ("ELSE", dumpfile
);
1419 fputs ("ELSE IF ", dumpfile
);
1420 show_expr (d
->expr1
);
1424 show_code (level
+ 1, d
->next
);
1429 code_indent (level
, c
->label1
);
1433 fputs ("ENDIF", dumpfile
);
1438 const char* blocktype
;
1439 if (c
->ext
.block
.assoc
)
1440 blocktype
= "ASSOCIATE";
1442 blocktype
= "BLOCK";
1444 fprintf (dumpfile
, "%s ", blocktype
);
1446 ns
= c
->ext
.block
.ns
;
1447 gfc_traverse_symtree (ns
->sym_root
, show_symtree
);
1448 show_code (show_level
, ns
->code
);
1451 fprintf (dumpfile
, "END %s ", blocktype
);
1457 fputs ("SELECT CASE ", dumpfile
);
1458 show_expr (c
->expr1
);
1459 fputc ('\n', dumpfile
);
1461 for (; d
; d
= d
->block
)
1463 code_indent (level
, 0);
1465 fputs ("CASE ", dumpfile
);
1466 for (cp
= d
->ext
.case_list
; cp
; cp
= cp
->next
)
1468 fputc ('(', dumpfile
);
1469 show_expr (cp
->low
);
1470 fputc (' ', dumpfile
);
1471 show_expr (cp
->high
);
1472 fputc (')', dumpfile
);
1473 fputc (' ', dumpfile
);
1475 fputc ('\n', dumpfile
);
1477 show_code (level
+ 1, d
->next
);
1480 code_indent (level
, c
->label1
);
1481 fputs ("END SELECT", dumpfile
);
1485 fputs ("WHERE ", dumpfile
);
1488 show_expr (d
->expr1
);
1489 fputc ('\n', dumpfile
);
1491 show_code (level
+ 1, d
->next
);
1493 for (d
= d
->block
; d
; d
= d
->block
)
1495 code_indent (level
, 0);
1496 fputs ("ELSE WHERE ", dumpfile
);
1497 show_expr (d
->expr1
);
1498 fputc ('\n', dumpfile
);
1499 show_code (level
+ 1, d
->next
);
1502 code_indent (level
, 0);
1503 fputs ("END WHERE", dumpfile
);
1508 fputs ("FORALL ", dumpfile
);
1509 for (fa
= c
->ext
.forall_iterator
; fa
; fa
= fa
->next
)
1511 show_expr (fa
->var
);
1512 fputc (' ', dumpfile
);
1513 show_expr (fa
->start
);
1514 fputc (':', dumpfile
);
1515 show_expr (fa
->end
);
1516 fputc (':', dumpfile
);
1517 show_expr (fa
->stride
);
1519 if (fa
->next
!= NULL
)
1520 fputc (',', dumpfile
);
1523 if (c
->expr1
!= NULL
)
1525 fputc (',', dumpfile
);
1526 show_expr (c
->expr1
);
1528 fputc ('\n', dumpfile
);
1530 show_code (level
+ 1, c
->block
->next
);
1532 code_indent (level
, 0);
1533 fputs ("END FORALL", dumpfile
);
1537 fputs ("CRITICAL\n", dumpfile
);
1538 show_code (level
+ 1, c
->block
->next
);
1539 code_indent (level
, 0);
1540 fputs ("END CRITICAL", dumpfile
);
1544 fputs ("DO ", dumpfile
);
1546 fprintf (dumpfile
, " %-5d ", c
->label1
->value
);
1548 show_expr (c
->ext
.iterator
->var
);
1549 fputc ('=', dumpfile
);
1550 show_expr (c
->ext
.iterator
->start
);
1551 fputc (' ', dumpfile
);
1552 show_expr (c
->ext
.iterator
->end
);
1553 fputc (' ', dumpfile
);
1554 show_expr (c
->ext
.iterator
->step
);
1557 show_code (level
+ 1, c
->block
->next
);
1564 fputs ("END DO", dumpfile
);
1568 fputs ("DO WHILE ", dumpfile
);
1569 show_expr (c
->expr1
);
1570 fputc ('\n', dumpfile
);
1572 show_code (level
+ 1, c
->block
->next
);
1574 code_indent (level
, c
->label1
);
1575 fputs ("END DO", dumpfile
);
1579 fputs ("CYCLE", dumpfile
);
1581 fprintf (dumpfile
, " %s", c
->symtree
->n
.sym
->name
);
1585 fputs ("EXIT", dumpfile
);
1587 fprintf (dumpfile
, " %s", c
->symtree
->n
.sym
->name
);
1591 fputs ("ALLOCATE ", dumpfile
);
1594 fputs (" STAT=", dumpfile
);
1595 show_expr (c
->expr1
);
1600 fputs (" ERRMSG=", dumpfile
);
1601 show_expr (c
->expr2
);
1604 for (a
= c
->ext
.alloc
.list
; a
; a
= a
->next
)
1606 fputc (' ', dumpfile
);
1607 show_expr (a
->expr
);
1612 case EXEC_DEALLOCATE
:
1613 fputs ("DEALLOCATE ", dumpfile
);
1616 fputs (" STAT=", dumpfile
);
1617 show_expr (c
->expr1
);
1622 fputs (" ERRMSG=", dumpfile
);
1623 show_expr (c
->expr2
);
1626 for (a
= c
->ext
.alloc
.list
; a
; a
= a
->next
)
1628 fputc (' ', dumpfile
);
1629 show_expr (a
->expr
);
1635 fputs ("OPEN", dumpfile
);
1640 fputs (" UNIT=", dumpfile
);
1641 show_expr (open
->unit
);
1645 fputs (" IOMSG=", dumpfile
);
1646 show_expr (open
->iomsg
);
1650 fputs (" IOSTAT=", dumpfile
);
1651 show_expr (open
->iostat
);
1655 fputs (" FILE=", dumpfile
);
1656 show_expr (open
->file
);
1660 fputs (" STATUS=", dumpfile
);
1661 show_expr (open
->status
);
1665 fputs (" ACCESS=", dumpfile
);
1666 show_expr (open
->access
);
1670 fputs (" FORM=", dumpfile
);
1671 show_expr (open
->form
);
1675 fputs (" RECL=", dumpfile
);
1676 show_expr (open
->recl
);
1680 fputs (" BLANK=", dumpfile
);
1681 show_expr (open
->blank
);
1685 fputs (" POSITION=", dumpfile
);
1686 show_expr (open
->position
);
1690 fputs (" ACTION=", dumpfile
);
1691 show_expr (open
->action
);
1695 fputs (" DELIM=", dumpfile
);
1696 show_expr (open
->delim
);
1700 fputs (" PAD=", dumpfile
);
1701 show_expr (open
->pad
);
1705 fputs (" DECIMAL=", dumpfile
);
1706 show_expr (open
->decimal
);
1710 fputs (" ENCODING=", dumpfile
);
1711 show_expr (open
->encoding
);
1715 fputs (" ROUND=", dumpfile
);
1716 show_expr (open
->round
);
1720 fputs (" SIGN=", dumpfile
);
1721 show_expr (open
->sign
);
1725 fputs (" CONVERT=", dumpfile
);
1726 show_expr (open
->convert
);
1728 if (open
->asynchronous
)
1730 fputs (" ASYNCHRONOUS=", dumpfile
);
1731 show_expr (open
->asynchronous
);
1733 if (open
->err
!= NULL
)
1734 fprintf (dumpfile
, " ERR=%d", open
->err
->value
);
1739 fputs ("CLOSE", dumpfile
);
1740 close
= c
->ext
.close
;
1744 fputs (" UNIT=", dumpfile
);
1745 show_expr (close
->unit
);
1749 fputs (" IOMSG=", dumpfile
);
1750 show_expr (close
->iomsg
);
1754 fputs (" IOSTAT=", dumpfile
);
1755 show_expr (close
->iostat
);
1759 fputs (" STATUS=", dumpfile
);
1760 show_expr (close
->status
);
1762 if (close
->err
!= NULL
)
1763 fprintf (dumpfile
, " ERR=%d", close
->err
->value
);
1766 case EXEC_BACKSPACE
:
1767 fputs ("BACKSPACE", dumpfile
);
1771 fputs ("ENDFILE", dumpfile
);
1775 fputs ("REWIND", dumpfile
);
1779 fputs ("FLUSH", dumpfile
);
1782 fp
= c
->ext
.filepos
;
1786 fputs (" UNIT=", dumpfile
);
1787 show_expr (fp
->unit
);
1791 fputs (" IOMSG=", dumpfile
);
1792 show_expr (fp
->iomsg
);
1796 fputs (" IOSTAT=", dumpfile
);
1797 show_expr (fp
->iostat
);
1799 if (fp
->err
!= NULL
)
1800 fprintf (dumpfile
, " ERR=%d", fp
->err
->value
);
1804 fputs ("INQUIRE", dumpfile
);
1809 fputs (" UNIT=", dumpfile
);
1810 show_expr (i
->unit
);
1814 fputs (" FILE=", dumpfile
);
1815 show_expr (i
->file
);
1820 fputs (" IOMSG=", dumpfile
);
1821 show_expr (i
->iomsg
);
1825 fputs (" IOSTAT=", dumpfile
);
1826 show_expr (i
->iostat
);
1830 fputs (" EXIST=", dumpfile
);
1831 show_expr (i
->exist
);
1835 fputs (" OPENED=", dumpfile
);
1836 show_expr (i
->opened
);
1840 fputs (" NUMBER=", dumpfile
);
1841 show_expr (i
->number
);
1845 fputs (" NAMED=", dumpfile
);
1846 show_expr (i
->named
);
1850 fputs (" NAME=", dumpfile
);
1851 show_expr (i
->name
);
1855 fputs (" ACCESS=", dumpfile
);
1856 show_expr (i
->access
);
1860 fputs (" SEQUENTIAL=", dumpfile
);
1861 show_expr (i
->sequential
);
1866 fputs (" DIRECT=", dumpfile
);
1867 show_expr (i
->direct
);
1871 fputs (" FORM=", dumpfile
);
1872 show_expr (i
->form
);
1876 fputs (" FORMATTED", dumpfile
);
1877 show_expr (i
->formatted
);
1881 fputs (" UNFORMATTED=", dumpfile
);
1882 show_expr (i
->unformatted
);
1886 fputs (" RECL=", dumpfile
);
1887 show_expr (i
->recl
);
1891 fputs (" NEXTREC=", dumpfile
);
1892 show_expr (i
->nextrec
);
1896 fputs (" BLANK=", dumpfile
);
1897 show_expr (i
->blank
);
1901 fputs (" POSITION=", dumpfile
);
1902 show_expr (i
->position
);
1906 fputs (" ACTION=", dumpfile
);
1907 show_expr (i
->action
);
1911 fputs (" READ=", dumpfile
);
1912 show_expr (i
->read
);
1916 fputs (" WRITE=", dumpfile
);
1917 show_expr (i
->write
);
1921 fputs (" READWRITE=", dumpfile
);
1922 show_expr (i
->readwrite
);
1926 fputs (" DELIM=", dumpfile
);
1927 show_expr (i
->delim
);
1931 fputs (" PAD=", dumpfile
);
1936 fputs (" CONVERT=", dumpfile
);
1937 show_expr (i
->convert
);
1939 if (i
->asynchronous
)
1941 fputs (" ASYNCHRONOUS=", dumpfile
);
1942 show_expr (i
->asynchronous
);
1946 fputs (" DECIMAL=", dumpfile
);
1947 show_expr (i
->decimal
);
1951 fputs (" ENCODING=", dumpfile
);
1952 show_expr (i
->encoding
);
1956 fputs (" PENDING=", dumpfile
);
1957 show_expr (i
->pending
);
1961 fputs (" ROUND=", dumpfile
);
1962 show_expr (i
->round
);
1966 fputs (" SIGN=", dumpfile
);
1967 show_expr (i
->sign
);
1971 fputs (" SIZE=", dumpfile
);
1972 show_expr (i
->size
);
1976 fputs (" ID=", dumpfile
);
1981 fprintf (dumpfile
, " ERR=%d", i
->err
->value
);
1985 fputs ("IOLENGTH ", dumpfile
);
1986 show_expr (c
->expr1
);
1991 fputs ("READ", dumpfile
);
1995 fputs ("WRITE", dumpfile
);
2001 fputs (" UNIT=", dumpfile
);
2002 show_expr (dt
->io_unit
);
2005 if (dt
->format_expr
)
2007 fputs (" FMT=", dumpfile
);
2008 show_expr (dt
->format_expr
);
2011 if (dt
->format_label
!= NULL
)
2012 fprintf (dumpfile
, " FMT=%d", dt
->format_label
->value
);
2014 fprintf (dumpfile
, " NML=%s", dt
->namelist
->name
);
2018 fputs (" IOMSG=", dumpfile
);
2019 show_expr (dt
->iomsg
);
2023 fputs (" IOSTAT=", dumpfile
);
2024 show_expr (dt
->iostat
);
2028 fputs (" SIZE=", dumpfile
);
2029 show_expr (dt
->size
);
2033 fputs (" REC=", dumpfile
);
2034 show_expr (dt
->rec
);
2038 fputs (" ADVANCE=", dumpfile
);
2039 show_expr (dt
->advance
);
2043 fputs (" ID=", dumpfile
);
2048 fputs (" POS=", dumpfile
);
2049 show_expr (dt
->pos
);
2051 if (dt
->asynchronous
)
2053 fputs (" ASYNCHRONOUS=", dumpfile
);
2054 show_expr (dt
->asynchronous
);
2058 fputs (" BLANK=", dumpfile
);
2059 show_expr (dt
->blank
);
2063 fputs (" DECIMAL=", dumpfile
);
2064 show_expr (dt
->decimal
);
2068 fputs (" DELIM=", dumpfile
);
2069 show_expr (dt
->delim
);
2073 fputs (" PAD=", dumpfile
);
2074 show_expr (dt
->pad
);
2078 fputs (" ROUND=", dumpfile
);
2079 show_expr (dt
->round
);
2083 fputs (" SIGN=", dumpfile
);
2084 show_expr (dt
->sign
);
2088 for (c
= c
->block
->next
; c
; c
= c
->next
)
2089 show_code_node (level
+ (c
->next
!= NULL
), c
);
2093 fputs ("TRANSFER ", dumpfile
);
2094 show_expr (c
->expr1
);
2098 fputs ("DT_END", dumpfile
);
2101 if (dt
->err
!= NULL
)
2102 fprintf (dumpfile
, " ERR=%d", dt
->err
->value
);
2103 if (dt
->end
!= NULL
)
2104 fprintf (dumpfile
, " END=%d", dt
->end
->value
);
2105 if (dt
->eor
!= NULL
)
2106 fprintf (dumpfile
, " EOR=%d", dt
->eor
->value
);
2109 case EXEC_OMP_ATOMIC
:
2110 case EXEC_OMP_BARRIER
:
2111 case EXEC_OMP_CRITICAL
:
2112 case EXEC_OMP_FLUSH
:
2114 case EXEC_OMP_MASTER
:
2115 case EXEC_OMP_ORDERED
:
2116 case EXEC_OMP_PARALLEL
:
2117 case EXEC_OMP_PARALLEL_DO
:
2118 case EXEC_OMP_PARALLEL_SECTIONS
:
2119 case EXEC_OMP_PARALLEL_WORKSHARE
:
2120 case EXEC_OMP_SECTIONS
:
2121 case EXEC_OMP_SINGLE
:
2123 case EXEC_OMP_TASKWAIT
:
2124 case EXEC_OMP_WORKSHARE
:
2125 show_omp_node (level
, c
);
2129 gfc_internal_error ("show_code_node(): Bad statement code");
2134 /* Show an equivalence chain. */
2137 show_equiv (gfc_equiv
*eq
)
2140 fputs ("Equivalence: ", dumpfile
);
2143 show_expr (eq
->expr
);
2146 fputs (", ", dumpfile
);
2151 /* Show a freakin' whole namespace. */
2154 show_namespace (gfc_namespace
*ns
)
2156 gfc_interface
*intr
;
2157 gfc_namespace
*save
;
2162 save
= gfc_current_ns
;
2165 fputs ("Namespace:", dumpfile
);
2173 while (i
< GFC_LETTERS
- 1
2174 && gfc_compare_types(&ns
->default_type
[i
+1],
2175 &ns
->default_type
[l
]))
2179 fprintf (dumpfile
, " %c-%c: ", l
+'A', i
+'A');
2181 fprintf (dumpfile
, " %c: ", l
+'A');
2183 show_typespec(&ns
->default_type
[l
]);
2185 } while (i
< GFC_LETTERS
);
2187 if (ns
->proc_name
!= NULL
)
2190 fprintf (dumpfile
, "procedure name = %s", ns
->proc_name
->name
);
2194 gfc_current_ns
= ns
;
2195 gfc_traverse_symtree (ns
->common_root
, show_common
);
2197 gfc_traverse_symtree (ns
->sym_root
, show_symtree
);
2199 for (op
= GFC_INTRINSIC_BEGIN
; op
!= GFC_INTRINSIC_END
; op
++)
2201 /* User operator interfaces */
2207 fprintf (dumpfile
, "Operator interfaces for %s:",
2208 gfc_op2string ((gfc_intrinsic_op
) op
));
2210 for (; intr
; intr
= intr
->next
)
2211 fprintf (dumpfile
, " %s", intr
->sym
->name
);
2214 if (ns
->uop_root
!= NULL
)
2217 fputs ("User operators:\n", dumpfile
);
2218 gfc_traverse_user_op (ns
, show_uop
);
2224 for (eq
= ns
->equiv
; eq
; eq
= eq
->next
)
2227 fputc ('\n', dumpfile
);
2229 fputs ("code:", dumpfile
);
2230 show_code (show_level
, ns
->code
);
2233 for (ns
= ns
->contained
; ns
; ns
= ns
->sibling
)
2235 fputs ("\nCONTAINS\n", dumpfile
);
2237 show_namespace (ns
);
2241 fputc ('\n', dumpfile
);
2242 gfc_current_ns
= save
;
2246 /* Main function for dumping a parse tree. */
2249 gfc_dump_parse_tree (gfc_namespace
*ns
, FILE *file
)
2252 show_namespace (ns
);