* some assembler writer bugs fixed

This commit is contained in:
florian 2002-08-17 18:23:53 +00:00
parent e313bab4ff
commit b841ba8b16
2 changed files with 33 additions and 14 deletions

View File

@ -126,7 +126,7 @@ unit agppcgas;
'xer','lr','ctr','fpscr' 'xer','lr','ctr','fpscr'
); );
symaddr2str: array[trefsymaddr] of string[4] = ('','ha16','lo16'); symaddr2str: array[trefsymaddr] of string[2] = ('','ha','l');
function getreferencestring(var ref : treference) : string; function getreferencestring(var ref : treference) : string;
var var
@ -147,7 +147,7 @@ unit agppcgas;
if not assigned(symbol) then if not assigned(symbol) then
s:='' s:=''
else else
s:=symaddr2str[symaddr]+'('+symbol.name + ')'; s:=symbol.name+symaddr2str[symaddr];
if offset<0 then if offset<0 then
s:=s+tostr(offset) s:=s+tostr(offset)
else else
@ -159,8 +159,12 @@ unit agppcgas;
s:=s+tostr(offset); s:=s+tostr(offset);
end; end;
if (index=R_NO) and (base<>R_NO) then if (index=R_NO) and (base<>R_NO) then
s:=s+'('+reg2str[base]+')' begin
else if (index<>R_NO) and (base<>R_NO) and (offset = 0) then if offset=0 then
s:=s+'0';
s:=s+'('+reg2str[base]+')'
end
else if (index<>R_NO) and (base<>R_NO) and (offset=0) then
s:=s+reg2str[base]+','+reg2str[index] s:=s+reg2str[base]+','+reg2str[index]
else if ((index<>R_NO) or (base<>R_NO)) then else if ((index<>R_NO) or (base<>R_NO)) then
{$ifndef testing} {$ifndef testing}
@ -306,11 +310,14 @@ unit agppcgas;
if is_calljmp(op) then if is_calljmp(op) then
begin begin
{ direct BO/BI in op[0] and op[1] not supported, put them in condition! } { direct BO/BI in op[0] and op[1] not supported, put them in condition! }
if op <> A_B then case op of
s:=cond2str(op,taicpu(hp).condition)+',' A_B,A_BA,A_BL,A_BLA:
else s:=#9+op2str[op]+#9
s:=#9'b'#9; else
s := s+getopstr_jmp(taicpu(hp).oper[0]); s:=cond2str(op,taicpu(hp).condition)+',';
end;
s:=s+getopstr_jmp(taicpu(hp).oper[0]);
end end
else else
{ process operands } { process operands }
@ -339,7 +346,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.10 2002-08-12 15:08:44 carl Revision 1.11 2002-08-17 18:23:53 florian
* some assembler writer bugs fixed
Revision 1.10 2002/08/12 15:08:44 carl
+ stab register indexes for powerpc (moved from gdb to cpubase) + stab register indexes for powerpc (moved from gdb to cpubase)
+ tprocessor enumeration moved to cpuinfo + tprocessor enumeration moved to cpuinfo
+ linker in target_info is now a class + linker in target_info is now a class

View File

@ -1,5 +1,5 @@
{ {
$Id$ $id: cgcpu.pas,v 1.43 2002/08/17 09:23:49 florian Exp $
Copyright (c) 1998-2002 by Florian Klaempfl Copyright (c) 1998-2002 by Florian Klaempfl
This unit implements the code generator for the PowerPC This unit implements the code generator for the PowerPC
@ -277,7 +277,7 @@ const
list.concat(taicpu.op_reg_const(A_LI,reg,smallint(a and $ffff))); list.concat(taicpu.op_reg_const(A_LI,reg,smallint(a and $ffff)));
if ((a shr 16) <> 0) or if ((a shr 16) <> 0) or
(smallint(a and $ffff) < 0) then (smallint(a and $ffff) < 0) then
list.concat(taicpu.op_reg_const(A_ADDIS,reg, list.concat(taicpu.op_reg_reg_const(A_ADDIS,reg,reg,
smallint((a shr 16)+ord(smallint(a and $ffff) < 0)))) smallint((a shr 16)+ord(smallint(a and $ffff) < 0))))
end end
else else
@ -855,6 +855,7 @@ const
href : treference; href : treference;
usesfpr,usesgpr,gotgot : boolean; usesfpr,usesgpr,gotgot : boolean;
parastart : aword; parastart : aword;
offset : aword;
begin begin
{ we do our own localsize calculation } { we do our own localsize calculation }
@ -936,9 +937,12 @@ const
else else
list.concat(taicpu.op_sym_ofs(A_BL,objectlibrary.newasmsymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)),0)); list.concat(taicpu.op_sym_ofs(A_BL,objectlibrary.newasmsymbol('_savefpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)),0));
} }
for regcounter:=firstreggpr to R_F31 do for regcounter:=firstregfpu to R_F31 do
if regcounter in rg.usedbyproc then if regcounter in rg.usedbyproc then
begin begin
{ reference_reset_base(href,R_1,-localsize);
list.concat(taicpu.op_reg_ref(A_STWU,R_1,href));
}
end; end;
{ compute end of gpr save area } { compute end of gpr save area }
@ -1041,6 +1045,7 @@ const
begin begin
{ address of fpr save area to r11 } { address of fpr save area to r11 }
list.concat(taicpu.op_reg_reg_const(A_ADDI,R_11,R_11,(ord(R_F31)-ord(firstregfpu)+1)*8)); list.concat(taicpu.op_reg_reg_const(A_ADDI,R_11,R_11,(ord(R_F31)-ord(firstregfpu)+1)*8));
{
if (procinfo.flags and pi_do_call)<>0 then if (procinfo.flags and pi_do_call)<>0 then
list.concat(taicpu.op_sym_ofs(A_BL,objectlibrary.newasmsymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+ list.concat(taicpu.op_sym_ofs(A_BL,objectlibrary.newasmsymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+
'_x'),0)) '_x'),0))
@ -1049,6 +1054,7 @@ const
list.concat(taicpu.op_sym_ofs(A_BL,objectlibrary.newasmsymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+ list.concat(taicpu.op_sym_ofs(A_BL,objectlibrary.newasmsymbol('_restfpr_'+tostr(ord(firstregfpu)-ord(R_F14)+14)+
'_l'),0)); '_l'),0));
genret:=false; genret:=false;
}
end; end;
{ if we didn't generate the return code, we've to do it now } { if we didn't generate the return code, we've to do it now }
if genret then if genret then
@ -1668,7 +1674,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.43 2002-08-17 09:23:49 florian Revision 1.44 2002-08-17 18:23:53 florian
* some assembler writer bugs fixed
Revision 1.43 2002/08/17 09:23:49 florian
* first part of procinfo rewrite * first part of procinfo rewrite
Revision 1.42 2002/08/16 14:24:59 carl Revision 1.42 2002/08/16 14:24:59 carl