mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 22:49:17 +02:00
* m68k: fix index register usage in memory references, when the index is 8 or 16 bit wide and unsigned
git-svn-id: trunk@46886 -
This commit is contained in:
parent
60bd9c5ba0
commit
de180d7656
@ -109,17 +109,24 @@ implementation
|
||||
end;
|
||||
location.reference.base:=maybe_const_reg;
|
||||
end
|
||||
else if location.reference.index=NR_NO then
|
||||
begin
|
||||
location.reference.index:=maybe_const_reg;
|
||||
if (scaled) then
|
||||
location.reference.scalefactor:=l;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if location.reference.index<>NR_NO then
|
||||
begin
|
||||
{ if we already have an index register, dereference the ref to a new base, to be able to insert an index }
|
||||
hreg:=cg.getaddressregister(current_asmdata.CurrAsmList);
|
||||
cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,location.reference,hreg);
|
||||
reference_reset_base(location.reference,hreg,0,location.reference.temppos,location.reference.alignment,location.reference.volatility);
|
||||
end;
|
||||
if def_cgsize(regsize) in [OS_8,OS_16] then
|
||||
begin
|
||||
{ index registers are always sign extended on m68k, so we have to zero extend by hand,
|
||||
if the index variable is unsigned, and its width is less than the whole register }
|
||||
//current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('updref: index zero extend')));
|
||||
hreg:=cg.getintregister(current_asmdata.CurrAsmList,OS_ADDR);
|
||||
cg.a_load_reg_reg(current_asmdata.CurrAsmList,def_cgsize(regsize),OS_ADDR,maybe_const_reg,hreg);
|
||||
maybe_const_reg:=hreg;
|
||||
end;
|
||||
{ insert new index register }
|
||||
location.reference.index:=maybe_const_reg;
|
||||
if (scaled) then
|
||||
|
Loading…
Reference in New Issue
Block a user