Page 1 of 1

LLVM vs Pure ASM

Posted: Mon Jan 30, 2017 2:00 am
by monobogdan
Yes, it's really stupid question, but, what better is LLVM or Pure ASM generation?

LLVM is easy but generates garbage

Pure is only for single architecture, but no garbage or anything.

Re: LLVM vs Pure ASM

Posted: Mon Jan 30, 2017 2:04 am
by monobogdan
P.S it's theme for selecting code generation tehnique for my compiler, not only opinion based.

Re: LLVM vs Pure ASM

Posted: Mon Jan 30, 2017 2:09 am
by Roman
If you think that you're smarter and have more man-years than all the people behind LLVM then pure assembly is better.
LLVM is easy but generates garbage
This is false.

Re: LLVM vs Pure ASM

Posted: Mon Jan 30, 2017 2:15 am
by glauxosdever
Hi,


My final compiler will generate some kind of pre-optimised AST, instead of machine-code object files. Then the AST files will be linked together into another AST file, which will be copied to the standard library directory, or converted into machine code executables on the end-user's machine.

However, for the initial compiler I'll (most likely) use LLVM's backend to speed up on development time. This way, in order to have good optimisations between different objects, LLVM's IR is probably the only sane option.

What I'm saying is that LLVM's IR isn't exactly ideal, but it's probably the best of what we have now.


Regards,
glauxosdever

Re: LLVM vs Pure ASM

Posted: Mon Jan 30, 2017 2:19 am
by monobogdan
glauxosdever wrote:Hi,


My final compiler will generate some kind of pre-optimised AST, instead of machine-code object files. Then the AST files will be linked together into another AST file, which will be copied to the standard library directory, or converted into machine code executables on the end-user's machine.

However, for the initial compiler I'll (most likely) use LLVM's backend to speed up on development time. This way, in order to have good optimisations between different objects, LLVM's IR is probably the only sane option.

What I'm saying is that LLVM's IR isn't exactly the best solution, but it's probably the best of what we have now.


Regards,
glauxosdever
LLVM can't compile bootsector, it's too large.

Re: LLVM vs Pure ASM

Posted: Mon Jan 30, 2017 2:35 am
by dchapiesky
monobogdan wrote: LLVM can't compile bootsector, it's too large.
This is false.

llvm.org - read the docs

Re: LLVM vs Pure ASM

Posted: Mon Jan 30, 2017 2:37 am
by dchapiesky
glauxosdever wrote:Hi,


My final compiler will generate some kind of pre-optimised AST, instead of machine-code object files. Then the AST files will be linked together into another AST file, which will be copied to the standard library directory, or converted into machine code executables on the end-user's machine.

However, for the initial compiler I'll (most likely) use LLVM's backend to speed up on development time. This way, in order to have good optimisations between different objects, LLVM's IR is probably the only sane option.

What I'm saying is that LLVM's IR isn't exactly ideal, but it's probably the best of what we have now.


Regards,
glauxosdever
In the context of your example - llvm shines since you can write custom "passes" which allow you to modify the AST... so as you try different optimizations you can snapshot the AST, compare the AST, etc... google has some really nice llvm AST manipulation tools

Re: LLVM vs Pure ASM

Posted: Mon Jan 30, 2017 3:16 am
by dozniak
monobogdan wrote: LLVM can't compile bootsector, it's too large.
Your misconceptions drive your desire to develop bicycles and invent wheels instead of learning something useful from already made projects. You may start getting smarter and read, or keep writing.

Re: LLVM vs Pure ASM

Posted: Mon Jan 30, 2017 4:31 am
by monobogdan
dchapiesky wrote:
glauxosdever wrote:Hi,


My final compiler will generate some kind of pre-optimised AST, instead of machine-code object files. Then the AST files will be linked together into another AST file, which will be copied to the standard library directory, or converted into machine code executables on the end-user's machine.

However, for the initial compiler I'll (most likely) use LLVM's backend to speed up on development time. This way, in order to have good optimisations between different objects, LLVM's IR is probably the only sane option.

What I'm saying is that LLVM's IR isn't exactly ideal, but it's probably the best of what we have now.


Regards,
glauxosdever
In the context of your example - llvm shines since you can write custom "passes" which allow you to modify the AST... so as you try different optimizations you can snapshot the AST, compare the AST, etc... google has some really nice llvm AST manipulation tools
may be my acknowledge about llvm is too small.

So, i'm try to port tcc to OGDOS.

It's seems to be interestring.

Re: LLVM vs Pure ASM

Posted: Mon Jan 30, 2017 12:05 pm
by Boris
Garbage comes when you feed something with wrong input. Did you tell llvm to generate 16 bit code ?

I think if you don't know what you do , llvm will help you reducing your code size

Re: LLVM vs Pure ASM

Posted: Mon Jan 30, 2017 9:47 pm
by dchapiesky
monobogdan wrote:So, i'm try to port tcc to OGDOS.
tcc is good --- though there is a version for 64bit if you look for it...

tcc shouldn't need much of a port at all

post if you need help

cheers

Re: LLVM vs Pure ASM

Posted: Tue Jan 31, 2017 1:28 am
by monobogdan
dchapiesky wrote:
monobogdan wrote:So, i'm try to port tcc to OGDOS.
tcc is good --- though there is a version for 64bit if you look for it...

tcc shouldn't need much of a port at all

post if you need help

cheers
Hm. May be make freedos kernel only... first stage kernel? Like in windows.

ntoskrnl is like to first stage kernel(and main kernel), kernel32.dll is api to kernel(and may be kernel stage two because it's 32 bit).

So, example boot scheme:

FreeDOS bootloader->FreeDOS kernel->32 bit bootloader->32 bit kernel->GUI