Browse Source

* generic tlocation
* move tlocation to cgutils

peter 21 years ago
parent
commit
c95a859f0a
97 changed files with 1020 additions and 870 deletions
  1. 7 3
      compiler/aasmbase.pas
  2. 11 7
      compiler/alpha/cpubase.pas
  3. 8 4
      compiler/alpha/cpupara.pas
  4. 6 2
      compiler/aopt.pas
  5. 6 2
      compiler/aoptbase.pas
  6. 6 2
      compiler/aoptobj.pas
  7. 8 4
      compiler/arm/cpubase.pas
  8. 7 3
      compiler/arm/narmcnv.pas
  9. 5 5
      compiler/assemble.pas
  10. 12 8
      compiler/cg64f32.pas
  11. 6 2
      compiler/cg64f64.pas
  12. 10 11
      compiler/cgbase.pas
  13. 7 52
      compiler/cgobj.pas
  14. 93 4
      compiler/cgutils.pas
  15. 5 2
      compiler/defcmp.pas
  16. 6 2
      compiler/defutil.pas
  17. 6 3
      compiler/dwarf.pas
  18. 7 2
      compiler/globals.pas
  19. 11 1
      compiler/globtype.pas
  20. 6 3
      compiler/i386/ag386int.pas
  21. 6 2
      compiler/i386/ag386nsm.pas
  22. 7 4
      compiler/i386/cgcpu.pas
  23. 12 2
      compiler/i386/cpubase.inc
  24. 5 14
      compiler/i386/cpuinfo.pas
  25. 6 2
      compiler/i386/cpupara.pas
  26. 7 3
      compiler/i386/csopt386.pas
  27. 6 2
      compiler/i386/daopt386.pas
  28. 22 18
      compiler/i386/n386add.pas
  29. 5 4
      compiler/i386/n386cal.pas
  30. 6 2
      compiler/i386/n386con.pas
  31. 36 32
      compiler/i386/n386mat.pas
  32. 8 4
      compiler/i386/n386mem.pas
  33. 6 2
      compiler/i386/n386obj.pas
  34. 6 2
      compiler/i386/ra386int.pas
  35. 11 7
      compiler/m68k/cpubase.pas
  36. 6 2
      compiler/m68k/n68kmat.pas
  37. 15 11
      compiler/m68k/ncpuadd.pas
  38. 9 4
      compiler/nbas.pas
  39. 6 2
      compiler/ncal.pas
  40. 16 12
      compiler/ncgadd.pas
  41. 7 4
      compiler/ncgbas.pas
  42. 15 11
      compiler/ncgcal.pas
  43. 7 3
      compiler/ncgcnv.pas
  44. 6 2
      compiler/ncgcon.pas
  45. 7 4
      compiler/ncginl.pas
  46. 23 1
      compiler/ncgld.pas
  47. 9 5
      compiler/ncgmat.pas
  48. 6 2
      compiler/ncgopt.pas
  49. 8 4
      compiler/ncgset.pas
  50. 35 31
      compiler/ncgutil.pas
  51. 7 3
      compiler/new/powerpc/cpubase.pas
  52. 6 2
      compiler/ninl.pas
  53. 5 9
      compiler/nld.pas
  54. 6 2
      compiler/node.pas
  55. 16 11
      compiler/parabase.pas
  56. 6 2
      compiler/paramgr.pas
  57. 6 2
      compiler/powerpc/aasmcpu.pas
  58. 6 2
      compiler/powerpc/agppcgas.pas
  59. 8 4
      compiler/powerpc/agppcmpw.pas
  60. 10 7
      compiler/powerpc/cgcpu.pas
  61. 12 92
      compiler/powerpc/cpubase.pas
  62. 5 14
      compiler/powerpc/cpuinfo.pas
  63. 47 43
      compiler/powerpc/nppcadd.pas
  64. 8 4
      compiler/powerpc/nppccnv.pas
  65. 6 2
      compiler/powerpc/nppcinl.pas
  66. 47 43
      compiler/powerpc/nppcmat.pas
  67. 7 3
      compiler/procinfo.pas
  68. 13 14
      compiler/rautils.pas
  69. 6 6
      compiler/rgobj.pas
  70. 7 3
      compiler/scanner.pas
  71. 6 2
      compiler/sparc/aasmcpu.pas
  72. 7 3
      compiler/sparc/cgcpu.pas
  73. 11 74
      compiler/sparc/cpubase.pas
  74. 6 2
      compiler/sparc/cpugas.pas
  75. 5 13
      compiler/sparc/cpuinfo.pas
  76. 6 2
      compiler/sparc/ncpuadd.pas
  77. 10 6
      compiler/sparc/ncpuinln.pas
  78. 25 21
      compiler/sparc/ncpumat.pas
  79. 8 4
      compiler/sparc/rgcpu.pas
  80. 6 2
      compiler/symdef.pas
  81. 8 4
      compiler/symsym.pas
  82. 6 4
      compiler/symutil.pas
  83. 21 5
      compiler/tgobj.pas
  84. 12 8
      compiler/vis/cpubase.pas
  85. 10 5
      compiler/x86/aasmcpu.pas
  86. 6 3
      compiler/x86/agx86att.pas
  87. 6 2
      compiler/x86/cga.pas
  88. 6 3
      compiler/x86/cgx86.pas
  89. 6 93
      compiler/x86/cpubase.pas
  90. 7 3
      compiler/x86/nx86add.pas
  91. 8 4
      compiler/x86/nx86cnv.pas
  92. 6 2
      compiler/x86/nx86inl.pas
  93. 9 5
      compiler/x86/nx86mat.pas
  94. 7 3
      compiler/x86/nx86set.pas
  95. 6 2
      compiler/x86/rax86.pas
  96. 7 3
      compiler/x86/rax86att.pas
  97. 8 4
      compiler/x86/rgx86.pas

+ 7 - 3
compiler/aasmbase.pas

@@ -34,8 +34,8 @@ interface
 
 
     uses
     uses
        cutils,cclasses,
        cutils,cclasses,
-       globtype,globals,systems,
-       cpuinfo;
+       globtype,globals,systems
+       ;
 
 
     type
     type
        TAsmSection = class;
        TAsmSection = class;
@@ -941,7 +941,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.22  2004-10-15 09:14:16  mazen
+  Revision 1.23  2004-10-31 21:45:02  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.22  2004/10/15 09:14:16  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
   - remove $IFDEF FPCPROCVAR and related code
 
 

+ 11 - 7
compiler/alpha/cpubase.pas

@@ -281,9 +281,9 @@ unit cpubase;
             { segment in reference at the same place as in loc_register }
             { segment in reference at the same place as in loc_register }
             LOC_REGISTER,LOC_CREGISTER : (
             LOC_REGISTER,LOC_CREGISTER : (
               case longint of
               case longint of
-                1 : (register,registerhigh : tregister);
-                { overlay a registerlow }
-                2 : (registerlow : tregister);
+                1 : (register,register64.reghi : tregister);
+                { overlay a register64.reglo }
+                2 : (register64.reglo : tregister);
                 { overlay a 64 Bit register type }
                 { overlay a 64 Bit register type }
                 3 : (reg64 : tregister64);
                 3 : (reg64 : tregister64);
                 4 : (register64 : tregister64);
                 4 : (register64 : tregister64);
@@ -308,9 +308,9 @@ unit cpubase;
             { segment in reference at the same place as in loc_register }
             { segment in reference at the same place as in loc_register }
             LOC_REGISTER,LOC_CREGISTER : (
             LOC_REGISTER,LOC_CREGISTER : (
               case longint of
               case longint of
-                1 : (register,registerhigh,segment : tregister);
-                { overlay a registerlow }
-                2 : (registerlow : tregister);
+                1 : (register,register64.reghi,segment : tregister);
+                { overlay a register64.reglo }
+                2 : (register64.reglo : tregister);
                 { overlay a 64 Bit register type }
                 { overlay a 64 Bit register type }
                 3 : (reg64 : tregister64);
                 3 : (reg64 : tregister64);
                 4 : (register64 : tregister64);
                 4 : (register64 : tregister64);
@@ -458,7 +458,11 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.7  2004-06-20 08:55:31  florian
+  Revision 1.8  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.7  2004/06/20 08:55:31  florian
     * logs truncated
     * logs truncated
 
 
 }
 }

+ 8 - 4
compiler/alpha/cpupara.pas

@@ -161,11 +161,11 @@ unit cpupara;
                       if nextintreg<=tregister(ord(R_10)-ord(is_64bit))  then
                       if nextintreg<=tregister(ord(R_10)-ord(is_64bit))  then
                         begin
                         begin
                            hp.paraloc.loc:=LOC_REGISTER;
                            hp.paraloc.loc:=LOC_REGISTER;
-                           hp.paraloc.registerlow:=nextintreg;
+                           hp.paraloc.register64.reglo:=nextintreg;
                            inc(nextintreg);
                            inc(nextintreg);
                            if is_64bit then
                            if is_64bit then
                              begin
                              begin
-                               hp.paraloc.registerhigh:=nextintreg;
+                               hp.paraloc.register64.reghi:=nextintreg;
                                inc(nextintreg);
                                inc(nextintreg);
                              end;
                              end;
                         end
                         end
@@ -257,7 +257,7 @@ unit cpupara;
                 getfuncretparaloc.register:=R_3;
                 getfuncretparaloc.register:=R_3;
                 getfuncretparaloc.size:=def_cgsize(p.rettype.def);
                 getfuncretparaloc.size:=def_cgsize(p.rettype.def);
                 if getfuncretparaloc.size in [OS_S64,OS_64] then
                 if getfuncretparaloc.size in [OS_S64,OS_64] then
-                  getfuncretparaloc.registerhigh:=R_4;
+                  getfuncretparaloc.register64.reghi:=R_4;
               end;
               end;
             floatdef:
             floatdef:
               begin
               begin
@@ -291,7 +291,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.2  2004-06-20 08:55:31  florian
+  Revision 1.3  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.2  2004/06/20 08:55:31  florian
     * logs truncated
     * logs truncated
 
 
 }
 }

+ 6 - 2
compiler/aopt.pas

@@ -55,7 +55,7 @@ Unit aopt;
   Implementation
   Implementation
 
 
     uses
     uses
-      cpuinfo, globtype, globals,
+      globtype, globals,
       aoptda,aoptcpu,aoptcpud;
       aoptda,aoptcpu,aoptcpud;
 
 
     Constructor TAsmOptimizer.create(_AsmL: taasmoutput);
     Constructor TAsmOptimizer.create(_AsmL: taasmoutput);
