What interest is there in LLVM?

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
dsjove
Posts: 56
Joined: 22 Jan 2011, 23:22

Re: What interest is there in LLVM?

Post 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...
dsjove
Posts: 56
Joined: 22 Jan 2011, 23:22

Re: What interest is there in LLVM?

Post 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.
spillerrec
Posts: 358
Joined: 01 Oct 2010, 06:37
Location: Denmark
Contact:

Re: What interest is there in LLVM?

Post 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.
My blog: http://spillerrec.dk/category/lego/
RICcreator, an alternative to nxtRICeditV2: http://riccreator.sourceforge.net/
dsjove
Posts: 56
Joined: 22 Jan 2011, 23:22

Re: What interest is there in LLVM?

Post 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.
schodet
Posts: 139
Joined: 29 Sep 2010, 11:21
Contact:

Re: What interest is there in LLVM?

Post 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?
LEGO things http://ni.fr.eu.org/lego/ - NXT Improved Firmware (GCC) http://nxt-firmware.ni.fr.eu.org/ - Other robots http://apbteam.org
dsjove
Posts: 56
Joined: 22 Jan 2011, 23:22

Re: What interest is there in LLVM?

Post 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.
nxt-ai
Posts: 36
Joined: 10 Jan 2011, 05:02

Re: What interest is there in LLVM?

Post 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
dsjove
Posts: 56
Joined: 22 Jan 2011, 23:22

Re: What interest is there in LLVM?

Post 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.
schodet
Posts: 139
Joined: 29 Sep 2010, 11:21
Contact:

Re: What interest is there in LLVM?

Post 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.
LEGO things http://ni.fr.eu.org/lego/ - NXT Improved Firmware (GCC) http://nxt-firmware.ni.fr.eu.org/ - Other robots http://apbteam.org
nxt-ai
Posts: 36
Joined: 10 Jan 2011, 05:02

Re: What interest is there in LLVM?

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests