1 /*
2  * Copyright (c) 1998-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 /* clang-format off */
19 
20 /**
21  * \file
22  * \brief Fortran RTE name build and entry symbol macros
23  */
24 
25 /* TODO FOR FLANG: resolve/merge w/ent3f.h??? */
26 
27 #ifndef _PGHPFENT_H_
28 #define _PGHPFENT_H_
29 
30 /* Alternate Fortran entry symbol formats */
31 #if defined(WIN64)
32 #if defined(DESC_I8)
33 #define ENTF90IO(UC, LC) pgf90io_##LC##_i8
34 #define ENTF90(UC, LC) pgf90_##LC##_i8
35 #define ENTFTN(UC, LC) pghpf_##LC##_i8
36 #define ENTRY(UC, LC) LC##_i8
37 #define ENTCRF90IO(UC, LC) pgcrf90io_##LC##_i8
38 #define ENTFTNIO(UC, LC) pghpfio_##LC##64
39 #define ENTCRFTNIO(UC, LC) pgcrhpfio_##LC##_i8
40 #define F90_MATMUL(s) pg_mm_##s##_i8_
41 #define F90_NORM2(s) pg_norm2_##s##_i8_
42 #else /* !defined(DESC_I8) */
43 #define ENTF90IO(UC, LC) pgf90io_##LC
44 #define ENTF90(UC, LC) pgf90_##LC
45 #define ENTFTN(UC, LC) pghpf_##LC
46 #define ENTRY(UC, LC) LC
47 #define ENTCRF90IO(UC, LC) pgcrf90io_##LC
48 #define ENTFTNIO(UC, LC) pghpfio_##LC
49 #define ENTCRFTNIO(UC, LC) pgcrhpfio_##LC
50 #define F90_MATMUL(s) pg_mm_##s##_
51 #define F90_NORM2(s) pg_norm2_##s##_
52 #endif /* defined(DESC_I8) */
53 #define ENTF90COMN(UC, LC) pgf90_##LC
54 #define ENTCRF90(UC, LC) pgcrf90_##LC
55 #define ENTCRFTN(UC, LC) pgcrhpf_##LC
56 #define ENTCOMN(UC, LC) pghpf_##LC##_
57 
58 #elif defined(WIN32)
59 #define ENTF90(UC, LC) pgf90_##LC
60 #define ENTF90IO(UC, LC) pgf90io_##LC
61 #define ENTFTN(UC, LC) pghpf_##LC
62 #define ENTFTNIO(UC, LC) pghpfio_##LC
63 #define ENTRY(UC, LC) LC
64 #define ENTCRF90IO(UC, LC) pgcrf90io_##LC
65 #define ENTCRFTNIO(UC, LC) pgcrhpfio_##LC
66 #define ENTCRF90(UC, LC) pgcrf90_##LC
67 #define ENTCRFTN(UC, LC) pgcrhpf_##LC
68 #define ENTCOMN(UC, LC) pghpf_##LC
69 #define F90_MATMUL(s) pg_mm_##s##_
70 #define F90_NORM2(s) pg_norm2_##s##_
71 
72 #elif defined(WINNT)
73 #define ENTF90(UC, LC) pgf90_##LC
74 #define ENTF90IO(UC, LC) pgf90io_##LC
75 #define ENTFTN(UC, LC) pghpf_##LC
76 #define ENTFTNIO(UC, LC) pghpfio_##LC
77 #define ENTRY(UC, LC) LC
78 #define ENTCRF90IO(UC, LC) pgcrf90io_##LC
79 #define ENTCRFTNIO(UC, LC) pgcrhpfio_##LC
80 #define ENTCRF90(UC, LC) pgcrf90_##LC
81 #define ENTCRFTN(UC, LC) pgcrhpf_##LC
82 #define ENTCOMN(UC, LC) pghpf_win_##LC
83 #define F90_MATMUL(s) pg_mm_##s##_
84 
85 #else
86 #if defined(DESC_I8)
87 #define ENTF90IO(UC, LC) f90io_##LC##_i8
88 #define ENTF90(UC, LC) f90_##LC##_i8
89 #define ENTFTN(UC, LC) fort_##LC##_i8
90 #define ENTRY(UC, LC) LC##_i8
91 #define ENTCRF90IO(UC, LC) crf90io_##LC##_i8 /* FIXME: HPF, delete all with this prefix*/
92 #define ENTFTNIO(UC, LC) ftnio_##LC##64
93 #define ENTCRFTNIO(UC, LC) crftnio_##LC##_i8 /* FIXME: HPF, delete all with this prefix*/
94 #define F90_MATMUL(s) f90_mm_##s##_i8_
95 #define F90_NORM2(s) f90_norm2_##s##_i8_
96 #else /* !defined(DESC_I8) */
97 #define ENTF90IO(UC, LC) f90io_##LC
98 #define ENTF90(UC, LC) f90_##LC
99 #define ENTFTN(UC, LC) fort_##LC
100 #define ENTRY(UC, LC) LC
101 #define ENTCRF90IO(UC, LC) crf90io_##LC	/* FIXME: HPF, delete all with this prefix*/
102 #define ENTFTNIO(UC, LC) ftnio_##LC
103 #define ENTCRFTNIO(UC, LC) crftnio_##LC	/* FIXME: HPF, delete all with this prefix*/
104 #define F90_MATMUL(s) f90_mm_##s##_
105 #define F90_NORM2(s) f90_norm2_##s##_
106 #endif /* defined(DESC_I8) */
107 
108 #define ENTF90COMN(UC, LC) pgf90_##LC
109 #define ENTCRF90(UC, LC) crf90_##LC	/* FIXME: HPF, delete all with this prefix*/
110 #define ENTCRFTN(UC, LC) crftn_##LC	/* FIXME: HPF, delete all with this prefix*/
111 #define ENTCOMN(UC, LC) ftn_##LC##_	/* FIXME: common blocks */
112 
113 #endif
114 
115 #if defined(DESC_I8)
116 #define I8(s) s##_i8
117 #define I8_(s) s##i8_
118 #define F90_I8(s) s##_i8_
119 #else
120 #define I8(s) s
121 #define I8_(s) s
122 #define F90_I8(s) s##_
123 #endif
124 
125 /* macros to put character length arguments in their place.
126    DCHAR declares a character pointer argument.
127    DCLEN declares a character length argument. Since DCLEN may have an
128    empty definition, no commas should be used before or after a DCLEN
129    reference in a dummy argument list.
130    CADR gets the character pointer.
131    CLEN gets the character length.  */
132 
133 #define __CLEN_T size_t
134 #define DCHAR(ARG) char *ARG##_adr
135 #define DCLEN(ARG) , int ARG##_len
136 #define DCLEN64(ARG) , __CLEN_T ARG##_len
137 #define CADR(ARG) (ARG##_adr)
138 #define CLEN(ARG) (ARG##_len)
139 
140 /* #if defined(WIN64) || defined(WIN32) */
141 #if defined(PGDLL) && defined(_DLL) &&                                         (defined(TARGET_WIN) || defined(WIN64) || defined(WIN32))
142 #define WIN_EXP __declspec(dllexport)
143 #define WIN_IMP extern __declspec(dllimport)
144 #else
145 #define WIN_EXP
146 #define WIN_IMP extern
147 #endif
148 
149 #define CORMEM ENTCOMN(0L, 0l)
150 #define LINENO ENTCOMN(LINENO, lineno)
151 
152 #define LOCAL_MODE 0
153 
154 /* SUBGROUP_MODE used to indicate communication between a subset of
155  * processors ...
156  * Used in __fort_global_reduce (reduct.c)
157  */
158 
159 #define SUBGROUP_MODE 0
160 
161 /* declare a variable private to a thread (taskcommon) */
162 
163 #define PRIVGLOB(type, var) type var
164 #define PRIVSTAT(type, var) static type var
165 #define PRIVXTRN(type, var) extern type var
166 
167 #endif
168