Browse Source

* sparc64 compiler can be build, not working yet

git-svn-id: trunk@36399 -
florian 8 years ago
parent
commit
1f4432af6b

+ 22 - 18
.gitattributes

@@ -658,29 +658,12 @@ compiler/rgobj.pas svneol=native#text/plain
 compiler/scandir.pas svneol=native#text/plain
 compiler/scandir.pas svneol=native#text/plain
 compiler/scanner.pas svneol=native#text/plain
 compiler/scanner.pas svneol=native#text/plain
 compiler/script.pas svneol=native#text/plain
 compiler/script.pas svneol=native#text/plain
-compiler/sparc/aasmcpu.pas svneol=native#text/plain
-compiler/sparc/aoptcpu.pas svneol=native#text/plain
-compiler/sparc/aoptcpub.pas svneol=native#text/plain
 compiler/sparc/aoptcpud.pas svneol=native#text/plain
 compiler/sparc/aoptcpud.pas svneol=native#text/plain
-compiler/sparc/cgcpu.pas svneol=native#text/plain
 compiler/sparc/cpuelf.pas svneol=native#text/plain
 compiler/sparc/cpuelf.pas svneol=native#text/plain
-compiler/sparc/cpugas.pas svneol=native#text/plain
 compiler/sparc/cpuinfo.pas svneol=native#text/plain
 compiler/sparc/cpuinfo.pas svneol=native#text/plain
 compiler/sparc/cpunode.pas svneol=native#text/plain
 compiler/sparc/cpunode.pas svneol=native#text/plain
 compiler/sparc/cpupara.pas svneol=native#text/plain
 compiler/sparc/cpupara.pas svneol=native#text/plain
-compiler/sparc/cpupi.pas svneol=native#text/plain
 compiler/sparc/cputarg.pas svneol=native#text/plain
 compiler/sparc/cputarg.pas svneol=native#text/plain
-compiler/sparc/hlcgcpu.pas svneol=native#text/plain
-compiler/sparc/itcpugas.pas svneol=native#text/plain
-compiler/sparc/ncpuadd.pas svneol=native#text/plain
-compiler/sparc/ncpucall.pas svneol=native#text/plain
-compiler/sparc/ncpucnv.pas svneol=native#text/plain
-compiler/sparc/ncpuinln.pas svneol=native#text/plain
-compiler/sparc/ncpumat.pas svneol=native#text/plain
-compiler/sparc/ncpuset.pas svneol=native#text/plain
-compiler/sparc/racpu.pas svneol=native#text/plain
-compiler/sparc/racpugas.pas svneol=native#text/plain
-compiler/sparc/rgcpu.pas svneol=native#text/plain
 compiler/sparc/rspcon.inc svneol=native#text/plain
 compiler/sparc/rspcon.inc svneol=native#text/plain
 compiler/sparc/rspdwrf.inc svneol=native#text/plain
 compiler/sparc/rspdwrf.inc svneol=native#text/plain
 compiler/sparc/rspnor.inc svneol=native#text/plain
 compiler/sparc/rspnor.inc svneol=native#text/plain
@@ -690,8 +673,10 @@ compiler/sparc/rspsri.inc svneol=native#text/plain
 compiler/sparc/rspstab.inc svneol=native#text/plain
 compiler/sparc/rspstab.inc svneol=native#text/plain
 compiler/sparc/rspstd.inc svneol=native#text/plain
 compiler/sparc/rspstd.inc svneol=native#text/plain
 compiler/sparc/rspsup.inc svneol=native#text/plain
 compiler/sparc/rspsup.inc svneol=native#text/plain
-compiler/sparc/symcpu.pas svneol=native#text/plain
 compiler/sparc64/cpuinfo.pas svneol=native#text/plain
 compiler/sparc64/cpuinfo.pas svneol=native#text/plain
+compiler/sparc64/cpunode.pas svneol=native#text/plain
+compiler/sparc64/cpupara.pas svneol=native#text/plain
+compiler/sparc64/cputarg.pas svneol=native#text/plain
 compiler/sparc64/rsp64con.inc svneol=native#text/pascal
 compiler/sparc64/rsp64con.inc svneol=native#text/pascal
 compiler/sparc64/rsp64dwrf.inc svneol=native#text/pascal
 compiler/sparc64/rsp64dwrf.inc svneol=native#text/pascal
 compiler/sparc64/rsp64nor.inc svneol=native#text/pascal
 compiler/sparc64/rsp64nor.inc svneol=native#text/pascal
@@ -701,10 +686,29 @@ compiler/sparc64/rsp64sri.inc svneol=native#text/pascal
 compiler/sparc64/rsp64stab.inc svneol=native#text/pascal
 compiler/sparc64/rsp64stab.inc svneol=native#text/pascal
 compiler/sparc64/rsp64std.inc svneol=native#text/pascal
 compiler/sparc64/rsp64std.inc svneol=native#text/pascal
 compiler/sparc64/rsp64sup.inc svneol=native#text/pascal
 compiler/sparc64/rsp64sup.inc svneol=native#text/pascal
+compiler/sparcgen/aasmcpu.pas svneol=native#text/plain
+compiler/sparcgen/aoptcpu.pas svneol=native#text/plain
+compiler/sparcgen/aoptcpub.pas svneol=native#text/plain
+compiler/sparcgen/cgcpu.pas svneol=native#text/plain
 compiler/sparcgen/cpubase.pas svneol=native#text/plain
 compiler/sparcgen/cpubase.pas svneol=native#text/plain
+compiler/sparcgen/cpugas.pas svneol=native#text/plain
+compiler/sparcgen/cpupi.pas svneol=native#text/plain
+compiler/sparcgen/hlcgcpu.pas svneol=native#text/plain
+compiler/sparcgen/itcpugas.pas svneol=native#text/plain
+compiler/sparcgen/ncpuadd.pas svneol=native#text/plain
+compiler/sparcgen/ncpucall.pas svneol=native#text/plain
+compiler/sparcgen/ncpucnv.pas svneol=native#text/plain
+compiler/sparcgen/ncpuinln.pas svneol=native#text/plain
+compiler/sparcgen/ncpumat.pas svneol=native#text/plain
+compiler/sparcgen/ncpuset.pas svneol=native#text/plain
 compiler/sparcgen/opcode.inc svneol=native#text/plain
 compiler/sparcgen/opcode.inc svneol=native#text/plain
