Browse Source

* all tokes now start with an underscore
* PowerPC compiles!!

Jonas Maebe 26 years ago
parent
commit
4a9d0a58d1

+ 25 - 16
compiler/new/powerpc/cpuasm.pas

@@ -80,6 +80,7 @@ type
      constructor op_sym(op : tasmop;_op1 : pasmsymbol);
      constructor op_sym_ofs(op : tasmop;_op1 : pasmsymbol;_op1ofs:longint);
      constructor op_reg_sym_ofs(op : tasmop;_op1 : tregister;_op2:pasmsymbol;_op2ofs : longint);
+     constructor op_sym_ofs_ref(op : tasmop;_op1 : pasmsymbol;_op1ofs:longint;_op2 : preference);
 
      destructor done;virtual;
      function  getcopy:plinkedlist_item;virtual;
@@ -90,8 +91,6 @@ type
 
 
 implementation
-uses
-  og386;
 
 {*****************************************************************************
                                  TaiRegAlloc
@@ -167,7 +166,7 @@ uses
          ops:=2;
       end;
 
-     constructor op_const_reg(op:tasmop; _op1: longint; _op2: tregister);
+     constructor tappc.op_const_reg(op:tasmop; _op1: longint; _op2: tregister);
       begin
          inherited init;
          init(op);
@@ -198,14 +197,21 @@ uses
          ops:=3;
       end;
 
-     constructor op_reg_reg_const(op : tasmop;_op1,_op2 : tregister; _op3: Longint);
+     constructor tappc.op_reg_reg_const(op : tasmop;_op1,_op2 : tregister; _op3: Longint);
        begin
          inherited init;
          init(op);
          ops:=3;
       end;
 
-     constructor op_reg_reg_sym_ofs(op : tasmop;_op1,_op2 : tregister; _op3: pasmsymbol;_op3ofs: longint);
+     constructor tappc.op_reg_reg_sym_ofs(op : tasmop;_op1,_op2 : tregister; _op3: pasmsymbol;_op3ofs: longint);
+       begin
+         inherited init;
+         init(op);
+         ops:=3;
+      end;
+
+     constructor tappc.op_reg_reg_ref(op : tasmop;_op1,_op2 : tregister; _op3: Longint);
        begin
          inherited init;
          init(op);
@@ -219,7 +225,7 @@ uses
          ops:=3;
       end;
 
-     constructor op_const_reg_const(op : tasmop;_op1 : longint;_op2 : tregister;_op3 : longint);
+     constructor tappc.op_const_reg_const(op : tasmop;_op1 : longint;_op2 : tregister;_op3 : longint);
       begin
          inherited init;
          init(op);
@@ -227,28 +233,28 @@ uses
       end;
 
 
-     constructor op_reg_reg_reg_reg(op : tasmop;_op1,_op2,_op3,_op4 : tregister);
+     constructor tappc.op_reg_reg_reg_reg(op : tasmop;_op1,_op2,_op3,_op4 : tregister);
       begin
          inherited init;
          init(op);
          ops:=4;
       end;
 
-     constructor op_reg_bool_reg_reg(op : tasmop;_op1: tregister;_op2:boolean;_op3,_op4:tregister);
+     constructor tappc.op_reg_bool_reg_reg(op : tasmop;_op1: tregister;_op2:boolean;_op3,_op4:tregister);
       begin
          inherited init;
          init(op);
          ops:=4;
       end;
 
-     constructor op_reg_bool_reg_const(op : tasmop;_op1: tregister;_op2:boolean;_op3:tregister;_op4: longint);
+     constructor tappc.op_reg_bool_reg_const(op : tasmop;_op1: tregister;_op2:boolean;_op3:tregister;_op4: longint);
       begin
          inherited init;
          init(op);
          ops:=4;
       end;
 
-     constructor op_reg_reg_const_const_const(op : tasmop;_op1,_op2 : tregister;_op3,_op4,_op5 : Longint);
+     constructor tappc.op_reg_reg_const_const_const(op : tasmop;_op1,_op2 : tregister;_op3,_op4,_op5 : Longint);
       begin
          inherited init;
          init(op);
@@ -263,11 +269,10 @@ uses
          ops:=1;
       end;
 
-     constructor op_const_const_sym(op : tasmop;_op1,_op2 : longint);
+     constructor tappc.op_const_const_sym(op : tasmop;_op1,_op2 : longint);
       begin
          inherited init;
          init(op);
-         condition:=cond;
          ops:=3;
       end;
 
@@ -321,10 +326,10 @@ uses
         p:=inherited getcopy;
         { make a copy of the references }
         for i:=1 to ops do
-         if (paalpha(p)^.oper[i-1].typ=top_ref) then
+         if (pappc(p)^.oper[i-1].typ=top_ref) then
           begin
-            new(paalpha(p)^.oper[i-1].ref);
-            paalpha(p)^.oper[i-1].ref^:=oper[i-1].ref^;
+            new(pappc(p)^.oper[i-1].ref);
+            pappc(p)^.oper[i-1].ref^:=oper[i-1].ref^;
           end;
         getcopy:=p;
       end;
@@ -332,7 +337,11 @@ uses
 end.
 {
   $Log$
-  Revision 1.1  1999-08-03 23:37:53  jonas
+  Revision 1.2  1999-08-04 12:59:24  jonas
+    * all tokes now start with an underscore
+    * PowerPC compiles!!
+
+  Revision 1.1  1999/08/03 23:37:53  jonas
     + initial implementation for PowerPC based on the Alpha stuff
 
 }

+ 31 - 17
compiler/new/powerpc/cpubase.pas

@@ -4,10 +4,6 @@
 
     Contains the base types for the PowerPC
 
-    * This code was inspired by the NASM sources
-      The Netwide Assembler is copyright (C) 1996 Simon Tatham and
-      Julian Hall. All rights reserved.
-
     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
@@ -107,7 +103,7 @@ type
     a_stfdu, a_stfdux, a_stfdx, a_stfiwx, a_stfs, a_stfsu, a_stfsux, a_stfsx,
     a_sth, a_sthbrx, a_sthu, a_sthux, a_sthx, a_stmw, a_stswi, a_stswx, a_stw,
     a_stwbrx, a_stwx_, a_stwu, a_stwux, a_stwx, a_subf, a_subf_, a_subfo,
-    a_subfo_, a_subfc, a_subc_, a_subfco, a_subfco_, a_subfe, a_subfe_,
+    a_subfo_, a_subfc, a_subfc_, a_subfco, a_subfco_, a_subfe, a_subfe_,
     a_subfeo, a_subfeo_, a_subfic, a_subfme, a_subfme_, a_subfmeo, a_subfmeo_,
     a_subfze, a_subfze_, a_subfzeo, a_subfzeo_, a_sync, a_tlbia, a_tlbie,
     a_tlbsync, a_tw, twi, a_xor, a_xor_, a_xori, a_xoris,
@@ -132,13 +128,11 @@ const
                                 Conditions
 *****************************************************************************}
 
