mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 02:49:21 +02:00
* loading of references with small offsets fixed
git-svn-id: trunk@575 -
This commit is contained in:
parent
caced33fed
commit
94b97e8898
@ -616,6 +616,8 @@ unit cgcpu;
|
|||||||
not(is_pc(ref.base)) and
|
not(is_pc(ref.base)) and
|
||||||
not(is_pc(ref.index))
|
not(is_pc(ref.index))
|
||||||
) or
|
) or
|
||||||
|
{ [#xxx] isn't a valid address operand }
|
||||||
|
((ref.base=NR_NO) and (ref.index=NR_NO)) or
|
||||||
(ref.offset<-4095) or
|
(ref.offset<-4095) or
|
||||||
(ref.offset>4095) or
|
(ref.offset>4095) or
|
||||||
((oppostfix in [PF_SB,PF_H,PF_SH]) and
|
((oppostfix in [PF_SB,PF_H,PF_SH]) and
|
||||||
@ -630,21 +632,24 @@ unit cgcpu;
|
|||||||
) then
|
) then
|
||||||
begin
|
begin
|
||||||
reference_reset(tmpref);
|
reference_reset(tmpref);
|
||||||
{ create consts entry }
|
|
||||||
objectlibrary.getlabel(l);
|
|
||||||
cg.a_label(current_procinfo.aktlocaldata,l);
|
|
||||||
tmpref.symboldata:=current_procinfo.aktlocaldata.last;
|
|
||||||
|
|
||||||
if assigned(ref.symbol) then
|
{ load symbol }
|
||||||
current_procinfo.aktlocaldata.concat(tai_const.create_sym_offset(ref.symbol,ref.offset))
|
|
||||||
else
|
|
||||||
current_procinfo.aktlocaldata.concat(tai_const.Create_32bit(ref.offset));
|
|
||||||
|
|
||||||
{ load consts entry }
|
|
||||||
tmpreg:=getintregister(list,OS_INT);
|
tmpreg:=getintregister(list,OS_INT);
|
||||||
tmpref.symbol:=l;
|
if assigned(ref.symbol) then
|
||||||
tmpref.base:=NR_R15;
|
begin
|
||||||
list.concat(taicpu.op_reg_ref(A_LDR,tmpreg,tmpref));
|
objectlibrary.getlabel(l);
|
||||||
|
cg.a_label(current_procinfo.aktlocaldata,l);
|
||||||
|
tmpref.symboldata:=current_procinfo.aktlocaldata.last;
|
||||||
|
|
||||||
|
current_procinfo.aktlocaldata.concat(tai_const.create_sym_offset(ref.symbol,ref.offset));
|
||||||
|
|
||||||
|
{ load consts entry }
|
||||||
|
tmpref.symbol:=l;
|
||||||
|
tmpref.base:=NR_R15;
|
||||||
|
list.concat(taicpu.op_reg_ref(A_LDR,tmpreg,tmpref));
|
||||||
|
end
|
||||||
|
else
|
||||||
|
a_load_const_reg(list,OS_ADDR,ref.offset,tmpreg);
|
||||||
|
|
||||||
if (ref.base<>NR_NO) then
|
if (ref.base<>NR_NO) then
|
||||||
begin
|
begin
|
||||||
@ -1085,8 +1090,8 @@ unit cgcpu;
|
|||||||
) then
|
) then
|
||||||
fixref(list,tmpref);
|
fixref(list,tmpref);
|
||||||
|
|
||||||
{ expect a base here }
|
{ expect a base here if there is an index }
|
||||||
if tmpref.base=NR_NO then
|
if (tmpref.base=NR_NO) and (tmpref.index<>NR_NO) then
|
||||||
internalerror(200312022);
|
internalerror(200312022);
|
||||||
|
|
||||||
if tmpref.index<>NR_NO then
|
if tmpref.index<>NR_NO then
|
||||||
@ -1103,7 +1108,12 @@ unit cgcpu;
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if tmpref.offset<>0 then
|
if tmpref.offset<>0 then
|
||||||
a_op_const_reg_reg(list,OP_ADD,OS_ADDR,tmpref.offset,tmpref.base,r)
|
begin
|
||||||
|
if tmpref.base<>NR_NO then
|
||||||
|
a_op_const_reg_reg(list,OP_ADD,OS_ADDR,tmpref.offset,tmpref.base,r)
|
||||||
|
else
|
||||||
|
a_load_const_reg(list,OS_ADDR,tmpref.offset,r);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
instr:=taicpu.op_reg_reg(A_MOV,r,tmpref.base);
|
instr:=taicpu.op_reg_reg(A_MOV,r,tmpref.base);
|
||||||
|
Loading…
Reference in New Issue
Block a user