+compiler/sparcgen/racpu.pas svneol=native#text/plain
+compiler/sparcgen/racpugas.pas svneol=native#text/plain
+compiler/sparcgen/rgcpu.pas svneol=native#text/plain
+compiler/sparcgen/sppara.pas svneol=native#text/plain
 compiler/sparcgen/spreg.dat svneol=native#text/plain
 compiler/sparcgen/spreg.dat svneol=native#text/plain
 compiler/sparcgen/strinst.inc svneol=native#text/plain
 compiler/sparcgen/strinst.inc svneol=native#text/plain
+compiler/sparcgen/symcpu.pas svneol=native#text/plain
 compiler/switches.pas svneol=native#text/plain
 compiler/switches.pas svneol=native#text/plain
 compiler/symbase.pas svneol=native#text/plain
 compiler/symbase.pas svneol=native#text/plain
 compiler/symconst.pas svneol=native#text/plain
 compiler/symconst.pas svneol=native#text/plain

+ 2 - 2
compiler/cgbase.pas

@@ -70,7 +70,7 @@ interface
          addr_full,
          addr_full,
          addr_pic,
          addr_pic,
          addr_pic_no_got
          addr_pic_no_got
-         {$IF defined(POWERPC) or defined(POWERPC64) or defined(SPARC) or defined(MIPS)}
+         {$IF defined(POWERPC) or defined(POWERPC64) or defined(SPARC) or defined(MIPS) or defined(SPARC64)}
          ,
          ,
          addr_low,         // bits 48-63
          addr_low,         // bits 48-63
          addr_high,        // bits 32-47
          addr_high,        // bits 32-47
@@ -84,7 +84,7 @@ interface
          addr_highera,     // bits 32-47, adjusted
          addr_highera,     // bits 32-47, adjusted
          addr_highesta     // bits 48-63, adjusted
          addr_highesta     // bits 48-63, adjusted
          {$ENDIF}
          {$ENDIF}
-         {$ENDIF POWERPC or POWERPC64 or SPARC or MIPS}
+         {$ENDIF POWERPC or POWERPC64 or SPARC or MIPS or SPARC64}
          {$IFDEF MIPS}
          {$IFDEF MIPS}
          ,
          ,
          addr_pic_call16,  // like addr_pic, but generates call16 reloc instead of got16
          addr_pic_call16,  // like addr_pic, but generates call16 reloc instead of got16

+ 2 - 266
compiler/sparc/cpupara.pas

@@ -28,19 +28,11 @@ interface
       cclasses,
       cclasses,
       aasmtai,aasmdata,
       aasmtai,aasmdata,
       cpubase,cpuinfo,
       cpubase,cpuinfo,
+      sppara,
       symconst,symbase,symsym,symtype,symdef,paramgr,parabase,cgbase,cgutils;
       symconst,symbase,symsym,symtype,symdef,paramgr,parabase,cgbase,cgutils;
 
 
     type
     type
-      tcpuparamanager=class(TParaManager)
-        function  push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
-        function  get_volatile_registers_int(calloption : tproccalloption):TCpuRegisterSet;override;
-        function  get_volatile_registers_fpu(calloption : tproccalloption):TCpuRegisterSet;override;
-        function  create_paraloc_info(p : TAbstractProcDef; side: tcallercallee):longint;override;
-        function  create_varargs_paraloc_info(p : TAbstractProcDef; varargspara:tvarargsparalist):longint;override;
-        function  get_funcretloc(p : tabstractprocdef; side: tcallercallee; forcetempdef: tdef): tcgpara;override;
-      private
-        procedure create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras: tparalist;
-                                             var intparareg,parasize:longint);
+      tcpuparamanager=class(TSparcParaManager)
       end;
       end;
 
 
 implementation
 implementation
@@ -50,262 +42,6 @@ implementation
       defutil,
       defutil,
       cgobj;
       cgobj;
 
 
