diff --git a/gen/toir.c b/gen/toir.c index f62a26cf..5fad5e8b 100644 --- a/gen/toir.c +++ b/gen/toir.c @@ -920,7 +920,7 @@ elem* CallExp::toElem(IRState* p) assert(llargs[j] != 0); } else { - llargs[j] = arg->mem; + llargs[j] = arg->mem ? arg->mem : arg->val; assert(llargs[j] != 0); } diff --git a/llvmdc-posix b/llvmdc-posix new file mode 100644 index 00000000..3ab6788f --- /dev/null +++ b/llvmdc-posix @@ -0,0 +1,67 @@ +#profile=phobos + +compiler=llvmdc +inifile=llvmdc.conf + +exeext= +objext=bc + + +version=LLVM +noversion=DigitalMars +noversion=GNU +testversion=linux +testversion=Unix +version=Posix +testversion=Windows +testversion=Win32 +testversion=Win64 +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=LittleEndian +testversion=BigEndian + + +[compile] +cmd=llvmdc -version=Posix -c $i + +flag=$i +incdir=-I$i +libdir=-L-L$i +optimize=-O5 +version=-version=$i + + +[link] +cmd=llvdc $i -of$o + +libdir=-L-L$i +lib=-L-l$i +flag=-L$i + + +[liblink] +safe=yes +cmd=ar rc $o $i + +libdir= +lib= +flag= + + +[postliblink] +cmd=ranlib $i + + +[shliblink] +shlibs=no + +[dyliblink] +dylibs=no diff --git a/readme.txt b/readme.txt new file mode 100644 index 00000000..75065ea5 --- /dev/null +++ b/readme.txt @@ -0,0 +1,20 @@ +LLVM D Compiler (LLVMDC) + +This compiler is based on the Digital Mars D (DMD)[1] compiler frontend, and +the LLVM[2] compiler toolkit. It is licensed under the same licence as the DMD +compiler frontend. See dmd/readme.txt for more details. + +premake[3] is used to generate a makefile so the project can be built. So far +only Linux is tested so use the command: 'premake --target gnu' to generate a +Makefile, then just type 'make'. + +You need LLVM 2.1 which is not yet released, so LLVM from SVN is required. +Current development has been done against the 20070814 revision, newer will +probably work, later probably wont... + +Many thing are still not implemented. For more information visit the website: +http://www.dsource.org/projects/llvmdc + +[1] http://www.digitalmars.com/d +[2] http://www.llvm.org +[3] http://premake.sourceforge.net diff --git a/test/g.d b/test/g.d new file mode 100644 index 00000000..f7e1ff74 --- /dev/null +++ b/test/g.d @@ -0,0 +1,13 @@ +module g; + +void func(char[] str) +{ + printf("%.*s\n", str.length, str.ptr); +} + +void main() +{ + char[] arr = "Hello World!"; + func(arr); + func("ditto"); +} diff --git a/test/pt.d b/test/pt.d index 90c4f655..e9669f05 100644 --- a/test/pt.d +++ b/test/pt.d @@ -12,7 +12,6 @@ int main() printf("%p %p\n", s.ptr, sd.ptr); printf("%c%c%c\n", s[0], s[1], s[2]); } - char[16] s1 = void; char[16] s2 = void;