mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 12:39:25 +02:00
* fix some small flaws which prevent sparc linux system unit from compiling
* some reformatting done
This commit is contained in:
parent
b6088901a6
commit
995f7e0f11
@ -1560,6 +1560,14 @@ implementation
|
||||
{$ENDIF}
|
||||
initasmmode:=asmmode_direct;
|
||||
{$endif powerpc}
|
||||
{$ifdef sparc}
|
||||
initoptprocessor:=SPARC_V8;
|
||||
initpackenum:=4;
|
||||
{$IFDEF testvarsets}
|
||||
initsetalloc:=0;
|
||||
{$ENDIF}
|
||||
initasmmode:=asmmode_direct;
|
||||
{$endif sparc}
|
||||
initinterfacetype:=it_interfacecom;
|
||||
initdefproccall:=pocall_none;
|
||||
initdefines:=TStringList.Create;
|
||||
@ -1575,7 +1583,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.91 2003-05-23 15:03:31 peter
|
||||
Revision 1.92 2003-05-23 22:33:48 florian
|
||||
* fix some small flaws which prevent sparc linux system unit from compiling
|
||||
* some reformatting done
|
||||
|
||||
Revision 1.91 2003/05/23 15:03:31 peter
|
||||
* fix previous commit for unix
|
||||
|
||||
Revision 1.90 2003/05/23 14:39:56 peter
|
||||
|
@ -794,7 +794,6 @@ implementation
|
||||
End;
|
||||
asmstat:=tasmnode(radirect.assemble);
|
||||
end;
|
||||
|
||||
else
|
||||
Message(parser_f_assembler_reader_not_supported);
|
||||
end;
|
||||
@ -1175,7 +1174,11 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.101 2003-05-23 15:15:36 peter
|
||||
Revision 1.102 2003-05-23 22:33:48 florian
|
||||
* fix some small flaws which prevent sparc linux system unit from compiling
|
||||
* some reformatting done
|
||||
|
||||
Revision 1.101 2003/05/23 15:15:36 peter
|
||||
* better error for undefined ordinal labels
|
||||
|
||||
Revision 1.100 2003/05/17 13:30:08 jonas
|
||||
|
@ -962,74 +962,86 @@ procedure TCgSparc.g_overflowCheck(List:TAasmOutput;const p:TNode);
|
||||
a_call_name(list,'FPC_OVERFLOW');
|
||||
a_label(list,hl);
|
||||
end;
|
||||
|
||||
{ *********** entry/exit code and address loading ************ }
|
||||
|
||||
procedure TCgSparc.g_stackframe_entry(list:TAasmOutput;LocalSize:LongInt);
|
||||
var
|
||||
href:TReference;
|
||||
r:Tregister;
|
||||
i:integer;
|
||||
again:tasmlabel;
|
||||
r : tregister;
|
||||
begin
|
||||
{Althogh the SPARC architecture require only word alignment, software
|
||||
convention and the operating system require every stack frame to be double word
|
||||
aligned}
|
||||
LocalSize:=(LocalSize+7)and $FFFFFFF8;
|
||||
{Execute the SAVE instruction to get a new register window and create a new
|
||||
stack frame. In the "SAVE %i6,size,%i6" the first %i6 is related to the state
|
||||
before execution of the SAVE instrucion so it is the caller %i6, when the %i6
|
||||
after execution of that instruction is the called function stack pointer}
|
||||
r.enum:=stack_pointer_reg;
|
||||
with list do
|
||||
concat(Taicpu.Op_reg_const_reg(A_SAVE,r,-LocalSize,r));
|
||||
{ Althogh the SPARC architecture require only word alignment, software
|
||||
convention and the operating system require every stack frame to be double word
|
||||
aligned }
|
||||
LocalSize:=align(LocalSize,8);
|
||||
{ Execute the SAVE instruction to get a new register window and create a new
|
||||
stack frame. In the "SAVE %i6,size,%i6" the first %i6 is related to the state
|
||||
before execution of the SAVE instrucion so it is the caller %i6, when the %i6
|
||||
after execution of that instruction is the called function stack pointer}
|
||||
r.enum:=R_INTREGISTER;
|
||||
r.number:=NR_STACK_POINTER_REG;
|
||||
list.concat(Taicpu.Op_reg_const_reg(A_SAVE,r,-LocalSize,r));
|
||||
end;
|
||||
|
||||
|
||||
procedure TCgSparc.g_restore_all_registers(list:TaasmOutput;accused,acchiused:boolean);
|
||||
begin
|
||||
{$warning FIX ME TCgSparc.g_restore_all_registers}
|
||||
{ The sparc port uses the sparc standard calling convetions so this function has no used }
|
||||
end;
|
||||
|
||||
|
||||
procedure TCgSparc.g_restore_frame_pointer(list:TAasmOutput);
|
||||
begin
|
||||
{This function intontionally does nothing as frame pointer is restored in the
|
||||
delay slot of the return instrucion done in g_return_from_proc}
|
||||
{ This function intontionally does nothing as frame pointer is restored in the
|
||||
delay slot of the return instrucion done in g_return_from_proc}
|
||||
end;
|
||||
|
||||
|
||||
procedure TCgSparc.g_restore_standard_registers(list:taasmoutput;usedinproc:Tsupregset);
|
||||
begin
|
||||
{$WARNING FIX ME TCgSparc.g_restore_standard_registers}
|
||||
{ The sparc port uses the sparc standard calling convetions so this function has no used }
|
||||
end;
|
||||
|
||||
|
||||
procedure TCgSparc.g_return_from_proc(list:TAasmOutput;parasize:aword);
|
||||
|
||||
var r,r2:Tregister;
|
||||
|
||||
var
|
||||
r,r2:Tregister;
|
||||
begin
|
||||
{According to the SPARC ABI, the stack is cleared using the RESTORE instruction
|
||||
which is genereted in the g_restore_frame_pointer. Notice that SPARC has no
|
||||
RETURN instruction and that JMPL is used instead. The JMPL instrucion have one
|
||||
delay slot, so an inversion is possible such as
|
||||
JMPL %i7+8,%g0
|
||||
RESTORE %g0,0,%g0
|
||||
If no inversion we can use just
|
||||
RESTORE %g0,0,%g0
|
||||
JMPL %i7+8,%g0
|
||||
NOP}
|
||||
{ According to the SPARC ABI, the stack is cleared using the RESTORE instruction
|
||||
which is genereted in the g_restore_frame_pointer. Notice that SPARC has no
|
||||
RETURN instruction and that JMPL is used instead. The JMPL instrucion have one
|
||||
delay slot, so an inversion is possible such as
|
||||
JMPL %i7+8,%g0
|
||||
RESTORE %g0,0,%g0
|
||||
If no inversion we can use just
|
||||
RESTORE %g0,0,%g0
|
||||
JMPL %i7+8,%g0
|
||||
NOP
|
||||
}
|
||||
with list do
|
||||
begin
|
||||
{Return address is computed by adding 8 to the CALL address saved onto %i6}
|
||||
{ Return address is computed by adding 8 to the CALL address saved onto %i6}
|
||||
r.enum:=R_G0;
|
||||
r2.enum:=R_I7;
|
||||
concat(Taicpu.Op_caddr_reg(A_JMPL,r,8,r));
|
||||
{We use trivial restore in the delay slot of the JMPL instruction, as we
|
||||
already set result onto %i0}
|
||||
{ We use trivial restore in the delay slot of the JMPL instruction, as we
|
||||
already set result onto %i0 }
|
||||
concat(Taicpu.Op_reg_const_reg(A_RESTORE,r,0,r));
|
||||
end
|
||||
end
|
||||
end;
|
||||
|
||||
|
||||
procedure TCgSparc.g_save_all_registers(list : taasmoutput);
|
||||
begin
|
||||
{$warning FIX ME TCgSparc.g_save_all_registers}
|
||||
{ The sparc port uses the sparc standard calling convetions so this function has no used }
|
||||
end;
|
||||
|
||||
|
||||
procedure TCgSparc.g_save_standard_registers(list : taasmoutput; usedinproc:Tsupregset);
|
||||
begin
|
||||
{$warning FIX ME tcgppc.g_save_standard_registers}
|
||||
{ The sparc port uses the sparc standard calling convetions so this function has no used }
|
||||
end;
|
||||
|
||||
|
||||
procedure TCgSparc.a_loadaddr_ref_reg(list:TAasmOutput;CONST ref:TReference;r:tregister);
|
||||
|
||||
begin
|
||||
@ -1449,7 +1461,11 @@ BEGIN
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.49 2003-05-22 16:11:22 florian
|
||||
Revision 1.50 2003-05-23 22:33:48 florian
|
||||
* fix some small flaws which prevent sparc linux system unit from compiling
|
||||
* some reformatting done
|
||||
|
||||
Revision 1.49 2003/05/22 16:11:22 florian
|
||||
* fixed sparc compilation partially
|
||||
|
||||
Revision 1.48 2003/05/07 15:04:30 mazen
|
||||
|
@ -39,9 +39,10 @@ TYPE
|
||||
ts64comp = extended;
|
||||
pbestreal=^bestreal;
|
||||
|
||||
{ possible supported processors for this target }
|
||||
{ possible supported processors for this target }
|
||||
tprocessors=(no_processor,SPARC_V8,SPARC_V9);
|
||||
CONST
|
||||
|
||||
const
|
||||
{# Size of native extended floating point type }
|
||||
{SPARC architecture uses IEEE double floating point numbers}
|
||||
extended_size = 8;
|
||||
@ -61,7 +62,11 @@ IMPLEMENTATION
|
||||
END.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.6 2002-11-16 20:07:57 florian
|
||||
Revision 1.7 2003-05-23 22:33:48 florian
|
||||
* fix some small flaws which prevent sparc linux system unit from compiling
|
||||
* some reformatting done
|
||||
|
||||
Revision 1.6 2002/11/16 20:07:57 florian
|
||||
* made target_cpu_name lowercase
|
||||
|
||||
Revision 1.5 2002/10/16 12:36:54 mazen
|
||||
|
@ -21,33 +21,39 @@
|
||||
****************************************************************************}
|
||||
{ This unit contains the CPU specific part of tprocinfo. }
|
||||
unit cpupi;
|
||||
{$INCLUDE fpcdefs.inc}
|
||||
|
||||
{$I fpcdefs.inc}
|
||||
|
||||
interface
|
||||
uses
|
||||
cutils,
|
||||
cgbase,cpuinfo;
|
||||
type
|
||||
TSparcProcInfo=class(TProcInfo)
|
||||
{overall size of allocated stack space, currently this is used for the
|
||||
PowerPC only}
|
||||
LocalSize:aword;
|
||||
{max of space need for parameters, currently used by the PowerPC port only}
|
||||
maxpushedparasize:aword;
|
||||
constructor create(aparent:tprocinfo);override;
|
||||
{According the the SPARC ABI the standard stack frame must include :
|
||||
* 16 word save for the in and local registers in case of overflow/underflow.
|
||||
this save area always must exist at the %o6+0,
|
||||
* software conventions requires space for the aggregate return value pointer, even if the word is not used,
|
||||
* althogh the first six words of arguments reside in registers, the standard
|
||||
stack frame reserves space for them. Arguments beond the sixth reside on the
|
||||
stack as in the Intel architecture,
|
||||
* other areas depend on the compiler and the code being compiled. The
|
||||
standard calling sequence does not define a maximum stack frame size, nor does
|
||||
it restrict how a language system uses the "unspecified" areas of the standard
|
||||
stack frame.}
|
||||
procedure after_header;override;
|
||||
procedure after_pass1;override;
|
||||
end;
|
||||
|
||||
uses
|
||||
cutils,
|
||||
cgbase,cpuinfo,
|
||||
psub;
|
||||
|
||||
type
|
||||
TSparcProcInfo=class(tcgprocinfo)
|
||||
{ overall size of allocated stack space, currently this is used for the
|
||||
PowerPC only }
|
||||
LocalSize:aword;
|
||||
{max of space need for parameters, currently used by the PowerPC port only}
|
||||
maxpushedparasize:aword;
|
||||
constructor create(aparent:tprocinfo);override;
|
||||
{ According the the SPARC ABI the standard stack frame must include :
|
||||
* 16 word save for the in and local registers in case of overflow/underflow.
|
||||
this save area always must exist at the %o6+0,
|
||||
* software conventions requires space for the aggregate return value pointer, even if the word is not used,
|
||||
* althogh the first six words of arguments reside in registers, the standard
|
||||
stack frame reserves space for them. Arguments beond the sixth reside on the
|
||||
stack as in the Intel architecture,
|
||||
* other areas depend on the compiler and the code being compiled. The
|
||||
standard calling sequence does not define a maximum stack frame size, nor does
|
||||
it restrict how a language system uses the "unspecified" areas of the standard
|
||||
stack frame.}
|
||||
procedure after_header;override;
|
||||
procedure after_pass1;override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
uses
|
||||
tgobj,paramgr,symsym,systems;
|
||||
@ -95,7 +101,11 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.14 2003-04-27 11:21:36 peter
|
||||
Revision 1.15 2003-05-23 22:33:48 florian
|
||||
* fix some small flaws which prevent sparc linux system unit from compiling
|
||||
* some reformatting done
|
||||
|
||||
Revision 1.14 2003/04/27 11:21:36 peter
|
||||
* aktprocdef renamed to current_procdef
|
||||
* procinfo renamed to current_procinfo
|
||||
* procinfo will now be stored in current_module so it can be
|
||||
|
@ -338,19 +338,22 @@ interface
|
||||
*****************************************************************************}
|
||||
|
||||
const
|
||||
asmmode_i386_direct_info : tasmmodeinfo =
|
||||
asmmode_sparc_direct_info : tasmmodeinfo =
|
||||
(
|
||||
id : asmmode_direct;
|
||||
idtxt : 'DIRECT'
|
||||
);
|
||||
|
||||
initialization
|
||||
RegisterAsmMode(asmmode_i386_direct_info);
|
||||
|
||||
RegisterAsmMode(asmmode_sparc_direct_info);
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.9 2003-05-23 21:10:50 florian
|
||||
Revision 1.10 2003-05-23 22:33:48 florian
|
||||
* fix some small flaws which prevent sparc linux system unit from compiling
|
||||
* some reformatting done
|
||||
|
||||
Revision 1.9 2003/05/23 21:10:50 florian
|
||||
* fixed sparc compiler compilation
|
||||
|
||||
Revision 1.8 2003/05/22 16:11:22 florian
|
||||
|
Loading…
Reference in New Issue
Block a user