Mercurial > projects > ddmd
annotate dmd/backend/TYPE.d @ 114:e28b18c23469
added a module dmd.common for commonly used stuff
it currently holds code for consistency checking of predefined versions
also added a VisualD project file
author | Trass3r |
---|---|
date | Wed, 01 Sep 2010 18:21:58 +0200 |
parents | 3f834bed4f13 |
children |
rev | line source |
---|---|
0 | 1 module dmd.backend.TYPE; |
2 | |
114 | 3 import dmd.common; |
0 | 4 import dmd.backend.Util; |
5 import dmd.backend.Srcpos; | |
6 import dmd.backend.elem; | |
7 import dmd.backend.LIST; | |
8 import dmd.backend.TYM; | |
9 import dmd.backend.PARAM; | |
10 import dmd.backend.targ_types; | |
11 import dmd.backend.Classsym; | |
12 | |
13 struct TYPE | |
14 { | |
15 debug { | |
16 ushort id; | |
17 enum IDtype = 0x1234; | |
18 ///#define type_debug(t) assert((t)->id == IDtype) | |
19 } else { | |
20 ///#define type_debug(t) | |
21 } | |
22 | |
23 tym_t Tty; /* mask (TYxxx) */ | |
24 ushort Tflags; // TFxxxxx | |
25 | |
26 version (TX86) { | |
22
fd4acc376c45
Implemented object file output and linking on linux.
Robert Clipsham <robert@octarineparrot.com>
parents:
16
diff
changeset
|
27 version (POSIX) { ///TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS |
0 | 28 ///#define mTYnoret 0x010000 // function has no return |
29 ///#define mTYtransu 0x010000 // transparent union | |
30 } else { | |
31 ///#define mTYfar16 0x010000 | |
32 } | |
33 ///#define mTYstdcall 0x020000 | |
34 ///#define mTYfastcall 0x040000 | |
35 ///#define mTYinterrupt 0x080000 | |
36 ///#define mTYcdecl 0x100000 | |
37 ///#define mTYpascal 0x200000 | |
38 ///#define mTYsyscall 0x400000 | |
39 ///#define mTYjava 0x800000 | |
40 | |
22
fd4acc376c45
Implemented object file output and linking on linux.
Robert Clipsham <robert@octarineparrot.com>
parents:
16
diff
changeset
|
41 version (POSIX) { ///TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS |
0 | 42 ///#define mTYTFF 0xFE0000 |
43 } else { | |
44 ///#define mTYTFF 0xFF0000 | |
45 } | |
46 | |
47 | |
48 ///#define TARGET_strucTYPE | |
49 mangle_t Tmangle; // name mangling | |
50 // Return name mangling of type | |
51 ///#define type_mangle(t) ((t)->Tmangle) | |
52 } | |
53 | |
54 uint Tcount; // # pointing to this type | |
55 TYPE* Tnext; // next in list | |
56 // TYenum: gives base type | |
57 union | |
58 { | |
59 targ_size_t Tdim; // TYarray: # of elements in array | |
60 elem* Tel; // TFvla: gives dimension (NULL if '*') | |
61 PARAM* Tparamtypes; // TYfunc, TYtemplate: types of function parameters | |
62 Classsym* Ttag; // TYstruct,TYmemptr: tag symbol | |
63 // TYenum,TYvtshape: tag symbol | |
64 char* Tident; // TYident: identifier | |
65 version (SCPP) { | |
66 TYPE* Talternate; // typtr: type of parameter before converting | |
67 } | |
68 version (MARS) { | |
69 TYPE* Tkey; // typtr: key type for associative arrays | |
70 } | |
71 } | |
72 | |
73 list_t Texcspec; // tyfunc(): list of types of exception specification | |
74 | |
75 static if (false) { | |
76 ushort Tstabidx; // Index into stab types | |
77 } | |
78 /// TARGET_strucTYPE | |
79 version (SOURCE_4TYPES) { | |
80 Srcpos Tsrcpos; /* position of type definition */ | |
81 } | |
82 version (HTOD) { | |
83 Symbol* Ttypedef; // if this type came from a typedef, this is | |
84 // the typedef symbol | |
85 } | |
86 } | |
87 | |
88 void dumpTYPE(TYPE* foo) | |
89 { | |
90 foreach (a, b; foo.tupleof) | |
91 { | |
92 std.stdio.writeln(foo.tupleof[a].stringof, " ", cast(char*)&foo.tupleof[a] - cast(char*)foo, " = ", foo.tupleof[a]); | |
93 //std.stdio.writeln("printf(\"", foo.tupleof[a].stringof, " %d = %d\\n\",(char*)(&", foo.tupleof[a].stringof, ")-(char*)foo, ", foo.tupleof[a].stringof, ");"); | |
94 } | |
95 } | |
96 | |
97 alias TYPE type; | |
98 | |
99 alias type* typep_t; | |
100 | |
25 | 101 version (Windows) { |
102 extern(C++) extern __gshared typep_t tstypes[TYM.TYMAX]; | |
103 extern(C++) extern __gshared typep_t tsptr2types[TYM.TYMAX]; | |
104 } else { | |
105 extern(C) extern __gshared typep_t tstypes[TYM.TYMAX]; | |
106 extern(C) extern __gshared typep_t tsptr2types[TYM.TYMAX]; | |
107 } | |
0 | 108 |
109 ref type* tsbool () { return tstypes[TYM.TYbool]; } | |
110 ref type* tschar () { return tstypes[TYM.TYchar]; } | |
111 ref type* tsschar () { return tstypes[TYM.TYschar]; } | |
112 ref type* tsuchar () { return tstypes[TYM.TYuchar]; } | |
113 ref type* tsshort () { return tstypes[TYM.TYshort]; } | |
114 ref type* tsushort () { return tstypes[TYM.TYushort]; } | |
115 ref type* tswchar_t () { return tstypes[TYM.TYwchar_t]; } | |
116 ref type* tsint () { return tstypes[TYM.TYint]; } | |
117 ref type* tsuns () { return tstypes[TYM.TYuint]; } | |
118 ref type* tslong () { return tstypes[TYM.TYlong]; } | |
119 ref type* tsulong () { return tstypes[TYM.TYulong]; } | |
120 ref type* tsdchar () { return tstypes[TYM.TYdchar]; } | |
121 ref type* tsllong () { return tstypes[TYM.TYllong]; } | |
122 ref type* tsullong () { return tstypes[TYM.TYullong]; } | |
123 ref type* tsfloat () { return tstypes[TYM.TYfloat]; } | |
124 ref type* tsdouble () { return tstypes[TYM.TYdouble]; } | |
125 ref type* tsreal64 () { return tstypes[TYM.TYdouble_alias]; } | |
126 ref type* tsldouble () { return tstypes[TYM.TYldouble]; } | |
16
5c9b78899f5d
Implemented methods for Tuples, fixed some linking issues.
Robert Clipsham <robert@octarineparrot.com>
parents:
14
diff
changeset
|
127 ref type* tsvoid () { return tstypes[TYM.TYvoid]; } |
0 | 128 ref type* tsifloat () { return tstypes[TYM.TYifloat]; } |
129 ref type* tsidouble () { return tstypes[TYM.TYidouble]; } | |
130 ref type* tsildouble () { return tstypes[TYM.TYildouble]; } | |
131 ref type* tscfloat () { return tstypes[TYM.TYcfloat]; } | |
132 ref type* tscdouble () { return tstypes[TYM.TYcdouble]; } | |
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
|
133 ref type* tscldouble () { return tstypes[TYM.TYcldouble]; } |