llvm-2.9 hello llvm-PB world

Linux specific forum
DoctorLove
User
User
Posts: 85
Joined: Sat Mar 06, 2010 2:55 pm

Re: llvm-2.9 hello llvm-PB world

Post by DoctorLove »

Damnit Idle! Wonderfull work.

Can we help with something?
User avatar
idle
Always Here
Always Here
Posts: 5844
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: llvm-2.9 hello llvm-PB world

Post by idle »

DoctorLove wrote:Damnit Idle! Wonderfull work.

Can we help with something?
Thanks, if you have mac or windows, you could try to build llvm for them.
Mac shouldn't be a problem, it may even have a shared object of LLVM on it already.

Windows I tried and failed, I couldn't get minGW to build a working dll but since it takes ~1.5 hours to build
it's not much fun when the thing fails or doesn't work.
Someone has offered to have a go at it but I think they'll likely have better ways to watch grass grow.

As for the code gen framework the problematic parts are worked out.
I still have to look at implementing vectors for mmx simd though that isn't a high priority.
Windows 11, Manjaro, Raspberry Pi OS
Image
DoctorLove
User
User
Posts: 85
Joined: Sat Mar 06, 2010 2:55 pm

Re: llvm-2.9 hello llvm-PB world

Post by DoctorLove »

I do have both.

I will try to get it build on the Mac OSX and Windows this week.
Its difficult when you have to wait 1,5 hours to compile everytime.

And if it still crashes afterwards you get crazy.
User avatar
idle
Always Here
Always Here
Posts: 5844
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: llvm-2.9 hello llvm-PB world

Post by idle »

OSX won't be a problem, it'll be the same as the Linux build

Windows is a bit more involved


llvm Setup for MinGW Windows takes around an hour 1/4 (in xp vm anyway)

Whats needed: links to downloads are supplied
WinRar
MinGW with msys
Python 2.7
(may also need tcl)


If you don't have winrar and you want to build llvm you'll need it to extract the archive
Download WinRar
http://www.rarlab.com/rar/wrar401.exe

Download MinGW
http://sourceforge.net/projects/mingw/f ... e/download

Run the installer
IMPORTANT _>>>> check Msys check box
>>>> check C++ compiler (not sure if it's needed but I did it anyway)
Install to C:\MinGW

Use the latest catalouge instead of the precompiled one (in case theres something missing)
set it going and then go make a coffee ~15 minutes

Once installed
you may want to set up environment vars for minGW (don't know if its required but I did it anyway)
XP click start -> right click MyComputer -> advanced Tab -> environment vars
edit Path add C:\MinGW\;C:\MinGW\Bin\;C:\MinGW\lib\;

IMPORTANT >>>> Download python 2.7.2 binary not version 3 or the build will fail halfway through
http://www.python.org/ftp/python/2.7.2/python-2.7.2.msi

Intall Python to where ever
IMPORTANT >>> then copy all the files under Python27\ directly to c:\MinGW\bin


Download llvm sources
IMPORTANT >>>> get the 2.8 version 2.9 is currently broken (probably a missing dependency in minGW)
http://llvm.org/releases/2.8/llvm-2.8.tgz

extract to C:\ so you have c:\llvm-2.8

Time to build, Cross Fingers!

open cmd prompt start > run type in cmd
> cd C:\minGW\msys\1.0
> msys

In the msys shell
> cd c:\llvm-2.8
> configure --enable-shared
(may also need to add --enable-optimized on that command)

wait it may hang for a moment before outputting results to console
A good time to go off and make a coffee while it checks everything!
takes ~15 to 20 minutes

When it's back to msys prompt
> make

Go and do something for ~30 to 40 minutes
Windows 11, Manjaro, Raspberry Pi OS
Image
DoctorLove
User
User
Posts: 85
Joined: Sat Mar 06, 2010 2:55 pm

Re: llvm-2.9 hello llvm-PB world

Post by DoctorLove »

Hey Idle,

As promised.

I have compiled the windows with Succes! It was all done within 20 minutes. So, i had only 2 cups of coffee, Grrr ;)

Well,
Here is the package from the \Release dir.
If you need anything more, let me know!

Download:
http://www.2shared.com/file/VaJlViUl/LL ... 72011.html
User avatar
graph100
Enthusiast
Enthusiast
Posts: 115
Joined: Tue Aug 10, 2010 3:17 pm

Re: llvm-2.9 hello llvm-PB world

Post by graph100 »

you must not have the same machine as Idle :mrgreen:

@Idle : I don't understand (though I didn't go and do extensive research :oops: ), llvm must be built under window. But does a user for a program regenerated by your compiler must have a built llvm version ?
If i understand well, llvm is installed on smartphone and device like this ?

