C-Backend
-
- Enthusiast
- Posts: 503
- Joined: Tue Oct 14, 2014 12:09 pm
C-Backend
Hi all,
It would be verypleased if someone can explain what is C-Backend ant the utility For purebasic.
THanks
It would be verypleased if someone can explain what is C-Backend ant the utility For purebasic.
THanks
-
- Addict
- Posts: 1443
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: C-Backend
Simply put it is a translator in the C language. https://www.purebasic.fr/blog/?p=480
Prior to version 6.00, a translator in the assembler language was used.
Prior to version 6.00, a translator in the assembler language was used.
Re: C-Backend
A new way for your code to be compiled, using superior-performance code. See here -> https://www.purebasic.fr/blog/
As you'll see there, just using the C backend compiler (in Compiler Options) for the graphics test app increased its speed by 50%, without the developer changing a single line in his code. It's fantastic!
Others will explain it better than I, but that's a major improvement in itself.
As you'll see there, just using the C backend compiler (in Compiler Options) for the graphics test app increased its speed by 50%, without the developer changing a single line in his code. It's fantastic!
Others will explain it better than I, but that's a major improvement in itself.
Re: C-Backend
In PB the 'backend' is the part which translates the PB code to the language of the used tool to generate machine code.
Up to PB 5.73 the tool to generate the machine code is the fasm compiler. So the backend translates the PB code to fasm assembler.
A (f)asm-backend.
From PB 6.0 onwards it is possible to use a C-backend (at the moment a gcc-backend).
It tranlates the PB code to c code for the gcc compiler.
There are several advantages:
Since C is a highlevel language, the c compiler can optimize the generated machine code.
And since gcc is very 'old' and has a very large community, the optimizations are very good.
Fred does not need to do the optimze stuff by himself, like in the asm backend.
The used gcc is available on many architectures, not only x86 or x64.
So it is possible to use PB on a raspberry pi with linux as OS. The cpu is an arm derivate.
But it doesn't matter, since gcc does this part.
But there is also a (small) price to pay:
The generated machine code (executable) can get larger.
The compilation time is longer, since gcc is not a one parse compiler.
It needs more loops over the c code to generate the best optimized machine code.
Summary:
Fred has less work to maintenance the optimizations and don't need to take care of the underlaying CPU type,
as long as the OS is supported by PB.
Up to PB 5.73 the tool to generate the machine code is the fasm compiler. So the backend translates the PB code to fasm assembler.
A (f)asm-backend.
From PB 6.0 onwards it is possible to use a C-backend (at the moment a gcc-backend).
It tranlates the PB code to c code for the gcc compiler.
There are several advantages:
Since C is a highlevel language, the c compiler can optimize the generated machine code.
And since gcc is very 'old' and has a very large community, the optimizations are very good.
Fred does not need to do the optimze stuff by himself, like in the asm backend.
The used gcc is available on many architectures, not only x86 or x64.
So it is possible to use PB on a raspberry pi with linux as OS. The cpu is an arm derivate.
But it doesn't matter, since gcc does this part.
But there is also a (small) price to pay:
The generated machine code (executable) can get larger.
The compilation time is longer, since gcc is not a one parse compiler.
It needs more loops over the c code to generate the best optimized machine code.
Summary:
Fred has less work to maintenance the optimizations and don't need to take care of the underlaying CPU type,
as long as the OS is supported by PB.
Re: C-Backend
Looking forward to compile my [in PB written] apps natively to a Apple M1 CPU
I am to provide the public with beneficial shocks.
Alfred Hitshock
Re: C-Backend
My Mac Mini M1 should get home today
Re: C-Backend
I.e. the linux version, including the ARM version, will not be waiting in the near future? All the attention will be devoted to MAC?
Dawn will come inevitably.
Re: C-Backend
Apples M1 is ARM based
But if you read and understand the stuff above you should know now that the CPU doesn't matter as long there is gcc available for it
and the OS is an already supported one.
But if you read and understand the stuff above you should know now that the CPU doesn't matter as long there is gcc available for it
and the OS is an already supported one.
Re: C-Backend
Hello, i understand what PB can write code for ARM?
¿Can write app for android?
Sorry my ignorance..
Greetings and thanks for the great tool PB!!
¿Can write app for android?
Sorry my ignorance..
Greetings and thanks for the great tool PB!!
If translation=Error: reply="Sorry, Im Spanish": Endif
Re: C-Backend
No(t yet). Maybe in the future, but that's not priority. And there's more to do than just switch the compiler.
I would pay an extra 80 bucks for PureBasic for Android. Like, the compiler as an extra, would be cool.
I would pay an extra 80 bucks for PureBasic for Android. Like, the compiler as an extra, would be cool.
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
- the.weavster
- Addict
- Posts: 1537
- Joined: Thu Jul 03, 2003 6:53 pm
- Location: England