@@ -252,7 +252,11 @@ end.
 
 
 {
 {
  $Log$
  $Log$
- Revision 1.7  2004-10-30 15:21:37  florian
+ Revision 1.8  2004-10-31 21:45:02  peter
+   * generic tlocation
+   * move tlocation to cgutils
+
+ Revision 1.7  2004/10/30 15:21:37  florian
    * fixed generic optimizer
    * fixed generic optimizer
    * enabled generic optimizer for sparc
    * enabled generic optimizer for sparc
 
 

+ 6 - 2
compiler/aoptbase.pas

@@ -93,7 +93,7 @@ unit aoptbase;
   implementation
   implementation
 
 
     uses
     uses
-      globtype,globals, aoptcpub, cpuinfo;
+      globtype,globals, aoptcpub;
 
 
   constructor taoptbase.create;
   constructor taoptbase.create;
     begin
     begin
@@ -258,7 +258,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.8  2004-10-30 15:21:37  florian
+  Revision 1.9  2004-10-31 21:45:02  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.8  2004/10/30 15:21:37  florian
     * fixed generic optimizer
     * fixed generic optimizer
     * enabled generic optimizer for sparc
     * enabled generic optimizer for sparc
 
 

+ 6 - 2
compiler/aoptobj.pas

@@ -36,7 +36,7 @@ Unit AoptObj;
       aasmbase,aasmcpu,aasmtai,
       aasmbase,aasmcpu,aasmtai,
       cclasses,
       cclasses,
       cgbase,
       cgbase,
-      cpuinfo, cpubase,
+      cpubase,
       aoptbase, aoptcpub, aoptda;
       aoptbase, aoptcpub, aoptda;
 
 
     { ************************************************************************* }
     { ************************************************************************* }
@@ -1085,7 +1085,11 @@ End.
 
 
 {
 {
  $Log$
  $Log$
- Revision 1.12  2004-10-30 15:21:37  florian
+ Revision 1.13  2004-10-31 21:45:02  peter
+   * generic tlocation
+   * move tlocation to cgutils
+
+ Revision 1.12  2004/10/30 15:21:37  florian
    * fixed generic optimizer
    * fixed generic optimizer
    * enabled generic optimizer for sparc
    * enabled generic optimizer for sparc
 
 

+ 8 - 4
compiler/arm/cpubase.pas

@@ -273,9 +273,9 @@ unit cpubase;
             { segment in reference at the same place as in loc_register }
             { segment in reference at the same place as in loc_register }
             LOC_REGISTER,LOC_CREGISTER : (
             LOC_REGISTER,LOC_CREGISTER : (
               case longint of
               case longint of
-                1 : (register,registerhigh,segment : tregister);
-                { overlay a registerlow }
-                2 : (registerlow : tregister);
+                1 : (register,register64.reghi,segment : tregister);
+                { overlay a register64.reglo }
+                2 : (register64.reglo : tregister);
                 { overlay a 64 Bit register type }
                 { overlay a 64 Bit register type }
                 3 : (reg64 : tregister64);
                 3 : (reg64 : tregister64);
                 4 : (register64 : tregister64);
                 4 : (register64 : tregister64);
@@ -565,7 +565,11 @@ unit cpubase;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.35  2004-10-31 12:37:11  florian
+  Revision 1.36  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.35  2004/10/31 12:37:11  florian
     * another couple of arm fixed
     * another couple of arm fixed
 
 
   Revision 1.34  2004/10/24 17:32:53  florian
   Revision 1.34  2004/10/24 17:32:53  florian

+ 7 - 3
compiler/arm/narmcnv.pas

@@ -177,9 +177,9 @@ implementation
                 if left.location.size in [OS_64,OS_S64] then
                 if left.location.size in [OS_64,OS_S64] then
                  begin
                  begin
                    hregister:=cg.getintregister(exprasmlist,OS_32);
                    hregister:=cg.getintregister(exprasmlist,OS_32);
-                   cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,left.location.registerlow,hregister);
+                   cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,left.location.register64.reglo,hregister);
                    tcgarm(cg).setflags:=true;
                    tcgarm(cg).setflags:=true;
-                   cg.a_op_reg_reg(exprasmlist,OP_OR,OS_32,left.location.registerhigh,hregister);
+                   cg.a_op_reg_reg(exprasmlist,OP_OR,OS_32,left.location.register64.reghi,hregister);
                    tcgarm(cg).setflags:=false;
                    tcgarm(cg).setflags:=false;
                  end
                  end
                 else
                 else
@@ -220,7 +220,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.11  2004-10-24 07:54:25  florian
+  Revision 1.12  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.11  2004/10/24 07:54:25  florian
     * fixed compilation of arm compiler
     * fixed compilation of arm compiler
 
 
   Revision 1.10  2004/06/20 08:55:31  florian
   Revision 1.10  2004/06/20 08:55:31  florian

+ 5 - 5
compiler/assemble.pas

@@ -186,7 +186,6 @@ Implementation
   {$endif}
   {$endif}
 {$endif}
 {$endif}
       cutils,script,fmodule,verbose,
       cutils,script,fmodule,verbose,
-      cpuinfo,
 {$ifdef memdebug}
 {$ifdef memdebug}
       cclasses,
       cclasses,
 {$endif memdebug}
 {$endif memdebug}
@@ -194,9 +193,6 @@ Implementation
       finput,
       finput,
       gdb,
       gdb,
 {$endif GDB}
 {$endif GDB}
-{$ifdef m68k}
-      cpuinfo,
-{$endif m68k}
       cpubase,aasmcpu
       cpubase,aasmcpu
       ;
       ;
 
 
@@ -1684,7 +1680,11 @@ Implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.80  2004-10-14 14:47:52  mazen
+  Revision 1.81  2004-10-31 21:45:02  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.80  2004/10/14 14:47:52  mazen
   * Merge is complete for this file, cycles !
   * Merge is complete for this file, cycles !
 
 
   Revision 1.79  2004/10/13 17:58:54  peter
   Revision 1.79  2004/10/13 17:58:54  peter

+ 12 - 8
compiler/cg64f32.pas

@@ -33,8 +33,8 @@ unit cg64f32;
 
 
     uses
     uses
        aasmbase,aasmtai,aasmcpu,
        aasmbase,aasmtai,aasmcpu,
-       cpuinfo,cpubase,cpupara,
-       cgbase,cgobj,parabase,
+       cpubase,cpupara,
+       cgbase,cgobj,parabase,cgutils,
        node,symtype
        node,symtype
        ;
        ;
 
 
@@ -375,7 +375,7 @@ unit cg64f32;
           LOC_CREFERENCE :
           LOC_CREFERENCE :
             a_load64low_ref_reg(list,l.reference,reg);
             a_load64low_ref_reg(list,l.reference,reg);
           LOC_REGISTER :
           LOC_REGISTER :
-            cg.a_load_reg_reg(list,OS_32,OS_32,l.registerlow,reg);
+            cg.a_load_reg_reg(list,OS_32,OS_32,l.register64.reglo,reg);
           LOC_CONSTANT :
           LOC_CONSTANT :
             cg.a_load_const_reg(list,OS_32,aint(lo(l.value64)),reg);
             cg.a_load_const_reg(list,OS_32,aint(lo(l.value64)),reg);
           else
           else
@@ -391,7 +391,7 @@ unit cg64f32;
           LOC_CREFERENCE :
           LOC_CREFERENCE :
             a_load64high_ref_reg(list,l.reference,reg);
             a_load64high_ref_reg(list,l.reference,reg);
           LOC_REGISTER :
           LOC_REGISTER :
-            cg.a_load_reg_reg(list,OS_32,OS_32,l.registerhigh,reg);
+            cg.a_load_reg_reg(list,OS_32,OS_32,l.register64.reghi,reg);
           LOC_CONSTANT :
           LOC_CONSTANT :
             cg.a_load_const_reg(list,OS_32,hi(l.value64),reg);
             cg.a_load_const_reg(list,OS_32,hi(l.value64),reg);
           else
           else
@@ -568,7 +568,7 @@ unit cg64f32;
              { get the high dword in a register }
              { get the high dword in a register }
              if l.loc in [LOC_REGISTER,LOC_CREGISTER] then
              if l.loc in [LOC_REGISTER,LOC_CREGISTER] then
                begin
                begin
-                 hreg := l.registerhigh;
+                 hreg := l.register64.reghi;
                end
                end
              else
              else
                begin
                begin
@@ -613,7 +613,7 @@ unit cg64f32;
                  cg.a_label(list,neglabel);
                  cg.a_label(list,neglabel);
                  if l.loc in [LOC_REGISTER,LOC_CREGISTER] then
                  if l.loc in [LOC_REGISTER,LOC_CREGISTER] then
                    begin
                    begin
-                     hreg := l.registerlow;
+                     hreg := l.register64.reglo;
                    end
                    end
                  else
                  else
                    begin
                    begin
@@ -654,7 +654,7 @@ unit cg64f32;
                  begin
                  begin
                    if is_64bit(fromdef) then
                    if is_64bit(fromdef) then
                      begin
                      begin
-                       hreg := l.registerhigh;
+                       hreg := l.register64.reghi;
                        opsize := OS_32;
                        opsize := OS_32;
                      end
                      end
                    else
                    else
@@ -777,7 +777,11 @@ unit cg64f32;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.64  2004-10-15 09:14:16  mazen
+  Revision 1.65  2004-10-31 21:45:02  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.64  2004/10/15 09:14:16  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
   - remove $IFDEF FPCPROCVAR and related code
 
 

+ 6 - 2
compiler/cg64f64.pas

@@ -33,7 +33,7 @@ unit cg64f64;
 
 
     uses
     uses
        aasmbase,aasmtai,aasmcpu,
        aasmbase,aasmtai,aasmcpu,
-       cpuinfo, cpubase,
+       cpubase,
        cgbase,cgobj,
        cgbase,cgobj,
        symtype;
        symtype;
 
 
@@ -271,7 +271,11 @@ unit cg64f64;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.13  2004-06-20 08:55:28  florian
+  Revision 1.14  2004-10-31 21:45:02  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.13  2004/06/20 08:55:28  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.12  2004/06/16 20:07:07  florian
   Revision 1.12  2004/06/16 20:07:07  florian

+ 10 - 11
compiler/cgbase.pas

@@ -29,7 +29,7 @@ interface
 
 
     uses
     uses
       globtype,
       globtype,
-      cpuinfo,
+      aasmbase,
       symconst;
       symconst;
 
 
     type
     type
@@ -166,12 +166,12 @@ interface
 {$ifdef cpu64bit}
 {$ifdef cpu64bit}
       tregister64 = tregister;
       tregister64 = tregister;
 {$else cpu64bit}
 {$else cpu64bit}
-      tregister64 = packed record
+      tregister64 = record
          reglo,reghi : tregister;
          reglo,reghi : tregister;
       end;
       end;
 {$endif cpu64bit}
 {$endif cpu64bit}
 
 
-      Tregistermmxset = packed record
+      Tregistermmxset = record
         reg0,reg1,reg2,reg3:Tregister
         reg0,reg1,reg2,reg3:Tregister
       end;
       end;
 
 
@@ -179,11 +179,6 @@ interface
       tcpuregisterset = set of byte;
       tcpuregisterset = set of byte;
       tsuperregisterset = array[byte] of set of byte;
       tsuperregisterset = array[byte] of set of byte;
 
 
-      { Temp types }
-      ttemptype = (tt_none,
-                   tt_free,tt_normal,tt_persistent,
-                   tt_noreuse,tt_freenoreuse);
-
       pmmshuffle = ^tmmshuffle;
       pmmshuffle = ^tmmshuffle;
 
 
       { this record describes shuffle operations for mm operations; if a pointer a shuffle record
       { this record describes shuffle operations for mm operations; if a pointer a shuffle record
@@ -231,7 +226,7 @@ interface
          { integer values }
          { integer values }
         (0,1,2,4,8,16,1,2,4,8,16,
         (0,1,2,4,8,16,1,2,4,8,16,
          { floating point values }
          { floating point values }
-         4,8,EXTENDED_SIZE,8,16,
+         4,8,10,8,16,
          { multimedia values }
          { multimedia values }
          1,2,4,8,16,1,2,4,8,16);
          1,2,4,8,16,1,2,4,8,16);
 
 
@@ -607,7 +602,11 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.95  2004-10-14 10:59:58  michael
+  Revision 1.96  2004-10-31 21:45:02  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.95  2004/10/14 10:59:58  michael
   * fix clearing of superregset (from Peter)
   * fix clearing of superregset (from Peter)
 
 
   Revision 1.94  2004/08/24 21:02:32  florian
   Revision 1.94  2004/08/24 21:02:32  florian
@@ -651,7 +650,7 @@ end.
 
 
   Revision 1.87  2004/02/09 22:14:17  peter
   Revision 1.87  2004/02/09 22:14:17  peter
     * more x86_64 parameter fixes
     * more x86_64 parameter fixes
-    * tparalocation.lochigh is now used to indicate if registerhigh
+    * tparalocation.lochigh is now used to indicate if register64.reghi
       is used and what the type is
       is used and what the type is
 
 
 }
 }

+ 7 - 52
compiler/cgobj.pas

@@ -38,7 +38,7 @@ unit cgobj;
 
 
     uses
     uses
        cclasses,globtype,
        cclasses,globtype,
-       cpubase,cpuinfo,cgbase,parabase,
+       cpubase,cgbase,cgutils,parabase,
        aasmbase,aasmtai,aasmcpu,
        aasmbase,aasmtai,aasmcpu,
        symconst,symbase,symtype,symdef,symtable,rgobj
        symconst,symbase,symtype,symdef,symtable,rgobj
        ;
        ;
@@ -46,7 +46,6 @@ unit cgobj;
     type
     type
        talignment = (AM_NATURAL,AM_NONE,AM_2BYTE,AM_4BYTE,AM_8BYTE);
        talignment = (AM_NATURAL,AM_NONE,AM_2BYTE,AM_4BYTE,AM_8BYTE);
 
 
-
        {# @abstract(Abstract code generator)
        {# @abstract(Abstract code generator)
           This class implements an abstract instruction generator. Some of
           This class implements an abstract instruction generator. Some of
           the methods of this class are generic, while others must
           the methods of this class are generic, while others must
@@ -478,14 +477,6 @@ unit cgobj;
     end;
     end;
 {$endif cpu64bit}
 {$endif cpu64bit}
 
 
-    { tlocation handling }
-
-    procedure location_reset(var l : tlocation;lt:TCGLoc;lsize:TCGSize);
-    procedure location_freetemp(list: taasmoutput; const l : tlocation);
-    procedure location_copy(var destloc:tlocation; const sourceloc : tlocation);
-    procedure location_swap(var destloc,sourceloc : tlocation);
-
-
     var
     var
        {# Main code generator class }
        {# Main code generator class }
        cg : tcg;
        cg : tcg;
@@ -500,8 +491,7 @@ implementation
     uses
     uses
        globals,options,systems,
        globals,options,systems,
        verbose,defutil,paramgr,
        verbose,defutil,paramgr,
-       tgobj,cutils,procinfo,
-       cgutils;
+       tgobj,cutils,procinfo;
 
 
     const
     const
       { Please leave this here, this module should NOT use
       { Please leave this here, this module should NOT use
@@ -2028,45 +2018,6 @@ implementation
 {$endif cpu64bit}
 {$endif cpu64bit}
 
 
 
 
-{****************************************************************************
-                                  TLocation
-****************************************************************************}
-
-    procedure location_reset(var l : tlocation;lt:TCGLoc;lsize:TCGSize);
-      begin
-        FillChar(l,sizeof(tlocation),0);
-        l.loc:=lt;
-        l.size:=lsize;
-{$ifdef arm}
-        if l.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
-          l.reference.signindex:=1;
-{$endif arm}
-      end;
-
-
-    procedure location_freetemp(list:taasmoutput; const l : tlocation);
-      begin
-        if (l.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
-         tg.ungetiftemp(list,l.reference);
-      end;
-
-
-    procedure location_copy(var destloc:tlocation; const sourceloc : tlocation);
-      begin
-        destloc:=sourceloc;
-      end;
-
-
-    procedure location_swap(var destloc,sourceloc : tlocation);
-      var
-        swapl : tlocation;
-      begin
-        swapl := destloc;
-        destloc := sourceloc;
-        sourceloc := swapl;
-      end;
-
-
 
 
 initialization
 initialization
     ;
     ;
@@ -2078,7 +2029,11 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.182  2004-10-25 15:36:47  peter
+  Revision 1.183  2004-10-31 21:45:02  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.182  2004/10/25 15:36:47  peter
     * save standard registers moved to tcgobj
     * save standard registers moved to tcgobj
 
 
   Revision 1.181  2004/10/24 20:01:08  peter
   Revision 1.181  2004/10/24 20:01:08  peter

+ 93 - 4
compiler/cgutils.pas

@@ -28,9 +28,52 @@ unit cgutils;
   interface
   interface
 
 
     uses
     uses
+      globtype,
       aasmbase,
       aasmbase,
-      cgbase,
-      cpubase;
+      cpubase,cgbase;
+
+    type
+      { reference record, reordered for best alignment }
+      preference = ^treference;
+      treference = record
+         offset      : aint;
+         symbol,
+         relsymbol   : tasmsymbol;
+         segment,
+         base,
+         index       : tregister;
+         refaddr     : trefaddr;
+         scalefactor : byte;
+      end;
+
+      tlocation = record
+         loc  : TCGLoc;
+         size : TCGSize;
+         case TCGLoc of
+            LOC_FLAGS : (resflags : tresflags);
+            LOC_CONSTANT : (
+              case longint of
+{$ifdef FPC_BIG_ENDIAN}
+                1 : (_valuedummy,value : aint);
+{$else FPC_BIG_ENDIAN}
+                1 : (value : aint);
+{$endif FPC_BIG_ENDIAN}
+                2 : (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 : tregister);
+{$ifndef cpu64bit}
+                { overlay a 64 Bit register type }
+                2 : (register64 : tregister64);
+{$endif cpu64bit}
+              );
+      end;
+
 
 
     { trerefence handling }
     { trerefence handling }
 
 
@@ -46,7 +89,15 @@ unit cgutils;
     }
     }
     function references_equal(sref : treference;dref : treference) : boolean;
     function references_equal(sref : treference;dref : treference) : boolean;
 
 
-  implementation
+    { tlocation handling }
+
+    procedure location_reset(var l : tlocation;lt:TCGLoc;lsize:TCGSize);
+    procedure location_copy(var destloc:tlocation; const sourceloc : tlocation);
+    procedure location_swap(var destloc,sourceloc : tlocation);
+
+
+
+implementation
 
 
 {****************************************************************************
 {****************************************************************************
                                   TReference
                                   TReference
@@ -82,10 +133,48 @@ unit cgutils;
         references_equal:=CompareByte(sref,dref,sizeof(treference))=0;
         references_equal:=CompareByte(sref,dref,sizeof(treference))=0;
       end;
       end;
 
 
+
+{****************************************************************************
+                                  TLocation
+****************************************************************************}
+
+    procedure location_reset(var l : tlocation;lt:TCGLoc;lsize:TCGSize);
+      begin
+        FillChar(l,sizeof(tlocation),0);
+        l.loc:=lt;
+        l.size:=lsize;
+{$ifdef arm}
+        if l.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
+          l.reference.signindex:=1;
+{$endif arm}
+      end;
+
+
+    procedure location_copy(var destloc:tlocation; const sourceloc : tlocation);
+      begin
+        destloc:=sourceloc;
+      end;
+
+
+    procedure location_swap(var destloc,sourceloc : tlocation);
+      var
+        swapl : tlocation;
+      begin
+        swapl := destloc;
+        destloc := sourceloc;
+        sourceloc := swapl;
+      end;
+
+
+
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2004-02-27 10:21:05  florian
+  Revision 1.2  2004-10-31 21:45:02  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.1  2004/02/27 10:21:05  florian
     * top_symbol killed
     * top_symbol killed
     + refaddr to treference added
     + refaddr to treference added
     + refsymbol to treference added
     + refsymbol to treference added

+ 5 - 2
compiler/defcmp.pas

@@ -28,7 +28,6 @@ interface
 
 
     uses
     uses
        cclasses,
        cclasses,
-       cpuinfo,
        globtype,globals,tokens,
        globtype,globals,tokens,
        node,
        node,
        symconst,symbase,symtype,symdef;
        symconst,symbase,symtype,symdef;
@@ -1300,7 +1299,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.53  2004-09-21 15:52:35  peter
+  Revision 1.54  2004-10-31 21:45:02  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.53  2004/09/21 15:52:35  peter
     * prefer pchar-string over pchar-pointer
     * prefer pchar-string over pchar-pointer
 
 
   Revision 1.52  2004/09/16 16:32:44  peter
   Revision 1.52  2004/09/16 16:32:44  peter

+ 6 - 2
compiler/defutil.pas

@@ -203,7 +203,7 @@ interface
 implementation
 implementation
 
 
     uses
     uses
-       tokens,systems,verbose;
+       systems,verbose;
 
 
     { returns true, if def uses FPU }
     { returns true, if def uses FPU }
     function is_fpu(def : tdef) : boolean;
     function is_fpu(def : tdef) : boolean;
@@ -888,7 +888,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.19  2004-08-24 21:02:32  florian
+  Revision 1.20  2004-10-31 21:45:02  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.19  2004/08/24 21:02:32  florian
     * fixed longbool(<int64>) on sparc
     * fixed longbool(<int64>) on sparc
 
 
   Revision 1.18  2004/06/20 08:55:29  florian
   Revision 1.18  2004/06/20 08:55:29  florian

+ 6 - 3
compiler/dwarf.pas

@@ -100,8 +100,7 @@ interface
 implementation
 implementation
 
 
     uses
     uses
-      verbose,
-      cpuinfo;
+      verbose;
 
 
     const
     const
       { Call frame information }
       { Call frame information }
@@ -422,7 +421,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2004-06-20 08:55:29  florian
+  Revision 1.4  2004-10-31 21:45:02  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.3  2004/06/20 08:55:29  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.2  2004/06/16 20:07:07  florian
   Revision 1.2  2004/06/16 20:07:07  florian

+ 7 - 2
compiler/globals.pas

@@ -47,7 +47,8 @@ interface
       dos,
       dos,
 {$ENDIF USE_SYSUTILS}
 {$ENDIF USE_SYSUTILS}
       cutils,cclasses,
       cutils,cclasses,
-      globtype,version,systems,cpuinfo;
+      cpuinfo,
+      globtype,version,systems;
 
 
     const
     const
        delphimodeswitches : tmodeswitches=
        delphimodeswitches : tmodeswitches=
@@ -2134,7 +2135,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.151  2004-10-31 19:09:54  peter
+  Revision 1.152  2004-10-31 21:45:02  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.151  2004/10/31 19:09:54  peter
     * default paths fixed
     * default paths fixed
 
 
   Revision 1.150  2004/10/31 18:54:24  peter
   Revision 1.150  2004/10/31 18:54:24  peter

+ 11 - 1
compiler/globtype.pas

@@ -178,6 +178,12 @@ than 255 characters. That's why using Ansi Strings}
          bt_general,bt_type,bt_const,bt_except,bt_body
          bt_general,bt_type,bt_const,bt_except,bt_body
        );
        );
 
 
+       { Temp types }
+       ttemptype = (tt_none,
+                    tt_free,tt_normal,tt_persistent,
+                    tt_noreuse,tt_freenoreuse);
+       ttemptypeset = set of ttemptype;
+
        { calling convention for tprocdef and tprocvardef }
        { calling convention for tprocdef and tprocvardef }
        tproccalloption=(pocall_none,
        tproccalloption=(pocall_none,
          { procedure uses C styled calling }
          { procedure uses C styled calling }
@@ -307,7 +313,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.63  2004-10-25 15:38:41  peter
+  Revision 1.64  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.63  2004/10/25 15:38:41  peter
     * heap and heapsize removed
     * heap and heapsize removed
     * checkpointer fixes
     * checkpointer fixes
 
 

+ 6 - 3
compiler/i386/ag386int.pas

@@ -31,7 +31,7 @@ interface
 
 
     uses
     uses
       cpubase,
       cpubase,
-      aasmbase,aasmtai,aasmcpu,assemble;
+      aasmbase,aasmtai,aasmcpu,assemble,cgutils;
 
 
     type
     type
       T386IntelAssembler = class(TExternalAssembler)
       T386IntelAssembler = class(TExternalAssembler)
@@ -354,7 +354,6 @@ implementation
       InlineLevel : longint;
       InlineLevel : longint;
       i,j,l    : longint;
       i,j,l    : longint;
       consttyp : taitype;
       consttyp : taitype;
-      found,
       do_line,DoNotSplitLine,
       do_line,DoNotSplitLine,
       quoted   : boolean;
       quoted   : boolean;
     begin
     begin
@@ -875,7 +874,11 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.52  2004-10-15 09:16:21  mazen
+  Revision 1.53  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.52  2004/10/15 09:16:21  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
   - remove $IFDEF FPCPROCVAR and related code
 
 

+ 6 - 2
compiler/i386/ag386nsm.pas

@@ -29,7 +29,7 @@ interface
 
 
     uses
     uses
       cpubase,
       cpubase,
-      aasmbase,aasmtai,aasmcpu,assemble;
+      aasmbase,aasmtai,aasmcpu,assemble,cgutils;
 
 
     type
     type
       T386NasmAssembler = class(texternalassembler)
       T386NasmAssembler = class(texternalassembler)
@@ -906,7 +906,11 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.49  2004-10-15 09:16:21  mazen
+  Revision 1.50  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.49  2004/10/15 09:16:21  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
   - remove $IFDEF FPCPROCVAR and related code
 
 

+ 7 - 4
compiler/i386/cgcpu.pas

@@ -30,7 +30,7 @@ unit cgcpu;
        globtype,
        globtype,
        cgbase,cgobj,cg64f32,cgx86,
        cgbase,cgobj,cg64f32,cgx86,
        aasmbase,aasmtai,aasmcpu,
        aasmbase,aasmtai,aasmcpu,
-       cpubase,cpuinfo,parabase,
+       cpubase,cpuinfo,parabase,cgutils,
        node,symconst
        node,symconst
        ;
        ;
 
 
@@ -65,8 +65,7 @@ unit cgcpu;
     uses
     uses
        globals,verbose,systems,cutils,
        globals,verbose,systems,cutils,
        paramgr,procinfo,
        paramgr,procinfo,
-       rgcpu,rgx86,tgobj,
-       cgutils;
+       rgcpu,rgx86,tgobj;
 
 
     procedure Tcg386.init_register_allocators;
     procedure Tcg386.init_register_allocators;
       begin
       begin
@@ -520,7 +519,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.59  2004-10-24 20:01:08  peter
+  Revision 1.60  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.59  2004/10/24 20:01:08  peter
     * remove saveregister calling convention
     * remove saveregister calling convention
 
 
   Revision 1.58  2004/10/24 11:44:28  peter
   Revision 1.58  2004/10/24 11:44:28  peter

+ 12 - 2
compiler/i386/cpubase.inc

@@ -23,7 +23,6 @@
 { This include file contains the basic declarations for the i386 architecture.
 { This include file contains the basic declarations for the i386 architecture.
 }
 }
 
 
-
 {*****************************************************************************
 {*****************************************************************************
                                 Operand Sizes
                                 Operand Sizes
 *****************************************************************************}
 *****************************************************************************}
@@ -167,9 +166,20 @@
       }
       }
       std_param_align = 4;
       std_param_align = 4;
 
 
+      { size of the buffer used for setjump/longjmp
+        the size of this buffer is deduced from the
+        jmp_buf structure in setjumph.inc file
+      }
+      jmp_buf_size = 24;
+
+
 {
 {
   $Log$
   $Log$
-  Revision 1.14  2004-06-20 08:55:31  florian
+  Revision 1.15  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.14  2004/06/20 08:55:31  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.13  2004/06/16 20:07:10  florian
   Revision 1.13  2004/06/16 20:07:10  florian

+ 5 - 14
compiler/i386/cpuinfo.pas

@@ -59,19 +59,6 @@ Type
 
 
 
 
 Const
 Const
-   {# Size of native extended floating point type }
-   extended_size = 10;
-   {# Size of a multimedia register               }
-   mmreg_size = 8;
-
-   { target cpu string (used by compiler options) }
-   target_cpu_string = 'i386';
-   { size of the buffer used for setjump/longjmp
-     the size of this buffer is deduced from the
-     jmp_buf structure in setjumph.inc file
-   }
-   jmp_buf_size = 24;
-
    { calling conventions supported by the code generator }
    { calling conventions supported by the code generator }
    supported_calling_conventions : tproccalloptions = [
    supported_calling_conventions : tproccalloptions = [
      pocall_internproc,
      pocall_internproc,
@@ -110,7 +97,11 @@ Implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.26  2004-06-20 08:55:31  florian
+  Revision 1.27  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.26  2004/06/20 08:55:31  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.25  2004/06/16 20:07:10  florian
   Revision 1.25  2004/06/16 20:07:10  florian

+ 6 - 2
compiler/i386/cpupara.pas

@@ -523,7 +523,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.55  2004-09-21 17:25:12  peter
+  Revision 1.56  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.55  2004/09/21 17:25:12  peter
     * paraloc branch merged
     * paraloc branch merged
 
 
   Revision 1.54.4.1  2004/08/31 20:43:06  peter
   Revision 1.54.4.1  2004/08/31 20:43:06  peter
@@ -555,7 +559,7 @@ end.
 
 
   Revision 1.50  2004/02/09 22:14:17  peter
   Revision 1.50  2004/02/09 22:14:17  peter
     * more x86_64 parameter fixes
     * more x86_64 parameter fixes
-    * tparalocation.lochigh is now used to indicate if registerhigh
+    * tparalocation.lochigh is now used to indicate if register64.reghi
       is used and what the type is
       is used and what the type is
 
 
 }
 }

+ 7 - 3
compiler/i386/csopt386.pas

@@ -45,7 +45,7 @@ uses
 {$else}
 {$else}
   {$ifdef replaceregdebug}cutils,{$endif}
   {$ifdef replaceregdebug}cutils,{$endif}
 {$endif}
 {$endif}
-  globtype, verbose, procinfo, globals, daopt386, rgobj, rropt386;
+  globtype, verbose, procinfo, globals, daopt386, rgobj, rropt386,cgutils;
 
 
 {
 {
 function TaiInSequence(P: tai; Const Seq: TContent): Boolean;
 function TaiInSequence(P: tai; Const Seq: TContent): Boolean;
@@ -1567,7 +1567,7 @@ begin
         else
         else
           AllocRegBetween(asml,newreg(R_INTREGISTER,reginfo.new2oldreg[regcounter],R_SUBWHOLE),
           AllocRegBetween(asml,newreg(R_INTREGISTER,reginfo.new2oldreg[regcounter],R_SUBWHOLE),
             prevseqstart,curseqstart,ptaiprop(prevseqstart.optinfo)^.usedregs);
             prevseqstart,curseqstart,ptaiprop(prevseqstart.optinfo)^.usedregs);
- 
+
         if curprev <> prevseqstart then
         if curprev <> prevseqstart then
           begin
           begin
             if assigned(reginfo.lastReload[regCounter]) then
             if assigned(reginfo.lastReload[regCounter]) then
@@ -2122,7 +2122,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.68  2004-10-10 15:01:19  jonas
+  Revision 1.69  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.68  2004/10/10 15:01:19  jonas
     * several fixes to allocregbetween()
     * several fixes to allocregbetween()
 
 
   Revision 1.67  2004/10/06 19:24:38  jonas
   Revision 1.67  2004/10/06 19:24:38  jonas

+ 6 - 2
compiler/i386/daopt386.pas

@@ -30,7 +30,7 @@ interface
 
 
 uses
 uses
   globtype,
   globtype,
-  cclasses,aasmbase,aasmtai,aasmcpu,cgbase,
+  cclasses,aasmbase,aasmtai,aasmcpu,cgbase,cgutils,
   cpubase,optbase;
   cpubase,optbase;
 
 
 {******************************* Constants *******************************}
 {******************************* Constants *******************************}
@@ -2783,7 +2783,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.73  2004-10-10 15:01:19  jonas
+  Revision 1.74  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.73  2004/10/10 15:01:19  jonas
     * several fixes to allocregbetween()
     * several fixes to allocregbetween()
 
 
   Revision 1.72  2004/10/06 19:24:38  jonas
   Revision 1.72  2004/10/06 19:24:38  jonas

+ 22 - 18
compiler/i386/n386add.pas

@@ -49,7 +49,7 @@ interface
       symconst,symdef,paramgr,
       symconst,symdef,paramgr,
       aasmbase,aasmtai,aasmcpu,
       aasmbase,aasmtai,aasmcpu,
       cgbase,
       cgbase,
-      ncon,nset,
+      ncon,nset,cgutils,tgobj,
       cga,ncgutil,cgobj,cg64f32;
       cga,ncgutil,cgobj,cg64f32;
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -195,8 +195,8 @@ interface
               hregister2:=cg.getintregister(exprasmlist,OS_INT);
               hregister2:=cg.getintregister(exprasmlist,OS_INT);
               cg64.a_load64_loc_reg(exprasmlist,left.location,joinreg64(hregister,hregister2));
               cg64.a_load64_loc_reg(exprasmlist,left.location,joinreg64(hregister,hregister2));
               location_reset(left.location,LOC_REGISTER,OS_64);
               location_reset(left.location,LOC_REGISTER,OS_64);
-              left.location.registerlow:=hregister;
-              left.location.registerhigh:=hregister2;
+              left.location.register64.reglo:=hregister;
+              left.location.register64.reghi:=hregister2;
             end
             end
            else
            else
             begin
             begin
@@ -231,12 +231,12 @@ interface
             begin
             begin
               r:=cg.getintregister(exprasmlist,OS_INT);
               r:=cg.getintregister(exprasmlist,OS_INT);
               cg64.a_load64low_loc_reg(exprasmlist,right.location,r);
               cg64.a_load64low_loc_reg(exprasmlist,right.location,r);
-              emit_reg_reg(op1,opsize,left.location.registerlow,r);
-              emit_reg_reg(A_MOV,opsize,r,left.location.registerlow);
+              emit_reg_reg(op1,opsize,left.location.register64.reglo,r);
+              emit_reg_reg(A_MOV,opsize,r,left.location.register64.reglo);
               cg64.a_load64high_loc_reg(exprasmlist,right.location,r);
               cg64.a_load64high_loc_reg(exprasmlist,right.location,r);
               { the carry flag is still ok }
               { the carry flag is still ok }
-              emit_reg_reg(op2,opsize,left.location.registerhigh,r);
-              emit_reg_reg(A_MOV,opsize,r,left.location.registerhigh);
+              emit_reg_reg(op2,opsize,left.location.register64.reghi,r);
+              emit_reg_reg(A_MOV,opsize,r,left.location.register64.reghi);
             end
             end
            else
            else
             begin
             begin
@@ -365,8 +365,8 @@ interface
                  hregister2:=cg.getintregister(exprasmlist,OS_INT);
                  hregister2:=cg.getintregister(exprasmlist,OS_INT);
                  cg64.a_load64_loc_reg(exprasmlist,left.location,joinreg64(hregister,hregister2));
                  cg64.a_load64_loc_reg(exprasmlist,left.location,joinreg64(hregister,hregister2));
                  location_reset(left.location,LOC_REGISTER,OS_64);
                  location_reset(left.location,LOC_REGISTER,OS_64);
-                 left.location.registerlow:=hregister;
-                 left.location.registerhigh:=hregister2;
+                 left.location.register64.reglo:=hregister;
+                 left.location.register64.reghi:=hregister2;
                end;
                end;
             end
             end
            else
            else
@@ -379,9 +379,9 @@ interface
         { at this point, left.location.loc should be LOC_REGISTER }
         { at this point, left.location.loc should be LOC_REGISTER }
         if right.location.loc=LOC_REGISTER then
         if right.location.loc=LOC_REGISTER then
          begin
          begin
-           emit_reg_reg(A_CMP,S_L,right.location.registerhigh,left.location.registerhigh);
+           emit_reg_reg(A_CMP,S_L,right.location.register64.reghi,left.location.register64.reghi);
            firstjmp64bitcmp;
            firstjmp64bitcmp;
-           emit_reg_reg(A_CMP,S_L,right.location.registerlow,left.location.registerlow);
+           emit_reg_reg(A_CMP,S_L,right.location.register64.reglo,left.location.register64.reglo);
            secondjmp64bitcmp;
            secondjmp64bitcmp;
          end
          end
         else
         else
@@ -389,9 +389,9 @@ interface
            case right.location.loc of
            case right.location.loc of
              LOC_CREGISTER :
              LOC_CREGISTER :
                begin
                begin
-                 emit_reg_reg(A_CMP,S_L,right.location.registerhigh,left.location.registerhigh);
+                 emit_reg_reg(A_CMP,S_L,right.location.register64.reghi,left.location.register64.reghi);
                  firstjmp64bitcmp;
                  firstjmp64bitcmp;
-                 emit_reg_reg(A_CMP,S_L,right.location.registerlow,left.location.registerlow);
+                 emit_reg_reg(A_CMP,S_L,right.location.register64.reglo,left.location.register64.reglo);
                  secondjmp64bitcmp;
                  secondjmp64bitcmp;
                end;
                end;
              LOC_CREFERENCE,
              LOC_CREFERENCE,
@@ -399,18 +399,18 @@ interface
                begin
                begin
                  href:=right.location.reference;
                  href:=right.location.reference;
                  inc(href.offset,4);
                  inc(href.offset,4);
-                 emit_ref_reg(A_CMP,S_L,href,left.location.registerhigh);
+                 emit_ref_reg(A_CMP,S_L,href,left.location.register64.reghi);
                  firstjmp64bitcmp;
                  firstjmp64bitcmp;
-                 emit_ref_reg(A_CMP,S_L,right.location.reference,left.location.registerlow);
+                 emit_ref_reg(A_CMP,S_L,right.location.reference,left.location.register64.reglo);
                  secondjmp64bitcmp;
                  secondjmp64bitcmp;
                  cg.a_jmp_always(exprasmlist,falselabel);
                  cg.a_jmp_always(exprasmlist,falselabel);
                  location_freetemp(exprasmlist,right.location);
                  location_freetemp(exprasmlist,right.location);
                end;
                end;
              LOC_CONSTANT :
              LOC_CONSTANT :
                begin
                begin
-                 exprasmlist.concat(taicpu.op_const_reg(A_CMP,S_L,aint(hi(right.location.value64)),left.location.registerhigh));
+                 exprasmlist.concat(taicpu.op_const_reg(A_CMP,S_L,aint(hi(right.location.value64)),left.location.register64.reghi));
                  firstjmp64bitcmp;
                  firstjmp64bitcmp;
-                 exprasmlist.concat(taicpu.op_const_reg(A_CMP,S_L,aint(lo(right.location.value64)),left.location.registerlow));
+                 exprasmlist.concat(taicpu.op_const_reg(A_CMP,S_L,aint(lo(right.location.value64)),left.location.register64.reglo));
                  secondjmp64bitcmp;
                  secondjmp64bitcmp;
                end;
                end;
              else
              else
@@ -654,7 +654,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.99  2004-09-25 14:23:54  peter
+  Revision 1.100  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.99  2004/09/25 14:23:54  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 5 - 4
compiler/i386/n386cal.pas

@@ -44,9 +44,6 @@ implementation
     uses
     uses
       globtype,systems,
       globtype,systems,
       cutils,verbose,globals,
       cutils,verbose,globals,
-{$ifdef GDB}
-      gdb,
-{$endif GDB}
       cgbase,
       cgbase,
       cpubase,paramgr,
       cpubase,paramgr,
       aasmtai,aasmcpu,
       aasmtai,aasmcpu,
@@ -99,7 +96,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.102  2004-09-25 14:23:54  peter
+  Revision 1.103  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.102  2004/09/25 14:23:54  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 6 - 2
compiler/i386/n386con.pas

@@ -41,7 +41,7 @@ implementation
       systems,globals,
       systems,globals,
       defutil,
       defutil,
       cpubase,
       cpubase,
-      cga,cgx86,cgobj,cgbase;
+      cga,cgx86,cgobj,cgbase,cgutils;
 
 
 {*****************************************************************************
 {*****************************************************************************
                            TI386REALCONSTNODE
                            TI386REALCONSTNODE
@@ -91,7 +91,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.25  2004-06-20 08:55:31  florian
+  Revision 1.26  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.25  2004/06/20 08:55:31  florian
     * logs truncated
     * logs truncated
 
 
 }
 }

+ 36 - 32
compiler/i386/n386mat.pas

@@ -53,10 +53,10 @@ implementation
       globtype,systems,
       globtype,systems,
       cutils,verbose,globals,
       cutils,verbose,globals,
       symconst,symdef,aasmbase,aasmtai,defutil,
       symconst,symdef,aasmbase,aasmtai,defutil,
-      cgbase,pass_1,pass_2,
+      cgbase,pass_2,
       ncon,
       ncon,
       cpubase,cpuinfo,
       cpubase,cpuinfo,
-      cga,ncgutil,cgobj;
+      cga,ncgutil,cgobj,cgutils;
 
 
 {*****************************************************************************
 {*****************************************************************************
                              TI386MODDIVNODE
                              TI386MODDIVNODE
@@ -181,7 +181,7 @@ implementation
 
 
     procedure ti386shlshrnode.pass_2;
     procedure ti386shlshrnode.pass_2;
 
 
-    var hregisterhigh,hregisterlow:Tregister;
+    var hreg64hi,hreg64lo:Tregister;
         op:Tasmop;
         op:Tasmop;
         v : TConstExprInt;
         v : TConstExprInt;
         l1,l2,l3:Tasmlabel;
         l1,l2,l3:Tasmlabel;
@@ -202,8 +202,8 @@ implementation
 
 
           { load left operator in a register }
           { load left operator in a register }
           location_force_reg(exprasmlist,left.location,OS_64,false);
           location_force_reg(exprasmlist,left.location,OS_64,false);
-          hregisterhigh:=left.location.registerhigh;
-          hregisterlow:=left.location.registerlow;
+          hreg64hi:=left.location.register64.reghi;
+          hreg64lo:=left.location.register64.reglo;
 
 
           { shifting by a constant directly coded: }
           { shifting by a constant directly coded: }
           if (right.nodetype=ordconstn) then
           if (right.nodetype=ordconstn) then
@@ -213,33 +213,33 @@ implementation
                 begin
                 begin
                   if nodetype=shln then
                   if nodetype=shln then
                     begin
                     begin
-                      emit_reg_reg(A_XOR,S_L,hregisterhigh,hregisterhigh);
+                      emit_reg_reg(A_XOR,S_L,hreg64hi,hreg64hi);
                       if ((v and 31) <> 0) then
                       if ((v and 31) <> 0) then
-                        emit_const_reg(A_SHL,S_L,v and 31,hregisterlow);
+                        emit_const_reg(A_SHL,S_L,v and 31,hreg64lo);
                     end
                     end
                   else
                   else
                     begin
                     begin
-                      emit_reg_reg(A_XOR,S_L,hregisterlow,hregisterlow);
+                      emit_reg_reg(A_XOR,S_L,hreg64lo,hreg64lo);
                       if ((v and 31) <> 0) then
                       if ((v and 31) <> 0) then
-                        emit_const_reg(A_SHR,S_L,v and 31,hregisterhigh);
+                        emit_const_reg(A_SHR,S_L,v and 31,hreg64hi);
                     end;
                     end;
-                  location.registerhigh:=hregisterlow;
-                  location.registerlow:=hregisterhigh;
+                  location.register64.reghi:=hreg64lo;
+                  location.register64.reglo:=hreg64hi;
                 end
                 end
               else
               else
                 begin
                 begin
                   if nodetype=shln then
                   if nodetype=shln then
                     begin
                     begin
-                      emit_const_reg_reg(A_SHLD,S_L,v and 31,hregisterlow,hregisterhigh);
-                      emit_const_reg(A_SHL,S_L,v and 31,hregisterlow);
+                      emit_const_reg_reg(A_SHLD,S_L,v and 31,hreg64lo,hreg64hi);
+                      emit_const_reg(A_SHL,S_L,v and 31,hreg64lo);
                     end
                     end
                   else
                   else
                     begin
                     begin
-                      emit_const_reg_reg(A_SHRD,S_L,v and 31,hregisterhigh,hregisterlow);
-                      emit_const_reg(A_SHR,S_L,v and 31,hregisterhigh);
+                      emit_const_reg_reg(A_SHRD,S_L,v and 31,hreg64hi,hreg64lo);
+                      emit_const_reg(A_SHR,S_L,v and 31,hreg64hi);
                     end;
                     end;
-                  location.registerlow:=hregisterlow;
-                  location.registerhigh:=hregisterhigh;
+                  location.register64.reglo:=hreg64lo;
+                  location.register64.reghi:=hreg64hi;
                 end;
                 end;
             end
             end
           else
           else
@@ -259,8 +259,8 @@ implementation
               objectlibrary.getlabel(l3);
               objectlibrary.getlabel(l3);
               emit_const_reg(A_CMP,S_L,64,NR_ECX);
               emit_const_reg(A_CMP,S_L,64,NR_ECX);
               cg.a_jmp_flags(exprasmlist,F_L,l1);
               cg.a_jmp_flags(exprasmlist,F_L,l1);
-              emit_reg_reg(A_XOR,S_L,hregisterlow,hregisterlow);
-              emit_reg_reg(A_XOR,S_L,hregisterhigh,hregisterhigh);
+              emit_reg_reg(A_XOR,S_L,hreg64lo,hreg64lo);
+              emit_reg_reg(A_XOR,S_L,hreg64hi,hreg64hi);
               cg.a_jmp_always(exprasmlist,l3);
               cg.a_jmp_always(exprasmlist,l3);
               cg.a_label(exprasmlist,l1);
               cg.a_label(exprasmlist,l1);
               emit_const_reg(A_CMP,S_L,32,NR_ECX);
               emit_const_reg(A_CMP,S_L,32,NR_ECX);
@@ -268,29 +268,29 @@ implementation
               emit_const_reg(A_SUB,S_L,32,NR_ECX);
               emit_const_reg(A_SUB,S_L,32,NR_ECX);
               if nodetype=shln then
               if nodetype=shln then
                 begin
                 begin
-                  emit_reg_reg(A_SHL,S_L,NR_CL,hregisterlow);
-                  emit_reg_reg(A_MOV,S_L,hregisterlow,hregisterhigh);
-                  emit_reg_reg(A_XOR,S_L,hregisterlow,hregisterlow);
+                  emit_reg_reg(A_SHL,S_L,NR_CL,hreg64lo);
+                  emit_reg_reg(A_MOV,S_L,hreg64lo,hreg64hi);
+                  emit_reg_reg(A_XOR,S_L,hreg64lo,hreg64lo);
                   cg.a_jmp_always(exprasmlist,l3);
                   cg.a_jmp_always(exprasmlist,l3);
                   cg.a_label(exprasmlist,l2);
                   cg.a_label(exprasmlist,l2);
-                  emit_reg_reg_reg(A_SHLD,S_L,NR_CL,hregisterlow,hregisterhigh);
-                  emit_reg_reg(A_SHL,S_L,NR_CL,hregisterlow);
+                  emit_reg_reg_reg(A_SHLD,S_L,NR_CL,hreg64lo,hreg64hi);
+                  emit_reg_reg(A_SHL,S_L,NR_CL,hreg64lo);
                 end
                 end
               else
               else
                 begin
                 begin
-                  emit_reg_reg(A_SHR,S_L,NR_CL,hregisterhigh);
-                  emit_reg_reg(A_MOV,S_L,hregisterhigh,hregisterlow);
-                  emit_reg_reg(A_XOR,S_L,hregisterhigh,hregisterhigh);
+                  emit_reg_reg(A_SHR,S_L,NR_CL,hreg64hi);
+                  emit_reg_reg(A_MOV,S_L,hreg64hi,hreg64lo);
+                  emit_reg_reg(A_XOR,S_L,hreg64hi,hreg64hi);
                   cg.a_jmp_always(exprasmlist,l3);
                   cg.a_jmp_always(exprasmlist,l3);
                   cg.a_label(exprasmlist,l2);
                   cg.a_label(exprasmlist,l2);
-                  emit_reg_reg_reg(A_SHRD,S_L,NR_CL,hregisterhigh,hregisterlow);
-                  emit_reg_reg(A_SHR,S_L,NR_CL,hregisterhigh);
+                  emit_reg_reg_reg(A_SHRD,S_L,NR_CL,hreg64hi,hreg64lo);
+                  emit_reg_reg(A_SHR,S_L,NR_CL,hreg64hi);
                 end;
                 end;
               cg.a_label(exprasmlist,l3);
               cg.a_label(exprasmlist,l3);
 
 
               cg.ungetcpuregister(exprasmlist,NR_ECX);
               cg.ungetcpuregister(exprasmlist,NR_ECX);
-              location.registerlow:=hregisterlow;
-              location.registerhigh:=hregisterhigh;
+              location.register64.reglo:=hreg64lo;
+              location.register64.reghi:=hreg64hi;
             end;
             end;
         end
         end
       else
       else
@@ -325,7 +325,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.72  2004-09-25 14:23:54  peter
+  Revision 1.73  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.72  2004/09/25 14:23:54  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 8 - 4
compiler/i386/n386mem.pas

@@ -63,9 +63,9 @@ implementation
 
 
       begin
       begin
         inherited pass_2;
         inherited pass_2;
-        { for use of other segments }
-        if left.location.reference.segment<>NR_NO then
-          location.segment:=left.location.reference.segment;
+        { for use of other segments, not used }
+        {if left.location.reference.segment<>NR_NO then
+          location.segment:=left.location.reference.segment;}
       end;
       end;
 
 
 
 
@@ -141,7 +141,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.64  2004-10-15 09:16:22  mazen
+  Revision 1.65  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.64  2004/10/15 09:16:22  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
   - remove $IFDEF FPCPROCVAR and related code
 
 

+ 6 - 2
compiler/i386/n386obj.pas

@@ -36,7 +36,7 @@ uses
   symconst,symdef,
   symconst,symdef,
   fmodule,
   fmodule,
   nobj,
   nobj,
-  cpuinfo,cpubase,
+  cpubase,
   cga,cgutils,cgobj;
   cga,cgutils,cgobj;
 
 
    type
    type
@@ -238,7 +238,11 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.35  2004-10-24 20:01:08  peter
+  Revision 1.36  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.35  2004/10/24 20:01:08  peter
     * remove saveregister calling convention
     * remove saveregister calling convention
 
 
   Revision 1.34  2004/06/20 08:55:31  florian
   Revision 1.34  2004/06/20 08:55:31  florian

+ 6 - 2
compiler/i386/ra386int.pas

@@ -1768,7 +1768,7 @@ Unit Ra386int;
                   AS_BYTE  : size:=1;
                   AS_BYTE  : size:=1;
                   AS_QWORD : size:=8;
                   AS_QWORD : size:=8;
                   AS_DQWORD : size:=16;
                   AS_DQWORD : size:=16;
-                  AS_TBYTE : size:=extended_size;
+                  AS_TBYTE : size:=10;
                 end;
                 end;
                 Consume(actasmtoken);
                 Consume(actasmtoken);
                 case actasmtoken of
                 case actasmtoken of
@@ -2014,7 +2014,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.77  2004-09-13 20:25:52  peter
+  Revision 1.78  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.77  2004/09/13 20:25:52  peter
     * support byte() typecast
     * support byte() typecast
     * support array index
     * support array index
 
 

+ 11 - 7
compiler/m68k/cpubase.pas

@@ -229,9 +229,9 @@ unit cpubase;
             { segment in reference at the same place as in loc_register }
             { segment in reference at the same place as in loc_register }
             LOC_REGISTER,LOC_CREGISTER : (
             LOC_REGISTER,LOC_CREGISTER : (
               case longint of
               case longint of
-                1 : (register,registerhigh : tregister);
-                { overlay a registerlow }
-                2 : (registerlow : tregister);
+                1 : (register,register64.reghi : tregister);
+                { overlay a register64.reglo }
+                2 : (register64.reglo : tregister);
                 { overlay a 64 Bit register type }
                 { overlay a 64 Bit register type }
                 3 : (reg64 : tregister64);
                 3 : (reg64 : tregister64);
                 4 : (register64 : tregister64);
                 4 : (register64 : tregister64);
@@ -257,9 +257,9 @@ unit cpubase;
             { segment in reference at the same place as in loc_register }
             { segment in reference at the same place as in loc_register }
             LOC_REGISTER,LOC_CREGISTER : (
             LOC_REGISTER,LOC_CREGISTER : (
               case longint of
               case longint of
-                1 : (register,registerhigh,segment : tregister);
-                { overlay a registerlow }
-                2 : (registerlow : tregister);
+                1 : (register,register64.reghi,segment : tregister);
+                { overlay a register64.reglo }
+                2 : (register64.reglo : tregister);
                 { overlay a 64 Bit register type }
                 { overlay a 64 Bit register type }
                 3 : (reg64 : tregister64);
                 3 : (reg64 : tregister64);
                 4 : (register64 : tregister64);
                 4 : (register64 : tregister64);
@@ -515,7 +515,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.31  2004-06-20 08:55:31  florian
+  Revision 1.32  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.31  2004/06/20 08:55:31  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.30  2004/06/20 08:47:33  florian
   Revision 1.30  2004/06/20 08:47:33  florian

+ 6 - 2
compiler/m68k/n68kmat.pas

@@ -116,7 +116,7 @@ implementation
               location_copy(location,left.location);
               location_copy(location,left.location);
               location_force_reg(exprasmlist,location,OS_64,false);
               location_force_reg(exprasmlist,location,OS_64,false);
               cg64.a_op64_loc_reg(exprasmlist,OP_NOT,location,
               cg64.a_op64_loc_reg(exprasmlist,OP_NOT,location,
-                joinreg64(location.registerlow,location.registerhigh));
+                joinreg64(location.register64.reglo,location.register64.reghi));
            end
            end
          else
          else
           begin
           begin
@@ -246,7 +246,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.10  2004-09-25 14:23:54  peter
+  Revision 1.11  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.10  2004/09/25 14:23:54  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 15 - 11
compiler/m68k/ncpuadd.pas

@@ -344,19 +344,19 @@ implementation
                     begin
                     begin
                       if left.location.loc = LOC_REGISTER then
                       if left.location.loc = LOC_REGISTER then
                         begin
                         begin
-                          tempreg64.reglo := left.location.registerlow;
-                          tempreg64.reghi := left.location.registerhigh;
+                          tempreg64.reglo := left.location.register64.reglo;
+                          tempreg64.reghi := left.location.register64.reghi;
                         end
                         end
                       else
                       else
                         begin
                         begin
                           if (aword(right.location.valueqword) <> 0) then
                           if (aword(right.location.valueqword) <> 0) then
                             tempreg64.reglo := cg.getintregister(exprasmlist)
                             tempreg64.reglo := cg.getintregister(exprasmlist)
                           else
                           else
-                            tempreg64.reglo := left.location.registerlow;
+                            tempreg64.reglo := left.location.register64.reglo;
                           if ((right.location.valueqword shr 32) <> 0) then
                           if ((right.location.valueqword shr 32) <> 0) then
                             tempreg64.reghi := cg.getintregister(exprasmlist)
                             tempreg64.reghi := cg.getintregister(exprasmlist)
                           else
                           else
-                            tempreg64.reghi := left.location.registerhigh;
+                            tempreg64.reghi := left.location.register64.reghi;
                         end;
                         end;
 
 
                       if (aword(right.location.valueqword) <> 0) then
                       if (aword(right.location.valueqword) <> 0) then
@@ -366,22 +366,22 @@ implementation
                            (longint(right.location.valueqword) < 0) then
                            (longint(right.location.valueqword) < 0) then
                           cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,
                           cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,
                             aword(right.location.valueqword),
                             aword(right.location.valueqword),
-                            left.location.registerlow,tempreg64.reglo)
+                            left.location.register64.reglo,tempreg64.reglo)
                         else
                         else
                           cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT,
                           cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT,
                             aword(right.location.valueqword),
                             aword(right.location.valueqword),
-                            left.location.registerlow,tempreg64.reglo);
+                            left.location.register64.reglo,tempreg64.reglo);
 
 
                       if ((right.location.valueqword shr 32) <> 0) then
                       if ((right.location.valueqword shr 32) <> 0) then
                         if (longint(right.location.valueqword shr 32) >= -32767) and
                         if (longint(right.location.valueqword shr 32) >= -32767) and
                            (longint(right.location.valueqword shr 32) < 0) then
                            (longint(right.location.valueqword shr 32) < 0) then
                           cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,
                           cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,
                             aword(right.location.valueqword shr 32),
                             aword(right.location.valueqword shr 32),
-                            left.location.registerhigh,tempreg64.reghi)
+                            left.location.register64.reghi,tempreg64.reghi)
                         else
                         else
                           cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT,
                           cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT,
                             aword(right.location.valueqword shr 32),
                             aword(right.location.valueqword shr 32),
-                            left.location.registerhigh,tempreg64.reghi);
+                            left.location.register64.reghi,tempreg64.reghi);
                     end
                     end
                   else
                   else
                     begin
                     begin
@@ -396,9 +396,9 @@ implementation
                   exprasmlist.concat(taicpu.op_reg_reg_reg(A_OR_,R_0,
                   exprasmlist.concat(taicpu.op_reg_reg_reg(A_OR_,R_0,
                     tempreg64.reglo,tempreg64.reghi));
                     tempreg64.reglo,tempreg64.reghi));
                   cg.a_reg_dealloc(exprasmlist,R_0);
                   cg.a_reg_dealloc(exprasmlist,R_0);
-                  if (tempreg64.reglo <> left.location.registerlow) then
+                  if (tempreg64.reglo <> left.location.register64.reglo) then
                     cg.ungetregister(exprasmlist,tempreg64.reglo);
                     cg.ungetregister(exprasmlist,tempreg64.reglo);
-                  if (tempreg64.reghi <> left.location.registerhigh) then
+                  if (tempreg64.reghi <> left.location.register64.reghi) then
                     cg.ungetregister(exprasmlist,tempreg64.reghi);
                     cg.ungetregister(exprasmlist,tempreg64.reghi);
 
 
                   location_reset(location,LOC_FLAGS,OS_NO);
                   location_reset(location,LOC_FLAGS,OS_NO);
@@ -426,7 +426,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.5  2004-06-20 08:55:31  florian
+  Revision 1.6  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.5  2004/06/20 08:55:31  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.4  2004/04/25 21:26:16  florian
   Revision 1.4  2004/04/25 21:26:16  florian

+ 9 - 4
compiler/nbas.pas

@@ -27,9 +27,10 @@ unit nbas;
 interface
 interface
 
 
     uses
     uses
-       cpuinfo,cpubase,cgbase,
+       globtype,
+       cpuinfo,cpubase,cgbase,cgutils,
        aasmbase,aasmtai,aasmcpu,
        aasmbase,aasmtai,aasmcpu,
-       node,tgobj,
+       node,
        symtype;
        symtype;
 
 
     type
     type
@@ -201,7 +202,7 @@ implementation
 
 
     uses
     uses
       cutils,
       cutils,
-      verbose,globals,globtype,systems,
+      verbose,globals,systems,
       symconst,symdef,defutil,defcmp,
       symconst,symdef,defutil,defcmp,
       pass_1,
       pass_1,
       nld,ncal,nflw,
       nld,ncal,nflw,
@@ -1027,7 +1028,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.88  2004-10-12 14:36:38  peter
+  Revision 1.89  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.88  2004/10/12 14:36:38  peter
     * gen high tree makes copy in temp when there is a calln
     * gen high tree makes copy in temp when there is a calln
 
 
   Revision 1.87  2004/09/26 17:45:30  peter
   Revision 1.87  2004/09/26 17:45:30  peter

+ 6 - 2
compiler/ncal.pas

@@ -185,7 +185,7 @@ implementation
       systems,
       systems,
       verbose,globals,
       verbose,globals,
       symconst,defutil,defcmp,
       symconst,defutil,defcmp,
-      htypechk,pass_1,
+      htypechk,pass_1,tgobj,
       ncnv,nld,ninl,nadd,ncon,nmem,
       ncnv,nld,ninl,nadd,ncon,nmem,
       procinfo,
       procinfo,
       cgbase
       cgbase
@@ -2416,7 +2416,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.253  2004-10-25 15:38:41  peter
+  Revision 1.254  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.253  2004/10/25 15:38:41  peter
     * heap and heapsize removed
     * heap and heapsize removed
     * checkpointer fixes
     * checkpointer fixes
 
 

+ 16 - 12
compiler/ncgadd.pas

@@ -73,8 +73,8 @@ interface
       cutils,verbose,globals,
       cutils,verbose,globals,
       symconst,symdef,paramgr,
       symconst,symdef,paramgr,
       aasmbase,aasmtai,defutil,
       aasmbase,aasmtai,defutil,
-      cgbase,cpuinfo,pass_2,
-      ncon,nset,ncgutil,cgobj
+      cgbase,pass_2,
+      ncon,nset,ncgutil,cgobj,cgutils
       ;
       ;
 
 
 
 
@@ -154,8 +154,8 @@ interface
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
             if location.size in [OS_64,OS_S64] then
             if location.size in [OS_64,OS_S64] then
               begin
               begin
-                location.registerlow := left.location.registerlow;
-                location.registerhigh := left.location.registerhigh;
+                location.register64.reglo := left.location.register64.reglo;
+                location.register64.reghi := left.location.register64.reghi;
               end
               end
             else
             else
 {$endif}
 {$endif}
@@ -169,8 +169,8 @@ interface
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
             if location.size in [OS_64,OS_S64] then
             if location.size in [OS_64,OS_S64] then
               begin
               begin
-                location.registerlow := right.location.registerlow;
-                location.registerhigh := right.location.registerhigh;
+                location.register64.reglo := right.location.register64.reglo;
+                location.register64.reghi := right.location.register64.reghi;
               end
               end
             else
             else
 {$endif}
 {$endif}
@@ -181,8 +181,8 @@ interface
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
             if location.size in [OS_64,OS_S64] then
             if location.size in [OS_64,OS_S64] then
               begin
               begin
-                location.registerlow := cg.getintregister(exprasmlist,OS_INT);
-                location.registerhigh := cg.getintregister(exprasmlist,OS_INT);
+                location.register64.reglo := cg.getintregister(exprasmlist,OS_INT);
+                location.register64.reghi := cg.getintregister(exprasmlist,OS_INT);
               end
               end
             else
             else
 {$endif}
 {$endif}
@@ -500,10 +500,10 @@ interface
 
 
               if left.location.loc <> LOC_CONSTANT then
               if left.location.loc <> LOC_CONSTANT then
                 begin
                 begin
-                  if (location.registerlow = NR_NO) then
+                  if (location.register64.reglo = NR_NO) then
                     begin
                     begin
-                     location.registerlow := cg.getintregister(exprasmlist,OS_INT);
-                     location.registerhigh := cg.getintregister(exprasmlist,OS_INT);
+                     location.register64.reglo := cg.getintregister(exprasmlist,OS_INT);
+                     location.register64.reghi := cg.getintregister(exprasmlist,OS_INT);
                   end;
                   end;
                   if right.location.loc <> LOC_CONSTANT then
                   if right.location.loc <> LOC_CONSTANT then
                     // reg64 - reg64
                     // reg64 - reg64
@@ -778,7 +778,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.34  2004-09-29 18:55:40  florian
+  Revision 1.35  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.34  2004/09/29 18:55:40  florian
     * fixed more sparc overflow stuff
     * fixed more sparc overflow stuff
     * fixed some op64 stuff for sparc
     * fixed some op64 stuff for sparc
 
 

+ 7 - 4
compiler/ncgbas.pas

@@ -27,7 +27,7 @@ unit ncgbas;
 interface
 interface
 
 
     uses
     uses
-       cpubase,
+       cpubase,cgutils,
        node,nbas;
        node,nbas;
 
 
     type
     type
@@ -72,8 +72,7 @@ interface
       aasmbase,aasmtai,aasmcpu,symsym,symconst,
       aasmbase,aasmtai,aasmcpu,symsym,symconst,
       defutil,
       defutil,
       nflw,pass_2,
       nflw,pass_2,
-      cgbase,
-      cgutils,cgobj,
+      cgbase,cgobj,
       procinfo,
       procinfo,
       tgobj
       tgobj
       ;
       ;
@@ -492,7 +491,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.68  2004-09-26 17:45:30  peter
+  Revision 1.69  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.68  2004/09/26 17:45:30  peter
     * simple regvar support, not yet finished
     * simple regvar support, not yet finished
 
 
   Revision 1.67  2004/09/25 14:23:54  peter
   Revision 1.67  2004/09/25 14:23:54  peter

+ 15 - 11
compiler/ncgcal.pas

@@ -29,7 +29,7 @@ interface
     uses
     uses
       cpubase,
       cpubase,
       globtype,
       globtype,
-      parabase,
+      parabase,cgutils,
       symdef,node,ncal;
       symdef,node,ncal;
 
 
     type
     type
@@ -90,7 +90,7 @@ implementation
       cga,cgx86,
       cga,cgx86,
 {$endif x86}
 {$endif x86}
       ncgutil,
       ncgutil,
-      cgutils,cgobj,tgobj,
+      cgobj,tgobj,
       procinfo;
       procinfo;
 
 
 
 
@@ -575,14 +575,14 @@ implementation
                              if retloc.loc<>LOC_REGISTER then
                              if retloc.loc<>LOC_REGISTER then
                                internalerror(200409141);
                                internalerror(200409141);
                              { the function result registers are already allocated }
                              { the function result registers are already allocated }
-                             if getsupreg(retloc.registerlow)<first_int_imreg then
-                               cg.ungetcpuregister(exprasmlist,retloc.registerlow);
-                             location.registerlow:=cg.getintregister(exprasmlist,OS_32);
-                             cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,retloc.registerlow,location.registerlow);
-                             if getsupreg(retloc.registerhigh)<first_int_imreg then
-                               cg.ungetcpuregister(exprasmlist,retloc.registerhigh);
-                             location.registerhigh:=cg.getintregister(exprasmlist,OS_32);
-                             cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,retloc.registerhigh,location.registerhigh);
+                             if getsupreg(retloc.register64.reglo)<first_int_imreg then
+                               cg.ungetcpuregister(exprasmlist,retloc.register64.reglo);
+                             location.register64.reglo:=cg.getintregister(exprasmlist,OS_32);
+                             cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,retloc.register64.reglo,location.register64.reglo);
+                             if getsupreg(retloc.register64.reghi)<first_int_imreg then
+                               cg.ungetcpuregister(exprasmlist,retloc.register64.reghi);
+                             location.register64.reghi:=cg.getintregister(exprasmlist,OS_32);
+                             cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,retloc.register64.reghi,location.register64.reghi);
                            end
                            end
                           else
                           else
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -1247,7 +1247,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.181  2004-10-24 20:01:08  peter
+  Revision 1.182  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.181  2004/10/24 20:01:08  peter
     * remove saveregister calling convention
     * remove saveregister calling convention
 
 
   Revision 1.180  2004/10/24 11:53:45  peter
   Revision 1.180  2004/10/24 11:53:45  peter

+ 7 - 3
compiler/ncgcnv.pas

@@ -60,9 +60,9 @@ interface
       cutils,verbose,globtype,globals,
       cutils,verbose,globtype,globals,
       aasmbase,aasmtai,aasmcpu,symconst,symdef,paramgr,
       aasmbase,aasmtai,aasmcpu,symconst,symdef,paramgr,
       ncon,ncal,
       ncon,ncal,
-      cpubase,cpuinfo,systems,
+      cpubase,systems,
       pass_2,
       pass_2,
-      procinfo,cgbase,
+      cgbase,
       cgutils,cgobj,
       cgutils,cgobj,
       ncgutil,
       ncgutil,
       tgobj
       tgobj
@@ -529,7 +529,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.60  2004-09-25 14:23:54  peter
+  Revision 1.61  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.60  2004/09/25 14:23:54  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 6 - 2
compiler/ncgcon.pas

@@ -67,7 +67,7 @@ implementation
       verbose,globals,
       verbose,globals,
       symconst,symdef,aasmbase,aasmtai,aasmcpu,defutil,
       symconst,symdef,aasmbase,aasmtai,aasmcpu,defutil,
       cpuinfo,cpubase,
       cpuinfo,cpubase,
-      cgbase,cgobj,
+      cgbase,cgobj,cgutils,
       ncgutil
       ncgutil
       ;
       ;
 
 
@@ -751,7 +751,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.46  2004-10-15 09:14:17  mazen
+  Revision 1.47  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.46  2004/10/15 09:14:17  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
   - remove $IFDEF FPCPROCVAR and related code
 
 

+ 7 - 4
compiler/ncginl.pas

@@ -62,8 +62,7 @@ implementation
       cpuinfo,cpubase,paramgr,procinfo,
       cpuinfo,cpubase,paramgr,procinfo,
       nbas,ncon,ncal,ncnv,nld,
       nbas,ncon,ncal,ncnv,nld,
       tgobj,ncgutil,
       tgobj,ncgutil,
-      cgutils,cgobj,
-      rgobj
+      cgutils,cgobj
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
       ,cg64f32
       ,cg64f32
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -428,7 +427,7 @@ implementation
                   location_force_reg(exprasmlist,tcallparanode(tcallparanode(left).right).left.location,cgsize,addvalue<=1);
                   location_force_reg(exprasmlist,tcallparanode(tcallparanode(left).right).left.location,cgsize,addvalue<=1);
                   hregister:=tcallparanode(tcallparanode(left).right).left.location.register;
                   hregister:=tcallparanode(tcallparanode(left).right).left.location.register;
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
-                  hregisterhi:=tcallparanode(tcallparanode(left).right).left.location.registerhigh;
+                  hregisterhi:=tcallparanode(tcallparanode(left).right).left.location.register64.reghi;
 {$endif cpu64bit}
 {$endif cpu64bit}
                   { insert multiply with addvalue if its >1 }
                   { insert multiply with addvalue if its >1 }
                   if addvalue>1 then
                   if addvalue>1 then
@@ -685,7 +684,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.64  2004-09-25 14:23:54  peter
+  Revision 1.65  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.64  2004/09/25 14:23:54  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 23 - 1
compiler/ncgld.pas

@@ -44,6 +44,10 @@ interface
           procedure pass_2;override;
           procedure pass_2;override;
        end;
        end;
 
 
+       tcgrttinode = class(trttinode)
+          procedure pass_2;override;
+       end;
+
 
 
 implementation
 implementation
 
 
@@ -926,14 +930,32 @@ implementation
          end;
          end;
       end;
       end;
 
 
+
+{*****************************************************************************
+                           SecondRTTI
+*****************************************************************************}
+
+    procedure tcgrttinode.pass_2;
+      begin
+        location_reset(location,LOC_CREFERENCE,OS_NO);
+        location.reference.symbol:=rttidef.get_rtti_label(rttitype);
+      end;
+
+
+
 begin
 begin
    cloadnode:=tcgloadnode;
    cloadnode:=tcgloadnode;
    cassignmentnode:=tcgassignmentnode;
    cassignmentnode:=tcgassignmentnode;
    carrayconstructornode:=tcgarrayconstructornode;
    carrayconstructornode:=tcgarrayconstructornode;
+   crttinode:=tcgrttinode;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.128  2004-10-24 11:44:28  peter
+  Revision 1.129  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.128  2004/10/24 11:44:28  peter
     * small regvar fixes
     * small regvar fixes
     * loadref parameter removed from concatcopy,incrrefcount,etc
     * loadref parameter removed from concatcopy,incrrefcount,etc
 
 

+ 9 - 5
compiler/ncgmat.pas

@@ -132,7 +132,7 @@ implementation
       parabase,
       parabase,
       pass_2,
       pass_2,
       ncon,
       ncon,
-      tgobj,ncgutil,cgobj,paramgr
+      tgobj,ncgutil,cgobj,cgutils,paramgr
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
       ,cg64f32
       ,cg64f32
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -180,7 +180,7 @@ implementation
         location_copy(location,left.location);
         location_copy(location,left.location);
         location_force_reg(exprasmlist,location,OS_64,false);
         location_force_reg(exprasmlist,location,OS_64,false);
         cg64.a_op64_loc_reg(exprasmlist,OP_NEG,
         cg64.a_op64_loc_reg(exprasmlist,OP_NEG,
-           location,joinreg64(location.registerlow,location.registerhigh));
+           location,joinreg64(location.register64.reglo,location.register64.reghi));
       end;
       end;
 {$endif cpu64bit}
 {$endif cpu64bit}
 
 
@@ -286,8 +286,8 @@ implementation
              location_copy(location,left.location);
              location_copy(location,left.location);
              location_force_reg(exprasmlist,right.location,OS_64,false);
              location_force_reg(exprasmlist,right.location,OS_64,false);
              emit64_div_reg_reg(is_signed(left.resulttype.def),
              emit64_div_reg_reg(is_signed(left.resulttype.def),
-               joinreg64(right.location.registerlow,right.location.registerhigh),
-               joinreg64(location.registerlow,location.registerhigh));
+               joinreg64(right.location.register64.reglo,right.location.register64.reghi),
+               joinreg64(location.register64.reglo,location.register64.reghi));
            end
            end
          else
          else
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -473,7 +473,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.29  2004-09-25 14:23:54  peter
+  Revision 1.30  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.29  2004/09/25 14:23:54  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 6 - 2
compiler/ncgopt.pas

@@ -44,7 +44,7 @@ uses
   aasmbase,aasmtai,
   aasmbase,aasmtai,
   ncnv, ncon, pass_2,
   ncnv, ncon, pass_2,
   cgbase, cpubase,
   cgbase, cpubase,
-  tgobj, cgobj, ncgutil;
+  tgobj, cgobj, cgutils,ncgutil;
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -196,7 +196,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2004-10-24 11:44:28  peter
+  Revision 1.17  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.16  2004/10/24 11:44:28  peter
     * small regvar fixes
     * small regvar fixes
     * loadref parameter removed from concatcopy,incrrefcount,etc
     * loadref parameter removed from concatcopy,incrrefcount,etc
 
 

+ 8 - 4
compiler/ncgset.pas

@@ -89,7 +89,7 @@ implementation
       verbose,
       verbose,
       symconst,symdef,defutil,
       symconst,symdef,defutil,
       paramgr,
       paramgr,
-      pass_2,
+      pass_2,tgobj,
       nbas,ncon,nflw,
       nbas,ncon,nflw,
       ncgutil,regvars,cpuinfo,
       ncgutil,regvars,cpuinfo,
       cgutils;
       cgutils;
@@ -787,8 +787,8 @@ implementation
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
          if opsize in [OS_S64,OS_64] then
          if opsize in [OS_S64,OS_64] then
            begin
            begin
-             hregister:=left.location.registerlow;
-             hregister2:=left.location.registerhigh;
+             hregister:=left.location.register64.reglo;
+             hregister2:=left.location.register64.reghi;
            end
            end
          else
          else
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -944,7 +944,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.69  2004-10-30 22:01:11  florian
+  Revision 1.70  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.69  2004/10/30 22:01:11  florian
     * jmp table code generation for case statement on sparc
     * jmp table code generation for case statement on sparc
 
 
   Revision 1.68  2004/09/25 14:23:54  peter
   Revision 1.68  2004/09/25 14:23:54  peter

+ 35 - 31
compiler/ncgutil.pas

@@ -29,7 +29,7 @@ interface
     uses
     uses
       node,cpuinfo,
       node,cpuinfo,
       globtype,
       globtype,
-      cpubase,cgbase,parabase,
+      cpubase,cgbase,parabase,cgutils,
       aasmbase,aasmtai,aasmcpu,
       aasmbase,aasmtai,aasmcpu,
       symconst,symbase,symdef,symsym,symtype,symtable
       symconst,symbase,symdef,symsym,symtype,symtable
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
@@ -127,7 +127,7 @@ implementation
 {$endif GDB}
 {$endif GDB}
     pass_1,pass_2,
     pass_1,pass_2,
     ncon,nld,nutils,
     ncon,nld,nutils,
-    tgobj,cgutils,cgobj;
+    tgobj,cgobj;
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -250,8 +250,8 @@ implementation
             begin
             begin
               { can't be a regvar, since it would be LOC_CREGISTER then }
               { can't be a regvar, since it would be LOC_CREGISTER then }
               exclude(regs,getsupreg(t.register));
               exclude(regs,getsupreg(t.register));
-              if t.registerhigh<>NR_NO then
-                exclude(regs,getsupreg(t.registerhigh));
+              if t.register64.reghi<>NR_NO then
+                exclude(regs,getsupreg(t.register64.reghi));
             end;
             end;
           LOC_CREFERENCE,LOC_REFERENCE:
           LOC_CREFERENCE,LOC_REFERENCE:
             begin
             begin
@@ -367,8 +367,8 @@ implementation
               { load a smaller size to OS_64 }
               { load a smaller size to OS_64 }
               if l.loc=LOC_REGISTER then
               if l.loc=LOC_REGISTER then
                begin
                begin
-                 hregister:=cg.makeregsize(list,l.registerlow,OS_32);
-                 cg.a_load_reg_reg(list,l.size,OS_32,l.registerlow,hregister);
+                 hregister:=cg.makeregsize(list,l.register64.reglo,OS_32);
+                 cg.a_load_reg_reg(list,l.size,OS_32,l.register64.reglo,hregister);
                end
                end
               else
               else
                hregister:=cg.getintregister(list,OS_INT);
                hregister:=cg.getintregister(list,OS_INT);
@@ -409,8 +409,8 @@ implementation
               else
               else
                cg.a_load_const_reg(list,OS_32,0,hregisterhi);
                cg.a_load_const_reg(list,OS_32,0,hregisterhi);
               location_reset(l,LOC_REGISTER,dst_size);
               location_reset(l,LOC_REGISTER,dst_size);
-              l.registerlow:=hregister;
-              l.registerhigh:=hregisterhi;
+              l.register64.reglo:=hregister;
+              l.register64.reghi:=hregisterhi;
             end
             end
            else
            else
             begin
             begin
@@ -418,8 +418,8 @@ implementation
               if (l.loc=LOC_REGISTER) or
               if (l.loc=LOC_REGISTER) or
                  ((l.loc=LOC_CREGISTER) and maybeconst) then
                  ((l.loc=LOC_CREGISTER) and maybeconst) then
                begin
                begin
-                 hregister:=l.registerlow;
-                 hregisterhi:=l.registerhigh;
+                 hregister:=l.register64.reglo;
+                 hregisterhi:=l.register64.reghi;
                end
                end
               else
               else
                begin
                begin
@@ -431,8 +431,8 @@ implementation
               { load value in new register }
               { load value in new register }
               cg64.a_load64_loc_reg(list,l,hreg64);
               cg64.a_load64_loc_reg(list,l,hreg64);
               location_reset(l,LOC_REGISTER,dst_size);
               location_reset(l,LOC_REGISTER,dst_size);
-              l.registerlow:=hregister;
-              l.registerhigh:=hregisterhi;
+              l.register64.reglo:=hregister;
+              l.register64.reghi:=hregisterhi;
             end;
             end;
          end
          end
         else
         else
@@ -1089,12 +1089,12 @@ implementation
                         internalerror(200409141);
                         internalerror(200409141);
                       { Load low and high register separate to generate better register
                       { Load low and high register separate to generate better register
                         allocation info }
                         allocation info }
-                      if getsupreg(resloc.registerlow)<first_int_imreg then
+                      if getsupreg(resloc.register64.reglo)<first_int_imreg then
                         begin
                         begin
-                          cg.getcpuregister(list,resloc.registerlow);
-                          cg.ungetcpuregister(list,resloc.registerlow);
+                          cg.getcpuregister(list,resloc.register64.reglo);
+                          cg.ungetcpuregister(list,resloc.register64.reglo);
                           { for the optimizer }
                           { for the optimizer }
-                          cg.a_reg_alloc(list,resloc.registerlow);
+                          cg.a_reg_alloc(list,resloc.register64.reglo);
                         end;
                         end;
                       case restmploc.loc of
                       case restmploc.loc of
                         LOC_REFERENCE :
                         LOC_REFERENCE :
@@ -1102,19 +1102,19 @@ implementation
                             href:=restmploc.reference;
                             href:=restmploc.reference;
                             if target_info.endian=ENDIAN_BIG then
                             if target_info.endian=ENDIAN_BIG then
                               inc(href.offset,4);
                               inc(href.offset,4);
-                            cg.a_load_ref_reg(list,OS_32,OS_32,href,resloc.registerlow);
+                            cg.a_load_ref_reg(list,OS_32,OS_32,href,resloc.register64.reglo);
                           end;
                           end;
                         LOC_CREGISTER :
                         LOC_CREGISTER :
-                          cg.a_load_reg_reg(list,OS_32,OS_32,restmploc.registerlow,resloc.registerlow);
+                          cg.a_load_reg_reg(list,OS_32,OS_32,restmploc.register64.reglo,resloc.register64.reglo);
                         else
                         else
                           internalerror(200409203);
                           internalerror(200409203);
                       end;
                       end;
-                      if getsupreg(resloc.registerhigh)<first_int_imreg then
+                      if getsupreg(resloc.register64.reghi)<first_int_imreg then
                         begin
                         begin
-                          cg.getcpuregister(list,resloc.registerhigh);
-                          cg.ungetcpuregister(list,resloc.registerhigh);
+                          cg.getcpuregister(list,resloc.register64.reghi);
+                          cg.ungetcpuregister(list,resloc.register64.reghi);
                           { for the optimizer }
                           { for the optimizer }
-                          cg.a_reg_alloc(list,resloc.registerhigh);
+                          cg.a_reg_alloc(list,resloc.register64.reghi);
                         end;
                         end;
                       case restmploc.loc of
                       case restmploc.loc of
                         LOC_REFERENCE :
                         LOC_REFERENCE :
@@ -1122,10 +1122,10 @@ implementation
                             href:=restmploc.reference;
                             href:=restmploc.reference;
                             if target_info.endian=ENDIAN_LITTLE then
                             if target_info.endian=ENDIAN_LITTLE then
                               inc(href.offset,4);
                               inc(href.offset,4);
-                            cg.a_load_ref_reg(list,OS_32,OS_32,href,resloc.registerhigh);
+                            cg.a_load_ref_reg(list,OS_32,OS_32,href,resloc.register64.reghi);
                           end;
                           end;
                         LOC_CREGISTER :
                         LOC_CREGISTER :
-                          cg.a_load_reg_reg(list,OS_32,OS_32,restmploc.registerhigh,resloc.registerhigh);
+                          cg.a_load_reg_reg(list,OS_32,OS_32,restmploc.register64.reghi,resloc.register64.reghi);
                         else
                         else
                           internalerror(200409204);
                           internalerror(200409204);
                       end;
                       end;
@@ -1323,17 +1323,17 @@ implementation
                       { First 32bits }
                       { First 32bits }
                       unget_para(paraloc^);
                       unget_para(paraloc^);
                       if (target_info.endian=ENDIAN_BIG) then
                       if (target_info.endian=ENDIAN_BIG) then
-                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.registerhigh)
+                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.register64.reghi)
                       else
                       else
-                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.registerlow);
+                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.register64.reglo);
                       { Second 32bits }
                       { Second 32bits }
                       if not assigned(paraloc^.next) then
                       if not assigned(paraloc^.next) then
                         internalerror(200410104);
                         internalerror(200410104);
                       unget_para(paraloc^);
                       unget_para(paraloc^);
                       if (target_info.endian=ENDIAN_BIG) then
                       if (target_info.endian=ENDIAN_BIG) then
-                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.registerlow)
+                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.register64.reglo)
                       else
                       else
-                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.registerhigh);
+                        gen_load_reg(paraloc^,tvarsym(hp.parasym).localloc.register64.reghi);
                     end
                     end
                   else
                   else
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -1874,8 +1874,8 @@ implementation
 {$ifndef cpu64bit}
 {$ifndef cpu64bit}
                                   if cgsize in [OS_64,OS_S64] then
                                   if cgsize in [OS_64,OS_S64] then
                                     begin
                                     begin
-                                      localloc.registerlow:=cg.getintregister(list,OS_32);
-                                      localloc.registerhigh:=cg.getintregister(list,OS_32);
+                                      localloc.register64.reglo:=cg.getintregister(list,OS_32);
+                                      localloc.register64.reghi:=cg.getintregister(list,OS_32);
                                     end
                                     end
                                   else
                                   else
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -2207,7 +2207,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.233  2004-10-28 18:29:44  olle
+  Revision 1.234  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.233  2004/10/28 18:29:44  olle
     * reverted, for macos only, last change.
     * reverted, for macos only, last change.
 
 
   Revision 1.232  2004/10/26 15:03:31  peter
   Revision 1.232  2004/10/26 15:03:31  peter

+ 7 - 3
compiler/new/powerpc/cpubase.pas

@@ -338,8 +338,8 @@ type
         LOC_FPU, LOC_CFPUREGISTER, LOC_MMREGISTER, LOC_CMMREGISTER,
         LOC_FPU, LOC_CFPUREGISTER, LOC_MMREGISTER, LOC_CMMREGISTER,
           LOC_REGISTER,LOC_CREGISTER : (
           LOC_REGISTER,LOC_CREGISTER : (
             case longint of
             case longint of
-              1 : (registerlow,registerhigh : tregister);
-              { overlay a registerlow }
+              1 : (register64.reglo,register64.reghi : tregister);
+              { overlay a register64.reglo }
               2 : (register : tregister);
               2 : (register : tregister);
             );
             );
 
 
@@ -599,7 +599,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.4  2001-09-09 17:10:26  jonas
+  Revision 1.5  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.4  2001/09/09 17:10:26  jonas
     * some more things implemented
     * some more things implemented
 
 
   Revision 1.3  2001/08/26 13:35:06  florian
   Revision 1.3  2001/08/26 13:35:06  florian

+ 6 - 2
compiler/ninl.pas

@@ -73,7 +73,7 @@ implementation
       verbose,globals,systems,
       verbose,globals,systems,
       globtype, cutils,
       globtype, cutils,
       symbase,symconst,symdef,symsym,symtable,paramgr,defutil,defcmp,
       symbase,symconst,symdef,symsym,symtable,paramgr,defutil,defcmp,
-      pass_1,
+      pass_1,tgobj,
       ncal,ncon,ncnv,nadd,nld,nbas,nflw,nmem,nmat,nutils,
       ncal,ncon,ncnv,nadd,nld,nbas,nflw,nmem,nmat,nutils,
       cgbase,procinfo
       cgbase,procinfo
       ;
       ;
@@ -2442,7 +2442,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.145  2004-09-16 16:32:27  peter
+  Revision 1.146  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.145  2004/09/16 16:32:27  peter
     * another fix for reading of subranges
     * another fix for reading of subranges
 
 
   Revision 1.144  2004/09/13 20:32:06  peter
   Revision 1.144  2004/09/13 20:32:06  peter

+ 5 - 9
compiler/nld.pas

@@ -119,7 +119,6 @@ interface
           procedure derefimpl;override;
           procedure derefimpl;override;
           function  getcopy : tnode;override;
           function  getcopy : tnode;override;
           function pass_1 : tnode;override;
           function pass_1 : tnode;override;
-          procedure pass_2;override;
           function det_resulttype:tnode;override;
           function det_resulttype:tnode;override;
           function docompare(p: tnode): boolean; override;
           function docompare(p: tnode): boolean; override;
        end;
        end;
@@ -1155,13 +1154,6 @@ implementation
       end;
       end;
 
 
 
 
-    procedure trttinode.pass_2;
-      begin
-        location_reset(location,LOC_CREFERENCE,OS_NO);
-        location.reference.symbol:=rttidef.get_rtti_label(rttitype);
-      end;
-
-
 begin
 begin
    cloadnode:=tloadnode;
    cloadnode:=tloadnode;
    cassignmentnode:=tassignmentnode;
    cassignmentnode:=tassignmentnode;
@@ -1172,7 +1164,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.135  2004-10-24 11:44:28  peter
+  Revision 1.136  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.135  2004/10/24 11:44:28  peter
     * small regvar fixes
     * small regvar fixes
     * loadref parameter removed from concatcopy,incrrefcount,etc
     * loadref parameter removed from concatcopy,incrrefcount,etc
 
 

+ 6 - 2
compiler/node.pas

@@ -29,7 +29,7 @@ interface
     uses
     uses
        cclasses,
        cclasses,
        globtype,globals,
        globtype,globals,
-       cpubase,cgbase,
+       cpubase,cgbase,cgutils,
        aasmbase,
        aasmbase,
        symtype;
        symtype;
 
 
@@ -1132,7 +1132,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.87  2004-06-20 08:55:29  florian
+  Revision 1.88  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.87  2004/06/20 08:55:29  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.86  2004/06/16 20:07:09  florian
   Revision 1.86  2004/06/16 20:07:09  florian

+ 16 - 11
compiler/parabase.pas

@@ -27,20 +27,21 @@ unit parabase;
 
 
     uses
     uses
        cclasses,globtype,
        cclasses,globtype,
-       cpubase,cgbase;
+       cpubase,cgbase,cgutils;
 
 
     type
     type
-       { tparamlocation describes where a parameter for a procedure is stored.
-         References are given from the caller's point of view. The usual
-         TLocation isn't used, because contains a lot of unnessary fields.
-       }
+       TCGParaReference = record
+          index       : tregister;
+          offset      : aint;
+       end;
+
        PCGParaLocation = ^TCGParaLocation;
        PCGParaLocation = ^TCGParaLocation;
        TCGParaLocation = record
        TCGParaLocation = record
          Next : PCGParaLocation;
          Next : PCGParaLocation;
          Size : TCGSize; { size of this location }
          Size : TCGSize; { size of this location }
          Loc  : TCGLoc;
          Loc  : TCGLoc;
          case TCGLoc of
          case TCGLoc of
-           LOC_REFERENCE : (reference : tparareference);
+           LOC_REFERENCE : (reference : TCGParaReference);
            LOC_FPUREGISTER,
            LOC_FPUREGISTER,
            LOC_CFPUREGISTER,
            LOC_CFPUREGISTER,
            LOC_MMREGISTER,
            LOC_MMREGISTER,
@@ -179,13 +180,13 @@ implementation
                     internalerror(200408207);
                     internalerror(200408207);
                   if (target_info.endian = ENDIAN_BIG) then
                   if (target_info.endian = ENDIAN_BIG) then
                     begin
                     begin
-                      newloc.registerhigh:=location^.register;
-                      newloc.registerlow:=location^.next^.register;
+                      newloc.register64.reghi:=location^.register;
+                      newloc.register64.reglo:=location^.next^.register;
                     end
                     end
                   else
                   else
                     begin
                     begin
-                      newloc.registerlow:=location^.register;
-                      newloc.registerhigh:=location^.next^.register;
+                      newloc.register64.reglo:=location^.register;
+                      newloc.register64.reghi:=location^.next^.register;
                     end;
                     end;
                 end
                 end
               else
               else
@@ -207,7 +208,11 @@ end.
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.3  2004-10-10 20:22:53  peter
+   Revision 1.4  2004-10-31 21:45:03  peter
+     * generic tlocation
+     * move tlocation to cgutils
+
+   Revision 1.3  2004/10/10 20:22:53  peter
      * symtable allocation rewritten
      * symtable allocation rewritten
      * loading of parameters to local temps/regs cleanup
      * loading of parameters to local temps/regs cleanup
      * regvar support for parameters
      * regvar support for parameters

+ 6 - 2
compiler/paramgr.pas

@@ -126,7 +126,7 @@ implementation
 
 
     uses
     uses
        systems,
        systems,
-       cgobj,tgobj,
+       cgobj,tgobj,cgutils,
        defutil,verbose;
        defutil,verbose;
 
 
     { true if uses a parameter as return value }
     { true if uses a parameter as return value }
@@ -447,7 +447,11 @@ end.
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.79  2004-09-25 14:23:54  peter
+   Revision 1.80  2004-10-31 21:45:03  peter
+     * generic tlocation
+     * move tlocation to cgutils
+
+   Revision 1.79  2004/09/25 14:23:54  peter
      * ungetregister is now only used for cpuregisters, renamed to
      * ungetregister is now only used for cpuregisters, renamed to
        ungetcpuregister
        ungetcpuregister
      * renamed (get|unget)explicitregister(s) to ..cpuregister
      * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 6 - 2
compiler/powerpc/aasmcpu.pas

@@ -30,7 +30,7 @@ uses
   cclasses,
   cclasses,
   globtype,globals,verbose,
   globtype,globals,verbose,
   aasmbase,aasmtai,
   aasmbase,aasmtai,
-  cpubase,cpuinfo,cgbase;
+  cpubase,cpuinfo,cgbase,cgutils;
 
 
     const
     const
       { "mov reg,reg" source operand number }
       { "mov reg,reg" source operand number }
@@ -410,7 +410,11 @@ uses cutils,rgobj;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.27  2004-06-20 08:55:31  florian
+  Revision 1.28  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.27  2004/06/20 08:55:31  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.26  2004/06/17 16:55:46  peter
   Revision 1.26  2004/06/17 16:55:46  peter

+ 6 - 2
compiler/powerpc/agppcgas.pas

@@ -46,7 +46,7 @@ unit agppcgas;
 
 
     uses
     uses
        cutils,globals,verbose,
        cutils,globals,verbose,
-       cgbase,systems,
+       cgbase,cgutils,systems,
        assemble,
        assemble,
        itcpugas,
        itcpugas,
        aasmcpu;
        aasmcpu;
@@ -365,7 +365,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.44  2004-06-20 08:55:31  florian
+  Revision 1.45  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.44  2004/06/20 08:55:31  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.43  2004/06/17 16:55:46  peter
   Revision 1.43  2004/06/17 16:55:46  peter

+ 8 - 4
compiler/powerpc/agppcmpw.pas

@@ -59,7 +59,7 @@ interface
     uses
     uses
       cutils,globtype,systems,cclasses,
       cutils,globtype,systems,cclasses,
       verbose,finput,fmodule,script,cpuinfo,
       verbose,finput,fmodule,script,cpuinfo,
-      cgbase,
+      cgbase,cgutils,
       itcpugas
       itcpugas
       ;
       ;
 
 
@@ -1022,7 +1022,7 @@ var
                    end
                    end
                  else
                  else
                    begin
                    begin
-                     s:= tostr(tai_const(hp).value); 
+                     s:= tostr(tai_const(hp).value);
                      AsmWrite(s);
                      AsmWrite(s);
                      inc(l,length(s));
                      inc(l,length(s));
                    end;
                    end;
@@ -1036,7 +1036,7 @@ var
                until false;
                until false;
                AsmLn;
                AsmLn;
              end;
              end;
- 
+
             ait_real_64bit :
             ait_real_64bit :
               begin
               begin
                 AsmWriteLn(target_asm.comment+'value: '+double2str(tai_real_64bit(hp).value));
                 AsmWriteLn(target_asm.comment+'value: '+double2str(tai_real_64bit(hp).value));
@@ -1462,7 +1462,11 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.41  2004-10-31 15:32:13  olle
+  Revision 1.42  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.41  2004/10/31 15:32:13  olle
     + Change of the way global variables, with multiple entrypoints,
     + Change of the way global variables, with multiple entrypoints,
       are referenced, fixes a lot of failed tests
       are referenced, fixes a lot of failed tests
 
 

+ 10 - 7
compiler/powerpc/cgcpu.pas

@@ -30,7 +30,7 @@ unit cgcpu;
        globtype,symtype,
        globtype,symtype,
        cgbase,cgobj,
        cgbase,cgobj,
        aasmbase,aasmcpu,aasmtai,
        aasmbase,aasmcpu,aasmtai,
-       cpubase,cpuinfo,node,cg64f32,rgcpu,
+       cpubase,cpuinfo,cgutils,cg64f32,rgcpu,
        parabase;
        parabase;
 
 
     type
     type
@@ -96,7 +96,7 @@ unit cgcpu;
         function get_rlwi_const(a: aint; var l1, l2: longint): boolean;
         function get_rlwi_const(a: aint; var l1, l2: longint): boolean;
 
 
         procedure a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel);
         procedure a_jmp_cond(list : taasmoutput;cond : TOpCmp;l: tasmlabel);
-        
+
       private
       private
 
 
         (* NOT IN USE: *)
         (* NOT IN USE: *)
@@ -156,8 +156,7 @@ const
     uses
     uses
        globals,verbose,systems,cutils,
        globals,verbose,systems,cutils,
        symconst,symdef,symsym,
        symconst,symdef,symsym,
-       rgobj,tgobj,cpupi,procinfo,paramgr,
-       cgutils;
+       rgobj,tgobj,cpupi,procinfo,paramgr;
 
 
 
 
     procedure tcgppc.init_register_allocators;
     procedure tcgppc.init_register_allocators;
@@ -980,8 +979,8 @@ const
       begin
       begin
         { this work is done in g_proc_entry }
         { this work is done in g_proc_entry }
       end;
       end;
-      
-    
+
+
     procedure tcgppc.g_restore_standard_registers(list:Taasmoutput);
     procedure tcgppc.g_restore_standard_registers(list:Taasmoutput);
       begin
       begin
         { this work is done in g_proc_exit }
         { this work is done in g_proc_exit }
@@ -2357,7 +2356,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.183  2004-10-26 18:21:29  jonas
+  Revision 1.184  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.183  2004/10/26 18:21:29  jonas
     + empty g_save_standard_registers/g_restore_standard_registers overrides
     + empty g_save_standard_registers/g_restore_standard_registers overrides
       (their work was/is done by g_proc_entry/g_proc_exit, and the generic
       (their work was/is done by g_proc_entry/g_proc_exit, and the generic
        version saves the registers in the wrong place)
        version saves the registers in the wrong place)

+ 12 - 92
compiler/powerpc/cpubase.pas

@@ -242,35 +242,6 @@ uses
                                 Reference
                                 Reference
 *****************************************************************************}
 *****************************************************************************}
 
 
-    type
-      trefoptions=(ref_none,ref_parafixup,ref_localfixup,ref_selffixup);
-
-      { reference record }
-      preference = ^treference;
-      treference = packed record
-         { base register, R_NO if none }
-         base,
-         { index register, R_NO if none }
-         index       : tregister;
-         { offset, 0 if none }
-         offset      : aint;
-         { symbol this reference refers to, nil if none }
-         symbol      : tasmsymbol;
-         { symbol the symbol of this reference is relative to, nil if none }
-         relsymbol      : tasmsymbol;
-         { reference type addr or symbol itself }
-         refaddr : trefaddr;
-         { alignment this reference is guaranteed to have }
-         alignment   : byte;
-      end;
-
-      { reference record }
-      pparareference = ^tparareference;
-      tparareference = packed record
-         index       : tregister;
-         offset      : aword;
-      end;
-
     const
     const
       symaddr2str: array[trefaddr] of string[3] = ('','','@ha','@l');
       symaddr2str: array[trefaddr] of string[3] = ('','','@ha','@l');
 
 
@@ -283,68 +254,6 @@ uses
                                 Operand Sizes
                                 Operand Sizes
 *****************************************************************************}
 *****************************************************************************}
 
 