Has you to built a llvm for each computer which need it, or a llvm built on one can be of use on an another ?
_________________________________________________
My Website : CeriseCode (Warning : perpetual changes & not completed ;))
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: llvm-2.9 hello llvm-PB world

Post by DoubleDutch »

DoctorLove: Thanks. :)

Graph100: llvm is/can be an 'in-between' machine. From that the llvm compiler compiles to native (or the destination) code. By using llvm you can cross compile to many different machines. All you need is the libraries then. An llvm interpreter is also available for debuggng. Apple are/have moved to llvm for their compiler for OSX and IOS.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
idle
Always Here
Always Here
Posts: 5844
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: llvm-2.9 hello llvm-PB world

Post by idle »

DoctorLove wrote: I have compiled the windows with Succes! It was all done within 20 minutes. So, i had only 2 cups of coffee, Grrr ;)
Thanks, that sure beat the hour and half it took to build in the xp VM.
maybe you could try compiling llvm 2.9, I think the problem I had building it was related to the VM
and if you could add the build instructions that would be great.

@graph100

you only need llvm on the host OS your developing on
though to cross compile to native code for other platforms you would need their native libs
but since llvm has a JIT you can also ship your code in byte code
and compile it at install time by using an installer program that contains (app bc, 3rd party libs, Jit engine, assembler, linker)
so a user could try the App (Jit and run) or install (assemble,link) write to file.

the current state compiling from PB source

[done]
types (all PB primitive types including constant strings)
variables
constants
binary operations
If,Else,ElseIf
For While Repeat (forever/until) : Break, Continue
Procedures
Imports (not tested on external libs yet)
Function calls
Type casting
Select
Arrays
structures
[/done]

[todo]
pointers
logical And Or .. with IF
nesting eg ThisFoo(ThatFoo(x,y),b)
Memory ...peek poke
strings
[/todo]

While it's compiling source there's still a bit to do to refine in the parser
(i've been lazy and still need to add in the error checking for a lot of things)
Will add passing and returning structures by arrays and value and eventually unsigned types
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
idle
Always Here
Always Here
Posts: 5844
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: llvm-2.9 hello llvm-PB world

Post by idle »

I just tried the windows dll in the vm and alas it had the same result as the one I'd built.

It creates a context and then fails to create a module, on the chance that it's a problem with the VM
can someone test it in a native windows install

http://www.idlearts.com/llvm2.8Win.zip

ps you will need to change include file name in the tests, i forgot to change them!
Last edited by idle on Sat Jul 30, 2011 9:37 pm, edited 1 time in total.
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: llvm-2.9 hello llvm-PB world

Post by DoubleDutch »

clicking the link is a 404 error...
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
idle
Always Here
Always Here
Posts: 5844
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: llvm-2.9 hello llvm-PB world

Post by idle »

case sensitive :oops:
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Re: llvm-2.9 hello llvm-PB world

Post by DoubleDutch »

Sorted, dloading now...
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
User avatar
fsw
Addict
Addict
Posts: 1603
Joined: Tue Apr 29, 2003 9:18 pm
Location: North by Northwest

Re: llvm-2.9 hello llvm-PB world

Post by fsw »

@Idle
pretty neat what you have accomplished so far.

Question:
Is it possible to create native executable for 32/64 bit Windows with the llvm dll you provided?

BTW:
installed msys with mingw, python2.7 and went to compile llvm using your instructions.
Sadly "make" doesn't finish it's job, but shows an error as it's not able to create Intrinsics.ge.tmp.

There is also an error message box saying:

---------------------------
tblgen.exe - Application Error
---------------------------
The application failed to initialize properly (0xc0000005). Click on OK to terminate the application.
---------------------------
OK
---------------------------

The only nice thing was that the configure step finished in 2 minutes and 5 seconds :mrgreen

bye

EDIT: forgot to mention that I tried it on WindowsXP-SP3...
User avatar
idle
Always Here
Always Here
Posts: 5844
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: llvm-2.9 hello llvm-PB world

Post by idle »

I haven't been able to get a working Dll compiled on windows XP SP3
They may have released version 3.0 by now so maybe I can try again with that.
Also I hit a bit of a bump dealing with compounded statements in the parser and code generator which caused a bit of frustration
and haven't had the time to focus on it, a case of don't want to break it, so it's sitting on the to do list while I reconsider the problem.
Windows 11, Manjaro, Raspberry Pi OS
Image
Post Reply