[fpc-devel] Different versions of register name search algorithms used
christo.crause at gmail.com
Wed May 20 18:09:30 CEST 2020
While trying to understand bug 0037121I noticed that the predominant search
algorithm used for finding register names is a binary search without a
match check. My understanding of this algorithm is that it will always run
the maximum iterations for the search space before terminating. To
understand how this is supposed to work I looked at other target
implementations. I realized that this algorithm is used in all but 2
cases: x86 (in itx86int.pas) which uses (what I consider to be) a
conventional binary search, and mips which uses a linear search.
I don't see a need to have different algorithms for performing what appears
to be the same function (search for a string in a sorted list of strings),
is this correct?
Then, I don't understand why the general search algorithm isn't the one in
itx86int.pas. Is there a compelling reason for preferring the 1st
algorithm over the conventional binary search?
Thirdly, each target has its own implementation of findreg_by_XXXname, is
there a reason not to have a single search function shared by all targets?
This may require some renaming of current variable lists such as
gas_regname_index and int_regname_index etc. to a common convention.
Your thoughts on these questions would be appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-devel