[fpc-devel] Case block optimisation
J. Gareth Moreton
gareth at moreton-family.com
Sat Dec 15 20:12:20 CET 2018
I'll see what I can do!
The one thing about my case optimisations here is that they're done at the
node level. Some parts are platform-independent, but unfortunately,
things like jump table generation have to be implemented for each platform.
The aint shuffling is a little difficult to test for sure, but what's
worse is the use of TConstExprInt, and not just because of the overhead
involved with reading and writing to them. I used logic in some places
though, like when I do a sort of for-loop between max_ and hv, I subtracted
1 from each variable (sometimes implicitly) to account for a potential
overflow situation. It's impossible for it to trigger an underflow
because max_ is greater than min_, and they wouldn't be equal otherwise a
jump table won't even be generated.
Either way, I'm just enjoying myself with this!
Gareth aka. Kit
On Sat 15/12/18 19:55 , Martok listbox at martoks-place.de sent:
Am 15.12.2018 um 18:08 schrieb J. Gareth Moreton:
> So here's something else I've been playing with in the interim... I've
been
> working on improving the algorithms used when compiling case blocks.
It was
> driven partly by my binary search idea for certain kinds of case block,
which I
> wrote up over here:
http://wiki.freepascal.org/Case_Compiler_Optimization
[1]">http://wiki.freepascal.org/Case_Compiler_Optimization
Feel free to include '0033093_Casenode_order.patch' from
[2];
It's actually already a bit simpler in your version ;-)
The one thing that still bugs me (but I know it's not really seen as a
problem
in FPC) is that every platform cg theoretically has to implement all of
that,
causing a lot of duplication.
I like the use of more expressive intermediate names. But there was a lot
of
overflowed-aint-shuffling, are you sure that still works everywhere?
Bug 0032115 provides a "nice" test case for things that can go wrong with
different word sizes, and is also a good test for the true label count.
--
Regards,
Martok
_______________________________________________
fpc-devel maillist - fpc-devel at lists.freepascal.org [3]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[4]">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Links:
------
[1] http://wiki.freepascal.org/Case_Compiler_Optimization
[2] https://bugs.freepascal.org/view.php?id=33093
[3] mailto:fpc-devel at lists.freepascal.org
[4] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20181215/1113290b/attachment.html>
More information about the fpc-devel
mailing list