-{*****************************************************************************
-                               Generic Location
-*****************************************************************************}
-
-    type
-      { tparamlocation describes where a parameter for a procedure is stored.
-        References are given from the caller's point of view. The usual
-        TLocation isn't used, because contains a lot of unnessary fields.
-      }
-      tparalocation = packed record
-         size : TCGSize;
-         { The location type where the parameter is passed, usually
-           LOC_REFERENCE,LOC_REGISTER or LOC_FPUREGISTER
-         }
-         loc  : TCGLoc;
-         lochigh : TCGLoc;
-         { Word alignment on stack 4 --> 32 bit }
-         Alignment:Byte;
-         case TCGLoc of
-            LOC_REFERENCE : (reference : tparareference);
-            LOC_FPUREGISTER, LOC_CFPUREGISTER, LOC_MMREGISTER, LOC_CMMREGISTER,
-              LOC_REGISTER,LOC_CREGISTER : (
-              case longint of
-                1 : (register,registerhigh : tregister);
-                { overlay a registerlow }
-                2 : (registerlow : tregister);
-{$ifndef cpu64bit}
-                { overlay a 64 Bit register type }
-                3 : (register64 : tregister64);
-{$endif cpu64bit}
-            );
-      end;
-
-      tlocation = packed record
-         size : TCGSize;
-         loc : tcgloc;
-         case tcgloc of
-            LOC_CREFERENCE,LOC_REFERENCE : (reference : treference);
-            LOC_CONSTANT : (
-              case longint of
-{$ifdef FPC_BIG_ENDIAN}
-                1 : (_valuedummy,value : aint);
-{$else FPC_BIG_ENDIAN}
-                1 : (value : aint);
-{$endif FPC_BIG_ENDIAN}
-                { can't do this, this layout depends on the host cpu. Use }
-                { lo(valueqword)/hi(valueqword) instead (JM)              }
-                { overlay a complete 64 Bit value }
-                2 : (value64 : Int64);
-              );
-            LOC_FPUREGISTER, LOC_CFPUREGISTER, LOC_MMREGISTER, LOC_CMMREGISTER,
-              LOC_REGISTER,LOC_CREGISTER : (
-                case longint of
-                  1 : (registerlow,registerhigh : tregister);
-                  2 : (register : tregister);
-{$ifndef cpu64bit}
-                  { overlay a 64 Bit register type }
-                  3 : (register64 : tregister64);
-{$endif cpu64bit}
-                );
-            LOC_FLAGS : (resflags : tresflags);
-      end;
 
 
 {*****************************************************************************
 {*****************************************************************************
                                  Constants
                                  Constants
@@ -455,6 +364,13 @@ uses
       }
       }
       std_param_align = 4;  { for 32-bit version only }
       std_param_align = 4;  { for 32-bit version only }
 
 
+      { size of the buffer used for setjump/longjmp
+        the size of this buffer is deduced from the
+        jmp_buf structure in setjumph.inc file
+      }
+      { for linux: }
+      jmp_buf_size = 232;
+
 {*****************************************************************************
 {*****************************************************************************
                             CPU Dependent Constants
                             CPU Dependent Constants
 *****************************************************************************}
 *****************************************************************************}
@@ -642,7 +558,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.91  2004-10-26 18:22:04  jonas
+  Revision 1.92  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.91  2004/10/26 18:22:04  jonas
     * fixed tlocation record again for big endian
     * fixed tlocation record again for big endian
     * fixed (currently unused) saved_standard_registers array
     * fixed (currently unused) saved_standard_registers array
 
 

+ 5 - 14
compiler/powerpc/cpuinfo.pas

@@ -45,19 +45,6 @@ Type
 
 
 
 
 Const
 Const
-   {# Size of native extended floating point type }
-   extended_size = 8;
-   {# Size of a multimedia register               }
-   mmreg_size = 16;
-   { target cpu string (used by compiler options) }
-   target_cpu_string = 'powerpc';
-   { size of the buffer used for setjump/longjmp
-     the size of this buffer is deduced from the
-     jmp_buf structure in setjumph.inc file
-   }
-   { for linux: }
-   jmp_buf_size = 232;
-
    { calling conventions supported by the code generator }
    { calling conventions supported by the code generator }
    supported_calling_conventions : tproccalloptions = [
    supported_calling_conventions : tproccalloptions = [
      pocall_internproc,
      pocall_internproc,
@@ -85,7 +72,11 @@ Implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.20  2004-06-20 08:55:32  florian
+  Revision 1.21  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.20  2004/06/20 08:55:32  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.19  2004/06/16 20:07:10  florian
   Revision 1.19  2004/06/16 20:07:10  florian

+ 47 - 43
compiler/powerpc/nppcadd.pas

@@ -55,7 +55,7 @@ interface
       symconst,symdef,paramgr,
       symconst,symdef,paramgr,
       aasmbase,aasmtai,aasmcpu,defutil,htypechk,
       aasmbase,aasmtai,aasmcpu,defutil,htypechk,
       cgbase,cpuinfo,pass_1,pass_2,regvars,
       cgbase,cpuinfo,pass_1,pass_2,regvars,
-      cpupara,cgcpu,
+      cpupara,cgcpu,cgutils,
       ncon,nset,
       ncon,nset,
       ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32;
       ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32;
 
 
@@ -110,7 +110,7 @@ interface
                 begin
                 begin
                   location.register := n.location.register;
                   location.register := n.location.register;
                   if is_64bit(n.resulttype.def) then
                   if is_64bit(n.resulttype.def) then
-                    location.registerhigh := n.location.registerhigh;
+                    location.register64.reghi := n.location.register64.reghi;
                 end;
                 end;
             LOC_REFERENCE,LOC_CREFERENCE:
             LOC_REFERENCE,LOC_CREFERENCE:
               begin
               begin
@@ -119,7 +119,7 @@ interface
                   begin
                   begin
                     location.register := n.location.register;
                     location.register := n.location.register;
                     if is_64bit(n.resulttype.def) then
                     if is_64bit(n.resulttype.def) then
-                      location.registerhigh := n.location.registerhigh;
+                      location.register64.reghi := n.location.register64.reghi;
                   end;
                   end;
               end;
               end;
             LOC_CONSTANT:
             LOC_CONSTANT:
@@ -130,7 +130,7 @@ interface
                     if not cmpop then
                     if not cmpop then
                       location.register := n.location.register;
                       location.register := n.location.register;
                       if is_64bit(n.resulttype.def) then
                       if is_64bit(n.resulttype.def) then
-                        location.registerhigh := n.location.registerhigh;
+                        location.register64.reghi := n.location.register64.reghi;
                   end;
                   end;
               end;
               end;
           end;
           end;
@@ -144,7 +144,7 @@ interface
          begin
          begin
            location.register := cg.getintregister(exprasmlist,OS_INT);
            location.register := cg.getintregister(exprasmlist,OS_INT);
            if is_64bit(resulttype.def) then
            if is_64bit(resulttype.def) then
-             location.registerhigh := cg.getintregister(exprasmlist,OS_INT);
+             location.register64.reghi := cg.getintregister(exprasmlist,OS_INT);
          end;
          end;
       end;
       end;
 
 
@@ -664,11 +664,11 @@ interface
           if left.location.loc = LOC_CONSTANT then
           if left.location.loc = LOC_CONSTANT then
             left.location.value64 := left.location.value64 shr 32
             left.location.value64 := left.location.value64 shr 32
           else
           else
-            left.location.registerlow := left.location.registerhigh;
+            left.location.register64.reglo := left.location.register64.reghi;
           if right.location.loc = LOC_CONSTANT then
           if right.location.loc = LOC_CONSTANT then
             right.location.value64 := right.location.value64 shr 32
             right.location.value64 := right.location.value64 shr 32
           else
           else
-            right.location.registerlow := right.location.registerhigh;
+            right.location.register64.reglo := right.location.register64.reghi;
 
 
           // and call the normal emit_compare
           // and call the normal emit_compare
           emit_compare(unsigned);
           emit_compare(unsigned);
@@ -834,19 +834,19 @@ interface
                     begin
                     begin
                       if left.location.loc = LOC_REGISTER then
                       if left.location.loc = LOC_REGISTER then
                         begin
                         begin
-                          tempreg64.reglo := left.location.registerlow;
-                          tempreg64.reghi := left.location.registerhigh;
+                          tempreg64.reglo := left.location.register64.reglo;
+                          tempreg64.reghi := left.location.register64.reghi;
                         end
                         end
                       else
                       else
                         begin
                         begin
                           if (aint(right.location.value64) <> 0) then
                           if (aint(right.location.value64) <> 0) then
                             tempreg64.reglo := cg.getintregister(exprasmlist,OS_32)
                             tempreg64.reglo := cg.getintregister(exprasmlist,OS_32)
                           else
                           else
-                            tempreg64.reglo := left.location.registerlow;
+                            tempreg64.reglo := left.location.register64.reglo;
                           if ((right.location.value64 shr 32) <> 0) then
                           if ((right.location.value64 shr 32) <> 0) then
                             tempreg64.reghi := cg.getintregister(exprasmlist,OS_32)
                             tempreg64.reghi := cg.getintregister(exprasmlist,OS_32)
                           else
                           else
-                            tempreg64.reghi := left.location.registerhigh;
+                            tempreg64.reghi := left.location.register64.reghi;
                         end;
                         end;
 
 
                       if (aint(right.location.value64) <> 0) then
                       if (aint(right.location.value64) <> 0) then
@@ -856,22 +856,22 @@ interface
                            (longint(right.location.value64) < 0) then
                            (longint(right.location.value64) < 0) then
                           cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,
                           cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,
                             aint(right.location.value64),
                             aint(right.location.value64),
-                            left.location.registerlow,tempreg64.reglo)
+                            left.location.register64.reglo,tempreg64.reglo)
                         else
                         else
                           cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT,
                           cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT,
                             aint(right.location.value64),
                             aint(right.location.value64),
-                            left.location.registerlow,tempreg64.reglo);
+                            left.location.register64.reglo,tempreg64.reglo);
 
 
                       if ((right.location.value64 shr 32) <> 0) then
                       if ((right.location.value64 shr 32) <> 0) then
                         if (longint(right.location.value64 shr 32) >= -32767) and
                         if (longint(right.location.value64 shr 32) >= -32767) and
                            (longint(right.location.value64 shr 32) < 0) then
                            (longint(right.location.value64 shr 32) < 0) then
                           cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,
                           cg.a_op_const_reg_reg(exprasmlist,OP_SUB,OS_INT,
                             aint(right.location.value64 shr 32),
                             aint(right.location.value64 shr 32),
-                            left.location.registerhigh,tempreg64.reghi)
+                            left.location.register64.reghi,tempreg64.reghi)
                         else
                         else
                           cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT,
                           cg.a_op_const_reg_reg(exprasmlist,OP_XOR,OS_INT,
                             aint(right.location.value64 shr 32),
                             aint(right.location.value64 shr 32),
-                            left.location.registerhigh,tempreg64.reghi);
+                            left.location.register64.reghi,tempreg64.reghi);
                     end
                     end
                   else
                   else
                     begin
                     begin
