1 /*
2  * Copyright (c) 2018, 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 #ifndef F_EXP_RTE_H_
19 #define F_EXP_RTE_H_
20 
21 #include "gbldefs.h"
22 #include "global.h"
23 #include "symtab.h"
24 #include "expand.h"
25 
26 /**
27    \brief ...
28  */
29 bool bindC_function_return_struct_in_registers(int func_sym);
30 
31 /**
32    \brief ...
33  */
34 int charaddr(SPTR sym);
35 
36 /**
37    \brief ...
38  */
39 int charlen(SPTR sym);
40 
41 /**
42    \brief ...
43  */
44 int exp_alloca(ILM *ilmp);
45 
46 /**
47    \brief ...
48  */
49 int gen_arg_ili(void);
50 
51 /**
52    \brief ...
53  */
54 SPTR getdumlen(void);
55 
56 /// Create a symbol representing the length of a passed-length character
57 /// argument in the host subprogram.
58 SPTR gethost_dumlen(int arg, ISZ_T address);
59 
60 /**
61    \brief ...
62  */
63 int is_passbyval_dummy(int sptr);
64 
65 /**
66    \brief ...
67  */
68 int needlen(int sym, int func);
69 
70 /**
71    \brief ...
72  */
73 void add_arg_ili(int ilix, int nme, int dtype);
74 
75 /**
76    \brief ...
77  */
78 void chk_terminal_func(int entbih, int exitbih);
79 
80 /**
81    \brief ...
82  */
83 void end_arg_ili(void);
84 
85 /**
86    \brief ...
87  */
88 void exp_agoto(ILM *ilmp, int curilm);
89 
90 /**
91    \brief ...
92  */
93 void expand_smove(int destilm, int srcilm, DTYPE dtype);
94 
95 /**
96    \brief ...
97  */
98 void exp_build_agoto(int *tab, int mx);
99 
100 /**
101    \brief ...
102  */
103 void exp_call(ILM_OP opc, ILM *ilmp, int curilm);
104 
105 /**
106    \brief ...
107  */
108 void exp_cgoto(ILM *ilmp, int curilm);
109 
110 /**
111    \brief ...
112  */
113 void exp_end(ILM *ilmp, int curilm, bool is_func);
114 
115 /**
116    \brief ...
117  */
118 void exp_fstring(ILM_OP opc, ILM *ilmp, int curilm);
119 
120 /**
121    \brief ...
122  */
123 void exp_header(SPTR sym);
124 
125 /**
126    \brief ...
127  */
128 void exp_qjsr(char *ext, DTYPE res_dtype, ILM *ilmp, int curilm);
129 
130 /**
131    \brief ...
132  */
133 void exp_remove_gsmove(void);
134 
135 /**
136    \brief ...
137  */
138 void exp_reset_argregs(int ir, int fr);
139 
140 /**
141    \brief ...
142  */
143 void exp_szero(ILM *ilmp, int curilm, int to, int from, int dtype);
144 
145 /**
146    \brief ...
147  */
148 void exp_zqjsr(char *ext, int res_dtype, ILM *ilmp, int curilm);
149 
150 /**
151    \brief ...
152  */
153 void init_arg_ili(int n);
154 
155 /** \brief Checks to see if a procedure has character dummy arguments.
156  *
157  *  \param func is the procedure we are checking.
158  *
159  *  \return true if the procedure has character dummy arguments, else false.
160  */
161 bool func_has_char_args(SPTR func);
162 
163 /// \brief Process referenced symbols, assigning them locations
164 void AssignAddresses(void);
165 #endif
166