Browse Source

* continued to work on the arm port

florian 22 years ago
parent
commit
9edd2b0401

+ 37 - 2
compiler/arm/aasmcpu.pas

@@ -39,6 +39,7 @@ uses
 
     type
       taicpu = class(taicpu_abstract)
+         procedure loadshifterop(opidx:longint;const so:tshifterop);
          constructor op_none(op : tasmop);
 
          constructor op_reg(op : tasmop;_op1 : tregister);
@@ -57,6 +58,7 @@ uses
          constructor op_reg_reg_ref(op : tasmop;_op1,_op2 : tregister; const _op3: treference);
          constructor op_const_reg_reg(op : tasmop;_op1 : longint;_op2, _op3 : tregister);
          constructor op_const_reg_const(op : tasmop;_op1 : longint;_op2 : tregister;_op3 : longint);
+         constructor op_reg_reg_shifterop(op : tasmop;_op1,_op2 : tregister;_op3 : tshifterop);
 
          constructor op_reg_reg_reg_reg(op : tasmop;_op1,_op2,_op3,_op4 : tregister);
 
@@ -94,7 +96,23 @@ uses
 
 implementation
 
-uses cutils,rgobj;
+  uses
+    cutils,rgobj;
+
+
+    procedure taicpu.loadshifterop(opidx:longint;const so:tshifterop);
+      begin
+        if opidx>=ops then
+         ops:=opidx+1;
+        with oper[opidx] do
+          begin
+            if typ<>top_shifterop then
+              new(shifterop);
+            shifterop^:=so;
+            typ:=top_shifterop;
+          end;
+      end;
+
 
 {*****************************************************************************
                                  taicpu Constructors
@@ -259,6 +277,20 @@ uses cutils,rgobj;
       end;
 
 
+     constructor taicpu.op_reg_reg_shifterop(op : tasmop;_op1,_op2 : tregister;_op3 : tshifterop);
+      begin
+         inherited create(op);
+         if (_op1.enum = R_INTREGISTER) and (_op1.number = NR_NO) then
+           internalerror(200308233);
+         if (_op2.enum = R_INTREGISTER) and (_op2.number = NR_NO) then
+           internalerror(200308233);
+         ops:=3;
+         loadreg(0,_op1);
+         loadreg(1,_op2);
+         loadshifterop(2,_op3);
+      end;
+
+
      constructor taicpu.op_reg_reg_reg_reg(op : tasmop;_op1,_op2,_op3,_op4 : tregister);
       begin
          inherited create(op);
@@ -719,7 +751,10 @@ uses cutils,rgobj;
 end.
 {
   $Log$
-  Revision 1.2  2003-08-20 15:50:12  florian
+  Revision 1.3  2003-08-24 12:27:26  florian
+    * continued to work on the arm port
+
+  Revision 1.2  2003/08/20 15:50:12  florian
     * more arm stuff
 
   Revision 1.1  2003/08/16 13:23:01  florian

+ 6 - 3
compiler/arm/agarmgas.pas

@@ -135,7 +135,7 @@ unit agarmgas;
               internalerror(200303121);
             getopstr_jmp:=std_reg2str[o.reg.enum];
           end;
-        top_shifter:
+        top_shifterop:
           begin
           end;
         { no top_ref jumping for powerpc }
@@ -179,7 +179,7 @@ unit agarmgas;
               internalerror(200303125);
             getopstr:=std_reg2str[o.reg.enum];
           end;
-        top_shifter:
+        top_shifterop:
           begin
           end;
         top_const:
@@ -273,7 +273,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.2  2003-08-20 15:50:12  florian
+  Revision 1.3  2003-08-24 12:27:26  florian
+    * continued to work on the arm port
+
+  Revision 1.2  2003/08/20 15:50:12  florian
     * more arm stuff
 
   Revision 1.1  2003/08/16 13:23:01  florian

+ 27 - 1
compiler/arm/cgcpu.pas

@@ -252,6 +252,29 @@ unit cgcpu;
 
      procedure tcgarm.a_op_const_reg(list : taasmoutput; Op: TOpCG; size: TCGSize; a: AWord; reg: TRegister);
        begin
+{
+            shifterop_reset(so);
+            { determine operator }
+            if nodetype=shln then
+              so.shiftertype:=SO_LSL
+            else
+              so.shiftertype:=SO_LSR;
+            { shifting by a constant directly coded: }
+            if (right.nodetype=ordconstn) then
+              begin
+                so.shiftimm:=tordconstnode(right).value and 31;
+                a_op_reg_reg_shifterop(exprasmlist,op,OS_32,hregister1,resultreg,so)
+              end
+            else
+              begin
+                { load shift count in a register if necessary }
+                location_force_reg(exprasmlist,right.location,def_cgsize(right.resulttype.def),true);
+                hregister2 := right.location.register;
+                so.rs:=hregister2;
+                a_op_reg_reg_reg(exprasmlist,op,OS_32,hregister2,hregister1,resultreg);
+                rg.UnGetRegisterInt(exprasmlist,hregister2);
+              end;
+}
        end;
 
 
@@ -507,7 +530,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.3  2003-08-21 03:14:00  florian
+  Revision 1.4  2003-08-24 12:27:26  florian
+    * continued to work on the arm port
+
+  Revision 1.3  2003/08/21 03:14:00  florian
     * arm compiler can be compiled; far from being working
 
   Revision 1.2  2003/08/20 15:50:12  florian

+ 13 - 5
compiler/arm/cpubase.pas

@@ -266,7 +266,7 @@ uses
 *****************************************************************************}
 
       { Types of operand }
-      toptype=(top_none,top_reg,top_ref,top_const,top_symbol,top_regset,top_shifter);
+      toptype=(top_none,top_reg,top_ref,top_const,top_symbol,top_regset,top_shifterop);
 
       tupdatereg = (UR_None,UR_Update);
 
@@ -276,8 +276,7 @@ uses
       pshifterop = ^tshifterop;
 
       tshifterop = record
-        imm : dword;
-        rm : tregister;
+        shiftertype : tshiftertype;
         rs : tregister;
         shiftimm : byte;
       end;
@@ -290,7 +289,7 @@ uses
          top_const  : (val:aword);
          top_symbol : (sym:tasmsymbol;symofs:longint);
          top_regset : (regset:tsupregset);
-         top_shifter : (shifterop : pshifterop);
+         top_shifterop : (shifterop : pshifterop);
       end;
 
 {*****************************************************************************
@@ -591,6 +590,8 @@ uses
     function flags_to_cond(const f: TResFlags) : TAsmCond;
     function supreg_name(r:Tsuperregister):string;
 
+    procedure shifterop_reset(var so : tshifterop);
+
 implementation
 
     procedure convert_register_to_enum(var r:Tregister);
@@ -630,12 +631,19 @@ implementation
       begin
       end;
 
+    procedure shifterop_reset(var so : tshifterop);
+      begin
+        FillChar(so,sizeof(so),0);
+      end;
 
 
 end.
 {
   $Log$
-  Revision 1.5  2003-08-21 03:14:00  florian
+  Revision 1.6  2003-08-24 12:27:26  florian
+    * continued to work on the arm port
+
+  Revision 1.5  2003/08/21 03:14:00  florian
     * arm compiler can be compiled; far from being working
 
   Revision 1.4  2003/08/20 15:50:13  florian

+ 4 - 2
compiler/arm/cpunode.pas

@@ -37,14 +37,16 @@ unit cpunode;
        }
        narmadd,
 //!!!       narminl,
-       narmmat,
        narmcnv
        ;
 
 end.
 {
   $Log$
-  Revision 1.3  2003-08-21 23:24:08  florian
+  Revision 1.4  2003-08-24 12:27:26  florian
+    * continued to work on the arm port
+
+  Revision 1.3  2003/08/21 23:24:08  florian
     * continued to work on the arm skeleton
 
   Revision 1.2  2003/08/21 03:14:00  florian

+ 0 - 79
compiler/arm/narmmat.pas

@@ -1,79 +0,0 @@
-{
-    $Id$
-    Copyright (c) 1998-2002 by Florian Klaempfl
-
-    Generate ARM assembler for math nodes
-
-    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 narmmat;
-
-{$i fpcdefs.inc}
-
-interface
-
-    uses
-      node,nmat,ncgmat;
-
-    type
-      tarmmoddivnode = class(tmoddivnode)
-         procedure pass_2;override;
-      end;
-
-      tarmshlshrnode = class(tshlshrnode)
-         procedure pass_2;override;
-      end;
-
-implementation
-
-    uses
-      globtype,systems,
-      cutils,verbose,globals,
-      symconst,symdef,
-      aasmbase,aasmcpu,aasmtai,
-      defutil,
-      cgbase,cgobj,pass_1,pass_2,
-      ncon,
-      cpubase,cpuinfo,cginfo,
-      ncgutil,cgcpu,cg64f32,rgobj;
-
-{*****************************************************************************
-                             TARMMODDIVNODE
-*****************************************************************************}
-
-    procedure tarmmoddivnode.pass_2;
-      begin
-      end;
-
-{*****************************************************************************
-                             TARMSHLRSHRNODE
-*****************************************************************************}
-
-    procedure tarmshlshrnode.pass_2;
-      begin
-      end;
-
-begin
-   cmoddivnode:=tarmmoddivnode;
-   cshlshrnode:=tarmshlshrnode;
-end.
-{
-  $Log$
-  Revision 1.1  2003-08-21 23:23:59  florian
-    * continued to work on the arm skeleton
-}
-