2 Copyright (C) 2003-2017 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
);
50 static void show_code (int, gfc_code
*);
53 /* Allow dumping of an expression in the debugger. */
54 void gfc_debug_expr (gfc_expr
*);
57 gfc_debug_expr (gfc_expr
*e
)
62 fputc ('\n', dumpfile
);
66 /* Allow for dumping of a piece of code in the debugger. */
67 void gfc_debug_code (gfc_code
*c
);
70 gfc_debug_code (gfc_code
*c
)
75 fputc ('\n', dumpfile
);
79 /* Do indentation for a specific level. */
82 code_indent (int level
, gfc_st_label
*label
)
87 fprintf (dumpfile
, "%-5d ", label
->value
);
89 for (i
= 0; i
< (2 * level
- (label
? 6 : 0)); i
++)
90 fputc (' ', dumpfile
);
94 /* Simple indentation at the current level. This one
95 is used to show symbols. */
100 fputc ('\n', dumpfile
);
101 code_indent (show_level
, NULL
);
105 /* Show type-specific information. */
108 show_typespec (gfc_typespec
*ts
)
110 if (ts
->type
== BT_ASSUMED
)
112 fputs ("(TYPE(*))", dumpfile
);
116 fprintf (dumpfile
, "(%s ", gfc_basic_typename (ts
->type
));
123 fprintf (dumpfile
, "%s", ts
->u
.derived
->name
);
128 show_expr (ts
->u
.cl
->length
);
129 fprintf(dumpfile
, " %d", ts
->kind
);
133 fprintf (dumpfile
, "%d", ts
->kind
);
136 if (ts
->is_c_interop
)
137 fputs (" C_INTEROP", dumpfile
);
140 fputs (" ISO_C", dumpfile
);
143 fputs (" DEFERRED", dumpfile
);
145 fputc (')', dumpfile
);
149 /* Show an actual argument list. */
152 show_actual_arglist (gfc_actual_arglist
*a
)
154 fputc ('(', dumpfile
);
156 for (; a
; a
= a
->next
)
158 fputc ('(', dumpfile
);
160 fprintf (dumpfile
, "%s = ", a
->name
);
164 fputs ("(arg not-present)", dumpfile
);
166 fputc (')', dumpfile
);
168 fputc (' ', dumpfile
);
171 fputc (')', dumpfile
);
175 /* Show a gfc_array_spec array specification structure. */
178 show_array_spec (gfc_array_spec
*as
)
185 fputs ("()", dumpfile
);
189 fprintf (dumpfile
, "(%d [%d]", as
->rank
, as
->corank
);
191 if (as
->rank
+ as
->corank
> 0 || as
->rank
== -1)
195 case AS_EXPLICIT
: c
= "AS_EXPLICIT"; break;
196 case AS_DEFERRED
: c
= "AS_DEFERRED"; break;
197 case AS_ASSUMED_SIZE
: c
= "AS_ASSUMED_SIZE"; break;
198 case AS_ASSUMED_SHAPE
: c
= "AS_ASSUMED_SHAPE"; break;
199 case AS_ASSUMED_RANK
: c
= "AS_ASSUMED_RANK"; break;
201 gfc_internal_error ("show_array_spec(): Unhandled array shape "
204 fprintf (dumpfile
, " %s ", c
);
206 for (i
= 0; i
< as
->rank
+ as
->corank
; i
++)
208 show_expr (as
->lower
[i
]);
209 fputc (' ', dumpfile
);
210 show_expr (as
->upper
[i
]);
211 fputc (' ', dumpfile
);
215 fputc (')', dumpfile
);
219 /* Show a gfc_array_ref array reference structure. */
222 show_array_ref (gfc_array_ref
* ar
)
226 fputc ('(', dumpfile
);
231 fputs ("FULL", dumpfile
);
235 for (i
= 0; i
< ar
->dimen
; i
++)
237 /* There are two types of array sections: either the
238 elements are identified by an integer array ('vector'),
239 or by an index range. In the former case we only have to
240 print the start expression which contains the vector, in
241 the latter case we have to print any of lower and upper
242 bound and the stride, if they're present. */
244 if (ar
->start
[i
] != NULL
)
245 show_expr (ar
->start
[i
]);
247 if (ar
->dimen_type
[i
] == DIMEN_RANGE
)
249 fputc (':', dumpfile
);
251 if (ar
->end
[i
] != NULL
)
252 show_expr (ar
->end
[i
]);
254 if (ar
->stride
[i
] != NULL
)
256 fputc (':', dumpfile
);
257 show_expr (ar
->stride
[i
]);
261 if (i
!= ar
->dimen
- 1)
262 fputs (" , ", dumpfile
);
267 for (i
= 0; i
< ar
->dimen
; i
++)
269 show_expr (ar
->start
[i
]);
270 if (i
!= ar
->dimen
- 1)
271 fputs (" , ", dumpfile
);
276 fputs ("UNKNOWN", dumpfile
);
280 gfc_internal_error ("show_array_ref(): Unknown array reference");
283 fputc (')', dumpfile
);
287 /* Show a list of gfc_ref structures. */
290 show_ref (gfc_ref
*p
)
292 for (; p
; p
= p
->next
)
296 show_array_ref (&p
->u
.ar
);
300 fprintf (dumpfile
, " %% %s", p
->u
.c
.component
->name
);
304 fputc ('(', dumpfile
);
305 show_expr (p
->u
.ss
.start
);
306 fputc (':', dumpfile
);
307 show_expr (p
->u
.ss
.end
);
308 fputc (')', dumpfile
);
312 gfc_internal_error ("show_ref(): Bad component code");
317 /* Display a constructor. Works recursively for array constructors. */
320 show_constructor (gfc_constructor_base base
)
323 for (c
= gfc_constructor_first (base
); c
; c
= gfc_constructor_next (c
))
325 if (c
->iterator
== NULL
)
329 fputc ('(', dumpfile
);
332 fputc (' ', dumpfile
);
333 show_expr (c
->iterator
->var
);
334 fputc ('=', dumpfile
);
335 show_expr (c
->iterator
->start
);
336 fputc (',', dumpfile
);
337 show_expr (c
->iterator
->end
);
338 fputc (',', dumpfile
);
339 show_expr (c
->iterator
->step
);
341 fputc (')', dumpfile
);
344 if (gfc_constructor_next (c
) != NULL
)
345 fputs (" , ", dumpfile
);
351 show_char_const (const gfc_char_t
*c
, int length
)
355 fputc ('\'', dumpfile
);
356 for (i
= 0; i
< length
; i
++)
359 fputs ("''", dumpfile
);
361 fputs (gfc_print_wide_char (c
[i
]), dumpfile
);
363 fputc ('\'', dumpfile
);
367 /* Show a component-call expression. */
370 show_compcall (gfc_expr
* p
)
372 gcc_assert (p
->expr_type
== EXPR_COMPCALL
);
374 fprintf (dumpfile
, "%s", p
->symtree
->n
.sym
->name
);
376 fprintf (dumpfile
, "%s", p
->value
.compcall
.name
);
378 show_actual_arglist (p
->value
.compcall
.actual
);
382 /* Show an expression. */
385 show_expr (gfc_expr
*p
)
392 fputs ("()", dumpfile
);
396 switch (p
->expr_type
)
399 show_char_const (p
->value
.character
.string
, p
->value
.character
.length
);
404 fprintf (dumpfile
, "%s(", p
->ts
.u
.derived
->name
);
405 show_constructor (p
->value
.constructor
);
406 fputc (')', dumpfile
);
410 fputs ("(/ ", dumpfile
);
411 show_constructor (p
->value
.constructor
);
412 fputs (" /)", dumpfile
);
418 fputs ("NULL()", dumpfile
);
425 mpz_out_str (stdout
, 10, p
->value
.integer
);
427 if (p
->ts
.kind
!= gfc_default_integer_kind
)
428 fprintf (dumpfile
, "_%d", p
->ts
.kind
);
432 if (p
->value
.logical
)
433 fputs (".true.", dumpfile
);
435 fputs (".false.", dumpfile
);
439 mpfr_out_str (stdout
, 10, 0, p
->value
.real
, GFC_RND_MODE
);
440 if (p
->ts
.kind
!= gfc_default_real_kind
)
441 fprintf (dumpfile
, "_%d", p
->ts
.kind
);
445 show_char_const (p
->value
.character
.string
,
446 p
->value
.character
.length
);
450 fputs ("(complex ", dumpfile
);
452 mpfr_out_str (stdout
, 10, 0, mpc_realref (p
->value
.complex),
454 if (p
->ts
.kind
!= gfc_default_complex_kind
)
455 fprintf (dumpfile
, "_%d", p
->ts
.kind
);
457 fputc (' ', dumpfile
);
459 mpfr_out_str (stdout
, 10, 0, mpc_imagref (p
->value
.complex),
461 if (p
->ts
.kind
!= gfc_default_complex_kind
)
462 fprintf (dumpfile
, "_%d", p
->ts
.kind
);
464 fputc (')', dumpfile
);
468 fprintf (dumpfile
, "%dH", p
->representation
.length
);
469 c
= p
->representation
.string
;
470 for (i
= 0; i
< p
->representation
.length
; i
++, c
++)
472 fputc (*c
, dumpfile
);
477 fputs ("???", dumpfile
);
481 if (p
->representation
.string
)
483 fputs (" {", dumpfile
);
484 c
= p
->representation
.string
;
485 for (i
= 0; i
< p
->representation
.length
; i
++, c
++)
487 fprintf (dumpfile
, "%.2x", (unsigned int) *c
);
488 if (i
< p
->representation
.length
- 1)
489 fputc (',', dumpfile
);
491 fputc ('}', dumpfile
);
497 if (p
->symtree
->n
.sym
->ns
&& p
->symtree
->n
.sym
->ns
->proc_name
)
498 fprintf (dumpfile
, "%s:", p
->symtree
->n
.sym
->ns
->proc_name
->name
);
499 fprintf (dumpfile
, "%s", p
->symtree
->n
.sym
->name
);
504 fputc ('(', dumpfile
);
505 switch (p
->value
.op
.op
)
507 case INTRINSIC_UPLUS
:
508 fputs ("U+ ", dumpfile
);
510 case INTRINSIC_UMINUS
:
511 fputs ("U- ", dumpfile
);
514 fputs ("+ ", dumpfile
);
516 case INTRINSIC_MINUS
:
517 fputs ("- ", dumpfile
);
519 case INTRINSIC_TIMES
:
520 fputs ("* ", dumpfile
);
522 case INTRINSIC_DIVIDE
:
523 fputs ("/ ", dumpfile
);
525 case INTRINSIC_POWER
:
526 fputs ("** ", dumpfile
);
528 case INTRINSIC_CONCAT
:
529 fputs ("// ", dumpfile
);
532 fputs ("AND ", dumpfile
);
535 fputs ("OR ", dumpfile
);
538 fputs ("EQV ", dumpfile
);
541 fputs ("NEQV ", dumpfile
);
544 case INTRINSIC_EQ_OS
:
545 fputs ("= ", dumpfile
);
548 case INTRINSIC_NE_OS
:
549 fputs ("/= ", dumpfile
);
552 case INTRINSIC_GT_OS
:
553 fputs ("> ", dumpfile
);
556 case INTRINSIC_GE_OS
:
557 fputs (">= ", dumpfile
);
560 case INTRINSIC_LT_OS
:
561 fputs ("< ", dumpfile
);
564 case INTRINSIC_LE_OS
:
565 fputs ("<= ", dumpfile
);
568 fputs ("NOT ", dumpfile
);
570 case INTRINSIC_PARENTHESES
:
571 fputs ("parens ", dumpfile
);
576 ("show_expr(): Bad intrinsic in expression!");
579 show_expr (p
->value
.op
.op1
);
583 fputc (' ', dumpfile
);
584 show_expr (p
->value
.op
.op2
);
587 fputc (')', dumpfile
);
591 if (p
->value
.function
.name
== NULL
)
593 fprintf (dumpfile
, "%s", p
->symtree
->n
.sym
->name
);
594 if (gfc_is_proc_ptr_comp (p
))
596 fputc ('[', dumpfile
);
597 show_actual_arglist (p
->value
.function
.actual
);
598 fputc (']', dumpfile
);
602 fprintf (dumpfile
, "%s", p
->value
.function
.name
);
603 if (gfc_is_proc_ptr_comp (p
))
605 fputc ('[', dumpfile
);
606 fputc ('[', dumpfile
);
607 show_actual_arglist (p
->value
.function
.actual
);
608 fputc (']', dumpfile
);
609 fputc (']', dumpfile
);
619 gfc_internal_error ("show_expr(): Don't know how to show expr");
623 /* Show symbol attributes. The flavor and intent are followed by
624 whatever single bit attributes are present. */
627 show_attr (symbol_attribute
*attr
, const char * module
)
629 if (attr
->flavor
!= FL_UNKNOWN
)
630 fprintf (dumpfile
, "(%s ", gfc_code2string (flavors
, attr
->flavor
));
631 if (attr
->access
!= ACCESS_UNKNOWN
)
632 fprintf (dumpfile
, "%s ", gfc_code2string (access_types
, attr
->access
));
633 if (attr
->proc
!= PROC_UNKNOWN
)
634 fprintf (dumpfile
, "%s ", gfc_code2string (procedures
, attr
->proc
));
635 if (attr
->save
!= SAVE_NONE
)
636 fprintf (dumpfile
, "%s", gfc_code2string (save_status
, attr
->save
));
638 if (attr
->artificial
)
639 fputs (" ARTIFICIAL", dumpfile
);
640 if (attr
->allocatable
)
641 fputs (" ALLOCATABLE", dumpfile
);
642 if (attr
->asynchronous
)
643 fputs (" ASYNCHRONOUS", dumpfile
);
644 if (attr
->codimension
)
645 fputs (" CODIMENSION", dumpfile
);
647 fputs (" DIMENSION", dumpfile
);
648 if (attr
->contiguous
)
649 fputs (" CONTIGUOUS", dumpfile
);
651 fputs (" EXTERNAL", dumpfile
);
653 fputs (" INTRINSIC", dumpfile
);
655 fputs (" OPTIONAL", dumpfile
);
657 fputs (" POINTER", dumpfile
);
658 if (attr
->is_protected
)
659 fputs (" PROTECTED", dumpfile
);
661 fputs (" VALUE", dumpfile
);
663 fputs (" VOLATILE", dumpfile
);
664 if (attr
->threadprivate
)
665 fputs (" THREADPRIVATE", dumpfile
);
667 fputs (" TARGET", dumpfile
);
670 fputs (" DUMMY", dumpfile
);
671 if (attr
->intent
!= INTENT_UNKNOWN
)
672 fprintf (dumpfile
, "(%s)", gfc_intent_string (attr
->intent
));
676 fputs (" RESULT", dumpfile
);
678 fputs (" ENTRY", dumpfile
);
680 fputs (" BIND(C)", dumpfile
);
683 fputs (" DATA", dumpfile
);
686 fputs (" USE-ASSOC", dumpfile
);
688 fprintf (dumpfile
, "(%s)", module
);
691 if (attr
->in_namelist
)
692 fputs (" IN-NAMELIST", dumpfile
);
694 fputs (" IN-COMMON", dumpfile
);
697 fputs (" ABSTRACT", dumpfile
);
699 fputs (" FUNCTION", dumpfile
);
700 if (attr
->subroutine
)
701 fputs (" SUBROUTINE", dumpfile
);
702 if (attr
->implicit_type
)
703 fputs (" IMPLICIT-TYPE", dumpfile
);
706 fputs (" SEQUENCE", dumpfile
);
708 fputs (" ELEMENTAL", dumpfile
);
710 fputs (" PURE", dumpfile
);
712 fputs (" RECURSIVE", dumpfile
);
714 fputc (')', dumpfile
);
718 /* Show components of a derived type. */
721 show_components (gfc_symbol
*sym
)
725 for (c
= sym
->components
; c
; c
= c
->next
)
727 fprintf (dumpfile
, "(%s ", c
->name
);
728 show_typespec (&c
->ts
);
729 if (c
->attr
.allocatable
)
730 fputs (" ALLOCATABLE", dumpfile
);
732 fputs (" POINTER", dumpfile
);
733 if (c
->attr
.proc_pointer
)
734 fputs (" PPC", dumpfile
);
735 if (c
->attr
.dimension
)
736 fputs (" DIMENSION", dumpfile
);
737 fputc (' ', dumpfile
);
738 show_array_spec (c
->as
);
740 fprintf (dumpfile
, " %s", gfc_code2string (access_types
, c
->attr
.access
));
741 fputc (')', dumpfile
);
743 fputc (' ', dumpfile
);
748 /* Show the f2k_derived namespace with procedure bindings. */
751 show_typebound_proc (gfc_typebound_proc
* tb
, const char* name
)
756 fputs ("GENERIC", dumpfile
);
759 fputs ("PROCEDURE, ", dumpfile
);
761 fputs ("NOPASS", dumpfile
);
765 fprintf (dumpfile
, "PASS(%s)", tb
->pass_arg
);
767 fputs ("PASS", dumpfile
);
769 if (tb
->non_overridable
)
770 fputs (", NON_OVERRIDABLE", dumpfile
);
773 if (tb
->access
== ACCESS_PUBLIC
)
774 fputs (", PUBLIC", dumpfile
);
776 fputs (", PRIVATE", dumpfile
);
778 fprintf (dumpfile
, " :: %s => ", name
);
783 for (g
= tb
->u
.generic
; g
; g
= g
->next
)
785 fputs (g
->specific_st
->name
, dumpfile
);
787 fputs (", ", dumpfile
);
791 fputs (tb
->u
.specific
->n
.sym
->name
, dumpfile
);
795 show_typebound_symtree (gfc_symtree
* st
)
797 gcc_assert (st
->n
.tb
);
798 show_typebound_proc (st
->n
.tb
, st
->name
);
802 show_f2k_derived (gfc_namespace
* f2k
)
808 fputs ("Procedure bindings:", dumpfile
);
811 /* Finalizer bindings. */
812 for (f
= f2k
->finalizers
; f
; f
= f
->next
)
815 fprintf (dumpfile
, "FINAL %s", f
->proc_tree
->n
.sym
->name
);
818 /* Type-bound procedures. */
819 gfc_traverse_symtree (f2k
->tb_sym_root
, &show_typebound_symtree
);
824 fputs ("Operator bindings:", dumpfile
);
827 /* User-defined operators. */
828 gfc_traverse_symtree (f2k
->tb_uop_root
, &show_typebound_symtree
);
830 /* Intrinsic operators. */
831 for (op
= GFC_INTRINSIC_BEGIN
; op
!= GFC_INTRINSIC_END
; ++op
)
833 show_typebound_proc (f2k
->tb_op
[op
],
834 gfc_op2string ((gfc_intrinsic_op
) op
));
840 /* Show a symbol. If a symbol is an ENTRY, SUBROUTINE or FUNCTION, we
841 show the interface. Information needed to reconstruct the list of
842 specific interfaces associated with a generic symbol is done within
846 show_symbol (gfc_symbol
*sym
)
848 gfc_formal_arglist
*formal
;
855 fprintf (dumpfile
, "|| symbol: '%s' ", sym
->name
);
856 len
= strlen (sym
->name
);
857 for (i
=len
; i
<12; i
++)
858 fputc(' ', dumpfile
);
863 fputs ("type spec : ", dumpfile
);
864 show_typespec (&sym
->ts
);
867 fputs ("attributes: ", dumpfile
);
868 show_attr (&sym
->attr
, sym
->module
);
873 fputs ("value: ", dumpfile
);
874 show_expr (sym
->value
);
880 fputs ("Array spec:", dumpfile
);
881 show_array_spec (sym
->as
);
887 fputs ("Generic interfaces:", dumpfile
);
888 for (intr
= sym
->generic
; intr
; intr
= intr
->next
)
889 fprintf (dumpfile
, " %s", intr
->sym
->name
);
895 fprintf (dumpfile
, "result: %s", sym
->result
->name
);
901 fputs ("components: ", dumpfile
);
902 show_components (sym
);
905 if (sym
->f2k_derived
)
909 fprintf (dumpfile
, "hash: %d", sym
->hash_value
);
910 show_f2k_derived (sym
->f2k_derived
);
916 fputs ("Formal arglist:", dumpfile
);
918 for (formal
= sym
->formal
; formal
; formal
= formal
->next
)
920 if (formal
->sym
!= NULL
)
921 fprintf (dumpfile
, " %s", formal
->sym
->name
);
923 fputs (" [Alt Return]", dumpfile
);
927 if (sym
->formal_ns
&& (sym
->formal_ns
->proc_name
!= sym
)
928 && sym
->attr
.proc
!= PROC_ST_FUNCTION
932 fputs ("Formal namespace", dumpfile
);
933 show_namespace (sym
->formal_ns
);
939 /* Show a user-defined operator. Just prints an operator
940 and the name of the associated subroutine, really. */
943 show_uop (gfc_user_op
*uop
)
948 fprintf (dumpfile
, "%s:", uop
->name
);
950 for (intr
= uop
->op
; intr
; intr
= intr
->next
)
951 fprintf (dumpfile
, " %s", intr
->sym
->name
);
955 /* Workhorse function for traversing the user operator symtree. */
958 traverse_uop (gfc_symtree
*st
, void (*func
) (gfc_user_op
*))
965 traverse_uop (st
->left
, func
);
966 traverse_uop (st
->right
, func
);
970 /* Traverse the tree of user operator nodes. */
973 gfc_traverse_user_op (gfc_namespace
*ns
, void (*func
) (gfc_user_op
*))
975 traverse_uop (ns
->uop_root
, func
);
979 /* Function to display a common block. */
982 show_common (gfc_symtree
*st
)
987 fprintf (dumpfile
, "common: /%s/ ", st
->name
);
989 s
= st
->n
.common
->head
;
992 fprintf (dumpfile
, "%s", s
->name
);
995 fputs (", ", dumpfile
);
997 fputc ('\n', dumpfile
);
1001 /* Worker function to display the symbol tree. */
1004 show_symtree (gfc_symtree
*st
)
1010 len
= strlen(st
->name
);
1011 fprintf (dumpfile
, "symtree: '%s'", st
->name
);
1013 for (i
=len
; i
<12; i
++)
1014 fputc(' ', dumpfile
);
1017 fputs( " Ambiguous", dumpfile
);
1019 if (st
->n
.sym
->ns
!= gfc_current_ns
)
1020 fprintf (dumpfile
, "|| symbol: '%s' from namespace '%s'", st
->n
.sym
->name
,
1021 st
->n
.sym
->ns
->proc_name
->name
);
1023 show_symbol (st
->n
.sym
);
1027 /******************* Show gfc_code structures **************/
1030 /* Show a list of code structures. Mutually recursive with
1031 show_code_node(). */
1034 show_code (int level
, gfc_code
*c
)
1036 for (; c
; c
= c
->next
)
1037 show_code_node (level
, c
);
1041 show_omp_namelist (int list_type
, gfc_omp_namelist
*n
)
1043 for (; n
; n
= n
->next
)
1045 if (list_type
== OMP_LIST_REDUCTION
)
1046 switch (n
->u
.reduction_op
)
1048 case OMP_REDUCTION_PLUS
:
1049 case OMP_REDUCTION_TIMES
:
1050 case OMP_REDUCTION_MINUS
:
1051 case OMP_REDUCTION_AND
:
1052 case OMP_REDUCTION_OR
:
1053 case OMP_REDUCTION_EQV
:
1054 case OMP_REDUCTION_NEQV
:
1055 fprintf (dumpfile
, "%s:",
1056 gfc_op2string ((gfc_intrinsic_op
) n
->u
.reduction_op
));
1058 case OMP_REDUCTION_MAX
: fputs ("max:", dumpfile
); break;
1059 case OMP_REDUCTION_MIN
: fputs ("min:", dumpfile
); break;
1060 case OMP_REDUCTION_IAND
: fputs ("iand:", dumpfile
); break;
1061 case OMP_REDUCTION_IOR
: fputs ("ior:", dumpfile
); break;
1062 case OMP_REDUCTION_IEOR
: fputs ("ieor:", dumpfile
); break;
1063 case OMP_REDUCTION_USER
:
1065 fprintf (dumpfile
, "%s:", n
->udr
->udr
->name
);
1069 else if (list_type
== OMP_LIST_DEPEND
)
1070 switch (n
->u
.depend_op
)
1072 case OMP_DEPEND_IN
: fputs ("in:", dumpfile
); break;
1073 case OMP_DEPEND_OUT
: fputs ("out:", dumpfile
); break;
1074 case OMP_DEPEND_INOUT
: fputs ("inout:", dumpfile
); break;
1075 case OMP_DEPEND_SINK_FIRST
:
1076 fputs ("sink:", dumpfile
);
1079 fprintf (dumpfile
, "%s", n
->sym
->name
);
1082 fputc ('+', dumpfile
);
1083 show_expr (n
->expr
);
1085 if (n
->next
== NULL
)
1087 else if (n
->next
->u
.depend_op
!= OMP_DEPEND_SINK
)
1089 fputs (") DEPEND(", dumpfile
);
1092 fputc (',', dumpfile
);
1098 else if (list_type
== OMP_LIST_MAP
)
1099 switch (n
->u
.map_op
)
1101 case OMP_MAP_ALLOC
: fputs ("alloc:", dumpfile
); break;
1102 case OMP_MAP_TO
: fputs ("to:", dumpfile
); break;
1103 case OMP_MAP_FROM
: fputs ("from:", dumpfile
); break;
1104 case OMP_MAP_TOFROM
: fputs ("tofrom:", dumpfile
); break;
1107 else if (list_type
== OMP_LIST_LINEAR
)
1108 switch (n
->u
.linear_op
)
1110 case OMP_LINEAR_REF
: fputs ("ref(", dumpfile
); break;
1111 case OMP_LINEAR_VAL
: fputs ("val(", dumpfile
); break;
1112 case OMP_LINEAR_UVAL
: fputs ("uval(", dumpfile
); break;
1115 fprintf (dumpfile
, "%s", n
->sym
->name
);
1116 if (list_type
== OMP_LIST_LINEAR
&& n
->u
.linear_op
!= OMP_LINEAR_DEFAULT
)
1117 fputc (')', dumpfile
);
1120 fputc (':', dumpfile
);
1121 show_expr (n
->expr
);
1124 fputc (',', dumpfile
);
1129 /* Show OpenMP or OpenACC clauses. */
1132 show_omp_clauses (gfc_omp_clauses
*omp_clauses
)
1136 switch (omp_clauses
->cancel
)
1138 case OMP_CANCEL_UNKNOWN
:
1140 case OMP_CANCEL_PARALLEL
:
1141 fputs (" PARALLEL", dumpfile
);
1143 case OMP_CANCEL_SECTIONS
:
1144 fputs (" SECTIONS", dumpfile
);
1147 fputs (" DO", dumpfile
);
1149 case OMP_CANCEL_TASKGROUP
:
1150 fputs (" TASKGROUP", dumpfile
);
1153 if (omp_clauses
->if_expr
)
1155 fputs (" IF(", dumpfile
);
1156 show_expr (omp_clauses
->if_expr
);
1157 fputc (')', dumpfile
);
1159 if (omp_clauses
->final_expr
)
1161 fputs (" FINAL(", dumpfile
);
1162 show_expr (omp_clauses
->final_expr
);
1163 fputc (')', dumpfile
);
1165 if (omp_clauses
->num_threads
)
1167 fputs (" NUM_THREADS(", dumpfile
);
1168 show_expr (omp_clauses
->num_threads
);
1169 fputc (')', dumpfile
);
1171 if (omp_clauses
->async
)
1173 fputs (" ASYNC", dumpfile
);
1174 if (omp_clauses
->async_expr
)
1176 fputc ('(', dumpfile
);
1177 show_expr (omp_clauses
->async_expr
);
1178 fputc (')', dumpfile
);
1181 if (omp_clauses
->num_gangs_expr
)
1183 fputs (" NUM_GANGS(", dumpfile
);
1184 show_expr (omp_clauses
->num_gangs_expr
);
1185 fputc (')', dumpfile
);
1187 if (omp_clauses
->num_workers_expr
)
1189 fputs (" NUM_WORKERS(", dumpfile
);
1190 show_expr (omp_clauses
->num_workers_expr
);
1191 fputc (')', dumpfile
);
1193 if (omp_clauses
->vector_length_expr
)
1195 fputs (" VECTOR_LENGTH(", dumpfile
);
1196 show_expr (omp_clauses
->vector_length_expr
);
1197 fputc (')', dumpfile
);
1199 if (omp_clauses
->gang
)
1201 fputs (" GANG", dumpfile
);
1202 if (omp_clauses
->gang_num_expr
|| omp_clauses
->gang_static_expr
)
1204 fputc ('(', dumpfile
);
1205 if (omp_clauses
->gang_num_expr
)
1207 fprintf (dumpfile
, "num:");
1208 show_expr (omp_clauses
->gang_num_expr
);
1210 if (omp_clauses
->gang_num_expr
&& omp_clauses
->gang_static
)
1211 fputc (',', dumpfile
);
1212 if (omp_clauses
->gang_static
)
1214 fprintf (dumpfile
, "static:");
1215 if (omp_clauses
->gang_static_expr
)
1216 show_expr (omp_clauses
->gang_static_expr
);
1218 fputc ('*', dumpfile
);
1220 fputc (')', dumpfile
);
1223 if (omp_clauses
->worker
)
1225 fputs (" WORKER", dumpfile
);
1226 if (omp_clauses
->worker_expr
)
1228 fputc ('(', dumpfile
);
1229 show_expr (omp_clauses
->worker_expr
);
1230 fputc (')', dumpfile
);
1233 if (omp_clauses
->vector
)
1235 fputs (" VECTOR", dumpfile
);
1236 if (omp_clauses
->vector_expr
)
1238 fputc ('(', dumpfile
);
1239 show_expr (omp_clauses
->vector_expr
);
1240 fputc (')', dumpfile
);
1243 if (omp_clauses
->sched_kind
!= OMP_SCHED_NONE
)
1246 switch (omp_clauses
->sched_kind
)
1248 case OMP_SCHED_STATIC
: type
= "STATIC"; break;
1249 case OMP_SCHED_DYNAMIC
: type
= "DYNAMIC"; break;
1250 case OMP_SCHED_GUIDED
: type
= "GUIDED"; break;
1251 case OMP_SCHED_RUNTIME
: type
= "RUNTIME"; break;
1252 case OMP_SCHED_AUTO
: type
= "AUTO"; break;
1256 fputs (" SCHEDULE (", dumpfile
);
1257 if (omp_clauses
->sched_simd
)
1259 if (omp_clauses
->sched_monotonic
1260 || omp_clauses
->sched_nonmonotonic
)
1261 fputs ("SIMD, ", dumpfile
);
1263 fputs ("SIMD: ", dumpfile
);
1265 if (omp_clauses
->sched_monotonic
)
1266 fputs ("MONOTONIC: ", dumpfile
);
1267 else if (omp_clauses
->sched_nonmonotonic
)
1268 fputs ("NONMONOTONIC: ", dumpfile
);
1269 fputs (type
, dumpfile
);
1270 if (omp_clauses
->chunk_size
)
1272 fputc (',', dumpfile
);
1273 show_expr (omp_clauses
->chunk_size
);
1275 fputc (')', dumpfile
);
1277 if (omp_clauses
->default_sharing
!= OMP_DEFAULT_UNKNOWN
)
1280 switch (omp_clauses
->default_sharing
)
1282 case OMP_DEFAULT_NONE
: type
= "NONE"; break;
1283 case OMP_DEFAULT_PRIVATE
: type
= "PRIVATE"; break;
1284 case OMP_DEFAULT_SHARED
: type
= "SHARED"; break;
1285 case OMP_DEFAULT_FIRSTPRIVATE
: type
= "FIRSTPRIVATE"; break;
1289 fprintf (dumpfile
, " DEFAULT(%s)", type
);
1291 if (omp_clauses
->tile_list
)
1293 gfc_expr_list
*list
;
1294 fputs (" TILE(", dumpfile
);
1295 for (list
= omp_clauses
->tile_list
; list
; list
= list
->next
)
1297 show_expr (list
->expr
);
1299 fputs (", ", dumpfile
);
1301 fputc (')', dumpfile
);
1303 if (omp_clauses
->wait_list
)
1305 gfc_expr_list
*list
;
1306 fputs (" WAIT(", dumpfile
);
1307 for (list
= omp_clauses
->wait_list
; list
; list
= list
->next
)
1309 show_expr (list
->expr
);
1311 fputs (", ", dumpfile
);
1313 fputc (')', dumpfile
);
1315 if (omp_clauses
->seq
)
1316 fputs (" SEQ", dumpfile
);
1317 if (omp_clauses
->independent
)
1318 fputs (" INDEPENDENT", dumpfile
);
1319 if (omp_clauses
->ordered
)
1321 if (omp_clauses
->orderedc
)
1322 fprintf (dumpfile
, " ORDERED(%d)", omp_clauses
->orderedc
);
1324 fputs (" ORDERED", dumpfile
);
1326 if (omp_clauses
->untied
)
1327 fputs (" UNTIED", dumpfile
);
1328 if (omp_clauses
->mergeable
)
1329 fputs (" MERGEABLE", dumpfile
);
1330 if (omp_clauses
->collapse
)
1331 fprintf (dumpfile
, " COLLAPSE(%d)", omp_clauses
->collapse
);
1332 for (list_type
= 0; list_type
< OMP_LIST_NUM
; list_type
++)
1333 if (omp_clauses
->lists
[list_type
] != NULL
1334 && list_type
!= OMP_LIST_COPYPRIVATE
)
1336 const char *type
= NULL
;
1339 case OMP_LIST_USE_DEVICE
: type
= "USE_DEVICE"; break;
1340 case OMP_LIST_DEVICE_RESIDENT
: type
= "USE_DEVICE"; break;
1341 case OMP_LIST_CACHE
: type
= ""; break;
1342 case OMP_LIST_PRIVATE
: type
= "PRIVATE"; break;
1343 case OMP_LIST_FIRSTPRIVATE
: type
= "FIRSTPRIVATE"; break;
1344 case OMP_LIST_LASTPRIVATE
: type
= "LASTPRIVATE"; break;
1345 case OMP_LIST_SHARED
: type
= "SHARED"; break;
1346 case OMP_LIST_COPYIN
: type
= "COPYIN"; break;
1347 case OMP_LIST_UNIFORM
: type
= "UNIFORM"; break;
1348 case OMP_LIST_ALIGNED
: type
= "ALIGNED"; break;
1349 case OMP_LIST_LINEAR
: type
= "LINEAR"; break;
1350 case OMP_LIST_REDUCTION
: type
= "REDUCTION"; break;
1351 case OMP_LIST_IS_DEVICE_PTR
: type
= "IS_DEVICE_PTR"; break;
1352 case OMP_LIST_USE_DEVICE_PTR
: type
= "USE_DEVICE_PTR"; break;
1353 case OMP_LIST_DEPEND
: type
= "DEPEND"; break;
1357 fprintf (dumpfile
, " %s(", type
);
1358 show_omp_namelist (list_type
, omp_clauses
->lists
[list_type
]);
1359 fputc (')', dumpfile
);
1361 if (omp_clauses
->safelen_expr
)
1363 fputs (" SAFELEN(", dumpfile
);
1364 show_expr (omp_clauses
->safelen_expr
);
1365 fputc (')', dumpfile
);
1367 if (omp_clauses
->simdlen_expr
)
1369 fputs (" SIMDLEN(", dumpfile
);
1370 show_expr (omp_clauses
->simdlen_expr
);
1371 fputc (')', dumpfile
);
1373 if (omp_clauses
->inbranch
)
1374 fputs (" INBRANCH", dumpfile
);
1375 if (omp_clauses
->notinbranch
)
1376 fputs (" NOTINBRANCH", dumpfile
);
1377 if (omp_clauses
->proc_bind
!= OMP_PROC_BIND_UNKNOWN
)
1380 switch (omp_clauses
->proc_bind
)
1382 case OMP_PROC_BIND_MASTER
: type
= "MASTER"; break;
1383 case OMP_PROC_BIND_SPREAD
: type
= "SPREAD"; break;
1384 case OMP_PROC_BIND_CLOSE
: type
= "CLOSE"; break;
1388 fprintf (dumpfile
, " PROC_BIND(%s)", type
);
1390 if (omp_clauses
->num_teams
)
1392 fputs (" NUM_TEAMS(", dumpfile
);
1393 show_expr (omp_clauses
->num_teams
);
1394 fputc (')', dumpfile
);
1396 if (omp_clauses
->device
)
1398 fputs (" DEVICE(", dumpfile
);
1399 show_expr (omp_clauses
->device
);
1400 fputc (')', dumpfile
);
1402 if (omp_clauses
->thread_limit
)
1404 fputs (" THREAD_LIMIT(", dumpfile
);
1405 show_expr (omp_clauses
->thread_limit
);
1406 fputc (')', dumpfile
);
1408 if (omp_clauses
->dist_sched_kind
!= OMP_SCHED_NONE
)
1410 fprintf (dumpfile
, " DIST_SCHEDULE (STATIC");
1411 if (omp_clauses
->dist_chunk_size
)
1413 fputc (',', dumpfile
);
1414 show_expr (omp_clauses
->dist_chunk_size
);
1416 fputc (')', dumpfile
);
1418 if (omp_clauses
->defaultmap
)
1419 fputs (" DEFALTMAP (TOFROM: SCALAR)", dumpfile
);
1420 if (omp_clauses
->nogroup
)
1421 fputs (" NOGROUP", dumpfile
);
1422 if (omp_clauses
->simd
)
1423 fputs (" SIMD", dumpfile
);
1424 if (omp_clauses
->threads
)
1425 fputs (" THREADS", dumpfile
);
1426 if (omp_clauses
->grainsize
)
1428 fputs (" GRAINSIZE(", dumpfile
);
1429 show_expr (omp_clauses
->grainsize
);
1430 fputc (')', dumpfile
);
1432 if (omp_clauses
->hint
)
1434 fputs (" HINT(", dumpfile
);
1435 show_expr (omp_clauses
->hint
);
1436 fputc (')', dumpfile
);
1438 if (omp_clauses
->num_tasks
)
1440 fputs (" NUM_TASKS(", dumpfile
);
1441 show_expr (omp_clauses
->num_tasks
);
1442 fputc (')', dumpfile
);
1444 if (omp_clauses
->priority
)
1446 fputs (" PRIORITY(", dumpfile
);
1447 show_expr (omp_clauses
->priority
);
1448 fputc (')', dumpfile
);
1450 for (i
= 0; i
< OMP_IF_LAST
; i
++)
1451 if (omp_clauses
->if_exprs
[i
])
1453 static const char *ifs
[] = {
1460 "TARGET ENTER DATA",
1463 fputs (" IF(", dumpfile
);
1464 fputs (ifs
[i
], dumpfile
);
1465 fputs (": ", dumpfile
);
1466 show_expr (omp_clauses
->if_exprs
[i
]);
1467 fputc (')', dumpfile
);
1469 if (omp_clauses
->depend_source
)
1470 fputs (" DEPEND(source)", dumpfile
);
1473 /* Show a single OpenMP or OpenACC directive node and everything underneath it
1477 show_omp_node (int level
, gfc_code
*c
)
1479 gfc_omp_clauses
*omp_clauses
= NULL
;
1480 const char *name
= NULL
;
1481 bool is_oacc
= false;
1485 case EXEC_OACC_PARALLEL_LOOP
:
1486 name
= "PARALLEL LOOP"; is_oacc
= true; break;
1487 case EXEC_OACC_PARALLEL
: name
= "PARALLEL"; is_oacc
= true; break;
1488 case EXEC_OACC_KERNELS_LOOP
: name
= "KERNELS LOOP"; is_oacc
= true; break;
1489 case EXEC_OACC_KERNELS
: name
= "KERNELS"; is_oacc
= true; break;
1490 case EXEC_OACC_DATA
: name
= "DATA"; is_oacc
= true; break;
1491 case EXEC_OACC_HOST_DATA
: name
= "HOST_DATA"; is_oacc
= true; break;
1492 case EXEC_OACC_LOOP
: name
= "LOOP"; is_oacc
= true; break;
1493 case EXEC_OACC_UPDATE
: name
= "UPDATE"; is_oacc
= true; break;
1494 case EXEC_OACC_WAIT
: name
= "WAIT"; is_oacc
= true; break;
1495 case EXEC_OACC_CACHE
: name
= "CACHE"; is_oacc
= true; break;
1496 case EXEC_OACC_ENTER_DATA
: name
= "ENTER DATA"; is_oacc
= true; break;
1497 case EXEC_OACC_EXIT_DATA
: name
= "EXIT DATA"; is_oacc
= true; break;
1498 case EXEC_OMP_ATOMIC
: name
= "ATOMIC"; break;
1499 case EXEC_OMP_BARRIER
: name
= "BARRIER"; break;
1500 case EXEC_OMP_CANCEL
: name
= "CANCEL"; break;
1501 case EXEC_OMP_CANCELLATION_POINT
: name
= "CANCELLATION POINT"; break;
1502 case EXEC_OMP_CRITICAL
: name
= "CRITICAL"; break;
1503 case EXEC_OMP_DISTRIBUTE
: name
= "DISTRIBUTE"; break;
1504 case EXEC_OMP_DISTRIBUTE_PARALLEL_DO
:
1505 name
= "DISTRIBUTE PARALLEL DO"; break;
1506 case EXEC_OMP_DISTRIBUTE_PARALLEL_DO_SIMD
:
1507 name
= "DISTRIBUTE PARALLEL DO SIMD"; break;
1508 case EXEC_OMP_DISTRIBUTE_SIMD
: name
= "DISTRIBUTE SIMD"; break;
1509 case EXEC_OMP_DO
: name
= "DO"; break;
1510 case EXEC_OMP_DO_SIMD
: name
= "DO SIMD"; break;
1511 case EXEC_OMP_FLUSH
: name
= "FLUSH"; break;
1512 case EXEC_OMP_MASTER
: name
= "MASTER"; break;
1513 case EXEC_OMP_ORDERED
: name
= "ORDERED"; break;
1514 case EXEC_OMP_PARALLEL
: name
= "PARALLEL"; break;
1515 case EXEC_OMP_PARALLEL_DO
: name
= "PARALLEL DO"; break;
1516 case EXEC_OMP_PARALLEL_DO_SIMD
: name
= "PARALLEL DO SIMD"; break;
1517 case EXEC_OMP_PARALLEL_SECTIONS
: name
= "PARALLEL SECTIONS"; break;
1518 case EXEC_OMP_PARALLEL_WORKSHARE
: name
= "PARALLEL WORKSHARE"; break;
1519 case EXEC_OMP_SECTIONS
: name
= "SECTIONS"; break;
1520 case EXEC_OMP_SIMD
: name
= "SIMD"; break;
1521 case EXEC_OMP_SINGLE
: name
= "SINGLE"; break;
1522 case EXEC_OMP_TARGET
: name
= "TARGET"; break;
1523 case EXEC_OMP_TARGET_DATA
: name
= "TARGET DATA"; break;
1524 case EXEC_OMP_TARGET_ENTER_DATA
: name
= "TARGET ENTER DATA"; break;
1525 case EXEC_OMP_TARGET_EXIT_DATA
: name
= "TARGET EXIT DATA"; break;
1526 case EXEC_OMP_TARGET_PARALLEL
: name
= "TARGET PARALLEL"; break;
1527 case EXEC_OMP_TARGET_PARALLEL_DO
: name
= "TARGET PARALLEL DO"; break;
1528 case EXEC_OMP_TARGET_PARALLEL_DO_SIMD
:
1529 name
= "TARGET_PARALLEL_DO_SIMD"; break;
1530 case EXEC_OMP_TARGET_SIMD
: name
= "TARGET SIMD"; break;
1531 case EXEC_OMP_TARGET_TEAMS
: name
= "TARGET TEAMS"; break;
1532 case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE
:
1533 name
= "TARGET TEAMS DISTRIBUTE"; break;
1534 case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO
:
1535 name
= "TARGET TEAMS DISTRIBUTE PARALLEL DO"; break;
1536 case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD
:
1537 name
= "TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD"; break;
1538 case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD
:
1539 name
= "TARGET TEAMS DISTRIBUTE SIMD"; break;
1540 case EXEC_OMP_TARGET_UPDATE
: name
= "TARGET UPDATE"; break;
1541 case EXEC_OMP_TASK
: name
= "TASK"; break;
1542 case EXEC_OMP_TASKGROUP
: name
= "TASKGROUP"; break;
1543 case EXEC_OMP_TASKLOOP
: name
= "TASKLOOP"; break;
1544 case EXEC_OMP_TASKLOOP_SIMD
: name
= "TASKLOOP SIMD"; break;
1545 case EXEC_OMP_TASKWAIT
: name
= "TASKWAIT"; break;
1546 case EXEC_OMP_TASKYIELD
: name
= "TASKYIELD"; break;
1547 case EXEC_OMP_TEAMS
: name
= "TEAMS"; break;
1548 case EXEC_OMP_TEAMS_DISTRIBUTE
: name
= "TEAMS DISTRIBUTE"; break;
1549 case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO
:
1550 name
= "TEAMS DISTRIBUTE PARALLEL DO"; break;
1551 case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD
:
1552 name
= "TEAMS DISTRIBUTE PARALLEL DO SIMD"; break;
1553 case EXEC_OMP_TEAMS_DISTRIBUTE_SIMD
: name
= "TEAMS DISTRIBUTE SIMD"; break;
1554 case EXEC_OMP_WORKSHARE
: name
= "WORKSHARE"; break;
1558 fprintf (dumpfile
, "!$%s %s", is_oacc
? "ACC" : "OMP", name
);
1561 case EXEC_OACC_PARALLEL_LOOP
:
1562 case EXEC_OACC_PARALLEL
:
1563 case EXEC_OACC_KERNELS_LOOP
:
1564 case EXEC_OACC_KERNELS
:
1565 case EXEC_OACC_DATA
:
1566 case EXEC_OACC_HOST_DATA
:
1567 case EXEC_OACC_LOOP
:
1568 case EXEC_OACC_UPDATE
:
1569 case EXEC_OACC_WAIT
:
1570 case EXEC_OACC_CACHE
:
1571 case EXEC_OACC_ENTER_DATA
:
1572 case EXEC_OACC_EXIT_DATA
:
1573 case EXEC_OMP_CANCEL
:
1574 case EXEC_OMP_CANCELLATION_POINT
:
1575 case EXEC_OMP_DISTRIBUTE
:
1576 case EXEC_OMP_DISTRIBUTE_PARALLEL_DO
:
1577 case EXEC_OMP_DISTRIBUTE_PARALLEL_DO_SIMD
:
1578 case EXEC_OMP_DISTRIBUTE_SIMD
:
1580 case EXEC_OMP_DO_SIMD
:
1581 case EXEC_OMP_ORDERED
:
1582 case EXEC_OMP_PARALLEL
:
1583 case EXEC_OMP_PARALLEL_DO
:
1584 case EXEC_OMP_PARALLEL_DO_SIMD
:
1585 case EXEC_OMP_PARALLEL_SECTIONS
:
1586 case EXEC_OMP_PARALLEL_WORKSHARE
:
1587 case EXEC_OMP_SECTIONS
:
1589 case EXEC_OMP_SINGLE
:
1590 case EXEC_OMP_TARGET
:
1591 case EXEC_OMP_TARGET_DATA
:
1592 case EXEC_OMP_TARGET_ENTER_DATA
:
1593 case EXEC_OMP_TARGET_EXIT_DATA
:
1594 case EXEC_OMP_TARGET_PARALLEL
:
1595 case EXEC_OMP_TARGET_PARALLEL_DO
:
1596 case EXEC_OMP_TARGET_PARALLEL_DO_SIMD
:
1597 case EXEC_OMP_TARGET_SIMD
:
1598 case EXEC_OMP_TARGET_TEAMS
:
1599 case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE
:
1600 case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO
:
1601 case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD
:
1602 case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD
:
1603 case EXEC_OMP_TARGET_UPDATE
:
1605 case EXEC_OMP_TASKLOOP
:
1606 case EXEC_OMP_TASKLOOP_SIMD
:
1607 case EXEC_OMP_TEAMS
:
1608 case EXEC_OMP_TEAMS_DISTRIBUTE
:
1609 case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO
:
1610 case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD
:
1611 case EXEC_OMP_TEAMS_DISTRIBUTE_SIMD
:
1612 case EXEC_OMP_WORKSHARE
:
1613 omp_clauses
= c
->ext
.omp_clauses
;
1615 case EXEC_OMP_CRITICAL
:
1616 omp_clauses
= c
->ext
.omp_clauses
;
1618 fprintf (dumpfile
, " (%s)", c
->ext
.omp_clauses
->critical_name
);
1620 case EXEC_OMP_FLUSH
:
1621 if (c
->ext
.omp_namelist
)
1623 fputs (" (", dumpfile
);
1624 show_omp_namelist (OMP_LIST_NUM
, c
->ext
.omp_namelist
);
1625 fputc (')', dumpfile
);
1628 case EXEC_OMP_BARRIER
:
1629 case EXEC_OMP_TASKWAIT
:
1630 case EXEC_OMP_TASKYIELD
:
1636 show_omp_clauses (omp_clauses
);
1637 fputc ('\n', dumpfile
);
1639 /* OpenMP and OpenACC executable directives don't have associated blocks. */
1640 if (c
->op
== EXEC_OACC_CACHE
|| c
->op
== EXEC_OACC_UPDATE
1641 || c
->op
== EXEC_OACC_ENTER_DATA
|| c
->op
== EXEC_OACC_EXIT_DATA
1642 || c
->op
== EXEC_OMP_TARGET_UPDATE
|| c
->op
== EXEC_OMP_TARGET_ENTER_DATA
1643 || c
->op
== EXEC_OMP_TARGET_EXIT_DATA
1644 || (c
->op
== EXEC_OMP_ORDERED
&& c
->block
== NULL
))
1646 if (c
->op
== EXEC_OMP_SECTIONS
|| c
->op
== EXEC_OMP_PARALLEL_SECTIONS
)
1648 gfc_code
*d
= c
->block
;
1651 show_code (level
+ 1, d
->next
);
1652 if (d
->block
== NULL
)
1654 code_indent (level
, 0);
1655 fputs ("!$OMP SECTION\n", dumpfile
);
1660 show_code (level
+ 1, c
->block
->next
);
1661 if (c
->op
== EXEC_OMP_ATOMIC
)
1663 fputc ('\n', dumpfile
);
1664 code_indent (level
, 0);
1665 fprintf (dumpfile
, "!$%s END %s", is_oacc
? "ACC" : "OMP", name
);
1666 if (omp_clauses
!= NULL
)
1668 if (omp_clauses
->lists
[OMP_LIST_COPYPRIVATE
])
1670 fputs (" COPYPRIVATE(", dumpfile
);
1671 show_omp_namelist (OMP_LIST_COPYPRIVATE
,
1672 omp_clauses
->lists
[OMP_LIST_COPYPRIVATE
]);
1673 fputc (')', dumpfile
);
1675 else if (omp_clauses
->nowait
)
1676 fputs (" NOWAIT", dumpfile
);
1678 else if (c
->op
== EXEC_OMP_CRITICAL
&& c
->ext
.omp_clauses
)
1679 fprintf (dumpfile
, " (%s)", c
->ext
.omp_clauses
->critical_name
);
1683 /* Show a single code node and everything underneath it if necessary. */
1686 show_code_node (int level
, gfc_code
*c
)
1688 gfc_forall_iterator
*fa
;
1701 fputc ('\n', dumpfile
);
1702 code_indent (level
, c
->here
);
1709 case EXEC_END_PROCEDURE
:
1713 fputs ("NOP", dumpfile
);
1717 fputs ("CONTINUE", dumpfile
);
1721 fprintf (dumpfile
, "ENTRY %s", c
->ext
.entry
->sym
->name
);
1724 case EXEC_INIT_ASSIGN
:
1726 fputs ("ASSIGN ", dumpfile
);
1727 show_expr (c
->expr1
);
1728 fputc (' ', dumpfile
);
1729 show_expr (c
->expr2
);
1732 case EXEC_LABEL_ASSIGN
:
1733 fputs ("LABEL ASSIGN ", dumpfile
);
1734 show_expr (c
->expr1
);
1735 fprintf (dumpfile
, " %d", c
->label1
->value
);
1738 case EXEC_POINTER_ASSIGN
:
1739 fputs ("POINTER ASSIGN ", dumpfile
);
1740 show_expr (c
->expr1
);
1741 fputc (' ', dumpfile
);
1742 show_expr (c
->expr2
);
1746 fputs ("GOTO ", dumpfile
);
1748 fprintf (dumpfile
, "%d", c
->label1
->value
);
1751 show_expr (c
->expr1
);
1755 fputs (", (", dumpfile
);
1756 for (; d
; d
= d
->block
)
1758 code_indent (level
, d
->label1
);
1759 if (d
->block
!= NULL
)
1760 fputc (',', dumpfile
);
1762 fputc (')', dumpfile
);
1769 case EXEC_ASSIGN_CALL
:
1770 if (c
->resolved_sym
)
1771 fprintf (dumpfile
, "CALL %s ", c
->resolved_sym
->name
);
1772 else if (c
->symtree
)
1773 fprintf (dumpfile
, "CALL %s ", c
->symtree
->name
);
1775 fputs ("CALL ?? ", dumpfile
);
1777 show_actual_arglist (c
->ext
.actual
);
1781 fputs ("CALL ", dumpfile
);
1782 show_compcall (c
->expr1
);
1786 fputs ("CALL ", dumpfile
);
1787 show_expr (c
->expr1
);
1788 show_actual_arglist (c
->ext
.actual
);
1792 fputs ("RETURN ", dumpfile
);
1794 show_expr (c
->expr1
);
1798 fputs ("PAUSE ", dumpfile
);
1800 if (c
->expr1
!= NULL
)
1801 show_expr (c
->expr1
);
1803 fprintf (dumpfile
, "%d", c
->ext
.stop_code
);
1807 case EXEC_ERROR_STOP
:
1808 fputs ("ERROR ", dumpfile
);
1812 fputs ("STOP ", dumpfile
);
1814 if (c
->expr1
!= NULL
)
1815 show_expr (c
->expr1
);
1817 fprintf (dumpfile
, "%d", c
->ext
.stop_code
);
1822 fputs ("SYNC ALL ", dumpfile
);
1823 if (c
->expr2
!= NULL
)
1825 fputs (" stat=", dumpfile
);
1826 show_expr (c
->expr2
);
1828 if (c
->expr3
!= NULL
)
1830 fputs (" errmsg=", dumpfile
);
1831 show_expr (c
->expr3
);
1835 case EXEC_SYNC_MEMORY
:
1836 fputs ("SYNC MEMORY ", dumpfile
);
1837 if (c
->expr2
!= NULL
)
1839 fputs (" stat=", dumpfile
);
1840 show_expr (c
->expr2
);
1842 if (c
->expr3
!= NULL
)
1844 fputs (" errmsg=", dumpfile
);
1845 show_expr (c
->expr3
);
1849 case EXEC_SYNC_IMAGES
:
1850 fputs ("SYNC IMAGES image-set=", dumpfile
);
1851 if (c
->expr1
!= NULL
)
1852 show_expr (c
->expr1
);
1854 fputs ("* ", dumpfile
);
1855 if (c
->expr2
!= NULL
)
1857 fputs (" stat=", dumpfile
);
1858 show_expr (c
->expr2
);
1860 if (c
->expr3
!= NULL
)
1862 fputs (" errmsg=", dumpfile
);
1863 show_expr (c
->expr3
);
1867 case EXEC_EVENT_POST
:
1868 case EXEC_EVENT_WAIT
:
1869 if (c
->op
== EXEC_EVENT_POST
)
1870 fputs ("EVENT POST ", dumpfile
);
1872 fputs ("EVENT WAIT ", dumpfile
);
1874 fputs ("event-variable=", dumpfile
);
1875 if (c
->expr1
!= NULL
)
1876 show_expr (c
->expr1
);
1877 if (c
->expr4
!= NULL
)
1879 fputs (" until_count=", dumpfile
);
1880 show_expr (c
->expr4
);
1882 if (c
->expr2
!= NULL
)
1884 fputs (" stat=", dumpfile
);
1885 show_expr (c
->expr2
);
1887 if (c
->expr3
!= NULL
)
1889 fputs (" errmsg=", dumpfile
);
1890 show_expr (c
->expr3
);
1896 if (c
->op
== EXEC_LOCK
)
1897 fputs ("LOCK ", dumpfile
);
1899 fputs ("UNLOCK ", dumpfile
);
1901 fputs ("lock-variable=", dumpfile
);
1902 if (c
->expr1
!= NULL
)
1903 show_expr (c
->expr1
);
1904 if (c
->expr4
!= NULL
)
1906 fputs (" acquired_lock=", dumpfile
);
1907 show_expr (c
->expr4
);
1909 if (c
->expr2
!= NULL
)
1911 fputs (" stat=", dumpfile
);
1912 show_expr (c
->expr2
);
1914 if (c
->expr3
!= NULL
)
1916 fputs (" errmsg=", dumpfile
);
1917 show_expr (c
->expr3
);
1921 case EXEC_ARITHMETIC_IF
:
1922 fputs ("IF ", dumpfile
);
1923 show_expr (c
->expr1
);
1924 fprintf (dumpfile
, " %d, %d, %d",
1925 c
->label1
->value
, c
->label2
->value
, c
->label3
->value
);
1930 fputs ("IF ", dumpfile
);
1931 show_expr (d
->expr1
);
1934 show_code (level
+ 1, d
->next
);
1938 for (; d
; d
= d
->block
)
1940 code_indent (level
, 0);
1942 if (d
->expr1
== NULL
)
1943 fputs ("ELSE", dumpfile
);
1946 fputs ("ELSE IF ", dumpfile
);
1947 show_expr (d
->expr1
);
1951 show_code (level
+ 1, d
->next
);
1956 code_indent (level
, c
->label1
);
1960 fputs ("ENDIF", dumpfile
);
1965 const char* blocktype
;
1966 gfc_namespace
*saved_ns
;
1967 gfc_association_list
*alist
;
1969 if (c
->ext
.block
.assoc
)
1970 blocktype
= "ASSOCIATE";
1972 blocktype
= "BLOCK";
1974 fprintf (dumpfile
, "%s ", blocktype
);
1975 for (alist
= c
->ext
.block
.assoc
; alist
; alist
= alist
->next
)
1977 fprintf (dumpfile
, " %s = ", alist
->name
);
1978 show_expr (alist
->target
);
1982 ns
= c
->ext
.block
.ns
;
1983 saved_ns
= gfc_current_ns
;
1984 gfc_current_ns
= ns
;
1985 gfc_traverse_symtree (ns
->sym_root
, show_symtree
);
1986 gfc_current_ns
= saved_ns
;
1987 show_code (show_level
, ns
->code
);
1990 fprintf (dumpfile
, "END %s ", blocktype
);
1994 case EXEC_END_BLOCK
:
1995 /* Only come here when there is a label on an
1996 END ASSOCIATE construct. */
2000 case EXEC_SELECT_TYPE
:
2002 if (c
->op
== EXEC_SELECT_TYPE
)
2003 fputs ("SELECT TYPE ", dumpfile
);
2005 fputs ("SELECT CASE ", dumpfile
);
2006 show_expr (c
->expr1
);
2007 fputc ('\n', dumpfile
);
2009 for (; d
; d
= d
->block
)
2011 code_indent (level
, 0);
2013 fputs ("CASE ", dumpfile
);
2014 for (cp
= d
->ext
.block
.case_list
; cp
; cp
= cp
->next
)
2016 fputc ('(', dumpfile
);
2017 show_expr (cp
->low
);
2018 fputc (' ', dumpfile
);
2019 show_expr (cp
->high
);
2020 fputc (')', dumpfile
);
2021 fputc (' ', dumpfile
);
2023 fputc ('\n', dumpfile
);
2025 show_code (level
+ 1, d
->next
);
2028 code_indent (level
, c
->label1
);
2029 fputs ("END SELECT", dumpfile
);
2033 fputs ("WHERE ", dumpfile
);
2036 show_expr (d
->expr1
);
2037 fputc ('\n', dumpfile
);
2039 show_code (level
+ 1, d
->next
);
2041 for (d
= d
->block
; d
; d
= d
->block
)
2043 code_indent (level
, 0);
2044 fputs ("ELSE WHERE ", dumpfile
);
2045 show_expr (d
->expr1
);
2046 fputc ('\n', dumpfile
);
2047 show_code (level
+ 1, d
->next
);
2050 code_indent (level
, 0);
2051 fputs ("END WHERE", dumpfile
);
2056 fputs ("FORALL ", dumpfile
);
2057 for (fa
= c
->ext
.forall_iterator
; fa
; fa
= fa
->next
)
2059 show_expr (fa
->var
);
2060 fputc (' ', dumpfile
);
2061 show_expr (fa
->start
);
2062 fputc (':', dumpfile
);
2063 show_expr (fa
->end
);
2064 fputc (':', dumpfile
);
2065 show_expr (fa
->stride
);
2067 if (fa
->next
!= NULL
)
2068 fputc (',', dumpfile
);
2071 if (c
->expr1
!= NULL
)
2073 fputc (',', dumpfile
);
2074 show_expr (c
->expr1
);
2076 fputc ('\n', dumpfile
);
2078 show_code (level
+ 1, c
->block
->next
);
2080 code_indent (level
, 0);
2081 fputs ("END FORALL", dumpfile
);
2085 fputs ("CRITICAL\n", dumpfile
);
2086 show_code (level
+ 1, c
->block
->next
);
2087 code_indent (level
, 0);
2088 fputs ("END CRITICAL", dumpfile
);
2092 fputs ("DO ", dumpfile
);
2094 fprintf (dumpfile
, " %-5d ", c
->label1
->value
);
2096 show_expr (c
->ext
.iterator
->var
);
2097 fputc ('=', dumpfile
);
2098 show_expr (c
->ext
.iterator
->start
);
2099 fputc (' ', dumpfile
);
2100 show_expr (c
->ext
.iterator
->end
);
2101 fputc (' ', dumpfile
);
2102 show_expr (c
->ext
.iterator
->step
);
2105 show_code (level
+ 1, c
->block
->next
);
2112 fputs ("END DO", dumpfile
);
2115 case EXEC_DO_CONCURRENT
:
2116 fputs ("DO CONCURRENT ", dumpfile
);
2117 for (fa
= c
->ext
.forall_iterator
; fa
; fa
= fa
->next
)
2119 show_expr (fa
->var
);
2120 fputc (' ', dumpfile
);
2121 show_expr (fa
->start
);
2122 fputc (':', dumpfile
);
2123 show_expr (fa
->end
);
2124 fputc (':', dumpfile
);
2125 show_expr (fa
->stride
);
2127 if (fa
->next
!= NULL
)
2128 fputc (',', dumpfile
);
2130 show_expr (c
->expr1
);
2132 show_code (level
+ 1, c
->block
->next
);
2133 code_indent (level
, c
->label1
);
2134 fputs ("END DO", dumpfile
);
2138 fputs ("DO WHILE ", dumpfile
);
2139 show_expr (c
->expr1
);
2140 fputc ('\n', dumpfile
);
2142 show_code (level
+ 1, c
->block
->next
);
2144 code_indent (level
, c
->label1
);
2145 fputs ("END DO", dumpfile
);
2149 fputs ("CYCLE", dumpfile
);
2151 fprintf (dumpfile
, " %s", c
->symtree
->n
.sym
->name
);
2155 fputs ("EXIT", dumpfile
);
2157 fprintf (dumpfile
, " %s", c
->symtree
->n
.sym
->name
);
2161 fputs ("ALLOCATE ", dumpfile
);
2164 fputs (" STAT=", dumpfile
);
2165 show_expr (c
->expr1
);
2170 fputs (" ERRMSG=", dumpfile
);
2171 show_expr (c
->expr2
);
2177 fputs (" MOLD=", dumpfile
);
2179 fputs (" SOURCE=", dumpfile
);
2180 show_expr (c
->expr3
);
2183 for (a
= c
->ext
.alloc
.list
; a
; a
= a
->next
)
2185 fputc (' ', dumpfile
);
2186 show_expr (a
->expr
);
2191 case EXEC_DEALLOCATE
:
2192 fputs ("DEALLOCATE ", dumpfile
);
2195 fputs (" STAT=", dumpfile
);
2196 show_expr (c
->expr1
);
2201 fputs (" ERRMSG=", dumpfile
);
2202 show_expr (c
->expr2
);
2205 for (a
= c
->ext
.alloc
.list
; a
; a
= a
->next
)
2207 fputc (' ', dumpfile
);
2208 show_expr (a
->expr
);
2214 fputs ("OPEN", dumpfile
);
2219 fputs (" UNIT=", dumpfile
);
2220 show_expr (open
->unit
);
2224 fputs (" IOMSG=", dumpfile
);
2225 show_expr (open
->iomsg
);
2229 fputs (" IOSTAT=", dumpfile
);
2230 show_expr (open
->iostat
);
2234 fputs (" FILE=", dumpfile
);
2235 show_expr (open
->file
);
2239 fputs (" STATUS=", dumpfile
);
2240 show_expr (open
->status
);
2244 fputs (" ACCESS=", dumpfile
);
2245 show_expr (open
->access
);
2249 fputs (" FORM=", dumpfile
);
2250 show_expr (open
->form
);
2254 fputs (" RECL=", dumpfile
);
2255 show_expr (open
->recl
);
2259 fputs (" BLANK=", dumpfile
);
2260 show_expr (open
->blank
);
2264 fputs (" POSITION=", dumpfile
);
2265 show_expr (open
->position
);
2269 fputs (" ACTION=", dumpfile
);
2270 show_expr (open
->action
);
2274 fputs (" DELIM=", dumpfile
);
2275 show_expr (open
->delim
);
2279 fputs (" PAD=", dumpfile
);
2280 show_expr (open
->pad
);
2284 fputs (" DECIMAL=", dumpfile
);
2285 show_expr (open
->decimal
);
2289 fputs (" ENCODING=", dumpfile
);
2290 show_expr (open
->encoding
);
2294 fputs (" ROUND=", dumpfile
);
2295 show_expr (open
->round
);
2299 fputs (" SIGN=", dumpfile
);
2300 show_expr (open
->sign
);
2304 fputs (" CONVERT=", dumpfile
);
2305 show_expr (open
->convert
);
2307 if (open
->asynchronous
)
2309 fputs (" ASYNCHRONOUS=", dumpfile
);
2310 show_expr (open
->asynchronous
);
2312 if (open
->err
!= NULL
)
2313 fprintf (dumpfile
, " ERR=%d", open
->err
->value
);
2318 fputs ("CLOSE", dumpfile
);
2319 close
= c
->ext
.close
;
2323 fputs (" UNIT=", dumpfile
);
2324 show_expr (close
->unit
);
2328 fputs (" IOMSG=", dumpfile
);
2329 show_expr (close
->iomsg
);
2333 fputs (" IOSTAT=", dumpfile
);
2334 show_expr (close
->iostat
);
2338 fputs (" STATUS=", dumpfile
);
2339 show_expr (close
->status
);
2341 if (close
->err
!= NULL
)
2342 fprintf (dumpfile
, " ERR=%d", close
->err
->value
);
2345 case EXEC_BACKSPACE
:
2346 fputs ("BACKSPACE", dumpfile
);
2350 fputs ("ENDFILE", dumpfile
);
2354 fputs ("REWIND", dumpfile
);
2358 fputs ("FLUSH", dumpfile
);
2361 fp
= c
->ext
.filepos
;
2365 fputs (" UNIT=", dumpfile
);
2366 show_expr (fp
->unit
);
2370 fputs (" IOMSG=", dumpfile
);
2371 show_expr (fp
->iomsg
);
2375 fputs (" IOSTAT=", dumpfile
);
2376 show_expr (fp
->iostat
);
2378 if (fp
->err
!= NULL
)
2379 fprintf (dumpfile
, " ERR=%d", fp
->err
->value
);
2383 fputs ("INQUIRE", dumpfile
);
2388 fputs (" UNIT=", dumpfile
);
2389 show_expr (i
->unit
);
2393 fputs (" FILE=", dumpfile
);
2394 show_expr (i
->file
);
2399 fputs (" IOMSG=", dumpfile
);
2400 show_expr (i
->iomsg
);
2404 fputs (" IOSTAT=", dumpfile
);
2405 show_expr (i
->iostat
);
2409 fputs (" EXIST=", dumpfile
);
2410 show_expr (i
->exist
);
2414 fputs (" OPENED=", dumpfile
);
2415 show_expr (i
->opened
);
2419 fputs (" NUMBER=", dumpfile
);
2420 show_expr (i
->number
);
2424 fputs (" NAMED=", dumpfile
);
2425 show_expr (i
->named
);
2429 fputs (" NAME=", dumpfile
);
2430 show_expr (i
->name
);
2434 fputs (" ACCESS=", dumpfile
);
2435 show_expr (i
->access
);
2439 fputs (" SEQUENTIAL=", dumpfile
);
2440 show_expr (i
->sequential
);
2445 fputs (" DIRECT=", dumpfile
);
2446 show_expr (i
->direct
);
2450 fputs (" FORM=", dumpfile
);
2451 show_expr (i
->form
);
2455 fputs (" FORMATTED", dumpfile
);
2456 show_expr (i
->formatted
);
2460 fputs (" UNFORMATTED=", dumpfile
);
2461 show_expr (i
->unformatted
);
2465 fputs (" RECL=", dumpfile
);
2466 show_expr (i
->recl
);
2470 fputs (" NEXTREC=", dumpfile
);
2471 show_expr (i
->nextrec
);
2475 fputs (" BLANK=", dumpfile
);
2476 show_expr (i
->blank
);
2480 fputs (" POSITION=", dumpfile
);
2481 show_expr (i
->position
);
2485 fputs (" ACTION=", dumpfile
);
2486 show_expr (i
->action
);
2490 fputs (" READ=", dumpfile
);
2491 show_expr (i
->read
);
2495 fputs (" WRITE=", dumpfile
);
2496 show_expr (i
->write
);
2500 fputs (" READWRITE=", dumpfile
);
2501 show_expr (i
->readwrite
);
2505 fputs (" DELIM=", dumpfile
);
2506 show_expr (i
->delim
);
2510 fputs (" PAD=", dumpfile
);
2515 fputs (" CONVERT=", dumpfile
);
2516 show_expr (i
->convert
);
2518 if (i
->asynchronous
)
2520 fputs (" ASYNCHRONOUS=", dumpfile
);
2521 show_expr (i
->asynchronous
);
2525 fputs (" DECIMAL=", dumpfile
);
2526 show_expr (i
->decimal
);
2530 fputs (" ENCODING=", dumpfile
);
2531 show_expr (i
->encoding
);
2535 fputs (" PENDING=", dumpfile
);
2536 show_expr (i
->pending
);
2540 fputs (" ROUND=", dumpfile
);
2541 show_expr (i
->round
);
2545 fputs (" SIGN=", dumpfile
);
2546 show_expr (i
->sign
);
2550 fputs (" SIZE=", dumpfile
);
2551 show_expr (i
->size
);
2555 fputs (" ID=", dumpfile
);
2560 fprintf (dumpfile
, " ERR=%d", i
->err
->value
);
2564 fputs ("IOLENGTH ", dumpfile
);
2565 show_expr (c
->expr1
);
2570 fputs ("READ", dumpfile
);
2574 fputs ("WRITE", dumpfile
);
2580 fputs (" UNIT=", dumpfile
);
2581 show_expr (dt
->io_unit
);
2584 if (dt
->format_expr
)
2586 fputs (" FMT=", dumpfile
);
2587 show_expr (dt
->format_expr
);
2590 if (dt
->format_label
!= NULL
)
2591 fprintf (dumpfile
, " FMT=%d", dt
->format_label
->value
);
2593 fprintf (dumpfile
, " NML=%s", dt
->namelist
->name
);
2597 fputs (" IOMSG=", dumpfile
);
2598 show_expr (dt
->iomsg
);
2602 fputs (" IOSTAT=", dumpfile
);
2603 show_expr (dt
->iostat
);
2607 fputs (" SIZE=", dumpfile
);
2608 show_expr (dt
->size
);
2612 fputs (" REC=", dumpfile
);
2613 show_expr (dt
->rec
);
2617 fputs (" ADVANCE=", dumpfile
);
2618 show_expr (dt
->advance
);
2622 fputs (" ID=", dumpfile
);
2627 fputs (" POS=", dumpfile
);
2628 show_expr (dt
->pos
);
2630 if (dt
->asynchronous
)
2632 fputs (" ASYNCHRONOUS=", dumpfile
);
2633 show_expr (dt
->asynchronous
);
2637 fputs (" BLANK=", dumpfile
);
2638 show_expr (dt
->blank
);
2642 fputs (" DECIMAL=", dumpfile
);
2643 show_expr (dt
->decimal
);
2647 fputs (" DELIM=", dumpfile
);
2648 show_expr (dt
->delim
);
2652 fputs (" PAD=", dumpfile
);
2653 show_expr (dt
->pad
);
2657 fputs (" ROUND=", dumpfile
);
2658 show_expr (dt
->round
);
2662 fputs (" SIGN=", dumpfile
);
2663 show_expr (dt
->sign
);
2667 for (c
= c
->block
->next
; c
; c
= c
->next
)
2668 show_code_node (level
+ (c
->next
!= NULL
), c
);
2672 fputs ("TRANSFER ", dumpfile
);
2673 show_expr (c
->expr1
);
2677 fputs ("DT_END", dumpfile
);
2680 if (dt
->err
!= NULL
)
2681 fprintf (dumpfile
, " ERR=%d", dt
->err
->value
);
2682 if (dt
->end
!= NULL
)
2683 fprintf (dumpfile
, " END=%d", dt
->end
->value
);
2684 if (dt
->eor
!= NULL
)
2685 fprintf (dumpfile
, " EOR=%d", dt
->eor
->value
);
2688 case EXEC_OACC_PARALLEL_LOOP
:
2689 case EXEC_OACC_PARALLEL
:
2690 case EXEC_OACC_KERNELS_LOOP
:
2691 case EXEC_OACC_KERNELS
:
2692 case EXEC_OACC_DATA
:
2693 case EXEC_OACC_HOST_DATA
:
2694 case EXEC_OACC_LOOP
:
2695 case EXEC_OACC_UPDATE
:
2696 case EXEC_OACC_WAIT
:
2697 case EXEC_OACC_CACHE
:
2698 case EXEC_OACC_ENTER_DATA
:
2699 case EXEC_OACC_EXIT_DATA
:
2700 case EXEC_OMP_ATOMIC
:
2701 case EXEC_OMP_CANCEL
:
2702 case EXEC_OMP_CANCELLATION_POINT
:
2703 case EXEC_OMP_BARRIER
:
2704 case EXEC_OMP_CRITICAL
:
2705 case EXEC_OMP_DISTRIBUTE
:
2706 case EXEC_OMP_DISTRIBUTE_PARALLEL_DO
:
2707 case EXEC_OMP_DISTRIBUTE_PARALLEL_DO_SIMD
:
2708 case EXEC_OMP_DISTRIBUTE_SIMD
:
2710 case EXEC_OMP_DO_SIMD
:
2711 case EXEC_OMP_FLUSH
:
2712 case EXEC_OMP_MASTER
:
2713 case EXEC_OMP_ORDERED
:
2714 case EXEC_OMP_PARALLEL
:
2715 case EXEC_OMP_PARALLEL_DO
:
2716 case EXEC_OMP_PARALLEL_DO_SIMD
:
2717 case EXEC_OMP_PARALLEL_SECTIONS
:
2718 case EXEC_OMP_PARALLEL_WORKSHARE
:
2719 case EXEC_OMP_SECTIONS
:
2721 case EXEC_OMP_SINGLE
:
2722 case EXEC_OMP_TARGET
:
2723 case EXEC_OMP_TARGET_DATA
:
2724 case EXEC_OMP_TARGET_ENTER_DATA
:
2725 case EXEC_OMP_TARGET_EXIT_DATA
:
2726 case EXEC_OMP_TARGET_PARALLEL
:
2727 case EXEC_OMP_TARGET_PARALLEL_DO
:
2728 case EXEC_OMP_TARGET_PARALLEL_DO_SIMD
:
2729 case EXEC_OMP_TARGET_SIMD
:
2730 case EXEC_OMP_TARGET_TEAMS
:
2731 case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE
:
2732 case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO
:
2733 case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD
:
2734 case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD
:
2735 case EXEC_OMP_TARGET_UPDATE
:
2737 case EXEC_OMP_TASKGROUP
:
2738 case EXEC_OMP_TASKLOOP
:
2739 case EXEC_OMP_TASKLOOP_SIMD
:
2740 case EXEC_OMP_TASKWAIT
:
2741 case EXEC_OMP_TASKYIELD
:
2742 case EXEC_OMP_TEAMS
:
2743 case EXEC_OMP_TEAMS_DISTRIBUTE
:
2744 case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO
:
2745 case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD
:
2746 case EXEC_OMP_TEAMS_DISTRIBUTE_SIMD
:
2747 case EXEC_OMP_WORKSHARE
:
2748 show_omp_node (level
, c
);
2752 gfc_internal_error ("show_code_node(): Bad statement code");
2757 /* Show an equivalence chain. */
2760 show_equiv (gfc_equiv
*eq
)
2763 fputs ("Equivalence: ", dumpfile
);
2766 show_expr (eq
->expr
);
2769 fputs (", ", dumpfile
);
2774 /* Show a freakin' whole namespace. */
2777 show_namespace (gfc_namespace
*ns
)
2779 gfc_interface
*intr
;
2780 gfc_namespace
*save
;
2786 save
= gfc_current_ns
;
2789 fputs ("Namespace:", dumpfile
);
2795 while (i
< GFC_LETTERS
- 1
2796 && gfc_compare_types (&ns
->default_type
[i
+1],
2797 &ns
->default_type
[l
]))
2801 fprintf (dumpfile
, " %c-%c: ", l
+'A', i
+'A');
2803 fprintf (dumpfile
, " %c: ", l
+'A');
2805 show_typespec(&ns
->default_type
[l
]);
2807 } while (i
< GFC_LETTERS
);
2809 if (ns
->proc_name
!= NULL
)
2812 fprintf (dumpfile
, "procedure name = %s", ns
->proc_name
->name
);
2816 gfc_current_ns
= ns
;
2817 gfc_traverse_symtree (ns
->common_root
, show_common
);
2819 gfc_traverse_symtree (ns
->sym_root
, show_symtree
);
2821 for (op
= GFC_INTRINSIC_BEGIN
; op
!= GFC_INTRINSIC_END
; op
++)
2823 /* User operator interfaces */
2829 fprintf (dumpfile
, "Operator interfaces for %s:",
2830 gfc_op2string ((gfc_intrinsic_op
) op
));
2832 for (; intr
; intr
= intr
->next
)
2833 fprintf (dumpfile
, " %s", intr
->sym
->name
);
2836 if (ns
->uop_root
!= NULL
)
2839 fputs ("User operators:\n", dumpfile
);
2840 gfc_traverse_user_op (ns
, show_uop
);
2843 for (eq
= ns
->equiv
; eq
; eq
= eq
->next
)
2846 if (ns
->oacc_declare
)
2848 struct gfc_oacc_declare
*decl
;
2849 /* Dump !$ACC DECLARE clauses. */
2850 for (decl
= ns
->oacc_declare
; decl
; decl
= decl
->next
)
2853 fprintf (dumpfile
, "!$ACC DECLARE");
2854 show_omp_clauses (decl
->clauses
);
2858 fputc ('\n', dumpfile
);
2860 fputs ("code:", dumpfile
);
2861 show_code (show_level
, ns
->code
);
2864 for (ns
= ns
->contained
; ns
; ns
= ns
->sibling
)
2866 fputs ("\nCONTAINS\n", dumpfile
);
2868 show_namespace (ns
);
2872 fputc ('\n', dumpfile
);
2873 gfc_current_ns
= save
;
2877 /* Main function for dumping a parse tree. */
2880 gfc_dump_parse_tree (gfc_namespace
*ns
, FILE *file
)
2883 show_namespace (ns
);