@@ -892,10 +892,10 @@ interface
                 end;
                 end;
               xorn,orn,andn,addn:
               xorn,orn,andn,addn:
                 begin
                 begin
-                  if (location.registerlow = NR_NO) then
+                  if (location.register64.reglo = NR_NO) then
                     begin
                     begin
-                      location.registerlow := cg.getintregister(exprasmlist,OS_INT);
-                      location.registerhigh := cg.getintregister(exprasmlist,OS_INT);
+                      location.register64.reglo := cg.getintregister(exprasmlist,OS_INT);
+                      location.register64.reghi := cg.getintregister(exprasmlist,OS_INT);
                     end;
                     end;
 
 
                   if (left.location.loc = LOC_CONSTANT) then
                   if (left.location.loc = LOC_CONSTANT) then
@@ -914,10 +914,10 @@ interface
 
 
                   if left.location.loc <> LOC_CONSTANT then
                   if left.location.loc <> LOC_CONSTANT then
                     begin
                     begin
-                      if (location.registerlow = NR_NO) then
+                      if (location.register64.reglo = NR_NO) then
                         begin
                         begin
-                         location.registerlow := cg.getintregister(exprasmlist,OS_INT);
-                         location.registerhigh := cg.getintregister(exprasmlist,OS_INT);
+                         location.register64.reglo := cg.getintregister(exprasmlist,OS_INT);
+                         location.register64.reghi := cg.getintregister(exprasmlist,OS_INT);
                       end;
                       end;
                       if right.location.loc <> LOC_CONSTANT then
                       if right.location.loc <> LOC_CONSTANT then
                         // reg64 - reg64
                         // reg64 - reg64
