mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 10:48:12 +02:00
* avr: patch by Christo Crause: replace findreg_by_gasname with gas_regname_table, resolves #37131
git-svn-id: trunk@45509 -
This commit is contained in:
parent
4a6080d602
commit
37a3b542e6
@ -111,8 +111,6 @@ unit cpubase;
|
||||
first_mm_supreg = RS_INVALID;
|
||||
first_mm_imreg = 0;
|
||||
|
||||
regnumber_count_bsstart = 32;
|
||||
|
||||
regnumber_table : array[tregisterindex] of tregister = (
|
||||
{$i ravrnum.inc}
|
||||
);
|
||||
|
@ -53,39 +53,21 @@ interface
|
||||
implementation
|
||||
|
||||
uses
|
||||
cutils,verbose;
|
||||
cutils,verbose,rgbase;
|
||||
|
||||
const
|
||||
gas_regname_table : array[tregisterindex] of string[7] = (
|
||||
gas_regname_table : TRegNameTable = (
|
||||
{$i ravrstd.inc}
|
||||
);
|
||||
|
||||
gas_regname_index : array[tregisterindex] of tregisterindex = (
|
||||
gas_regname_index : TRegisterIndexTable = (
|
||||
{$i ravrsri.inc}
|
||||
);
|
||||
|
||||
function findreg_by_gasname(const s:string):tregisterindex;
|
||||
var
|
||||
i,p : tregisterindex;
|
||||
begin
|
||||
{Binary search.}
|
||||
p:=0;
|
||||
i:=regnumber_count_bsstart;
|
||||
repeat
|
||||
if (p+i<=high(tregisterindex)) and (gas_regname_table[gas_regname_index[p+i]]<=s) then
|
||||
p:=p+i;
|
||||
i:=i shr 1;
|
||||
until i=0;
|
||||
if gas_regname_table[gas_regname_index[p]]=s then
|
||||
findreg_by_gasname:=gas_regname_index[p]
|
||||
else
|
||||
findreg_by_gasname:=0;
|
||||
end;
|
||||
|
||||
|
||||
function gas_regnum_search(const s:string):Tregister;
|
||||
begin
|
||||
result:=regnumber_table[findreg_by_gasname(s)];
|
||||
result:=regnumber_table[findreg_by_name_table(s,gas_regname_table,gas_regname_index)];
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user