Mercurial > projects > ldc
annotate dmd/mtype.h @ 445:cc40db549aea
Changed the handling of variadic intrinsics a bit.
Removed the -fp80 option and made real be 80bit floats on X86, this is what the D spec really says it should be and fixes a bunch of issues.
Changed the handling of parameter attributes to a bit more generalized approach.
Added sext/zext attributes for byte/short/ubyte/ushort parameters, fixes #60 .
Parameter attribs now properly set for intrinsic calls if necessary.
Made the tango.math.Math patch less intrusive.
Fixed/added some mini tests.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Fri, 01 Aug 2008 17:59:58 +0200 |
parents | 3545f9eddbfc |
children | a34078905d01 |
rev | line source |
---|---|
159 | 1 |
2 // Compiler implementation of the D programming language | |
3 // Copyright (c) 1999-2007 by Digital Mars | |
4 // All Rights Reserved | |
5 // written by Walter Bright | |
6 // http://www.digitalmars.com | |
7 // License for redistribution is by either the Artistic License | |
8 // in artistic.txt, or the GNU General Public License in gnu.txt. | |
9 // See the included readme.txt for details. | |
10 | |
11 #ifndef DMD_MTYPE_H | |
12 #define DMD_MTYPE_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
16 #endif /* __DMC__ */ | |
17 | |
18 #include "root.h" | |
19 #include "stringtable.h" | |
20 | |
21 #include "arraytypes.h" | |
22 #include "expression.h" | |
23 | |
173
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
24 // llvm |
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
25 #include "../ir/irtype.h" |
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
26 |
159 | 27 struct Scope; |
28 struct Identifier; | |
29 struct Expression; | |
30 struct StructDeclaration; | |
31 struct ClassDeclaration; | |
32 struct VarDeclaration; | |
33 struct EnumDeclaration; | |
34 struct TypedefDeclaration; | |
35 struct TypeInfoDeclaration; | |
36 struct Dsymbol; | |
37 struct TemplateInstance; | |
38 enum LINK; | |
39 | |
40 struct TypeBasic; | |
41 struct HdrGenState; | |
42 | |
43 // Back end | |
44 #if IN_GCC | |
45 union tree_node; typedef union tree_node TYPE; | |
46 typedef TYPE type; | |
47 #else | |
48 typedef struct TYPE type; | |
49 #endif | |
50 struct Symbol; | |
51 | |
52 enum TY | |
53 { | |
54 Tarray, // dynamic array | |
55 Tsarray, // static array | |
56 Taarray, // associative array | |
57 Tpointer, | |
58 Treference, | |
59 Tfunction, | |
60 Tident, | |
61 Tclass, | |
62 Tstruct, | |
63 Tenum, | |
64 Ttypedef, | |
65 Tdelegate, | |
66 | |
67 Tnone, | |
68 Tvoid, | |
69 Tint8, | |
70 Tuns8, | |
71 Tint16, | |
72 Tuns16, | |
73 Tint32, | |
74 Tuns32, | |
75 Tint64, | |
76 Tuns64, | |
77 Tfloat32, | |
78 Tfloat64, | |
79 Tfloat80, | |
80 | |
81 Timaginary32, | |
82 Timaginary64, | |
83 Timaginary80, | |
84 | |
85 Tcomplex32, | |
86 Tcomplex64, | |
87 Tcomplex80, | |
88 | |
89 Tbit, | |
90 Tbool, | |
91 Tchar, | |
92 Twchar, | |
93 Tdchar, | |
94 | |
95 Terror, | |
96 Tinstance, | |
97 Ttypeof, | |
98 Ttuple, | |
99 Tslice, | |
379
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
100 |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
101 // LLVMDC |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
102 Topaque, |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
103 |
159 | 104 TMAX |
105 }; | |
106 | |
107 #define Tascii Tchar | |
108 | |
109 extern int Tsize_t; | |
110 extern int Tptrdiff_t; | |
111 | |
112 struct Type : Object | |
113 { | |
114 TY ty; | |
115 unsigned char mod; // modifiers (MODconst, MODinvariant) | |
116 #define MODconst 1 // type is const | |
117 #define MODinvariant 2 // type is invariant | |
118 Type *next; | |
119 char *deco; | |
120 Type *pto; // merged pointer to this type | |
121 Type *rto; // reference to this type | |
122 Type *arrayof; // array of this type | |
123 TypeInfoDeclaration *vtinfo; // TypeInfo object for this Type | |
124 | |
125 type *ctype; // for back end | |
126 | |
127 #define tvoid basic[Tvoid] | |
128 #define tint8 basic[Tint8] | |
129 #define tuns8 basic[Tuns8] | |
130 #define tint16 basic[Tint16] | |
131 #define tuns16 basic[Tuns16] | |
132 #define tint32 basic[Tint32] | |
133 #define tuns32 basic[Tuns32] | |
134 #define tint64 basic[Tint64] | |
135 #define tuns64 basic[Tuns64] | |
136 #define tfloat32 basic[Tfloat32] | |
137 #define tfloat64 basic[Tfloat64] | |
138 #define tfloat80 basic[Tfloat80] | |
139 | |
140 #define timaginary32 basic[Timaginary32] | |
141 #define timaginary64 basic[Timaginary64] | |
142 #define timaginary80 basic[Timaginary80] | |
143 | |
144 #define tcomplex32 basic[Tcomplex32] | |
145 #define tcomplex64 basic[Tcomplex64] | |
146 #define tcomplex80 basic[Tcomplex80] | |
147 | |
148 #define tbit basic[Tbit] | |
149 #define tbool basic[Tbool] | |
150 #define tchar basic[Tchar] | |
151 #define twchar basic[Twchar] | |
152 #define tdchar basic[Tdchar] | |
153 | |
154 // Some special types | |
155 #define tshiftcnt tint32 // right side of shift expression | |
156 // #define tboolean tint32 // result of boolean expression | |
157 #define tboolean tbool // result of boolean expression | |
158 #define tindex tint32 // array/ptr index | |
159 static Type *tvoidptr; // void* | |
160 #define terror basic[Terror] // for error recovery | |
161 | |
162 #define tsize_t basic[Tsize_t] // matches size_t alias | |
163 #define tptrdiff_t basic[Tptrdiff_t] // matches ptrdiff_t alias | |
164 #define thash_t tsize_t // matches hash_t alias | |
165 | |
166 static ClassDeclaration *typeinfo; | |
167 static ClassDeclaration *typeinfoclass; | |
168 static ClassDeclaration *typeinfointerface; | |
169 static ClassDeclaration *typeinfostruct; | |
170 static ClassDeclaration *typeinfotypedef; | |
171 static ClassDeclaration *typeinfopointer; | |
172 static ClassDeclaration *typeinfoarray; | |
173 static ClassDeclaration *typeinfostaticarray; | |
174 static ClassDeclaration *typeinfoassociativearray; | |
175 static ClassDeclaration *typeinfoenum; | |
176 static ClassDeclaration *typeinfofunction; | |
177 static ClassDeclaration *typeinfodelegate; | |
178 static ClassDeclaration *typeinfotypelist; | |
179 | |
379
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
180 // LLVMDC, for runtime function signatures that contain |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
181 // AAs or arrays of unknown type |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
182 static Type* topaque; |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
183 |
159 | 184 static Type *basic[TMAX]; |
185 static unsigned char mangleChar[TMAX]; | |
186 static StringTable stringtable; | |
187 | |
188 // These tables are for implicit conversion of binary ops; | |
189 // the indices are the type of operand one, followed by operand two. | |
190 static unsigned char impcnvResult[TMAX][TMAX]; | |
191 static unsigned char impcnvType1[TMAX][TMAX]; | |
192 static unsigned char impcnvType2[TMAX][TMAX]; | |
193 | |
194 // If !=0, give warning on implicit conversion | |
195 static unsigned char impcnvWarn[TMAX][TMAX]; | |
196 | |
197 Type(TY ty, Type *next); | |
198 virtual Type *syntaxCopy(); | |
199 int equals(Object *o); | |
200 int dyncast() { return DYNCAST_TYPE; } // kludge for template.isType() | |
201 int covariant(Type *t); | |
202 char *toChars(); | |
203 static char needThisPrefix(); | |
204 static void init(); | |
205 d_uns64 size(); | |
206 virtual d_uns64 size(Loc loc); | |
207 virtual unsigned alignsize(); | |
208 virtual Type *semantic(Loc loc, Scope *sc); | |
209 virtual void toDecoBuffer(OutBuffer *buf); | |
210 Type *merge(); | |
211 virtual void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
212 virtual void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
213 void toCBuffer3(OutBuffer *buf, HdrGenState *hgs, int mod); | |
214 virtual int isbit(); | |
215 virtual int isintegral(); | |
216 virtual int isfloating(); // real, imaginary, or complex | |
217 virtual int isreal(); | |
218 virtual int isimaginary(); | |
219 virtual int iscomplex(); | |
220 virtual int isscalar(); | |
221 virtual int isunsigned(); | |
222 virtual int isauto(); | |
223 virtual int isString(); | |
224 virtual int checkBoolean(); // if can be converted to boolean value | |
225 void checkDeprecated(Loc loc, Scope *sc); | |
226 Type *pointerTo(); | |
227 Type *referenceTo(); | |
228 Type *arrayOf(); | |
229 virtual Dsymbol *toDsymbol(Scope *sc); | |
230 virtual Type *toBasetype(); | |
231 virtual int isBaseOf(Type *t, int *poffset); | |
232 virtual MATCH implicitConvTo(Type *to); | |
233 virtual ClassDeclaration *isClassHandle(); | |
234 virtual Expression *getProperty(Loc loc, Identifier *ident); | |
235 virtual Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
236 virtual unsigned memalign(unsigned salign); | |
237 virtual Expression *defaultInit(Loc loc = 0); | |
238 virtual int isZeroInit(); // if initializer is 0 | |
239 virtual dt_t **toDt(dt_t **pdt); | |
240 Identifier *getTypeInfoIdent(int internal); | |
241 virtual MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
242 virtual void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
243 Expression *getInternalTypeInfo(Scope *sc); | |
244 Expression *getTypeInfo(Scope *sc); | |
245 virtual TypeInfoDeclaration *getTypeInfoDeclaration(); | |
246 virtual int builtinTypeInfo(); | |
247 virtual Type *reliesOnTident(); | |
248 virtual Expression *toExpression(); | |
249 virtual int hasPointers(); | |
250 Type *nextOf() { return next; } | |
251 | |
252 static void error(Loc loc, const char *format, ...); | |
253 | |
254 // For backend | |
255 virtual unsigned totym(); | |
256 virtual type *toCtype(); | |
257 virtual type *toCParamtype(); | |
258 virtual Symbol *toSymbol(); | |
259 | |
260 // For eliminating dynamic_cast | |
261 virtual TypeBasic *isTypeBasic(); | |
173
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
262 |
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
263 // llvmdc |
db9890b3fb64
[svn r189] moving IR data back into DMD frontend nodes
ChristianK
parents:
162
diff
changeset
|
264 IrType ir; |
159 | 265 }; |
266 | |
267 struct TypeBasic : Type | |
268 { | |
269 char *dstring; | |
270 char *cstring; | |
271 unsigned flags; | |
272 | |
273 TypeBasic(TY ty); | |
274 Type *syntaxCopy(); | |
275 d_uns64 size(Loc loc); | |
276 unsigned alignsize(); | |
277 Expression *getProperty(Loc loc, Identifier *ident); | |
278 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
279 char *toChars(); | |
280 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
281 int isintegral(); | |
282 int isbit(); | |
283 int isfloating(); | |
284 int isreal(); | |
285 int isimaginary(); | |
286 int iscomplex(); | |
287 int isscalar(); | |
288 int isunsigned(); | |
289 MATCH implicitConvTo(Type *to); | |
290 Expression *defaultInit(Loc loc); | |
291 int isZeroInit(); | |
292 int builtinTypeInfo(); | |
293 | |
294 // For eliminating dynamic_cast | |
295 TypeBasic *isTypeBasic(); | |
296 }; | |
297 | |
298 struct TypeArray : Type | |
299 { | |
300 TypeArray(TY ty, Type *next); | |
301 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
302 }; | |
303 | |
304 // Static array, one with a fixed dimension | |
305 struct TypeSArray : TypeArray | |
306 { | |
307 Expression *dim; | |
308 | |
309 TypeSArray(Type *t, Expression *dim); | |
310 Type *syntaxCopy(); | |
311 d_uns64 size(Loc loc); | |
312 unsigned alignsize(); | |
313 Type *semantic(Loc loc, Scope *sc); | |
314 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
315 void toDecoBuffer(OutBuffer *buf); | |
316 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
317 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
318 int isString(); | |
319 int isZeroInit(); | |
320 unsigned memalign(unsigned salign); | |
321 MATCH implicitConvTo(Type *to); | |
322 Expression *defaultInit(Loc loc); | |
323 dt_t **toDt(dt_t **pdt); | |
324 dt_t **toDtElem(dt_t **pdt, Expression *e); | |
325 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
326 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
327 Expression *toExpression(); | |
328 int hasPointers(); | |
329 | |
330 type *toCtype(); | |
331 type *toCParamtype(); | |
332 }; | |
333 | |
334 // Dynamic array, no dimension | |
335 struct TypeDArray : TypeArray | |
336 { | |
337 TypeDArray(Type *t); | |
338 Type *syntaxCopy(); | |
339 d_uns64 size(Loc loc); | |
340 unsigned alignsize(); | |
341 Type *semantic(Loc loc, Scope *sc); | |
342 void toDecoBuffer(OutBuffer *buf); | |
343 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
344 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
345 int isString(); | |
346 int isZeroInit(); | |
347 int checkBoolean(); | |
348 MATCH implicitConvTo(Type *to); | |
349 Expression *defaultInit(Loc loc); | |
350 int builtinTypeInfo(); | |
351 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
352 int hasPointers(); | |
353 | |
354 type *toCtype(); | |
355 }; | |
356 | |
357 struct TypeAArray : TypeArray | |
358 { | |
359 Type *index; // key type for type checking | |
360 Type *key; // actual key type | |
361 | |
362 TypeAArray(Type *t, Type *index); | |
363 Type *syntaxCopy(); | |
364 d_uns64 size(Loc loc); | |
365 Type *semantic(Loc loc, Scope *sc); | |
336 | 366 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); |
159 | 367 void toDecoBuffer(OutBuffer *buf); |
368 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
369 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
370 Expression *defaultInit(Loc loc); | |
371 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
211
f66219e0d530
[svn r227] Fixed: crash in lifetime.d when resizing array of AAs by .length assignment.
lindquist
parents:
173
diff
changeset
|
372 int isZeroInit(); |
159 | 373 int checkBoolean(); |
374 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
375 int hasPointers(); | |
376 | |
377 // Back end | |
378 Symbol *aaGetSymbol(char *func, int flags); | |
379 | |
380 type *toCtype(); | |
381 }; | |
382 | |
383 struct TypePointer : Type | |
384 { | |
385 TypePointer(Type *t); | |
386 Type *syntaxCopy(); | |
387 Type *semantic(Loc loc, Scope *sc); | |
388 d_uns64 size(Loc loc); | |
389 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
390 MATCH implicitConvTo(Type *to); | |
391 int isscalar(); | |
411
3545f9eddbfc
Switch TypePointer::isunsigned from false to true, so CmpExp::toElem chooses the right operand for pointer comparisons.
Christian Kamm <kamm incasoftware de>
parents:
379
diff
changeset
|
392 // LLVMDC: pointers are unsigned |
3545f9eddbfc
Switch TypePointer::isunsigned from false to true, so CmpExp::toElem chooses the right operand for pointer comparisons.
Christian Kamm <kamm incasoftware de>
parents:
379
diff
changeset
|
393 int isunsigned() { return TRUE; }; |
159 | 394 Expression *defaultInit(Loc loc); |
395 int isZeroInit(); | |
396 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
397 int hasPointers(); | |
398 | |
399 type *toCtype(); | |
400 }; | |
401 | |
402 struct TypeReference : Type | |
403 { | |
404 TypeReference(Type *t); | |
405 Type *syntaxCopy(); | |
406 d_uns64 size(Loc loc); | |
407 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
408 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
409 Expression *defaultInit(Loc loc); | |
410 int isZeroInit(); | |
411 }; | |
412 | |
413 enum RET | |
414 { | |
415 RETregs = 1, // returned in registers | |
416 RETstack = 2, // returned on stack | |
417 }; | |
418 | |
419 struct TypeFunction : Type | |
420 { | |
421 Arguments *parameters; // function parameters | |
422 int varargs; // 1: T t, ...) style for variable number of arguments | |
423 // 2: T t ...) style for variable number of arguments | |
424 enum LINK linkage; // calling convention | |
425 | |
426 int inuse; | |
427 | |
428 TypeFunction(Arguments *parameters, Type *treturn, int varargs, enum LINK linkage); | |
429 Type *syntaxCopy(); | |
430 Type *semantic(Loc loc, Scope *sc); | |
431 void toDecoBuffer(OutBuffer *buf); | |
432 void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); | |
433 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
434 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
435 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
436 Type *reliesOnTident(); | |
437 | |
438 int callMatch(Expressions *toargs); | |
439 type *toCtype(); | |
440 enum RET retStyle(); | |
441 | |
442 unsigned totym(); | |
443 | |
444 bool llvmRetInPtr; | |
445 bool llvmUsesThis; | |
445
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
411
diff
changeset
|
446 unsigned llvmRetAttrs; |
159 | 447 }; |
448 | |
449 struct TypeDelegate : Type | |
450 { | |
451 TypeDelegate(Type *t); | |
452 Type *syntaxCopy(); | |
453 Type *semantic(Loc loc, Scope *sc); | |
454 d_uns64 size(Loc loc); | |
455 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
456 Expression *defaultInit(Loc loc); | |
457 int isZeroInit(); | |
458 int checkBoolean(); | |
459 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
460 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
461 int hasPointers(); | |
462 | |
463 type *toCtype(); | |
464 }; | |
465 | |
466 struct TypeQualified : Type | |
467 { | |
468 Loc loc; | |
469 Array idents; // array of Identifier's representing ident.ident.ident etc. | |
470 | |
471 TypeQualified(TY ty, Loc loc); | |
472 void syntaxCopyHelper(TypeQualified *t); | |
473 void addIdent(Identifier *ident); | |
474 void toCBuffer2Helper(OutBuffer *buf, HdrGenState *hgs); | |
475 d_uns64 size(Loc loc); | |
476 void resolveHelper(Loc loc, Scope *sc, Dsymbol *s, Dsymbol *scopesym, | |
477 Expression **pe, Type **pt, Dsymbol **ps); | |
478 }; | |
479 | |
480 struct TypeIdentifier : TypeQualified | |
481 { | |
482 Identifier *ident; | |
483 | |
484 TypeIdentifier(Loc loc, Identifier *ident); | |
485 Type *syntaxCopy(); | |
486 //char *toChars(); | |
487 void toDecoBuffer(OutBuffer *buf); | |
488 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
489 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
490 Dsymbol *toDsymbol(Scope *sc); | |
491 Type *semantic(Loc loc, Scope *sc); | |
492 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
493 Type *reliesOnTident(); | |
494 Expression *toExpression(); | |
495 }; | |
496 | |
497 /* Similar to TypeIdentifier, but with a TemplateInstance as the root | |
498 */ | |
499 struct TypeInstance : TypeQualified | |
500 { | |
501 TemplateInstance *tempinst; | |
502 | |
503 TypeInstance(Loc loc, TemplateInstance *tempinst); | |
504 Type *syntaxCopy(); | |
505 //char *toChars(); | |
506 //void toDecoBuffer(OutBuffer *buf); | |
507 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
508 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
509 Type *semantic(Loc loc, Scope *sc); | |
510 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
511 }; | |
512 | |
513 struct TypeTypeof : TypeQualified | |
514 { | |
515 Expression *exp; | |
516 | |
517 TypeTypeof(Loc loc, Expression *exp); | |
518 Type *syntaxCopy(); | |
519 Dsymbol *toDsymbol(Scope *sc); | |
520 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
521 Type *semantic(Loc loc, Scope *sc); | |
522 d_uns64 size(Loc loc); | |
523 }; | |
524 | |
525 struct TypeStruct : Type | |
526 { | |
527 StructDeclaration *sym; | |
528 | |
529 TypeStruct(StructDeclaration *sym); | |
530 d_uns64 size(Loc loc); | |
531 unsigned alignsize(); | |
532 char *toChars(); | |
533 Type *syntaxCopy(); | |
534 Type *semantic(Loc loc, Scope *sc); | |
535 Dsymbol *toDsymbol(Scope *sc); | |
536 void toDecoBuffer(OutBuffer *buf); | |
537 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
538 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
539 unsigned memalign(unsigned salign); | |
540 Expression *defaultInit(Loc loc); | |
541 int isZeroInit(); | |
542 int checkBoolean(); | |
543 dt_t **toDt(dt_t **pdt); | |
544 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
545 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
546 int hasPointers(); | |
547 | |
548 type *toCtype(); | |
549 }; | |
550 | |
551 struct TypeEnum : Type | |
552 { | |
553 EnumDeclaration *sym; | |
554 | |
555 TypeEnum(EnumDeclaration *sym); | |
556 d_uns64 size(Loc loc); | |
557 unsigned alignsize(); | |
558 char *toChars(); | |
559 Type *semantic(Loc loc, Scope *sc); | |
560 Dsymbol *toDsymbol(Scope *sc); | |
561 void toDecoBuffer(OutBuffer *buf); | |
562 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
563 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
564 Expression *getProperty(Loc loc, Identifier *ident); | |
565 int isintegral(); | |
566 int isfloating(); | |
567 int isscalar(); | |
568 int isunsigned(); | |
569 MATCH implicitConvTo(Type *to); | |
570 Type *toBasetype(); | |
571 Expression *defaultInit(Loc loc); | |
572 int isZeroInit(); | |
573 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
574 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
575 int hasPointers(); | |
576 | |
577 type *toCtype(); | |
578 }; | |
579 | |
580 struct TypeTypedef : Type | |
581 { | |
582 TypedefDeclaration *sym; | |
583 | |
584 TypeTypedef(TypedefDeclaration *sym); | |
585 Type *syntaxCopy(); | |
586 d_uns64 size(Loc loc); | |
587 unsigned alignsize(); | |
588 char *toChars(); | |
589 Type *semantic(Loc loc, Scope *sc); | |
590 Dsymbol *toDsymbol(Scope *sc); | |
591 void toDecoBuffer(OutBuffer *buf); | |
592 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
593 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
594 Expression *getProperty(Loc loc, Identifier *ident); | |
595 int isbit(); | |
596 int isintegral(); | |
597 int isfloating(); | |
598 int isreal(); | |
599 int isimaginary(); | |
600 int iscomplex(); | |
601 int isscalar(); | |
602 int isunsigned(); | |
603 int checkBoolean(); | |
604 Type *toBasetype(); | |
605 MATCH implicitConvTo(Type *to); | |
606 Expression *defaultInit(Loc loc); | |
607 int isZeroInit(); | |
608 dt_t **toDt(dt_t **pdt); | |
609 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
610 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
611 int hasPointers(); | |
612 | |
613 type *toCtype(); | |
614 type *toCParamtype(); | |
615 }; | |
616 | |
617 struct TypeClass : Type | |
618 { | |
619 ClassDeclaration *sym; | |
620 | |
621 TypeClass(ClassDeclaration *sym); | |
622 d_uns64 size(Loc loc); | |
623 char *toChars(); | |
624 Type *syntaxCopy(); | |
625 Type *semantic(Loc loc, Scope *sc); | |
626 Dsymbol *toDsymbol(Scope *sc); | |
627 void toDecoBuffer(OutBuffer *buf); | |
628 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
629 Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); | |
630 ClassDeclaration *isClassHandle(); | |
631 int isBaseOf(Type *t, int *poffset); | |
632 MATCH implicitConvTo(Type *to); | |
633 Expression *defaultInit(Loc loc); | |
634 int isZeroInit(); | |
635 MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes); | |
636 int isauto(); | |
637 int checkBoolean(); | |
638 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
639 int hasPointers(); | |
640 | |
641 type *toCtype(); | |
642 | |
643 Symbol *toSymbol(); | |
644 }; | |
645 | |
646 struct TypeTuple : Type | |
647 { | |
648 Arguments *arguments; // types making up the tuple | |
649 | |
650 TypeTuple(Arguments *arguments); | |
651 TypeTuple(Expressions *exps); | |
652 Type *syntaxCopy(); | |
653 Type *semantic(Loc loc, Scope *sc); | |
654 int equals(Object *o); | |
655 Type *reliesOnTident(); | |
656 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
657 void toDecoBuffer(OutBuffer *buf); | |
658 Expression *getProperty(Loc loc, Identifier *ident); | |
659 TypeInfoDeclaration *getTypeInfoDeclaration(); | |
660 }; | |
661 | |
662 struct TypeSlice : Type | |
663 { | |
664 Expression *lwr; | |
665 Expression *upr; | |
666 | |
667 TypeSlice(Type *next, Expression *lwr, Expression *upr); | |
668 Type *syntaxCopy(); | |
669 Type *semantic(Loc loc, Scope *sc); | |
670 void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); | |
671 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); | |
672 }; | |
673 | |
379
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
674 //LLVMDC |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
675 struct TypeOpaque : Type |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
676 { |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
677 TypeOpaque() : Type(Topaque, NULL) {} |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
678 void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod); |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
679 }; |
d632801b15f0
Introducing opaque type to dmd frontent to be used with certain runtime array
Christian Kamm <kamm incasoftware de>
parents:
336
diff
changeset
|
680 |
159 | 681 /**************************************************************/ |
682 | |
683 //enum InOut { None, In, Out, InOut, Lazy }; | |
684 | |
685 struct Argument : Object | |
686 { | |
687 //enum InOut inout; | |
688 unsigned storageClass; | |
689 Type *type; | |
690 Identifier *ident; | |
691 Expression *defaultArg; | |
692 | |
693 Argument(unsigned storageClass, Type *type, Identifier *ident, Expression *defaultArg); | |
694 Argument *syntaxCopy(); | |
695 Type *isLazyArray(); | |
696 void toDecoBuffer(OutBuffer *buf); | |
697 static Arguments *arraySyntaxCopy(Arguments *args); | |
698 static char *argsTypesToChars(Arguments *args, int varargs); | |
699 static void argsToCBuffer(OutBuffer *buf, HdrGenState *hgs, Arguments *arguments, int varargs); | |
700 static void argsToDecoBuffer(OutBuffer *buf, Arguments *arguments); | |
701 static size_t dim(Arguments *arguments); | |
702 static Argument *getNth(Arguments *arguments, size_t nth, size_t *pn = NULL); | |
217
0806379a5eca
[svn r233] Added: -oq command line option for writing fully qualified object names.
lindquist
parents:
211
diff
changeset
|
703 |
0806379a5eca
[svn r233] Added: -oq command line option for writing fully qualified object names.
lindquist
parents:
211
diff
changeset
|
704 // LLVMDC |
445
cc40db549aea
Changed the handling of variadic intrinsics a bit.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
411
diff
changeset
|
705 unsigned llvmAttrs; |
159 | 706 }; |
707 | |
708 extern int PTRSIZE; | |
709 extern int REALSIZE; | |
710 extern int REALPAD; | |
711 extern int Tsize_t; | |
712 extern int Tptrdiff_t; | |
713 | |
714 #endif /* DMD_MTYPE_H */ |