Browse Source

* fixed arm compilation with cgutils
* ...

florian 21 years ago
parent
commit
73c30d6579

+ 7 - 3
compiler/arm/aasmcpu.pas

@@ -29,7 +29,7 @@ interface
 uses
   cclasses,aasmtai,
   aasmbase,globtype,globals,verbose,
-  cpubase,cpuinfo,cgbase;
+  cpubase,cpuinfo,cgbase,cgutils;
 
     const
       { "mov reg,reg" source operand number }
@@ -391,7 +391,7 @@ implementation
               result := operand_read
             else
               { check for pre/post indexed }
-              result := operand_read
+              result := operand_read;
           else
             internalerror(200403151);
         end;
@@ -493,7 +493,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.35  2004-10-24 17:32:53  florian
+  Revision 1.36  2004-11-01 17:41:28  florian
+    * fixed arm compilation with cgutils
+    * ...
+
+  Revision 1.35  2004/10/24 17:32:53  florian
     * fixed several arm compiler bugs
 
   Revision 1.34  2004/07/04 15:22:34  florian

+ 6 - 2
compiler/arm/agarmgas.pas

@@ -52,7 +52,7 @@ unit agarmgas;
        assemble,
        aasmcpu,
        itcpugas,
-       cgbase;
+       cgbase,cgutils;
 
     const
        as_arm_gas_info : tasminfo =
@@ -238,7 +238,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.21  2004-06-20 08:55:31  florian
+  Revision 1.22  2004-11-01 17:41:28  florian
+    * fixed arm compilation with cgutils
+    * ...
+
+  Revision 1.21  2004/06/20 08:55:31  florian
     * logs truncated
 
   Revision 1.20  2004/06/16 20:07:10  florian

+ 6 - 3
compiler/arm/cgcpu.pas

@@ -30,7 +30,7 @@ unit cgcpu;
 
     uses
        globtype,symtype,
-       cgbase,cgobj,
+       cgbase,cgutils,cgobj,
        aasmbase,aasmcpu,aasmtai,
        parabase,
        cpubase,cpuinfo,node,cg64f32,rgcpu;
@@ -120,7 +120,6 @@ unit cgcpu;
        symconst,symdef,symsym,
        tgobj,
        procinfo,cpupi,
-       cgutils,
        paramgr;
 
 
@@ -1287,7 +1286,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.61  2004-10-31 16:47:43  florian
+  Revision 1.62  2004-11-01 17:41:28  florian
+    * fixed arm compilation with cgutils
+    * ...
+
+  Revision 1.61  2004/10/31 16:47:43  florian
     * fixed ie with pi_do_call
 
   Revision 1.60  2004/10/31 16:04:30  florian

+ 6 - 70
compiler/arm/cpubase.pas

@@ -200,45 +200,12 @@ unit cpubase;
         F_GE,F_LT,F_GT,F_LE);
 
 {*****************************************************************************
-                                Reference
+                                Operands
 *****************************************************************************}
 
-    type
-      trefoptions=(ref_none,ref_parafixup,ref_localfixup,ref_selffixup);
-
       taddressmode = (AM_OFFSET,AM_PREINDEXED,AM_POSTINDEXED);
       tshiftmode = (SM_None,SM_LSL,SM_LSR,SM_ASR,SM_ROR,SM_RRX);
 
-      { reference record }
-      preference = ^treference;
-      treference = record
-         symbol      : tasmsymbol;
-         { symbol the symbol of this reference is relative to, nil if none }
-         relsymbol      : tasmsymbol;
-         offset      : longint;
-         base,
-         index       : tregister;
-         symboldata  : tlinkedlistitem;
-         { reference type addr or symbol itself }
-         refaddr : trefaddr;
-         signindex   : shortint;
-         shiftimm    : byte;
-         options     : trefoptions;
-         addressmode : taddressmode;
-         shiftmode   : tshiftmode;
-      end;
-
-      { reference record }
-      pparareference = ^tparareference;
-      tparareference = record
-         index       : tregister;
-         offset      : longint;
-      end;
-
-{*****************************************************************************
-                                Operands
-*****************************************************************************}
-
       tupdatereg = (UR_None,UR_Update);
 
       pshifterop = ^tshifterop;
@@ -249,41 +216,6 @@ unit cpubase;
         shiftimm : byte;
       end;
 
