changeset 665:d8a1481eaa0c

Renames.
author Christian Kamm <kamm incasoftware de>
date Mon, 06 Oct 2008 22:56:54 +0200
parents eef8ac26c66c
children 0d934394ada1
files bin/ldc.conf bin/ldc.ini bin/ldc.phobos bin/ldc.tango bin/llvmdc.conf bin/llvmdc.ini bin/llvmdc.phobos bin/llvmdc.tango ldc-tango llvmdc-tango lphobos/ldc-build lphobos/ldc.conf lphobos/llvmdc-build lphobos/llvmdc.conf runtime/import/ldc/cstdarg.di runtime/import/ldc/intrinsics.di runtime/import/llvmdc/cstdarg.di runtime/import/llvmdc/intrinsics.di runtime/internal/ldc.mak runtime/internal/ldc/bitmanip.d runtime/internal/ldc/vararg.d runtime/internal/llvmdc.mak runtime/internal/llvmdc/bitmanip.d runtime/internal/llvmdc/vararg.d runtime/ldc.diff runtime/lib/common/tango/ldc.mak runtime/lib/common/tango/llvmdc.mak runtime/lib/gc/basic/ldc.mak runtime/lib/gc/basic/llvmdc.mak runtime/lib/gc/stub/ldc.mak runtime/lib/gc/stub/llvmdc.mak runtime/lib/ldc-posix.mak runtime/lib/llvmdc-posix.mak runtime/llvmdc.diff
diffstat 34 files changed, 1961 insertions(+), 1961 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/ldc.conf	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,4 @@
+
+[Environment]
+
+DFLAGS=-I%@P%/../tango -I%@P%/../tango/lib/common -L-L%@P%/../lib -version=Tango
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/ldc.ini	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,2 @@
+[Environment]
+DFLAGS=-I%@P%/../tango -I%@P%/../tango/lib/common -L-L%@P%/../lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/ldc.phobos	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,4 @@
+
+[Environment]
+
+DFLAGS=-I%@P%/../lphobos -L-L%@P%/../lib -R%@P%/../lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/ldc.tango	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,4 @@
+
+[Environment]
+
+DFLAGS=-I%@P%/../tango -E%@P%/../lib -L-L=%@P%/../lib
--- a/bin/llvmdc.conf	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-
-[Environment]
-
-DFLAGS=-I%@P%/../tango -I%@P%/../tango/lib/common -L-L%@P%/../lib -version=Tango
--- a/bin/llvmdc.ini	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-[Environment]
-DFLAGS=-I%@P%/../tango -I%@P%/../tango/lib/common -L-L%@P%/../lib
--- a/bin/llvmdc.phobos	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-
-[Environment]
-
-DFLAGS=-I%@P%/../lphobos -L-L%@P%/../lib -R%@P%/../lib
--- a/bin/llvmdc.tango	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-
-[Environment]
-
-DFLAGS=-I%@P%/../tango -E%@P%/../lib -L-L=%@P%/../lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ldc-tango	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,76 @@
+ignore=object
+
+compiler=ldc
+inifile=ldc.conf
+
+exeext=
+objext=bc
+
+
+version=LLVM
+version=LDC
+noversion=DigitalMars
+noversion=GNU
+testversion=linux
+testversion=darwin
+testversion=freebsd
+testversion=Unix
+testversion=Posix
+testversion=Windows
+testversion=Win32
+testversion=Win64
+testversion=mingw32
+testversion=X86
+testversion=PPC
+testversion=X86_64
+testversion=PPC64
+testversion=D_InlineAsm
+testvestion=D_InlineAsm_X86
+testversion=D_InlineAsm_PPC
+testversion=D_InlineAsm_X86_64
+testversion=D_InlineAsm_PPC64
+testversion=LLVM_InlineAsm_X86
+testversion=LittleEndian
+testversion=BigEndian
+testversion=LLVM64
+testversion=PIC
+
+
+[compile]
+cmd=ldc -c $i
+
+flag=$i
+incdir=-I$i
+libdir=-L-L=$i
+optimize=-O3
+version=-version=$i
+
+
+[link]
+oneatatime=yes
+cmd=ldc $i -of$o
+
+libdir=-L-L=$i
+lib=-L-l=$i
+flag=-L$i
+
+
+[liblink]
+safe=yes
+oneatatime=yes
+cmd=llvm-ar rsc $o $i
+
+libdir=
+lib=
+flag=
+
+
+[postliblink]
+#cmd=ranlib $i
+
+
+[shliblink]
+shlibs=no
+
+[dyliblink]
+dylibs=no
--- a/llvmdc-tango	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-ignore=object
-
-compiler=ldc
-inifile=ldc.conf
-
-exeext=
-objext=bc
-
-
-version=LLVM
-version=LDC
-noversion=DigitalMars
-noversion=GNU
-testversion=linux
-testversion=darwin
-testversion=freebsd
-testversion=Unix
-testversion=Posix
-testversion=Windows
-testversion=Win32
-testversion=Win64
-testversion=mingw32
-testversion=X86
-testversion=PPC
-testversion=X86_64
-testversion=PPC64
-testversion=D_InlineAsm
-testvestion=D_InlineAsm_X86
-testversion=D_InlineAsm_PPC
-testversion=D_InlineAsm_X86_64
-testversion=D_InlineAsm_PPC64
-testversion=LLVM_InlineAsm_X86
-testversion=LittleEndian
-testversion=BigEndian
-testversion=LLVM64
-testversion=PIC
-
-
-[compile]
-cmd=ldc -c $i
-
-flag=$i
-incdir=-I$i
-libdir=-L-L=$i
-optimize=-O3
-version=-version=$i
-
-
-[link]
-oneatatime=yes
-cmd=ldc $i -of$o
-
-libdir=-L-L=$i
-lib=-L-l=$i
-flag=-L$i
-
-
-[liblink]
-safe=yes
-oneatatime=yes
-cmd=llvm-ar rsc $o $i
-
-libdir=
-lib=
-flag=
-
-
-[postliblink]
-#cmd=ranlib $i
-
-
-[shliblink]
-shlibs=no
-
-[dyliblink]
-dylibs=no
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lphobos/ldc-build	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,9 @@
+#!/bin/sh
+export PATH=$PATH:/opt/llvm/bin
+export FILE=$1; shift
+export LDC_PATH=~/ldc
+PARAM=$(for p_file in $($LDC_PATH/bin/ldc $FILE -I~/ldc/lphobos -c -v -of/dev/null |grep import \
+        |sed -e "s/import *//" -e "s/\t.*//" \
+        |sed -e "s/\./\//g" -e "s/$/\.d/"); do if [ -f $p_file ]; then echo $p_file; fi; done)
+echo ldc $FILE $@ $PARAM
+$LDC_PATH/bin/ldc $FILE $@ $PARAM
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lphobos/ldc.conf	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,5 @@
+
+[Environment]
+
+DFLAGS=-I%@P%/../lphobos -I%@P%/../import -L-L%@P%/../lib
+# -R%@P%/../lib
--- a/lphobos/llvmdc-build	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#!/bin/sh
-export PATH=$PATH:/opt/llvm/bin
-export FILE=$1; shift
-export LDC_PATH=~/ldc
-PARAM=$(for p_file in $($LDC_PATH/bin/ldc $FILE -I~/ldc/lphobos -c -v -of/dev/null |grep import \
-        |sed -e "s/import *//" -e "s/\t.*//" \
-        |sed -e "s/\./\//g" -e "s/$/\.d/"); do if [ -f $p_file ]; then echo $p_file; fi; done)
-echo ldc $FILE $@ $PARAM
-$LDC_PATH/bin/ldc $FILE $@ $PARAM
--- a/lphobos/llvmdc.conf	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-
-[Environment]
-
-DFLAGS=-I%@P%/../lphobos -I%@P%/../import -L-L%@P%/../lib
-# -R%@P%/../lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/import/ldc/cstdarg.di	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,29 @@
+/*
+ * vararg support for extern(C) functions
+ */
+
+module ldc.cstdarg;
+
+// Check for the right compiler
+version(LDC)
+{
+    // OK
+}
+else
+{
+    static assert(false, "This module is only valid for LDC");
+}
+
+alias void* va_list;
+
+pragma(va_start)
+    void va_start(T)(va_list ap, ref T);
+
+pragma(va_arg)
+    T va_arg(T)(va_list ap);
+
+pragma(va_end)
+    void va_end(va_list args);
+
+pragma(va_copy)
+    void va_copy(va_list dst, va_list src);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/import/ldc/intrinsics.di	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,316 @@
+/*
+ * This module holds declarations to LLVM intrinsics.
+ *
+ * See the LLVM language reference for more information:
+ *
+ * - http://llvm.org/docs/LangRef.html#intrinsics
+ *
+ */
+
+module ldc.intrinsics;
+
+// Check for the right compiler
+version(LDC)
+{
+    // OK
+}
+else
+{
+    static assert(false, "This module is only valid for LDC");
+}
+
+//
+// CODE GENERATOR INTRINSICS
+//
+
+
+// The 'llvm.returnaddress' intrinsic attempts to compute a target-specific value indicating the return address of the current function or one of its callers. 
+
+pragma(intrinsic, "llvm.returnaddress")
+    void* llvm_returnaddress(uint level);
+
+
+// The 'llvm.frameaddress' intrinsic attempts to return the target-specific frame pointer value for the specified stack frame. 
+
+pragma(intrinsic, "llvm.frameaddress")
+    void* llvm_frameaddress(uint level);
+
+
+// The 'llvm.stacksave' intrinsic is used to remember the current state of the function stack, for use with llvm.stackrestore. This is useful for implementing language features like scoped automatic variable sized arrays in C99. 
+
+pragma(intrinsic, "llvm.stacksave")
+    void* llvm_stacksave();
+
+
+// The 'llvm.stackrestore' intrinsic is used to restore the state of the function stack to the state it was in when the corresponding llvm.stacksave intrinsic executed. This is useful for implementing language features like scoped automatic variable sized arrays in C99. 
+
+pragma(intrinsic, "llvm.stackrestore")
+    void llvm_stackrestore(void* ptr);
+
+
+// The 'llvm.prefetch' intrinsic is a hint to the code generator to insert a prefetch instruction if supported; otherwise, it is a noop. Prefetches have no effect on the behavior of the program but can change its performance characteristics.
+
+pragma(intrinsic, "llvm.prefetch")
+    void llvm_prefetch(void* ptr, uint rw, uint locality);
+
+
+// The 'llvm.pcmarker' intrinsic is a method to export a Program Counter (PC) in a region of code to simulators and other tools. The method is target specific, but it is expected that the marker will use exported symbols to transmit the PC of the marker. The marker makes no guarantees that it will remain with any specific instruction after optimizations. It is possible that the presence of a marker will inhibit optimizations. The intended use is to be inserted after optimizations to allow correlations of simulation runs. 
+
+pragma(intrinsic, "llvm.pcmarker")
+    void llvm_pcmarker(uint id);
+
+
+// The 'llvm.readcyclecounter' intrinsic provides access to the cycle counter register (or similar low latency, high accuracy clocks) on those targets that support it. On X86, it should map to RDTSC. On Alpha, it should map to RPCC. As the backing counters overflow quickly (on the order of 9 seconds on alpha), this should only be used for small timings. 
+
+pragma(intrinsic, "llvm.readcyclecounter")
+    ulong readcyclecounter();
+
+
+
+
+//
+// STANDARD C LIBRARY INTRINSICS
+//
+
+
+// The 'llvm.memcpy.*' intrinsics copy a block of memory from the source location to the destination location.
+// Note that, unlike the standard libc function, the llvm.memcpy.* intrinsics do not return a value, and takes an extra alignment argument.
+
+pragma(intrinsic, "llvm.memcpy.i32")
+    void llvm_memcpy_i32(void* dst, void* src, uint len, uint alignment);
+pragma(intrinsic, "llvm.memcpy.i64")
+    void llvm_memcpy_i64(void* dst, void* src, ulong len, uint alignment);
+
+
+// The 'llvm.memmove.*' intrinsics move a block of memory from the source location to the destination location. It is similar to the 'llvm.memcpy' intrinsic but allows the two memory locations to overlap.
+// Note that, unlike the standard libc function, the llvm.memmove.* intrinsics do not return a value, and takes an extra alignment argument.
+
+pragma(intrinsic, "llvm.memmove.i32")
+    void llvm_memmove_i32(void* dst, void* src, uint len, uint alignment);
+pragma(intrinsic, "llvm.memmove.i64")
+    void llvm_memmove_i64(void* dst, void* src, ulong len, int alignment);
+
+
+// The 'llvm.memset.*' intrinsics fill a block of memory with a particular byte value.
+// Note that, unlike the standard libc function, the llvm.memset intrinsic does not return a value, and takes an extra alignment argument.
+
+pragma(intrinsic, "llvm.memset.i32")
+    void llvm_memset_i32(void* dst, ubyte val, uint len, uint alignment);
+pragma(intrinsic, "llvm.memset.i64")
+    void llvm_memset_i64(void* dst, ubyte val, ulong len, uint alignment);
+
+
+// The 'llvm.sqrt' intrinsics return the sqrt of the specified operand, returning the same value as the libm 'sqrt' functions would. Unlike sqrt in libm, however, llvm.sqrt has undefined behavior for negative numbers other than -0.0 (which allows for better optimization, because there is no need to worry about errno being set). llvm.sqrt(-0.0) is defined to return -0.0 like IEEE sqrt. 
+
+pragma(intrinsic, "llvm.sqrt.f32")
+    float llvm_sqrt_f32(float val);
+pragma(intrinsic, "llvm.sqrt.f64")
+    double llvm_sqrt_f64(double val);
+version(X86)
+{
+pragma(intrinsic, "llvm.sqrt.f80")
+    real llvm_sqrt_f80(real val);
+}
+
+
+// The 'llvm.sin.*' intrinsics return the sine of the operand. 
+
+pragma(intrinsic, "llvm.sin.f32")
+    float llvm_sin_f32(float val);
+pragma(intrinsic, "llvm.sin.f64")
+    double llvm_sin_f64(double val);
+version(X86)
+{
+pragma(intrinsic, "llvm.sin.f80")
+    real llvm_sin_f80(real val);
+}
+
+
+// The 'llvm.cos.*' intrinsics return the cosine of the operand. 
+
+pragma(intrinsic, "llvm.cos.f32")
+    float llvm_cos_f32(float val);
+pragma(intrinsic, "llvm.cos.f64")
+    double llvm_cos_f64(double val);
+version(X86)
+{
+pragma(intrinsic, "llvm.cos.f80")
+    real llvm_cos_f80(real val);
+}
+
+
+// The 'llvm.powi.*' intrinsics return the first operand raised to the specified (positive or negative) power. The order of evaluation of multiplications is not defined. When a vector of floating point type is used, the second argument remains a scalar integer value. 
+
+pragma(intrinsic, "llvm.powi.f32")
+    float llvm_powi_f32(float val, int power);
+
+pragma(intrinsic, "llvm.powi.f64")
+    double llvm_powi_f64(double val, int power);
+version(X86)
+{
+pragma(intrinsic, "llvm.powi.f80")
+    real llvm_powi_f80(real val, int power);
+}
+
+
+// The 'llvm.pow.*' intrinsics return the first operand raised to the specified (positive or negative) power. 
+
+pragma(intrinsic, "llvm.pow.f32")
+    float llvm_pow_f32(float val, float power);
+
+pragma(intrinsic, "llvm.pow.f64")
+    double llvm_pow_f64(double val, double power);
+version(X86)
+{
+pragma(intrinsic, "llvm.pow.f80")
+    real llvm_pow_f80(real val, real power);
+}
+
+
+
+
+//
+// BIT MANIPULATION INTRINSICS
+//
+
+// The 'llvm.bswap' family of intrinsics is used to byte swap integer values with an even number of bytes (positive multiple of 16 bits). These are useful for performing operations on data that is not in the target's native byte order. 
+
+pragma(intrinsic, "llvm.bswap.i16.i16")
+    ushort llvm_bswap_i16(ushort val);
+
+pragma(intrinsic, "llvm.bswap.i32.i32")
+    uint llvm_bswap_i32(uint val);
+
+pragma(intrinsic, "llvm.bswap.i64.i64")
+    ulong llvm_bswap_i64(ulong val);
+
+
+// The 'llvm.ctpop' family of intrinsics counts the number of bits set in a value. 
+
+pragma(intrinsic, "llvm.ctpop.i8")
+    ubyte llvm_ctpop_i8(ubyte src);
+
+pragma(intrinsic, "llvm.ctpop.i16")
+    ushort llvm_ctpop_i16(ushort src);
+
+pragma(intrinsic, "llvm.ctpop.i32")
+    uint llvm_ctpop_i32(uint src);
+
+pragma(intrinsic, "llvm.ctpop.i64")
+    ulong llvm_ctpop_i64(ulong src);
+
+
+// The 'llvm.ctlz' family of intrinsic functions counts the number of leading zeros in a variable. 
+
+pragma(intrinsic, "llvm.ctlz.i8")
+    ubyte llvm_ctlz_i8(ubyte src);
+
+pragma(intrinsic, "llvm.ctlz.i16")
+    ushort llvm_ctlz_i16(ushort src);
+
+pragma(intrinsic, "llvm.ctlz.i32")
+    uint llvm_ctlz_i32(uint src);
+
+pragma(intrinsic, "llvm.ctlz.i64")
+    ulong llvm_ctlz_i64(ulong src);
+
+
+// The 'llvm.cttz' family of intrinsic functions counts the number of trailing zeros. 
+
+pragma(intrinsic, "llvm.cttz.i8")
+    ubyte llvm_cttz_i8(ubyte src);
+
+pragma(intrinsic, "llvm.cttz.i16")
+    ushort llvm_cttz_i16(ushort src);
+
+pragma(intrinsic, "llvm.cttz.i32")
+    uint llvm_cttz_i32(uint src);
+
+pragma(intrinsic, "llvm.cttz.i64")
+    ulong llvm_cttz_i64(ulong src);
+
+
+// The 'llvm.part.select' family of intrinsic functions selects a range of bits from an integer value and returns them in the same bit width as the original value.
+
+pragma(intrinsic, "llvm.part.select.i8")
+    ubyte llvm_part_select_i(ubyte val, uint loBit, uint hiBit);
+
+pragma(intrinsic, "llvm.part.select.i16")
+    ushort llvm_part_select_i(ushort val, uint loBit, uint hiBit);
+
+pragma(intrinsic, "llvm.part.select.i32")
+    uint llvm_part_select_i(uint val, uint loBit, uint hiBit);
+
+pragma(intrinsic, "llvm.part.select.i64")
+    ulong llvm_part_select_i(ulong val, uint loBit, uint hiBit);
+
+
+// The 'llvm.part.set' family of intrinsic functions replaces a range of bits in an integer value with another integer value. It returns the integer with the replaced bits.
+
+// TODO
+// declare i17 @llvm.part.set.i17.i9 (i17 %val, i9 %repl, i32 %lo, i32 %hi)
+// declare i29 @llvm.part.set.i29.i9 (i29 %val, i9 %repl, i32 %lo, i32 %hi)
+
+
+
+
+//
+// ATOMIC OPERATIONS AND SYNCHRONIZATION INTRINSICS
+//
+
+// The llvm.memory.barrier intrinsic guarantees ordering between specific pairs of memory access types.
+
+pragma(intrinsic, "llvm.memory.barrier")
+    void llvm_memory_barrier(bool ll, bool ls, bool sl, bool ss, bool device);
+
+// This loads a value in memory and compares it to a given value. If they are equal, it stores a new value into the memory.
+
+pragma(intrinsic, "llvm.atomic.cmp.swap.i#.p0i#")
+    T llvm_atomic_cmp_swap(T)(T* ptr, T cmp, T val);
+
+// This intrinsic loads the value stored in memory at ptr and yields the value from memory. It then stores the value in val in the memory at ptr.
+
+pragma(intrinsic, "llvm.atomic.swap.i#.p0i#")
+    T llvm_atomic_swap(T)(T* ptr, T val);
+
+// This intrinsic adds delta to the value stored in memory at ptr. It yields the original value at ptr.
+
+pragma(intrinsic, "llvm.atomic.load.add.i#.p0i#")
+    T llvm_atomic_load_add(T)(T* ptr, T val);
+
+// This intrinsic subtracts delta to the value stored in memory at ptr. It yields the original value at ptr.
+
+pragma(intrinsic, "llvm.atomic.load.sub.i#.p0i#")
+    T llvm_atomic_load_sub(T)(T* ptr, T val);
+
+// These intrinsics bitwise the operation (and, nand, or, xor) delta to the value stored in memory at ptr. It yields the original value at ptr.
+
+pragma(intrinsic, "llvm.atomic.load.and.i#.p0i#")
+    T llvm_atomic_load_and(T)(T* ptr, T val);
+pragma(intrinsic, "llvm.atomic.load.nand.i#.p0i#")
+    T llvm_atomic_load_nand(T)(T* ptr, T val);
+pragma(intrinsic, "llvm.atomic.load.or.i#.p0i#")
+    T llvm_atomic_load_or(T)(T* ptr, T val);
+pragma(intrinsic, "llvm.atomic.load.xor.i#.p0i#")
+    T llvm_atomic_load_xor(T)(T* ptr, T val);
+
+// These intrinsics takes the signed or unsigned minimum or maximum of delta and the value stored in memory at ptr. It yields the original value at ptr. 
+
+pragma(intrinsic, "llvm.atomic.load.max.i#.p0i#")
+    T llvm_atomic_load_max(T)(T* ptr, T val);
+pragma(intrinsic, "llvm.atomic.load.min.i#.p0i#")
+    T llvm_atomic_load_min(T)(T* ptr, T val);
+pragma(intrinsic, "llvm.atomic.load.umax.i#.p0i#")
+    T llvm_atomic_load_umax(T)(T* ptr, T val);
+pragma(intrinsic, "llvm.atomic.load.umin.i#.p0i#")
+    T llvm_atomic_load_umin(T)(T* ptr, T val);
+
+//
+// GENERAL INTRINSICS
+//
+
+
+// This intrinsics is lowered to the target dependent trap instruction. If the target does not have a trap instruction, this intrinsic will be lowered to the call of the abort() function. 
+
+pragma(intrinsic, "llvm.trap")
+    void llvm_trap();
--- a/runtime/import/llvmdc/cstdarg.di	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * vararg support for extern(C) functions
- */
-
-module ldc.cstdarg;
-
-// Check for the right compiler
-version(LDC)
-{
-    // OK
-}
-else
-{
-    static assert(false, "This module is only valid for LDC");
-}
-
-alias void* va_list;
-
-pragma(va_start)
-    void va_start(T)(va_list ap, ref T);
-
-pragma(va_arg)
-    T va_arg(T)(va_list ap);
-
-pragma(va_end)
-    void va_end(va_list args);
-
-pragma(va_copy)
-    void va_copy(va_list dst, va_list src);
--- a/runtime/import/llvmdc/intrinsics.di	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,316 +0,0 @@
-/*
- * This module holds declarations to LLVM intrinsics.
- *
- * See the LLVM language reference for more information:
- *
- * - http://llvm.org/docs/LangRef.html#intrinsics
- *
- */
-
-module ldc.intrinsics;
-
-// Check for the right compiler
-version(LDC)
-{
-    // OK
-}
-else
-{
-    static assert(false, "This module is only valid for LDC");
-}
-
-//
-// CODE GENERATOR INTRINSICS
-//
-
-
-// The 'llvm.returnaddress' intrinsic attempts to compute a target-specific value indicating the return address of the current function or one of its callers. 
-
-pragma(intrinsic, "llvm.returnaddress")
-    void* llvm_returnaddress(uint level);
-
-
-// The 'llvm.frameaddress' intrinsic attempts to return the target-specific frame pointer value for the specified stack frame. 
-
-pragma(intrinsic, "llvm.frameaddress")
-    void* llvm_frameaddress(uint level);
-
-
-// The 'llvm.stacksave' intrinsic is used to remember the current state of the function stack, for use with llvm.stackrestore. This is useful for implementing language features like scoped automatic variable sized arrays in C99. 
-
-pragma(intrinsic, "llvm.stacksave")
-    void* llvm_stacksave();
-
-
-// The 'llvm.stackrestore' intrinsic is used to restore the state of the function stack to the state it was in when the corresponding llvm.stacksave intrinsic executed. This is useful for implementing language features like scoped automatic variable sized arrays in C99. 
-
-pragma(intrinsic, "llvm.stackrestore")
-    void llvm_stackrestore(void* ptr);
-
-
-// The 'llvm.prefetch' intrinsic is a hint to the code generator to insert a prefetch instruction if supported; otherwise, it is a noop. Prefetches have no effect on the behavior of the program but can change its performance characteristics.
-
-pragma(intrinsic, "llvm.prefetch")
-    void llvm_prefetch(void* ptr, uint rw, uint locality);
-
-
-// The 'llvm.pcmarker' intrinsic is a method to export a Program Counter (PC) in a region of code to simulators and other tools. The method is target specific, but it is expected that the marker will use exported symbols to transmit the PC of the marker. The marker makes no guarantees that it will remain with any specific instruction after optimizations. It is possible that the presence of a marker will inhibit optimizations. The intended use is to be inserted after optimizations to allow correlations of simulation runs. 
-
-pragma(intrinsic, "llvm.pcmarker")
-    void llvm_pcmarker(uint id);
-
-
-// The 'llvm.readcyclecounter' intrinsic provides access to the cycle counter register (or similar low latency, high accuracy clocks) on those targets that support it. On X86, it should map to RDTSC. On Alpha, it should map to RPCC. As the backing counters overflow quickly (on the order of 9 seconds on alpha), this should only be used for small timings. 
-
-pragma(intrinsic, "llvm.readcyclecounter")
-    ulong readcyclecounter();
-
-
-
-
-//
-// STANDARD C LIBRARY INTRINSICS
-//
-
-
-// The 'llvm.memcpy.*' intrinsics copy a block of memory from the source location to the destination location.
-// Note that, unlike the standard libc function, the llvm.memcpy.* intrinsics do not return a value, and takes an extra alignment argument.
-
-pragma(intrinsic, "llvm.memcpy.i32")
-    void llvm_memcpy_i32(void* dst, void* src, uint len, uint alignment);
-pragma(intrinsic, "llvm.memcpy.i64")
-    void llvm_memcpy_i64(void* dst, void* src, ulong len, uint alignment);
-
-
-// The 'llvm.memmove.*' intrinsics move a block of memory from the source location to the destination location. It is similar to the 'llvm.memcpy' intrinsic but allows the two memory locations to overlap.
-// Note that, unlike the standard libc function, the llvm.memmove.* intrinsics do not return a value, and takes an extra alignment argument.
-
-pragma(intrinsic, "llvm.memmove.i32")
-    void llvm_memmove_i32(void* dst, void* src, uint len, uint alignment);
-pragma(intrinsic, "llvm.memmove.i64")
-    void llvm_memmove_i64(void* dst, void* src, ulong len, int alignment);
-
-
-// The 'llvm.memset.*' intrinsics fill a block of memory with a particular byte value.
-// Note that, unlike the standard libc function, the llvm.memset intrinsic does not return a value, and takes an extra alignment argument.
-
-pragma(intrinsic, "llvm.memset.i32")
-    void llvm_memset_i32(void* dst, ubyte val, uint len, uint alignment);
-pragma(intrinsic, "llvm.memset.i64")
-    void llvm_memset_i64(void* dst, ubyte val, ulong len, uint alignment);
-
-
-// The 'llvm.sqrt' intrinsics return the sqrt of the specified operand, returning the same value as the libm 'sqrt' functions would. Unlike sqrt in libm, however, llvm.sqrt has undefined behavior for negative numbers other than -0.0 (which allows for better optimization, because there is no need to worry about errno being set). llvm.sqrt(-0.0) is defined to return -0.0 like IEEE sqrt. 
-
-pragma(intrinsic, "llvm.sqrt.f32")
-    float llvm_sqrt_f32(float val);
-pragma(intrinsic, "llvm.sqrt.f64")
-    double llvm_sqrt_f64(double val);
-version(X86)
-{
-pragma(intrinsic, "llvm.sqrt.f80")
-    real llvm_sqrt_f80(real val);
-}
-
-
-// The 'llvm.sin.*' intrinsics return the sine of the operand. 
-
-pragma(intrinsic, "llvm.sin.f32")
-    float llvm_sin_f32(float val);
-pragma(intrinsic, "llvm.sin.f64")
-    double llvm_sin_f64(double val);
-version(X86)
-{
-pragma(intrinsic, "llvm.sin.f80")
-    real llvm_sin_f80(real val);
-}
-
-
-// The 'llvm.cos.*' intrinsics return the cosine of the operand. 
-
-pragma(intrinsic, "llvm.cos.f32")
-    float llvm_cos_f32(float val);
-pragma(intrinsic, "llvm.cos.f64")
-    double llvm_cos_f64(double val);
-version(X86)
-{
-pragma(intrinsic, "llvm.cos.f80")
-    real llvm_cos_f80(real val);
-}
-
-
-// The 'llvm.powi.*' intrinsics return the first operand raised to the specified (positive or negative) power. The order of evaluation of multiplications is not defined. When a vector of floating point type is used, the second argument remains a scalar integer value. 
-
-pragma(intrinsic, "llvm.powi.f32")
-    float llvm_powi_f32(float val, int power);
-
-pragma(intrinsic, "llvm.powi.f64")
-    double llvm_powi_f64(double val, int power);
-version(X86)
-{
-pragma(intrinsic, "llvm.powi.f80")
-    real llvm_powi_f80(real val, int power);
-}
-
-
-// The 'llvm.pow.*' intrinsics return the first operand raised to the specified (positive or negative) power. 
-
-pragma(intrinsic, "llvm.pow.f32")
-    float llvm_pow_f32(float val, float power);
-
-pragma(intrinsic, "llvm.pow.f64")
-    double llvm_pow_f64(double val, double power);
-version(X86)
-{
-pragma(intrinsic, "llvm.pow.f80")
-    real llvm_pow_f80(real val, real power);
-}
-
-
-
-
-//
-// BIT MANIPULATION INTRINSICS
-//
-
-// The 'llvm.bswap' family of intrinsics is used to byte swap integer values with an even number of bytes (positive multiple of 16 bits). These are useful for performing operations on data that is not in the target's native byte order. 
-
-pragma(intrinsic, "llvm.bswap.i16.i16")
-    ushort llvm_bswap_i16(ushort val);
-
-pragma(intrinsic, "llvm.bswap.i32.i32")
-    uint llvm_bswap_i32(uint val);
-
-pragma(intrinsic, "llvm.bswap.i64.i64")
-    ulong llvm_bswap_i64(ulong val);
-
-
-// The 'llvm.ctpop' family of intrinsics counts the number of bits set in a value. 
-
-pragma(intrinsic, "llvm.ctpop.i8")
-    ubyte llvm_ctpop_i8(ubyte src);
-
-pragma(intrinsic, "llvm.ctpop.i16")
-    ushort llvm_ctpop_i16(ushort src);
-
-pragma(intrinsic, "llvm.ctpop.i32")
-    uint llvm_ctpop_i32(uint src);
-
-pragma(intrinsic, "llvm.ctpop.i64")
-    ulong llvm_ctpop_i64(ulong src);
-
-
-// The 'llvm.ctlz' family of intrinsic functions counts the number of leading zeros in a variable. 
-
-pragma(intrinsic, "llvm.ctlz.i8")
-    ubyte llvm_ctlz_i8(ubyte src);
-
-pragma(intrinsic, "llvm.ctlz.i16")
-    ushort llvm_ctlz_i16(ushort src);
-
-pragma(intrinsic, "llvm.ctlz.i32")
-    uint llvm_ctlz_i32(uint src);
-
-pragma(intrinsic, "llvm.ctlz.i64")
-    ulong llvm_ctlz_i64(ulong src);
-
-
-// The 'llvm.cttz' family of intrinsic functions counts the number of trailing zeros. 
-
-pragma(intrinsic, "llvm.cttz.i8")
-    ubyte llvm_cttz_i8(ubyte src);
-
-pragma(intrinsic, "llvm.cttz.i16")
-    ushort llvm_cttz_i16(ushort src);
-
-pragma(intrinsic, "llvm.cttz.i32")
-    uint llvm_cttz_i32(uint src);
-
-pragma(intrinsic, "llvm.cttz.i64")
-    ulong llvm_cttz_i64(ulong src);
-
-
-// The 'llvm.part.select' family of intrinsic functions selects a range of bits from an integer value and returns them in the same bit width as the original value.
-
-pragma(intrinsic, "llvm.part.select.i8")
-    ubyte llvm_part_select_i(ubyte val, uint loBit, uint hiBit);
-
-pragma(intrinsic, "llvm.part.select.i16")
-    ushort llvm_part_select_i(ushort val, uint loBit, uint hiBit);
-
-pragma(intrinsic, "llvm.part.select.i32")
-    uint llvm_part_select_i(uint val, uint loBit, uint hiBit);
-
-pragma(intrinsic, "llvm.part.select.i64")
-    ulong llvm_part_select_i(ulong val, uint loBit, uint hiBit);
-
-
-// The 'llvm.part.set' family of intrinsic functions replaces a range of bits in an integer value with another integer value. It returns the integer with the replaced bits.
-
-// TODO
-// declare i17 @llvm.part.set.i17.i9 (i17 %val, i9 %repl, i32 %lo, i32 %hi)
-// declare i29 @llvm.part.set.i29.i9 (i29 %val, i9 %repl, i32 %lo, i32 %hi)
-
-
-
-
-//
-// ATOMIC OPERATIONS AND SYNCHRONIZATION INTRINSICS
-//
-
-// The llvm.memory.barrier intrinsic guarantees ordering between specific pairs of memory access types.
-
-pragma(intrinsic, "llvm.memory.barrier")
-    void llvm_memory_barrier(bool ll, bool ls, bool sl, bool ss, bool device);
-
-// This loads a value in memory and compares it to a given value. If they are equal, it stores a new value into the memory.
-
-pragma(intrinsic, "llvm.atomic.cmp.swap.i#.p0i#")
-    T llvm_atomic_cmp_swap(T)(T* ptr, T cmp, T val);
-
-// This intrinsic loads the value stored in memory at ptr and yields the value from memory. It then stores the value in val in the memory at ptr.
-
-pragma(intrinsic, "llvm.atomic.swap.i#.p0i#")
-    T llvm_atomic_swap(T)(T* ptr, T val);
-
-// This intrinsic adds delta to the value stored in memory at ptr. It yields the original value at ptr.
-
-pragma(intrinsic, "llvm.atomic.load.add.i#.p0i#")
-    T llvm_atomic_load_add(T)(T* ptr, T val);
-
-// This intrinsic subtracts delta to the value stored in memory at ptr. It yields the original value at ptr.
-
-pragma(intrinsic, "llvm.atomic.load.sub.i#.p0i#")
-    T llvm_atomic_load_sub(T)(T* ptr, T val);
-
-// These intrinsics bitwise the operation (and, nand, or, xor) delta to the value stored in memory at ptr. It yields the original value at ptr.
-
-pragma(intrinsic, "llvm.atomic.load.and.i#.p0i#")
-    T llvm_atomic_load_and(T)(T* ptr, T val);
-pragma(intrinsic, "llvm.atomic.load.nand.i#.p0i#")
-    T llvm_atomic_load_nand(T)(T* ptr, T val);
-pragma(intrinsic, "llvm.atomic.load.or.i#.p0i#")
-    T llvm_atomic_load_or(T)(T* ptr, T val);
-pragma(intrinsic, "llvm.atomic.load.xor.i#.p0i#")
-    T llvm_atomic_load_xor(T)(T* ptr, T val);
-
-// These intrinsics takes the signed or unsigned minimum or maximum of delta and the value stored in memory at ptr. It yields the original value at ptr. 
-
-pragma(intrinsic, "llvm.atomic.load.max.i#.p0i#")
-    T llvm_atomic_load_max(T)(T* ptr, T val);
-pragma(intrinsic, "llvm.atomic.load.min.i#.p0i#")
-    T llvm_atomic_load_min(T)(T* ptr, T val);
-pragma(intrinsic, "llvm.atomic.load.umax.i#.p0i#")
-    T llvm_atomic_load_umax(T)(T* ptr, T val);
-pragma(intrinsic, "llvm.atomic.load.umin.i#.p0i#")
-    T llvm_atomic_load_umin(T)(T* ptr, T val);
-
-//
-// GENERAL INTRINSICS
-//
-
-
-// This intrinsics is lowered to the target dependent trap instruction. If the target does not have a trap instruction, this intrinsic will be lowered to the call of the abort() function. 
-
-pragma(intrinsic, "llvm.trap")
-    void llvm_trap();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/internal/ldc.mak	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,196 @@
+# Makefile to build the LDC compiler runtime D library for Linux
+# Designed to work with GNU make
+# Targets:
+#	make
+#		Same as make all
+#	make lib
+#		Build the compiler runtime library
+#   make doc
+#       Generate documentation
+#	make clean
+#		Delete unneeded files created by build process
+
+LIB_TARGET_FULL=libldc-runtime.a
+LIB_TARGET_BC_ONLY=libldc-runtime-bc-only.a
+LIB_TARGET_C_ONLY=libldc-runtime-c-only.a
+LIB_TARGET_SHARED=libldc-runtime-shared.so
+LIB_MASK=libldc-runtime*.*
+
+
+CP=cp -f
+RM=rm -f
+MD=mkdir -p
+
+#CFLAGS=-O3 $(ADD_CFLAGS)
+CFLAGS=$(ADD_CFLAGS)
+
+#DFLAGS=-release -O3 -inline -w $(ADD_DFLAGS)
+DFLAGS=-w $(ADD_DFLAGS)
+
+#TFLAGS=-O3 -inline -w $(ADD_DFLAGS)
+TFLAGS=-w $(ADD_DFLAGS)
+
+DOCFLAGS=-version=DDoc
+
+CC=gcc
+LC=llvm-ar rsv
+LLINK=llvm-link
+LCC=llc
+CLC=ar rsv
+DC=ldc
+LLC=llvm-as
+
+LIB_DEST=..
+
+.SUFFIXES: .s .S .c .cpp .d .ll .html .o .bc
+
+.s.o:
+	$(CC) -c $(CFLAGS) $< -o$@
+
+.S.o:
+	$(CC) -c $(CFLAGS) $< -o$@
+
+.c.o:
+	$(CC) -c $(CFLAGS) $< -o$@
+
+.cpp.o:
+	g++ -c $(CFLAGS) $< -o$@
+
+.d.bc:
+	$(DC) -c $(DFLAGS) $< -of$@
+
+.d.html:
+	$(DC) -c -o- $(DOCFLAGS) -Df$*.html ldc.ddoc $<
+
+targets : lib sharedlib doc
+all     : lib sharedlib doc
+lib     : ldc.lib ldc.bclib ldc.clib
+sharedlib : ldc.sharedlib
+doc     : ldc.doc
+
+######################################################
+OBJ_C= \
+    monitor.o \
+    critical.o
+
+OBJ_BASE= \
+    aaA.bc \
+    aApply.bc \
+    aApplyR.bc \
+    adi.bc \
+    arrayInit.bc \
+    cast.bc \
+    dmain2.bc \
+    eh.bc \
+    genobj.bc \
+    lifetime.bc \
+    memory.bc \
+    qsort2.bc \
+    switch.bc \
+    invariant.bc
+
+OBJ_UTIL= \
+    util/console.bc \
+    util/ctype.bc \
+    util/string.bc \
+    util/utf.bc
+
+OBJ_LDC= \
+    ldc/bitmanip.bc \
+    ldc/vararg.bc
+
+OBJ_TI= \
+    typeinfo/ti_AC.bc \
+    typeinfo/ti_Acdouble.bc \
+    typeinfo/ti_Acfloat.bc \
+    typeinfo/ti_Acreal.bc \
+    typeinfo/ti_Adouble.bc \
+    typeinfo/ti_Afloat.bc \
+    typeinfo/ti_Ag.bc \
+    typeinfo/ti_Aint.bc \
+    typeinfo/ti_Along.bc \
+    typeinfo/ti_Areal.bc \
+    typeinfo/ti_Ashort.bc \
+    typeinfo/ti_byte.bc \
+    typeinfo/ti_C.bc \
+    typeinfo/ti_cdouble.bc \
+    typeinfo/ti_cfloat.bc \
+    typeinfo/ti_char.bc \
+    typeinfo/ti_creal.bc \
+    typeinfo/ti_dchar.bc \
+    typeinfo/ti_delegate.bc \
+    typeinfo/ti_double.bc \
+    typeinfo/ti_float.bc \
+    typeinfo/ti_idouble.bc \
+    typeinfo/ti_ifloat.bc \
+    typeinfo/ti_int.bc \
+    typeinfo/ti_ireal.bc \
+    typeinfo/ti_long.bc \
+    typeinfo/ti_ptr.bc \
+    typeinfo/ti_real.bc \
+    typeinfo/ti_short.bc \
+    typeinfo/ti_ubyte.bc \
+    typeinfo/ti_uint.bc \
+    typeinfo/ti_ulong.bc \
+    typeinfo/ti_ushort.bc \
+    typeinfo/ti_void.bc \
+    typeinfo/ti_wchar.bc
+
+ALL_OBJS= \
+    $(OBJ_BASE) \
+    $(OBJ_UTIL) \
+    $(OBJ_TI) \
+    $(OBJ_LDC)
+
+######################################################
+
+ALL_DOCS=
+
+######################################################
+
+ldc.bclib : $(LIB_TARGET_BC_ONLY)
+ldc.clib : $(LIB_TARGET_C_ONLY)
+ldc.lib : $(LIB_TARGET_FULL)
+ldc.sharedlib : $(LIB_TARGET_SHARED)
+
+$(LIB_TARGET_BC_ONLY) : $(ALL_OBJS)
+	$(RM) $@
+	$(LC) $@ $(ALL_OBJS)
+
+
+$(LIB_TARGET_FULL) : $(ALL_OBJS) $(OBJ_C)
+	$(RM) $@ $@.bc $@.s $@.o
+	$(LLINK) -o=$@.bc $(ALL_OBJS)
+	$(LCC) -o=$@.s $@.bc
+	$(CC) -c -o $@.o $@.s
+	$(CLC) $@ $@.o $(OBJ_C)
+
+
+$(LIB_TARGET_C_ONLY) : $(OBJ_C)
+	$(RM) $@
+	$(CLC) $@ $(OBJ_C)
+
+
+$(LIB_TARGET_SHARED) : $(ALL_OBJS) $(OBJ_C)
+	$(RM) $@ $@.bc $@.s $@.o
+	$(LLINK) -o=$@.bc $(ALL_OBJS)
+	$(LCC) -relocation-model=pic -o=$@.s $@.bc
+	$(CC) -c -o $@.o $@.s
+	$(CC) -shared -o $@ $@.o $(OBJ_C)
+
+
+ldc.doc : $(ALL_DOCS)
+	echo No documentation available.
+
+######################################################
+
+clean :
+	find . -name "*.di" | xargs $(RM)
+	$(RM) $(ALL_OBJS)
+	$(RM) $(OBJ_C)
+	$(RM) $(ALL_DOCS)
+	$(RM) $(LIB_MASK)
+
+install :
+	$(MD) $(LIB_DEST)
+	$(CP) $(LIB_MASK) $(LIB_DEST)/.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/internal/ldc/bitmanip.d	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,81 @@
+/*
+ * D phobos intrinsics for LDC
+ *
+ * From GDC ... public domain!
+ */
+module ldc.bitmanip;
+
+// Check for the right compiler
+version(LDC)
+{
+    // OK
+}
+else
+{
+    static assert(false, "This module is only valid for LDC");
+}
+
+int bsf(uint v)
+{
+    uint m = 1;
+    uint i;
+    for (i = 0; i < 32; i++,m<<=1) {
+        if (v&m)
+        return i;
+    }
+    return i; // supposed to be undefined
+}
+
+int bsr(uint v)
+{
+    uint m = 0x80000000;
+    uint i;
+    for (i = 32; i ; i--,m>>>=1) {
+    if (v&m)
+        return i-1;
+    }
+    return i; // supposed to be undefined
+}
+
+int bt(uint *p, uint bitnum)
+{
+    return (p[bitnum / (uint.sizeof*8)] & (1<<(bitnum & ((uint.sizeof*8)-1)))) ? -1 : 0 ;
+}
+
+int btc(uint *p, uint bitnum)
+{
+    uint * q = p + (bitnum / (uint.sizeof*8));
+    uint mask = 1 << (bitnum & ((uint.sizeof*8) - 1));
+    int result = *q & mask;
+    *q ^= mask;
+    return result ? -1 : 0;
+}
+
+int btr(uint *p, uint bitnum)
+{
+    uint * q = p + (bitnum / (uint.sizeof*8));
+    uint mask = 1 << (bitnum & ((uint.sizeof*8) - 1));
+    int result = *q & mask;
+    *q &= ~mask;
+    return result ? -1 : 0;
+}
+
+int bts(uint *p, uint bitnum)
+{
+    uint * q = p + (bitnum / (uint.sizeof*8));
+    uint mask = 1 << (bitnum & ((uint.sizeof*8) - 1));
+    int result = *q & mask;
+    *q |= mask;
+    return result ? -1 : 0;
+}
+
+pragma(intrinsic, "llvm.bswap.i32")
+    uint bswap(uint val);
+
+ubyte  inp(uint p) { throw new Exception("inp intrinsic not yet implemented"); }
+ushort inpw(uint p) { throw new Exception("inpw intrinsic not yet implemented"); }
+uint   inpl(uint p) { throw new Exception("inpl intrinsic not yet implemented"); }
+
+ubyte  outp(uint p, ubyte v) { throw new Exception("outp intrinsic not yet implemented"); }
+ushort outpw(uint p, ushort v) { throw new Exception("outpw intrinsic not yet implemented"); }
+uint   outpl(uint p, uint v) { throw new Exception("outpl intrinsic not yet implemented"); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/internal/ldc/vararg.d	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,43 @@
+/*
+ * This module holds the implementation of special vararg templates for D style var args.
+ *
+ * Provides the functions tango.core.Vararg expects to be present!
+ */
+
+module ldc.Vararg;
+
+// Check for the right compiler
+version(LDC)
+{
+    // OK
+}
+else
+{
+    static assert(false, "This module is only valid for LDC");
+}
+
+alias void* va_list;
+
+void va_start(T) ( out va_list ap, inout T parmn )
+{
+    // not needed !
+}
+
+T va_arg(T)(ref va_list vp)
+{
+    T* arg = cast(T*) vp;
+    // ldc always aligns to size_t.sizeof in vararg lists
+    vp = cast(va_list) ( cast(void*) vp + ( ( T.sizeof + size_t.sizeof - 1 ) & ~( size_t.sizeof - 1 ) ) );
+    return *arg;
+}
+
+void va_end( va_list ap )
+{
+    // not needed !
+}
+
+void va_copy( out va_list dst, va_list src )
+{
+    // seems pretty useless !
+    dst = src;
+}
--- a/runtime/internal/llvmdc.mak	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,196 +0,0 @@
-# Makefile to build the LDC compiler runtime D library for Linux
-# Designed to work with GNU make
-# Targets:
-#	make
-#		Same as make all
-#	make lib
-#		Build the compiler runtime library
-#   make doc
-#       Generate documentation
-#	make clean
-#		Delete unneeded files created by build process
-
-LIB_TARGET_FULL=libldc-runtime.a
-LIB_TARGET_BC_ONLY=libldc-runtime-bc-only.a
-LIB_TARGET_C_ONLY=libldc-runtime-c-only.a
-LIB_TARGET_SHARED=libldc-runtime-shared.so
-LIB_MASK=libldc-runtime*.*
-
-
-CP=cp -f
-RM=rm -f
-MD=mkdir -p
-
-#CFLAGS=-O3 $(ADD_CFLAGS)
-CFLAGS=$(ADD_CFLAGS)
-
-#DFLAGS=-release -O3 -inline -w $(ADD_DFLAGS)
-DFLAGS=-w $(ADD_DFLAGS)
-
-#TFLAGS=-O3 -inline -w $(ADD_DFLAGS)
-TFLAGS=-w $(ADD_DFLAGS)
-
-DOCFLAGS=-version=DDoc
-
-CC=gcc
-LC=llvm-ar rsv
-LLINK=llvm-link
-LCC=llc
-CLC=ar rsv
-DC=ldc
-LLC=llvm-as
-
-LIB_DEST=..
-
-.SUFFIXES: .s .S .c .cpp .d .ll .html .o .bc
-
-.s.o:
-	$(CC) -c $(CFLAGS) $< -o$@
-
-.S.o:
-	$(CC) -c $(CFLAGS) $< -o$@
-
-.c.o:
-	$(CC) -c $(CFLAGS) $< -o$@
-
-.cpp.o:
-	g++ -c $(CFLAGS) $< -o$@
-
-.d.bc:
-	$(DC) -c $(DFLAGS) $< -of$@
-
-.d.html:
-	$(DC) -c -o- $(DOCFLAGS) -Df$*.html ldc.ddoc $<
-
-targets : lib sharedlib doc
-all     : lib sharedlib doc
-lib     : ldc.lib ldc.bclib ldc.clib
-sharedlib : ldc.sharedlib
-doc     : ldc.doc
-
-######################################################
-OBJ_C= \
-    monitor.o \
-    critical.o
-
-OBJ_BASE= \
-    aaA.bc \
-    aApply.bc \
-    aApplyR.bc \
-    adi.bc \
-    arrayInit.bc \
-    cast.bc \
-    dmain2.bc \
-    eh.bc \
-    genobj.bc \
-    lifetime.bc \
-    memory.bc \
-    qsort2.bc \
-    switch.bc \
-    invariant.bc
-
-OBJ_UTIL= \
-    util/console.bc \
-    util/ctype.bc \
-    util/string.bc \
-    util/utf.bc
-
-OBJ_LDC= \
-    ldc/bitmanip.bc \
-    ldc/vararg.bc
-
-OBJ_TI= \
-    typeinfo/ti_AC.bc \
-    typeinfo/ti_Acdouble.bc \
-    typeinfo/ti_Acfloat.bc \
-    typeinfo/ti_Acreal.bc \
-    typeinfo/ti_Adouble.bc \
-    typeinfo/ti_Afloat.bc \
-    typeinfo/ti_Ag.bc \
-    typeinfo/ti_Aint.bc \
-    typeinfo/ti_Along.bc \
-    typeinfo/ti_Areal.bc \
-    typeinfo/ti_Ashort.bc \
-    typeinfo/ti_byte.bc \
-    typeinfo/ti_C.bc \
-    typeinfo/ti_cdouble.bc \
-    typeinfo/ti_cfloat.bc \
-    typeinfo/ti_char.bc \
-    typeinfo/ti_creal.bc \
-    typeinfo/ti_dchar.bc \
-    typeinfo/ti_delegate.bc \
-    typeinfo/ti_double.bc \
-    typeinfo/ti_float.bc \
-    typeinfo/ti_idouble.bc \
-    typeinfo/ti_ifloat.bc \
-    typeinfo/ti_int.bc \
-    typeinfo/ti_ireal.bc \
-    typeinfo/ti_long.bc \
-    typeinfo/ti_ptr.bc \
-    typeinfo/ti_real.bc \
-    typeinfo/ti_short.bc \
-    typeinfo/ti_ubyte.bc \
-    typeinfo/ti_uint.bc \
-    typeinfo/ti_ulong.bc \
-    typeinfo/ti_ushort.bc \
-    typeinfo/ti_void.bc \
-    typeinfo/ti_wchar.bc
-
-ALL_OBJS= \
-    $(OBJ_BASE) \
-    $(OBJ_UTIL) \
-    $(OBJ_TI) \
-    $(OBJ_LDC)
-
-######################################################
-
-ALL_DOCS=
-
-######################################################
-
-ldc.bclib : $(LIB_TARGET_BC_ONLY)
-ldc.clib : $(LIB_TARGET_C_ONLY)
-ldc.lib : $(LIB_TARGET_FULL)
-ldc.sharedlib : $(LIB_TARGET_SHARED)
-
-$(LIB_TARGET_BC_ONLY) : $(ALL_OBJS)
-	$(RM) $@
-	$(LC) $@ $(ALL_OBJS)
-
-
-$(LIB_TARGET_FULL) : $(ALL_OBJS) $(OBJ_C)
-	$(RM) $@ $@.bc $@.s $@.o
-	$(LLINK) -o=$@.bc $(ALL_OBJS)
-	$(LCC) -o=$@.s $@.bc
-	$(CC) -c -o $@.o $@.s
-	$(CLC) $@ $@.o $(OBJ_C)
-
-
-$(LIB_TARGET_C_ONLY) : $(OBJ_C)
-	$(RM) $@
-	$(CLC) $@ $(OBJ_C)
-
-
-$(LIB_TARGET_SHARED) : $(ALL_OBJS) $(OBJ_C)
-	$(RM) $@ $@.bc $@.s $@.o
-	$(LLINK) -o=$@.bc $(ALL_OBJS)
-	$(LCC) -relocation-model=pic -o=$@.s $@.bc
-	$(CC) -c -o $@.o $@.s
-	$(CC) -shared -o $@ $@.o $(OBJ_C)
-
-
-ldc.doc : $(ALL_DOCS)
-	echo No documentation available.
-
-######################################################
-
-clean :
-	find . -name "*.di" | xargs $(RM)
-	$(RM) $(ALL_OBJS)
-	$(RM) $(OBJ_C)
-	$(RM) $(ALL_DOCS)
-	$(RM) $(LIB_MASK)
-
-install :
-	$(MD) $(LIB_DEST)
-	$(CP) $(LIB_MASK) $(LIB_DEST)/.
--- a/runtime/internal/llvmdc/bitmanip.d	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * D phobos intrinsics for LDC
- *
- * From GDC ... public domain!
- */
-module ldc.bitmanip;
-
-// Check for the right compiler
-version(LDC)
-{
-    // OK
-}
-else
-{
-    static assert(false, "This module is only valid for LDC");
-}
-
-int bsf(uint v)
-{
-    uint m = 1;
-    uint i;
-    for (i = 0; i < 32; i++,m<<=1) {
-        if (v&m)
-        return i;
-    }
-    return i; // supposed to be undefined
-}
-
-int bsr(uint v)
-{
-    uint m = 0x80000000;
-    uint i;
-    for (i = 32; i ; i--,m>>>=1) {
-    if (v&m)
-        return i-1;
-    }
-    return i; // supposed to be undefined
-}
-
-int bt(uint *p, uint bitnum)
-{
-    return (p[bitnum / (uint.sizeof*8)] & (1<<(bitnum & ((uint.sizeof*8)-1)))) ? -1 : 0 ;
-}
-
-int btc(uint *p, uint bitnum)
-{
-    uint * q = p + (bitnum / (uint.sizeof*8));
-    uint mask = 1 << (bitnum & ((uint.sizeof*8) - 1));
-    int result = *q & mask;
-    *q ^= mask;
-    return result ? -1 : 0;
-}
-
-int btr(uint *p, uint bitnum)
-{
-    uint * q = p + (bitnum / (uint.sizeof*8));
-    uint mask = 1 << (bitnum & ((uint.sizeof*8) - 1));
-    int result = *q & mask;
-    *q &= ~mask;
-    return result ? -1 : 0;
-}
-
-int bts(uint *p, uint bitnum)
-{
-    uint * q = p + (bitnum / (uint.sizeof*8));
-    uint mask = 1 << (bitnum & ((uint.sizeof*8) - 1));
-    int result = *q & mask;
-    *q |= mask;
-    return result ? -1 : 0;
-}
-
-pragma(intrinsic, "llvm.bswap.i32")
-    uint bswap(uint val);
-
-ubyte  inp(uint p) { throw new Exception("inp intrinsic not yet implemented"); }
-ushort inpw(uint p) { throw new Exception("inpw intrinsic not yet implemented"); }
-uint   inpl(uint p) { throw new Exception("inpl intrinsic not yet implemented"); }
-
-ubyte  outp(uint p, ubyte v) { throw new Exception("outp intrinsic not yet implemented"); }
-ushort outpw(uint p, ushort v) { throw new Exception("outpw intrinsic not yet implemented"); }
-uint   outpl(uint p, uint v) { throw new Exception("outpl intrinsic not yet implemented"); }
--- a/runtime/internal/llvmdc/vararg.d	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * This module holds the implementation of special vararg templates for D style var args.
- *
- * Provides the functions tango.core.Vararg expects to be present!
- */
-
-module ldc.Vararg;
-
-// Check for the right compiler
-version(LDC)
-{
-    // OK
-}
-else
-{
-    static assert(false, "This module is only valid for LDC");
-}
-
-alias void* va_list;
-
-void va_start(T) ( out va_list ap, inout T parmn )
-{
-    // not needed !
-}
-
-T va_arg(T)(ref va_list vp)
-{
-    T* arg = cast(T*) vp;
-    // ldc always aligns to size_t.sizeof in vararg lists
-    vp = cast(va_list) ( cast(void*) vp + ( ( T.sizeof + size_t.sizeof - 1 ) & ~( size_t.sizeof - 1 ) ) );
-    return *arg;
-}
-
-void va_end( va_list ap )
-{
-    // not needed !
-}
-
-void va_copy( out va_list dst, va_list src )
-{
-    // seems pretty useless !
-    dst = src;
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/ldc.diff	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,711 @@
+Index: object.di
+===================================================================
+--- object.di	(revision 3954)
++++ 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 3954)
++++ lib/common/tango/core/BitManip.d	(working copy)
+@@ -171,6 +171,10 @@
+      */
+     uint outpl( uint port_address, uint value );
+ }
++else version( LDC )
++{
++    public import ldc.bitmanip;
++}
+ else
+ {
+     public import std.intrinsic;
+Index: lib/common/tango/core/Thread.d
+===================================================================
+--- lib/common/tango/core/Thread.d	(revision 3954)
++++ lib/common/tango/core/Thread.d	(working copy)
+@@ -244,8 +244,29 @@
+         }
+         body
+         {
+-            version( D_InlineAsm_X86 )
++            version( LDC)
+             {
++                version(X86)
++                {
++                    uint eax,ecx,edx,ebx,ebp,esi,edi;
++                    asm
++                    {
++                        mov eax[EBP], EAX      ;
++                        mov ecx[EBP], ECX      ;
++                        mov edx[EBP], EDX      ;
++                        mov ebx[EBP], EBX      ;
++                        mov ebp[EBP], EBP      ;
++                        mov esi[EBP], ESI      ;
++                        mov edi[EBP], EDI      ;
++                    }
++                }
++                else
++                {
++                    static assert( false, "Architecture not supported." );
++                }
++            }
++            else version( D_InlineAsm_X86 )
++            {
+                 asm
+                 {
+                     pushad;
+@@ -297,8 +318,12 @@
+                 }
+             }
+ 
+-            version( D_InlineAsm_X86 )
++            version( LDC)
+             {
++                // nothing to pop
++            }
++            else version( D_InlineAsm_X86 )
++            {
+                 asm
+                 {
+                     popad;
+@@ -2286,6 +2311,13 @@
+             version = AsmPPC_Posix;
+     }
+ 
++    version( LLVM_InlineAsm_X86 )
++    {
++        version( Win32 )
++            version = LLVM_AsmX86_Win32;
++        else version( Posix )
++            version = LLVM_AsmX86_Posix;
++    }
+ 
+     version( Posix )
+     {
+@@ -2296,6 +2328,8 @@
+         version( AsmX86_Win32 ) {} else
+         version( AsmX86_Posix ) {} else
+         version( AsmPPC_Posix ) {} else
++        version( LLVM_AsmX86_Win32 ) {} else
++        version( LLVM_AsmX86_Posix ) {} else
+         {
+             // NOTE: The ucontext implementation requires architecture specific
+             //       data definitions to operate so testing for it must be done
+@@ -2306,10 +2340,10 @@
+             import tango.stdc.posix.ucontext;
+         }
+     }
+-
+-    const size_t PAGESIZE;
+ }
+ 
++// this can't be private since it's used as default argument to a public function
++const size_t PAGESIZE;
+ 
+ static this()
+ {
+@@ -2336,7 +2370,7 @@
+     }
+ }
+ 
+-
++extern(C) int printf(char*, ...);
+ ////////////////////////////////////////////////////////////////////////////////
+ // Fiber Entry Point and Context Switch
+ ////////////////////////////////////////////////////////////////////////////////
+@@ -2450,6 +2484,22 @@
+                 ret;
+             }
+         }
++        else version( LLVM_AsmX86_Posix )
++        {
++            asm
++            {
++                // clobber registers to save
++                inc EBX;
++                inc ESI;
++                inc EDI;
++
++                // store oldp again with more accurate address
++                mov EAX, oldp;
++                mov [EAX], ESP;
++                // load newp to begin context switch
++                mov ESP, newp;
++            }
++        }
+         else static if( is( ucontext_t ) )
+         {
+             Fiber   cfib = Fiber.getThis();
+@@ -3115,6 +3165,16 @@
+             push( 0x00000000 );                                     // ESI
+             push( 0x00000000 );                                     // EDI
+         }
++        else version( LLVM_AsmX86_Posix )
++        {
++            push( cast(size_t) &fiber_entryPoint );                 // EIP
++            push( 0x00000000 );                                     // newp
++            push( 0x00000000 );                                     // oldp
++            push( 0x00000000 );                                     // EBP
++            push( 0x00000000 );                                     // EBX
++            push( 0x00000000 );                                     // ESI
++            push( 0x00000000 );                                     // EDI
++        }
+         else version( AsmPPC_Posix )
+         {
+             version( StackGrowsDown )
+Index: lib/unittest.sh
+===================================================================
+--- lib/unittest.sh	(revision 3954)
++++ lib/unittest.sh	(working copy)
+@@ -18,8 +18,9 @@
+   --help: This message
+   --run-all: Reports result instead of breaking. Do not use this if you want to
+          run unittest runner through a debugger.
+-  dmd: Builds unittests for dmd
+-  gdc: Builds unittests for gdc
++  dmd:    Builds unittests for dmd
++  gdc:    Builds unittests for gdc
++  ldc: Builds unittests for ldc
+ 
+   <none>: Builds unittests for all known compilers.'
+   exit 0
+@@ -86,7 +87,7 @@
+ void main() {}
+ EOF
+ 
+-        rebuild -w -d -g -L-ldl -L-lz -L-lbz2 -debug=UnitTest -debug -full -clean -unittest \
++        rebuild -w -d -L-ldl -L-lz -L-lbz2 -debug=UnitTest -debug -full -clean -unittest \
+         -version=UnitTest $EXE.d tango/core/*.d tango/core/sync/*.d tango/io/digest/*.d \
+         tango/io/model/*.d tango/io/protocol/*.d tango/io/selector/*.d tango/io/*.d \
+         tango/io/vfs/*.d tango/io/vfs/model/*.d \
+@@ -125,6 +126,9 @@
+         gdc)
+             GDC=1
+             ;;
++        ldc)
++            LDC=1
++            ;;
+         *)
+             usage
+             ;;
+@@ -132,10 +136,11 @@
+     shift
+ done
+ 
+-if [ ! "$DMD" -a ! "$GDC" ]
++if [ ! "$DMD" -a ! "$GDC" -a ! "$LDC" ]
+ then
+     DMD=1
+     GDC=1
++    LDC=1
+ fi
+ 
+ if [ "$DMD" = "1" ]
+@@ -146,4 +151,7 @@
+ then
+     compile gdc runUnitTest_gdc
+ fi
+-
++if [ "$LDC" = "1" ]
++then
++    compile ldc runUnitTest_ldc
++fi
+Index: lib/gc/basic/gcx.d
+===================================================================
+--- lib/gc/basic/gcx.d	(revision 3954)
++++ lib/gc/basic/gcx.d	(working copy)
+@@ -65,6 +65,13 @@
+ }
+ 
+ 
++struct BlkInfo
++{
++    void*  base;
++    size_t size;
++    uint   attr;
++}
++
+ private
+ {
+     enum BlkAttr : uint
+@@ -75,13 +82,6 @@
+         ALL_BITS = 0b1111_1111
+     }
+ 
+-    struct BlkInfo
+-    {
+-        void*  base;
+-        size_t size;
+-        uint   attr;
+-    }
+-
+     extern (C) void* rt_stackBottom();
+     extern (C) void* rt_stackTop();
+ 
+@@ -2178,6 +2178,28 @@
+             __builtin_unwind_init();
+             sp = & sp;
+         }
++        else version(LDC)
++        {
++            version(X86)
++            {
++                uint eax,ecx,edx,ebx,ebp,esi,edi;
++                asm
++                {
++                    mov eax[EBP], EAX      ;
++                    mov ecx[EBP], ECX      ;
++                    mov edx[EBP], EDX      ;
++                    mov ebx[EBP], EBX      ;
++                    mov ebp[EBP], EBP      ;
++                    mov esi[EBP], ESI      ;
++                    mov edi[EBP], EDI      ;
++                    mov sp[EBP],ESP     ;
++                }
++            }
++            else
++            {
++                static assert( false, "Architecture not supported." );
++            }
++        }
+         else
+         {
+         asm
+@@ -2191,6 +2213,10 @@
+         {
+             // nothing to do
+         }
++        else version(LDC)
++        {
++            // nothing to do
++        }
+         else
+         {
+         asm
+Index: lib/gc/basic/gcbits.d
+===================================================================
+--- lib/gc/basic/gcbits.d	(revision 3954)
++++ lib/gc/basic/gcbits.d	(working copy)
+@@ -39,6 +39,10 @@
+ {
+     // use the unoptimized version
+ }
++else version(LDC)
++{
++    // ditto
++}
+ else version (D_InlineAsm_X86)
+ {
+     version = Asm86;
+Index: tango/text/convert/Layout.d
+===================================================================
+--- tango/text/convert/Layout.d	(revision 3954)
++++ tango/text/convert/Layout.d	(working copy)
+@@ -47,6 +47,12 @@
+         alias void* Arg;
+         alias va_list ArgList;
+         }
++else version(LDC)
++        {
++        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 (LDC)
+                         {
+                         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 3954)
++++ tango/core/Vararg.d	(working copy)
+@@ -15,6 +15,10 @@
+ {
+     public import std.stdarg;
+ }
++else version( LDC )
++{
++    public import ldc.vararg;
++}
+ else
+ {
+     /**
+Index: tango/core/Atomic.d
+===================================================================
+--- tango/core/Atomic.d	(revision 3954)
++++ tango/core/Atomic.d	(working copy)
+@@ -270,6 +270,167 @@
+ 
+ 
+ ////////////////////////////////////////////////////////////////////////////////
++// LDC Atomics Implementation
++////////////////////////////////////////////////////////////////////////////////
++
++
++else version( LDC )
++{
++    import ldc.intrinsics;
++
++
++    ////////////////////////////////////////////////////////////////////////////
++    // Atomic Load
++    ////////////////////////////////////////////////////////////////////////////
++
++
++    template atomicLoad( msync ms = msync.seq, T )
++    {
++        T atomicLoad(ref T val)
++        {
++            llvm_memory_barrier(
++                ms == msync.hlb || ms == msync.acq || ms == msync.seq,
++                ms == msync.hsb || ms == msync.acq || ms == msync.seq,
++                ms == msync.slb || ms == msync.rel || ms == msync.seq,
++                ms == msync.ssb || ms == msync.rel || ms == msync.seq,
++                false);
++            static if (isPointerType!(T))
++            {
++                return cast(T)llvm_atomic_load_add!(size_t)(cast(size_t*)&val, 0);
++            }
++            else static if (is(T == bool))
++            {
++                return llvm_atomic_load_add!(ubyte)(cast(ubyte*)&val, cast(ubyte)0) ? 1 : 0;
++            }
++            else
++            {
++                return llvm_atomic_load_add!(T)(&val, cast(T)0);
++            }
++        }
++    }
++
++
++    ////////////////////////////////////////////////////////////////////////////
++    // Atomic Store
++    ////////////////////////////////////////////////////////////////////////////
++
++
++    template atomicStore( msync ms = msync.seq, T )
++    {
++        void atomicStore( ref T val, T newval )
++        {
++            llvm_memory_barrier(
++                ms == msync.hlb || ms == msync.acq || ms == msync.seq,
++                ms == msync.hsb || ms == msync.acq || ms == msync.seq,
++                ms == msync.slb || ms == msync.rel || ms == msync.seq,
++                ms == msync.ssb || ms == msync.rel || ms == msync.seq,
++                false);
++            static if (isPointerType!(T))
++            {
++                llvm_atomic_swap!(size_t)(cast(size_t*)&val, cast(size_t)newval);
++            }
++            else static if (is(T == bool))
++            {
++                llvm_atomic_swap!(ubyte)(cast(ubyte*)&val, newval?1:0);
++            }
++            else
++            {
++                llvm_atomic_swap!(T)(&val, newval);
++            }
++        }
++    }
++
++
++    ////////////////////////////////////////////////////////////////////////////
++    // Atomic Store If
++    ////////////////////////////////////////////////////////////////////////////
++
++
++    template atomicStoreIf( msync ms = msync.seq, T )
++    {
++        bool atomicStoreIf( ref T val, T newval, T equalTo )
++        {
++            llvm_memory_barrier(
++                ms == msync.hlb || ms == msync.acq || ms == msync.seq,
++                ms == msync.hsb || ms == msync.acq || ms == msync.seq,
++                ms == msync.slb || ms == msync.rel || ms == msync.seq,
++                ms == msync.ssb || ms == msync.rel || ms == msync.seq,
++                false);
++            T oldval = void;
++            static if (isPointerType!(T))
++            {
++                oldval = cast(T)llvm_atomic_cmp_swap!(size_t)(cast(size_t*)&val, cast(size_t)equalTo, cast(size_t)newval);
++            }
++            else static if (is(T == bool))
++            {
++                oldval = llvm_atomic_cmp_swap!(ubyte)(cast(ubyte*)&val, equalTo?1:0, newval?1:0)?0:1;
++            }
++            else
++            {
++                oldval = llvm_atomic_cmp_swap!(T)(&val, equalTo, newval);
++            }
++            return oldval == equalTo;
++        }
++    }
++    
++    
++    ////////////////////////////////////////////////////////////////////////////
++    // Atomic Increment
++    ////////////////////////////////////////////////////////////////////////////
++
++
++    template atomicIncrement( msync ms = msync.seq, T )
++    {
++        //
++        // NOTE: This operation is only valid for integer or pointer types
++        //
++        static assert( isValidNumericType!(T) );
++
++
++        T atomicIncrement( ref T val )
++        {
++            static if (isPointerType!(T))
++            {
++                llvm_atomic_load_add!(size_t)(cast(size_t*)&val, 1);
++            }
++            else
++            {
++                llvm_atomic_load_add!(T)(&val, cast(T)1);
++            }
++            return val;
++        }
++    }
++    
++    
++    ////////////////////////////////////////////////////////////////////////////
++    // Atomic Decrement
++    ////////////////////////////////////////////////////////////////////////////
++
++
++    template atomicDecrement( msync ms = msync.seq, T )
++    {
++        //
++        // NOTE: This operation is only valid for integer or pointer types
++        //
++        static assert( isValidNumericType!(T) );
++
++
++        T atomicDecrement( ref T val )
++        {
++            static if (isPointerType!(T))
++            {
++                llvm_atomic_load_sub!(size_t)(cast(size_t*)&val, 1);
++            }
++            else
++            {
++                llvm_atomic_load_sub!(T)(&val, cast(T)1);
++            }
++            return val;
++        }
++    }
++}
++
++////////////////////////////////////////////////////////////////////////////////
+ // x86 Atomic Function Implementation
+ ////////////////////////////////////////////////////////////////////////////////
+ 
+Index: tango/math/Math.d
+===================================================================
+--- tango/math/Math.d	(revision 3954)
++++ tango/math/Math.d	(working copy)
+@@ -76,6 +76,14 @@
+         version = DigitalMars_D_InlineAsm_X86;
+     }
+ }
++else version(LDC)
++{
++    import ldc.intrinsics;
++    version(X86)
++    {
++        version = LDC_X86;
++    }
++}
+ 
+ /*
+  * Constants
+@@ -298,6 +306,24 @@
+  * Bugs:
+  *  Results are undefined if |x| >= $(POWER 2,64).
+  */
++version(LDC)
++{
++    alias llvm_cos_f32 cos;
++    alias llvm_cos_f64 cos;
++    version(X86)
++    {
++        alias llvm_cos_f80 cos;
++    }
++    else
++    {
++        real cos(real x)
++        {
++            return tango.stdc.math.cosl(x);
++        }
++    }
++}
++else
++{
+ real cos(real x) /* intrinsic */
+ {
+     version(D_InlineAsm_X86)
+@@ -313,6 +339,7 @@
+         return tango.stdc.math.cosl(x);
+     }
+ }
++}
+ 
+ debug(UnitTest) {
+ unittest {
+@@ -333,6 +360,24 @@
+  * Bugs:
+  *  Results are undefined if |x| >= $(POWER 2,64).
+  */
++version(LDC)
++{
++    alias llvm_sin_f32 sin;
++    alias llvm_sin_f64 sin;
++    version(X86)
++    {
++        alias llvm_sin_f80 sin;
++    }
++    else
++    {
++        real sin(real x)
++        {
++            return tango.stdc.math.sinl(x);
++        }
++    }
++}
++else
++{
+ real sin(real x) /* intrinsic */
+ {
+     version(D_InlineAsm_X86)
+@@ -348,6 +393,7 @@
+         return tango.stdc.math.sinl(x);
+     }
+ }
++}
+ 
+ debug(UnitTest) {
+ unittest {
+@@ -374,7 +420,11 @@
+ {
+     version (GNU) {
+         return tanl(x);
+-    } else {
++    }
++    else version(LDC) {
++        return tango.stdc.math.tanl(x);
++    }
++    else {
+     asm
+     {
+         fld x[EBP]      ; // load theta
+@@ -947,6 +997,25 @@
+  *  <tr> <td> +&infin; <td> +&infin; <td> no
+  *  )
+  */
++version(LDC)
++{
++    alias llvm_sqrt_f32 sqrt;
++    alias llvm_sqrt_f64 sqrt;
++    version(X86)
++    {
++        alias llvm_sqrt_f80 sqrt;
++    }
++    else
++    {
++        real sqrt(real x)
++        {
++            return tango.stdc.math.sqrtl(x);
++        }
++    }
++}
++else
++{
++
+ float sqrt(float x) /* intrinsic */
+ {
+     version(D_InlineAsm_X86)
+@@ -995,6 +1064,8 @@
+     }
+ }
+ 
++}
++
+ /** ditto */
+ creal sqrt(creal z)
+ {
+@@ -1477,7 +1548,14 @@
+         }
+     }
+     }
+-    return tango.stdc.math.powl(x, y);
++    version(LDC_X86)
++    {
++        return llvm_pow_f80(x, y);
++    }
++    else
++    {
++        return tango.stdc.math.powl(x, y);
++    }
+ }
+ 
+ debug(UnitTest) {
+Index: tango/stdc/stdlib.d
+===================================================================
+--- tango/stdc/stdlib.d	(revision 3954)
++++ tango/stdc/stdlib.d	(working copy)
+@@ -94,6 +94,11 @@
+ {
+     void* alloca(size_t size);
+ }
++else version( LDC )
++{
++    pragma(alloca)
++        void* alloca(size_t size);
++}
+ else version( GNU )
+ {
+     private import gcc.builtins;
+Index: tango/stdc/stdarg.d
+===================================================================
+--- tango/stdc/stdarg.d	(revision 3954)
++++ tango/stdc/stdarg.d	(working copy)
+@@ -13,6 +13,10 @@
+ {
+     public import std.c.stdarg;
+ }
++else version( LDC )
++{
++    public import ldc.cstdarg;
++}
+ else
+ {
+     alias void* va_list;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/lib/common/tango/ldc.mak	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,173 @@
+# Makefile to build the common D runtime library for LLVM
+# Designed to work with GNU make
+# Targets:
+#	make
+#		Same as make all
+#	make lib
+#		Build the common library
+#   make doc
+#       Generate documentation
+#	make clean
+#		Delete unneeded files created by build process
+
+LIB_TARGET_FULL=libtango-cc-tango.a
+LIB_TARGET_BC_ONLY=libtango-cc-tango-bc-only.a
+LIB_TARGET_C_ONLY=libtango-cc-tango-c-only.a
+LIB_TARGET_SHARED=libtango-cc-tango-shared.so
+LIB_MASK=libtango-cc-tango*.*
+
+CP=cp -f
+RM=rm -f
+MD=mkdir -p
+
+ADD_CFLAGS=
+ADD_DFLAGS=
+
+#CFLAGS=-O3 $(ADD_CFLAGS)
+CFLAGS=$(ADD_CFLAGS)
+
+#DFLAGS=-release -O3 -inline -w $(ADD_DFLAGS)
+DFLAGS=-w $(ADD_DFLAGS)
+
+#TFLAGS=-O3 -inline -w $(ADD_DFLAGS)
+TFLAGS=-w $(ADD_DFLAGS)
+
+DOCFLAGS=-version=DDoc
+
+CC=gcc
+LC=llvm-ar rsv
+LLINK=llvm-link
+LCC=llc
+CLC=ar rsv
+DC=ldc
+LLC=llvm-as
+
+INC_DEST=../../../tango
+LIB_DEST=..
+DOC_DEST=../../../doc/tango
+
+.SUFFIXES: .s .S .c .cpp .d .ll .html .o .bc
+
+.s.o:
+	$(CC) -c $(CFLAGS) $< -o$@
+
+.S.o:
+	$(CC) -c $(CFLAGS) $< -o$@
+
+.c.o:
+	$(CC) -c $(CFLAGS) $< -o$@
+
+.cpp.o:
+	g++ -c $(CFLAGS) $< -o$@
+
+.d.bc:
+	$(DC) -c $(DFLAGS) -Hf$*.di $< -of$@
+#	$(DC) -c $(DFLAGS) $< -of$@
+
+.ll.bc:
+	$(LLC) -f -o=$@ $<
+
+.d.html:
+	$(DC) -c -o- $(DOCFLAGS) -Df$*.html $<
+#	$(DC) -c -o- $(DOCFLAGS) -Df$*.html tango.ddoc $<
+
+targets : lib sharedlib doc
+all     : lib sharedlib doc
+tango   : lib
+lib     : tango.lib tango.bclib tango.clib
+sharedlib : tango.sharedlib
+doc     : tango.doc
+
+######################################################
+
+OBJ_CORE= \
+    core/BitManip.bc \
+    core/Exception.bc \
+    core/Memory.bc \
+    core/Runtime.bc \
+    core/Thread.bc
+#    core/ThreadASM.o
+
+OBJ_STDC= \
+    stdc/wrap.o
+#    stdc/wrap.bc
+
+OBJ_STDC_POSIX= \
+    stdc/posix/pthread_darwin.o
+
+ALL_OBJS= \
+    $(OBJ_CORE)
+#    $(OBJ_STDC)
+#    $(OBJ_STDC_POSIX)
+
+######################################################
+
+DOC_CORE= \
+    core/BitManip.html \
+    core/Exception.html \
+    core/Memory.html \
+    core/Runtime.html \
+    core/Thread.html
+
+
+ALL_DOCS=
+
+######################################################
+
+tango.bclib : $(LIB_TARGET_BC_ONLY)
+tango.lib : $(LIB_TARGET_FULL)
+tango.clib : $(LIB_TARGET_C_ONLY)
+tango.sharedlib : $(LIB_TARGET_SHARED)
+
+$(LIB_TARGET_BC_ONLY) : $(ALL_OBJS)
+	$(RM) $@
+	$(LC) $@ $(ALL_OBJS)
+
+
+$(LIB_TARGET_FULL) : $(ALL_OBJS) $(OBJ_STDC)
+	$(RM) $@ $@.bc $@.s $@.o
+	$(LLINK) -o=$@.bc $(ALL_OBJS)
+	$(LCC) -o=$@.s $@.bc
+	$(CC) -c -o $@.o $@.s
+	$(CLC) $@ $@.o $(OBJ_STDC)
+
+
+$(LIB_TARGET_C_ONLY) : $(OBJ_STDC)
+	$(RM) $@
+	$(CLC) $@ $(OBJ_STDC)
+
+
+$(LIB_TARGET_SHARED) : $(ALL_OBJS) $(OBJ_STDC)
+	$(RM) $@ $@.bc $@.s $@.o
+	$(LLINK) -o=$@.bc $(ALL_OBJS)
+	$(LCC) -relocation-model=pic -o=$@.s $@.bc
+	$(CC) -c -o $@.o $@.s
+	$(CC) -shared -o $@ $@.o $(OBJ_STDC)
+
+
+tango.doc : $(ALL_DOCS)
+	echo Documentation generated.
+
+######################################################
+
+### stdc/posix
+
+#stdc/posix/pthread_darwin.o : stdc/posix/pthread_darwin.d
+#	$(DC) -c $(DFLAGS) stdc/posix/pthread_darwin.d -of$@
+
+######################################################
+
+clean :
+	find . -name "*.di" | xargs $(RM)
+	$(RM) $(ALL_OBJS)
+	$(RM) $(OBJ_STDC)
+	$(RM) $(ALL_DOCS)
+	find . -name "$(LIB_MASK)" | xargs $(RM)
+
+install :
+	$(MD) $(INC_DEST)
+	find . -name "*.di" -exec cp -f {} $(INC_DEST)/{} \;
+	$(MD) $(DOC_DEST)
+	find . -name "*.html" -exec cp -f {} $(DOC_DEST)/{} \;
+	$(MD) $(LIB_DEST)
+	find . -name "$(LIB_MASK)" -exec cp -f {} $(LIB_DEST)/{} \;
--- a/runtime/lib/common/tango/llvmdc.mak	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-# Makefile to build the common D runtime library for LLVM
-# Designed to work with GNU make
-# Targets:
-#	make
-#		Same as make all
-#	make lib
-#		Build the common library
-#   make doc
-#       Generate documentation
-#	make clean
-#		Delete unneeded files created by build process
-
-LIB_TARGET_FULL=libtango-cc-tango.a
-LIB_TARGET_BC_ONLY=libtango-cc-tango-bc-only.a
-LIB_TARGET_C_ONLY=libtango-cc-tango-c-only.a
-LIB_TARGET_SHARED=libtango-cc-tango-shared.so
-LIB_MASK=libtango-cc-tango*.*
-
-CP=cp -f
-RM=rm -f
-MD=mkdir -p
-
-ADD_CFLAGS=
-ADD_DFLAGS=
-
-#CFLAGS=-O3 $(ADD_CFLAGS)
-CFLAGS=$(ADD_CFLAGS)
-
-#DFLAGS=-release -O3 -inline -w $(ADD_DFLAGS)
-DFLAGS=-w $(ADD_DFLAGS)
-
-#TFLAGS=-O3 -inline -w $(ADD_DFLAGS)
-TFLAGS=-w $(ADD_DFLAGS)
-
-DOCFLAGS=-version=DDoc
-
-CC=gcc
-LC=llvm-ar rsv
-LLINK=llvm-link
-LCC=llc
-CLC=ar rsv
-DC=ldc
-LLC=llvm-as
-
-INC_DEST=../../../tango
-LIB_DEST=..
-DOC_DEST=../../../doc/tango
-
-.SUFFIXES: .s .S .c .cpp .d .ll .html .o .bc
-
-.s.o:
-	$(CC) -c $(CFLAGS) $< -o$@
-
-.S.o:
-	$(CC) -c $(CFLAGS) $< -o$@
-
-.c.o:
-	$(CC) -c $(CFLAGS) $< -o$@
-
-.cpp.o:
-	g++ -c $(CFLAGS) $< -o$@
-
-.d.bc:
-	$(DC) -c $(DFLAGS) -Hf$*.di $< -of$@
-#	$(DC) -c $(DFLAGS) $< -of$@
-
-.ll.bc:
-	$(LLC) -f -o=$@ $<
-
-.d.html:
-	$(DC) -c -o- $(DOCFLAGS) -Df$*.html $<
-#	$(DC) -c -o- $(DOCFLAGS) -Df$*.html tango.ddoc $<
-
-targets : lib sharedlib doc
-all     : lib sharedlib doc
-tango   : lib
-lib     : tango.lib tango.bclib tango.clib
-sharedlib : tango.sharedlib
-doc     : tango.doc
-
-######################################################
-
-OBJ_CORE= \
-    core/BitManip.bc \
-    core/Exception.bc \
-    core/Memory.bc \
-    core/Runtime.bc \
-    core/Thread.bc
-#    core/ThreadASM.o
-
-OBJ_STDC= \
-    stdc/wrap.o
-#    stdc/wrap.bc
-
-OBJ_STDC_POSIX= \
-    stdc/posix/pthread_darwin.o
-
-ALL_OBJS= \
-    $(OBJ_CORE)
-#    $(OBJ_STDC)
-#    $(OBJ_STDC_POSIX)
-
-######################################################
-
-DOC_CORE= \
-    core/BitManip.html \
-    core/Exception.html \
-    core/Memory.html \
-    core/Runtime.html \
-    core/Thread.html
-
-
-ALL_DOCS=
-
-######################################################
-
-tango.bclib : $(LIB_TARGET_BC_ONLY)
-tango.lib : $(LIB_TARGET_FULL)
-tango.clib : $(LIB_TARGET_C_ONLY)
-tango.sharedlib : $(LIB_TARGET_SHARED)
-
-$(LIB_TARGET_BC_ONLY) : $(ALL_OBJS)
-	$(RM) $@
-	$(LC) $@ $(ALL_OBJS)
-
-
-$(LIB_TARGET_FULL) : $(ALL_OBJS) $(OBJ_STDC)
-	$(RM) $@ $@.bc $@.s $@.o
-	$(LLINK) -o=$@.bc $(ALL_OBJS)
-	$(LCC) -o=$@.s $@.bc
-	$(CC) -c -o $@.o $@.s
-	$(CLC) $@ $@.o $(OBJ_STDC)
-
-
-$(LIB_TARGET_C_ONLY) : $(OBJ_STDC)
-	$(RM) $@
-	$(CLC) $@ $(OBJ_STDC)
-
-
-$(LIB_TARGET_SHARED) : $(ALL_OBJS) $(OBJ_STDC)
-	$(RM) $@ $@.bc $@.s $@.o
-	$(LLINK) -o=$@.bc $(ALL_OBJS)
-	$(LCC) -relocation-model=pic -o=$@.s $@.bc
-	$(CC) -c -o $@.o $@.s
-	$(CC) -shared -o $@ $@.o $(OBJ_STDC)
-
-
-tango.doc : $(ALL_DOCS)
-	echo Documentation generated.
-
-######################################################
-
-### stdc/posix
-
-#stdc/posix/pthread_darwin.o : stdc/posix/pthread_darwin.d
-#	$(DC) -c $(DFLAGS) stdc/posix/pthread_darwin.d -of$@
-
-######################################################
-
-clean :
-	find . -name "*.di" | xargs $(RM)
-	$(RM) $(ALL_OBJS)
-	$(RM) $(OBJ_STDC)
-	$(RM) $(ALL_DOCS)
-	find . -name "$(LIB_MASK)" | xargs $(RM)
-
-install :
-	$(MD) $(INC_DEST)
-	find . -name "*.di" -exec cp -f {} $(INC_DEST)/{} \;
-	$(MD) $(DOC_DEST)
-	find . -name "*.html" -exec cp -f {} $(DOC_DEST)/{} \;
-	$(MD) $(LIB_DEST)
-	find . -name "$(LIB_MASK)" -exec cp -f {} $(LIB_DEST)/{} \;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/lib/gc/basic/ldc.mak	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,124 @@
+# Makefile to build the garbage collector D library for LDC
+# Designed to work with GNU make
+# Targets:
+#	make
+#		Same as make all
+#	make lib
+#		Build the garbage collector library
+#   make doc
+#       Generate documentation
+#	make clean
+#		Delete unneeded files created by build process
+
+LIB_TARGET_BC=libtango-gc-basic-bc.a
+LIB_TARGET_NATIVE=libtango-gc-basic.a
+LIB_TARGET_SHARED=libtango-gc-basic-shared.so
+LIB_MASK=libtango-gc-basic*.*
+
+CP=cp -f
+RM=rm -f
+MD=mkdir -p
+
+ADD_CFLAGS=
+ADD_DFLAGS=
+
+#CFLAGS=-O3 $(ADD_CFLAGS)
+CFLAGS=$(ADD_CFLAGS)
+
+#DFLAGS=-release -O3 -inline -w -nofloat $(ADD_DFLAGS)
+DFLAGS=-w -disable-invariants $(ADD_DFLAGS)
+
+#TFLAGS=-O3 -inline -w -nofloat $(ADD_DFLAGS)
+TFLAGS=-w -disable-invariants $(ADD_DFLAGS)
+
+DOCFLAGS=-version=DDoc
+
+CC=gcc
+LC=llvm-ar rsv
+LCC=llc
+LLINK=llvm-link
+CLC=ar rsv
+LD=llvm-ld
+DC=ldc
+
+LIB_DEST=..
+
+.SUFFIXES: .s .S .c .cpp .d .html .o .bc
+
+.s.o:
+	$(CC) -c $(CFLAGS) $< -o$@
+
+.S.o:
+	$(CC) -c $(CFLAGS) $< -o$@
+
+.c.o:
+	$(CC) -c $(CFLAGS) $< -o$@
+
+.cpp.o:
+	g++ -c $(CFLAGS) $< -o$@
+
+.d.bc:
+	$(DC) -c $(DFLAGS) $< -of$@
+
+.d.html:
+	$(DC) -c -o- $(DOCFLAGS) -Df$*.html $<
+#	$(DC) -c -o- $(DOCFLAGS) -Df$*.html dmd.ddoc $<
+
+targets : lib sharedlib doc
+all     : lib sharedlib doc
+lib     : basic.lib basic.nlib
+sharedlib : basic.sharedlib
+doc     : basic.doc
+
+######################################################
+
+ALL_OBJS= \
+    gc.bc \
+    gcalloc.bc \
+    gcbits.bc \
+    gcstats.bc \
+    gcx.bc
+
+######################################################
+
+ALL_DOCS=
+
+######################################################
+
+basic.lib : $(LIB_TARGET_BC)
+basic.nlib : $(LIB_TARGET_NATIVE)
+basic.sharedlib : $(LIB_TARGET_SHARED)
+
+$(LIB_TARGET_BC) : $(ALL_OBJS)
+	$(RM) $@
+	$(LC) $@ $(ALL_OBJS)
+
+
+$(LIB_TARGET_NATIVE) : $(ALL_OBJS)
+	$(RM) $@ $@.bc $@.s $@.o
+	$(LLINK) -o=$@.bc $(ALL_OBJS)
+	$(LCC) -o=$@.s $@.bc
+	$(CC) -c -o $@.o $@.s
+	$(CLC) $@ $@.o
+
+
+$(LIB_TARGET_SHARED) : $(ALL_OBJS)
+	$(RM) $@ $@.bc $@.s $@.o
+	$(LLINK) -o=$@.bc $(ALL_OBJS)
+	$(LCC) -relocation-model=pic -o=$@.s $@.bc
+	$(CC) -shared -o $@ $@.s
+
+basic.doc : $(ALL_DOCS)
+	echo No documentation available.
+
+######################################################
+
+clean :
+	find . -name "*.di" | xargs $(RM)
+	$(RM) $(ALL_OBJS)
+	$(RM) $(ALL_DOCS)
+	$(RM) $(LIB_MASK)
+
+install :
+	$(MD) $(LIB_DEST)
+	$(CP) $(LIB_MASK) $(LIB_DEST)/.
--- a/runtime/lib/gc/basic/llvmdc.mak	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-# Makefile to build the garbage collector D library for LDC
-# Designed to work with GNU make
-# Targets:
-#	make
-#		Same as make all
-#	make lib
-#		Build the garbage collector library
-#   make doc
-#       Generate documentation
-#	make clean
-#		Delete unneeded files created by build process
-
-LIB_TARGET_BC=libtango-gc-basic-bc.a
-LIB_TARGET_NATIVE=libtango-gc-basic.a
-LIB_TARGET_SHARED=libtango-gc-basic-shared.so
-LIB_MASK=libtango-gc-basic*.*
-
-CP=cp -f
-RM=rm -f
-MD=mkdir -p
-
-ADD_CFLAGS=
-ADD_DFLAGS=
-
-#CFLAGS=-O3 $(ADD_CFLAGS)
-CFLAGS=$(ADD_CFLAGS)
-
-#DFLAGS=-release -O3 -inline -w -nofloat $(ADD_DFLAGS)
-DFLAGS=-w -disable-invariants $(ADD_DFLAGS)
-
-#TFLAGS=-O3 -inline -w -nofloat $(ADD_DFLAGS)
-TFLAGS=-w -disable-invariants $(ADD_DFLAGS)
-
-DOCFLAGS=-version=DDoc
-
-CC=gcc
-LC=llvm-ar rsv
-LCC=llc
-LLINK=llvm-link
-CLC=ar rsv
-LD=llvm-ld
-DC=ldc
-
-LIB_DEST=..
-
-.SUFFIXES: .s .S .c .cpp .d .html .o .bc
-
-.s.o:
-	$(CC) -c $(CFLAGS) $< -o$@
-
-.S.o:
-	$(CC) -c $(CFLAGS) $< -o$@
-
-.c.o:
-	$(CC) -c $(CFLAGS) $< -o$@
-
-.cpp.o:
-	g++ -c $(CFLAGS) $< -o$@
-
-.d.bc:
-	$(DC) -c $(DFLAGS) $< -of$@
-
-.d.html:
-	$(DC) -c -o- $(DOCFLAGS) -Df$*.html $<
-#	$(DC) -c -o- $(DOCFLAGS) -Df$*.html dmd.ddoc $<
-
-targets : lib sharedlib doc
-all     : lib sharedlib doc
-lib     : basic.lib basic.nlib
-sharedlib : basic.sharedlib
-doc     : basic.doc
-
-######################################################
-
-ALL_OBJS= \
-    gc.bc \
-    gcalloc.bc \
-    gcbits.bc \
-    gcstats.bc \
-    gcx.bc
-
-######################################################
-
-ALL_DOCS=
-
-######################################################
-
-basic.lib : $(LIB_TARGET_BC)
-basic.nlib : $(LIB_TARGET_NATIVE)
-basic.sharedlib : $(LIB_TARGET_SHARED)
-
-$(LIB_TARGET_BC) : $(ALL_OBJS)
-	$(RM) $@
-	$(LC) $@ $(ALL_OBJS)
-
-
-$(LIB_TARGET_NATIVE) : $(ALL_OBJS)
-	$(RM) $@ $@.bc $@.s $@.o
-	$(LLINK) -o=$@.bc $(ALL_OBJS)
-	$(LCC) -o=$@.s $@.bc
-	$(CC) -c -o $@.o $@.s
-	$(CLC) $@ $@.o
-
-
-$(LIB_TARGET_SHARED) : $(ALL_OBJS)
-	$(RM) $@ $@.bc $@.s $@.o
-	$(LLINK) -o=$@.bc $(ALL_OBJS)
-	$(LCC) -relocation-model=pic -o=$@.s $@.bc
-	$(CC) -shared -o $@ $@.s
-
-basic.doc : $(ALL_DOCS)
-	echo No documentation available.
-
-######################################################
-
-clean :
-	find . -name "*.di" | xargs $(RM)
-	$(RM) $(ALL_OBJS)
-	$(RM) $(ALL_DOCS)
-	$(RM) $(LIB_MASK)
-
-install :
-	$(MD) $(LIB_DEST)
-	$(CP) $(LIB_MASK) $(LIB_DEST)/.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/lib/gc/stub/ldc.mak	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,96 @@
+# Makefile to build the garbage collector D library for Posix
+# Designed to work with GNU make
+# Targets:
+#	make
+#		Same as make all
+#	make lib
+#		Build the garbage collector library
+#   make doc
+#       Generate documentation
+#	make clean
+#		Delete unneeded files created by build process
+
+LIB_TARGET=libtango-gc-stub.a
+LIB_MASK=libtango-gc-stub*.a
+
+CP=cp -f
+RM=rm -f
+MD=mkdir -p
+
+ADD_CFLAGS=
+ADD_DFLAGS=
+
+#CFLAGS=-O3 $(ADD_CFLAGS)
+CFLAGS=$(ADD_CFLAGS)
+
+#DFLAGS=-release -O3 -inline -w $(ADD_DFLAGS)
+DFLAGS=$(ADD_DFLAGS)
+
+#TFLAGS=-O3 -inline $(ADD_DFLAGS)
+TFLAGS=$(ADD_DFLAGS)
+
+DOCFLAGS=-version=DDoc
+
+CC=gcc
+LC=llvm-ar rsv
+DC=ldc
+
+LIB_DEST=..
+
+.SUFFIXES: .s .S .c .cpp .d .html .o .bc
+
+.s.o:
+	$(CC) -c $(CFLAGS) $< -o$@
+
+.S.o:
+	$(CC) -c $(CFLAGS) $< -o$@
+
+.c.o:
+	$(CC) -c $(CFLAGS) $< -o$@
+
+.cpp.o:
+	g++ -c $(CFLAGS) $< -o$@
+
+.d.bc:
+	$(DC) -c $(DFLAGS) $< -of$@
+
+.d.html:
+	$(DC) -c -o- $(DOCFLAGS) -Df$*.html $<
+#	$(DC) -c -o- $(DOCFLAGS) -Df$*.html dmd.ddoc $<
+
+targets : lib doc
+all     : lib doc
+lib     : stub.lib
+doc     : stub.doc
+
+######################################################
+
+ALL_OBJS= \
+    gc.bc
+
+######################################################
+
+ALL_DOCS=
+
+######################################################
+
+stub.lib : $(LIB_TARGET)
+
+$(LIB_TARGET) : $(ALL_OBJS)
+	$(RM) $@
+	$(LC) $@ $(ALL_OBJS)
+
+stub.doc : $(ALL_DOCS)
+	echo No documentation available.
+
+######################################################
+
+clean :
+	find . -name "*.di" | xargs $(RM)
+	$(RM) $(ALL_OBJS)
+	$(RM) $(ALL_DOCS)
+	$(RM) $(LIB_MASK)
+
+install :
+	$(MD) $(LIB_DEST)
+	$(CP) $(LIB_MASK) $(LIB_DEST)/.
--- a/runtime/lib/gc/stub/llvmdc.mak	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-# Makefile to build the garbage collector D library for Posix
-# Designed to work with GNU make
-# Targets:
-#	make
-#		Same as make all
-#	make lib
-#		Build the garbage collector library
-#   make doc
-#       Generate documentation
-#	make clean
-#		Delete unneeded files created by build process
-
-LIB_TARGET=libtango-gc-stub.a
-LIB_MASK=libtango-gc-stub*.a
-
-CP=cp -f
-RM=rm -f
-MD=mkdir -p
-
-ADD_CFLAGS=
-ADD_DFLAGS=
-
-#CFLAGS=-O3 $(ADD_CFLAGS)
-CFLAGS=$(ADD_CFLAGS)
-
-#DFLAGS=-release -O3 -inline -w $(ADD_DFLAGS)
-DFLAGS=$(ADD_DFLAGS)
-
-#TFLAGS=-O3 -inline $(ADD_DFLAGS)
-TFLAGS=$(ADD_DFLAGS)
-
-DOCFLAGS=-version=DDoc
-
-CC=gcc
-LC=llvm-ar rsv
-DC=ldc
-
-LIB_DEST=..
-
-.SUFFIXES: .s .S .c .cpp .d .html .o .bc
-
-.s.o:
-	$(CC) -c $(CFLAGS) $< -o$@
-
-.S.o:
-	$(CC) -c $(CFLAGS) $< -o$@
-
-.c.o:
-	$(CC) -c $(CFLAGS) $< -o$@
-
-.cpp.o:
-	g++ -c $(CFLAGS) $< -o$@
-
-.d.bc:
-	$(DC) -c $(DFLAGS) $< -of$@
-
-.d.html:
-	$(DC) -c -o- $(DOCFLAGS) -Df$*.html $<
-#	$(DC) -c -o- $(DOCFLAGS) -Df$*.html dmd.ddoc $<
-
-targets : lib doc
-all     : lib doc
-lib     : stub.lib
-doc     : stub.doc
-
-######################################################
-
-ALL_OBJS= \
-    gc.bc
-
-######################################################
-
-ALL_DOCS=
-
-######################################################
-
-stub.lib : $(LIB_TARGET)
-
-$(LIB_TARGET) : $(ALL_OBJS)
-	$(RM) $@
-	$(LC) $@ $(ALL_OBJS)
-
-stub.doc : $(ALL_DOCS)
-	echo No documentation available.
-
-######################################################
-
-clean :
-	find . -name "*.di" | xargs $(RM)
-	$(RM) $(ALL_OBJS)
-	$(RM) $(ALL_DOCS)
-	$(RM) $(LIB_MASK)
-
-install :
-	$(MD) $(LIB_DEST)
-	$(CP) $(LIB_MASK) $(LIB_DEST)/.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/runtime/lib/ldc-posix.mak	Mon Oct 06 22:56:54 2008 +0200
@@ -0,0 +1,88 @@
+# Makefile to build the composite D runtime library for Linux
+# Designed to work with GNU make
+# Targets:
+#	make
+#		Same as make all
+#	make lib
+#		Build the runtime library
+#   make doc
+#       Generate documentation
+#	make clean
+#		Delete unneeded files created by build process
+
+LIB_TARGET=libtango-base-ldc.a
+LIB_MASK=libtango-base-ldc*.a
+LIB_TARGET_C=libtango-base-c-ldc.a
+LIB_MASK_C=libtango-base-c-ldc*.a
+LIB_NAME_NATIVE=libtango-base-ldc-native
+LIB_TARGET_NATIVE=$(LIB_NAME_NATIVE).a
+
+DIR_CC=./common/tango
+DIR_RT=../../runtime/internal
+DIR_GC=./gc/basic
+#DIR_GC=./gc/stub
+
+CP=cp -f
+RM=rm -f
+MD=mkdir -p
+
+CC=gcc
+LC=llvm-ar rsv
+CLC=ar rsv
+DC=ldc
+LLVMLINK=llvm-link
+LLC=llc
+
+ADD_CFLAGS=
+#ADD_DFLAGS=
+ADD_DFLAGS=-I`pwd`/common/
+
+targets : lib sharedlib doc
+all     : lib sharedlib doc
+
+######################################################
+
+ALL_OBJS=
+
+######################################################
+
+ALL_DOCS=
+
+######################################################
+
+lib : $(ALL_OBJS)
+	make -C $(DIR_CC) -fldc.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"
+	make -C $(DIR_RT) -fldc.mak lib
+	make -C $(DIR_GC) -fldc.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"
+	# could link the three parts into one here, but why should we
+
+sharedlib : $(ALL_OBJS)
+	make -C $(DIR_CC) -fldc.mak sharedlib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"
+	make -C $(DIR_RT) -fldc.mak sharedlib
+	make -C $(DIR_GC) -fldc.mak sharedlib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"
+	# could link the three parts into one here, but why should we
+
+doc : $(ALL_DOCS)
+	make -C $(DIR_CC) -fldc.mak doc
+	make -C $(DIR_RT) -fldc.mak doc
+	make -C $(DIR_GC) -fldc.mak doc
+
+######################################################
+
+clean :
+	find . -name "*.di" | xargs $(RM)
+	$(RM) $(ALL_OBJS)
+	$(RM) $(ALL_DOCS)
+	make -C $(DIR_CC) -fldc.mak clean
+	make -C $(DIR_RT) -fldc.mak clean
+	make -C $(DIR_GC) -fldc.mak clean
+	$(RM) $(LIB_MASK)
+	$(RM) $(LIB_MASK_C)
+	$(RM) $(LIB_NAME_NATIVE)*
+
+install :
+	make -C $(DIR_CC) -fldc.mak install
+	make -C $(DIR_RT) -fldc.mak install
+	make -C $(DIR_GC) -fldc.mak install
+	$(CP) $(LIB_MASK) $(LIB_DEST)/.
+	$(CP) $(LIB_MASK_C) $(LIB_DEST)/.
--- a/runtime/lib/llvmdc-posix.mak	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-# Makefile to build the composite D runtime library for Linux
-# Designed to work with GNU make
-# Targets:
-#	make
-#		Same as make all
-#	make lib
-#		Build the runtime library
-#   make doc
-#       Generate documentation
-#	make clean
-#		Delete unneeded files created by build process
-
-LIB_TARGET=libtango-base-ldc.a
-LIB_MASK=libtango-base-ldc*.a
-LIB_TARGET_C=libtango-base-c-ldc.a
-LIB_MASK_C=libtango-base-c-ldc*.a
-LIB_NAME_NATIVE=libtango-base-ldc-native
-LIB_TARGET_NATIVE=$(LIB_NAME_NATIVE).a
-
-DIR_CC=./common/tango
-DIR_RT=../../runtime/internal
-DIR_GC=./gc/basic
-#DIR_GC=./gc/stub
-
-CP=cp -f
-RM=rm -f
-MD=mkdir -p
-
-CC=gcc
-LC=llvm-ar rsv
-CLC=ar rsv
-DC=ldc
-LLVMLINK=llvm-link
-LLC=llc
-
-ADD_CFLAGS=
-#ADD_DFLAGS=
-ADD_DFLAGS=-I`pwd`/common/
-
-targets : lib sharedlib doc
-all     : lib sharedlib doc
-
-######################################################
-
-ALL_OBJS=
-
-######################################################
-
-ALL_DOCS=
-
-######################################################
-
-lib : $(ALL_OBJS)
-	make -C $(DIR_CC) -fldc.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"
-	make -C $(DIR_RT) -fldc.mak lib
-	make -C $(DIR_GC) -fldc.mak lib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"
-	# could link the three parts into one here, but why should we
-
-sharedlib : $(ALL_OBJS)
-	make -C $(DIR_CC) -fldc.mak sharedlib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"
-	make -C $(DIR_RT) -fldc.mak sharedlib
-	make -C $(DIR_GC) -fldc.mak sharedlib DC=$(DC) ADD_DFLAGS="$(ADD_DFLAGS)" ADD_CFLAGS="$(ADD_CFLAGS)"
-	# could link the three parts into one here, but why should we
-
-doc : $(ALL_DOCS)
-	make -C $(DIR_CC) -fldc.mak doc
-	make -C $(DIR_RT) -fldc.mak doc
-	make -C $(DIR_GC) -fldc.mak doc
-
-######################################################
-
-clean :
-	find . -name "*.di" | xargs $(RM)
-	$(RM) $(ALL_OBJS)
-	$(RM) $(ALL_DOCS)
-	make -C $(DIR_CC) -fldc.mak clean
-	make -C $(DIR_RT) -fldc.mak clean
-	make -C $(DIR_GC) -fldc.mak clean
-	$(RM) $(LIB_MASK)
-	$(RM) $(LIB_MASK_C)
-	$(RM) $(LIB_NAME_NATIVE)*
-
-install :
-	make -C $(DIR_CC) -fldc.mak install
-	make -C $(DIR_RT) -fldc.mak install
-	make -C $(DIR_GC) -fldc.mak install
-	$(CP) $(LIB_MASK) $(LIB_DEST)/.
-	$(CP) $(LIB_MASK_C) $(LIB_DEST)/.
--- a/runtime/llvmdc.diff	Mon Oct 06 22:54:08 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,711 +0,0 @@
-Index: object.di
-===================================================================
---- object.di	(revision 3954)
-+++ 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 3954)
-+++ lib/common/tango/core/BitManip.d	(working copy)
-@@ -171,6 +171,10 @@
-      */
-     uint outpl( uint port_address, uint value );
- }
-+else version( LDC )
-+{
-+    public import ldc.bitmanip;
-+}
- else
- {
-     public import std.intrinsic;
-Index: lib/common/tango/core/Thread.d
-===================================================================
---- lib/common/tango/core/Thread.d	(revision 3954)
-+++ lib/common/tango/core/Thread.d	(working copy)
-@@ -244,8 +244,29 @@
-         }
-         body
-         {
--            version( D_InlineAsm_X86 )
-+            version( LDC)
-             {
-+                version(X86)
-+                {
-+                    uint eax,ecx,edx,ebx,ebp,esi,edi;
-+                    asm
-+                    {
-+                        mov eax[EBP], EAX      ;
-+                        mov ecx[EBP], ECX      ;
-+                        mov edx[EBP], EDX      ;
-+                        mov ebx[EBP], EBX      ;
-+                        mov ebp[EBP], EBP      ;
-+                        mov esi[EBP], ESI      ;
-+                        mov edi[EBP], EDI      ;
-+                    }
-+                }
-+                else
-+                {
-+                    static assert( false, "Architecture not supported." );
-+                }
-+            }
-+            else version( D_InlineAsm_X86 )
-+            {
-                 asm
-                 {
-                     pushad;
-@@ -297,8 +318,12 @@
-                 }
-             }
- 
--            version( D_InlineAsm_X86 )
-+            version( LDC)
-             {
-+                // nothing to pop
-+            }
-+            else version( D_InlineAsm_X86 )
-+            {
-                 asm
-                 {
-                     popad;
-@@ -2286,6 +2311,13 @@
-             version = AsmPPC_Posix;
-     }
- 
-+    version( LLVM_InlineAsm_X86 )
-+    {
-+        version( Win32 )
-+            version = LLVM_AsmX86_Win32;
-+        else version( Posix )
-+            version = LLVM_AsmX86_Posix;
-+    }
- 
-     version( Posix )
-     {
-@@ -2296,6 +2328,8 @@
-         version( AsmX86_Win32 ) {} else
-         version( AsmX86_Posix ) {} else
-         version( AsmPPC_Posix ) {} else
-+        version( LLVM_AsmX86_Win32 ) {} else
-+        version( LLVM_AsmX86_Posix ) {} else
-         {
-             // NOTE: The ucontext implementation requires architecture specific
-             //       data definitions to operate so testing for it must be done
-@@ -2306,10 +2340,10 @@
-             import tango.stdc.posix.ucontext;
-         }
-     }
--
--    const size_t PAGESIZE;
- }
- 
-+// this can't be private since it's used as default argument to a public function
-+const size_t PAGESIZE;
- 
- static this()
- {
-@@ -2336,7 +2370,7 @@
-     }
- }
- 
--
-+extern(C) int printf(char*, ...);
- ////////////////////////////////////////////////////////////////////////////////
- // Fiber Entry Point and Context Switch
- ////////////////////////////////////////////////////////////////////////////////
-@@ -2450,6 +2484,22 @@
-                 ret;
-             }
-         }
-+        else version( LLVM_AsmX86_Posix )
-+        {
-+            asm
-+            {
-+                // clobber registers to save
-+                inc EBX;
-+                inc ESI;
-+                inc EDI;
-+
-+                // store oldp again with more accurate address
-+                mov EAX, oldp;
-+                mov [EAX], ESP;
-+                // load newp to begin context switch
-+                mov ESP, newp;
-+            }
-+        }
-         else static if( is( ucontext_t ) )
-         {
-             Fiber   cfib = Fiber.getThis();
-@@ -3115,6 +3165,16 @@
-             push( 0x00000000 );                                     // ESI
-             push( 0x00000000 );                                     // EDI
-         }
-+        else version( LLVM_AsmX86_Posix )
-+        {
-+            push( cast(size_t) &fiber_entryPoint );                 // EIP
-+            push( 0x00000000 );                                     // newp
-+            push( 0x00000000 );                                     // oldp
-+            push( 0x00000000 );                                     // EBP
-+            push( 0x00000000 );                                     // EBX
-+            push( 0x00000000 );                                     // ESI
-+            push( 0x00000000 );                                     // EDI
-+        }
-         else version( AsmPPC_Posix )
-         {
-             version( StackGrowsDown )
-Index: lib/unittest.sh
-===================================================================
---- lib/unittest.sh	(revision 3954)
-+++ lib/unittest.sh	(working copy)
-@@ -18,8 +18,9 @@
-   --help: This message
-   --run-all: Reports result instead of breaking. Do not use this if you want to
-          run unittest runner through a debugger.
--  dmd: Builds unittests for dmd
--  gdc: Builds unittests for gdc
-+  dmd:    Builds unittests for dmd
-+  gdc:    Builds unittests for gdc
-+  ldc: Builds unittests for ldc
- 
-   <none>: Builds unittests for all known compilers.'
-   exit 0
-@@ -86,7 +87,7 @@
- void main() {}
- EOF
- 
--        rebuild -w -d -g -L-ldl -L-lz -L-lbz2 -debug=UnitTest -debug -full -clean -unittest \
-+        rebuild -w -d -L-ldl -L-lz -L-lbz2 -debug=UnitTest -debug -full -clean -unittest \
-         -version=UnitTest $EXE.d tango/core/*.d tango/core/sync/*.d tango/io/digest/*.d \
-         tango/io/model/*.d tango/io/protocol/*.d tango/io/selector/*.d tango/io/*.d \
-         tango/io/vfs/*.d tango/io/vfs/model/*.d \
-@@ -125,6 +126,9 @@
-         gdc)
-             GDC=1
-             ;;
-+        ldc)
-+            LDC=1
-+            ;;
-         *)
-             usage
-             ;;
-@@ -132,10 +136,11 @@
-     shift
- done
- 
--if [ ! "$DMD" -a ! "$GDC" ]
-+if [ ! "$DMD" -a ! "$GDC" -a ! "$LDC" ]
- then
-     DMD=1
-     GDC=1
-+    LDC=1
- fi
- 
- if [ "$DMD" = "1" ]
-@@ -146,4 +151,7 @@
- then
-     compile gdc runUnitTest_gdc
- fi
--
-+if [ "$LDC" = "1" ]
-+then
-+    compile ldc runUnitTest_ldc
-+fi
-Index: lib/gc/basic/gcx.d
-===================================================================
---- lib/gc/basic/gcx.d	(revision 3954)
-+++ lib/gc/basic/gcx.d	(working copy)
-@@ -65,6 +65,13 @@
- }
- 
- 
-+struct BlkInfo
-+{
-+    void*  base;
-+    size_t size;
-+    uint   attr;
-+}
-+
- private
- {
-     enum BlkAttr : uint
-@@ -75,13 +82,6 @@
-         ALL_BITS = 0b1111_1111
-     }
- 
--    struct BlkInfo
--    {
--        void*  base;
--        size_t size;
--        uint   attr;
--    }
--
-     extern (C) void* rt_stackBottom();
-     extern (C) void* rt_stackTop();
- 
-@@ -2178,6 +2178,28 @@
-             __builtin_unwind_init();
-             sp = & sp;
-         }
-+        else version(LDC)
-+        {
-+            version(X86)
-+            {
-+                uint eax,ecx,edx,ebx,ebp,esi,edi;
-+                asm
-+                {
-+                    mov eax[EBP], EAX      ;
-+                    mov ecx[EBP], ECX      ;
-+                    mov edx[EBP], EDX      ;
-+                    mov ebx[EBP], EBX      ;
-+                    mov ebp[EBP], EBP      ;
-+                    mov esi[EBP], ESI      ;
-+                    mov edi[EBP], EDI      ;
-+                    mov sp[EBP],ESP     ;
-+                }
-+            }
-+            else
-+            {
-+                static assert( false, "Architecture not supported." );
-+            }
-+        }
-         else
-         {
-         asm
-@@ -2191,6 +2213,10 @@
-         {
-             // nothing to do
-         }
-+        else version(LDC)
-+        {
-+            // nothing to do
-+        }
-         else
-         {
-         asm
-Index: lib/gc/basic/gcbits.d
-===================================================================
---- lib/gc/basic/gcbits.d	(revision 3954)
-+++ lib/gc/basic/gcbits.d	(working copy)
-@@ -39,6 +39,10 @@
- {
-     // use the unoptimized version
- }
-+else version(LDC)
-+{
-+    // ditto
-+}
- else version (D_InlineAsm_X86)
- {
-     version = Asm86;
-Index: tango/text/convert/Layout.d
-===================================================================
---- tango/text/convert/Layout.d	(revision 3954)
-+++ tango/text/convert/Layout.d	(working copy)
-@@ -47,6 +47,12 @@
-         alias void* Arg;
-         alias va_list ArgList;
-         }
-+else version(LDC)
-+        {
-+        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 (LDC)
-                         {
-                         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 3954)
-+++ tango/core/Vararg.d	(working copy)
-@@ -15,6 +15,10 @@
- {
-     public import std.stdarg;
- }
-+else version( LDC )
-+{
-+    public import ldc.vararg;
-+}
- else
- {
-     /**
-Index: tango/core/Atomic.d
-===================================================================
---- tango/core/Atomic.d	(revision 3954)
-+++ tango/core/Atomic.d	(working copy)
-@@ -270,6 +270,167 @@
- 
- 
- ////////////////////////////////////////////////////////////////////////////////
-+// LDC Atomics Implementation
-+////////////////////////////////////////////////////////////////////////////////
-+
-+
-+else version( LDC )
-+{
-+    import ldc.intrinsics;
-+
-+
-+    ////////////////////////////////////////////////////////////////////////////
-+    // Atomic Load
-+    ////////////////////////////////////////////////////////////////////////////
-+
-+
-+    template atomicLoad( msync ms = msync.seq, T )
-+    {
-+        T atomicLoad(ref T val)
-+        {
-+            llvm_memory_barrier(
-+                ms == msync.hlb || ms == msync.acq || ms == msync.seq,
-+                ms == msync.hsb || ms == msync.acq || ms == msync.seq,
-+                ms == msync.slb || ms == msync.rel || ms == msync.seq,
-+                ms == msync.ssb || ms == msync.rel || ms == msync.seq,
-+                false);
-+            static if (isPointerType!(T))
-+            {
-+                return cast(T)llvm_atomic_load_add!(size_t)(cast(size_t*)&val, 0);
-+            }
-+            else static if (is(T == bool))
-+            {
-+                return llvm_atomic_load_add!(ubyte)(cast(ubyte*)&val, cast(ubyte)0) ? 1 : 0;
-+            }
-+            else
-+            {
-+                return llvm_atomic_load_add!(T)(&val, cast(T)0);
-+            }
-+        }
-+    }
-+
-+
-+    ////////////////////////////////////////////////////////////////////////////
-+    // Atomic Store
-+    ////////////////////////////////////////////////////////////////////////////
-+
-+
-+    template atomicStore( msync ms = msync.seq, T )
-+    {
-+        void atomicStore( ref T val, T newval )
-+        {
-+            llvm_memory_barrier(
-+                ms == msync.hlb || ms == msync.acq || ms == msync.seq,
-+                ms == msync.hsb || ms == msync.acq || ms == msync.seq,
-+                ms == msync.slb || ms == msync.rel || ms == msync.seq,
-+                ms == msync.ssb || ms == msync.rel || ms == msync.seq,
-+                false);
-+            static if (isPointerType!(T))
-+            {
-+                llvm_atomic_swap!(size_t)(cast(size_t*)&val, cast(size_t)newval);
-+            }
-+            else static if (is(T == bool))
-+            {
-+                llvm_atomic_swap!(ubyte)(cast(ubyte*)&val, newval?1:0);
-+            }
-+            else
-+            {
-+                llvm_atomic_swap!(T)(&val, newval);
-+            }
-+        }
-+    }
-+
-+
-+    ////////////////////////////////////////////////////////////////////////////
-+    // Atomic Store If
-+    ////////////////////////////////////////////////////////////////////////////
-+
-+
-+    template atomicStoreIf( msync ms = msync.seq, T )
-+    {
-+        bool atomicStoreIf( ref T val, T newval, T equalTo )
-+        {
-+            llvm_memory_barrier(
-+                ms == msync.hlb || ms == msync.acq || ms == msync.seq,
-+                ms == msync.hsb || ms == msync.acq || ms == msync.seq,
-+                ms == msync.slb || ms == msync.rel || ms == msync.seq,
-+                ms == msync.ssb || ms == msync.rel || ms == msync.seq,
-+                false);
-+            T oldval = void;
-+            static if (isPointerType!(T))
-+            {
-+                oldval = cast(T)llvm_atomic_cmp_swap!(size_t)(cast(size_t*)&val, cast(size_t)equalTo, cast(size_t)newval);
-+            }
-+            else static if (is(T == bool))
-+            {
-+                oldval = llvm_atomic_cmp_swap!(ubyte)(cast(ubyte*)&val, equalTo?1:0, newval?1:0)?0:1;
-+            }
-+            else
-+            {
-+                oldval = llvm_atomic_cmp_swap!(T)(&val, equalTo, newval);
-+            }
-+            return oldval == equalTo;
-+        }
-+    }
-+    
-+    
-+    ////////////////////////////////////////////////////////////////////////////
-+    // Atomic Increment
-+    ////////////////////////////////////////////////////////////////////////////
-+
-+
-+    template atomicIncrement( msync ms = msync.seq, T )
-+    {
-+        //
-+        // NOTE: This operation is only valid for integer or pointer types
-+        //
-+        static assert( isValidNumericType!(T) );
-+
-+
-+        T atomicIncrement( ref T val )
-+        {
-+            static if (isPointerType!(T))
-+            {
-+                llvm_atomic_load_add!(size_t)(cast(size_t*)&val, 1);
-+            }
-+            else
-+            {
-+                llvm_atomic_load_add!(T)(&val, cast(T)1);
-+            }
-+            return val;
-+        }
-+    }
-+    
-+    
-+    ////////////////////////////////////////////////////////////////////////////
-+    // Atomic Decrement
-+    ////////////////////////////////////////////////////////////////////////////
-+
-+
-+    template atomicDecrement( msync ms = msync.seq, T )
-+    {
-+        //
-+        // NOTE: This operation is only valid for integer or pointer types
-+        //
-+        static assert( isValidNumericType!(T) );
-+
-+
-+        T atomicDecrement( ref T val )
-+        {
-+            static if (isPointerType!(T))
-+            {
-+                llvm_atomic_load_sub!(size_t)(cast(size_t*)&val, 1);
-+            }
-+            else
-+            {
-+                llvm_atomic_load_sub!(T)(&val, cast(T)1);
-+            }
-+            return val;
-+        }
-+    }
-+}
-+
-+////////////////////////////////////////////////////////////////////////////////
- // x86 Atomic Function Implementation
- ////////////////////////////////////////////////////////////////////////////////
- 
-Index: tango/math/Math.d
-===================================================================
---- tango/math/Math.d	(revision 3954)
-+++ tango/math/Math.d	(working copy)
-@@ -76,6 +76,14 @@
-         version = DigitalMars_D_InlineAsm_X86;
-     }
- }
-+else version(LDC)
-+{
-+    import ldc.intrinsics;
-+    version(X86)
-+    {
-+        version = LDC_X86;
-+    }
-+}
- 
- /*
-  * Constants
-@@ -298,6 +306,24 @@
-  * Bugs:
-  *  Results are undefined if |x| >= $(POWER 2,64).
-  */
-+version(LDC)
-+{
-+    alias llvm_cos_f32 cos;
-+    alias llvm_cos_f64 cos;
-+    version(X86)
-+    {
-+        alias llvm_cos_f80 cos;
-+    }
-+    else
-+    {
-+        real cos(real x)
-+        {
-+            return tango.stdc.math.cosl(x);
-+        }
-+    }
-+}
-+else
-+{
- real cos(real x) /* intrinsic */
- {
-     version(D_InlineAsm_X86)
-@@ -313,6 +339,7 @@
-         return tango.stdc.math.cosl(x);
-     }
- }
-+}
- 
- debug(UnitTest) {
- unittest {
-@@ -333,6 +360,24 @@
-  * Bugs:
-  *  Results are undefined if |x| >= $(POWER 2,64).
-  */
-+version(LDC)
-+{
-+    alias llvm_sin_f32 sin;
-+    alias llvm_sin_f64 sin;
-+    version(X86)
-+    {
-+        alias llvm_sin_f80 sin;
-+    }
-+    else
-+    {
-+        real sin(real x)
-+        {
-+            return tango.stdc.math.sinl(x);
-+        }
-+    }
-+}
-+else
-+{
- real sin(real x) /* intrinsic */
- {
-     version(D_InlineAsm_X86)
-@@ -348,6 +393,7 @@
-         return tango.stdc.math.sinl(x);
-     }
- }
-+}
- 
- debug(UnitTest) {
- unittest {
-@@ -374,7 +420,11 @@
- {
-     version (GNU) {
-         return tanl(x);
--    } else {
-+    }
-+    else version(LDC) {
-+        return tango.stdc.math.tanl(x);
-+    }
-+    else {
-     asm
-     {
-         fld x[EBP]      ; // load theta
-@@ -947,6 +997,25 @@
-  *  <tr> <td> +&infin; <td> +&infin; <td> no
-  *  )
-  */
-+version(LDC)
-+{
-+    alias llvm_sqrt_f32 sqrt;
-+    alias llvm_sqrt_f64 sqrt;
-+    version(X86)
-+    {
-+        alias llvm_sqrt_f80 sqrt;
-+    }
-+    else
-+    {
-+        real sqrt(real x)
-+        {
-+            return tango.stdc.math.sqrtl(x);
-+        }
-+    }
-+}
-+else
-+{
-+
- float sqrt(float x) /* intrinsic */
- {
-     version(D_InlineAsm_X86)
-@@ -995,6 +1064,8 @@
-     }
- }
- 
-+}
-+
- /** ditto */
- creal sqrt(creal z)
- {
-@@ -1477,7 +1548,14 @@
-         }
-     }
-     }
--    return tango.stdc.math.powl(x, y);
-+    version(LDC_X86)
-+    {
-+        return llvm_pow_f80(x, y);
-+    }
-+    else
-+    {
-+        return tango.stdc.math.powl(x, y);
-+    }
- }
- 
- debug(UnitTest) {
-Index: tango/stdc/stdlib.d
-===================================================================
---- tango/stdc/stdlib.d	(revision 3954)
-+++ tango/stdc/stdlib.d	(working copy)
-@@ -94,6 +94,11 @@
- {
-     void* alloca(size_t size);
- }
-+else version( LDC )
-+{
-+    pragma(alloca)
-+        void* alloca(size_t size);
-+}
- else version( GNU )
- {
-     private import gcc.builtins;
-Index: tango/stdc/stdarg.d
-===================================================================
---- tango/stdc/stdarg.d	(revision 3954)
-+++ tango/stdc/stdarg.d	(working copy)
-@@ -13,6 +13,10 @@
- {
-     public import std.c.stdarg;
- }
-+else version( LDC )
-+{
-+    public import ldc.cstdarg;
-+}
- else
- {
-     alias void* va_list;