Page 2 of 3

Re: What interest is there in LLVM?

Posted: 11 Feb 2011, 03:00
by dsjove
I have been receiving a blank screen on "submit" of this reply for a week (Safari MacOSX) :evil: . I am trying Firefox now...

Re: What interest is there in LLVM?

Posted: 11 Feb 2011, 03:04
by dsjove
Ok. FireFox it is...

@doc-helmut

I see your point. And that is why I tried Lejos. But I found the implementation way too hackish for my liking. Given our domain (specialized robots), I can live with many of the limitations of the extended firmware. I have worked in embedded systems with many of those. It is the reentrancy that I find the most annoying. But that is solvable (along with some of the others) using a stratagem similar to C++ template expansion (auto generate a copy for each non-inline function for each additional invoking task). This would not just be another dialect of NXC. We would get the power of a nearly full C++ language and optimizer. That is huge.

And you got me thinking again. :P LLVM makes a very clean separation between front-end, intermediate, and back-end modules of the compiler. I see no reason why we would not be able to swap in other back-ends to take advantage of more advanced brick OSs. And that could tie into h-g-t's find.

@h-g-t
Did you see any forum or contacts associated with that Kent project?

@spillerrec
Done properly! :o Watcha talking about?
I am very interested. I want compile-polymorphism, real references, C++ templates, re-entrancy - all of which are doable. I don't want to be the only one working on this! This weekend I'll start figuring out what an LLVM project looks like.

Re: What interest is there in LLVM?

Posted: 11 Feb 2011, 09:17
by spillerrec
dsjove wrote:I have been receiving a blank screen on "submit" of this reply for a week (Safari MacOSX) :evil: . I am trying Firefox now...
I have experienced similar issues (in Opera), usually it seems to go away if I clear the cookies associated with this site.
dsjove wrote:@spillerrec
Done properly! :o Watcha talking about?
I am very interested. I want compile-polymorphism, real references, C++ templates, re-entrancy - all of which are doable. I don't want to be the only one working on this! This weekend I'll start figuring out what an LLVM project looks like.
Everything should be done properly, but whether this is the case or not is up to the developer ; )

I got the feeling that you wanted some others to be with you on this, but are there any that are interested to do this?What will you do if you ended up alone in the end?
I'm interested in the project and would love to help if I can, however I have a few other projects and before those are done I'm not sure how much time I would be able to use on it.

Re: What interest is there in LLVM?

Posted: 12 Feb 2011, 01:34
by dsjove
I don't have the time to do this alone. I would be surprised if in all the internets there are not some people interested in contributing to a project like this.

Re: What interest is there in LLVM?

Posted: 13 Feb 2011, 23:18
by schodet
dsjove wrote:I don't have the time to do this alone. I would be surprised if in all the internets there are not some people interested in contributing to a project like this.
Well, all the internet is not reading this forum :)

Could you precise what you exactly plan to implement the virtual machine?

Re: What interest is there in LLVM?

Posted: 14 Feb 2011, 01:24
by dsjove
schodet wrote:Well, all the internet is not reading this forum
Well, they should be. Excusing the weekly Safari compatibility glitches, this forum or any LEGO forum is awesome 8-)

I am not planning on creating another VM or Brick OS. I want a C++ compiler for the extended firmware that fully integrates with XCode and helps John take BrickCC to a whole new level.

Re: What interest is there in LLVM?

Posted: 16 Feb 2011, 00:28
by nxt-ai
To clarify for me and anyone else who has as of yet only read the acronym (and watched Apple's "LLVM = Awesome" video), what is LLVM exactly?
By that I mean the VM part.
Personally I abhor virtual machines, so what does it mean in this case? I really think using a vm anywhere would be a step back. That is my main gripe with the current firmware, that no matter what you always run in a VM. Why is a compiler using a VM? I want to learn to code for my brick, not some made up virtual machine language. However, in the likely event I've misunderstood; why is LLVM called Low Level Virtual Machine unless it uses a VM?

Sincerely, NXT AI

Re: What interest is there in LLVM?

Posted: 16 Feb 2011, 02:39
by dsjove
It is a fascinating developer video. And Apple always touts their tech as awesome :lol:

LLVM does stand for "Low Level Virtual Machine". To quote LLVM's site,
The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Despite its name, LLVM has little to do with traditional virtual machines, though it does provide helpful libraries that can be used to build them.
At its core is a language neutral intermediate code. The intermediate code has both a binary form and a human readable assembler. It isn't to far off from NBC. In the LLVM toolchain is a front end module called Clang. This is a very fast and alterable C/C++ front-end to LLVM's bytecode. Other front-ends are (relatively) easy to make and change. We get the built in optimizer for free.

The fundamental work of NXT LLVM is to create a back-end that translates LLVM intermediate code to either NBC or even directly to an rxe file. Clang would have to be extended to have an "everything-is-global" calling convention. Many of the same tricks NXC uses can be applied to Clang.

The goal is to leverage this powerful compiler technology so this very active LEGO community can then work on extending the native firmware without reinventing a C language front-end.

Re: What interest is there in LLVM?

Posted: 16 Feb 2011, 22:04
by schodet
I do not think that using LLVM with the NXT byte code can be useful, you will always be limited by the NXT not fitting in the LLVM model.

Re: What interest is there in LLVM?

Posted: 16 Feb 2011, 23:45
by nxt-ai
Why would intermediate code be good? My understanding would lead me to believe this would make less efficient code unless your other compiler is really bad.
How does adding an extra step improve efficiency?

nbc ------- rxe

nbc ------- llvm --------- rxe

In any case doesn't LLVM just add another useless step?

Please explain.