Page 2 of 3

Re: LLVM

Posted: Tue Oct 26, 2010 5:31 pm
by DoubleDutch
If the compiler generated code and we could use OS native routines like we can do with the Win32 API then I don't think it would matter so much initially that the pb libs aren't done. With regard to ARM - I think that Android mainly uses the JVM so that code runs on both Android ARM and Android x86 - although you can write 'native' ARM though if you like. If there was a Basic (like pb) for Android then it would be best to target: ARM, JVM or x86/x64.

Re: LLVM

Posted: Tue Oct 26, 2010 6:08 pm
by Trond
If the compiler generated code and we could use OS native routines like we can do with the Win32 API then I don't think it would matter so much initially that the pb libs aren't done.
A PB without strings, lists, arrays, and all the libraries wouldn't be much different from coding in plain C or Java, would it?

Re: LLVM

Posted: Tue Oct 26, 2010 6:48 pm
by DoubleDutch
Obviously some of the libs would need to be there initially - but the gfx, sound, window, etc wouldn't - just access to the native os libs.

Re: LLVM

Posted: Tue Oct 26, 2010 7:15 pm
by Coolman
Pour du vrai developpement multiplateforme, il serait possible de se baser sur QT (http://qt.nokia.com/) qui existe sur (linux, mac osx, windows mobile, windows ce, symbian, maemo, meego) :

http://qt.nokia.com/products/platform/platforms

http://doc.qt.nokia.com/4.6/supported-platforms.html

plus d'informations ici :

http://qt.nokia.com/products

**********************************************************************************************

For the true development platform, it would be possible to rely on QT (http://qt.nokia.com/) that exists on (linux, mac osx, Windows Mobile, Windows CE, Symbian, maemo, Meego)

http://qt.nokia.com/products/platform/platforms

http://doc.qt.nokia.com/4.6/supported-platforms.html

more information here:

http://qt.nokia.com/products

8)

Re: LLVM

Posted: Tue Oct 26, 2010 8:10 pm
by blueznl
Desperate people could build their own FASM -> LLVM converter ;-)

Re: LLVM

Posted: Tue Oct 26, 2010 9:01 pm
by Seymour Clufley
It may also help to use PB as a web programming language.

Re: LLVM

Posted: Tue Oct 26, 2010 9:49 pm
by blueznl
It's not a bad idea, but I guess it would require a different apporach ie. level of cross platform compatibility...

Something like...

- all features - Windows (hehe)
- most features - Linux
- less features - Apple ;-)
- least features - LLVM for web or mobile using some multi platform GUI framework

The more one would go cross platform, the smaller the command set available, but it would allow building mobile apps with the same great language.

But, there's a catch, it is a *lot* of work for Fred & Co, so I *could* imagine they are *somewhat* reluctant :-) especially as they have not completed my requested feature list yet :twisted:

Then again, it would provide a pathway to mobile Android / Apple devices, but at what cost...

Re: LLVM

Posted: Tue Oct 26, 2010 10:18 pm
by DoubleDutch
Seymour Clufley: Hadn't seen that before - thanks for the link.

The more I look, the more it looks like everyone is going down the LLVM route - even Adobe for flash compilation to real native exe on iPhone!

Re: LLVM

Posted: Tue Oct 26, 2010 11:36 pm
by Thorium
freak wrote: > But i dont think the resulting compiled code can be more optimized than a direct compiler can do.
> You just can't use CPU specific stuff very smart.

Why not? The CPU specific optimizations are done by the code-generator for the target platform. This comes after the general optimizations are applied to code in IR. Also, LLVM can do a lot of things that ordinary compilers can't do. It can run all its optimizers even after link-time, so things like inter-procedural optimizations become much more effective than applying them to each compiled module separately. Link-time optimization is something that only few compilers/linkers do well and even then they do it only for a few kinds of optimizations. In LLVM, this is part of the basic design from the beginning.
Maybe i am wrong but as i understand it, the high level code will be broken down into this low level LL code, which then gets broken down into asm.
So this LL code need to be very universally and architecture independant. I just guess there is a chance that there is some overhead added by doing two compiles. We allready have overhead if we compile from high level directly to asm. So here we do it 2 times.

