Recent

Author Topic: Undocumented optimization compiler directives  (Read 4305 times)

Marladu

  • New Member
  • *
  • Posts: 19
Undocumented optimization compiler directives
« on: January 21, 2015, 04:41:34 pm »
 Digging through the compiler code I happened to find compiler directives related to optimization that are accepted by the compiler but that I don't know what they do. Here's the list (found in globtype.pas):

{$OPTIMIZATION STRENGTH}: unknown?
{$OPTIMIZATION SCHEDULE}: unknown?
{$OPTIMIZATION AUTOINLINE}:guessing it's like delphi {$inline auto}? what rules does it follow?
{$OPTIMIZATION USERBP}: guessing it's a 64bit version of {$OPTIMIZATION USEEBP}?
{$OPTIMIZATION FASTMATH}, {$OPTIMIZATION DEADVALUES}, {$OPTIMIZATION DEADSTORE}: nicely documented at http://wiki.freepascal.org/FPC_New_Features_Trunk#Code_generator

 So, anyone got details on what the first 4 do?

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Undocumented optimization compiler directives
« Reply #1 on: January 21, 2015, 05:41:37 pm »
I don't expect you to see answers here. Try a suitable mailing list or move your post under Free Pascal where FPK is a moderator.

{$OPTIMIZATION USERBP}: guessing it's a 64bit version of {$OPTIMIZATION USEEBP}?
Yes.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Undocumented optimization compiler directives
« Reply #2 on: January 21, 2015, 05:43:11 pm »
Strength is probably "Strength Reduction" (look up in wikipedia), hoisting code out of loops.

Schedule is probably instruction level scheduling.

Marladu

  • New Member
  • *
  • Posts: 19
Re: Undocumented optimization compiler directives
« Reply #3 on: January 21, 2015, 06:20:49 pm »
 Darn, I though I had posted in freepascal-general, my bad, apologies. Still, the answers are plenty good and appreciated, thanks!

 I had forgotten to write about {$OPTIMIZATION FORCENOSTACKFRAME} but it doesn't seem to do anything at this time, I'm guessing when implemented it will force a nostackframe on every function where it works. For {$OPTIMIZATION AUTOINLINE} I tested it and it works, inlining small functions it can even without the inline function modifier, just don't know what rules it follows. Only did limited testing with {$OPTIMIZATION FASTMATH} but so far it looks very very excellent at improving speed of unoptimized floating point operations, and I didn't observe any precision loss as warned in those small tests.

 

TinyPortal © 2005-2018