-    type
-      tparasupregs = array[0..5] of tsuperregister;
-      pparasupregs = ^tparasupregs;
-    const
-      paraoutsupregs : tparasupregs = (RS_O0,RS_O1,RS_O2,RS_O3,RS_O4,RS_O5);
-      parainsupregs  : tparasupregs = (RS_I0,RS_I1,RS_I2,RS_I3,RS_I4,RS_I5);
-
-
-    function tcpuparamanager.get_volatile_registers_int(calloption : tproccalloption):TCpuRegisterSet;
-      begin
-        result:=[RS_G1,RS_O0,RS_O1,RS_O2,RS_O3,RS_O4,RS_O5,RS_O6,RS_O7];
-      end;
-
-
-    function tcpuparamanager.get_volatile_registers_fpu(calloption : tproccalloption):TCpuRegisterSet;
-      begin
-        result:=[RS_F0..RS_F31];
-      end;
-
-
-    { true if a parameter is too large to copy and only the address is pushed }
-    function tcpuparamanager.push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
-      begin
-        result:=false;
-        { var,out,constref always require address }
-        if varspez in [vs_var,vs_out,vs_constref] then
-          begin
-            result:=true;
-            exit;
-          end;
-        case def.typ of
-          arraydef:
-            result:=(tarraydef(def).highrange>=tarraydef(def).lowrange) or
-                             is_open_array(def) or
-                             is_array_of_const(def) or
-                             is_array_constructor(def);
-          recorddef,
-          variantdef,
-          formaldef :
-            result:=true;
-          objectdef :
-            result:=is_object(def);
-          stringdef :
-            result:=(tstringdef(def).stringtype in [st_shortstring,st_longstring]);
-          procvardef :
-            result:=not tprocvardef(def).is_addressonly;
-          setdef :
-            result:=not is_smallset(def);
-        end;
-      end;
-
-
-    function tcpuparamanager.get_funcretloc(p : tabstractprocdef; side: tcallercallee; forcetempdef: tdef): tcgpara;
-      var
-        paraloc : pcgparalocation;
-        retcgsize  : tcgsize;
-      begin
-        if set_common_funcretloc_info(p,forcetempdef,retcgsize,result) then
-          exit;
-
-        paraloc:=result.add_location;
-        { Return in FPU register? }
-        if result.def.typ=floatdef then
-          begin
-            paraloc^.loc:=LOC_FPUREGISTER;
-            paraloc^.register:=NR_FPU_RESULT_REG;
-            if retcgsize=OS_F64 then
-              setsubreg(paraloc^.register,R_SUBFD);
-            paraloc^.size:=retcgsize;
-            paraloc^.def:=result.def;
-          end
-        else
-         { Return in register }
-          begin
-{$ifndef cpu64bitaddr}
-            if retcgsize in [OS_64,OS_S64] then
-             begin
-               paraloc^.loc:=LOC_REGISTER;
-               { high }
-               if side=callerside then
-                 paraloc^.register:=NR_FUNCTION_RESULT64_HIGH_REG
-               else
-                 paraloc^.register:=NR_FUNCTION_RETURN64_HIGH_REG;
-               paraloc^.size:=OS_32;
-               paraloc^.def:=u32inttype;
-               { low }
-               paraloc:=result.add_location;
-               paraloc^.loc:=LOC_REGISTER;
-               if side=callerside then
-                 paraloc^.register:=NR_FUNCTION_RESULT64_LOW_REG
-               else
-                 paraloc^.register:=NR_FUNCTION_RETURN64_LOW_REG;
-               paraloc^.size:=OS_32;
-               paraloc^.def:=u32inttype;
-             end
-            else
-{$endif not cpu64bitaddr}
-             begin
-               paraloc^.loc:=LOC_REGISTER;
-               paraloc^.size:=retcgsize;
-               paraloc^.def:=result.def;
-               if (side=callerside) then
-                 paraloc^.register:=newreg(R_INTREGISTER,RS_FUNCTION_RESULT_REG,cgsize2subreg(R_INTREGISTER,retcgsize))
-               else
-                 paraloc^.register:=newreg(R_INTREGISTER,RS_FUNCTION_RETURN_REG,cgsize2subreg(R_INTREGISTER,retcgsize));
-             end;
-          end;
-      end;
-
-
-    procedure tcpuparamanager.create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee;paras:tparalist;
-                                                           var intparareg,parasize:longint);
-      var
-        paraloc      : pcgparalocation;
-        i            : integer;
-        hp           : tparavarsym;
-        paradef      : tdef;
-        paracgsize   : tcgsize;
-        hparasupregs : pparasupregs;
-        paralen      : longint;
-      begin
-        if side=callerside then
-          hparasupregs:=@paraoutsupregs
-        else
-          hparasupregs:=@parainsupregs;
-        for i:=0 to paras.count-1 do
-          begin
-            hp:=tparavarsym(paras[i]);
-            paradef:=hp.vardef;
-            { currently only support C-style array of const,
-              there should be no location assigned to the vararg array itself }
-            if (p.proccalloption in cstylearrayofconst) and
-               is_array_of_const(paradef) then
-              begin
-                paraloc:=hp.paraloc[side].add_location;
-                { hack: the paraloc must be valid, but is not actually used }
-                paraloc^.loc:=LOC_REGISTER;
-                paraloc^.register:=NR_G0;
-                paraloc^.size:=OS_ADDR;
-                paraloc^.def:=voidpointertype;
-                break;
-              end;
-
-            if push_addr_param(hp.varspez,paradef,p.proccalloption) then
-              begin
-                paracgsize:=OS_ADDR;
-                paradef:=cpointerdef.getreusable_no_free(paradef);
-              end
-            else
-              begin
-                paracgsize:=def_cgsize(paradef);
-                { for formaldef }
-                if paracgsize=OS_NO then
-                  begin
-                    paracgsize:=OS_ADDR;
-                    paradef:=voidpointertype;
-                  end;
-              end;
-            hp.paraloc[side].reset;
-            hp.paraloc[side].size:=paracgsize;
-            hp.paraloc[side].def:=paradef;
-            if (side = callerside) then
-              hp.paraloc[side].Alignment:=std_param_align
-            else
-              hp.paraloc[side].Alignment:=paradef.alignment;
-            paralen:=tcgsize2size[paracgsize];
-            hp.paraloc[side].intsize:=paralen;
-            while paralen>0 do
-              begin
-                paraloc:=hp.paraloc[side].add_location;
-                { Floats are passed in int registers,
-                  We can allocate at maximum 32 bits per register }
-                if paracgsize in [OS_64,OS_S64,OS_F32,OS_F64] then
-                  begin
-                    paraloc^.size:=OS_32;
-                    paraloc^.def:=u32inttype;
-                  end
-                else
-                  begin
-                    paraloc^.size:=paracgsize;
-                    paraloc^.def:=paradef;
-                  end;
-                { ret in param? }
-                if vo_is_funcret in hp.varoptions then
-                  begin
-                    paraloc^.loc:=LOC_REFERENCE;
-                    if side=callerside then
-                      paraloc^.reference.index:=NR_STACK_POINTER_REG
-                    else
-                      paraloc^.reference.index:=NR_FRAME_POINTER_REG;
-                    paraloc^.reference.offset:=64;
-                  end
-                { In case of po_delphi_nested_cc, the parent frame pointer
-                  is always passed on the stack. }
-                else if (intparareg<=high(tparasupregs)) and
-                   (not(vo_is_parentfp in hp.varoptions) or
-                    not(po_delphi_nested_cc in p.procoptions)) then
-                  begin
-                    paraloc^.loc:=LOC_REGISTER;
-                    paraloc^.register:=newreg(R_INTREGISTER,hparasupregs^[intparareg],R_SUBWHOLE);
-                    inc(intparareg);
-                  end
-                else
-                  begin
-                    paraloc^.loc:=LOC_REFERENCE;
-                    if side=callerside then
-                      paraloc^.reference.index:=NR_STACK_POINTER_REG
-                    else
-                      paraloc^.reference.index:=NR_FRAME_POINTER_REG;
-                    paraloc^.reference.offset:=target_info.first_parm_offset+parasize;
-
-                    if (target_info.endian=endian_big) and
-                       (paralen<tcgsize2size[OS_INT]) and
-                       (paradef.typ<>recorddef) then
-                      inc(paraloc^.reference.offset,4-paralen);
-
-                    { Parameters are aligned at 4 bytes }
-                    inc(parasize,align(tcgsize2size[paraloc^.size],sizeof(pint)));
-                  end;
-                dec(paralen,tcgsize2size[paraloc^.size]);
-              end;
-          end;
-      end;
-
-
-    function tcpuparamanager.create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargsparalist):longint;
-      var
-        intparareg,
-        parasize : longint;
-      begin
-        intparareg:=0;
-        parasize:=0;
-        { calculate the registers for the normal parameters }
-        create_paraloc_info_intern(p,callerside,p.paras,intparareg,parasize);
-        { append the varargs }
-        create_paraloc_info_intern(p,callerside,varargspara,intparareg,parasize);
-        result:=parasize;
-      end;
-
-
-
-    function tcpuparamanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;
-      var
-        intparareg,
-        parasize : longint;
-      begin
-        intparareg:=0;
-        parasize:=0;
-        create_paraloc_info_intern(p,side,p.paras,intparareg,parasize);
-        { Create Function result paraloc }
-        create_funcretloc_info(p,side);
-        { We need to return the size allocated on the stack }
-        result:=parasize;
-      end;
-
-
 begin
 begin
    ParaManager:=tcpuparamanager.create;
    ParaManager:=tcpuparamanager.create;
 end.
 end.

