Mercurial > projects > ldc
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/runtime/llvmdc.diff Fri Aug 01 00:32:06 2008 +0200 @@ -0,0 +1,672 @@ +Index: object.di +=================================================================== +--- object.di (revision 3819) ++++ object.di (working copy) +@@ -150,6 +150,9 @@ + void function() dtor; + void function() unitTest; + ++ void* xgetMembers; ++ void function() ictor; ++ + static int opApply( int delegate( inout ModuleInfo ) ); + } + +Index: lib/common/tango/core/BitManip.d +=================================================================== +--- lib/common/tango/core/BitManip.d (revision 3819) ++++ lib/common/tango/core/BitManip.d (working copy) +@@ -171,6 +171,10 @@ + */ + uint outpl( uint port_address, uint value ); + } ++else version( LLVMDC ) ++{ ++ public import llvmdc.bitmanip; ++} + else + { + public import std.intrinsic; +Index: lib/common/tango/core/Thread.d +=================================================================== +--- lib/common/tango/core/Thread.d (revision 3819) ++++ lib/common/tango/core/Thread.d (working copy) +@@ -244,10 +244,33 @@ + } + body + { +- version( D_InlineAsm_X86 ) ++ version( LLVMDC ) + { ++ // put registers on the stack ++ version(D_InlineAsm_X86) ++ { ++ uint _eax, _ecx, _edx, _ebx, _esp, _ebp, _esi, _edi; + asm + { ++ mov _eax, EAX; ++ mov _ecx, ECX; ++ mov _edx, EDX; ++ mov _ebx, EBX; ++ mov _esp, ESP; ++ mov _ebp, EBP; ++ mov _esi, ESI; ++ mov _edi, EDI; ++ } ++ } ++ else ++ { ++ // FIXME ++ } ++ } ++ else version( D_InlineAsm_X86 ) ++ { ++ asm ++ { + pushad; + } + } +@@ -297,8 +320,12 @@ + } + } + +- version( D_InlineAsm_X86 ) ++ version( LLVMDC ) + { ++ // nothing to do ++ } ++ else version( D_InlineAsm_X86 ) ++ { + asm + { + popad; +@@ -2266,8 +2293,12 @@ + + private + { +- version( D_InlineAsm_X86 ) ++ version( LLVMDC ) + { ++ ++ } ++ else version( D_InlineAsm_X86 ) ++ { + version( X86_64 ) + { + +Index: lib/gc/basic/gcx.d +=================================================================== +--- lib/gc/basic/gcx.d (revision 3819) ++++ lib/gc/basic/gcx.d (working copy) +@@ -2178,6 +2178,28 @@ + __builtin_unwind_init(); + sp = & sp; + } ++ else version(LLVMDC) ++ { ++ version(D_InlineAsm_X86) ++ { ++ uint _eax, _ecx, _edx, _ebx, _ebp, _esi, _edi; ++ asm ++ { ++ mov _eax, EAX; ++ mov _ecx, ECX; ++ mov _edx, EDX; ++ mov _ebx, EBX; ++ mov _ebp, EBP; ++ mov _esi, ESI; ++ mov _edi, EDI; ++ mov sp, ESP; ++ } ++ } ++ else ++ { ++ // FIXME ++ } ++ } + else + { + asm +@@ -2191,6 +2213,10 @@ + { + // nothing to do + } ++ else version(LLVMDC) ++ { ++ // nothing to do ++ } + else + { + asm +Index: lib/gc/basic/gcbits.d +=================================================================== +--- lib/gc/basic/gcbits.d (revision 3819) ++++ lib/gc/basic/gcbits.d (working copy) +@@ -39,6 +39,10 @@ + { + // use the unoptimized version + } ++else version(LLVMDC) ++{ ++ // ditto ++} + else version (D_InlineAsm_X86) + { + version = Asm86; +Index: tango/text/convert/Layout.d +=================================================================== +--- tango/text/convert/Layout.d (revision 3819) ++++ tango/text/convert/Layout.d (working copy) +@@ -47,6 +47,12 @@ + alias void* Arg; + alias va_list ArgList; + } ++else version(LLVMDC) ++ { ++ private import tango.core.Vararg; ++ alias void* Arg; ++ alias va_list ArgList; ++ } + else + { + alias void* Arg; +@@ -197,9 +203,18 @@ + assert (formatStr, "null format specifier"); + assert (arguments.length < 64, "too many args in Layout.convert"); + +- version (GNU) ++ version (LLVMDC) + { + Arg[64] arglist = void; ++ foreach (i, arg; arguments) ++ { ++ arglist[i] = args; ++ args += (arg.tsize + size_t.sizeof - 1) & ~ (size_t.sizeof - 1); ++ } ++ } ++ else version (GNU) ++ { ++ Arg[64] arglist = void; + int[64] intargs = void; + byte[64] byteargs = void; + long[64] longargs = void; +Index: tango/core/Vararg.d +=================================================================== +--- tango/core/Vararg.d (revision 3819) ++++ tango/core/Vararg.d (working copy) +@@ -15,6 +15,10 @@ + { + public import std.stdarg; + } ++else version( LLVMDC ) ++{ ++ public import llvmdc.vararg; ++} + else + { + /** +Index: tango/math/Math.d +=================================================================== +--- tango/math/Math.d (revision 3819) ++++ tango/math/Math.d (working copy) +@@ -76,7 +76,77 @@ + version = DigitalMars_D_InlineAsm_X86; + } + } ++else version(LLVMDC) ++{ ++ private ++ { + ++ pragma(LLVM_internal, "intrinsic", "llvm.sqrt.f32") ++ float llvm_sqrt(float); ++ pragma(LLVM_internal, "intrinsic", "llvm.sqrt.f64") ++ double llvm_sqrt(double); ++ ++ version(LLVM_X86_FP80) ++ { ++ alias tango.stdc.math.tanl llvm_tan; ++ alias tango.stdc.math.acosl llvm_acos; ++ alias tango.stdc.math.asinl llvm_asin; ++ alias tango.stdc.math.atanl llvm_atan; ++ alias tango.stdc.math.atan2l llvm_atan2; ++ alias tango.stdc.math.coshl llvm_cosh; ++ alias tango.stdc.math.sinhl llvm_sinh; ++ alias tango.stdc.math.tanhl llvm_tanh; ++ alias tango.stdc.math.cbrtl llvm_cbrt; ++ alias tango.stdc.math.expl llvm_exp; ++ alias tango.stdc.math.exp1ml llvm_exp1m; ++ alias tango.stdc.math.exp2l llvm_exp2; ++ alias tango.stdc.math.logl llvm_log; ++ alias tango.stdc.math.log1pl llvm_log1p; ++ alias tango.stdc.math.log2l llvm_log2; ++ alias tango.stdc.math.log10l llvm_log10; ++ alias tango.stdc.math.powl llvm_pow; ++ alias tango.stdc.math.lrintl llvm_lrint; ++ alias tango.stdc.math.llrintl llvm_llrint; ++ ++ pragma(LLVM_internal, "intrinsic", "llvm.cos.f80") ++ real llvm_cos(real); ++ pragma(LLVM_internal, "intrinsic", "llvm.sin.f80") ++ real llvm_sin(real); ++ pragma(LLVM_internal, "intrinsic", "llvm.sqrt.f80") ++ real llvm_sqrt(real); ++ } ++ else ++ { ++ alias tango.stdc.math.tan llvm_tan; ++ alias tango.stdc.math.acos llvm_acos; ++ alias tango.stdc.math.asin llvm_asin; ++ alias tango.stdc.math.atan llvm_atan; ++ alias tango.stdc.math.atan2 llvm_atan2; ++ alias tango.stdc.math.cosh llvm_cosh; ++ alias tango.stdc.math.sinh llvm_sinh; ++ alias tango.stdc.math.tanh llvm_tanh; ++ alias tango.stdc.math.cbrt llvm_cbrt; ++ alias tango.stdc.math.exp llvm_exp; ++ alias tango.stdc.math.exp1m llvm_exp1m; ++ alias tango.stdc.math.exp2 llvm_exp2; ++ alias tango.stdc.math.log llvm_log; ++ alias tango.stdc.math.log1p llvm_log1p; ++ alias tango.stdc.math.log2 llvm_log2; ++ alias tango.stdc.math.log10 llvm_log10; ++ alias tango.stdc.math.pow llvm_pow; ++ alias tango.stdc.math.lrint llvm_lrint; ++ alias tango.stdc.math.llrint llvm_llrint; ++ ++ pragma(LLVM_internal, "intrinsic", "llvm.cos.f64") ++ real llvm_cos(real); ++ pragma(LLVM_internal, "intrinsic", "llvm.sin.f64") ++ real llvm_sin(real); ++ pragma(LLVM_internal, "intrinsic", "llvm.sqrt.f64") ++ real llvm_sqrt(real); ++ } ++ } ++} ++ + /* + * Constants + */ +@@ -300,6 +370,10 @@ + */ + real cos(real x) /* intrinsic */ + { ++ version(LLVMDC) ++ { ++ return llvm_cos(x); ++ } + version(D_InlineAsm_X86) + { + asm +@@ -335,6 +409,10 @@ + */ + real sin(real x) /* intrinsic */ + { ++ version(LLVMDC) ++ { ++ return llvm_sin(x); ++ } + version(D_InlineAsm_X86) + { + asm +@@ -374,6 +452,9 @@ + { + version (GNU) { + return tanl(x); ++ } ++ else version(LLVMDC) { ++ return llvm_tan(x); + } else { + asm + { +@@ -576,7 +657,14 @@ + */ + real acos(real x) + { +- return tango.stdc.math.acosl(x); ++ version(LLVMDC) ++ { ++ return llvm_acos(x); ++ } ++ else ++ { ++ return tango.stdc.math.acosl(x); ++ } + } + + debug(UnitTest) { +@@ -599,7 +687,14 @@ + */ + real asin(real x) + { +- return tango.stdc.math.asinl(x); ++ version(LLVMDC) ++ { ++ return llvm_asin(x); ++ } ++ else ++ { ++ return tango.stdc.math.asinl(x); ++ } + } + + debug(UnitTest) { +@@ -621,7 +716,14 @@ + */ + real atan(real x) + { +- return tango.stdc.math.atanl(x); ++ version(LLVMDC) ++ { ++ return llvm_atan(x); ++ } ++ else ++ { ++ return tango.stdc.math.atanl(x); ++ } + } + + debug(UnitTest) { +@@ -658,7 +760,14 @@ + */ + real atan2(real y, real x) + { +- return tango.stdc.math.atan2l(y,x); ++ version(LLVMDC) ++ { ++ return llvm_atan2(x); ++ } ++ else ++ { ++ return tango.stdc.math.atan2l(x); ++ } + } + + debug(UnitTest) { +@@ -707,7 +816,14 @@ + */ + real cosh(real x) + { +- return tango.stdc.math.coshl(x); ++ version(LLVMDC) ++ { ++ return llvm_cosh(x); ++ } ++ else ++ { ++ return tango.stdc.math.coshl(x); ++ } + } + + debug(UnitTest) { +@@ -728,7 +844,14 @@ + */ + real sinh(real x) + { +- return tango.stdc.math.sinhl(x); ++ version(LLVMDC) ++ { ++ return llvm_sinh(x); ++ } ++ else ++ { ++ return tango.stdc.math.sinhl(x); ++ } + } + + debug(UnitTest) { +@@ -749,7 +872,14 @@ + */ + real tanh(real x) + { +- return tango.stdc.math.tanhl(x); ++ version(LLVMDC) ++ { ++ return llvm_tanh(x); ++ } ++ else ++ { ++ return tango.stdc.math.tanhl(x); ++ } + } + + debug(UnitTest) { +@@ -949,8 +1079,12 @@ + */ + float sqrt(float x) /* intrinsic */ + { +- version(D_InlineAsm_X86) ++ version(LLVMDC) + { ++ return llvm_sqrt_f32(x); ++ } ++ else version(D_InlineAsm_X86) ++ { + asm + { + fld x; +@@ -965,8 +1099,12 @@ + + double sqrt(double x) /* intrinsic */ /// ditto + { +- version(D_InlineAsm_X86) ++ version(LLVMDC) + { ++ return llvm_sqrt_f64(x); ++ } ++ else version(D_InlineAsm_X86) ++ { + asm + { + fld x; +@@ -981,8 +1119,12 @@ + + real sqrt(real x) /* intrinsic */ /// ditto + { +- version(D_InlineAsm_X86) ++ version(LLVMDC) + { ++ return llvm_sqrt_f80(x); ++ } ++ else version(D_InlineAsm_X86) ++ { + asm + { + fld x; +@@ -1045,7 +1187,14 @@ + */ + real cbrt(real x) + { +- return tango.stdc.math.cbrtl(x); ++ version(LLVMDC) ++ { ++ return llvm_cbrt(x); ++ } ++ else ++ { ++ return tango.stdc.math.cbrtl(x); ++ } + } + + +@@ -1067,7 +1216,14 @@ + */ + real exp(real x) + { +- return tango.stdc.math.expl(x); ++ version(LLVMDC) ++ { ++ return llvm_exp(x); ++ } ++ else ++ { ++ return tango.stdc.math.expl(x); ++ } + } + + debug(UnitTest) { +@@ -1093,7 +1249,14 @@ + */ + real expm1(real x) + { +- return tango.stdc.math.expm1l(x); ++ version(LLVMDC) ++ { ++ return llvm_expm1(x); ++ } ++ else ++ { ++ return tango.stdc.math.expm1l(x); ++ } + } + + debug(UnitTest) { +@@ -1115,7 +1278,14 @@ + */ + real exp2(real x) + { +- return tango.stdc.math.exp2l(x); ++ version(LLVMDC) ++ { ++ return llvm_exp2(x); ++ } ++ else ++ { ++ return tango.stdc.math.exp2l(x); ++ } + } + + debug(UnitTest) { +@@ -1141,7 +1311,14 @@ + */ + real log(real x) + { +- return tango.stdc.math.logl(x); ++ version(LLVMDC) ++ { ++ return llvm_log(x); ++ } ++ else ++ { ++ return tango.stdc.math.logl(x); ++ } + } + + debug(UnitTest) { +@@ -1167,7 +1344,14 @@ + */ + real log1p(real x) + { +- return tango.stdc.math.log1pl(x); ++ version(LLVMDC) ++ { ++ return llvm_log1p(x); ++ } ++ else ++ { ++ return tango.stdc.math.log1pl(x); ++ } + } + + debug(UnitTest) { +@@ -1190,7 +1374,14 @@ + */ + real log2(real x) + { +- return tango.stdc.math.log2l(x); ++ version(LLVMDC) ++ { ++ return llvm_log2(x); ++ } ++ else ++ { ++ return tango.stdc.math.log2l(x); ++ } + } + + debug(UnitTest) { +@@ -1212,7 +1403,14 @@ + */ + real log10(real x) + { +- return tango.stdc.math.log10l(x); ++ version(LLVMDC) ++ { ++ return llvm_log10(x); ++ } ++ else ++ { ++ return tango.stdc.math.log10l(x); ++ } + } + + debug(UnitTest) { +@@ -1477,7 +1675,14 @@ + } + } + } +- return tango.stdc.math.powl(x, y); ++ version(LLVMDC) ++ { ++ return llvm_pow(x, y); ++ } ++ else ++ { ++ return tango.stdc.math.powl(x, y); ++ } + } + + debug(UnitTest) { +@@ -1823,6 +2028,10 @@ + } + return n; + } ++ else version(LLVMDC) ++ { ++ return llvm_lrint(x); ++ } + else + { + return tango.stdc.math.lrintl(x); +@@ -1842,6 +2051,10 @@ + } + return n; + } ++ else version(LLVMDC) ++ { ++ return llvm_llrint(x); ++ } + else + { + return tango.stdc.math.llrintl(x); +Index: tango/stdc/stdlib.d +=================================================================== +--- tango/stdc/stdlib.d (revision 3819) ++++ tango/stdc/stdlib.d (working copy) +@@ -94,6 +94,11 @@ + { + void* alloca(size_t size); + } ++else version( LLVMDC ) ++{ ++ pragma(alloca) ++ void* alloca(size_t size); ++} + else version( GNU ) + { + private import gcc.builtins; +Index: tango/stdc/stdarg.d +=================================================================== +--- tango/stdc/stdarg.d (revision 3819) ++++ tango/stdc/stdarg.d (working copy) +@@ -13,6 +13,10 @@ + { + public import std.c.stdarg; + } ++else version( LLVMDC ) ++{ ++ public import llvmdc.cstdarg; ++} + else + { + alias void* va_list;