Browse Source

* completely merged ppc assembler writers

git-svn-id: branches/fpc_2_3@6434 -
Jonas Maebe 18 years ago
parent
commit
04a1efcc65
4 changed files with 108 additions and 242 deletions
  1. 1 3
      .gitattributes
  2. 0 139
      compiler/powerpc/agppcgas.pas
  3. 0 97
      compiler/powerpc64/agppcgas.pas
  4. 107 3
      compiler/ppcgen/agppcgas.pas

+ 1 - 3
.gitattributes

@@ -297,7 +297,6 @@ compiler/pexports.pas svneol=native#text/plain
 compiler/pexpr.pas svneol=native#text/plain
 compiler/pinline.pas svneol=native#text/plain
 compiler/pmodules.pas svneol=native#text/plain
-compiler/powerpc/agppcgas.pas svneol=native#text/plain
 compiler/powerpc/agppcmpw.pas svneol=native#text/plain
 compiler/powerpc/aoptcpu.pas svneol=native#text/plain
 compiler/powerpc/aoptcpub.pas svneol=native#text/plain
@@ -332,7 +331,6 @@ compiler/powerpc/rppcsri.inc svneol=native#text/plain
 compiler/powerpc/rppcstab.inc svneol=native#text/plain
 compiler/powerpc/rppcstd.inc svneol=native#text/plain
 compiler/powerpc/rppcsup.inc svneol=native#text/plain
-compiler/powerpc64/agppcgas.pas svneol=native#text/plain
 compiler/powerpc64/aoptcpu.pas svneol=native#text/plain
 compiler/powerpc64/aoptcpub.pas svneol=native#text/plain
 compiler/powerpc64/aoptcpuc.pas svneol=native#text/plain
@@ -377,7 +375,7 @@ compiler/ppc.dof -text
 compiler/ppc68k.lpi svneol=native#text/plain
 compiler/ppcarm.lpi svneol=native#text/plain
 compiler/ppcgen/aasmcpu.pas svneol=native#text/plain
-compiler/ppcgen/agppcutl.pas svneol=native#text/plain
+compiler/ppcgen/agppcgas.pas svneol=native#text/plain
 compiler/ppcgen/cgppc.pas svneol=native#text/plain
 compiler/ppcgen/ngppcadd.pas svneol=native#text/plain
 compiler/ppcgen/ngppccnv.pas svneol=native#text/plain

+ 0 - 139
compiler/powerpc/agppcgas.pas