@@ -932,17 +932,17 @@ interface
                     end
                     end
                   else if ((left.location.value64 shr 32) = 0) then
                   else if ((left.location.value64 shr 32) = 0) then
                     begin
                     begin
-                      if (location.registerlow = NR_NO) then
+                      if (location.register64.reglo = NR_NO) then
                         begin
                         begin
-                         location.registerlow := cg.getintregister(exprasmlist,OS_INT);
-                         location.registerhigh := cg.getintregister(exprasmlist,OS_INT);
+                         location.register64.reglo := cg.getintregister(exprasmlist,OS_INT);
+                         location.register64.reghi := cg.getintregister(exprasmlist,OS_INT);
                       end;
                       end;
                       if (int64(left.location.value64) >= low(smallint)) and
                       if (int64(left.location.value64) >= low(smallint)) and
                          (int64(left.location.value64) <= high(smallint)) then
                          (int64(left.location.value64) <= high(smallint)) then
                         begin
                         begin
                           // consts16 - reg64
                           // consts16 - reg64
                           exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC,
                           exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC,
-                            location.registerlow,right.location.registerlow,
+                            location.register64.reglo,right.location.register64.reglo,
                             left.location.value));
                             left.location.value));
                         end
                         end
                       else
                       else
@@ -951,26 +951,26 @@ interface
                           location_force_reg(exprasmlist,left.location,
                           location_force_reg(exprasmlist,left.location,
                             OS_32,true);
                             OS_32,true);
                           exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBC,
                           exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBC,
