|
@@ -421,6 +421,7 @@ implementation
|
|
procedure TCgSparc.a_call_name(list:TAasmOutput;const s:string);
|
|
procedure TCgSparc.a_call_name(list:TAasmOutput;const s:string);
|
|
begin
|
|
begin
|
|
list.concat(taicpu.op_sym(A_CALL,objectlibrary.newasmsymbol(s)));
|
|
list.concat(taicpu.op_sym(A_CALL,objectlibrary.newasmsymbol(s)));
|
|
|
|
+ { Delay slot }
|
|
list.concat(taicpu.op_none(A_NOP));
|
|
list.concat(taicpu.op_none(A_NOP));
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -428,6 +429,8 @@ implementation
|
|
procedure TCgSparc.a_call_reg(list:TAasmOutput;Reg:TRegister);
|
|
procedure TCgSparc.a_call_reg(list:TAasmOutput;Reg:TRegister);
|
|
begin
|
|
begin
|
|
list.concat(taicpu.op_reg(A_CALL,reg));
|
|
list.concat(taicpu.op_reg(A_CALL,reg));
|
|
|
|
+ { Delay slot }
|
|
|
|
+ list.concat(taicpu.op_none(A_NOP));
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -562,11 +565,16 @@ implementation
|
|
(ref.offset<simm13lo) or
|
|
(ref.offset<simm13lo) or
|
|
(ref.offset>simm13hi) then
|
|
(ref.offset>simm13hi) then
|
|
begin
|
|
begin
|
|
- {$ifdef newra}
|
|
|
|
- hreg:=rg.getaddressregister(list);
|
|
|
|
- {$else}
|
|
|
|
- hreg:=get_scratch_reg_address(list);
|
|
|
|
- {$endif}
|
|
|
|
|
|
+ if (ref.base.number<>r.number) and (ref.index.number<>r.number) then
|
|
|
|
+ hreg:=r
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ {$ifdef newra}
|
|
|
|
+ hreg:=rg.getaddressregister(list);
|
|
|
|
+ {$else}
|
|
|
|
+ hreg:=get_scratch_reg_address(list);
|
|
|
|
+ {$endif}
|
|
|
|
+ end;
|
|
reference_reset(tmpref);
|
|
reference_reset(tmpref);
|
|
tmpref.symbol := ref.symbol;
|
|
tmpref.symbol := ref.symbol;
|
|
tmpref.offset := ref.offset;
|
|
tmpref.offset := ref.offset;
|
|
@@ -584,12 +592,20 @@ implementation
|
|
end
|
|
end
|
|
else
|
|
else
|
|
list.concat(taicpu.op_reg_reg_reg(A_ADD,hreg,ref.base,r));
|
|
list.concat(taicpu.op_reg_reg_reg(A_ADD,hreg,ref.base,r));
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ if hreg.number<>r.number then
|
|
|
|
+ list.Concat(taicpu.op_reg_reg(A_MOV,hreg,r));
|
|
|
|
+ end;
|
|
|
|
+ if hreg.number<>r.number then
|
|
|
|
+ begin
|
|
|
|
+ {$ifdef newra}
|
|
|
|
+ rg.ungetaddressregister(list,hreg);
|
|
|
|
+ {$else}
|
|
|
|
+ free_scratch_reg(list,hreg);
|
|
|
|
+ {$endif}
|
|
end;
|
|
end;
|
|
- {$ifdef newra}
|
|
|
|
- rg.ungetaddressregister(list,hreg);
|
|
|
|
- {$else}
|
|
|
|
- free_scratch_reg(list,hreg);
|
|
|
|
- {$endif}
|
|
|
|
end
|
|
end
|
|
else
|
|
else
|
|
{ At least small offset, maybe base and maybe index }
|
|
{ At least small offset, maybe base and maybe index }
|
|
@@ -599,18 +615,26 @@ implementation
|
|
begin
|
|
begin
|
|
if ref.index.number<>NR_NO then
|
|
if ref.index.number<>NR_NO then
|
|
begin
|
|
begin
|
|
- {$ifdef newra}
|
|
|
|
- hreg:=rg.getaddressregister(list);
|
|
|
|
- {$else}
|
|
|
|
- hreg:=get_scratch_reg_address(list);
|
|
|
|
- {$endif}
|
|
|
|
|
|
+ if (ref.base.number<>r.number) and (ref.index.number<>r.number) then
|
|
|
|
+ hreg:=r
|
|
|
|
+ else
|
|
|
|
+ begin
|
|
|
|
+ {$ifdef newra}
|
|
|
|
+ hreg:=rg.getaddressregister(list);
|
|
|
|
+ {$else}
|
|
|
|
+ hreg:=get_scratch_reg_address(list);
|
|
|
|
+ {$endif}
|
|
|
|
+ end;
|
|
list.concat(taicpu.op_reg_const_reg(A_ADD,ref.base,aword(ref.offset),hreg));
|
|
list.concat(taicpu.op_reg_const_reg(A_ADD,ref.base,aword(ref.offset),hreg));
|
|
list.concat(taicpu.op_reg_reg_reg(A_ADD,hreg,ref.index,r));
|
|
list.concat(taicpu.op_reg_reg_reg(A_ADD,hreg,ref.index,r));
|
|
- {$ifdef newra}
|
|
|
|
- rg.ungetaddressregister(list,hreg);
|
|
|
|
- {$else}
|
|
|
|
- free_scratch_reg(list,hreg);
|
|
|
|
- {$endif}
|
|
|
|
|
|
+ if hreg.number<>r.number then
|
|
|
|
+ begin
|
|
|
|
+ {$ifdef newra}
|
|
|
|
+ rg.ungetaddressregister(list,hreg);
|
|
|
|
+ {$else}
|
|
|
|
+ free_scratch_reg(list,hreg);
|
|
|
|
+ {$endif}
|
|
|
|
+ end;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
list.concat(taicpu.op_reg_const_reg(A_ADD,ref.base,ref.offset,r));
|
|
list.concat(taicpu.op_reg_const_reg(A_ADD,ref.base,ref.offset,r));
|
|
@@ -776,6 +800,8 @@ implementation
|
|
procedure TCgSparc.a_jmp_always(List:TAasmOutput;l:TAsmLabel);
|
|
procedure TCgSparc.a_jmp_always(List:TAasmOutput;l:TAsmLabel);
|
|
begin
|
|
begin
|
|
List.Concat(TAiCpu.op_sym(A_BA,objectlibrary.newasmsymbol(l.name)));
|
|
List.Concat(TAiCpu.op_sym(A_BA,objectlibrary.newasmsymbol(l.name)));
|
|
|
|
+ { Delay slot }
|
|
|
|
+ list.Concat(TAiCpu.Op_none(A_NOP));
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -786,6 +812,7 @@ implementation
|
|
ai:=TAiCpu.Op_sym(A_Bxx,l);
|
|
ai:=TAiCpu.Op_sym(A_Bxx,l);
|
|
ai.SetCondition(TOpCmp2AsmCond[cond]);
|
|
ai.SetCondition(TOpCmp2AsmCond[cond]);
|
|
list.Concat(ai);
|
|
list.Concat(ai);
|
|
|
|
+ { Delay slot }
|
|
list.Concat(TAiCpu.Op_none(A_NOP));
|
|
list.Concat(TAiCpu.Op_none(A_NOP));
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -797,6 +824,7 @@ implementation
|
|
ai := Taicpu.op_sym(A_Bxx,l);
|
|
ai := Taicpu.op_sym(A_Bxx,l);
|
|
ai.SetCondition(flags_to_cond(f));
|
|
ai.SetCondition(flags_to_cond(f));
|
|
list.Concat(ai);
|
|
list.Concat(ai);
|
|
|
|
+ { Delay slot }
|
|
list.Concat(TAiCpu.Op_none(A_NOP));
|
|
list.Concat(TAiCpu.Op_none(A_NOP));
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -811,6 +839,7 @@ implementation
|
|
{$warning Need to retrieve the correct flag setting in reg}
|
|
{$warning Need to retrieve the correct flag setting in reg}
|
|
// ai.SetCondition(flags_to_cond(f));
|
|
// ai.SetCondition(flags_to_cond(f));
|
|
list.Concat(ai);
|
|
list.Concat(ai);
|
|
|
|
+ { Delay slot }
|
|
list.Concat(TAiCpu.Op_none(A_NOP));
|
|
list.Concat(TAiCpu.Op_none(A_NOP));
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1212,7 +1241,12 @@ begin
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.61 2003-07-02 22:18:04 peter
|
|
|
|
|
|
+ Revision 1.62 2003-07-03 21:09:53 peter
|
|
|
|
+ * delay slot NOPs and comments added
|
|
|
|
+ * a_loadaddr_ref_reg fixed and optimized to reuse passed register
|
|
|
|
+ if it is not used by the ref
|
|
|
|
+
|
|
|
|
+ Revision 1.61 2003/07/02 22:18:04 peter
|
|
* paraloc splitted in callerparaloc,calleeparaloc
|
|
* paraloc splitted in callerparaloc,calleeparaloc
|
|
* sparc calling convention updates
|
|
* sparc calling convention updates
|
|
|
|
|