1 /*
2  * Copyright (c) 1997-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 DINIT_H_
19 #define DINIT_H_
20 
21 /** \file
22  * \brief (Fortran) declarations needed to use dinitutil.c module.
23  */
24 
25 #include "gbldefs.h"
26 #include "symtab.h"
27 #include <stdio.h>
28 
29 struct CONST;
30 struct VAR;
31 
32 typedef struct DREC {/* dinit file record */
33   DTYPE dtype;  /*  also sptr  */
34   ISZ_T conval; /*  also offset */
35 } DREC;
36 
37 #define DINIT_ENDFILE  ((DTYPE)-96)
38 #define DINIT_STARTARY ((DTYPE)-95)
39 #define DINIT_ENDARY   ((DTYPE)-94)
40 #define DINIT_TYPEDEF  ((DTYPE)-93)
41 #define DINIT_ENDTYPE  ((DTYPE)-92)
42 #define DINIT_LOC      ((DTYPE)-99)
43 #define DINIT_SLOC     ((DTYPE)-91)
44 #define DINIT_REPEAT   ((DTYPE)-88)
45 #define DINIT_SECT     ((DTYPE)-87) /* conval field is sptr to string with section name */
46 #define DINIT_DATASECT ((DTYPE)-86) /* return to data section */
47 #define DINIT_OFFSET   ((DTYPE)-77)
48 #define DINIT_LABEL    ((DTYPE)-33)
49 #define DINIT_ZEROES   ((DTYPE)-66)
50 #define DINIT_VPUINSTR ((DTYPE)-55) /* sparc/VPU compiler only */
51 #define DINIT_COMMENT  ((DTYPE)-44) /* comment string for asm file - the
52                                      * DREC.conval field is an int index into
53                                      * the getitem_p table (salloc.c) which
54                                      * contains the pointer to the string.
55                                      */
56 #define DINIT_FILL     ((DTYPE)-59)
57 #define DINIT_MASK     ((DTYPE)-60)
58 #define DINIT_ZEROINIT ((DTYPE)-61) /* llvm : use zeroinitializer */
59 
60 #define DINIT_FUNCCOUNT ((DTYPE)-31) /* gbl.func_count value */
61 #define DINIT_STRING   ((DTYPE)-30) // holds string initialization, length given
62 
63 /**
64    \brief ...
65  */
66 bool dinit_ok(int sptr);
67 
68 /**
69    \brief ...
70  */
71 int mk_largest_val(DTYPE dtype);
72 
73 /**
74    \brief ...
75  */
76 int mk_smallest_val(DTYPE dtype);
77 
78 /**
79    \brief ...
80  */
81 int mk_unop(int optype, int lop, DTYPE dtype);
82 
83 /**
84    \brief ...
85  */
86 void dinit(struct VAR *ivl, struct CONST *ict);
87 
88 /**
89    \brief ...
90  */
91 void dmp_ict(struct CONST *ict, FILE *f);
92 
93 /**
94    \brief ...
95  */
96 void dmp_ivl(struct VAR *ivl, FILE *f);
97 
98 /**
99    \brief ...
100  */
101 void do_dinit(void);
102 
103 
104 #endif
105