+ 41 - 0
compiler/sparc64/cpunode.pas

@@ -0,0 +1,41 @@
+{******************************************************************************
+    Copyright (c) 2000 by Florian Klaempfl
+
+    Includes the SPARC64 code generator
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ *****************************************************************************}
+unit CpuNode;
+
+{$I fpcdefs.inc}
+
+interface
+{ This unit is used to define the specific CPU implementations. All needed
+actions are included in the INITALIZATION part of these units. This explains
+the behaviour of such a unit having just a USES clause! }
+
+implementation
+
+  uses
+    ncgbas,ncgflw,ncgcnv,ncgld,ncgmem,ncgcon,ncgset,
+    ncpuadd,ncpucall,ncpumat,ncpuinln,ncpucnv,ncpuset,
+    { this not really a node }
+    rgcpu,
+    { symtable }
+    symcpu,
+    aasmdef;
+
+end.

+ 47 - 0
compiler/sparc64/cpupara.pas

@@ -0,0 +1,47 @@
+{
+    Copyright (c) 1998-2002 by Florian Klaempfl
+
+    Calling conventions for the SPARC64
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *****************************************************************************}
+unit cpupara;
+
+{$i fpcdefs.inc}
+
+interface
+
+    uses
+      globtype,
+      cclasses,
+      aasmtai,aasmdata,
+      cpubase,cpuinfo,
+      sppara,
+      symconst,symbase,symsym,symtype,symdef,paramgr,parabase,cgbase,cgutils;
+
+    type
+      tcpuparamanager=class(TSparcParaManager)
+      end;
+
+implementation
+
+    uses
+      cutils,verbose,systems,
+      defutil,
+      cgobj;
+
+begin
+   ParaManager:=tcpuparamanager.create;
+end.

+ 86 - 0
compiler/sparc64/cputarg.pas

@@ -0,0 +1,86 @@
+{
+    Copyright (c) 2001 by Peter Vreman
+
+    Includes the i386 dependent target units
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+unit cputarg;
+
+{$i fpcdefs.inc}
+
+interface
+
+
+implementation
+
+    uses
+      systems { prevent a syntax error when nothing is included }
+
+{$ifndef NOOPT}
+      ,aoptcpu
+{$endif NOOPT}
+
+{**************************************
+             Targets
+**************************************}
+
+    {$ifndef NOTARGETLINUX}
+      ,t_linux
+    {$endif}
+    {$ifndef NOTARGETSUNOS}
+//      ,t_sunos
+    {$endif}
+
+{**************************************
+             Assemblers
+**************************************}
+
+      ,CpuGas
+
+    { Sparc elf generator is not ready yet }
+    {$ifndef TEST_AGSPARC_ELF}
+      {$define NOAGSPARC_ELF}
+    {$endif TEST_AGSPARC_ELF}
+    { To be removed once implemented. PM }
+    {$ifndef NOAGSPARC_ELF}
+      ,ogelf
+      ,cpuelf
+    {$endif}
+
+{**************************************
+        Assembler Readers
+**************************************}
+
+  {$ifndef NoSparcgas}
+       ,racpugas
+  {$endif NoSparcgas}
+
+{**************************************
+             Debuginfo
+**************************************}
+
+  {$ifndef NoDbgStabs}
+      ,dbgstabs
+  {$endif NoDbgStabs}
+  {$ifndef NoDbgDwarf}
+      ,dbgdwarf
+  {$endif NoDbgDwarf}
+
+      ;
+
+end.

+ 0 - 0
compiler/sparc/aasmcpu.pas → compiler/sparcgen/aasmcpu.pas


+ 0 - 0
compiler/sparc/aoptcpu.pas → compiler/sparcgen/aoptcpu.pas


+ 0 - 0
compiler/sparc/aoptcpub.pas → compiler/sparcgen/aoptcpub.pas


+ 12 - 3
compiler/sparc/cgcpu.pas → compiler/sparcgen/cgcpu.pas

@@ -27,7 +27,10 @@ interface
 
 
     uses
     uses
        globtype,parabase,
        globtype,parabase,
-       cgbase,cgutils,cgobj,cg64f32,
+       cgbase,cgutils,cgobj,
+{$ifndef SPARC64}
+       cg64f32,
+{$endif SPARC64}
        aasmbase,aasmtai,aasmdata,aasmcpu,
        aasmbase,aasmtai,aasmdata,aasmcpu,
        cpubase,cpuinfo,
        cpubase,cpuinfo,
        node,symconst,SymType,symdef,
        node,symconst,SymType,symdef,
@@ -92,6 +95,7 @@ interface
         use_unlimited_pic_mode : boolean;
         use_unlimited_pic_mode : boolean;
       end;
       end;
 
 
+{$ifndef SPARC64}
       TCg64Sparc=class(tcg64f32)
       TCg64Sparc=class(tcg64f32)
       private
       private
         procedure get_64bit_ops(op:TOpCG;var op1,op2:TAsmOp;checkoverflow : boolean);
         procedure get_64bit_ops(op:TOpCG;var op1,op2:TAsmOp;checkoverflow : boolean);
@@ -106,6 +110,7 @@ interface
         procedure a_op64_const_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation);override;
         procedure a_op64_const_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;value : int64;regsrc,regdst : tregister64;setflags : boolean;var ovloc : tlocation);override;
         procedure a_op64_reg_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation);override;
         procedure a_op64_reg_reg_reg_checkoverflow(list: TAsmList;op:TOpCG;size : tcgsize;regsrc1,regsrc2,regdst : tregister64;setflags : boolean;var ovloc : tlocation);override;
       end;
       end;
