mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 21:00:28 +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_supreg = RS_INVALID;
|
||||||
first_mm_imreg = 0;
|
first_mm_imreg = 0;
|
||||||
|
|
||||||
regnumber_count_bsstart = 32;
|
|
||||||
|
|
||||||
regnumber_table : array[tregisterindex] of tregister = (
|
regnumber_table : array[tregisterindex] of tregister = (
|
||||||
{$i ravrnum.inc}
|
{$i ravrnum.inc}
|
||||||
);
|
);
|
||||||
|
@ -53,39 +53,21 @@ interface
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
cutils,verbose;
|
cutils,verbose,rgbase;
|
||||||
|
|
||||||
const
|
const
|
||||||
gas_regname_table : array[tregisterindex] of string[7] = (
|
gas_regname_table : TRegNameTable = (
|
||||||
{$i ravrstd.inc}
|
{$i ravrstd.inc}
|
||||||
);
|
);
|
||||||
|
|
||||||
gas_regname_index : array[tregisterindex] of tregisterindex = (
|
gas_regname_index : TRegisterIndexTable = (
|
||||||
{$i ravrsri.inc}
|
{$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;
|
function gas_regnum_search(const s:string):Tregister;
|
||||||
begin
|
begin
|
||||||
result:=regnumber_table[findreg_by_gasname(s)];
|
result:=regnumber_table[findreg_by_name_table(s,gas_regname_table,gas_regname_index)];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user