-{*****************************************************************************
-                               Generic Location
-*****************************************************************************}
-
-    type
-      tlocation = record
-         loc  : TCGLoc;
-         size : TCGSize;
-         case TCGLoc of
-            LOC_FLAGS : (resflags : tresflags);
-            LOC_CONSTANT : (
-              case longint of
-                1 : (value : aint);
-                { can't do this, this layout depends on the host cpu. Use }
-                { lo(valueqword)/hi(valueqword) instead (JM)              }
-                { 2 : (valuelow, valuehigh:AWord);                        }
-                { overlay a complete 64 Bit value }
-                3 : (value64 : int64);
-              );
-            LOC_CREFERENCE,
-            LOC_REFERENCE : (reference : treference);
-            { segment in reference at the same place as in loc_register }
-            LOC_REGISTER,LOC_CREGISTER : (
-              case longint of
-                1 : (register,register64.reghi,segment : tregister);
-                { overlay a register64.reglo }
-                2 : (register64.reglo : tregister);
-                { overlay a 64 Bit register type }
-                3 : (reg64 : tregister64);
-                4 : (register64 : tregister64);
-              );
-            { it's only for better handling }
-            LOC_MMXREGISTER,LOC_CMMXREGISTER : (mmxreg : tregister);
-      end;
-
 {*****************************************************************************
                                  Constants
 *****************************************************************************}
@@ -565,7 +497,11 @@ unit cpubase;
 end.
 {
   $Log$
-  Revision 1.36  2004-10-31 21:45:03  peter
+  Revision 1.37  2004-11-01 17:41:28  florian
+    * fixed arm compilation with cgutils
+    * ...
+
+  Revision 1.36  2004/10/31 21:45:03  peter
     * generic tlocation
     * move tlocation to cgutils
 

+ 7 - 2
compiler/arm/narmadd.pas

@@ -48,7 +48,8 @@ interface
       cutils,verbose,globals,
       symconst,symdef,paramgr,
       aasmbase,aasmtai,aasmcpu,defutil,htypechk,
-      cgbase,cpuinfo,pass_1,pass_2,regvars,cgcpu,
+      cgbase,cgutils,cgcpu,
+      cpuinfo,pass_1,pass_2,regvars,
       cpupara,
       ncon,nset,nadd,
       ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32;
@@ -331,7 +332,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.18  2004-10-31 16:04:30  florian
+  Revision 1.19  2004-11-01 17:41:28  florian
+    * fixed arm compilation with cgutils
+    * ...
+
+  Revision 1.18  2004/10/31 16:04:30  florian
     * fixed compilation of system unit on arm
 
   Revision 1.17  2004/10/24 17:32:53  florian

+ 7 - 2
compiler/arm/narminl.pas

@@ -61,7 +61,8 @@ implementation
       cutils,verbose,globals,fmodule,
       symconst,symdef,
       aasmbase,aasmtai,aasmcpu,
-      cgbase,pass_1,pass_2,
+      cgbase,cgutils,
+      pass_1,pass_2,
       cpubase,paramgr,
       nbas,ncon,ncal,ncnv,nld,
       tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu,cgcpu;
@@ -202,7 +203,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.7  2004-06-20 08:55:31  florian
+  Revision 1.8  2004-11-01 17:41:28  florian
+    * fixed arm compilation with cgutils
+    * ...
+
+  Revision 1.7  2004/06/20 08:55:31  florian
     * logs truncated
 
   Revision 1.6  2004/03/16 22:12:10  florian

+ 7 - 2
compiler/arm/narmmat.pas

@@ -48,7 +48,8 @@ implementation
       symconst,symdef,
       aasmbase,aasmcpu,aasmtai,
       defutil,
-      cgbase,cgobj,pass_1,pass_2,
+      cgbase,cgobj,cgutils,
+      pass_1,pass_2,
       ncon,
       cpubase,cpuinfo,
       ncgutil,cgcpu,cg64f32,rgobj;
@@ -121,7 +122,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.8  2004-10-24 07:54:25  florian
+  Revision 1.9  2004-11-01 17:41:28  florian
+    * fixed arm compilation with cgutils
+    * ...
+
+  Revision 1.8  2004/10/24 07:54:25  florian
     * fixed compilation of arm compiler
 
   Revision 1.7  2004/06/20 08:55:31  florian

+ 7 - 3
compiler/arm/rgcpu.pas

@@ -30,7 +30,7 @@ unit rgcpu;
 
      uses
        aasmbase,aasmtai,aasmcpu,
-       cgbase,
+       cgbase,cgutils,
        cpubase,
        rgobj;
 
@@ -48,7 +48,7 @@ unit rgcpu;
 
     uses
       verbose, cutils,
-      cgutils,cgobj,
+      cgobj,
       procinfo;
 
 
@@ -159,7 +159,11 @@ end.
 
 {
   $Log$
-  Revision 1.14  2004-10-24 07:54:25  florian
+  Revision 1.15  2004-11-01 17:41:28  florian
+    * fixed arm compilation with cgutils
+    * ...
+
+  Revision 1.14  2004/10/24 07:54:25  florian
     * fixed compilation of arm compiler
 
   Revision 1.13  2004/07/03 19:29:14  florian

+ 13 - 1
compiler/cgutils.pas

@@ -29,6 +29,7 @@ unit cgutils;
 
     uses
       globtype,
+      cclasses,
       aasmbase,
       cpubase,cgbase;
 
@@ -44,6 +45,13 @@ unit cgutils;
          index       : tregister;
          refaddr     : trefaddr;
          scalefactor : byte;
+{$ifdef arm}
+         symboldata  : tlinkedlistitem;
+         signindex   : shortint;
+         shiftimm    : byte;
+         addressmode : taddressmode;
+         shiftmode   : tshiftmode;
+{$endif arm}
       end;
 
       tlocation = record
@@ -170,7 +178,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.2  2004-10-31 21:45:02  peter
+  Revision 1.3  2004-11-01 17:41:28  florian
+    * fixed arm compilation with cgutils
+    * ...
+
+  Revision 1.2  2004/10/31 21:45:02  peter
     * generic tlocation
     * move tlocation to cgutils
 

+ 7 - 8
compiler/ncgadd.pas

@@ -488,10 +488,10 @@ interface
             begin
               if (right.location.loc = LOC_CONSTANT) then
                 cg.a_op_const_reg_reg(exprasmlist,op,location.size,right.location.value,
-                  left.location.register64,location.register)
+                  left.location.register,location.register)
               else
                 cg.a_op_reg_reg_reg(exprasmlist,op,location.size,right.location.register,
-                  left.location.register64,location.register);
+                  left.location.register,location.register);
             end;
           subn:
             begin
@@ -500,11 +500,6 @@ interface
 
               if left.location.loc <> LOC_CONSTANT then
                 begin
-                  if (location.register64.reglo = NR_NO) then
-                    begin
-                     location.register64.reglo := cg.getintregister(exprasmlist,OS_INT);
-                     location.register64.reghi := cg.getintregister(exprasmlist,OS_INT);
-                  end;
                   if right.location.loc <> LOC_CONSTANT then
                     // reg64 - reg64
                     cg.a_op_reg_reg_reg(exprasmlist,OP_SUB,location.size,
@@ -778,7 +773,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.35  2004-10-31 21:45:03  peter
+  Revision 1.36  2004-11-01 17:41:28  florian
+    * fixed arm compilation with cgutils
+    * ...
+
+  Revision 1.35  2004/10/31 21:45:03  peter
     * generic tlocation
     * move tlocation to cgutils
 

+ 13 - 3
compiler/ncgcal.pas

@@ -516,14 +516,20 @@ implementation
             begin
               if resultparaloc^.loc<>LOC_REGISTER then
                 internalerror(200409261);
+
               { the FUNCTION_RESULT_REG is already allocated }
-              if getsupreg(resultparaloc^.register)<first_mm_imreg then
+              if getsupreg(resultparaloc^.register)<first_int_imreg then
                 cg.ungetcpuregister(exprasmlist,resultparaloc^.register);
               if not assigned(funcretnode) then
                 begin
+                  { reg_ref could generate two instrcutions and allocate a register so we've to
+                    save the result first before releasing it }
+                  hregister:=cg.getaddressregister(exprasmlist);
+                  cg.a_load_reg_reg(exprasmlist,OS_ADDR,OS_ADDR,resultparaloc^.register,hregister);
+
                   location_reset(location,LOC_REFERENCE,OS_ADDR);
                   location.reference:=refcountedtemp;
-                  cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,NR_FUNCTION_RESULT_REG,location.reference);
+                  cg.a_load_reg_ref(exprasmlist,OS_ADDR,OS_ADDR,hregister,location.reference);
                 end
               else
                 begin
@@ -1247,7 +1253,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.182  2004-10-31 21:45:03  peter
+  Revision 1.183  2004-11-01 17:41:28  florian
+    * fixed arm compilation with cgutils
+    * ...
+
+  Revision 1.182  2004/10/31 21:45:03  peter
     * generic tlocation
     * move tlocation to cgutils
 

+ 11 - 7
compiler/ncgcnv.pas

@@ -94,13 +94,13 @@ interface
               than the original, else load it to a register }
             if (location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) and
                (ressize<leftsize) then
-             begin
-               location.size:=newsize;
-               if (target_info.endian = ENDIAN_BIG) then
-                 inc(location.reference.offset,leftsize-ressize);
-             end
+              begin
+                location.size:=newsize;
+                if (target_info.endian = ENDIAN_BIG) then
+                  inc(location.reference.offset,leftsize-ressize);
+              end
             else
-             location_force_reg(exprasmlist,location,newsize,false);
+              location_force_reg(exprasmlist,location,newsize,false);
           end
         else
           begin
@@ -531,7 +531,11 @@ end.
 
 {
   $Log$
-  Revision 1.62  2004-11-01 15:31:58  peter
+  Revision 1.63  2004-11-01 17:41:28  florian
+    * fixed arm compilation with cgutils
+    * ...
+
+  Revision 1.62  2004/11/01 15:31:58  peter
     * -Or fix for absolute
 
   Revision 1.61  2004/10/31 21:45:03  peter

+ 6 - 1
compiler/ninl.pas

@@ -2099,6 +2099,7 @@ implementation
                 result := ctypeconvnode.create_explicit(left,resulttype);
               left := nil;
               firstpass(result);
+              printnode(output,result);
             end;
 
           in_sizeof_x:
@@ -2442,7 +2443,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.146  2004-10-31 21:45:03  peter
+  Revision 1.147  2004-11-01 17:41:28  florian
+    * fixed arm compilation with cgutils
+    * ...
+
+  Revision 1.146  2004/10/31 21:45:03  peter
     * generic tlocation
     * move tlocation to cgutils