-(* still needs to be implmented in a generic way somehow
-
 type
   TAsmCond=(C_None,
     C_LT,C_LE,C_EQ,C_GE,C_GT,C_NL,C_NE,C_NG,C_SO,C_NS,C_UN,C_NU
   );
-
+(*
   TAsmCondBO = (B_T,B_F,B_DNZ,B_DNZT,B_DNZF,B_DZ,B_DZT,B_DZF);
   TasmCondSuffix = (SU_NO,SU_A,SU_LR,SU_CTR,SU_L,SU_LA,SU_LRL,SU_CTRL);
 
@@ -234,6 +228,9 @@ const
     'F0','F1','F2','F3','F4','F5','F6','F7', 'F8','F9','F10','F11','F12',
     'F13','F14','F15','F16','F17', 'F18','F19','F20','F21','F22', 'F23','F24',
     'F25','F26','F27','F28','F29','F30','F31',
+    'M0','M1','M2','M3','M4','M5','M6','M7','M8','M9','M10','M11','M12',
+    'M13','M14','M15','M16','M17','M18','M19','M20','M21','M22', 'M23','M24',
+    'M25','M26','M27','M28','M29','M30','M31',
     'CR','CR0','CR1','CR2','CR3','CR4','CR5','CR6','CR7',
     'XER','LR','CTR','FPSCR'
   );
@@ -245,6 +242,9 @@ const
     'F0','F1','F2','F3','F4','F5','F6','F7', 'F8','F9','F10','F11','F12',
     'F13','F14','F15','F16','F17', 'F18','F19','F20','F21','F22', 'F23','F24',
     'F25','F26','F27','F28','F29','F30','F31',
+    'M0','M1','M2','M3','M4','M5','M6','M7','M8','M9','M10','M11','M12',
+    'M13','M14','M15','M16','M17','M18','M19','M20','M21','M22', 'M23','M24',
+    'M25','M26','M27','M28','M29','M30','M31',
     'CR','CR0','CR1','CR2','CR3','CR4','CR5','CR6','CR7',
     'XER','LR','CTR','FPSCR'
   );
@@ -256,12 +256,12 @@ const
 
 type
   TResFlags = (F_LT,F_GT,F_EQ,F_SO,F_FX,F_FEX,F_VX,F_OX);
