* several large offset-related fixes

This commit is contained in:
Jonas Maebe 2002-09-08 13:03:26 +00:00
parent 6592c96e70
commit 07c1116a8c
2 changed files with 32 additions and 26 deletions

View File

@ -78,6 +78,7 @@ unit agppcgas;
as_ppc_gas_info : tasminfo =
(
id : as_gas;
idtxt : 'AS';
asmbin : 'as';
asmcmd : '-o $OBJ $ASM';
@ -150,19 +151,15 @@ unit agppcgas;
with ref do
begin
inc(offset,offsetfixup);
if (offset < -32768) or (offset > 32767) then
{$ifndef testing}
if ((offset < -32768) or (offset > 32767)) and
(symaddr = refs_full) then
internalerror(19991);
{$else testing}
begin
writeln('internalerror 19991');
halt(1);
end;
{$endif testing}
if not assigned(symbol) then
s:=''
else
s:=symbol.name+symaddr2str[symaddr];
if (symaddr = refs_full) then
s := ''
else if not assigned(symbol) then
s := '('
else
s:='('+symbol.name;
if offset<0 then
s:=s+tostr(offset)
else
@ -173,6 +170,10 @@ unit agppcgas;
else
s:=s+tostr(offset);
end;
if (symaddr <> refs_full) then
s := s+')'+symaddr2str[symaddr];
if (index=R_NO) and (base<>R_NO) then
begin
if offset=0 then
@ -187,18 +188,12 @@ unit agppcgas;
else if (index<>R_NO) and (base<>R_NO) and (offset=0) then
s:=s+gas_reg2str[base]+','+gas_reg2str[index]
else if ((index<>R_NO) or (base<>R_NO)) then
{$ifndef testing}
internalerror(19992);
{$else testing}
begin
writeln('internalerror 19992');
halt(1);
end;
{$endif testing}
end;
getreferencestring:=s;
end;
function getopstr_jmp(const o:toper) : string;
var
hs : string;
@ -368,7 +363,10 @@ begin
end.
{
$Log$
Revision 1.17 2002-09-01 21:04:48 florian
Revision 1.18 2002-09-08 13:03:26 jonas
* several large offset-related fixes
Revision 1.17 2002/09/01 21:04:48 florian
* several powerpc related stuff fixed
Revision 1.16 2002/08/31 19:27:48 jonas

View File

@ -962,7 +962,7 @@ const
tppcprocinfo(procinfo).localsize:=localsize;
reference_reset_base(href,R_1,-localsize);
list.concat(taicpu.op_reg_ref(A_STWU,R_1,href));
a_load_store(list,A_STWU,R_1,href);
{ no GOT pointer loaded yet }
gotgot:=false;
@ -981,7 +981,7 @@ const
if regcounter in rg.usedbyproc then
begin
{ reference_reset_base(href,R_1,-localsize);
list.concat(taicpu.op_reg_ref(A_STWU,R_1,href));
a_load_store(list,A_STWU,R_1,href);
}
end;
@ -1101,7 +1101,7 @@ const
begin
{ adjust r1 }
reference_reset_base(href,R_1,tppcprocinfo(procinfo).localsize);
list.concat(taicpu.op_reg_ref(A_STWU,R_1,href));
a_load_store(list,A_STWU,R_1,href);
{ load link register? }
if (procinfo.flags and pi_do_call)<>0 then
begin
@ -1464,6 +1464,7 @@ const
(ref.offset = 0)));
end;
function tcgppc.fixref(list: taasmoutput; var ref: treference): boolean;
var
@ -1575,11 +1576,15 @@ const
tmpref: treference;
begin
if assigned(ref.symbol) then
tmpreg := R_NO;
if assigned(ref.symbol) or
(cardinal(ref.offset-low(smallint)) >
high(smallint)-low(smallint)) then
begin
tmpreg := get_scratch_reg_address(list);
reference_reset(tmpref);
tmpref.symbol := ref.symbol;
tmpref.offset := ref.offset;
tmpref.symaddr := refs_ha;
if ref.base <> R_NO then
list.concat(taicpu.op_reg_reg_ref(A_ADDIS,tmpreg,
@ -1590,7 +1595,7 @@ const
ref.symaddr := refs_l;
end;
list.concat(taicpu.op_reg_ref(op,reg,ref));
if assigned(ref.symbol) then
if (tmpreg <> R_NO) then
free_scratch_reg(list,tmpreg);
end;
@ -1714,7 +1719,10 @@ begin
end.
{
$Log$
Revision 1.54 2002-09-07 17:54:58 florian
Revision 1.55 2002-09-08 13:03:26 jonas
* several large offset-related fixes
Revision 1.54 2002/09/07 17:54:58 florian
* first part of PowerPC fixes
Revision 1.53 2002/09/07 15:25:14 peter