-                            location.registerlow,left.location.registerlow,
-                            right.location.registerlow));
+                            location.register64.reglo,left.location.register64.reglo,
+                            right.location.register64.reglo));
                         end;
                         end;
                       exprasmlist.concat(taicpu.op_reg_reg(A_SUBFZE,
                       exprasmlist.concat(taicpu.op_reg_reg(A_SUBFZE,
-                        location.registerhigh,right.location.registerhigh));
+                        location.register64.reghi,right.location.register64.reghi));
                     end
                     end
                   else if (aint(left.location.value64) = 0) then
                   else if (aint(left.location.value64) = 0) then
                     begin
                     begin
                       // (const32 shl 32) - reg64
                       // (const32 shl 32) - reg64
-                      if (location.registerlow = NR_NO) then
+                      if (location.register64.reglo = NR_NO) then
                         begin
                         begin
-                         location.registerlow := cg.getintregister(exprasmlist,OS_INT);
-                         location.registerhigh := cg.getintregister(exprasmlist,OS_INT);
+                         location.register64.reglo := cg.getintregister(exprasmlist,OS_INT);
+                         location.register64.reghi := cg.getintregister(exprasmlist,OS_INT);
                       end;
                       end;
                       exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC,
                       exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC,
-                        location.registerlow,right.location.registerlow,0));
+                        location.register64.reglo,right.location.register64.reglo,0));
                       left.location.value64 := left.location.value64 shr 32;
                       left.location.value64 := left.location.value64 shr 32;
                       location_force_reg(exprasmlist,left.location,OS_32,true);
                       location_force_reg(exprasmlist,left.location,OS_32,true);
                       exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBFE,
                       exprasmlist.concat(taicpu.op_reg_reg_reg(A_SUBFE,
-                        location.registerhigh,right.location.registerhigh,
+                        location.register64.reghi,right.location.register64.reghi,
                         left.location.register));
                         left.location.register));
                     end
                     end
                   else
                   else
@@ -980,10 +980,10 @@ interface
                         def_cgsize(left.resulttype.def),false);
                         def_cgsize(left.resulttype.def),false);
                       if (left.location.loc = LOC_REGISTER) then
                       if (left.location.loc = LOC_REGISTER) then
                         location.register64 := left.location.register64
                         location.register64 := left.location.register64
-                      else if (location.registerlow = NR_NO) then
+                      else if (location.register64.reglo = NR_NO) then
                         begin
                         begin
-                         location.registerlow := cg.getintregister(exprasmlist,OS_INT);
-                         location.registerhigh := cg.getintregister(exprasmlist,OS_INT);
+                         location.register64.reglo := cg.getintregister(exprasmlist,OS_INT);
+                         location.register64.reghi := cg.getintregister(exprasmlist,OS_INT);
                         end;
                         end;
                       cg64.a_op64_reg_reg_reg(exprasmlist,OP_SUB,
                       cg64.a_op64_reg_reg_reg(exprasmlist,OP_SUB,
                         right.location.register64,left.location.register64,
                         right.location.register64,left.location.register64,
@@ -1028,15 +1028,15 @@ interface
                     end;
                     end;
                 end;
                 end;
               end;
               end;
-            exprasmlist.concat(taicpu.op_reg_reg_reg(op1,location.registerlow,
-              left.location.registerlow,right.location.registerlow));
-            exprasmlist.concat(taicpu.op_reg_reg_reg(op2,location.registerhigh,
-              right.location.registerhigh,left.location.registerhigh));
+            exprasmlist.concat(taicpu.op_reg_reg_reg(op1,location.register64.reglo,
+              left.location.register64.reglo,right.location.register64.reglo));
+            exprasmlist.concat(taicpu.op_reg_reg_reg(op2,location.register64.reghi,
+              right.location.register64.reghi,left.location.register64.reghi));
             if not(is_signed(resulttype.def)) then
             if not(is_signed(resulttype.def)) then
               if nodetype = addn then
               if nodetype = addn then
-                exprasmlist.concat(taicpu.op_reg_reg(A_CMPLW,location.registerhigh,left.location.registerhigh))
+                exprasmlist.concat(taicpu.op_reg_reg(A_CMPLW,location.register64.reghi,left.location.register64.reghi))
               else
               else
-                exprasmlist.concat(taicpu.op_reg_reg(A_CMPLW,left.location.registerhigh,location.registerhigh));
+                exprasmlist.concat(taicpu.op_reg_reg(A_CMPLW,left.location.register64.reghi,location.register64.reghi));
             cg.g_overflowcheck(exprasmlist,location,resulttype.def);
             cg.g_overflowcheck(exprasmlist,location,resulttype.def);
           end;
           end;
 
 
@@ -1458,7 +1458,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.51  2004-10-26 18:22:31  jonas
+  Revision 1.52  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.51  2004/10/26 18:22:31  jonas
     * fixed bugs due to change of the value field of tlocation from aword to
     * fixed bugs due to change of the value field of tlocation from aword to
       aint
       aint
 
 

+ 8 - 4
compiler/powerpc/nppccnv.pas

@@ -57,10 +57,10 @@ interface
 implementation
 implementation
 
 
    uses
    uses
-      verbose,globals,systems,
+      verbose,globtype,globals,systems,
       symconst,symdef,aasmbase,aasmtai,
       symconst,symdef,aasmbase,aasmtai,
       defutil,
       defutil,
-      cgbase,pass_1,pass_2,
+      cgbase,cgutils,pass_1,pass_2,
       ncon,ncal,
       ncon,ncal,
       ncgutil,
       ncgutil,
       cpubase,aasmcpu,
       cpubase,aasmcpu,
@@ -305,7 +305,7 @@ implementation
                      if left.location.size in [OS_64,OS_S64] then
                      if left.location.size in [OS_64,OS_S64] then
                        begin
                        begin
                           hreg1:=cg.getintregister(exprasmlist,OS_32);
                           hreg1:=cg.getintregister(exprasmlist,OS_32);
-                          cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,left.location.registerhigh,left.location.registerlow,hreg1);
+                          cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,left.location.register64.reghi,left.location.register64.reglo,hreg1);
                        end
                        end
                      else
                      else
                        hreg1 := left.location.register;
                        hreg1 := left.location.register;
@@ -345,7 +345,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.54  2004-09-25 14:23:55  peter
+  Revision 1.55  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.54  2004/09/25 14:23:55  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 6 - 2
compiler/powerpc/nppcinl.pas

@@ -53,7 +53,7 @@ implementation
       defutil,
       defutil,
       cgbase,pass_2,
       cgbase,pass_2,
       cpubase,ncgutil,
       cpubase,ncgutil,
-      cgobj,rgobj;
+      cgutils,cgobj,rgobj;
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -147,7 +147,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2004-09-25 14:23:55  peter
+  Revision 1.17  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.16  2004/09/25 14:23:55  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 47 - 43
compiler/powerpc/nppcmat.pas

@@ -57,7 +57,7 @@ implementation
       symconst,symdef,
       symconst,symdef,
       aasmbase,aasmcpu,aasmtai,
       aasmbase,aasmcpu,aasmtai,
       defutil,
       defutil,
-      cgbase,cgobj,pass_1,pass_2,
+      cgbase,cgutils,cgobj,pass_1,pass_2,
       ncon,procinfo,
       ncon,procinfo,
       cpubase,cpuinfo,
       cpubase,cpuinfo,
       ncgutil,cgcpu,cg64f32,rgobj;
       ncgutil,cgcpu,cg64f32,rgobj;
@@ -184,7 +184,7 @@ implementation
 
 
       var
       var
          resultreg, hregister1,hregister2,
          resultreg, hregister1,hregister2,
-         hregisterhigh,hregisterlow : tregister;
+         hreg64hi,hreg64lo : tregister;
          op : topcg;
          op : topcg;
          asmop1, asmop2: tasmop;
          asmop1, asmop2: tasmop;
          shiftval: aint;
          shiftval: aint;
@@ -199,35 +199,35 @@ implementation
              location_force_reg(exprasmlist,left.location,
              location_force_reg(exprasmlist,left.location,
                def_cgsize(left.resulttype.def),true);
                def_cgsize(left.resulttype.def),true);
              location_copy(location,left.location);
              location_copy(location,left.location);
-             hregisterhigh := location.registerhigh;
-             hregisterlow := location.registerlow;
+             hreg64hi := location.register64.reghi;
+             hreg64lo := location.register64.reglo;
              if (location.loc = LOC_CREGISTER) then
              if (location.loc = LOC_CREGISTER) then
                begin
                begin
                  location.loc := LOC_REGISTER;
                  location.loc := LOC_REGISTER;
-                 location.registerhigh := cg.getintregister(exprasmlist,OS_32);
-                 location.registerlow := cg.getintregister(exprasmlist,OS_32);
+                 location.register64.reghi := cg.getintregister(exprasmlist,OS_32);
+                 location.register64.reglo := cg.getintregister(exprasmlist,OS_32);
                end;
                end;
              if (right.nodetype = ordconstn) then
              if (right.nodetype = ordconstn) then
                begin
                begin
                  shiftval := tordconstnode(right).value;
                  shiftval := tordconstnode(right).value;
                  if shiftval > 63 then
                  if shiftval > 63 then
                    begin
                    begin
-                     cg.a_load_const_reg(exprasmlist,OS_32,0,location.registerlow);
-                     cg.a_load_const_reg(exprasmlist,OS_32,0,location.registerlow);
+                     cg.a_load_const_reg(exprasmlist,OS_32,0,location.register64.reglo);
+                     cg.a_load_const_reg(exprasmlist,OS_32,0,location.register64.reglo);
                    end
                    end
                  else if shiftval > 31 then
                  else if shiftval > 31 then
                    begin
                    begin
                      if nodetype = shln then
                      if nodetype = shln then
                        begin
                        begin
                          cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,
                          cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,
-                           shiftval and 31,hregisterlow,location.registerhigh);
-                         cg.a_load_const_reg(exprasmlist,OS_32,0,location.registerlow);
+                           shiftval and 31,hreg64lo,location.register64.reghi);
+                         cg.a_load_const_reg(exprasmlist,OS_32,0,location.register64.reglo);
                        end
                        end
                      else
                      else
                        begin
                        begin
                          cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,
                          cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,
-                           shiftval and 31,hregisterhigh,location.registerlow);
-                         cg.a_load_const_reg(exprasmlist,OS_32,0,location.registerhigh);
+                           shiftval and 31,hreg64hi,location.register64.reglo);
+                         cg.a_load_const_reg(exprasmlist,OS_32,0,location.register64.reghi);
                        end;
                        end;
                    end
                    end
                  else
                  else
@@ -235,25 +235,25 @@ implementation
                      if nodetype = shln then
                      if nodetype = shln then
                        begin
                        begin
                          exprasmlist.concat(taicpu.op_reg_reg_const_const_const(
                          exprasmlist.concat(taicpu.op_reg_reg_const_const_const(
-                           A_RLWINM,location.registerhigh,hregisterhigh,shiftval,
+                           A_RLWINM,location.register64.reghi,hreg64hi,shiftval,
                            0,31-shiftval));
                            0,31-shiftval));
                          exprasmlist.concat(taicpu.op_reg_reg_const_const_const(
                          exprasmlist.concat(taicpu.op_reg_reg_const_const_const(
-                           A_RLWIMI,location.registerhigh,hregisterlow,shiftval,
+                           A_RLWIMI,location.register64.reghi,hreg64lo,shiftval,
                            32-shiftval,31));
                            32-shiftval,31));
                          exprasmlist.concat(taicpu.op_reg_reg_const_const_const(
                          exprasmlist.concat(taicpu.op_reg_reg_const_const_const(
-                           A_RLWINM,location.registerlow,hregisterlow,shiftval,
+                           A_RLWINM,location.register64.reglo,hreg64lo,shiftval,
                            0,31-shiftval));
                            0,31-shiftval));
                        end
                        end
                      else
                      else
                        begin
                        begin
                          exprasmlist.concat(taicpu.op_reg_reg_const_const_const(
                          exprasmlist.concat(taicpu.op_reg_reg_const_const_const(
-                           A_RLWINM,location.registerlow,hregisterlow,32-shiftval,
+                           A_RLWINM,location.register64.reglo,hreg64lo,32-shiftval,
                            shiftval,31));
                            shiftval,31));
                          exprasmlist.concat(taicpu.op_reg_reg_const_const_const(
                          exprasmlist.concat(taicpu.op_reg_reg_const_const_const(
-                           A_RLWIMI,location.registerlow,hregisterhigh,32-shiftval,
+                           A_RLWIMI,location.register64.reglo,hreg64hi,32-shiftval,
                            0,shiftval-1));
                            0,shiftval-1));
                          exprasmlist.concat(taicpu.op_reg_reg_const_const_const(
                          exprasmlist.concat(taicpu.op_reg_reg_const_const_const(
-                           A_RLWINM,location.registerhigh,hregisterhigh,32-shiftval,
+                           A_RLWINM,location.register64.reghi,hreg64hi,32-shiftval,
                            shiftval,31));
                            shiftval,31));
                        end;
                        end;
                    end;
                    end;
@@ -272,38 +272,38 @@ implementation
                    begin
                    begin
                      asmop1 := A_SRW;
                      asmop1 := A_SRW;
                      asmop2 := A_SLW;
                      asmop2 := A_SLW;
-                     resultreg := hregisterhigh;
-                     hregisterhigh := hregisterlow;
-                     hregisterlow := resultreg;
-                     resultreg := location.registerhigh;
-                     location.registerhigh := location.registerlow;
-                     location.registerlow := resultreg;
+                     resultreg := hreg64hi;
+                     hreg64hi := hreg64lo;
+                     hreg64lo := resultreg;
+                     resultreg := location.register64.reghi;
+                     location.register64.reghi := location.register64.reglo;
+                     location.register64.reglo := resultreg;
                    end;
                    end;
 
 
                  cg.getcpuregister(exprasmlist,NR_R0);
                  cg.getcpuregister(exprasmlist,NR_R0);
                  exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC,
                  exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC,
                    NR_R0,hregister1,32));
                    NR_R0,hregister1,32));
                  exprasmlist.concat(taicpu.op_reg_reg_reg(asmop1,
                  exprasmlist.concat(taicpu.op_reg_reg_reg(asmop1,
-                   location.registerhigh,hregisterhigh,hregister1));
+                   location.register64.reghi,hreg64hi,hregister1));
                  exprasmlist.concat(taicpu.op_reg_reg_reg(asmop2,
                  exprasmlist.concat(taicpu.op_reg_reg_reg(asmop2,
-                   NR_R0,hregisterlow,NR_R0));
+                   NR_R0,hreg64lo,NR_R0));
                  exprasmlist.concat(taicpu.op_reg_reg_reg(A_OR,
                  exprasmlist.concat(taicpu.op_reg_reg_reg(A_OR,
-                   location.registerhigh,location.registerhigh,NR_R0));
+                   location.register64.reghi,location.register64.reghi,NR_R0));
                  exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBI,
                  exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBI,
                    NR_R0,hregister1,32));
                    NR_R0,hregister1,32));
                  exprasmlist.concat(taicpu.op_reg_reg_reg(asmop1,
                  exprasmlist.concat(taicpu.op_reg_reg_reg(asmop1,
-                   NR_R0,hregisterlow,NR_R0));
+                   NR_R0,hreg64lo,NR_R0));
                  exprasmlist.concat(taicpu.op_reg_reg_reg(A_OR,
                  exprasmlist.concat(taicpu.op_reg_reg_reg(A_OR,
-                   location.registerhigh,location.registerhigh,NR_R0));
+                   location.register64.reghi,location.register64.reghi,NR_R0));
                  exprasmlist.concat(taicpu.op_reg_reg_reg(asmop1,
                  exprasmlist.concat(taicpu.op_reg_reg_reg(asmop1,
-                   location.registerlow,hregisterlow,hregister1));
+                   location.register64.reglo,hreg64lo,hregister1));
                  cg.ungetcpuregister(exprasmlist,NR_R0);
                  cg.ungetcpuregister(exprasmlist,NR_R0);
 
 
                  if nodetype = shrn then
                  if nodetype = shrn then
                    begin
                    begin
-                     resultreg := location.registerhigh;
-                     location.registerhigh := location.registerlow;
-                     location.registerlow := resultreg;
+                     resultreg := location.register64.reghi;
+                     location.register64.reghi := location.register64.reglo;
+                     location.register64.reglo := resultreg;
                    end;
                    end;
                end
                end
            end
            end
@@ -362,18 +362,18 @@ implementation
              location_copy(location,left.location);
              location_copy(location,left.location);
              if (location.loc = LOC_CREGISTER) then
              if (location.loc = LOC_CREGISTER) then
                begin
                begin