+{$endif SPARC64}
 
 
     procedure create_codegen;
     procedure create_codegen;
 
 
@@ -1129,7 +1134,7 @@ implementation
         countreg: TRegister;
         countreg: TRegister;
         src, dst: TReference;
         src, dst: TReference;
         lab: tasmlabel;
         lab: tasmlabel;
-        count, count2: aint;
+        count, count2: longint;
 
 
         function reference_is_reusable(const ref: treference): boolean;
         function reference_is_reusable(const ref: treference): boolean;
           begin
           begin
@@ -1223,7 +1228,7 @@ implementation
         src, dst: TReference;
         src, dst: TReference;
         tmpreg1,
         tmpreg1,
         countreg: TRegister;
         countreg: TRegister;
-        i : aint;
+        i : longint;
         lab: tasmlabel;
         lab: tasmlabel;
       begin
       begin
         if len>31 then
         if len>31 then
@@ -1276,6 +1281,7 @@ implementation
       end;
       end;
 
 
 
 
+{$ifndef SPARC64}
 {****************************************************************************
 {****************************************************************************
                                TCG64Sparc
                                TCG64Sparc
 ****************************************************************************}
 ****************************************************************************}
@@ -1434,6 +1440,7 @@ implementation
         list.concat(taicpu.op_reg_reg_reg(op1,regsrc2.reglo,regsrc1.reglo,regdst.reglo));
         list.concat(taicpu.op_reg_reg_reg(op1,regsrc2.reglo,regsrc1.reglo,regdst.reglo));
         list.concat(taicpu.op_reg_reg_reg(op2,regsrc2.reghi,regsrc1.reghi,regdst.reghi));
         list.concat(taicpu.op_reg_reg_reg(op2,regsrc2.reghi,regsrc1.reghi,regdst.reghi));
       end;
       end;
+{$endif SPARC64}
 
 
 
 
     procedure create_codegen;
     procedure create_codegen;
@@ -1443,7 +1450,9 @@ implementation
           TCgSparc(cg).use_unlimited_pic_mode:=true
           TCgSparc(cg).use_unlimited_pic_mode:=true
         else
         else
           TCgSparc(cg).use_unlimited_pic_mode:=false;
           TCgSparc(cg).use_unlimited_pic_mode:=false;
+{$ifndef SPARC64}
         cg64:=TCg64Sparc.Create;
         cg64:=TCg64Sparc.Create;
+{$endif SPARC64}
       end;
       end;
 
 
 end.
 end.

+ 4 - 1
compiler/sparc/cpugas.pas → compiler/sparcgen/cpugas.pas

@@ -74,8 +74,11 @@ implementation
          //
          //
          // v9 is required as the default since the RTL started using membar at 2.2.2.
          // v9 is required as the default since the RTL started using membar at 2.2.2.
          case current_settings.cputype of
          case current_settings.cputype of
+{$ifdef SPARC}
            cpu_SPARC_V7: Replace(result,'$ARCH','-Av7');
            cpu_SPARC_V7: Replace(result,'$ARCH','-Av7');
-           cpu_SPARC_V8: Replace(result,'$ARCH','-Av8')
+           cpu_SPARC_V8: Replace(result,'$ARCH','-Av8');
+{$endif SPARC}
+           cpu_SPARC_V9: Replace(result,'$ARCH','-Av7');
          else
          else
            Replace(result,'$ARCH','-Av9')
            Replace(result,'$ARCH','-Av9')
          end
          end

+ 0 - 0
compiler/sparc/cpupi.pas → compiler/sparcgen/cpupi.pas


+ 0 - 0
compiler/sparc/hlcgcpu.pas → compiler/sparcgen/hlcgcpu.pas


+ 10 - 1
compiler/sparc/itcpugas.pas → compiler/sparcgen/itcpugas.pas

@@ -41,6 +41,15 @@ implementation
       cutils,verbose;
       cutils,verbose;
 
 
     const
     const
+{$ifdef SPARC64}
+      gas_regname_table : array[tregisterindex] of string[7] = (
+        {$i rsp64std.inc}
+      );
+
+      gas_regname_index : array[tregisterindex] of tregisterindex = (
+        {$i rsp64sri.inc}
+      );
+{$else SPARC64}
       gas_regname_table : array[tregisterindex] of string[7] = (
       gas_regname_table : array[tregisterindex] of string[7] = (
         {$i rspstd.inc}
         {$i rspstd.inc}
       );
       );
@@ -48,7 +57,7 @@ implementation
       gas_regname_index : array[tregisterindex] of tregisterindex = (
       gas_regname_index : array[tregisterindex] of tregisterindex = (
         {$i rspsri.inc}
         {$i rspsri.inc}
       );
       );
-
+{$endif SPARC64}
 
 
     function findreg_by_gasname(const s:string):tregisterindex;
     function findreg_by_gasname(const s:string):tregisterindex;
       var
       var

+ 7 - 1
compiler/sparc/ncpuadd.pas → compiler/sparcgen/ncpuadd.pas

@@ -38,7 +38,9 @@ interface
           procedure second_cmpfloat;override;
           procedure second_cmpfloat;override;
           procedure second_cmpboolean;override;
           procedure second_cmpboolean;override;
           procedure second_cmpsmallset;override;
           procedure second_cmpsmallset;override;
+{$ifndef SPARC64}
           procedure second_cmp64bit;override;
           procedure second_cmp64bit;override;
+{$endif SPARC64}
           procedure second_cmpordinal;override;
           procedure second_cmpordinal;override;
           procedure second_addordinal;override;
           procedure second_addordinal;override;
        public
        public
@@ -306,7 +308,7 @@ interface
         end;
         end;
       end;
       end;
 
 
-
+{$ifndef SPARC64}
     procedure tsparcaddnode.second_cmp64bit;
     procedure tsparcaddnode.second_cmp64bit;
       var
       var
         unsigned   : boolean;
         unsigned   : boolean;
