Debian Codegraph @

mip/node.h

raw symbols SCIP
1 /* $Id: node.h,v 1.43 2015/11/17 19:19:40 ragge Exp $ */
2 /*
3 * Copyright (c) 2003 Anders Magnusson ([email protected]).
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef NODE_H
30 #define NODE_H
31
32 /*
33 * The attribute struct contains stuff that might be useful in
34 * both passes; but currently it's only legal to use it in pass1.
35 */
36 union aarg {
37 int iarg;
38 char *sarg;
39 void *varg;
40 };
41
42 struct attr {
43 struct attr *next;
44 unsigned int atype:12, sz:2;
45 union aarg aa[];
46 };
47
48 #define iarg(x) aa[x].iarg
49 #define sarg(x) aa[x].sarg
50 #define varg(x) aa[x].varg
51
52 /*
53 * The node structure is the basic element in the compiler.
54 * Depending on the operator, it may be one of several types.
55 *
56 * This is rewritten to be a struct instead of a union as it
57 * was in the old compiler.
58 */
59 typedef unsigned int TWORD;
60 #define NIL (NODE *)0
61
62 struct regw;
63
64 typedef struct node {
65 int n_op;
66 union {
67 int _reg;
68 struct regw *_regw;
69 } n_3;
70 #define n_reg n_3._reg
71 #define n_regw n_3._regw
72 TWORD n_type;
73 TWORD n_qual;
74 int n_su;
75 union {
76 char * _name;
77 int _label;
78 #ifdef LANG_CXX
79 union dimfun *_df;
80 #endif
81 } n_5;
82 struct attr *n_ap;
83 union {
84 struct {
85 union {
86 struct node *_left;
87 CONSZ _val;
88 } n_l;
89 union {
90 struct node *_right;
91 int _rval;
92 #ifdef LANG_CXX
93 struct symtab *_sp;
94 #endif
95 } n_r;
96 } n_u;
97 void *_dcon;
98 #if 0
99 #ifdef SOFTFLOAT
100 #ifdef FDFLOAT
101 /* To store F- or D-floats */
102 struct softfloat {
103 unsigned short fd1, fd2, fd3, fd4;
104 } _dcon;
105 #else
106 #error missing softfloat structure definition
107 #endif
108 #else
109 long double _dcon;
110 #endif
111 #endif
112 } n_f;
113 } NODE;
114
115 #define n_name n_5._name
116 #define n_df n_5._df
117 #define n_label n_5._label
118
119 #define n_left n_f.n_u.n_l._left
120 #define n_val n_f.n_u.n_l._val
121 #define n_slval n_f.n_u.n_l._slval
122 #define n_right n_f.n_u.n_r._right
123 #define n_rval n_f.n_u.n_r._rval
124 #define n_sp n_f.n_u.n_r._sp
125 #define n_dcon n_f._dcon
126 #define getlval(p) ((p)->n_f.n_u.n_l._val)
127 #define setlval(p,v) ((p)->n_f.n_u.n_l._val = (v))
128
129 #define NLOCAL1 010000
130 #define NLOCAL2 020000
131 #define NLOCAL3 040000
132 /*
133 * Node types.
134 *
135 * MAXOP is the highest number used by the backend.
136 */
137
138 #define FREE 1
139 /*
140 * Value nodes.
141 */
142 #define NAME 2
143 #define ICON 4
144 #define FCON 5
145 #define REG 6
146 #define OREG 7
147 #define TEMP 8
148 #define XARG 9
149
150 /*
151 * Arithmetic nodes.
152 */
153 #define PLUS 10
154 #define MINUS 11
155 #define DIV 12
156 #define MOD 13
157 #define MUL 14
158
159 /*
160 * Bitwise operations.
161 */
162 #define AND 15
163 #define OR 16
164 #define ER 17
165 #define LS 18
166 #define RS 19
167 #define COMPL 20
168
169 #define UMUL 23
170 #define UMINUS 24
171
172 /*
173 * Logical compare nodes.
174 */
175 #define EQ 25
176 #define NE 26
177 #define LE 27
178 #define LT 28
179 #define GE 29
180 #define GT 30
181 #define ULE 31
182 #define ULT 32
183 #define UGE 33
184 #define UGT 34
185
186 /*
187 * Branch nodes.
188 */
189 #define CBRANCH 35
190
191 /*
192 * Convert types.
193 */
194 #define FLD 36
195 #define SCONV 37
196 #define PCONV 38
197 #define PMCONV 39
198 #define PVCONV 40
199
200 /*
201 * Function calls.
202 */
203 #define CALL 41
204 #define UCALL 42
205 #define FORTCALL 43
206 #define UFORTCALL 44
207 #define STCALL 45
208 #define USTCALL 46
209
210 /*
211 * Other used nodes.
212 */
213 #define CCODES 47
214 #define CM 48
215 #define ASSIGN 49
216 #define STASG 50
217 #define STARG 51
218 #define FORCE 52
219 #define XASM 53
220 #define GOTO 54
221 #define RETURN 55
222 #define FUNARG 57
223 #define ADDROF 58
224
225 #define MAXOP 58
226
227 #endif