1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
|
#ifndef COMPILER_ENODE_H
#define COMPILER_ENODE_H
#include "compiler/common.h"
#ifdef __MWERKS__
#pragma options align=mac68k
#endif
typedef enum ENodeType {
EPOSTINC,
EPOSTDEC,
EPREINC,
EPREDEC,
EINDIRECT,
EMONMIN,
EBINNOT,
ELOGNOT,
EFORCELOAD,
EMUL,
EMULV,
EDIV,
EMODULO,
EADDV,
ESUBV,
EADD,
ESUB,
ESHL,
ESHR,
ELESS,
EGREATER,
ELESSEQU,
EGREATEREQU,
EEQU,
ENOTEQU,
EAND,
EXOR,
EOR,
ELAND,
ELOR,
EASS,
EMULASS,
EDIVASS,
EMODASS,
EADDASS,
ESUBASS,
ESHLASS,
ESHRASS,
EANDASS,
EXORASS,
EORASS,
ECOMMA,
EPMODULO,
EROTL,
EROTR,
EBCLR,
EBTST,
EBSET,
ETYPCON,
EBITFIELD,
EINTCONST,
EFLOATCONST,
ESTRINGCONST,
ECOND,
EFUNCCALL,
EFUNCCALLP,
EOBJREF,
EMFPOINTER,
ENULLCHECK,
EPRECOMP,
ETEMP,
EARGOBJ,
ELOCOBJ,
ELABEL,
ESETCONST,
ENEWEXCEPTION,
ENEWEXCEPTIONARRAY,
EINITTRYCATCH,
EOBJLIST,
EMEMBER,
ETEMPLDEP,
EINSTRUCTION,
EDEFINE,
EREUSE,
EASSBLK,
EVECTOR128CONST,
ECONDASS,
MAXEXPR
} ENodeType;
struct EMemberInfo {
BClassList *path;
ENode *expr;
NameSpaceObjectList *list;
TemplArg *templargs;
Boolean pr_1D;
Boolean x11;
Boolean isambig;
};
struct ENodeList {
ENodeList *next;
ENode *node;
};
typedef union ENodeUnion {
CInt64 intval;
Float floatval;
SInt32 longval;
ENode *monadic;
Object *objref;
CLabel *label;
MWVector128 vector128val;
struct {
ENode *left;
ENode *right;
} diadic;
struct {
ENode *cond;
ENode *expr1;
ENode *expr2;
} cond;
struct {
ENode *funcref;
ENodeList *args;
TypeFunc *functype;
} funccall;
//ObjAccess objaccess;
struct {
ENode *accessnode;
ENode *mfpointer;
} mfpointer;
struct {
ENode *nullcheckexpr;
ENode *condexpr;
SInt32 precompid;
} nullcheck;
SInt32 precompid;
struct {
Type *type;
SInt32 uniqueid;
Boolean needs_dtor;
} temp;
struct {
SInt32 size;
char *data;
//SInt32 segnum; ??
char ispascal;
char ispacked;
} string;
struct {
SInt32 size;
char *data;
} set;
struct {
ENode *initexpr;
ENode *tryexpr;
Object *pointertemp;
Object *deletefunc;
} newexception;
struct {
ENode *initexpr;
ENode *tryexpr;
ENode *catchexpr;
ENode *result;
} itc;
struct {
Object *objref;
SInt32 offset;
} addr;
struct {
NameSpaceObjectList *list;
TemplArg *templargs;
HashNameNode *name;
} objlist;
EMemberInfo *emember;
void *inst;
MemInitializer *ctorinit;
Statement *stmt;
struct {
union {
TemplParamID pid;
struct {
Type *type;
} typeexpr;
struct {
ENodeList *args;
Type *type;
UInt32 qual;
} cast;
struct {
TypeTemplDep *type;
HashNameNode *name;
} qual;
struct {
ENode *expr;
TStreamElement *token;
} sourceref;
ENode *monadic;
Object *obj;
} u;
TemplDepSubType subtype;
} templdep;
} ENodeUnion;
struct ENode {
ENodeType type;
UInt8 cost;
UInt16 flags;
Boolean ignored;
Boolean hascall;
// void *loc; - might not be in pro7?
Type *rtype;
PointsToFunction *pointsTo;
ENodeUnion data;
};
enum {
ENODE_FLAG_CONST = Q_CONST,
ENODE_FLAG_VOLATILE = Q_VOLATILE,
ENODE_FLAG_QUALS = Q_CONST | Q_VOLATILE,
ENODE_FLAG_10 = 0x10,
ENODE_FLAG_80 = 0x80
};
#define ENODE_IS(_enode, _etype) ( (_enode)->type == (_etype) )
#define ENODE_IS2(_enode, _etype1, _etype2) ( ENODE_IS((_enode), (_etype1)) || ENODE_IS((_enode), (_etype2)) )
#define ENODE_IS3(_enode, _etype1, _etype2, _etype3) ( ENODE_IS((_enode), (_etype1)) || ENODE_IS((_enode), (_etype2)) || ENODE_IS((_enode), (_etype3)) )
#define ENODE_IS4(_enode, _etype1, _etype2, _etype3, _etype4) ( ENODE_IS((_enode), (_etype1)) || ENODE_IS((_enode), (_etype2)) || ENODE_IS((_enode), (_etype3)) || ENODE_IS((_enode), (_etype4)) )
#define ENODE_IS5(_enode, _etype1, _etype2, _etype3, _etype4, _etype5) ( ENODE_IS((_enode), (_etype1)) || ENODE_IS((_enode), (_etype2)) || ENODE_IS((_enode), (_etype3)) || ENODE_IS((_enode), (_etype4)) || ENODE_IS((_enode), (_etype5)) )
#define ENODE_IS_RANGE(_enode, _lo, _hi) ( ((_enode)->type >= (_lo)) && ((_enode)->type <= (_hi)) )
#define ENODE_QUALS(_enode) ( (UInt32) ( (_enode)->flags & ENODE_FLAG_QUALS ) )
#define ENODE_IS_INDIRECT_TO(_enode, _etype) ( ENODE_IS((_enode), EINDIRECT) && ENODE_IS((_enode)->data.monadic, (_etype)) )
#define ENODE_IS_ASSIGN(_enode) ( ENODE_IS_RANGE((_enode), EASS, EORASS) )
#define ENODE_IS_ASSIGN_TO(_enode, _etype) ( ENODE_IS_RANGE((_enode), EASS, EORASS) && ENODE_IS((_enode)->data.diadic.left->data.monadic, (_etype)) )
// 0 to 8, 0x30 to 0x31
#define ENODE_CASE_MONADIC \
case EPOSTINC: \
case EPOSTDEC: \
case EPREINC: \
case EPREDEC: \
case EINDIRECT: \
case EMONMIN: \
case EBINNOT: \
case ELOGNOT: \
case EFORCELOAD: \
case ETYPCON: \
case EBITFIELD
// 9 to 0x1B
#define ENODE_CASE_DIADIC_1 \
case EMUL: \
case EMULV: \
case EDIV: \
case EMODULO: \
case EADDV: \
case ESUBV: \
case EADD: \
case ESUB: \
case ESHL: \
case ESHR: \
case ELESS: \
case EGREATER: \
case ELESSEQU: \
case EGREATEREQU: \
case EEQU: \
case ENOTEQU: \
case EAND: \
case EXOR: \
case EOR
// 0x1E to 0x28, 0x2D, 0x2F
#define ENODE_CASE_ASSIGN \
case EASS: \
case EMULASS: \
case EDIVASS: \
case EMODASS: \
case EADDASS: \
case ESUBASS: \
case ESHLASS: \
case ESHRASS: \
case EANDASS: \
case EXORASS: \
case EORASS: \
case EBCLR: \
case EBSET
// 9 to 0x2F
#define ENODE_CASE_DIADIC_ALL \
case EMUL: \
case EMULV: \
case EDIV: \
case EMODULO: \
case EADDV: \
case ESUBV: \
case EADD: \
case ESUB: \
case ESHL: \
case ESHR: \
case ELESS: \
case EGREATER: \
case ELESSEQU: \
case EGREATEREQU: \
case EEQU: \
case ENOTEQU: \
case EAND: \
case EXOR: \
case EOR: \
case ELAND: \
case ELOR: \
case EASS: \
case EMULASS: \
case EDIVASS: \
case EMODASS: \
case EADDASS: \
case ESUBASS: \
case ESHLASS: \
case ESHRASS: \
case EANDASS: \
case EXORASS: \
case EORASS: \
case ECOMMA: \
case EPMODULO: \
case EROTL: \
case EROTR: \
case EBCLR: \
case EBTST: \
case EBSET
#ifdef __MWERKS__
#pragma options align=reset
#endif
#endif
|