@@ -414,6 +416,7 @@ interface
               InternalError(2014011001);
               InternalError(2014011001);
           end;
           end;
       end;
       end;
+{$endif SPARC64}
 
 
 
 
     procedure tsparcaddnode.second_cmpordinal;
     procedure tsparcaddnode.second_cmpordinal;
@@ -443,8 +446,10 @@ interface
       var
       var
         unsigned: boolean;
         unsigned: boolean;
       begin
       begin
+{$ifndef SPARC64}
         unsigned:=not(is_signed(left.resultdef)) or
         unsigned:=not(is_signed(left.resultdef)) or
                   not(is_signed(right.resultdef));
                   not(is_signed(right.resultdef));
+
         if (nodetype=muln) and is_64bit(resultdef) then
         if (nodetype=muln) and is_64bit(resultdef) then
           begin
           begin
             pass_left_right;
             pass_left_right;
@@ -456,6 +461,7 @@ interface
             current_asmdata.CurrAsmList.Concat(taicpu.op_reg_reg(A_MOV,NR_Y,location.register64.reghi));
             current_asmdata.CurrAsmList.Concat(taicpu.op_reg_reg(A_MOV,NR_Y,location.register64.reghi));
           end
           end
         else
         else
+{$endif SPARC64}
           inherited second_addordinal;
           inherited second_addordinal;
       end;
       end;
 
 

+ 0 - 0
compiler/sparc/ncpucall.pas → compiler/sparcgen/ncpucall.pas


+ 0 - 0
compiler/sparc/ncpucnv.pas → compiler/sparcgen/ncpucnv.pas


+ 0 - 0
compiler/sparc/ncpuinln.pas → compiler/sparcgen/ncpuinln.pas


+ 6 - 0
compiler/sparc/ncpumat.pas → compiler/sparcgen/ncpumat.pas

@@ -34,9 +34,11 @@ interface
       end;
       end;
 
 
       tSparcshlshrnode = class(tcgshlshrnode)
       tSparcshlshrnode = class(tcgshlshrnode)
+{$ifndef SPARC64}
          procedure second_64bit;override;
          procedure second_64bit;override;
          { everything will be handled in pass_2 }
          { everything will be handled in pass_2 }
          function first_shlshr64bitint: tnode; override;
          function first_shlshr64bitint: tnode; override;
+{$endif SPARC64}
       end;
       end;
 
 
       tSparcnotnode = class(tcgnotnode)
       tSparcnotnode = class(tcgnotnode)
@@ -171,6 +173,7 @@ implementation
                              TSparcSHLRSHRNODE
                              TSparcSHLRSHRNODE
 *****************************************************************************}
 *****************************************************************************}
 
 
+{$ifndef SPARC64}
     function TSparcShlShrNode.first_shlshr64bitint:TNode;
     function TSparcShlShrNode.first_shlshr64bitint:TNode;
       begin
       begin
         { 64bit without constants need a helper }
         { 64bit without constants need a helper }
@@ -248,6 +251,7 @@ implementation
               end;
               end;
           end;
           end;
       end;
       end;
+{$endif SPARC64}
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -271,10 +275,12 @@ implementation
               LOC_SUBSETREF, LOC_CSUBSETREF:
               LOC_SUBSETREF, LOC_CSUBSETREF:
                 begin
                 begin
                   hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
                   hlcg.location_force_reg(current_asmdata.CurrAsmList,left.location,left.resultdef,left.resultdef,true);
+{$ifndef SPARC64}
                   if is_64bit(left.resultdef) then
                   if is_64bit(left.resultdef) then
                     current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ORcc,
                     current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(A_ORcc,
                       left.location.register64.reglo,left.location.register64.reghi,NR_G0))
                       left.location.register64.reglo,left.location.register64.reghi,NR_G0))
                   else
                   else
+{$endif SPARC64}
                     current_asmdata.CurrAsmList.concat(taicpu.op_reg_const_reg(A_SUBcc,left.location.register,0,NR_G0));
                     current_asmdata.CurrAsmList.concat(taicpu.op_reg_const_reg(A_SUBcc,left.location.register,0,NR_G0));
                   location_reset(location,LOC_FLAGS,OS_NO);
                   location_reset(location,LOC_FLAGS,OS_NO);
                   location.resflags:=F_E;
                   location.resflags:=F_E;

+ 4 - 2
compiler/sparc/ncpuset.pas → compiler/sparcgen/ncpuset.pas

@@ -79,9 +79,11 @@ unit ncpuset;
             if assigned(t^.less) then
             if assigned(t^.less) then
               genitem(list,t^.less);
               genitem(list,t^.less);
             { fill possible hole }
             { fill possible hole }
-            for i:=last.svalue+1 to t^._low.svalue-1 do
+            i:=last.svalue+1;
+            while i<=t^._low.svalue-1 do
               list.concat(Tai_const.Create_rel_sym(aitconst_ptr,base,elselabel));
               list.concat(Tai_const.Create_rel_sym(aitconst_ptr,base,elselabel));
-            for i:=t^._low.svalue to t^._high.svalue do
+            i:=t^._low.svalue;
+            while i<=t^._high.svalue do
               list.concat(Tai_const.Create_rel_sym(aitconst_ptr,base,blocklabel(t^.blockid)));
               list.concat(Tai_const.Create_rel_sym(aitconst_ptr,base,blocklabel(t^.blockid)));
             last:=t^._high;
             last:=t^._high;
             if assigned(t^.greater) then
             if assigned(t^.greater) then

+ 0 - 0
compiler/sparc/racpu.pas → compiler/sparcgen/racpu.pas


+ 0 - 0
compiler/sparc/racpugas.pas → compiler/sparcgen/racpugas.pas


+ 0 - 0
compiler/sparc/rgcpu.pas → compiler/sparcgen/rgcpu.pas


+ 309 - 0
compiler/sparcgen/sppara.pas

