[solved] OPTIMIZER-Flag - What asm optimizations?

Just starting out? Need help? Post your questions and find answers here.
juergenkulow
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 25, 2019 10:18 am

[solved] OPTIMIZER-Flag - What asm optimizations?

Post by juergenkulow »

What optimizations does /OPTIMIZER flag make in the ASM backend?

Since 6.01 beta 4: /OPTIMIZER:

Code: Select all

PureBasic 6.03 beta 9 LTS (Windows - x86)
Compiling H:\PB23_1\left.pb
Loading external libraries...
Starting compilation...
Optimizing asm output...      <-----------
14 lines processed.
Creating and launching executable.

- Feel the ..PuRe.. Power -
Last edited by juergenkulow on Wed Sep 27, 2023 8:04 am, edited 1 time in total.
Please ask your questions, because switch on the cognition apparatus decides on the only known life in the universe.Wersten :DDüsseldorf NRW Germany Europe Earth Solar System Flake Bubble Orionarm
Milky Way Local_Group Virgo Supercluster Laniakea Universe
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: OPTIMIZER-Flag - What asm optimizations?

Post by Kuron »

This is detailed in the blog (with examples), all it has ever done is a single pass optimization on the ASM code.

That said, FASM is a multi-pass assembler that makes a lot of code optimizations. So, it would appear that FASM is optimizing the ASM code, in addition to the single pass that PB does?
Best wishes to the PB community. Thank you for the memories. ♥️
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: OPTIMIZER-Flag - What asm optimizations?

Post by luis »

Kuron wrote: Mon Sep 25, 2023 6:53 pm This is detailed in the blog (with examples),
I've just quickly looked through all the posts and I didn't found one on the subject of ASM optimizations. Did I miss it ?

EDIT: My bad, I actually missed it, the title didn't help :)

Here it is: https://www.purebasic.fr/blog/?p=502
Kuron wrote: Mon Sep 25, 2023 6:53 pm That said, FASM is a multi-pass assembler that makes a lot of code optimizations.
I think it can optimize the size of the opcodes (to use the smaller ones when possible) but that's about it.
Unless you meant that... but it does not actually change the ASM code.
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: OPTIMIZER-Flag - What asm optimizations?

Post by Kuron »

luis wrote: Mon Sep 25, 2023 7:43 pm I think it can optimize the size of the opcodes (to use the smaller ones when possible) but that's about it.
Unless you meant that... but it does not actually change the ASM code.
Going strictly by this.
Best wishes to the PB community. Thank you for the memories. ♥️
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: OPTIMIZER-Flag - What asm optimizations?

Post by luis »

Yes, that's it, optimizing the size of the code by trying to select the smallest opcodes, for example for the jumps, where you have opcodes for near or far jumps with different sizes.
But the ASM code stays the same and it's not optimized in any way.

Some comments about this from its forum
https://board.flatassembler.net/topic.php?t=8593
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
Kuron
Addict
Addict
Posts: 1626
Joined: Sat Oct 17, 2009 10:51 pm
Location: Pacific Northwest

Re: OPTIMIZER-Flag - What asm optimizations?

Post by Kuron »

You should get them to rewrite the wikipedia page to say what you want it to say. :wink:
Best wishes to the PB community. Thank you for the memories. ♥️
User avatar
luis
Addict
Addict
Posts: 3895
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: OPTIMIZER-Flag - What asm optimizations?

Post by luis »

Kuron wrote: Mon Sep 25, 2023 11:19 pm You should get them to rewrite the wikipedia page to say what you want it to say. :wink:
Uh ? Already does that.
wikipedia wrote: It makes extensive code-size optimization and allows unconstrained forward referencing
It says "code-size" optimization and the second document linked there (number 7) talk about "code resolving" and that is what is used to select the optimal sized opcodes.
"Have you tried turning it off and on again ?"
A little PureBasic review
juergenkulow
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 25, 2019 10:18 am

Re: OPTIMIZER-Flag - What asm optimizations?

Post by juergenkulow »

Is there a sample program for optimizing asm output?
Fred
Administrator
Administrator
Posts: 18178
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: OPTIMIZER-Flag - What asm optimizations?

Post by Fred »

You can use the --commented switch to compare between optimized and none optimized asm output
Post Reply