1 /*
2  * Copyright (c) 1994-2019, NVIDIA CORPORATION.  All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17 
18 /**
19  *  \file
20  *  \brief - Symbol utilities
21  */
22 
23 #ifndef SYMUTL_H_
24 #define SYMUTL_H_
25 
26 #define SLIST_AREA 11
27 
28 int get_next_sym(char *, char *);
29 SPTR get_symtype(SYMTYPE, SPTR);
30 int get_next_user_sym(char *, char *);
31 int sym_get_scalar(char *, char *, int);
32 int sym_get_ptr(int);
33 int sym_get_ptr_name(char *);
34 int sym_get_offset(int);
35 int sym_get_array(char *, char *, int, int);
36 int sym_mkfunc(char *, int);
37 int sym_mkfunc_nodesc(char *, int);
38 int sym_mkfunc_nodesc_nocomm(char *, int);
39 int sym_mkfunc_nodesc_expst(char *nmptr, int dtype);
40 int sym_mknproc(void);
41 int sym_get_tmplate(int);
42 int sym_get_sec(char *, int);
43 int sym_get_cp(void);
44 int sym_get_xfer(void);
45 int sym_get_arg_sec(int);
46 int sym_get_formal(int);
47 int get_temp_forall(int, int, int, int, int, int);
48 int get_temp_copy_section(int, int, int, int, int, int);
49 int get_temp_pure_replicated(int, int, int, int);
50 int mk_assign_sptr(int, char *, int *, int, int *);
51 int chk_assign_sptr(int, char *, int *, int, int, int *);
52 int mk_shape_sptr(int, int *, int);
53 int chk_reduc_sptr(int, char *, int *, int, int, int, int *);
54 int mk_spread_sptr(int, char *, int *, int, int, int, int, int *);
55 int mk_matmul_sptr(int, int, char *, int *, int, int *);
56 int mk_transpose_sptr(int, char *, int *, int, int *);
57 int mk_pack_sptr(int, int);
58 int mk_maxloc_sptr(int, int);
59 int search_forall_var(int, int);
60 int other_forall_var(int, int, int);
61 int mk_forall_sptr(int, int, int *, int);
62 int mk_forall_sptr_copy_section(int, int, int, int *, int);
63 int mk_forall_sptr_pure(int, int, int, int *, int);
64 int mk_mem_allocate(int, int *, int, int);
65 int mk_mem_deallocate(int, int);
66 int sym_get_global_array(void);
67 int check_member(int, int);
68 void dump_alignment(FILE *, int, int);
69 void dump_distribution(FILE *, int, int);
70 int first_hash(int sptr);
71 int find_dummy(int, int);
72 int find_array(int ast, int *returnast);
73 LOGICAL has_allocattr(int);
74 char *mangle_name_dt(char *, char *, int);
75 void fixup_srcalloc_bounds(int *, int *, int);
76 
77 void check_alloc_ptr_type(int, int, DTYPE, int, int, int, int); /* func.c */
78 LOGICAL contiguous_section(int arr_ast);                        /* func.c */
79 
80 LOGICAL inline_RTE_set_type(int, int, int, int, DTYPE, int); /* outconv.c */
81 
82 int get_forall_subscr(int, int, int *, int);
83 
84 void set_symutl_sc(int);
85 int get_next_sym_dt(char *, char *, int);
86 void trans_mkdescr(int);
87 int first_element(int ast);
88 int mk_forall_sptr_gatherx(int forall_ast, int lhs, int rhs, int *subscr,
89                            int elem_dty);
90 int get_temp_pure(int forall_ast, int lhs, int rhs, int alloc_stmt,
91                   int dealloc_stmt, int ast_dty);
92 void check_small_allocatable(int sptr);
93 LOGICAL was_implicit(int sptr);             /* symtab.c */
94 LOGICAL is_argp_in_entry(int ent, int arg); /* symtab.c */
95 int get_next_hash_link(int sptr, int task);
96 int findByNameStypeScope(char *symname, int stype, int scope);
97 LOGICAL is_array_sptr(int sptr);
98 LOGICAL is_unl_poly(int sptr);
99 bool is_impure(SPTR sptr);
100 LOGICAL needs_descriptor(int sptr);
101 bool proc_arg_needs_proc_desc(SPTR symfunc);
102 int find_descriptor_ast(int sptr, int ast);
103 SPTR get_member_descriptor(SPTR sptr);
104 int find_member_descriptor(int sptr);
105 int find_dummy_position(int proc_sptr, int arg_sptr);
106 int max_binding_invobj(int impl_sptr, int invobj);
107 LOGICAL is_tbp(int sptr);
108 LOGICAL is_final_procedure(int sptr);
109 LOGICAL is_tbp_or_final(int sptr);
110 int get_tmp_descr(DTYPE dtype);
111 int get_descriptor_length_ast(int descriptor_ast);
112 int symbol_descriptor_length_ast(SPTR sptr, int ast);
113 int get_value_length_ast(DTYPE value_dtype, int value_ast,
114                          SPTR sptr, DTYPE sptr_dtype, int value_descr_ast);
115 
116 #if DEBUG
117 void ds(int);
118 void dss(int, int);
119 void dsym(int);
120 void dsyms(int, int);
121 #endif
122 
123 typedef struct {
124   int sc;            /* storage class used for symutl-created scalars */
125   int none_implicit; /* Copy of sem.none_implicit */
126 } SYMUTL;
127 
128 extern SYMUTL symutl; /**< FIXME: what is this? */
129 
130 void add_auto_len(int sym, int Lbegin);
131 
132 #endif /* SYMUTL_H_ */
133