<HTML>
<style> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</style><br>
<div>I've only really researched and improved the 
peephole optimizer, which is the assembler stage.  I'm not sure how much
 optimisation is done at earlier stages, but I do know that care is 
taken in deciding the best implementation of a case block, for example, 
evaluating factors such as how many separate branches there are.</div><div><br>
 
</div><div>As it currently stands, pure function evaluation would be at 
the pre-compilation stage, where Pascal code is converted into 
platform-independent nodes.</div><div><br>
 
</div><div>Gareth</div> <br>
<br>
<span style="font-weight: bold;">On Mon 09/07/18 03:33 , "R0b0t1" r030t1@gmail.com sent:<br>
</span><blockquote style="BORDER-LEFT: #F5F5F5 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">n Sun, Jul 8, 2018 at 9:07 PM, Dmitry Boyarintsev
<br>

<<a href="javascript:top.opencompose('skalogryz.lists@gmail.com','','','')">skalogryz.lists@gmail.com</a>> wrote:
<br>

<span style="color: rgb(102, 102, 102);">>
</span><br>

<span style="color: rgb(102, 102, 102);">> On Sun, Jul 8, 2018 at 8:15 PM, J. Gareth Moreton
</span><br>

<span style="color: rgb(102, 102, 102);">> <<a href="javascript:top.opencompose('gareth@moreton-family.com','','','')">gareth@moreton-family.com</a>> wrote:
</span><br>

<span style="color: rgb(102, 102, 102);">>>
</span><br>

<span style="color: rgb(102, 102, 102);">>> Yes, if any parameters are variables, then the function is not evaluated.
</span><br>

<span style="color: rgb(102, 102, 102);">>> My intention is that the purity of a function is only determined when it
</span><br>

<span style="color: rgb(102, 102, 102);">>> comes to evaluating it in an expression, but because of how complex
</span><br>

<span style="color: rgb(102, 102, 102);">>> functions can become, the "pure" directive hints to the compiler that the
</span><br>

<span style="color: rgb(102, 102, 102);">>> given function is pure and it should attempt the laborous task of evaluating
</span><br>

<span style="color: rgb(102, 102, 102);">>> it, rather than the opposite approach of attempting to evaluate all
</span><br>

<span style="color: rgb(102, 102, 102);">>> functions with constant actual parameters and potentially increasing the
</span><br>

<span style="color: rgb(102, 102, 102);">>> compilation time by several orders of magnitude (don't forget it might be
</span><br>

<span style="color: rgb(102, 102, 102);">>> attempting to do the same thing with system functions if the project is
</span><br>

<span style="color: rgb(102, 102, 102);">>> undergoing a full build).
</span><br>

<span style="color: rgb(102, 102, 102);">>
</span><br>

<span style="color: rgb(102, 102, 102);">>
</span><br>

<span style="color: rgb(102, 102, 102);">>  if FPC assembler reader powerful enough to analyze and trust assembler
</span><br>

<span style="color: rgb(102, 102, 102);">> functions marked as pure?
</span><br>

<span style="color: rgb(102, 102, 102);">>
</span><br>


<br>

At which stages is optimization done? GCC's backend optimizes each
<br>

step in compilation (as I am aware), i.e. GENERIC -> GIMPLE -> RTL ->
<br>

assembly. Many optimizations work best or are only possible at a
<br>

certain stage.
<br>


<br>

The various representations are also what makes analysis efficient.
<br>

Most optimization passes do not happen on assembly.
<br>

<br>

<br>

</blockquote></HTML>