-                 location.registerlow := cg.getintregister(exprasmlist,OS_INT);
-                 location.registerhigh := cg.getintregister(exprasmlist,OS_INT);
+                 location.register64.reglo := cg.getintregister(exprasmlist,OS_INT);
+                 location.register64.reghi := cg.getintregister(exprasmlist,OS_INT);
                  location.loc := LOC_REGISTER;
                  location.loc := LOC_REGISTER;
                end;
                end;
              exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC,
              exprasmlist.concat(taicpu.op_reg_reg_const(A_SUBFIC,
-               location.registerlow,left.location.registerlow,0));
+               location.register64.reglo,left.location.register64.reglo,0));
              if not(cs_check_overflow in aktlocalswitches) then
              if not(cs_check_overflow in aktlocalswitches) then
                exprasmlist.concat(taicpu.op_reg_reg(A_SUBFZE,
                exprasmlist.concat(taicpu.op_reg_reg(A_SUBFZE,
-                 location.registerhigh,left.location.registerhigh))
+                 location.register64.reghi,left.location.register64.reghi))
              else
              else
                exprasmlist.concat(taicpu.op_reg_reg(A_SUBFZEO_,
                exprasmlist.concat(taicpu.op_reg_reg(A_SUBFZEO_,
-                 location.registerhigh,left.location.registerhigh));
+                 location.register64.reghi,left.location.register64.reghi));
            end
            end
          else
          else
            begin
            begin
@@ -495,10 +495,10 @@ implementation
              location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),false);
              location_force_reg(exprasmlist,left.location,def_cgsize(left.resulttype.def),false);
              location_copy(location,left.location);
              location_copy(location,left.location);
              { perform the NOT operation }
              { perform the NOT operation }
-             exprasmlist.concat(taicpu.op_reg_reg(A_NOT,location.registerhigh,
-               location.registerhigh));
-             exprasmlist.concat(taicpu.op_reg_reg(A_NOT,location.registerlow,
-               location.registerlow));
+             exprasmlist.concat(taicpu.op_reg_reg(A_NOT,location.register64.reghi,
+               location.register64.reghi));
+             exprasmlist.concat(taicpu.op_reg_reg(A_NOT,location.register64.reglo,
+               location.register64.reglo));
            end
            end
          else
          else
            begin
            begin
@@ -521,7 +521,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.41  2004-10-25 15:36:47  peter
+  Revision 1.42  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.41  2004/10/25 15:36:47  peter
     * save standard registers moved to tcgobj
     * save standard registers moved to tcgobj
 
 
   Revision 1.40  2004/09/25 14:23:55  peter
   Revision 1.40  2004/09/25 14:23:55  peter

+ 7 - 3
compiler/procinfo.pas

@@ -34,7 +34,7 @@ unit procinfo;
       { symtable }
       { symtable }
       symconst,symtype,symdef,symsym,
       symconst,symtype,symdef,symsym,
       { aasm }
       { aasm }
-      cpubase,cpuinfo,cgbase,
+      cpubase,cpuinfo,cgbase,cgutils,
       aasmbase,aasmtai
       aasmbase,aasmtai
       ;
       ;
 
 
@@ -123,7 +123,7 @@ implementation
 
 
      uses
      uses
         cutils,systems,
         cutils,systems,
-        tgobj,cgutils,cgobj,
+        tgobj,cgobj,
         paramgr
         paramgr
         ;
         ;
 
 
@@ -184,7 +184,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2004-06-20 08:55:30  florian
+  Revision 1.17  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.16  2004/06/20 08:55:30  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.15  2004/06/16 20:07:09  florian
   Revision 1.15  2004/06/16 20:07:09  florian

+ 13 - 14
compiler/rautils.pas

@@ -28,7 +28,7 @@ Interface
 
 
 Uses
 Uses
   cutils,cclasses,
   cutils,cclasses,
-  globtype,aasmbase,aasmtai,cpubase,cpuinfo,cgbase,
+  globtype,aasmbase,aasmtai,cpubase,cpuinfo,cgbase,cgutils,
   symconst,symbase,symtype,symdef,symsym;
   symconst,symbase,symtype,symdef,symsym;
 
 
 Const
 Const
@@ -710,20 +710,15 @@ end;
 Procedure TOperand.SetSize(_size:longint;force:boolean);
 Procedure TOperand.SetSize(_size:longint;force:boolean);
 begin
 begin
   if force or
   if force or
-     ((size = OS_NO) and (_size<=extended_size)) then
+     ((size = OS_NO) and (_size<=16)) then
    Begin
    Begin
      case _size of
      case _size of
-      1 : size:=OS_8;
-      2 : size:=OS_16{ could be S_IS};
-      4 : size:=OS_32{ could be S_IL or S_FS};
-      8 : size:=OS_64{ could be S_D or S_FL};
-     else
-      begin
-        { extended_size can also be 8, resulting in a
-          duplicate label }
-        if _size=extended_size then
-          size:=OS_F80;
-      end;
+        1 : size:=OS_8;
+        2 : size:=OS_16{ could be S_IS};
+        4 : size:=OS_32{ could be S_IL or S_FS};
+        8 : size:=OS_64{ could be S_D or S_FL};
+       10 : size:=OS_F80;
+       16 : size:=OS_128;
      end;
      end;
    end;
    end;
 end;
 end;
@@ -1664,7 +1659,11 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.92  2004-10-24 11:44:28  peter
+  Revision 1.93  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.92  2004/10/24 11:44:28  peter
     * small regvar fixes
     * small regvar fixes
     * loadref parameter removed from concatcopy,incrrefcount,etc
     * loadref parameter removed from concatcopy,incrrefcount,etc
 
 

+ 6 - 6
compiler/rgobj.pas

@@ -33,7 +33,7 @@ unit rgobj;
     uses
     uses
       cutils, cpubase,
       cutils, cpubase,
       aasmbase,aasmtai,aasmcpu,
       aasmbase,aasmtai,aasmcpu,
-      cclasses,globtype,cgbase,node,
+      cclasses,globtype,cgbase,cgutils,
       cpuinfo
       cpuinfo
       ;
       ;
 
 
@@ -518,7 +518,6 @@ unit rgobj;
       var
       var
         spillingcounter:byte;
         spillingcounter:byte;
         endspill:boolean;
         endspill:boolean;
-        i:Tsuperregister;
       begin
       begin
         { Insert regalloc info for imaginary registers }
         { Insert regalloc info for imaginary registers }
         insert_regalloc_info_all(list);
         insert_regalloc_info_all(list);
@@ -789,9 +788,6 @@ unit rgobj;
 
 
 
 
     procedure trgobj.prepare_colouring;
     procedure trgobj.prepare_colouring;
-
-    var i:word;
-
     begin
     begin
       make_work_list;
       make_work_list;
       active_moves:=Tlinkedlist.create;
       active_moves:=Tlinkedlist.create;
@@ -1997,7 +1993,11 @@ unit rgobj;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.146  2004-10-31 16:04:30  florian
+  Revision 1.147  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.146  2004/10/31 16:04:30  florian
     * fixed compilation of system unit on arm
     * fixed compilation of system unit on arm
 
 
   Revision 1.145  2004/10/30 15:21:37  florian
   Revision 1.145  2004/10/30 15:21:37  florian

+ 7 - 3
compiler/scanner.pas

@@ -1680,7 +1680,7 @@ implementation
         oldaktfilepos:=aktfilepos;
         oldaktfilepos:=aktfilepos;
         repeat
         repeat
           current_scanner.gettokenpos;
           current_scanner.gettokenpos;
-          p.proc;
+          p.proc();
           { accept the text ? }
           { accept the text ? }
           if (current_scanner.preprocstack=nil) or current_scanner.preprocstack.accept then
           if (current_scanner.preprocstack=nil) or current_scanner.preprocstack.accept then
            break
            break
@@ -1777,7 +1777,7 @@ implementation
                else
                else
                 begin
                 begin
                   Message1(scan_d_handling_switch,'$'+hs);
                   Message1(scan_d_handling_switch,'$'+hs);
-                  t.proc;
+                  t.proc();
                 end;
                 end;
              end
              end
             else
             else
@@ -3290,7 +3290,11 @@ exit_label:
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.94  2004-10-31 18:54:25  peter
+  Revision 1.95  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.94  2004/10/31 18:54:25  peter
     * $fpctarget expands to <cpu>-<os>
     * $fpctarget expands to <cpu>-<os>
     * allow * in middle of the path to support ../*/units/$fpctarget
     * allow * in middle of the path to support ../*/units/$fpctarget
 
 

+ 6 - 2
compiler/sparc/aasmcpu.pas

@@ -30,7 +30,7 @@ uses
   cclasses,
   cclasses,
   globtype,globals,verbose,
   globtype,globals,verbose,
   aasmbase,aasmtai,
   aasmbase,aasmtai,
-  cgbase,cpubase,cpuinfo;
+  cgbase,cgutils,cpubase,cpuinfo;
 
 
     const
     const
       { "mov reg,reg" source operand number }
       { "mov reg,reg" source operand number }
@@ -313,7 +313,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.51  2004-10-30 15:21:38  florian
+  Revision 1.52  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.51  2004/10/30 15:21:38  florian
     * fixed generic optimizer
     * fixed generic optimizer
     * enabled generic optimizer for sparc
     * enabled generic optimizer for sparc
 
 

+ 7 - 3
compiler/sparc/cgcpu.pas

@@ -28,7 +28,7 @@ interface
 
 
     uses
     uses
        globtype,parabase,
        globtype,parabase,
-       cgbase,cgobj,cg64f32,
+       cgbase,cgutils,cgobj,cg64f32,
        aasmbase,aasmtai,aasmcpu,
        aasmbase,aasmtai,aasmcpu,
        cpubase,cpuinfo,
        cpubase,cpuinfo,
        node,symconst,SymType,
        node,symconst,SymType,
@@ -120,7 +120,7 @@ implementation
   uses
   uses
     globals,verbose,systems,cutils,
     globals,verbose,systems,cutils,
     symdef,paramgr,
     symdef,paramgr,
-    tgobj,cpupi,cgutils;
+    tgobj,cpupi;
 
 
 
 
 {****************************************************************************
 {****************************************************************************
@@ -1245,7 +1245,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.97  2004-10-24 20:01:08  peter
+  Revision 1.98  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.97  2004/10/24 20:01:08  peter
     * remove saveregister calling convention
     * remove saveregister calling convention
 
 
   Revision 1.96  2004/10/24 11:53:45  peter
   Revision 1.96  2004/10/24 11:53:45  peter

+ 11 - 74
compiler/sparc/cpubase.pas

@@ -157,72 +157,11 @@ uses
         F_FLE  {Less or Equal}
         F_FLE  {Less or Equal}
       );
       );
 
 
-{*****************************************************************************
-                                Reference
-*****************************************************************************}
-
-    type
-      { reference record }
-      preference = ^treference;
-      treference = record
-         { base register, R_NO if none }
-         base,
-         { index register, R_NO if none }
-         index       : tregister;
-         { offset, 0 if none }
-         offset      : aint;
-         { symbol this reference refers to, nil if none }
-         symbol      : tasmsymbol;
-         { symbol the symbol of this reference is relative to, nil if none }
-         relsymbol   : tasmsymbol;
-         { reference type addr or symbol itself }
-         refaddr     : trefaddr;
-      end;
-
-      { reference record }
-      pparareference = ^tparareference;
-      tparareference = packed record
-         index       : tregister;
-         offset      : aint;
-      end;
-
 {*****************************************************************************
 {*****************************************************************************
                                 Operand Sizes
                                 Operand Sizes
 *****************************************************************************}
 *****************************************************************************}
 
 
 
 
-{*****************************************************************************
-                               Generic Location
-*****************************************************************************}
-
-    type
-      TLocation = record
-         size : TCGSize;
-         loc : tcgloc;
-         case tcgloc of
-            LOC_CREFERENCE,LOC_REFERENCE : (reference : treference);
-            LOC_CONSTANT : (
-              case longint of
-{$ifdef FPC_BIG_ENDIAN}
-                1 : (_valuedummy,value : Aint);
-{$else FPC_BIG_ENDIAN}
-                1 : (value : Aint);
-{$endif FPC_BIG_ENDIAN}
-                2 : (value64 : int64);
-              );
-            LOC_FPUREGISTER,LOC_CFPUREGISTER,
-            LOC_MMREGISTER,LOC_CMMREGISTER,
-            LOC_REGISTER,LOC_CREGISTER : (
-                case longint of
-                  1 : (registerlow,registerhigh : tregister);
-                  2 : (register : tregister);
-                  { overlay a 64 Bit register type }
-                  3 : (reg64 : tregister64);
-                  4 : (register64 : tregister64);
-                );
-            LOC_FLAGS : (resflags : tresflags);
-      end;
-
 {*****************************************************************************
 {*****************************************************************************
                                  Constants
                                  Constants
 *****************************************************************************}
 *****************************************************************************}
@@ -381,6 +320,12 @@ uses
       }
       }
       std_param_align = 4;  { for 32-bit version only }
       std_param_align = 4;  { for 32-bit version only }
 
 
+     { size of the buffer used for setjump/longjmp
+       the size of this buffer is deduced from the
+       jmp_buf structure in setjumph.inc file }
+     JMP_BUF_SIZE = 12+16;
+
+
 {*****************************************************************************
 {*****************************************************************************
                             CPU Dependent Constants
                             CPU Dependent Constants
 *****************************************************************************}
 *****************************************************************************}
@@ -393,7 +338,6 @@ uses
                                   Helpers
                                   Helpers
 *****************************************************************************}
 *****************************************************************************}
 
 
-    function RefsEqual(Const r1,r2: TReference) : Boolean;
     function  is_calljmp(o:tasmop):boolean;
     function  is_calljmp(o:tasmop):boolean;
 
 
     procedure inverse_flags(var f: TResFlags);
     procedure inverse_flags(var f: TResFlags);
@@ -428,17 +372,6 @@ implementation
                                   Helpers
                                   Helpers
 *****************************************************************************}
 *****************************************************************************}
 
 
-    function RefsEqual(Const r1,r2: TReference) : Boolean;
-      begin
-        RefsEqual := (r1.Offset=r2.Offset) and
-                     (r1.Base=r2.Base) and
-                     (r1.Index=r2.Index) and
-                     (r1.symbol=r2.symbol) and
-                     (r1.relsymbol=r2.relsymbol) and
-                     (r1.refaddr=r2.refaddr);
-      end;
-
-
     function is_calljmp(o:tasmop):boolean;
     function is_calljmp(o:tasmop):boolean;
       const
       const
         CallJmpOp=[A_JMPL..A_CBccc];
         CallJmpOp=[A_JMPL..A_CBccc];
@@ -521,7 +454,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.74  2004-10-30 15:21:38  florian
+  Revision 1.75  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.74  2004/10/30 15:21:38  florian
     * fixed generic optimizer
     * fixed generic optimizer
     * enabled generic optimizer for sparc
     * enabled generic optimizer for sparc
 
 

+ 6 - 2
compiler/sparc/cpugas.pas

@@ -39,7 +39,7 @@ implementation
 
 
     uses
     uses
       cutils,systems,
       cutils,systems,
-      verbose,itcpugas,cgbase;
+      verbose,itcpugas,cgbase,cgutils;
 
 
 
 
     function GetReferenceString(var ref:TReference):string;
     function GetReferenceString(var ref:TReference):string;
@@ -189,7 +189,11 @@ begin
 end.
 end.
 {
 {
     $Log$
     $Log$
-    Revision 1.29  2004-10-03 12:42:22  florian
+    Revision 1.30  2004-10-31 21:45:04  peter
+      * generic tlocation
+      * move tlocation to cgutils
+
+    Revision 1.29  2004/10/03 12:42:22  florian
       * made sqrt, sqr and abs internal for the sparc
       * made sqrt, sqr and abs internal for the sparc
 
 
     Revision 1.28  2004/06/20 08:55:32  florian
     Revision 1.28  2004/06/20 08:55:32  florian

+ 5 - 13
compiler/sparc/cpuinfo.pas

@@ -45,18 +45,6 @@ type
 
 
 
 
 const
 const
-{# Size of native extended floating point type }
-{SPARC architecture uses IEEE double floating point numbers}
-  extended_size = 8;
-{# Size of a multimedia register               }
-  mmreg_size = 8;
-{ target cpu string (used by compiler options) }
-  target_cpu_string = 'sparc';
-{ size of the buffer used for setjump/longjmp
-  the size of this buffer is deduced from the
-  jmp_buf structure in setjumph.inc file }
-  JMP_BUF_SIZE = 12+16;
-
   { calling conventions supported by the code generator }
   { calling conventions supported by the code generator }
   supported_calling_conventions : tproccalloptions = [
   supported_calling_conventions : tproccalloptions = [
     pocall_internproc,
     pocall_internproc,
@@ -83,7 +71,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.19  2004-09-21 17:25:13  peter
+  Revision 1.20  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.19  2004/09/21 17:25:13  peter
     * paraloc branch merged
     * paraloc branch merged
 
 
   Revision 1.18.4.1  2004/09/12 12:04:41  peter
   Revision 1.18.4.1  2004/09/12 12:04:41  peter

+ 6 - 2
compiler/sparc/ncpuadd.pas

@@ -50,7 +50,7 @@ interface
       cutils,verbose,
       cutils,verbose,
       paramgr,
       paramgr,
       aasmtai,aasmcpu,defutil,
       aasmtai,aasmcpu,defutil,
-      cgbase,cgcpu,
+      cgbase,cgcpu,cgutils,
       cpupara,
       cpupara,
       ncon,nset,nadd,
       ncon,nset,nadd,
       ncgutil,cgobj;
       ncgutil,cgobj;
@@ -377,7 +377,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.27  2004-09-25 14:23:55  peter
+  Revision 1.28  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.27  2004/09/25 14:23:55  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 10 - 6
compiler/sparc/ncpuinln.pas

@@ -45,14 +45,14 @@ interface
 implementation
 implementation
 
 
     uses
     uses
-      globtype,systems,
-      cutils,verbose,globals,fmodule,
+      systems,
+      cutils,verbose,
       symconst,symdef,
       symconst,symdef,
-      aasmbase,aasmtai,aasmcpu,
-      cgbase,pass_1,pass_2,
+      aasmtai,aasmcpu,
+      cgbase,pass_2,
       cpubase,paramgr,
       cpubase,paramgr,
       nbas,ncon,ncal,ncnv,nld,
       nbas,ncon,ncal,ncnv,nld,
-      tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu;
+      ncgutil,cgobj,cgutils;
 
 
 {*****************************************************************************
 {*****************************************************************************
                               tsparcinlinenode
                               tsparcinlinenode
@@ -150,7 +150,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.10  2004-10-03 12:42:22  florian
+  Revision 1.11  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.10  2004/10/03 12:42:22  florian
     * made sqrt, sqr and abs internal for the sparc
     * made sqrt, sqr and abs internal for the sparc
 
 
   Revision 1.9  2004/06/20 08:55:32  florian
   Revision 1.9  2004/06/20 08:55:32  florian

+ 25 - 21
compiler/sparc/ncpumat.pas

@@ -55,7 +55,7 @@ implementation
       cgbase,cgobj,pass_2,
       cgbase,cgobj,pass_2,
       ncon,
       ncon,
       cpubase,
       cpubase,
-      ncgutil,cgcpu;
+      ncgutil,cgcpu,cgutils;
 
 
 {*****************************************************************************
 {*****************************************************************************
                              TSparcMODDIVNODE
                              TSparcMODDIVNODE
@@ -178,7 +178,7 @@ implementation
     procedure tSparcshlshrnode.pass_2;
     procedure tSparcshlshrnode.pass_2;
       var
       var
         hregister,resultreg,hregister1,
         hregister,resultreg,hregister1,
-        hregisterhigh,hregisterlow : tregister;
+        hreg64hi,hreg64lo : tregister;
         op : topcg;
         op : topcg;
         shiftval: aword;
         shiftval: aword;
       begin
       begin
@@ -196,46 +196,46 @@ implementation
 
 
             { load left operator in a register }
             { load left operator in a register }
             location_force_reg(exprasmlist,left.location,OS_64,false);
             location_force_reg(exprasmlist,left.location,OS_64,false);
-            hregisterhigh:=left.location.registerhigh;
-            hregisterlow:=left.location.registerlow;
+            hreg64hi:=left.location.register64.reghi;
+            hreg64lo:=left.location.register64.reglo;
 
 
             shiftval := tordconstnode(right).value and 63;
             shiftval := tordconstnode(right).value and 63;
             if shiftval > 31 then
             if shiftval > 31 then
               begin
               begin
                 if nodetype = shln then
                 if nodetype = shln then
                   begin
                   begin
-                    cg.a_load_const_reg(exprasmlist,OS_32,0,hregisterhigh);
+                    cg.a_load_const_reg(exprasmlist,OS_32,0,hreg64hi);
                     if (shiftval and 31) <> 0 then
                     if (shiftval and 31) <> 0 then
-                      cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,shiftval and 31,hregisterlow,hregisterlow);
+                      cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,shiftval and 31,hreg64lo,hreg64lo);
                   end
                   end
                 else
                 else
                   begin
                   begin
-                    cg.a_load_const_reg(exprasmlist,OS_32,0,hregisterlow);
+                    cg.a_load_const_reg(exprasmlist,OS_32,0,hreg64lo);
                     if (shiftval and 31) <> 0 then
                     if (shiftval and 31) <> 0 then
-                      cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,shiftval and 31,hregisterhigh,hregisterhigh);
+                      cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,shiftval and 31,hreg64hi,hreg64hi);
                   end;
                   end;
-                location.registerlow:=hregisterhigh;
-                location.registerhigh:=hregisterlow;
+                location.register64.reglo:=hreg64hi;
+                location.register64.reghi:=hreg64lo;
               end
               end
             else
             else
               begin
               begin
                 hregister:=cg.getintregister(exprasmlist,OS_32);
                 hregister:=cg.getintregister(exprasmlist,OS_32);
                 if nodetype = shln then
                 if nodetype = shln then
                   begin
                   begin
-                    cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,32-shiftval,hregisterlow,hregister);
-                    cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,shiftval,hregisterhigh,hregisterhigh);
-                    cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,hregister,hregisterhigh,hregisterhigh);
-                    cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,shiftval,hregisterlow,hregisterlow);
+                    cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,32-shiftval,hreg64lo,hregister);
+                    cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,shiftval,hreg64hi,hreg64hi);
+                    cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,hregister,hreg64hi,hreg64hi);
+                    cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,shiftval,hreg64lo,hreg64lo);
                   end
                   end
                 else
                 else
                   begin
                   begin
-                    cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,32-shiftval,hregisterhigh,hregister);
-                    cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,shiftval,hregisterlow,hregisterlow);
-                    cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,hregister,hregisterlow,hregisterlow);
-                    cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,shiftval,hregisterhigh,hregisterhigh);
+                    cg.a_op_const_reg_reg(exprasmlist,OP_SHL,OS_32,32-shiftval,hreg64hi,hregister);
+                    cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,shiftval,hreg64lo,hreg64lo);
+                    cg.a_op_reg_reg_reg(exprasmlist,OP_OR,OS_32,hregister,hreg64lo,hreg64lo);
+                    cg.a_op_const_reg_reg(exprasmlist,OP_SHR,OS_32,shiftval,hreg64hi,hreg64hi);
                   end;
                   end;
-                location.registerhigh:=hregisterhigh;
-                location.registerlow:=hregisterlow;
+                location.register64.reghi:=hreg64hi;
+                location.register64.reglo:=hreg64lo;
               end;
               end;
           end
           end
         else
         else
