View previous topic :: View next topic |
Author |
Message |
lindquist
Joined: 14 Sep 2006 Posts: 55 Location: Copenhagen, Denmark
|
Posted: Wed Aug 01, 2007 9:03 pm Post subject: LLVM D Compiler |
|
|
Hi.
I've been working on a LLVM D compiler for some time now, and I anticipate having a pre-alpha release ready in a week or two. I've decided that I'd like to host it on dsource for a nice Trac environment and all that.
The project should be called LLVMDC.
-Tomas Lindquist Olsen |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
lindquist
Joined: 14 Sep 2006 Posts: 55 Location: Copenhagen, Denmark
|
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
Anders
Joined: 24 Jun 2006 Posts: 1
|
Posted: Thu Aug 02, 2007 3:21 pm Post subject: |
|
|
Anders says hello! ![Very Happy](images/smiles/icon_biggrin.gif) |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
mp4
Joined: 22 Jun 2007 Posts: 19
|
Posted: Sat Aug 11, 2007 4:41 am Post subject: hi! |
|
|
Hi! Just curious ... What do you expect from this compiler?
In what ways would it better than dmd or gdc? |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
lindquist
Joined: 14 Sep 2006 Posts: 55 Location: Copenhagen, Denmark
|
Posted: Mon Aug 13, 2007 7:29 am Post subject: |
|
|
To start with it's not going to be better. In the long term however, I have faith that LLVM will evolve to become a leading backend in the compiler scene. Having a D compiler as early as possible will make sure any potential problems in LLVM can be solved before the project (LLVM) matures too much.
The LLVM optimizer is already pretty amazing. New architectures are being added as we speak, and the people behind it are very responsive to feedback and help requests.
But most importantly, I get myself a chance to learn something about compilers So far it has been very interesting, and if I can actually create a working D 1.0 compiler as my first compiler project ever, I think that says a lot about LLVM as well. Even if the whole thing is mostly just a big hack.
-Tomas |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
yukito
Joined: 22 Aug 2006 Posts: 2 Location: Belgium
|
Posted: Fri Aug 31, 2007 4:01 am Post subject: Re: hi! |
|
|
mp4 wrote: | Hi! Just curious ... What do you expect from this compiler?
In what ways would it better than dmd or gdc? |
Some of us just like LLVM and would like to see D work on their amazing backend. LLVM was designed to support many advanced languages, so it's only natural that we want D on it.
Keep up the good work, lindquist! |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
kris
Joined: 27 Mar 2004 Posts: 1494 Location: South Pacific
|
Posted: Fri Aug 31, 2007 11:14 am Post subject: |
|
|
Yeah, LLVM is quite amazing. I'd be somewhat surprised if it doesn't generate tighter code than dmd |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
lindquist
Joined: 14 Sep 2006 Posts: 55 Location: Copenhagen, Denmark
|
Posted: Sat Sep 01, 2007 1:51 pm Post subject: |
|
|
I have committed the code to trunk now. It requires LLVM from svn. I have been developing against revision 20070821.
Please note that this is not a complete D compiler. Many things are still not working.
Arch linux users can get my llvm-svn package from AUR.
You will need premake to generate the Makefile, and I've only tested on x86-64 linux, there may be problems on other platforms.
Any feedback is much appreciated
The code is pretty rough... Bear with me it's my first compiler
-Tomas |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
wilsonk
Joined: 21 Apr 2006 Posts: 40
|
Posted: Sun Sep 02, 2007 3:00 pm Post subject: llvmdc |
|
|
Hey Tomas,
This is great stuff. I just compiled everything using llvm's svn repo for today. Everything works and I love the little build.sh/tester.sh, etc. scripts to help things along. I will mention for others that they need premake (google for it) in their path. Then just do a 'premake --target gnu' under linux to get things moving
Are all of the test directories files supposed to work? I assume not since I am getting several errors. Some files work though.
How are you calculating uses? Do you have an SSA intermediate form that I can't see? Just wondering since I think the struct 's' in ...test/b.d has 8 uses, I believe, instead of the 9 in the llvm output code. Not a disparaging remark here at all.....just wondering
This is really great stuff....wooohoooo.
Thanks,
K.Wilson
P.S. I had never used premake but it is a great little program. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
lindquist
Joined: 14 Sep 2006 Posts: 55 Location: Copenhagen, Denmark
|
Posted: Sun Sep 02, 2007 3:43 pm Post subject: |
|
|
Thanx for trying it out wilsonk
The .ll you see is generated by the external llvm-dis tool so llvmdc really has nothing to do with the uses thing.
Basically llvm just generates bytecode and (optionally) passes it on to llvm-ld for optimization and linking.
Most of the files in test should work. I'll try them out and see what I broke the type info stuff there is really the only ones that shouldn't work yet. I'm still working on TypeInfo.
-Tomas |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
wilsonk
Joined: 21 Apr 2006 Posts: 40
|
Posted: Sun Sep 02, 2007 3:53 pm Post subject: |
|
|
Ahh,
Sorry Tomas, I didn't realise that llvm-dis is generating the .ll output...this would seem to indicate that llvm is internally setting up its SSA intermediate form once it gets your input. Makes sense, and makes a different project I was looking at much easier...haha cool.
I haven't looked at your code much yet. I just had to post something, though, to let you know that at least one other person has it running and is looking at it.
Thanks,
K.Wilson |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
lindquist
Joined: 14 Sep 2006 Posts: 55 Location: Copenhagen, Denmark
|
Posted: Tue Sep 04, 2007 11:19 pm Post subject: |
|
|
I've been doing some small fixes. Now all tests should work except the one or two that use typeinfo.
I've also added a preliminary rebuild profile and a small readme. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
wilsonk
Joined: 21 Apr 2006 Posts: 40
|
Posted: Wed Sep 12, 2007 2:11 am Post subject: |
|
|
Hey Tomas,
I have a couple diffs for you. They are a couple fixes for recursive functions and dynamic arrays. There are a couple test files included in this tgz:
http://pages.cpsc.ucalgary.ca/~wilsonk/llvmdc.tgz
Let me know if something is missing or improperly done.
Thanks,
K.Wilson |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
lindquist
Joined: 14 Sep 2006 Posts: 55 Location: Copenhagen, Denmark
|
Posted: Wed Sep 12, 2007 10:48 am Post subject: |
|
|
Hey
Glad to see you're looking at it... Could I get you to post the diffs as unified? or just use 'svn diff'.
Please let me know if you'd like to collaborate more as I could certainly use some help.
-Tomas |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
wilsonk
Joined: 21 Apr 2006 Posts: 40
|
Posted: Wed Sep 12, 2007 7:36 pm Post subject: |
|
|
Hey Tomas,
I would try to do the 'svn diff', as usual, but I have monkeyed around with the code base so much at this point that the diff is monstrous (and useless as a result). I was actually hoping that I could download a new copy once the diffs I posted were applied and stop messing up the code so much. I have a better idea of how things are working now.
I had saved a copy of llvmdc before I messed things up at all, but then I did an svn update without thinking and my backup copy was revision 8 instead of 9...this meant another monstrous diff which would include all of your diffs anyways.
I will try not to do this again. Sorry. If you really need me to get a unified diff I can try it with just those three files, I guess. Obviously the two test case files can just be copied to .../llvmdc/test.
Thanks,
K.Wilson
P.S. I would like to collaborate more (but I may be starting a new job soon so I will have to see how much time I have). I should have time over the next couple weeks, at least ![Wink](images/smiles/icon_wink.gif) |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|