@@ -0,0 +1,309 @@
+{
+    Copyright (c) 1998-2002 by Florian Klaempfl
+
+    Calling conventions for the SPARC
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *****************************************************************************}
+unit sppara;
+
+{$i fpcdefs.inc}
+
+interface
+
+    uses
+      globtype,
+      cclasses,
+      aasmtai,aasmdata,
+      cpubase,cpuinfo,
+      symconst,symbase,symsym,symtype,symdef,paramgr,parabase,cgbase,cgutils;
+
+    type
+      tsparcparamanager=class(TParaManager)
+        function  push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
+        function  get_volatile_registers_int(calloption : tproccalloption):TCpuRegisterSet;override;
+        function  get_volatile_registers_fpu(calloption : tproccalloption):TCpuRegisterSet;override;
+        function  create_paraloc_info(p : TAbstractProcDef; side: tcallercallee):longint;override;
+        function  create_varargs_paraloc_info(p : TAbstractProcDef; varargspara:tvarargsparalist):longint;override;
+        function  get_funcretloc(p : tabstractprocdef; side: tcallercallee; forcetempdef: tdef): tcgpara;override;
+      private
+        procedure create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras: tparalist;
+                                             var intparareg,parasize:longint);
+      end;
+
+implementation
+
+    uses
+      cutils,verbose,systems,
+      defutil,
+      cgobj;
+
+    type
+      tparasupregs = array[0..5] of tsuperregister;
+      pparasupregs = ^tparasupregs;
+    const
+      paraoutsupregs : tparasupregs = (RS_O0,RS_O1,RS_O2,RS_O3,RS_O4,RS_O5);
+      parainsupregs  : tparasupregs = (RS_I0,RS_I1,RS_I2,RS_I3,RS_I4,RS_I5);
+
+
+    function tsparcparamanager.get_volatile_registers_int(calloption : tproccalloption):TCpuRegisterSet;
+      begin
+        result:=[RS_G1,RS_O0,RS_O1,RS_O2,RS_O3,RS_O4,RS_O5,RS_O6,RS_O7];
+      end;
+
+
+    function tsparcparamanager.get_volatile_registers_fpu(calloption : tproccalloption):TCpuRegisterSet;
+      begin
+        result:=[RS_F0..RS_F31];
+      end;
+
+
+    { true if a parameter is too large to copy and only the address is pushed }
+    function tsparcparamanager.push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
+      begin
+        result:=false;
+        { var,out,constref always require address }
+        if varspez in [vs_var,vs_out,vs_constref] then
+          begin
+            result:=true;
+            exit;
+          end;
+        case def.typ of
+          arraydef:
+            result:=(tarraydef(def).highrange>=tarraydef(def).lowrange) or
+                             is_open_array(def) or
+                             is_array_of_const(def) or
+                             is_array_constructor(def);
+          recorddef,
+          variantdef,
+          formaldef :
+            result:=true;
+          objectdef :
+            result:=is_object(def);
+          stringdef :
+            result:=(tstringdef(def).stringtype in [st_shortstring,st_longstring]);
+          procvardef :
+            result:=not tprocvardef(def).is_addressonly;
+          setdef :
+            result:=not is_smallset(def);
+        end;
+      end;
+
+
+    function tsparcparamanager.get_funcretloc(p : tabstractprocdef; side: tcallercallee; forcetempdef: tdef): tcgpara;
+      var
+        paraloc : pcgparalocation;
+        retcgsize  : tcgsize;
+      begin
+        if set_common_funcretloc_info(p,forcetempdef,retcgsize,result) then
+          exit;
+
+        paraloc:=result.add_location;
+        { Return in FPU register? }
+        if result.def.typ=floatdef then
+          begin
+            paraloc^.loc:=LOC_FPUREGISTER;
+            paraloc^.register:=NR_FPU_RESULT_REG;
+            if retcgsize=OS_F64 then
+              setsubreg(paraloc^.register,R_SUBFD);
+            paraloc^.size:=retcgsize;
+            paraloc^.def:=result.def;
+          end
+        else
+         { Return in register }
+          begin
+{$ifndef cpu64bitaddr}
+            if retcgsize in [OS_64,OS_S64] then
+             begin
+               paraloc^.loc:=LOC_REGISTER;
+               { high }
+               if side=callerside then
+                 paraloc^.register:=NR_FUNCTION_RESULT64_HIGH_REG
+               else
+                 paraloc^.register:=NR_FUNCTION_RETURN64_HIGH_REG;
+               paraloc^.size:=OS_32;
+               paraloc^.def:=u32inttype;
+               { low }
+               paraloc:=result.add_location;
+               paraloc^.loc:=LOC_REGISTER;
+               if side=callerside then
+                 paraloc^.register:=NR_FUNCTION_RESULT64_LOW_REG
+               else
+                 paraloc^.register:=NR_FUNCTION_RETURN64_LOW_REG;
+               paraloc^.size:=OS_32;
+               paraloc^.def:=u32inttype;
+             end
+            else
+{$endif not cpu64bitaddr}
+             begin
+               paraloc^.loc:=LOC_REGISTER;
+               paraloc^.size:=retcgsize;
+               paraloc^.def:=result.def;
+               if (side=callerside) then
+                 paraloc^.register:=newreg(R_INTREGISTER,RS_FUNCTION_RESULT_REG,cgsize2subreg(R_INTREGISTER,retcgsize))
+               else
+                 paraloc^.register:=newreg(R_INTREGISTER,RS_FUNCTION_RETURN_REG,cgsize2subreg(R_INTREGISTER,retcgsize));
+             end;
+          end;
+      end;
+
+
+    procedure tsparcparamanager.create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee;paras:tparalist;
+                                                           var intparareg,parasize:longint);
+      var
+        paraloc      : pcgparalocation;
+        i            : integer;
+        hp           : tparavarsym;
+        paradef      : tdef;
+        paracgsize   : tcgsize;
+        hparasupregs : pparasupregs;
+        paralen      : longint;
+      begin
+        if side=callerside then
+          hparasupregs:=@paraoutsupregs
+        else
+          hparasupregs:=@parainsupregs;
+        for i:=0 to paras.count-1 do
+          begin
+            hp:=tparavarsym(paras[i]);
+            paradef:=hp.vardef;
+            { currently only support C-style array of const,
+              there should be no location assigned to the vararg array itself }
+            if (p.proccalloption in cstylearrayofconst) and
+               is_array_of_const(paradef) then
+              begin
+                paraloc:=hp.paraloc[side].add_location;
+                { hack: the paraloc must be valid, but is not actually used }
+                paraloc^.loc:=LOC_REGISTER;
+                paraloc^.register:=NR_G0;
+                paraloc^.size:=OS_ADDR;
+                paraloc^.def:=voidpointertype;
+                break;
+              end;
+
+            if push_addr_param(hp.varspez,paradef,p.proccalloption) then
+              begin
+                paracgsize:=OS_ADDR;
+                paradef:=cpointerdef.getreusable_no_free(paradef);
+              end
+            else
+              begin
+                paracgsize:=def_cgsize(paradef);
+                { for formaldef }
+                if paracgsize=OS_NO then
+                  begin
+                    paracgsize:=OS_ADDR;
+                    paradef:=voidpointertype;
+                  end;
+              end;
+            hp.paraloc[side].reset;
+            hp.paraloc[side].size:=paracgsize;
+            hp.paraloc[side].def:=paradef;
+            if (side = callerside) then
+              hp.paraloc[side].Alignment:=std_param_align
+            else
+              hp.paraloc[side].Alignment:=paradef.alignment;
+            paralen:=tcgsize2size[paracgsize];
+            hp.paraloc[side].intsize:=paralen;
+            while paralen>0 do
+              begin
+                paraloc:=hp.paraloc[side].add_location;
+                { Floats are passed in int registers,
+                  We can allocate at maximum 32 bits per register }
+                if paracgsize in [OS_64,OS_S64,OS_F32,OS_F64] then
+                  begin
+                    paraloc^.size:=OS_32;
+                    paraloc^.def:=u32inttype;
+                  end
+                else
+                  begin
+                    paraloc^.size:=paracgsize;
+                    paraloc^.def:=paradef;
+                  end;
+                { ret in param? }
+                if vo_is_funcret in hp.varoptions then
+                  begin
+                    paraloc^.loc:=LOC_REFERENCE;
+                    if side=callerside then
+                      paraloc^.reference.index:=NR_STACK_POINTER_REG
+                    else
+                      paraloc^.reference.index:=NR_FRAME_POINTER_REG;
+                    paraloc^.reference.offset:=64;
+                  end
+                { In case of po_delphi_nested_cc, the parent frame pointer
+                  is always passed on the stack. }
+                else if (intparareg<=high(tparasupregs)) and
+                   (not(vo_is_parentfp in hp.varoptions) or
+                    not(po_delphi_nested_cc in p.procoptions)) then
+                  begin
+                    paraloc^.loc:=LOC_REGISTER;
+                    paraloc^.register:=newreg(R_INTREGISTER,hparasupregs^[intparareg],R_SUBWHOLE);
+                    inc(intparareg);
+                  end
+                else
+                  begin
+                    paraloc^.loc:=LOC_REFERENCE;
+                    if side=callerside then
+                      paraloc^.reference.index:=NR_STACK_POINTER_REG
+                    else
+                      paraloc^.reference.index:=NR_FRAME_POINTER_REG;
+                    paraloc^.reference.offset:=target_info.first_parm_offset+parasize;
+
+                    if (target_info.endian=endian_big) and
+                       (paralen<tcgsize2size[OS_INT]) and
+                       (paradef.typ<>recorddef) then
+                      inc(paraloc^.reference.offset,4-paralen);
+
+                    { Parameters are aligned at 4 bytes }
+                    inc(parasize,align(tcgsize2size[paraloc^.size],sizeof(pint)));
+                  end;
+                dec(paralen,tcgsize2size[paraloc^.size]);
+              end;
+          end;
+      end;
+
+
+    function tsparcparamanager.create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargsparalist):longint;
+      var
+        intparareg,
+        parasize : longint;
+      begin
+        intparareg:=0;
+        parasize:=0;
+        { calculate the registers for the normal parameters }
+        create_paraloc_info_intern(p,callerside,p.paras,intparareg,parasize);
+        { append the varargs }
+        create_paraloc_info_intern(p,callerside,varargspara,intparareg,parasize);
+        result:=parasize;
+      end;
+
+
+
+    function tsparcparamanager.create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;
+      var
+        intparareg,
+        parasize : longint;
+      begin
+        intparareg:=0;
+        parasize:=0;
+        create_paraloc_info_intern(p,side,p.paras,intparareg,parasize);
+        { Create Function result paraloc }
+        create_funcretloc_info(p,side);
+        { We need to return the size allocated on the stack }
+        result:=parasize;
+      end;
+
+
+end.