@@ -1,139 +0,0 @@
-{
-    Copyright (c) 1998-2002 by Florian Klaempfl
-
-    This unit implements an asm for the PowerPC
-
-    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.
-
- ****************************************************************************
-}
-{ This unit implements the GNU Assembler writer for the PowerPC
-}
-
-unit agppcgas;
-
-{$i fpcdefs.inc}
-
-  interface
-
-    uses
-       aasmbase,
-       aasmtai,aasmdata,
-       aggas,
-       cpubase,
-       globtype;
-
-    type
-      TPPCGNUAssembler=class(TGNUassembler)
-        constructor create(smart: boolean); override;
-        procedure WriteExtraHeader; override;
-      end;
-
-      TPPCAppleGNUAssembler=class(TAppleGNUassembler)
-        constructor create(smart: boolean); override;
-        function MakeCmdLine: TCmdStr; override;
-      end;
-
-  implementation
-
-    uses
-       cutils,globals,verbose,
-       cgbase,cgutils,systems,
-       assemble,
-       itcpugas,cpuinfo,
-       aasmcpu,agppcutl;
-
-{****************************************************************************}
-{                         GNU PPC Assembler writer                           }
-{****************************************************************************}
-
-    constructor TPPCGNUAssembler.create(smart: boolean);
-      begin
-        inherited create(smart);
-        InstrWriter := TPPCInstrWriter.create(self);
-      end;
-
-
-    procedure TPPCGNUAssembler.WriteExtraHeader;
-      var
-         i : longint;
-      begin
-        for i:=0 to 31 do
-          AsmWriteln(#9'.set'#9'r'+tostr(i)+','+tostr(i));
-        for i:=0 to 31 do
-          AsmWriteln(#9'.set'#9'f'+tostr(i)+','+tostr(i));
-      end;
-
-
-{****************************************************************************}
-{                      GNU/Apple PPC Assembler writer                        }
-{****************************************************************************}
-
-    constructor TPPCAppleGNUAssembler.create(smart: boolean);
-      begin
-        inherited create(smart);
-        InstrWriter := TPPCInstrWriter.create(self);
-      end;
-
-
-    function TPPCAppleGNUAssembler.MakeCmdLine: TCmdStr;
-      begin
-        result := inherited MakeCmdLine;
-        case current_settings.cputype of
-          cpu_PPC7400:
-            Replace(result,'$ARCH','ppc7400');
-          cpu_PPC970:
-            Replace(result,'$ARCH','ppc970');
-          else
-            Replace(result,'$ARCH','ppc')
-        end;
-      end;
-
-{*****************************************************************************
-                                  Initialize
-*****************************************************************************}
-
-    const
-       as_ppc_gas_info : tasminfo =
-          (
-            id     : as_gas;
-
-            idtxt  : 'AS';
-            asmbin : 'as';
-            asmcmd : '-o $OBJ $ASM';
-            supported_target : system_any;
-            flags : [af_allowdirect,af_needar,af_smartlink_sections];
-            labelprefix : '.L';
-            comment : '# ';
-          );
-
-
-       as_ppc_gas_darwin_powerpc_info : tasminfo =
-          (
-            id     : as_darwin;
-
-            idtxt  : 'AS-Darwin';
-            asmbin : 'as';
-            asmcmd : '-o $OBJ $ASM -arch $ARCH';
-            supported_target : system_any;
-            flags : [af_allowdirect,af_needar,af_smartlink_sections,af_supports_dwarf];
-            labelprefix : 'L';
-            comment : '# ';
-          );
-
-begin
-  RegisterAssembler(as_ppc_gas_info,TPPCGNUAssembler);
-  RegisterAssembler(as_ppc_gas_darwin_powerpc_info,TPPCAppleGNUAssembler);
-end.

+ 0 - 97
compiler/powerpc64/agppcgas.pas

@@ -1,97 +0,0 @@
-{
-    Copyright (c) 1998-2002 by Florian Klaempfl
-
-    This unit implements an asm for the PowerPC64. Heavily based on the one
-    from the PowerPC architecture.
-
-    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.
-
- ****************************************************************************
-}
-{ This unit implements the GNU Assembler writer for the PowerPC
-}
-
-unit agppcgas;
-
-{$I fpcdefs.inc}
-
-interface
-
-uses
-  aasmtai,aasmdata,
-  aggas,
-  cpubase;
-
-type
-  TPPCGNUAssembler = class(TGNUassembler)
-  public
-    constructor create(smart: boolean); override;
-    procedure WriteExtraHeader; override;
-  end;
-
-
-implementation
-
-uses
-  cutils, globals, verbose,
-  cgbase, cgutils, systems,
-  assemble, globtype, fmodule,
-  itcpugas, finput,
-  aasmcpu, agppcutl;
-
-
-{****************************************************************************}
-{                         GNU PPC Assembler writer                           }
-{****************************************************************************}
-
-constructor TPPCGNUAssembler.create(smart: boolean);
-begin
-  inherited create(smart);
-  InstrWriter := TPPCInstrWriter.create(self);
-end;
-
-
-procedure TPPCGNUAssembler.WriteExtraHeader;
-var
-  i: longint;
-begin
-  for i := 0 to 31 do
-    AsmWriteln(#9'.set'#9'r' + tostr(i) + ',' + tostr(i));
-  for i := 0 to 31 do
-    AsmWriteln(#9'.set'#9'f' + tostr(i) + ',' + tostr(i));
-end;
-
-{*****************************************************************************
-                                  Initialize
-*****************************************************************************}
-
-const
-  as_ppc_gas_info: tasminfo =
-  (
-    id: as_gas;
-
-    idtxt: 'AS';
-    asmbin: 'as';
-    asmcmd: '-a64 -o $OBJ $ASM';
-    supported_target: system_any;
-    flags: [af_allowdirect, af_needar, af_smartlink_sections];
-    labelprefix: '.L';
-    comment: '# ';
-    );
-
-
-begin
-  RegisterAssembler(as_ppc_gas_info, TPPCGNUAssembler);
-end.

+ 107 - 3
compiler/ppcgen/agppcutl.pas → compiler/ppcgen/agppcgas.pas

@@ -1,8 +1,7 @@
 {
     Copyright (c) 1998-2002 by Florian Klaempfl
 
-    This unit implements common helper routines for the asm writers for
-    PowerPC/PowerPC64
+    This unit the GAS asm writers for PowerPC/PowerPC64
 
     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
@@ -25,7 +24,7 @@
 {                  Helper routines for Instruction Writer                    }
 {****************************************************************************}
 
-unit agppcutl;
+unit agppcgas;
 
 {$i fpcdefs.inc}
 
@@ -43,6 +42,16 @@ unit agppcutl;
        procedure WriteInstruction(hp : tai);override;
     end;
 
+    TPPCGNUAssembler=class(TGNUassembler)
+      constructor create(smart: boolean); override;
+      procedure WriteExtraHeader; override;
+    end;
+
+    TPPCAppleGNUAssembler=class(TAppleGNUassembler)
+      constructor create(smart: boolean); override;
+      function MakeCmdLine: TCmdStr; override;
+    end;
+
     function getreferencestring(var ref : treference) : string;
     function getopstr_jmp(const o:toper) : string;
     function getopstr(const o:toper) : string;
@@ -339,4 +348,99 @@ unit agppcutl;
       owner.AsmWriteLn(s);
     end;
 
+
+{****************************************************************************}
+{                         GNU PPC Assembler writer                           }
+{****************************************************************************}
+
+    constructor TPPCGNUAssembler.create(smart: boolean);
+      begin
+        inherited create(smart);
+        InstrWriter := TPPCInstrWriter.create(self);
+      end;
+
+
+    procedure TPPCGNUAssembler.WriteExtraHeader;
+      var
+         i : longint;
+      begin
+        for i:=0 to 31 do
+          AsmWriteln(#9'.set'#9'r'+tostr(i)+','+tostr(i));
+        for i:=0 to 31 do
+          AsmWriteln(#9'.set'#9'f'+tostr(i)+','+tostr(i));
+      end;
+
+
+{****************************************************************************}
+{                      GNU/Apple PPC Assembler writer                        }
+{****************************************************************************}
+
+    constructor TPPCAppleGNUAssembler.create(smart: boolean);
+      begin
+        inherited create(smart);
+        InstrWriter := TPPCInstrWriter.create(self);
+      end;
+
+
+    function TPPCAppleGNUAssembler.MakeCmdLine: TCmdStr;
+      begin
+        result := inherited MakeCmdLine;
+{$ifdef cpu64bit}
+        Replace(result,'$ARCH','ppc64')
+{$else cpu64bit}
+        case current_settings.cputype of
+          cpu_PPC7400:
+            Replace(result,'$ARCH','ppc7400');
+          cpu_PPC970:
+            Replace(result,'$ARCH','ppc970');
+          else
+            Replace(result,'$ARCH','ppc')
+        end;
+{$endif cpu64bit}
+      end;
+
+
+
+
+
+{*****************************************************************************
+                                  Initialize
+*****************************************************************************}
+
+  const
+    as_ppc_gas_info : tasminfo =
+       (
+         id     : as_gas;
+
+         idtxt  : 'AS';
+         asmbin : 'as';
+{$ifdef cpu64bit}
+         asmcmd : '-o $OBJ $ASM';
+{$else cpu64bit}
+         asmcmd: '-a64 -o $OBJ $ASM';
+{$endif cpu64bit}
+         supported_target : system_any;
+         flags : [af_allowdirect,af_needar,af_smartlink_sections];
+         labelprefix : '.L';
+         comment : '# ';
+       );
+
+
+    as_ppc_gas_darwin_powerpc_info : tasminfo =
+       (
+         id     : as_darwin;
+
+         idtxt  : 'AS-Darwin';
+         asmbin : 'as';
+         asmcmd : '-o $OBJ $ASM -arch $ARCH';
+         supported_target : system_any;
+         flags : [af_allowdirect,af_needar,af_smartlink_sections,af_supports_dwarf];
+         labelprefix : 'L';
+         comment : '# ';
+       );
+
+
+begin
+  RegisterAssembler(as_ppc_gas_info,TPPCGNUAssembler);
+  RegisterAssembler(as_ppc_gas_darwin_powerpc_info,TPPCAppleGNUAssembler);
 end.