-
+(*
 const
   { arrays for boolean location conversions }
   flag_2_cond : array[TResFlags] of TAsmCond =
      (C_E,C_NE,C_G,C_L,C_GE,C_LE,C_C,C_NC,C_A,C_AE,C_B,C_BE);
-
+*)
 
 {*****************************************************************************
                                 Reference
@@ -308,7 +308,7 @@ type
   TLoc=(
     LOC_INVALID,     { added for tracking problems}
     LOC_REGISTER,    { in a processor register }
-    LOC_CREGISTER    { Constant register which shouldn't be modified }
+    LOC_CREGISTER,    { Constant register which shouldn't be modified }
     LOC_FPUREGISTER, { FPU register }
     LOC_CFPUREGISTER,{ Constant FPU register which shouldn't be modified }
     LOC_MMREGISTER,  { multimedia register }
@@ -316,7 +316,7 @@ type
     LOC_MEM,         { in memory }
     LOC_REFERENCE,   { like LOC_MEM, but lvalue }
     LOC_JUMP,        { boolean results only, jump to false or true label }
-    LOC_FLAGS,       { boolean results only, flags are set }
+    LOC_FLAGS        { boolean results only, flags are set }
   );
 
   plocation = ^tlocation;
@@ -348,14 +348,24 @@ type
 
 const
   availabletempregsint = [R_0,R_11..R_30];
-  availabletempregsfpu = [F_14..F_31];
-  availabletempregsmm  = [M_0..M_31];
+  availabletempregsfpu = [R_F14..R_F31];
+  availabletempregsmm  = [R_M0..R_M31];
+
+  c_countusableregsint = 21;
+  c_countusableregsfpu = 32;
+  c_countusableregsmm  = 32;
+
+  maxvarregs = 18;
+
+  varregs : Array [1..maxvarregs] of Tregister =
+            (R_13,R_14,R_15,R_16,R_17,R_18,R_19,R_20,R_21,R_22,R_23,R_24,R_25,
+             R_26,R_27,R_28,R_29,R_30);
 
   intregs = [R_0..R_31];
   fpuregs = [R_F0..R_F31];
   mmregs = [R_M0..R_M31];
 
-  registers_saved_on_cdecl = [R_ESI,R_EDI,R_EBX];
+  registers_saved_on_cdecl = [R_11..R_30];
 
   { generic register names }
   stack_pointer = R_1;
@@ -363,7 +373,7 @@ const
   self_pointer  = R_9;
   accumulator   = R_3;
 
-  cpuflags : set of tcpuflags = [];
+(*  cpuflags : set of tcpuflags = []; *)
 
   { sizes }
   pointersize   = 4;
@@ -453,7 +463,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.1  1999-08-03 23:37:53  jonas
+  Revision 1.2  1999-08-04 12:59:25  jonas
+    * all tokes now start with an underscore
+    * PowerPC compiles!!
+
+  Revision 1.1  1999/08/03 23:37:53  jonas
     + initial implementation for PowerPC based on the Alpha stuff
 
 }

+ 6 - 2
compiler/new/powerpc/tgcpu.pas

@@ -29,7 +29,7 @@ unit tgcpu;
 
     type
 
-       ttgpowerpc = Object(ttgobj)
+       ttgppc = Object(ttgobj)
        end;
 
     var
@@ -42,7 +42,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.1  1999-08-03 23:37:53  jonas
+  Revision 1.2  1999-08-04 12:59:26  jonas
+    * all tokes now start with an underscore
+    * PowerPC compiles!!
+
+  Revision 1.1  1999/08/03 23:37:53  jonas
     + initial implementation for PowerPC based on the Alpha stuff
 
 

+ 20 - 7
compiler/new/pp.pas

@@ -55,14 +55,14 @@
       { people can try to compile without GDB }
       { $error The compiler switch GDB must be defined}
    {$endif GDB}
-   
+
    { One of Alpha, I386 or M68K must be defined }
    {$UNDEF CPUOK}
-   
+
    {$ifdef I386}
    {$define CPUOK}
    {$endif}
-   
+
    {$ifdef M68K}
    {$ifndef CPUOK}
    {$DEFINE CPUOK}
@@ -78,11 +78,20 @@
      {$fatal cannot define two CPU switches}
    {$endif}
    {$endif}
-   
+
+   {$ifdef powerpc}
+   {$ifndef CPUOK}
+   {$DEFINE CPUOK}
+   {$else}
+     {$fatal cannot define two CPU switches}
+   {$endif}
+   {$endif}
+
+
    {$ifndef CPUOK}
-   {$fatal One of the switches I386,Alpha or M68K must be defined}
+   {$fatal One of the switches I386,Alpha, PowerPC or M68K must be defined}
    {$endif}
-   
+
    {$ifdef support_mmx}
      {$ifndef i386}
        {$fatal I386 switch must be on for MMX support}
@@ -270,7 +279,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.5  1999-08-02 21:29:06  florian
+  Revision 1.6  1999-08-04 12:59:22  jonas
+    * all tokes now start with an underscore
+    * PowerPC compiles!!
+
+  Revision 1.5  1999/08/02 21:29:06  florian
     * the main branch psub.pas is now used for
       newcg compiler