Mercurial > projects > ddmd
annotate dmd/backend/Config.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.Config; |
2 | |
114 | 3 import dmd.common; |
0 | 4 import dmd.backend.LINKAGE; |
5 import dmd.EnumUtils; | |
6 | |
7 extern (C) { | |
8 void cod3_set64(); | |
9 void cod3_set386(); | |
10 } | |
11 | |
25 | 12 |
13 debug { | |
14 | |
15 version (Windows) { | |
16 extern (C++) extern | |
17 { | |
18 __gshared char debuga; /* cg - watch assignaddr() */ | |
19 __gshared char debugb; /* watch block optimization */ | |
20 __gshared char debugc; /* watch code generated */ | |
21 __gshared char debugd; /* watch debug information generated */ | |
22 __gshared char debuge; // dump eh info | |
23 __gshared char debugf; /* trees after dooptim */ | |
24 __gshared char debugg; /* trees for code generator */ | |
25 __gshared char debugo; // watch optimizer | |
26 __gshared char debugr; // watch register allocation | |
27 __gshared char debugs; /* watch common subexp eliminator */ | |
28 __gshared char debugt; /* do test points */ | |
29 __gshared char debugu; | |
30 __gshared char debugw; /* watch progress */ | |
31 __gshared char debugx; /* suppress predefined CPP stuff */ | |
32 __gshared char debugy; /* watch output to il buffer */ | |
33 } | |
34 } else { | |
35 extern (C) extern | |
36 { | |
37 __gshared char debuga; /* cg - watch assignaddr() */ | |
38 __gshared char debugb; /* watch block optimization */ | |
39 __gshared char debugc; /* watch code generated */ | |
40 __gshared char debugd; /* watch debug information generated */ | |
41 __gshared char debuge; // dump eh info | |
42 __gshared char debugf; /* trees after dooptim */ | |
43 __gshared char debugg; /* trees for code generator */ | |
44 __gshared char debugo; // watch optimizer | |
45 __gshared char debugr; // watch register allocation | |
46 __gshared char debugs; /* watch common subexp eliminator */ | |
47 __gshared char debugt; /* do test points */ | |
48 __gshared char debugu; | |
49 __gshared char debugw; /* watch progress */ | |
50 __gshared char debugx; /* suppress predefined CPP stuff */ | |
51 __gshared char debugy; /* watch output to il buffer */ | |
52 } | |
53 } | |
54 | |
0 | 55 } |
56 | |
57 // This part of the configuration is saved in the precompiled header for use | |
58 // in comparing to make sure it hasn't changed. | |
59 | |
60 enum CFG2 | |
61 { | |
62 CFG2comdat = 1, // use initialized common blocks | |
63 CFG2nodeflib = 2, // no default library imbedded in OBJ file | |
64 CFG2browse = 4, // generate browse records | |
65 CFG2dyntyping = 8, // generate dynamic typing information | |
66 CFG2fulltypes = 0x10, // don't optimize CV4 class info | |
67 CFG2warniserr = 0x20, // treat warnings as errors | |
68 CFG2phauto = 0x40, // automatic precompiled headers | |
69 CFG2phuse = 0x80, // use precompiled headers | |
70 CFG2phgen = 0x100, // generate precompiled header | |
71 CFG2once = 0x200, // only include header files once | |
72 CFG2hdrdebug = 0x400, // generate debug info for header | |
73 CFG2phautoy = 0x800, // fast build precompiled headers | |
74 CFG2noobj = 0x1000, // we are not generating a .OBJ file | |
75 CFG2noerrmax = 0x4000, // no error count maximum | |
76 CFG2expand = 0x8000, // expanded output to list file | |
77 CFG2seh = 0x10000, // use Win32 SEH to support any exception handling | |
78 CFGX2 = (CFG2warniserr | CFG2phuse | CFG2phgen | CFG2phauto | CFG2once | CFG2hdrdebug | CFG2noobj | CFG2noerrmax | CFG2expand | CFG2nodeflib), | |
79 } | |
80 | |
81 enum CFG3ju = 1; // char == unsigned char | |
82 enum CFG3eh = 4; // generate exception handling stuff | |
83 enum CFG3strcod = 8; // strings are placed in code segment | |
84 enum CFG3eseqds = 0x10; // ES == DS at all times | |
85 enum CFG3ptrchk = 0x20; // generate pointer validation code | |
86 enum CFG3strictproto = 0x40; // strict prototyping | |
87 enum CFG3autoproto = 0x80; // auto prototyping | |
88 enum CFG3rtti = 0x100; // add RTTI support | |
89 enum CFG3relax = 0x200; // relaxed type checking (C only) | |
90 enum CFG3cpp = 0x400; // C++ compile | |
91 enum CFG3igninc = 0x800; // ignore standard include directory | |
22
fd4acc376c45
Implemented object file output and linking on linux.
Robert Clipsham <robert@octarineparrot.com>
parents:
16
diff
changeset
|
92 version (POSIX) {///TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS) { |
0 | 93 enum CFG3mars = 0x1000; // use mars libs and headers |
94 enum NO_FAR = true; // always ignore __far and __huge keywords | |
95 } else { | |
96 enum CFG3nofar = 0x1000; // ignore __far and __huge keywords | |
97 ///enum NO_FAR = (config.flags3 & CFG3nofar); | |
98 } | |
99 enum CFG3noline = 0x2000; // do not output #line directives | |
100 enum CFG3comment = 0x4000; // leave comments in preprocessed output | |
101 enum CFG3cppcomment = 0x8000; // allow C++ style comments | |
102 enum CFG3wkfloat = 0x10000; // make floating point references weak externs | |
103 enum CFG3digraphs = 0x20000; // support ANSI C++ digraphs | |
104 ///#if TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS | |
105 enum CFG3semirelax = 0x40000; // moderate relaxed type checking | |
106 ///#endif | |
107 enum CFG3pic = 0x80000; // position independent code | |
108 enum CFGX3 = (CFG3strcod | CFG3ptrchk); | |
109 | |
110 enum CFG4speed = 1; // optimized for speed | |
111 enum CFG4space = 2; // optimized for space | |
112 enum CFG4optimized = (CFG4speed | CFG4space); | |
113 enum CFG4allcomdat = 4; // place all functions in COMDATs | |
114 enum CFG4fastfloat = 8; // fast floating point (-ff) | |
115 enum CFG4fdivcall = 0x10; // make function call for FDIV opcodes | |
116 enum CFG4tempinst = 0x20; // instantiate templates for undefined functions | |
117 enum CFG4oldstdmangle = 0x40; // do stdcall mangling without @ | |
118 enum CFG4pascal = 0x80; // default to pascal linkage | |
119 enum CFG4stdcall = 0x100; // default to std calling convention | |
120 enum CFG4cacheph = 0x200; // cache precompiled headers in memory | |
121 enum CFG4alternate = 0x400; // if alternate digraph tokens | |
122 enum CFG4bool = 0x800; // support 'bool' as basic type | |
123 enum CFG4wchar_t = 0x1000; // support 'wchar_t' as basic type | |
124 enum CFG4notempexp = 0x2000; // no instantiation of template functions | |
125 enum CFG4anew = 0x4000; // allow operator new[] and delete[] overloading | |
126 enum CFG4oldtmangle = 0x8000; // use old template name mangling | |
127 enum CFG4dllrtl = 0x10000; // link with DLL RTL | |
128 enum CFG4noemptybaseopt = 0x40000; // turn off empty base class optimization | |
129 enum CFG4stackalign = CFG4speed; // align stack to 8 bytes | |
130 enum CFG4nowchar_t = 0x80000; // use unsigned short name mangling for wchar_t | |
131 enum CFG4forscope = 0x100000; // new C++ for scoping rules | |
132 enum CFG4warnccast = 0x200000; // warn about C style casts | |
133 enum CFG4adl = 0x400000; // argument dependent lookup | |
134 enum CFG4enumoverload = 0x800000; // enum overloading | |
135 enum CFG4implicitfromvoid = 0x1000000; // allow implicit cast from void* to T* | |
136 enum CFG4dependent = 0x2000000; // dependent / non-dependent lookup | |
137 enum CFG4wchar_is_long = 0x4000000; // wchar_t is 4 bytes | |
138 enum CFG4underscore = 0x8000000; // prepend _ for C mangling | |
139 enum CFGX4 = (CFG4optimized | CFG4fastfloat | CFG4fdivcall | CFG4tempinst | CFG4cacheph | CFG4notempexp | CFG4stackalign | CFG4dependent); | |
140 enum CFGY4 = (CFG4nowchar_t | CFG4noemptybaseopt | CFG4adl | CFG4enumoverload | CFG4implicitfromvoid | CFG4wchar_is_long | CFG4underscore); | |
141 | |
142 mixin(BringToCurrentScope!(CFG2)); | |
143 | |
144 enum TARGET | |
145 { | |
146 TARGET_8086= 0, | |
147 TARGET_80286= 2, | |
148 TARGET_80386= 3, | |
149 TARGET_80486= 4, | |
150 TARGET_Pentium= 5, | |
151 TARGET_PentiumMMX= 6, | |
152 TARGET_PentiumPro= 7, | |
153 TARGET_PentiumII= 8, | |
154 TARGET_AMD64= 9, //(32 or 64 bit mode) | |
155 } | |
156 | |
157 mixin(BringToCurrentScope!(TARGET)); | |
158 | |
159 struct Config | |
160 { | |
161 char language; // 'C' = C, 'D' = C++ | |
162 //#define CPP (config.language == 'D') | |
163 char version_[8]; // = VERSION | |
164 char exetype[3]; // distinguish exe types so PH | |
165 // files are distinct (= SUFFIX) | |
166 | |
167 char target_cpu; // instruction selection | |
168 char target_scheduler; // instruction scheduling (normally same as selection) | |
169 | |
170 short versionint; // intermediate file version (= VERSIONINT) | |
171 int defstructalign; // struct alignment specified by command line | |
172 short hxversion; // HX version number | |
173 char fulltypes; | |
174 uint wflags; // flags for Windows code generation | |
175 | |
176 char inline8087; /* 0: emulator | |
177 1: IEEE 754 inline 8087 code | |
178 2: fast inline 8087 code | |
179 */ | |
180 short memmodel; // 0:S,X,N,F, 1:M, 2:C, 3:L, 4:V | |
181 uint exe; // target operating system | |
182 | |
183 ///#define EX_flat (EX_OS2 | EX_NT | EX_LINUX | EX_WIN64 | EX_LINUX64 | \ | |
184 /// EX_OSX | EX_OSX64 | EX_FREEBSD | EX_FREEBSD64 | \ | |
185 /// EX_SOLARIS | EX_SOLARIS64) | |
186 ///#define EX_dos (EX_DOSX | EX_ZPM | EX_RATIONAL | EX_PHARLAP | \ | |
187 /// EX_COM | EX_MZ /*| EX_WIN16*/) | |
188 | |
189 /* CFGX: flags ignored in precompiled headers | |
190 * CFGY: flags copied from precompiled headers into current config | |
191 */ | |
192 uint flags; | |
193 uint flags2; | |
194 uint flags3; | |
195 uint flags4; | |
196 uint flags5; | |
197 ///#define CFG5debug 1 // compile in __debug code | |
198 ///#define CFG5in 2 // compile in __in code | |
199 ///#define CFG5out 4 // compile in __out code | |
200 ///#define CFG5invariant 8 // compile in __invariant code | |
201 | |
202 ///#if HTOD | |
203 /// unsigned htodFlags; // configuration for htod | |
204 ///#define HTODFinclude 1 // -hi drill down into #include files | |
205 ///#define HTODFsysinclude 2 // -hs drill down into system #include files | |
206 ///#define HTODFtypedef 4 // -ht drill down into typedefs | |
207 ///#define HTODFcdecl 8 // -hc skip C declarations as comments | |
208 ///#endif | |
209 char ansi_c; // strict ANSI C | |
210 // 89 for ANSI C89, 99 for ANSI C99 | |
211 char asian_char; /* 0: normal, 1: Japanese, 2: Chinese */ | |
212 /* and Taiwanese, 3: Korean */ | |
213 uint threshold; // data larger than threshold is assumed to | |
214 // be far (16 bit models only) | |
215 ///#define THRESHMAX 0xFFFF // if threshold == THRESHMAX, all data defaults | |
216 // to near | |
217 LINKAGE linkage; // default function call linkage | |
218 } | |
219 | |
25 | 220 version (Windows) { |
221 extern (C++) extern __gshared Config config; | |
222 } else { | |
223 extern (C) extern __gshared Config config; | |
224 } | |
0 | 225 |
226 enum CVNONE = 0; // No symbolic info | |
22
fd4acc376c45
Implemented object file output and linking on linux.
Robert Clipsham <robert@octarineparrot.com>
parents:
16
diff
changeset
|
227 enum CVOLD = 1; // Codeview 1 symbolic info |
fd4acc376c45
Implemented object file output and linking on linux.
Robert Clipsham <robert@octarineparrot.com>
parents:
16
diff
changeset
|
228 enum CV4 = 2; // Codeview 4 symbolic info |
fd4acc376c45
Implemented object file output and linking on linux.
Robert Clipsham <robert@octarineparrot.com>
parents:
16
diff
changeset
|
229 enum CVSYM = 3; // Symantec format |
fd4acc376c45
Implemented object file output and linking on linux.
Robert Clipsham <robert@octarineparrot.com>
parents:
16
diff
changeset
|
230 enum CVTDB = 4; // Symantec format written to file |
fd4acc376c45
Implemented object file output and linking on linux.
Robert Clipsham <robert@octarineparrot.com>
parents:
16
diff
changeset
|
231 enum CVDWARF_C = 5; // Dwarf in C format |
fd4acc376c45
Implemented object file output and linking on linux.
Robert Clipsham <robert@octarineparrot.com>
parents:
16
diff
changeset
|
232 enum CVDWARF_D = 6; // Dwarf in D format |
fd4acc376c45
Implemented object file output and linking on linux.
Robert Clipsham <robert@octarineparrot.com>
parents:
16
diff
changeset
|
233 enum CVSTABS = 7; // Elf Stabs in C format |
0 | 234 |
235 enum CFGuchar = 1; // chars are unsigned | |
236 enum CFGsegs = 2; // new code seg for each far func | |
237 enum CFGtrace = 4; // output trace functions | |
238 enum CFGglobal = 8; // make all static functions global | |
239 enum CFGstack = 0x20; // add stack overflow checking | |
240 enum CFGalwaysframe = 0x40; // always generate stack frame | |
241 enum CFGnoebp = 0x80; // do not use EBP as general purpose register | |
242 enum CFGromable = 0x100; // put switch tables in code segment | |
243 enum CFGeasyomf = 0x200; // generate Pharlap Easy-OMF format | |
244 enum CFGfarvtbls = 0x800; // store vtables in far segments | |
245 enum CFGnoinlines = 0x1000; // do not inline functions | |
246 enum CFGnowarning = 0x8000; // disable warnings | |
247 enum CFGX = (CFGnowarning); | |
248 | |
249 enum EX_DOSX = 1; // DOSX 386 program | |
250 enum EX_ZPM = 2; // ZPM 286 program | |
251 enum EX_RATIONAL = 4; // RATIONAL 286 program | |
252 enum EX_PHARLAP = 8; // PHARLAP 386 program | |
253 enum EX_COM = 0x10; // MSDOS .COM program | |
254 //#define EX_WIN16 0x20 // Windows 3.x 16 bit program | |
255 enum EX_OS2 = 0x40; // OS/2 2.0 32 bit program | |
256 enum EX_OS1 = 0x80; // OS/2 1.x 16 bit program | |
257 enum EX_NT = 0x100; // NT | |
258 enum EX_MZ = 0x200; // MSDOS real mode program | |
259 enum EX_XENIX = 0x400; | |
260 enum EX_SCOUNIX = 0x800; | |
261 enum EX_UNIXSVR4 = 0x1000; | |
262 enum EX_LINUX = 0x2000; | |
263 enum EX_WIN64 = 0x4000; // AMD64 and Windows (64 bit mode) | |
264 enum EX_LINUX64 = 0x8000; // AMD64 and Linux (64 bit mode) | |
265 enum EX_OSX = 0x10000; | |
266 enum EX_OSX64 = 0x20000; | |
267 enum EX_FREEBSD = 0x40000; | |
268 enum EX_FREEBSD64 = 0x80000; | |
269 enum EX_SOLARIS = 0x100000; | |
270 enum EX_SOLARIS64 = 0x200000; | |
271 | |
272 enum WFwindows = 1; // generating code for Windows app or DLL | |
273 enum WFdll = 2; // generating code for Windows DLL | |
274 enum WFincbp = 4; // mark far stack frame with inc BP / dec BP | |
275 enum WFloadds = 8; // assume __loadds for all functions | |
276 enum WFexpdef = 0x10; // generate export definition records for | |
277 // exported functions | |
278 enum WFss = 0x20; // load DS from SS | |
279 enum WFreduced = 0x40; // skip DS load for non-exported functions | |
280 enum WFdgroup = 0x80; // load DS from DGROUP | |
281 enum WFexport = 0x100; // assume __export for all far functions | |
282 enum WFds = 0x200; // load DS from DS | |
283 enum WFmacros = 0x400; // define predefined windows macros | |
284 enum WFssneds = 0x800; // SS != DS | |
285 enum WFthunk = 0x1000; // use fixups instead of direct ref to CS | |
286 enum WFsaveds = 0x2000; // use push/pop DS for far functions | |
287 enum WFdsnedgroup = 0x4000; // DS != DGROUP | |
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
|
288 enum WFexe = 0x8000; // generating code for Windows EXE |