Mercurial > projects > ldc
comparison runtime/llvmdc.diff @ 531:f775ea9d09d3
Updated the tango patch, removed some now unnecessarily complex inline asm.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Thu, 21 Aug 2008 15:35:24 +0200 |
parents | cef0cbcf7d22 |
children | 2fe2d4518618 |
comparison
equal
deleted
inserted
replaced
529:cef0cbcf7d22 | 531:f775ea9d09d3 |
---|---|
1 Index: object.di | 1 Index: object.di |
2 =================================================================== | 2 =================================================================== |
3 --- object.di (revision 3880) | 3 --- object.di (revision 3899) |
4 +++ object.di (working copy) | 4 +++ object.di (working copy) |
5 @@ -150,6 +150,9 @@ | 5 @@ -150,6 +150,9 @@ |
6 void function() dtor; | 6 void function() dtor; |
7 void function() unitTest; | 7 void function() unitTest; |
8 | 8 |
12 static int opApply( int delegate( inout ModuleInfo ) ); | 12 static int opApply( int delegate( inout ModuleInfo ) ); |
13 } | 13 } |
14 | 14 |
15 Index: lib/unittest.sh | 15 Index: lib/unittest.sh |
16 =================================================================== | 16 =================================================================== |
17 --- lib/unittest.sh (revision 3880) | 17 --- lib/unittest.sh (revision 3899) |
18 +++ lib/unittest.sh (working copy) | 18 +++ lib/unittest.sh (working copy) |
19 @@ -18,8 +18,9 @@ | 19 @@ -18,8 +18,9 @@ |
20 --help: This message | 20 --help: This message |
21 --run-all: Reports result instead of breaking. Do not use this if you want to | 21 --run-all: Reports result instead of breaking. Do not use this if you want to |
22 run unittest runner through a debugger. | 22 run unittest runner through a debugger. |
69 +then | 69 +then |
70 + compile llvmdc runUnitTest_llvmdc | 70 + compile llvmdc runUnitTest_llvmdc |
71 +fi | 71 +fi |
72 Index: lib/common/tango/core/BitManip.d | 72 Index: lib/common/tango/core/BitManip.d |
73 =================================================================== | 73 =================================================================== |
74 --- lib/common/tango/core/BitManip.d (revision 3880) | 74 --- lib/common/tango/core/BitManip.d (revision 3899) |
75 +++ lib/common/tango/core/BitManip.d (working copy) | 75 +++ lib/common/tango/core/BitManip.d (working copy) |
76 @@ -171,6 +171,10 @@ | 76 @@ -171,6 +171,10 @@ |
77 */ | 77 */ |
78 uint outpl( uint port_address, uint value ); | 78 uint outpl( uint port_address, uint value ); |
79 } | 79 } |
84 else | 84 else |
85 { | 85 { |
86 public import std.intrinsic; | 86 public import std.intrinsic; |
87 Index: lib/common/tango/core/Thread.d | 87 Index: lib/common/tango/core/Thread.d |
88 =================================================================== | 88 =================================================================== |
89 --- lib/common/tango/core/Thread.d (revision 3880) | 89 --- lib/common/tango/core/Thread.d (revision 3899) |
90 +++ lib/common/tango/core/Thread.d (working copy) | 90 +++ lib/common/tango/core/Thread.d (working copy) |
91 @@ -244,10 +244,33 @@ | 91 @@ -255,6 +255,10 @@ |
92 } | |
93 body | |
94 { | |
95 - version( D_InlineAsm_X86 ) | |
96 + version( LLVMDC ) | |
97 { | 92 { |
98 + // put registers on the stack | 93 __builtin_unwind_init(); |
99 + version(D_InlineAsm_X86) | |
100 + { | |
101 + uint _eax, _ecx, _edx, _ebx, _esp, _ebp, _esi, _edi; | |
102 asm | |
103 { | |
104 + mov _eax, EAX; | |
105 + mov _ecx, ECX; | |
106 + mov _edx, EDX; | |
107 + mov _ebx, EBX; | |
108 + mov _esp, ESP; | |
109 + mov _ebp, EBP; | |
110 + mov _esi, ESI; | |
111 + mov _edi, EDI; | |
112 + } | |
113 + } | |
114 + else | |
115 + { | |
116 + // FIXME | |
117 + } | |
118 + } | |
119 + else version( D_InlineAsm_X86 ) | |
120 + { | |
121 + asm | |
122 + { | |
123 pushad; | |
124 } | |
125 } | 94 } |
126 @@ -297,8 +320,12 @@ | 95 + else version( LLVMDC ) |
127 } | 96 + { |
97 + pragma(msg, "don't know how to push registers on the stack for this architecture with LLVMDC"); | |
98 + } | |
99 else | |
100 { | |
101 static assert( false, "Architecture not supported." ); | |
102 @@ -308,6 +312,10 @@ | |
103 { | |
104 // registers will be popped automatically | |
128 } | 105 } |
129 | 106 + else version( LLVMDC ) |
130 - version( D_InlineAsm_X86 ) | 107 + { |
131 + version( LLVMDC ) | 108 + // TODO |
109 + } | |
110 else | |
132 { | 111 { |
133 + // nothing to do | 112 static assert( false, "Architecture not supported." ); |
134 + } | |
135 + else version( D_InlineAsm_X86 ) | |
136 + { | |
137 asm | |
138 { | |
139 popad; | |
140 @@ -2266,8 +2293,12 @@ | |
141 | |
142 private | |
143 { | |
144 - version( D_InlineAsm_X86 ) | |
145 + version( LLVMDC ) | |
146 { | |
147 + | |
148 + } | |
149 + else version( D_InlineAsm_X86 ) | |
150 + { | |
151 version( X86_64 ) | |
152 { | |
153 | |
154 Index: lib/gc/basic/gcx.d | 113 Index: lib/gc/basic/gcx.d |
155 =================================================================== | 114 =================================================================== |
156 --- lib/gc/basic/gcx.d (revision 3880) | 115 --- lib/gc/basic/gcx.d (revision 3899) |
157 +++ lib/gc/basic/gcx.d (working copy) | 116 +++ lib/gc/basic/gcx.d (working copy) |
158 @@ -2178,6 +2178,28 @@ | 117 @@ -2178,6 +2178,21 @@ |
159 __builtin_unwind_init(); | 118 __builtin_unwind_init(); |
160 sp = & sp; | 119 sp = & sp; |
161 } | 120 } |
162 + else version(LLVMDC) | 121 + else version(LLVMDC) |
163 + { | 122 + { |
164 + version(D_InlineAsm_X86) | 123 + version(X86) |
165 + { | 124 + { |
166 + uint _eax, _ecx, _edx, _ebx, _ebp, _esi, _edi; | 125 + asm |
167 + asm | 126 + { |
168 + { | 127 + pushad ; |
169 + mov _eax, EAX; | 128 + mov sp[EBP],ESP ; |
170 + mov _ecx, ECX; | 129 + } |
171 + mov _edx, EDX; | |
172 + mov _ebx, EBX; | |
173 + mov _ebp, EBP; | |
174 + mov _esi, ESI; | |
175 + mov _edi, EDI; | |
176 + mov sp, ESP; | |
177 + } | |
178 + } | 130 + } |
179 + else | 131 + else |
180 + { | 132 + { |
181 + // FIXME | 133 + pragma(msg, "don't know how to push registers on the stack for this architecture with llvmdc"); |
182 + } | 134 + } |
183 + } | 135 + } |
184 else | 136 else |
185 { | 137 { |
186 asm | 138 asm |
187 @@ -2191,6 +2213,10 @@ | 139 @@ -2191,6 +2206,20 @@ |
188 { | 140 { |
189 // nothing to do | 141 // nothing to do |
190 } | 142 } |
191 + else version(LLVMDC) | 143 + else version(LLVMDC) |
192 + { | 144 + { |
193 + // nothing to do | 145 + version(X86) |
146 + { | |
147 + asm | |
148 + { | |
149 + popad ; | |
150 + } | |
151 + } | |
152 + else | |
153 + { | |
154 + // TODO | |
155 + } | |
194 + } | 156 + } |
195 else | 157 else |
196 { | 158 { |
197 asm | 159 asm |
198 Index: lib/gc/basic/gcbits.d | 160 Index: lib/gc/basic/gcbits.d |
199 =================================================================== | 161 =================================================================== |
200 --- lib/gc/basic/gcbits.d (revision 3880) | 162 --- lib/gc/basic/gcbits.d (revision 3899) |
201 +++ lib/gc/basic/gcbits.d (working copy) | 163 +++ lib/gc/basic/gcbits.d (working copy) |
202 @@ -39,6 +39,10 @@ | 164 @@ -39,6 +39,10 @@ |
203 { | 165 { |
204 // use the unoptimized version | 166 // use the unoptimized version |
205 } | 167 } |
210 else version (D_InlineAsm_X86) | 172 else version (D_InlineAsm_X86) |
211 { | 173 { |
212 version = Asm86; | 174 version = Asm86; |
213 Index: tango/text/convert/Layout.d | 175 Index: tango/text/convert/Layout.d |
214 =================================================================== | 176 =================================================================== |
215 --- tango/text/convert/Layout.d (revision 3880) | 177 --- tango/text/convert/Layout.d (revision 3899) |
216 +++ tango/text/convert/Layout.d (working copy) | 178 +++ tango/text/convert/Layout.d (working copy) |
217 @@ -47,6 +47,12 @@ | 179 @@ -47,6 +47,12 @@ |
218 alias void* Arg; | 180 alias void* Arg; |
219 alias va_list ArgList; | 181 alias va_list ArgList; |
220 } | 182 } |
247 int[64] intargs = void; | 209 int[64] intargs = void; |
248 byte[64] byteargs = void; | 210 byte[64] byteargs = void; |
249 long[64] longargs = void; | 211 long[64] longargs = void; |
250 Index: tango/core/Vararg.d | 212 Index: tango/core/Vararg.d |
251 =================================================================== | 213 =================================================================== |
252 --- tango/core/Vararg.d (revision 3880) | 214 --- tango/core/Vararg.d (revision 3899) |
253 +++ tango/core/Vararg.d (working copy) | 215 +++ tango/core/Vararg.d (working copy) |
254 @@ -15,6 +15,10 @@ | 216 @@ -15,6 +15,10 @@ |
255 { | 217 { |
256 public import std.stdarg; | 218 public import std.stdarg; |
257 } | 219 } |
260 + public import llvmdc.vararg; | 222 + public import llvmdc.vararg; |
261 +} | 223 +} |
262 else | 224 else |
263 { | 225 { |
264 /** | 226 /** |
265 Index: tango/core/Variant.d | |
266 =================================================================== | |
267 --- tango/core/Variant.d (revision 3880) | |
268 +++ tango/core/Variant.d (working copy) | |
269 @@ -102,13 +102,45 @@ | |
270 const isInterface = false; | |
271 } | |
272 | |
273 - template isStaticArray(T) | |
274 +// template isStaticArray(T) | |
275 +// { | |
276 +// static if( is( typeof(T.init)[(T).sizeof / typeof(T.init).sizeof] == T ) ) | |
277 +// const isStaticArray = true; | |
278 +// else | |
279 +// const isStaticArray = false; | |
280 +// } | |
281 + /* ******************************************* | |
282 + */ | |
283 + template isStaticArray_impl(T) | |
284 { | |
285 - static if( is( typeof(T.init)[(T).sizeof / typeof(T.init).sizeof] == T ) ) | |
286 - const isStaticArray = true; | |
287 + const T inst = void; | |
288 + | |
289 + static if (is(typeof(T.length))) | |
290 + { | |
291 + static if (!is(T == typeof(T.init))) | |
292 + { // abuses the fact that int[5].init == int | |
293 + static if (is(T == typeof(T[0])[inst.length])) | |
294 + { // sanity check. this check alone isn't enough because dmd complains about dynamic arrays | |
295 + const bool res = true; | |
296 + } | |
297 + else | |
298 + const bool res = false; | |
299 + } | |
300 else | |
301 - const isStaticArray = false; | |
302 + const bool res = false; | |
303 + } | |
304 + else | |
305 + { | |
306 + const bool res = false; | |
307 + } | |
308 } | |
309 + /** | |
310 + * Detect whether type T is a static array. | |
311 + */ | |
312 + template isStaticArray(T) | |
313 + { | |
314 + const bool isStaticArray = isStaticArray_impl!(T).res; | |
315 + } | |
316 | |
317 bool isAny(T,argsT...)(T v, argsT args) | |
318 { | |
319 Index: tango/core/Atomic.d | 227 Index: tango/core/Atomic.d |
320 =================================================================== | 228 =================================================================== |
321 --- tango/core/Atomic.d (revision 3880) | 229 --- tango/core/Atomic.d (revision 3899) |
322 +++ tango/core/Atomic.d (working copy) | 230 +++ tango/core/Atomic.d (working copy) |
323 @@ -270,6 +270,161 @@ | 231 @@ -270,6 +270,161 @@ |
324 | 232 |
325 | 233 |
326 //////////////////////////////////////////////////////////////////////////////// | 234 //////////////////////////////////////////////////////////////////////////////// |
482 // x86 Atomic Function Implementation | 390 // x86 Atomic Function Implementation |
483 //////////////////////////////////////////////////////////////////////////////// | 391 //////////////////////////////////////////////////////////////////////////////// |
484 | 392 |
485 Index: tango/math/Math.d | 393 Index: tango/math/Math.d |
486 =================================================================== | 394 =================================================================== |
487 --- tango/math/Math.d (revision 3880) | 395 --- tango/math/Math.d (revision 3899) |
488 +++ tango/math/Math.d (working copy) | 396 +++ tango/math/Math.d (working copy) |
489 @@ -76,6 +76,14 @@ | 397 @@ -76,6 +76,14 @@ |
490 version = DigitalMars_D_InlineAsm_X86; | 398 version = DigitalMars_D_InlineAsm_X86; |
491 } | 399 } |
492 } | 400 } |
629 + return tango.stdc.math.powl(x, y); | 537 + return tango.stdc.math.powl(x, y); |
630 + } | 538 + } |
631 } | 539 } |
632 | 540 |
633 debug(UnitTest) { | 541 debug(UnitTest) { |
542 Index: tango/math/internal/BignumX86.d | |
543 =================================================================== | |
544 --- tango/math/internal/BignumX86.d (revision 3899) | |
545 +++ tango/math/internal/BignumX86.d (working copy) | |
546 @@ -50,6 +50,8 @@ | |
547 private: | |
548 version(GNU) { | |
549 // GDC is a filthy liar. It can't actually do inline asm. | |
550 +} else version(LLVMDC) { | |
551 + // I guess the same goes for llvmdc to some extent :( | |
552 } else version(D_InlineAsm_X86) { | |
553 /* Duplicate string s, with n times, substituting index for '@'. | |
554 * | |
555 Index: tango/math/internal/BiguintCore.d | |
556 =================================================================== | |
557 --- tango/math/internal/BiguintCore.d (revision 3899) | |
558 +++ tango/math/internal/BiguintCore.d (working copy) | |
559 @@ -12,7 +12,10 @@ | |
560 } else version(GNU) { | |
561 // GDC lies about its X86 support | |
562 private import tango.math.internal.BignumNoAsm; | |
563 -} else version(D_InlineAsm_X86) { | |
564 +} else version(LLVMDC) { | |
565 + // I guess llvmdc does too :( | |
566 +private import tango.math.internal.BignumNoAsm; | |
567 +} else version(D_InlineAsm_X86) { | |
568 private import tango.math.internal.BignumX86; | |
569 } else { | |
570 private import tango.math.internal.BignumNoAsm; | |
634 Index: tango/stdc/stdlib.d | 571 Index: tango/stdc/stdlib.d |
635 =================================================================== | 572 =================================================================== |
636 --- tango/stdc/stdlib.d (revision 3880) | 573 --- tango/stdc/stdlib.d (revision 3899) |
637 +++ tango/stdc/stdlib.d (working copy) | 574 +++ tango/stdc/stdlib.d (working copy) |
638 @@ -94,6 +94,11 @@ | 575 @@ -94,6 +94,11 @@ |
639 { | 576 { |
640 void* alloca(size_t size); | 577 void* alloca(size_t size); |
641 } | 578 } |
647 else version( GNU ) | 584 else version( GNU ) |
648 { | 585 { |
649 private import gcc.builtins; | 586 private import gcc.builtins; |
650 Index: tango/stdc/stdarg.d | 587 Index: tango/stdc/stdarg.d |
651 =================================================================== | 588 =================================================================== |
652 --- tango/stdc/stdarg.d (revision 3880) | 589 --- tango/stdc/stdarg.d (revision 3899) |
653 +++ tango/stdc/stdarg.d (working copy) | 590 +++ tango/stdc/stdarg.d (working copy) |
654 @@ -13,6 +13,10 @@ | 591 @@ -13,6 +13,10 @@ |
655 { | 592 { |
656 public import std.c.stdarg; | 593 public import std.c.stdarg; |
657 } | 594 } |