comparison runtime/llvmdc.diff @ 443:44f08170f4ef

Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn. Reworked the LLVMDC specific pragmas.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Fri, 01 Aug 2008 00:32:06 +0200
parents
children f2b5f86348ef
comparison
equal deleted inserted replaced
442:76078c8ab5b9 443:44f08170f4ef
1 Index: object.di
2 ===================================================================
3 --- object.di (revision 3819)
4 +++ object.di (working copy)
5 @@ -150,6 +150,9 @@
6 void function() dtor;
7 void function() unitTest;
8
9 + void* xgetMembers;
10 + void function() ictor;
11 +
12 static int opApply( int delegate( inout ModuleInfo ) );
13 }
14
15 Index: lib/common/tango/core/BitManip.d
16 ===================================================================
17 --- lib/common/tango/core/BitManip.d (revision 3819)
18 +++ lib/common/tango/core/BitManip.d (working copy)
19 @@ -171,6 +171,10 @@
20 */
21 uint outpl( uint port_address, uint value );
22 }
23 +else version( LLVMDC )
24 +{
25 + public import llvmdc.bitmanip;
26 +}
27 else
28 {
29 public import std.intrinsic;
30 Index: lib/common/tango/core/Thread.d
31 ===================================================================
32 --- lib/common/tango/core/Thread.d (revision 3819)
33 +++ lib/common/tango/core/Thread.d (working copy)
34 @@ -244,10 +244,33 @@
35 }
36 body
37 {
38 - version( D_InlineAsm_X86 )
39 + version( LLVMDC )
40 {
41 + // put registers on the stack
42 + version(D_InlineAsm_X86)
43 + {
44 + uint _eax, _ecx, _edx, _ebx, _esp, _ebp, _esi, _edi;
45 asm
46 {
47 + mov _eax, EAX;
48 + mov _ecx, ECX;
49 + mov _edx, EDX;
50 + mov _ebx, EBX;
51 + mov _esp, ESP;
52 + mov _ebp, EBP;
53 + mov _esi, ESI;
54 + mov _edi, EDI;
55 + }
56 + }
57 + else
58 + {
59 + // FIXME
60 + }
61 + }
62 + else version( D_InlineAsm_X86 )
63 + {
64 + asm
65 + {
66 pushad;
67 }
68 }
69 @@ -297,8 +320,12 @@
70 }
71 }
72
73 - version( D_InlineAsm_X86 )
74 + version( LLVMDC )
75 {
76 + // nothing to do
77 + }
78 + else version( D_InlineAsm_X86 )
79 + {
80 asm
81 {
82 popad;
83 @@ -2266,8 +2293,12 @@
84
85 private
86 {
87 - version( D_InlineAsm_X86 )
88 + version( LLVMDC )
89 {
90 +
91 + }
92 + else version( D_InlineAsm_X86 )
93 + {
94 version( X86_64 )
95 {
96
97 Index: lib/gc/basic/gcx.d
98 ===================================================================
99 --- lib/gc/basic/gcx.d (revision 3819)
100 +++ lib/gc/basic/gcx.d (working copy)
101 @@ -2178,6 +2178,28 @@
102 __builtin_unwind_init();
103 sp = & sp;
104 }
105 + else version(LLVMDC)
106 + {
107 + version(D_InlineAsm_X86)
108 + {
109 + uint _eax, _ecx, _edx, _ebx, _ebp, _esi, _edi;
110 + asm
111 + {
112 + mov _eax, EAX;
113 + mov _ecx, ECX;
114 + mov _edx, EDX;
115 + mov _ebx, EBX;
116 + mov _ebp, EBP;
117 + mov _esi, ESI;
118 + mov _edi, EDI;
119 + mov sp, ESP;
120 + }
121 + }
122 + else
123 + {
124 + // FIXME
125 + }
126 + }
127 else
128 {
129 asm
130 @@ -2191,6 +2213,10 @@
131 {
132 // nothing to do
133 }
134 + else version(LLVMDC)
135 + {
136 + // nothing to do
137 + }
138 else
139 {
140 asm
141 Index: lib/gc/basic/gcbits.d
142 ===================================================================
143 --- lib/gc/basic/gcbits.d (revision 3819)
144 +++ lib/gc/basic/gcbits.d (working copy)
145 @@ -39,6 +39,10 @@
146 {
147 // use the unoptimized version
148 }
149 +else version(LLVMDC)
150 +{
151 + // ditto
152 +}
153 else version (D_InlineAsm_X86)
154 {
155 version = Asm86;
156 Index: tango/text/convert/Layout.d
157 ===================================================================
158 --- tango/text/convert/Layout.d (revision 3819)
159 +++ tango/text/convert/Layout.d (working copy)
160 @@ -47,6 +47,12 @@
161 alias void* Arg;
162 alias va_list ArgList;
163 }
164 +else version(LLVMDC)
165 + {
166 + private import tango.core.Vararg;
167 + alias void* Arg;
168 + alias va_list ArgList;
169 + }
170 else
171 {
172 alias void* Arg;
173 @@ -197,9 +203,18 @@
174 assert (formatStr, "null format specifier");
175 assert (arguments.length < 64, "too many args in Layout.convert");
176
177 - version (GNU)
178 + version (LLVMDC)
179 {
180 Arg[64] arglist = void;
181 + foreach (i, arg; arguments)
182 + {
183 + arglist[i] = args;
184 + args += (arg.tsize + size_t.sizeof - 1) & ~ (size_t.sizeof - 1);
185 + }
186 + }
187 + else version (GNU)
188 + {
189 + Arg[64] arglist = void;
190 int[64] intargs = void;
191 byte[64] byteargs = void;
192 long[64] longargs = void;
193 Index: tango/core/Vararg.d
194 ===================================================================
195 --- tango/core/Vararg.d (revision 3819)
196 +++ tango/core/Vararg.d (working copy)
197 @@ -15,6 +15,10 @@
198 {
199 public import std.stdarg;
200 }
201 +else version( LLVMDC )
202 +{
203 + public import llvmdc.vararg;
204 +}
205 else
206 {
207 /**
208 Index: tango/math/Math.d
209 ===================================================================
210 --- tango/math/Math.d (revision 3819)
211 +++ tango/math/Math.d (working copy)
212 @@ -76,7 +76,77 @@
213 version = DigitalMars_D_InlineAsm_X86;
214 }
215 }
216 +else version(LLVMDC)
217 +{
218 + private
219 + {
220
221 + pragma(LLVM_internal, "intrinsic", "llvm.sqrt.f32")
222 + float llvm_sqrt(float);
223 + pragma(LLVM_internal, "intrinsic", "llvm.sqrt.f64")
224 + double llvm_sqrt(double);
225 +
226 + version(LLVM_X86_FP80)
227 + {
228 + alias tango.stdc.math.tanl llvm_tan;
229 + alias tango.stdc.math.acosl llvm_acos;
230 + alias tango.stdc.math.asinl llvm_asin;
231 + alias tango.stdc.math.atanl llvm_atan;
232 + alias tango.stdc.math.atan2l llvm_atan2;
233 + alias tango.stdc.math.coshl llvm_cosh;
234 + alias tango.stdc.math.sinhl llvm_sinh;
235 + alias tango.stdc.math.tanhl llvm_tanh;
236 + alias tango.stdc.math.cbrtl llvm_cbrt;
237 + alias tango.stdc.math.expl llvm_exp;
238 + alias tango.stdc.math.exp1ml llvm_exp1m;
239 + alias tango.stdc.math.exp2l llvm_exp2;
240 + alias tango.stdc.math.logl llvm_log;
241 + alias tango.stdc.math.log1pl llvm_log1p;
242 + alias tango.stdc.math.log2l llvm_log2;
243 + alias tango.stdc.math.log10l llvm_log10;
244 + alias tango.stdc.math.powl llvm_pow;
245 + alias tango.stdc.math.lrintl llvm_lrint;
246 + alias tango.stdc.math.llrintl llvm_llrint;
247 +
248 + pragma(LLVM_internal, "intrinsic", "llvm.cos.f80")
249 + real llvm_cos(real);
250 + pragma(LLVM_internal, "intrinsic", "llvm.sin.f80")
251 + real llvm_sin(real);
252 + pragma(LLVM_internal, "intrinsic", "llvm.sqrt.f80")
253 + real llvm_sqrt(real);
254 + }
255 + else
256 + {
257 + alias tango.stdc.math.tan llvm_tan;
258 + alias tango.stdc.math.acos llvm_acos;
259 + alias tango.stdc.math.asin llvm_asin;
260 + alias tango.stdc.math.atan llvm_atan;
261 + alias tango.stdc.math.atan2 llvm_atan2;
262 + alias tango.stdc.math.cosh llvm_cosh;
263 + alias tango.stdc.math.sinh llvm_sinh;
264 + alias tango.stdc.math.tanh llvm_tanh;
265 + alias tango.stdc.math.cbrt llvm_cbrt;
266 + alias tango.stdc.math.exp llvm_exp;
267 + alias tango.stdc.math.exp1m llvm_exp1m;
268 + alias tango.stdc.math.exp2 llvm_exp2;
269 + alias tango.stdc.math.log llvm_log;
270 + alias tango.stdc.math.log1p llvm_log1p;
271 + alias tango.stdc.math.log2 llvm_log2;
272 + alias tango.stdc.math.log10 llvm_log10;
273 + alias tango.stdc.math.pow llvm_pow;
274 + alias tango.stdc.math.lrint llvm_lrint;
275 + alias tango.stdc.math.llrint llvm_llrint;
276 +
277 + pragma(LLVM_internal, "intrinsic", "llvm.cos.f64")
278 + real llvm_cos(real);
279 + pragma(LLVM_internal, "intrinsic", "llvm.sin.f64")
280 + real llvm_sin(real);
281 + pragma(LLVM_internal, "intrinsic", "llvm.sqrt.f64")
282 + real llvm_sqrt(real);
283 + }
284 + }
285 +}
286 +
287 /*
288 * Constants
289 */
290 @@ -300,6 +370,10 @@
291 */
292 real cos(real x) /* intrinsic */
293 {
294 + version(LLVMDC)
295 + {
296 + return llvm_cos(x);
297 + }
298 version(D_InlineAsm_X86)
299 {
300 asm
301 @@ -335,6 +409,10 @@
302 */
303 real sin(real x) /* intrinsic */
304 {
305 + version(LLVMDC)
306 + {
307 + return llvm_sin(x);
308 + }
309 version(D_InlineAsm_X86)
310 {
311 asm
312 @@ -374,6 +452,9 @@
313 {
314 version (GNU) {
315 return tanl(x);
316 + }
317 + else version(LLVMDC) {
318 + return llvm_tan(x);
319 } else {
320 asm
321 {
322 @@ -576,7 +657,14 @@
323 */
324 real acos(real x)
325 {
326 - return tango.stdc.math.acosl(x);
327 + version(LLVMDC)
328 + {
329 + return llvm_acos(x);
330 + }
331 + else
332 + {
333 + return tango.stdc.math.acosl(x);
334 + }
335 }
336
337 debug(UnitTest) {
338 @@ -599,7 +687,14 @@
339 */
340 real asin(real x)
341 {
342 - return tango.stdc.math.asinl(x);
343 + version(LLVMDC)
344 + {
345 + return llvm_asin(x);
346 + }
347 + else
348 + {
349 + return tango.stdc.math.asinl(x);
350 + }
351 }
352
353 debug(UnitTest) {
354 @@ -621,7 +716,14 @@
355 */
356 real atan(real x)
357 {
358 - return tango.stdc.math.atanl(x);
359 + version(LLVMDC)
360 + {
361 + return llvm_atan(x);
362 + }
363 + else
364 + {
365 + return tango.stdc.math.atanl(x);
366 + }
367 }
368
369 debug(UnitTest) {
370 @@ -658,7 +760,14 @@
371 */
372 real atan2(real y, real x)
373 {
374 - return tango.stdc.math.atan2l(y,x);
375 + version(LLVMDC)
376 + {
377 + return llvm_atan2(x);
378 + }
379 + else
380 + {
381 + return tango.stdc.math.atan2l(x);
382 + }
383 }
384
385 debug(UnitTest) {
386 @@ -707,7 +816,14 @@
387 */
388 real cosh(real x)
389 {
390 - return tango.stdc.math.coshl(x);
391 + version(LLVMDC)
392 + {
393 + return llvm_cosh(x);
394 + }
395 + else
396 + {
397 + return tango.stdc.math.coshl(x);
398 + }
399 }
400
401 debug(UnitTest) {
402 @@ -728,7 +844,14 @@
403 */
404 real sinh(real x)
405 {
406 - return tango.stdc.math.sinhl(x);
407 + version(LLVMDC)
408 + {
409 + return llvm_sinh(x);
410 + }
411 + else
412 + {
413 + return tango.stdc.math.sinhl(x);
414 + }
415 }
416
417 debug(UnitTest) {
418 @@ -749,7 +872,14 @@
419 */
420 real tanh(real x)
421 {
422 - return tango.stdc.math.tanhl(x);
423 + version(LLVMDC)
424 + {
425 + return llvm_tanh(x);
426 + }
427 + else
428 + {
429 + return tango.stdc.math.tanhl(x);
430 + }
431 }
432
433 debug(UnitTest) {
434 @@ -949,8 +1079,12 @@
435 */
436 float sqrt(float x) /* intrinsic */
437 {
438 - version(D_InlineAsm_X86)
439 + version(LLVMDC)
440 {
441 + return llvm_sqrt_f32(x);
442 + }
443 + else version(D_InlineAsm_X86)
444 + {
445 asm
446 {
447 fld x;
448 @@ -965,8 +1099,12 @@
449
450 double sqrt(double x) /* intrinsic */ /// ditto
451 {
452 - version(D_InlineAsm_X86)
453 + version(LLVMDC)
454 {
455 + return llvm_sqrt_f64(x);
456 + }
457 + else version(D_InlineAsm_X86)
458 + {
459 asm
460 {
461 fld x;
462 @@ -981,8 +1119,12 @@
463
464 real sqrt(real x) /* intrinsic */ /// ditto
465 {
466 - version(D_InlineAsm_X86)
467 + version(LLVMDC)
468 {
469 + return llvm_sqrt_f80(x);
470 + }
471 + else version(D_InlineAsm_X86)
472 + {
473 asm
474 {
475 fld x;
476 @@ -1045,7 +1187,14 @@
477 */
478 real cbrt(real x)
479 {
480 - return tango.stdc.math.cbrtl(x);
481 + version(LLVMDC)
482 + {
483 + return llvm_cbrt(x);
484 + }
485 + else
486 + {
487 + return tango.stdc.math.cbrtl(x);
488 + }
489 }
490
491
492 @@ -1067,7 +1216,14 @@
493 */
494 real exp(real x)
495 {
496 - return tango.stdc.math.expl(x);
497 + version(LLVMDC)
498 + {
499 + return llvm_exp(x);
500 + }
501 + else
502 + {
503 + return tango.stdc.math.expl(x);
504 + }
505 }
506
507 debug(UnitTest) {
508 @@ -1093,7 +1249,14 @@
509 */
510 real expm1(real x)
511 {
512 - return tango.stdc.math.expm1l(x);
513 + version(LLVMDC)
514 + {
515 + return llvm_expm1(x);
516 + }
517 + else
518 + {
519 + return tango.stdc.math.expm1l(x);
520 + }
521 }
522
523 debug(UnitTest) {
524 @@ -1115,7 +1278,14 @@
525 */
526 real exp2(real x)
527 {
528 - return tango.stdc.math.exp2l(x);
529 + version(LLVMDC)
530 + {
531 + return llvm_exp2(x);
532 + }
533 + else
534 + {
535 + return tango.stdc.math.exp2l(x);
536 + }
537 }
538
539 debug(UnitTest) {
540 @@ -1141,7 +1311,14 @@
541 */
542 real log(real x)
543 {
544 - return tango.stdc.math.logl(x);
545 + version(LLVMDC)
546 + {
547 + return llvm_log(x);
548 + }
549 + else
550 + {
551 + return tango.stdc.math.logl(x);
552 + }
553 }
554
555 debug(UnitTest) {
556 @@ -1167,7 +1344,14 @@
557 */
558 real log1p(real x)
559 {
560 - return tango.stdc.math.log1pl(x);
561 + version(LLVMDC)
562 + {
563 + return llvm_log1p(x);
564 + }
565 + else
566 + {
567 + return tango.stdc.math.log1pl(x);
568 + }
569 }
570
571 debug(UnitTest) {
572 @@ -1190,7 +1374,14 @@
573 */
574 real log2(real x)
575 {
576 - return tango.stdc.math.log2l(x);
577 + version(LLVMDC)
578 + {
579 + return llvm_log2(x);
580 + }
581 + else
582 + {
583 + return tango.stdc.math.log2l(x);
584 + }
585 }
586
587 debug(UnitTest) {
588 @@ -1212,7 +1403,14 @@
589 */
590 real log10(real x)
591 {
592 - return tango.stdc.math.log10l(x);
593 + version(LLVMDC)
594 + {
595 + return llvm_log10(x);
596 + }
597 + else
598 + {
599 + return tango.stdc.math.log10l(x);
600 + }
601 }
602
603 debug(UnitTest) {
604 @@ -1477,7 +1675,14 @@
605 }
606 }
607 }
608 - return tango.stdc.math.powl(x, y);
609 + version(LLVMDC)
610 + {
611 + return llvm_pow(x, y);
612 + }
613 + else
614 + {
615 + return tango.stdc.math.powl(x, y);
616 + }
617 }
618
619 debug(UnitTest) {
620 @@ -1823,6 +2028,10 @@
621 }
622 return n;
623 }
624 + else version(LLVMDC)
625 + {
626 + return llvm_lrint(x);
627 + }
628 else
629 {
630 return tango.stdc.math.lrintl(x);
631 @@ -1842,6 +2051,10 @@
632 }
633 return n;
634 }
635 + else version(LLVMDC)
636 + {
637 + return llvm_llrint(x);
638 + }
639 else
640 {
641 return tango.stdc.math.llrintl(x);
642 Index: tango/stdc/stdlib.d
643 ===================================================================
644 --- tango/stdc/stdlib.d (revision 3819)
645 +++ tango/stdc/stdlib.d (working copy)
646 @@ -94,6 +94,11 @@
647 {
648 void* alloca(size_t size);
649 }
650 +else version( LLVMDC )
651 +{
652 + pragma(alloca)
653 + void* alloca(size_t size);
654 +}
655 else version( GNU )
656 {
657 private import gcc.builtins;
658 Index: tango/stdc/stdarg.d
659 ===================================================================
660 --- tango/stdc/stdarg.d (revision 3819)
661 +++ tango/stdc/stdarg.d (working copy)
662 @@ -13,6 +13,10 @@
663 {
664 public import std.c.stdarg;
665 }
666 +else version( LLVMDC )
667 +{
668 + public import llvmdc.cstdarg;
669 +}
670 else
671 {
672 alias void* va_list;