Does this LLVM have architecture independant SIMD functionality? That would be awesome.

Re: LLVM

Posted: Wed Oct 27, 2010 1:48 am
by freak
@DoubleDutch

PureBasic without its libraries and debugger is just a nicer looking version of C. You wouldn't be happy with that for long.
I understand your wish to write programs for phones with PB, but its not going to happen any time soon. You'll just have to live with that.

@Thorium

Its not really an assembly language. It just looks like one. It is a code representation in static single assignment form (http://en.wikipedia.org/wiki/Static_sin ... nment_form) including full type information on all values. This is the same kind of code representation used by many compilers (including gcc since version 4) to represent the code in the steps between the compiler front-end and the back-end (where higher-level optimizations are done). The LLVM IR is just a readable form of what most compilers do behind the scenes as well.
This is why LLVM is nice for compiler writers: You just have to do a decent front-end which generates SSA and LLVM can do all the rest for you.

> Does this LLVM have architecture independant SIMD functionality? That would be awesome.

It does. There is a "vector" data type which can be used with many instructions. The code generators will generate SIMD instructions for that if the target platform provides them.

Re: LLVM

Posted: Wed Oct 27, 2010 6:48 am
by DoubleDutch
Freak: Ok, np - consider the subject closed. :)

Re: LLVM

Posted: Wed Oct 27, 2010 1:59 pm
by Coolman
DoubleDutch wrote:
If purebasic evolved and can directly generate C code directly compilable by LLVM, it would be exceptional because it would be possible to generate executables for different architectures (x86, x64, arm ...)
Shouldn't that read:
If purebasic evolved and can directly generate 'll' code directly compilable by LLVM, it would be exceptional because it would be possible to generate executables for different architectures (x86, x64, arm ...)
?
DoubleDutch, desolé, je n'avais pas vu ton post, j'utilise le traducteur de google mais je crois que c'est bien ce que je voulais dire, le language c c++ est je penses plus portable que tout les autres, il me semble logique de generer a partir de la syntaxe de purebasic un code c c++ directement compilable par LLVM,ca permettrait a long terme de reduire la charge de travail de l'auteur, si en plus QT etait utilisé, alors il serait possible de compiler directement sans modification de la GUI pour differentes plateformes comme je l'ai indiqué plus haut...

Cela dit, la reponse de Freak est mauvais signe, je serais curieux d'entendre celle de fred qui est apres tout le plus concerné...

Si c'est la meme, alors c'est bien dommage de gacher autant de competence dans un projet qui restera a mon avis marginal...

Je continuerais cependant a utiliser purebasic mais uniquement pour de petits projets...

Note : J'ecris ce post en francais parce que l'auteur est francais, n'y voyez aucun manque de respect...

8)

**********************************************************

DoubleDutch, sorry, I had not seen your post, I use google translator but I think that's what I meant, the language c c + + I think is more portable than any other, I seems logical to generate from syntax purebasic code c c + + directly compilable by LLVM, it would allow long-term to reduce the workload of the author, if in addition to QT was used, then it would be possible to compile directly without changing the GUI for different platforms as I mentioned above ...

However, the reply from Freak is a bad sign, I'd be curious to hear that fred is after all most concerned ...

If it is the same, so it's a shame to spoil as much expertise in a project that will remain marginal in my opinion ...

I will however continue to use purebasic but only for small projects ...

Note: I am writing this post in french because the author is french, do not see any lack of respect ...

8)

Re: LLVM

Posted: Wed Oct 27, 2010 2:52 pm
by DoubleDutch
Coolman: no problem. I know it's a shame that they couldn't have used this technology as it looks like a lot of big companies are helping with LLVM (adobe, apple, google, etc) - so imho it could save them time and effort in the long run. Maybe when PureBasic has the next big major release - I mean from 4.xx to 5.0 they may have a change of mind?

Re: LLVM

Posted: Wed Oct 27, 2010 4:54 pm
by blueznl
We will know before christmas :-)

Re: LLVM

Posted: Wed Oct 27, 2010 5:01 pm
by DoubleDutch
I don't think it be 5.0 before Christmas - I reckon this years present will be 4.60. ;)