+ 0 - 0
compiler/sparc/symcpu.pas → compiler/sparcgen/symcpu.pas


+ 6 - 0
compiler/systems/t_linux.pas

@@ -209,6 +209,11 @@ const defdynlinker='/lib/ld-linux-aarch64.so.1';
   const defdynlinker='/lib/ld.so.1';
   const defdynlinker='/lib/ld.so.1';
 {$endif mips}
 {$endif mips}
 
 
+{$ifdef sparc64}
+  const defdynlinker='/lib64/ld-linux.so.2';
+{$endif sparc64}
+
+
 procedure SetupDynlinker(out DynamicLinker:string;out libctype:TLibcType);
 procedure SetupDynlinker(out DynamicLinker:string;out libctype:TLibcType);
 begin
 begin
 {$ifdef powerpc64}
 {$ifdef powerpc64}
@@ -301,6 +306,7 @@ const
 {$ifdef powerpc}   platform_select='-b elf32-powerpc -m elf32ppclinux';{$endif}
 {$ifdef powerpc}   platform_select='-b elf32-powerpc -m elf32ppclinux';{$endif}
 {$ifdef POWERPC64} platform_select='';{$endif}
 {$ifdef POWERPC64} platform_select='';{$endif}
 {$ifdef sparc}     platform_select='-b elf32-sparc -m elf32_sparc';{$endif}
 {$ifdef sparc}     platform_select='-b elf32-sparc -m elf32_sparc';{$endif}
+{$ifdef sparc64}     platform_select='-b elf64-sparc64 -m elf32_sparc64';{$endif}
 {$ifdef arm}       platform_select='';{$endif} {unknown :( }
 {$ifdef arm}       platform_select='';{$endif} {unknown :( }
 {$ifdef aarch64}   platform_select='';{$endif} {unknown :( }
 {$ifdef aarch64}   platform_select='';{$endif} {unknown :( }
 {$ifdef m68k}      platform_select='';{$endif} {unknown :( }
 {$ifdef m68k}      platform_select='';{$endif} {unknown :( }