@@ -325,7 +325,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.21  2004-09-25 14:23:55  peter
+  Revision 1.22  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.21  2004/09/25 14:23:55  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 8 - 4
compiler/sparc/rgcpu.pas

@@ -28,7 +28,7 @@ unit rgcpu;
 
 
     uses
     uses
       aasmbase,aasmcpu,aasmtai,
       aasmbase,aasmcpu,aasmtai,
-      cgbase,
+      cgbase,cgutils,
       cpubase,
       cpubase,
       rgobj;
       rgobj;
 
 
@@ -44,8 +44,8 @@ unit rgcpu;
 implementation
 implementation
 
 
     uses
     uses
-      verbose, cutils,
-      cgutils,cgobj;
+      verbose,cutils,
+      cgobj;
 
 
     procedure trgcpu.add_constraints(reg:tregister);
     procedure trgcpu.add_constraints(reg:tregister);
       var
       var
@@ -164,7 +164,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.30  2004-10-05 21:29:29  florian
+  Revision 1.31  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.30  2004/10/05 21:29:29  florian
     * fixed generation of refs wiht large offsets, code still broken though
     * fixed generation of refs wiht large offsets, code still broken though
 
 
   Revision 1.29  2004/10/05 20:41:02  peter
   Revision 1.29  2004/10/05 20:41:02  peter

+ 6 - 2
compiler/symdef.pas

@@ -2092,7 +2092,7 @@ implementation
       begin
       begin
          case typ of
          case typ of
            s32real : savesize:=4;
            s32real : savesize:=4;
-           s80real : savesize:=extended_size;
+           s80real : savesize:=10;
            s64real,
            s64real,
            s64currency,
            s64currency,
            s64comp : savesize:=8;
            s64comp : savesize:=8;
@@ -6200,7 +6200,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.260  2004-10-26 15:02:33  peter
+  Revision 1.261  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.260  2004/10/26 15:02:33  peter
     * align arraydef rtti
     * align arraydef rtti
 
 
   Revision 1.259  2004/10/15 09:14:17  mazen
   Revision 1.259  2004/10/15 09:14:17  mazen

+ 8 - 4
compiler/symsym.pas

@@ -37,7 +37,7 @@ interface
        cclasses,symnot,
        cclasses,symnot,
        { aasm }
        { aasm }
        aasmbase,
        aasmbase,
-       cpuinfo,cpubase,cgbase,parabase
+       cpuinfo,cpubase,cgbase,cgutils,parabase
        ;
        ;
 
 
     type
     type
@@ -305,7 +305,7 @@ interface
 implementation
 implementation
 
 
     uses
     uses
-       strings,
+//       strings,
        { global }
        { global }
        verbose,
        verbose,
        { target }
        { target }
@@ -315,7 +315,7 @@ implementation
        { tree }
        { tree }
        node,
        node,
        { aasm }
        { aasm }
-       aasmcpu,
+//       aasmcpu,
        { codegen }
        { codegen }
        paramgr,cresstr,
        paramgr,cresstr,
        procinfo
        procinfo
@@ -2251,7 +2251,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.188  2004-10-15 09:14:17  mazen
+  Revision 1.189  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.188  2004/10/15 09:14:17  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
   - remove $IFDEF FPCPROCVAR and related code
 
 

+ 6 - 4
compiler/symutil.pas

@@ -41,9 +41,7 @@ interface
 implementation
 implementation
 
 
     uses
     uses
-       globtype,
-       cpuinfo,
-       procinfo,
+       globtype,cpuinfo,procinfo,
        symconst;
        symconst;
 
 
 
 
@@ -116,7 +114,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.5  2004-06-20 08:55:30  florian
+  Revision 1.6  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.5  2004/06/20 08:55:30  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.4  2004/03/23 22:34:50  peter
   Revision 1.4  2004/03/23 22:34:50  peter

+ 21 - 5
compiler/tgobj.pas

@@ -36,12 +36,10 @@ unit tgobj;
       cclasses,
       cclasses,
       globals,globtype,
       globals,globtype,
       symtype,
       symtype,
-      cpubase,cpuinfo,cgbase,
+      cpubase,cpuinfo,cgbase,cgutils,
       aasmbase,aasmtai;
       aasmbase,aasmtai;
 
 
     type
     type
-      ttemptypeset = set of ttemptype;
-
       ptemprecord = ^ttemprecord;
       ptemprecord = ^ttemprecord;
       ttemprecord = record
       ttemprecord = record
          temptype   : ttemptype;
          temptype   : ttemptype;
@@ -110,8 +108,10 @@ unit tgobj;
      var
      var
        tg: ttgobj;
        tg: ttgobj;
 
 
+    procedure location_freetemp(list:taasmoutput; const l : tlocation);
+
 
 
-    implementation
+implementation
 
 
     uses
     uses
        cutils,
        cutils,
@@ -138,6 +138,18 @@ unit tgobj;
       );
       );
 
 
 
 
+{*****************************************************************************
+                                    Helpers
+*****************************************************************************}
+
+    procedure location_freetemp(list:taasmoutput; const l : tlocation);
+      begin
+        if (l.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
+         tg.ungetiftemp(list,l.reference);
+      end;
+
+
+
 {*****************************************************************************
 {*****************************************************************************
                                     TTGOBJ
                                     TTGOBJ
 *****************************************************************************}
 *****************************************************************************}
@@ -611,7 +623,11 @@ unit tgobj;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.48  2004-09-21 17:25:12  peter
+  Revision 1.49  2004-10-31 21:45:03  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.48  2004/09/21 17:25:12  peter
     * paraloc branch merged
     * paraloc branch merged
 
 
   Revision 1.47  2004/09/20 15:40:21  peter
   Revision 1.47  2004/09/20 15:40:21  peter

+ 12 - 8
compiler/vis/cpubase.pas

@@ -304,9 +304,9 @@ uses
             LOC_FPUREGISTER, LOC_CFPUREGISTER, LOC_MMREGISTER, LOC_CMMREGISTER,
             LOC_FPUREGISTER, LOC_CFPUREGISTER, LOC_MMREGISTER, LOC_CMMREGISTER,
               LOC_REGISTER,LOC_CREGISTER : (
               LOC_REGISTER,LOC_CREGISTER : (
               case longint of
               case longint of
-                1 : (register,registerhigh : tregister);
-                { overlay a registerlow }
-                2 : (registerlow : tregister);
+                1 : (register,register64.reghi : tregister);
+                { overlay a register64.reglo }
+                2 : (register64.reglo : tregister);
                 { overlay a 64 Bit register type }
                 { overlay a 64 Bit register type }
                 3 : (reg64 : tregister64);
                 3 : (reg64 : tregister64);
                 4 : (register64 : tregister64);
                 4 : (register64 : tregister64);
@@ -315,9 +315,9 @@ uses
 
 
       treglocation = packed record
       treglocation = packed record
         case longint of
         case longint of
-          1 : (register,registerhigh : tregister);
-          { overlay a registerlow }
-          2 : (registerlow : tregister);
+          1 : (register,register64.reghi : tregister);
+          { overlay a register64.reglo }
+          2 : (register64.reglo : tregister);
           { overlay a 64 Bit register type }
           { overlay a 64 Bit register type }
           3 : (reg64 : tregister64);
           3 : (reg64 : tregister64);
           4 : (register64 : tregister64);
           4 : (register64 : tregister64);
@@ -341,7 +341,7 @@ uses
             LOC_FPUREGISTER, LOC_CFPUREGISTER, LOC_MMREGISTER, LOC_CMMREGISTER,
             LOC_FPUREGISTER, LOC_CFPUREGISTER, LOC_MMREGISTER, LOC_CMMREGISTER,
               LOC_REGISTER,LOC_CREGISTER : (
               LOC_REGISTER,LOC_CREGISTER : (
                 case longint of
                 case longint of
-                  1 : (registerlow,registerhigh : tregister);
+                  1 : (register64.reglo,register64.reghi : tregister);
                   2 : (register : tregister);
                   2 : (register : tregister);
                   { overlay a 64 Bit register type }
                   { overlay a 64 Bit register type }
                   3 : (reg64 : tregister64);
                   3 : (reg64 : tregister64);
@@ -644,7 +644,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.6  2004-06-20 08:55:32  florian
+  Revision 1.7  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.6  2004/06/20 08:55:32  florian
     * logs truncated
     * logs truncated
 
 
 }
 }

+ 10 - 5
compiler/x86/aasmcpu.pas

@@ -33,8 +33,8 @@ interface
     uses
     uses
       cclasses,globtype,globals,verbose,
       cclasses,globtype,globals,verbose,
       cpuinfo,cpubase,
       cpuinfo,cpubase,
-      cgbase,
-      symtype,symsym,
+      cgbase,cgutils,
+      symtype,
       aasmbase,aasmtai;
       aasmbase,aasmtai;
 
 
     const
     const
@@ -134,7 +134,7 @@ interface
 
 
     type
     type
       { What an instruction can change. Needed for optimizer and spilling code.
       { What an instruction can change. Needed for optimizer and spilling code.
-      
+
         Note: The order of this enumeration is should not be changed! }
         Note: The order of this enumeration is should not be changed! }
       TInsChange = (Ch_None,
       TInsChange = (Ch_None,
         {Read from a register}
         {Read from a register}
@@ -278,7 +278,8 @@ implementation
 
 
      uses
      uses
        cutils,
        cutils,
-       itcpugas;
+       itcpugas,
+       symsym;
 
 
 {*****************************************************************************
 {*****************************************************************************
                               Instruction table
                               Instruction table
@@ -2110,7 +2111,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.61  2004-10-04 21:11:24  peter
+  Revision 1.62  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.61  2004/10/04 21:11:24  peter
     * reverted a minor move in the order of tinschange. The order
     * reverted a minor move in the order of tinschange. The order
       is required by the optimizer. Added also a remark
       is required by the optimizer. Added also a remark
 
 

+ 6 - 3
compiler/x86/agx86att.pas

@@ -30,7 +30,7 @@ interface
 
 
     uses
     uses
       cclasses,cpubase,
       cclasses,cpubase,
-      globals,
+      globals,cgutils,
       aasmbase,aasmtai,assemble,aggas;
       aasmbase,aasmtai,assemble,aggas;
 
 
     type
     type
@@ -50,7 +50,6 @@ interface
       cutils,systems,
       cutils,systems,
       verbose,
       verbose,
       itcpugas,
       itcpugas,
-      cpuinfo,
       cgbase,
       cgbase,
       aasmcpu;
       aasmcpu;
 
 
@@ -280,7 +279,11 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2004-06-29 21:00:08  peter
+  Revision 1.17  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.16  2004/06/29 21:00:08  peter
     * only enable dwarf for supported platforms
     * only enable dwarf for supported platforms
 
 
   Revision 1.15  2004/06/20 08:55:32  florian
   Revision 1.15  2004/06/20 08:55:32  florian

+ 6 - 2
compiler/x86/cga.pas

@@ -29,7 +29,7 @@ interface
 
 
     uses
     uses
        globtype,
        globtype,
-       cpuinfo,cpubase,cgbase,
+       cpuinfo,cpubase,cgbase,cgutils,
        symconst,symtype,symdef,aasmbase,aasmtai,aasmcpu;
        symconst,symtype,symdef,aasmbase,aasmtai,aasmcpu;
 
 
     procedure emit_none(i : tasmop;s : topsize);
     procedure emit_none(i : tasmop;s : topsize);
@@ -129,7 +129,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.9  2004-06-20 08:55:32  florian
+  Revision 1.10  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.9  2004/06/20 08:55:32  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.8  2004/06/16 20:07:11  florian
   Revision 1.8  2004/06/16 20:07:11  florian

+ 6 - 3
compiler/x86/cgx86.pas

@@ -30,7 +30,7 @@ unit cgx86;
 
 
     uses
     uses
        globtype,
        globtype,
-       cgbase,cgobj,
+       cgbase,cgutils,cgobj,
        aasmbase,aasmtai,aasmcpu,
        aasmbase,aasmtai,aasmcpu,
        cpubase,cpuinfo,rgobj,rgx86,rgcpu,
        cpubase,cpuinfo,rgobj,rgx86,rgcpu,
        symconst,symtype;
        symconst,symtype;
@@ -150,7 +150,6 @@ unit cgx86;
 
 
     uses
     uses
        globals,verbose,systems,cutils,
        globals,verbose,systems,cutils,
-       cgutils,
        dwarf,
        dwarf,
        symdef,defutil,paramgr,tgobj,procinfo;
        symdef,defutil,paramgr,tgobj,procinfo;
 
 
@@ -1627,7 +1626,11 @@ unit cgx86;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.132  2004-10-25 15:36:47  peter
+  Revision 1.133  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.132  2004/10/25 15:36:47  peter
     * save standard registers moved to tcgobj
     * save standard registers moved to tcgobj
 
 
   Revision 1.131  2004/10/24 20:10:08  peter
   Revision 1.131  2004/10/24 20:10:08  peter

+ 6 - 93
compiler/x86/cpubase.pas

@@ -36,9 +36,7 @@ interface
 
 
 uses
 uses
   cutils,cclasses,
   cutils,cclasses,
-  globtype,globals,
-  cpuinfo,
-  aasmbase,
+  globtype,
   cgbase
   cgbase
   ;
   ;
 
 
@@ -226,95 +224,6 @@ uses
                    F_A,F_AE,F_B,F_BE,
                    F_A,F_AE,F_B,F_BE,
                    F_S,F_NS,F_O,F_NO);
                    F_S,F_NS,F_O,F_NO);
 
 
-{*****************************************************************************
-                                Reference
-*****************************************************************************}
-
-    type
-      { reference record, reordered for best alignment }
-      preference = ^treference;
-      treference = record
-         offset      : aint;
-         symbol,
-         relsymbol   : tasmsymbol;
-         segment,
-         base,
-         index       : tregister;
-         refaddr     : trefaddr;
-         scalefactor : byte;
-      end;
-
-      { reference record }
-      pparareference = ^tparareference;
-      tparareference = packed record
-         index       : tregister;
-         offset      : aint;
-      end;
-
-{*****************************************************************************
-                               Generic Location
-*****************************************************************************}
-
-    type
-      { tparamlocation describes where a parameter for a procedure is stored.
-        References are given from the caller's point of view. The usual
-        TLocation isn't used, because contains a lot of unnessary fields.
-      }
-      tparalocation = record
-         size : TCGSize;
-         loc  : TCGLoc;
-         { Location type of registerhigh, for x86_64 this can
-           be different from loc when pushing structures of 16 bytes }
-         lochigh : TCGLoc;
-         alignment : byte;
-         case TCGLoc of
-            LOC_REFERENCE : (reference : tparareference);
-            { segment in reference at the same place as in loc_register }
-            LOC_REGISTER,LOC_CREGISTER : (
-              case longint of
-                1 : (register,registerhigh : tregister);
-                { overlay a registerlow }
-                2 : (registerlow : tregister);
-{$ifndef cpu64bit}
-                { overlay a 64 Bit register type }
-                3 : (register64 : tregister64);
-{$endif cpu64bit}
-              );
-            { it's only for better handling }
-            LOC_MMXREGISTER,LOC_CMMXREGISTER : (
-              case longint of
-              0: (mmxreg : tregister);
-              1: (mmxregset : Tregistermmxset);
-            );
-      end;
-
-      tlocation = packed 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)              }
-                { overlay a complete 64 Bit value }
-                2 : (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,registerhigh,segment : tregister);
-                { overlay a registerlow }
-                2 : (registerlow : tregister);
-                { overlay a 64 Bit register type }
-                3 : (register64 : tregister64);
-              );
-            { it's only for better handling }
-            LOC_MMXREGISTER,LOC_CMMXREGISTER : (mmxreg : tregister);
-      end;
 
 
 {*****************************************************************************
 {*****************************************************************************
                                  Constants
                                  Constants
@@ -539,7 +448,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.48  2004-10-25 15:36:47  peter
+  Revision 1.49  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.48  2004/10/25 15:36:47  peter
     * save standard registers moved to tcgobj
     * save standard registers moved to tcgobj
 
 
   Revision 1.47  2004/10/15 09:22:23  mazen
   Revision 1.47  2004/10/15 09:22:23  mazen

+ 7 - 3
compiler/x86/nx86add.pas

@@ -67,9 +67,9 @@ unit nx86add;
       cpuinfo,
       cpuinfo,
       aasmbase,aasmtai,aasmcpu,
       aasmbase,aasmtai,aasmcpu,
       symconst,symdef,
       symconst,symdef,
-      cgobj,cgx86,cga,
+      cgobj,cgx86,cga,cgutils,
       paramgr,parabase,
       paramgr,parabase,
-      htypechk,
+      htypechk,tgobj,
       pass_2,ncgutil,
       pass_2,ncgutil,
       ncon,nset,
       ncon,nset,
       defutil;
       defutil;
@@ -906,7 +906,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.13  2004-09-25 14:23:55  peter
+  Revision 1.14  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.13  2004/09/25 14:23:55  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 8 - 4
compiler/x86/nx86cnv.pas

@@ -59,7 +59,7 @@ interface
 implementation
 implementation
 
 
    uses
    uses
-      verbose,systems,globals,
+      verbose,systems,globals,globtype,
       aasmbase,aasmtai,aasmcpu,
       aasmbase,aasmtai,aasmcpu,
       symconst,symdef,
       symconst,symdef,
       cgbase,cga,pass_2,
       cgbase,cga,pass_2,
@@ -152,8 +152,8 @@ implementation
                 if left.location.size in [OS_64,OS_S64] then
                 if left.location.size in [OS_64,OS_S64] then
                  begin
                  begin
                    hregister:=cg.getintregister(exprasmlist,OS_32);
                    hregister:=cg.getintregister(exprasmlist,OS_32);
-                   cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,left.location.registerlow,hregister);
-                   cg.a_op_reg_reg(exprasmlist,OP_OR,OS_32,left.location.registerhigh,hregister);
+                   cg.a_load_reg_reg(exprasmlist,OS_32,OS_32,left.location.register64.reglo,hregister);
+                   cg.a_op_reg_reg(exprasmlist,OP_OR,OS_32,left.location.register64.reghi,hregister);
                  end
                  end
                 else
                 else
 {$endif cpu64bit}
 {$endif cpu64bit}
@@ -292,7 +292,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2004-09-30 19:32:19  hajny
+  Revision 1.17  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.16  2004/09/30 19:32:19  hajny
     * explicit typecast added to avoid range check error
     * explicit typecast added to avoid range check error
 
 
   Revision 1.15  2004/09/26 09:12:50  florian
   Revision 1.15  2004/09/26 09:12:50  florian

+ 6 - 2
compiler/x86/nx86inl.pas

@@ -63,7 +63,7 @@ implementation
 
 
     uses
     uses
       systems,
       systems,
-      globtype,globals,
+      globals,
       cutils,verbose,
       cutils,verbose,
       defutil,
       defutil,
       aasmtai,aasmcpu,
       aasmtai,aasmcpu,
@@ -344,7 +344,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.6  2004-09-25 14:23:55  peter
+  Revision 1.7  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.6  2004/09/25 14:23:55  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 9 - 5
compiler/x86/nx86mat.pas

@@ -48,13 +48,13 @@ interface
   implementation
   implementation
 
 
     uses
     uses
-      globtype,systems,
+      systems,
       cutils,verbose,globals,
       cutils,verbose,globals,
-      symconst,symdef,aasmbase,aasmtai,defutil,
+      symconst,aasmbase,aasmtai,defutil,
       cgbase,pass_1,pass_2,
       cgbase,pass_1,pass_2,
       ncon,
       ncon,
-      cpubase,cpuinfo,
-      cga,ncgutil,cgobj,cgx86;
+      cpubase,
+      cga,ncgutil,cgobj,cgx86,cgutils;
 
 
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -304,7 +304,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.6  2004-09-25 14:23:55  peter
+  Revision 1.7  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.6  2004/09/25 14:23:55  peter
     * ungetregister is now only used for cpuregisters, renamed to
     * ungetregister is now only used for cpuregisters, renamed to
       ungetcpuregister
       ungetcpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister
     * renamed (get|unget)explicitregister(s) to ..cpuregister

+ 7 - 3
compiler/x86/nx86set.pas

@@ -44,10 +44,10 @@ implementation
       verbose,globals,
       verbose,globals,
       symconst,symdef,defutil,
       symconst,symdef,defutil,
       aasmbase,aasmtai,aasmcpu,
       aasmbase,aasmtai,aasmcpu,
-      cgbase,pass_2,
+      cgbase,pass_2,tgobj,
       ncon,
       ncon,
       cpubase,
       cpubase,
-      cga,cgobj,ncgutil,
+      cga,cgobj,cgutils,ncgutil,
       cgx86;
       cgx86;
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -463,7 +463,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.7  2004-10-24 20:10:08  peter
+  Revision 1.8  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.7  2004/10/24 20:10:08  peter
     * -Or fixes
     * -Or fixes
 
 
   Revision 1.6  2004/10/01 17:32:16  peter
   Revision 1.6  2004/10/01 17:32:16  peter

+ 6 - 2
compiler/x86/rax86.pas

@@ -84,7 +84,7 @@ implementation
 
 
 uses
 uses
   globtype,globals,systems,verbose,
   globtype,globals,systems,verbose,
-  cpuinfo,cgbase,
+  cpuinfo,cgbase,cgutils,
   itcpugas,cgx86;
   itcpugas,cgx86;
 
 
 {$define ATTOP}
 {$define ATTOP}
@@ -742,7 +742,11 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.19  2004-06-20 08:55:32  florian
+  Revision 1.20  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.19  2004/06/20 08:55:32  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.18  2004/06/16 20:07:11  florian
   Revision 1.18  2004/06/16 20:07:11  florian

+ 7 - 3
compiler/x86/rax86att.pas

@@ -51,9 +51,9 @@ Implementation
       globtype,globals,verbose,
       globtype,globals,verbose,
       systems,
       systems,
       { aasm }
       { aasm }
-      cpuinfo,aasmbase,aasmtai,aasmcpu,
+      aasmbase,aasmtai,aasmcpu,
       { symtable }
       { symtable }
-      symconst,symbase,symtype,symsym,symtable,
+      symconst,symsym,
       { parser }
       { parser }
       scanner,
       scanner,
       procinfo,
       procinfo,
@@ -788,7 +788,11 @@ Implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.5  2004-06-20 08:55:32  florian
+  Revision 1.6  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.5  2004/06/20 08:55:32  florian
     * logs truncated
     * logs truncated
 
 
   Revision 1.4  2004/06/16 20:07:11  florian
   Revision 1.4  2004/06/16 20:07:11  florian

+ 8 - 4
compiler/x86/rgx86.pas

@@ -29,10 +29,10 @@ unit rgx86;
   interface
   interface
 
 
     uses
     uses
-      cpubase,
-      cpuinfo,
+      cclasses,globtype,
+      cpubase,cpuinfo,cgbase,cgutils,
       aasmbase,aasmtai,aasmcpu,
       aasmbase,aasmtai,aasmcpu,
-      cclasses,globtype,cgbase,rgobj;
+      rgobj;
 
 
     type
     type
        trgx86 = class(trgobj)
        trgx86 = class(trgobj)
@@ -315,7 +315,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.9  2004-10-10 16:30:26  peter
+  Revision 1.10  2004-10-31 21:45:04  peter
+    * generic tlocation
+    * move tlocation to cgutils
+
+  Revision 1.9  2004/10/10 16:30:26  peter
     * optimized spilling writing when the reg operand can be
     * optimized spilling writing when the reg operand can be
       replaced by reference
       replaced by reference