Commit Graph

4 Commits

Author SHA1 Message Date
pierre
1351ccb3bf Avoid range check errors
git-svn-id: trunk@48317 -
2021-01-22 12:51:53 +00:00
florian
f62fd437b1 * patch by J. Gareth Moreton: improve test and benchmark, resolves #35633
git-svn-id: trunk@43671 -
2019-12-10 21:31:42 +00:00
florian
1641585655 * updated bcase.pp benchmark by Gareth Moreton, now used also as test
git-svn-id: trunk@40710 -
2018-12-30 22:21:03 +00:00
florian
7f5c2fa3aa * (modified) patch by Gareth Moreton: Speed improvement in case blocks, resolves #0034762
This patch improves the compiler where "case" statements are concerned, using jump tables more often and creating more efficient machine code in some situations:
  * If a case block only contains one branch (not including the else block), the initial range check is removed, since this becomes wasted effort.
  * If the else block is empty, the else label is set to the end label - though this doesn't decrease the code size, it takes a bit of strain off the peephole optimizer.
  * On -O2 and above, some node analysis is now done on the branch labels. Most of the time this just redirects it to the end
    label for empty blocks, but if the block contains a goto statement, it will redirect it to its destination instead,
    thus increasing performance by not having multiple jumps (this won't get picked up by the peephole optimiser if the label addresses are in a jump table).
  * Some checks now use what I call the 'true count' rather than the 'label count'. The true count includes each
    individual value in a range - for example, 0..2 counts as 3. This increases the chance that a jump table will be
    utilised in situations where it is more efficient than a linear list.
  * For jump tables, if the case block almost covers the entire range (32 entries or fewer from full coverage),
    the initial range check is removed and the gaps included in the jump table (pointing to the else label).

git-svn-id: trunk@40676 -
2018-12-27 18:31:55 +00:00