annotate dmd/backend/OPER.d @ 140:31c086f76669

dmd.lib now only contains the backend backward references from the backend to the frontend are implemented in ddmd win32_lib.mak is replaced by a patch also fixed VisualD project file predefined versions
author Trass3r
date Tue, 14 Sep 2010 01:54:48 +0200
parents 5c9b78899f5d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.backend.OPER;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
3 enum OPER : ubyte ///
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 OPunde, /* place holder for undefined operator */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 OPadd,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 OPmin,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 OPmul,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 OPdiv,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 OPmod,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 OPshr, // unsigned right shift
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 OPshl,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14 OPand,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 OPxor,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 OPor,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 OPashr, // signed right shift
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 OPnot,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 OPbool, /* "booleanize" */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 OPcom,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 OPcond,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 OPcomma,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 OPoror,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 OPandand,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 OPbit, /* ref to bit field */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 OPind, /* *E */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 OPaddr, /* &E */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28 OPneg, /* unary - */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29 OPuadd, /* unary + */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 ///#if TX86
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 OPvoid, // where casting to void is not a no-op
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 OPabs, /* absolute value */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33 OPsqrt, /* square root */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 OPrndtol, // round to short, long, long long (inline 8087 only)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 OPsin, // sine
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 OPcos, // cosine
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
37 OPrint, // round to int
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 OPscale, // ldexp
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 OPyl2x, // y * log2(x)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40 OPyl2xp1, // y * log2(x + 1)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41 OPstrlen, /* strlen() */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 OPstrcpy, /* strcpy() */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 OPstrcat, /* strcat() */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44 OPstrcmp, /* strcmp() */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 OPmemcpy,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 OPmemcmp,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 OPmemset,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48 OPsetjmp, // setjmp()
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
49 OPremquo, // / and % in one operation
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
51 OPbsf, // bit scan forward
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 OPbsr, // bit scan reverse
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 OPbt, // bit test
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
54 OPbtc, // bit test and complement
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
55 OPbtr, // bit test and reset
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56 OPbts, // bit test and set
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 OPbswap, // swap bytes
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 ///#endif
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
60 OPstreq, /* structure assignment */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 OPnegass, // x = -x
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 OPpostinc, /* x++ */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64 OPpostdec, /* x-- */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
65
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66 OPeq,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 OPaddass,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68 OPminass,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69 OPmulass,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
70 OPdivass,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 OPmodass,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 OPshrass,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 OPshlass,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74 OPandass,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
75 OPxorass,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76 OPorass,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78 /* Convert from token to assignment operator */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
79 ///#define asgtoktoop(tok) ((int) (tok) + ((int)OPeq - (int) TKeq))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
81 OPashrass,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
82
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
83 /* relational operators (in same order as corresponding tokens) */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
84 ///#define RELOPMIN ((int)OPle)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85 OPle,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
86 OPgt,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
87 OPlt,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
88 OPge,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
89 OPeqeq,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
90 OPne,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
91
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
92 OPunord, /* !<>= */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
93 OPlg, /* <> */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
94 OPleg, /* <>= */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
95 OPule, /* !> */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
96 OPul, /* !>= */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
97 OPuge, /* !< */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
98 OPug, /* !<= */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
99 OPue, /* !<> */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
100 OPngt,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
101 OPnge,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
102 OPnlt,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
103 OPnle,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
104 OPord,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
105 OPnlg,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
106 OPnleg,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
107 OPnule,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
108 OPnul,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
109 OPnuge,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
110 OPnug,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
111 OPnue,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
112
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
113 ///#define rel_toktoop(tk) ((enum OPER)((int)tk - (int)TKle + (int)OPle))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
114
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
115 /***************** End of relational operators ******************/
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
116 ///#define CNVOPMIN (OPnue+1)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
117
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
118 // parallel array inconvtab[] in cgelem.c)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
119
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
120 ///#if TX86
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
121
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
122 /* Convert from conversion operator to conversion index */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
123 ///#define convidx(op) ((int)(op) - CNVOPMIN)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
124
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
125 /* 8,16,32,64 integral type of unspecified sign
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
126 s,u signed/unsigned
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
127 f,d,ld float/double/long double
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
128 np,fp,vp,f16p near pointer/far pointer/handle pointer/far16 pointer
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
129 cvp const handle pointer
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
130 */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
131
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
132 OPb_8, // convert bit to byte
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
133 OPd_s32,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
134 OPs32_d,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
135 OPd_s16,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
136 OPs16_d,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
137 OPd_u16,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
138 OPu16_d,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
139 OPd_u32,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
140 OPu32_d,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
141 OPd_s64,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
142 OPs64_d,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
143 OPd_u64,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
144 OPu64_d,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
145 OPd_f,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
146 OPf_d,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
147 OPvp_fp,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
148 OPcvp_fp, // const handle * => far *
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
149 OPs16_32, // short to long
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
150 OPu16_32, // unsigned short to long
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
151 OP32_16, // long to short
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
152 OPu8_16, // unsigned char to short
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
153 OPs8_16, // signed char to short
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
154 OP16_8, // short to 8 bits
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
155 OPu32_64, // unsigned long to long long
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
156 OPs32_64, // long to long long
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
157 OP64_32, // long long to long
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
158 ///#define OPsfltdbl OPunde
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
159 ///#define OPdblsflt OPunde
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
160 OPoffset, // get offset of far pointer
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
161 OPnp_fp, // convert near pointer to far
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
162 OPnp_f16p, // from 0:32 to 16:16
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
163 OPf16p_np, // from 16:16 to 0:32
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
164 OPld_d,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
165 OPd_ld,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
166 OPld_u64,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
167 ///#else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
168 ///TARGET_CONVERSION_OPS
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
169 ///#endif
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
170
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
171 ///#define CNVOPMAX (OPc_r-1)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
172 ///#define convidx(op) ((int)(op) - CNVOPMIN)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
173 /* Convert from conversion operator to conversion index */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
174
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
175 ///#if 1
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
176 // The old conversion operators - retain until we get the code fixed
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
177 ///#define OPlngdbl OPs32_d
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
178 ///#define OPdblint OPd_s16
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
179 ///#define OPintdbl OPs16_d
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
180 ///#define OPdbluns OPd_u16
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
181 ///#define OPunsdbl OPu16_d
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
182 ///#define OPdblulng OPd_u32
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
183 ///#define OPulngdbl OPu32_d
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
184 ///#define OPdblllng OPd_s64
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
185 ///#define OPllngdbl OPs64_d
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
186 ///#define OPdblullng OPd_u64
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
187 ///#define OPdblflt OPd_f
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
188 ///#define OPvptrfptr OPvp_fp
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
189 ///#define OPcvptrfptr OPcvp_fp // const handle * => far *
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
190 ///#define OPshtlng OPs16_32 // short to long
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
191 ///#define OPushtlng OPu16_32 // unsigned short to long
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
192 ///#define OPlngsht OP32_16 // long to short
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
193 ///#define OPu8int OPu8_16 // unsigned char to short
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
194 ///#define OPs8int OPs8_16 // signed char to short
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
195 ///#define OPint8 OP16_8 // short to 8 bits
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
196 ///#define OPulngllng OPu32_64 // unsigned long to long long
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
197 ///#define OPlngllng OPs32_64 // long to long long
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
198 ///#define OPllnglng OP64_32 // long long to long
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
199 ///#define OPsfltdbl OPunde
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
200 ///#define OPdblsflt OPunde
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
201 ///#define OPoffset OPoffset // get offset of far pointer
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
202 ///#define OPptrlptr OPnp_fp // convert near pointer to far
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
203 ///#define OPtofar16 OPnp_f16p // from 0:32 to 16:16
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
204 ///#define OPfromfar16 OPf16p_np // from 16:16 to 0:32
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
205
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
206 ///#endif
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
207
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
208 /***************** End of conversion operators ******************/
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
209
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
210 OPc_r, // complex to real
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
211 OPc_i, // complex to imaginary
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
212 OPmsw, // top 32 bits of 64 bit word (32 bit code gen)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
213 // top 16 bits of 32 bit word (16 bit code gen)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
214
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
215 OPparam, /* function parameter separator */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
216 OPcall, /* binary function call */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
217 OPucall, /* unary function call */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
218 OPcallns, // binary function call, no side effects
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
219 OPucallns, // unary function call, no side effects
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
220
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
221 OPsizeof, /* for forward-ref'd structs */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
222 OPstrctor, /* call ctor on struct param */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
223 OPstrthis, // 'this' pointer for OPstrctor
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
224 OPstrpar, /* structure func param */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
225 OPconst, /* constant */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
226 OPrelconst, /* constant that contains an address */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
227 OPvar, /* variable */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
228 OPreg, // register (used in inline asm operand expressions)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
229 OPcolon, /* : as in ?: */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
230 OPcolon2, // alternate version with different EH semantics
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
231 OPstring, /* address of string */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
232 OPasm, /* in-line assembly code */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
233 OPinfo, // attach info (used to attach ctor/dtor
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
234 OPhalt, // insert HLT instruction
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
235 // info for exception handling)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
236 OPctor,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
237 OPdtor,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
238 OPmark,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
239 OPpair, // build register pair, E1 is lsb, E2 = msb
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
240 OPrpair, // build reversed register pair, E1 is msb, E2 = lsb
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
241 OPframeptr, // load pointer to base of frame
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
242 OPgot, // load pointer to global offset table
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
243
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
244 // Jupiter operators
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
245 OParray, // access Jupiter array, left is handle, right is index
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
246 OParraylength, // evaluates array handle into array length
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
247 OPfield, // access Jupiter object field, left is handle, right is offset
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
248 OPnewarray, // allocate Jupiter array, left is dimension, right is type
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
249 OPmultinewarray, // allocate multidimensional Jupiter array
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
250 // left is dimensions, right is (numdims,type signature)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
251 OPinstanceof, // left is class id, right is handle
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
252 OPfinalinstanceof, // left is class id, right is handle
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
253 OPcheckcast, // left is class id, right is handle
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
254 OPhstring, // handle to static string
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
255 OPnullcheck, // check if pointer is null
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
256
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
257 ///#if TX86
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
258 OPinp, /* input from I/O port */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
259 OPoutp, /* output to I/O port */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
260 ///#endif
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
261 /* C++ operators */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
262 OPnew, // operator new
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
263 OPanew, // operator new[]
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
264 OPdelete, // operator delete
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
265 OPadelete, // operator delete[]
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
266 OPbrack, /* [] subscript */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
267 OParrow, /* for -> overloading */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
268 OParrowstar, /* for ->* overloading */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
269 OPpreinc, /* ++x overloading */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
270 OPpredec, /* --x overloading */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
271
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
272 ///#ifdef TARGET_INLINEFUNC_OPS
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
273 /// TARGET_INLINEFUNC_OPS
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
274 ///#endif
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
275
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
276 ///#if (TARGET_POWERPC)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
277 OPeieio,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
278 ///#endif
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
279
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
280 OPMAX /* 1 past last operator */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
281 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
282
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
283 enum RELOPMIN = cast(int)OPER.OPle;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
284
14
2cc604139636 Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
285 version (Windows)
2cc604139636 Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
286 {
2cc604139636 Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
287 extern(C++) extern __gshared const ubyte[OPER.OPMAX] optab1;
2cc604139636 Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
288 extern(C++) extern __gshared const ubyte[OPER.OPMAX] optab2;
2cc604139636 Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
289 extern(C++) extern __gshared const ubyte[OPER.OPMAX] optab3;
2cc604139636 Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
290 extern(C++) extern __gshared const ubyte[OPER.OPMAX] opcost;
2cc604139636 Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
291 }
2cc604139636 Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
292 else
2cc604139636 Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
293 {
16
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 14
diff changeset
294 extern(C) extern __gshared const ubyte[OPER.OPMAX] optab1;
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 14
diff changeset
295 extern(C) extern __gshared const ubyte[OPER.OPMAX] optab2;
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 14
diff changeset
296 extern(C) extern __gshared const ubyte[OPER.OPMAX] optab3;
5c9b78899f5d Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents: 14
diff changeset
297 extern(C) extern __gshared const ubyte[OPER.OPMAX] opcost;
14
2cc604139636 Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
298 }
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
299
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
300 enum _OT
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
301 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
302 _OTbinary = 1,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
303 _OTunary = 2,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
304 _OTcommut = 4,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
305 _OTassoc = 8,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
306 _OTsideff = 0x10,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
307 _OTeop0e = 0x20,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
308 _OTeop00 = 0x40,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
309 _OTeop1e = 0x80,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
310
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
311 /* optab2[] */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
312 _OTlogical = 1,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
313 _OTwid = 2,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
314 _OTcall = 4,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
315 _OTrtol = 8,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
316 _OTassign = 0x10,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
317 _OTdef = 0x20,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
318 _OTae = 0x40,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
319 _OTexp = 0x80,
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
320 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
321
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
322 /+
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
323 // optab3[]
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
324 #define _OTboolnop 1
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
325 +/
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
326
140
31c086f76669 dmd.lib now only contains the backend
Trass3r
parents: 16
diff changeset
327 ubyte OTbinary(OPER op)
31c086f76669 dmd.lib now only contains the backend
Trass3r
parents: 16
diff changeset
328 {
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
329 return (optab1[op] & _OT._OTbinary);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
330 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
331
140
31c086f76669 dmd.lib now only contains the backend
Trass3r
parents: 16
diff changeset
332 ubyte OTunary(OPER op)
31c086f76669 dmd.lib now only contains the backend
Trass3r
parents: 16
diff changeset
333 {
31c086f76669 dmd.lib now only contains the backend
Trass3r
parents: 16
diff changeset
334 return (optab1[op] & _OT._OTunary);
31c086f76669 dmd.lib now only contains the backend
Trass3r
parents: 16
diff changeset
335 }
31c086f76669 dmd.lib now only contains the backend
Trass3r
parents: 16
diff changeset
336
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
337 /+
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
338 #define OTleaf(op) (!(optab1[op]&(_OTunary|_OTbinary)))
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
339 #define OTcommut(op) (optab1[op]&_OTcommut)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
340 #define OTassoc(op) (optab1[op]&_OTassoc)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
341 #define OTassign(op) (optab2[op]&_OTassign)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
342 #define OTpost(op) ((op) == OPpostinc || (op) == OPpostdec)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
343 #define OTeop0e(op) (optab1[op]&_OTeop0e)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
344 #define OTeop00(op) (optab1[op]&_OTeop00)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
345 #define OTeop1e(op) (optab1[op]&_OTeop1e)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
346 #define OTsideff(op) (optab1[op]&_OTsideff)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
347 #define OTconv(op) ((op) >= CNVOPMIN && (op) <= CNVOPMAX)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
348 #define OTlogical(op) (optab2[op]&_OTlogical)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
349 #define OTwid(op) (optab2[op]&_OTwid)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
350 #define OTopeq(op) ((op) >= OPaddass && (op) <= OPashrass)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
351 #define OTop(op) ((op) >= OPadd && (op) <= OPor)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
352 #define OTcall(op) (optab2[op]&_OTcall)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
353 #define OTrtol(op) (optab2[op]&_OTrtol)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
354 #define OTrel(op) ((op) >= OPle && (op) <= OPnue)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
355 #define OTrel2(op) ((op) >= OPle && (op) <= OPge)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
356 #define OTdef(op) (optab2[op]&_OTdef)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
357 #define OTae(op) (optab2[op]&_OTae)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
358 #define OTexp(op) (optab2[op]&_OTexp)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
359 #if 1
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
360 #define OTboolnop(op) (optab3[op]&_OTboolnop)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
361 #define OTcalldef(op) (OTcall(op) || (op) == OPstrcpy || (op) == OPstrcat || (op) == OPmemcpy)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
362 #else
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
363 #endif
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
364
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
365 /* Convert op= to op */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
366 #define opeqtoop(opx) ((opx) - OPaddass + OPadd)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
367
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
368 /* Convert op to op= */
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
369 #define optoopeq(opx) ((opx) - OPadd + OPaddass)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
370 +/
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
371
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
372 import dmd.EnumUtils;
14
2cc604139636 Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
Robert Clipsham <robert@octarineparrot.com>
parents: 0
diff changeset
373 mixin(BringToCurrentScope!(OPER));