digitalmars.D - D + LLVM?
- Stephen Waits (2/2) May 30 2007 Has anyone looked at marrying the D front end to LLVM?
- Frits van Bommel (5/6) May 30 2007 It has been suggested here before, but AFAIK nothing working ever came
- Daniel Keep (19/22) May 30 2007 I've thought about it a few times. At this stage, I think it would be
- BCS (9/21) May 30 2007 You just quoted the comment out of the top of a program I'm working on.
- Stephen Waits (4/8) May 31 2007 With LLVM you needn't bother with the backend, as they exist for quite a...
- BCS (2/13) May 31 2007 Where would the fun be in that?
- Tomas Lindquist Olsen (31/34) May 31 2007 I have been playing around with merging the DMD frontend and LLVM for ab...
- Stephen Waits (7/14) May 31 2007 Is LLVM's SSA structure the same as gcc's? I know they've interface gcc...
- Tomas Lindquist Olsen (2/4) May 31 2007 Last week I didn't even know what SSA was, so I really have no clue.
- Nick Sabalausky (10/15) Aug 03 2007 I've been working on writing stubs and such to at least get the DMD fron...
- Nick Sabalausky (4/22) Aug 03 2007 Sorry, disregard this, my newsgroup reader seems to have replied to the
Has anyone looked at marrying the D front end to LLVM? --Steve
May 30 2007
Stephen Waits wrote:Has anyone looked at marrying the D front end to LLVM?It has been suggested here before, but AFAIK nothing working ever came of it (I'm not even sure anyone seriously tried). If you want to give it a try GDC may be a good place to start since IIRC the GCC C and C++ frontends were already adapted to work with LLVM.
May 30 2007
Stephen Waits wrote:Has anyone looked at marrying the D front end to LLVM? --SteveI've thought about it a few times. At this stage, I think it would be really good to have a second, completely independent implementation of D that doesn't depend on the DMD front-end. What I'd really like to[1] write is a very simple, easily modified D compiler that spits out LLVM bytecode so that new language features could be prototyped. Maybe one of these days :P -- Daniel [1] have the time to -- int getRandomNumber() { return 4; // chosen by fair dice roll. // guaranteed to be random. } http://xkcd.com/ v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP http://hackerkey.com/
May 30 2007
Reply to Daniel,I've thought about it a few times. At this stage, I think it would be really good to have a second, completely independent implementation of D that doesn't depend on the DMD front-end. What I'd really like to[1] write is a very simple, easily modified D compiler that spits out LLVM bytecode so that new language features could be prototyped. Maybe one of these days :P -- DanielYou just quoted the comment out of the top of a program I'm working on. It's just a lexer at this point[1] and the target is to also build the back end[2] (or ends), but other other than that you and I are thinking along the same lines. [1] I've /only/ been working on it for like a year so I should be done soon ;b [2] What can I say, I'm writing a COMPILER for fun. Don't say it, I've all ready been told I'm nuts.
May 30 2007
BCS wrote:It's just a lexer at this point[1] and the target is to also build the back end[2] (or ends), but other other than that you and I are thinking along the same lines.With LLVM you needn't bother with the backend, as they exist for quite a few platforms. --Steve
May 31 2007
Reply to Stephen,BCS wrote:Where would the fun be in that?It's just a lexer at this point[1] and the target is to also build the back end[2] (or ends), but other other than that you and I are thinking along the same lines.With LLVM you needn't bother with the backend, as they exist for quite a few platforms. --Steve
May 31 2007
Stephen Waits wrote:Has anyone looked at marrying the D front end to LLVM? --SteveI have been playing around with merging the DMD frontend and LLVM for about a week now. It's not a really serious attempt, but it's going a lot better than I had thought it would. I had not planned to announce anything, but since this post has arrived I thought I'd let out the secret. I'm not a compiler guru, in fact this is my first attempt ever with anything compiler related. Also I'm just a hobbyist programmer and I'm doing this in my spare time just for fun. Maybe something useful will come out of it, maybe it will die in a week. Right now I just don't know... That being said I'm not going to stop yet as it's actually pretty fun so far :) To give an idea of how far I am (which isn't very far) I have the following working so far: * integral and floating types (real is double) * pointers to the working types (& and *) * casts * global variables * structs (no methods) * free functions (templated too) * = - * / += -= *= /= operators As you can see I've only implemented a tiny fraction of the specification so far, but it would definitely be nice to have a comlpete LLVM-D implementation. It's just a really nice feeling to run my test modules in the JIT compiler :P The main issue I've had so far is translating to the LLVM SSA form. As far as I have seen DMD does not provide any information about whether a variable needs storage or not. Before pointers I had some really nice code output, but when I got to pointers it all collapsed and now I use alloca for all variables and rely on the mem2reg optimization pass to figure out where it's really needed and not... -Tomas
May 31 2007
Tomas Lindquist Olsen wrote:Thomas, that's GREAT to hear!Has anyone looked at marrying the D front end to LLVM?I have been playing around with merging the DMD frontend and LLVM for about a week now. It's not a really serious attempt, but it's going a lot betterThe main issue I've had so far is translating to the LLVM SSA form. As far as I have seen DMD does not provide any information about whether aIs LLVM's SSA structure the same as gcc's? I know they've interface gcc and g++ onto LLVM. This is why I figured GDC might be a viable front-end for LLVM; however, I obviously haven't looked into it yet. --Steve
May 31 2007
Stephen Waits wrote:Is LLVM's SSA structure the same as gcc's?Last week I didn't even know what SSA was, so I really have no clue.
May 31 2007
"Tomas Lindquist Olsen" <tomas famolsen.dk> wrote in message news:f3mp43$235j$1 digitalmars.com...I have been playing around with merging the DMD frontend and LLVM for about a week now. It's not a really serious attempt, but it's going a lot better than I had thought it would. I had not planned to announce anything, but since this post has arrived I thought I'd let out the secret.I've been working on writing stubs and such to at least get the DMD frontend to compile and I'm curious how you handled DMD's tocsym.c and todt.c files. Did you: 1. Rip them out (like I think I've heard DMC does)? 2. Keep them, but gut the function bodies? or 3. Leave them intact and recreate all of the backend stuff they reference? (Like I tried but ultimately gave up on)
Aug 03 2007
Sorry, disregard this, my newsgroup reader seems to have replied to the wrong forum (Should have been D.gnu). "Nick Sabalausky" <a a.a> wrote in message news:f8vl7s$9k8$1 digitalmars.com..."Tomas Lindquist Olsen" <tomas famolsen.dk> wrote in message news:f3mp43$235j$1 digitalmars.com...I have been playing around with merging the DMD frontend and LLVM for about a week now. It's not a really serious attempt, but it's going a lot better than I had thought it would. I had not planned to announce anything, but since this post has arrived I thought I'd let out the secret.I've been working on writing stubs and such to at least get the DMD frontend to compile and I'm curious how you handled DMD's tocsym.c and todt.c files. Did you: 1. Rip them out (like I think I've heard DMC does)? 2. Keep them, but gut the function bodies? or 3. Leave them intact and recreate all of the backend stuff they reference? (Like I tried but ultimately gave up on)
Aug 03 2007