Explorar o código

* powerpc target fixed, very simple units can be compiled
* some basic stuff for better callparanode handling, far from being finished

florian %!s(int64=23) %!d(string=hai) anos
pai
achega
07783d2a0d

+ 6 - 2
compiler/aasmbase.pas

@@ -20,7 +20,7 @@
 
 
  ****************************************************************************
  ****************************************************************************
 }
 }
-{# @abstract(This unit implements an abstract asm output class for all processor types)
+{ @abstract(This unit implements an abstract asm output class for all processor types)
   This unit implements an abstract assembler output class for all processors, these
   This unit implements an abstract assembler output class for all processors, these
   are then overriden for each assembler writer to actually write the data in these
   are then overriden for each assembler writer to actually write the data in these
   classes to an assembler file.
   classes to an assembler file.
@@ -781,7 +781,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.1  2002-07-01 18:46:20  peter
+  Revision 1.2  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.1  2002/07/01 18:46:20  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 6 - 2
compiler/aggas.pas

@@ -20,7 +20,7 @@
 
 
  ****************************************************************************
  ****************************************************************************
 }
 }
-{# Base unit for writing GNU assembler output.
+{ Base unit for writing GNU assembler output.
 }
 }
 unit aggas;
 unit aggas;
 
 
@@ -796,7 +796,11 @@ var
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.6  2002-07-01 18:46:20  peter
+  Revision 1.7  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.6  2002/07/01 18:46:20  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 7 - 2
compiler/aoptbase.pas

@@ -25,7 +25,8 @@ unit aoptbase;
 
 
 Interface
 Interface
 
 
-uses aasm, cpuasm,cpubase;
+uses aasmbase,aasmcpu,aasmtai,
+  cpubase;
 
 
 { the number of tai objects processed by an optimizer object since the last }
 { the number of tai objects processed by an optimizer object since the last }
 { time a register was modified                                              }
 { time a register was modified                                              }
@@ -261,7 +262,11 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.5  2002-05-18 13:34:05  peter
+  Revision 1.6  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.5  2002/05/18 13:34:05  peter
     * readded missing revisions
     * readded missing revisions
 
 
   Revision 1.4  2002/05/16 19:46:34  carl
   Revision 1.4  2002/05/16 19:46:34  carl

+ 8 - 3
compiler/aoptobj.pas

@@ -29,7 +29,8 @@ Unit AoptObj;
 
 
 Interface
 Interface
 
 
-uses aasm, cclasses, cpuinfo, cpubase, cpuasm, aoptbase, aoptcpub;
+uses aasmbase,aasmcpu,aasmtai,
+  cclasses, cpuinfo, cpubase, aoptbase, aoptcpub;
 
 
 { ************************************************************************* }
 { ************************************************************************* }
 { ********************************* Constants ***************************** }
 { ********************************* Constants ***************************** }
@@ -277,7 +278,7 @@ Type
 
 
 Implementation
 Implementation
 
 
-uses globtype, globals, cgbase, tainst;
+uses globtype, globals, cgbase;
 
 
 { ************************************************************************* }
 { ************************************************************************* }
 { ******************************** TUsedRegs ****************************** }
 { ******************************** TUsedRegs ****************************** }
@@ -787,7 +788,11 @@ End.
 
 
 {
 {
  $Log$
  $Log$
- Revision 1.5  2002-07-01 18:46:21  peter
+ Revision 1.6  2002-07-07 09:52:32  florian
+   * powerpc target fixed, very simple units can be compiled
+   * some basic stuff for better callparanode handling, far from being finished
+
+ Revision 1.5  2002/07/01 18:46:21  peter
    * internal linker
    * internal linker
    * reorganized aasm layer
    * reorganized aasm layer
 
 

+ 26 - 18
compiler/cg64f32.pas

@@ -63,10 +63,10 @@ unit cg64f32;
         procedure a_op64_reg_loc(list : taasmoutput;op:TOpCG;reg : tregister64;const l : tlocation);override;
         procedure a_op64_reg_loc(list : taasmoutput;op:TOpCG;reg : tregister64;const l : tlocation);override;
         procedure a_op64_loc_reg(list : taasmoutput;op:TOpCG;const l : tlocation;reg : tregister64);override;
         procedure a_op64_loc_reg(list : taasmoutput;op:TOpCG;const l : tlocation;reg : tregister64);override;
 
 
-        procedure a_param64_reg(list : taasmoutput;reg : tregister64;nr : longint);override;
-        procedure a_param64_const(list : taasmoutput;value : qword;nr : longint);override;
-        procedure a_param64_ref(list : taasmoutput;const r : treference;nr : longint);override;
-        procedure a_param64_loc(list : taasmoutput;const l : tlocation;nr : longint);override;
+        procedure a_param64_reg(list : taasmoutput;reg : tregister64;const locpara : tparalocation);override;
+        procedure a_param64_const(list : taasmoutput;value : qword;const locpara : tparalocation);override;
+        procedure a_param64_ref(list : taasmoutput;const r : treference;const locpara : tparalocation);override;
+        procedure a_param64_loc(list : taasmoutput;const l : tlocation;const locpara : tparalocation);override;
 
 
         procedure g_rangecheck64(list: taasmoutput; const p: tnode;
         procedure g_rangecheck64(list: taasmoutput; const p: tnode;
           const todef: tdef); override;
           const todef: tdef); override;
@@ -364,56 +364,60 @@ unit cg64f32;
       end;
       end;
 
 
 
 
-    procedure tcg64f32.a_param64_reg(list : taasmoutput;reg : tregister64;nr : longint);
+    procedure tcg64f32.a_param64_reg(list : taasmoutput;reg : tregister64;const locpara : tparalocation);
       begin
       begin
-         cg.a_param_reg(list,OS_32,reg.reghi,nr);
+{$warning FIX ME}
+         cg.a_param_reg(list,OS_32,reg.reghi,locpara);
          { the nr+1 needs definitivly a fix FK }
          { the nr+1 needs definitivly a fix FK }
          { maybe the parameter numbering needs }
          { maybe the parameter numbering needs }
          { to take care of this on 32 Bit      }
          { to take care of this on 32 Bit      }
          { systems FK                          }
          { systems FK                          }
-         cg.a_param_reg(list,OS_32,reg.reglo,nr+1);
+         cg.a_param_reg(list,OS_32,reg.reglo,locpara);
       end;
       end;
 
 
 
 
-    procedure tcg64f32.a_param64_const(list : taasmoutput;value : qword;nr : longint);
+    procedure tcg64f32.a_param64_const(list : taasmoutput;value : qword;const locpara : tparalocation);
       begin
       begin
+{$warning FIX ME}
         if target_info.endian<>source_info.endian then
         if target_info.endian<>source_info.endian then
           swap_qword(value);
           swap_qword(value);
-         cg.a_param_const(list,OS_32,hi(value),nr);
+         cg.a_param_const(list,OS_32,hi(value),locpara);
          { the nr+1 needs definitivly a fix FK }
          { the nr+1 needs definitivly a fix FK }
          { maybe the parameter numbering needs }
          { maybe the parameter numbering needs }
          { to take care of this on 32 Bit      }
          { to take care of this on 32 Bit      }
          { systems FK                          }
          { systems FK                          }
-         cg.a_param_const(list,OS_32,lo(value),nr+1);
+         cg.a_param_const(list,OS_32,lo(value),locpara);
       end;
       end;
 
 
 
 
-    procedure tcg64f32.a_param64_ref(list : taasmoutput;const r : treference;nr : longint);
+    procedure tcg64f32.a_param64_ref(list : taasmoutput;const r : treference;const locpara : tparalocation);
       var
       var
         tmpref: treference;
         tmpref: treference;
       begin
       begin
+{$warning FIX ME}
         tmpref := r;
         tmpref := r;
         inc(tmpref.offset,4);
         inc(tmpref.offset,4);
-        cg.a_param_ref(list,OS_32,tmpref,nr);
+        cg.a_param_ref(list,OS_32,tmpref,locpara);
         { the nr+1 needs definitivly a fix FK }
         { the nr+1 needs definitivly a fix FK }
         { maybe the parameter numbering needs }
         { maybe the parameter numbering needs }
         { to take care of this on 32 Bit      }
         { to take care of this on 32 Bit      }
         { systems FK                          }
         { systems FK                          }
-        cg.a_param_ref(list,OS_32,r,nr+1);
+        cg.a_param_ref(list,OS_32,r,locpara);
       end;
       end;
 
 
 
 
-    procedure tcg64f32.a_param64_loc(list : taasmoutput;const l:tlocation;nr : longint);
+    procedure tcg64f32.a_param64_loc(list : taasmoutput;const l:tlocation;const locpara : tparalocation);
       begin
       begin
+{$warning FIX ME}
         case l.loc of
         case l.loc of
           LOC_REGISTER,
           LOC_REGISTER,
           LOC_CREGISTER :
           LOC_CREGISTER :
-            a_param64_reg(list,l.register64,nr);
+            a_param64_reg(list,l.register64,locpara);
           LOC_CONSTANT :
           LOC_CONSTANT :
-            a_param64_const(list,l.valueqword,nr);
+            a_param64_const(list,l.valueqword,locpara);
           LOC_CREFERENCE,
           LOC_CREFERENCE,
           LOC_REFERENCE :
           LOC_REFERENCE :
-            a_param64_ref(list,l.reference,nr);
+            a_param64_ref(list,l.reference,locpara);
         else
         else
           internalerror(200203287);
           internalerror(200203287);
         end;
         end;
@@ -587,7 +591,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.16  2002-07-01 18:46:21  peter
+  Revision 1.17  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.16  2002/07/01 18:46:21  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 12 - 3
compiler/cginfo.pas

@@ -93,15 +93,24 @@ interface
        tcgsize2tfloat: array[OS_F32..OS_C64] of tfloattype =
        tcgsize2tfloat: array[OS_F32..OS_C64] of tfloattype =
          (s32real,s64real,s80real,s64comp);
          (s32real,s64real,s80real,s64comp);
 
 
-
-
+       { Table to convert tcgsize variables to the correspondending
+         unsigned types }
+       tcgsize2unsigned : array[tcgsize] of tcgsize = (OS_NO,
+          OS_8,OS_16,OS_32,OS_64,OS_8,OS_16,OS_32,OS_64,
+          OS_F32,OS_F64,OS_F80,OS_C64,
+          OS_M8,OS_M16,OS_M32,OS_M64,OS_M128,OS_M8,OS_M16,OS_M32,
+          OS_M64,OS_M128);
 
 
 implementation
 implementation
 
 
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.12  2002-07-01 16:23:52  peter
+  Revision 1.13  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.12  2002/07/01 16:23:52  peter
     * cg64 patch
     * cg64 patch
     * basics for currency
     * basics for currency
     * asnode updates for class and interface (not finished)
     * asnode updates for class and interface (not finished)

+ 60 - 54
compiler/cgobj.pas

@@ -33,7 +33,7 @@ unit cgobj;
 
 
     uses
     uses
        cclasses,aasmbase,aasmtai,aasmcpu,symtable,
        cclasses,aasmbase,aasmtai,aasmcpu,symtable,
-       cpubase,cpuinfo,
+       cpubase,cpuinfo,cpupara,
        cginfo,
        cginfo,
        symconst,symbase,symtype,node;
        symconst,symbase,symtype,node;
 
 
@@ -109,7 +109,7 @@ unit cgobj;
              @param(r register source of the operand)
              @param(r register source of the operand)
              @param(nr parameter number (starting from one) of routine (from left to right))
              @param(nr parameter number (starting from one) of routine (from left to right))
           }
           }
-          procedure a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;nr : longint);virtual; abstract;
+          procedure a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;const locpara : tparalocation);virtual; abstract;
           {# Pass a parameter, which is a constant, to a routine.
           {# Pass a parameter, which is a constant, to a routine.
 
 
              A generic version is provided.
              A generic version is provided.
@@ -118,7 +118,7 @@ unit cgobj;
              @param(a value of constant to send)
              @param(a value of constant to send)
              @param(nr parameter number (starting from one) of routine (from left to right))
              @param(nr parameter number (starting from one) of routine (from left to right))
           }
           }
-          procedure a_param_const(list : taasmoutput;size : tcgsize;a : aword;nr : longint);virtual;
+          procedure a_param_const(list : taasmoutput;size : tcgsize;a : aword;const locpara : tparalocation);virtual;
           {# Pass the value of a parameter, which is located in memory, to a routine.
           {# Pass the value of a parameter, which is located in memory, to a routine.
 
 
              A generic version is provided.
              A generic version is provided.
@@ -127,7 +127,7 @@ unit cgobj;
              @param(r Memory reference of value to send)
              @param(r Memory reference of value to send)
              @param(nr parameter number (starting from one) of routine (from left to right))
              @param(nr parameter number (starting from one) of routine (from left to right))
           }
           }
-          procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;nr : longint);virtual;
+          procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const locpara : tparalocation);virtual;
           {# Pass the value of a parameter, which can be located either in a register or memory location,
           {# Pass the value of a parameter, which can be located either in a register or memory location,
              to a routine.
              to a routine.
 
 
@@ -136,7 +136,7 @@ unit cgobj;
              @param(l location of the operand to send)
              @param(l location of the operand to send)
              @param(nr parameter number (starting from one) of routine (from left to right))
              @param(nr parameter number (starting from one) of routine (from left to right))
           }
           }
-          procedure a_param_loc(list : taasmoutput;const l : tlocation;nr : longint);
+          procedure a_param_loc(list : taasmoutput;const l : tlocation;const locpara : tparalocation);
           {# Pass the address of a reference to a routine.
           {# Pass the address of a reference to a routine.
 
 
              A generic version is provided.
              A generic version is provided.
@@ -144,7 +144,7 @@ unit cgobj;
              @param(r reference to get address from)
              @param(r reference to get address from)
              @param(nr parameter number (starting from one) of routine (from left to right))
              @param(nr parameter number (starting from one) of routine (from left to right))
           }
           }
-          procedure a_paramaddr_ref(list : taasmoutput;const r : treference;nr : longint);virtual;
+          procedure a_paramaddr_ref(list : taasmoutput;const r : treference;const locpara : tparalocation);virtual;
 
 
           {**********************************}
           {**********************************}
           { these methods must be overriden: }
           { these methods must be overriden: }
@@ -366,10 +366,10 @@ unit cgobj;
         procedure a_op64_reg_loc(list : taasmoutput;op:TOpCG;reg : tregister64;const l : tlocation);virtual;abstract;
         procedure a_op64_reg_loc(list : taasmoutput;op:TOpCG;reg : tregister64;const l : tlocation);virtual;abstract;
         procedure a_op64_loc_reg(list : taasmoutput;op:TOpCG;const l : tlocation;reg64 : tregister64);virtual;abstract;
         procedure a_op64_loc_reg(list : taasmoutput;op:TOpCG;const l : tlocation;reg64 : tregister64);virtual;abstract;
 
 
-        procedure a_param64_reg(list : taasmoutput;reg64 : tregister64;nr : longint);virtual;abstract;
-        procedure a_param64_const(list : taasmoutput;value : qword;nr : longint);virtual;abstract;
-        procedure a_param64_ref(list : taasmoutput;const r : treference;nr : longint);virtual;abstract;
-        procedure a_param64_loc(list : taasmoutput;const l : tlocation;nr : longint);virtual;abstract;
+        procedure a_param64_reg(list : taasmoutput;reg64 : tregister64;const loc : tparalocation);virtual;abstract;
+        procedure a_param64_const(list : taasmoutput;value : qword;const loc : tparalocation);virtual;abstract;
+        procedure a_param64_ref(list : taasmoutput;const r : treference;const loc : tparalocation);virtual;abstract;
+        procedure a_param64_loc(list : taasmoutput;const l : tlocation;const loc : tparalocation);virtual;abstract;
 
 
         { override to catch 64bit rangechecks }
         { override to catch 64bit rangechecks }
         procedure g_rangecheck64(list: taasmoutput; const p: tnode;
         procedure g_rangecheck64(list: taasmoutput; const p: tnode;
@@ -467,7 +467,7 @@ unit cgobj;
           for better code generation these methods should be overridden
           for better code generation these methods should be overridden
 ******************************************************************************}
 ******************************************************************************}
 
 
-    procedure tcg.a_param_const(list : taasmoutput;size : tcgsize;a : aword;nr : longint);
+    procedure tcg.a_param_const(list : taasmoutput;size : tcgsize;a : aword;const locpara : tparalocation);
 
 
       var
       var
          hr : tregister;
          hr : tregister;
@@ -475,11 +475,11 @@ unit cgobj;
       begin
       begin
          hr:=get_scratch_reg_int(list);
          hr:=get_scratch_reg_int(list);
          a_load_const_reg(list,size,a,hr);
          a_load_const_reg(list,size,a,hr);
-         a_param_reg(list,size,hr,nr);
+         a_param_reg(list,size,hr,locpara);
          free_scratch_reg(list,hr);
          free_scratch_reg(list,hr);
       end;
       end;
 
 
-    procedure tcg.a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;nr : longint);
+    procedure tcg.a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const locpara : tparalocation);
 
 
       var
       var
          hr : tregister;
          hr : tregister;
@@ -487,30 +487,30 @@ unit cgobj;
       begin
       begin
          hr:=get_scratch_reg_int(list);
          hr:=get_scratch_reg_int(list);
          a_load_ref_reg(list,size,r,hr);
          a_load_ref_reg(list,size,r,hr);
-         a_param_reg(list,size,hr,nr);
+         a_param_reg(list,size,hr,locpara);
          free_scratch_reg(list,hr);
          free_scratch_reg(list,hr);
       end;
       end;
 
 
 
 
-    procedure tcg.a_param_loc(list : taasmoutput;const l:tlocation;nr : longint);
+    procedure tcg.a_param_loc(list : taasmoutput;const l:tlocation;const locpara : tparalocation);
 
 
       begin
       begin
         case l.loc of
         case l.loc of
           LOC_REGISTER,
           LOC_REGISTER,
           LOC_CREGISTER :
           LOC_CREGISTER :
-            a_param_reg(list,l.size,l.register,nr);
+            a_param_reg(list,l.size,l.register,locpara);
           LOC_CONSTANT :
           LOC_CONSTANT :
-            a_param_const(list,l.size,l.value,nr);
+            a_param_const(list,l.size,l.value,locpara);
           LOC_CREFERENCE,
           LOC_CREFERENCE,
           LOC_REFERENCE :
           LOC_REFERENCE :
-            a_param_ref(list,l.size,l.reference,nr);
+            a_param_ref(list,l.size,l.reference,locpara);
         else
         else
           internalerror(2002032211);
           internalerror(2002032211);
         end;
         end;
       end;
       end;
 
 
 
 
-    procedure tcg.a_paramaddr_ref(list : taasmoutput;const r : treference;nr : longint);
+    procedure tcg.a_paramaddr_ref(list : taasmoutput;const r : treference;const locpara : tparalocation);
 
 
       var
       var
          hr : tregister;
          hr : tregister;
@@ -518,7 +518,7 @@ unit cgobj;
       begin
       begin
          hr:=get_scratch_reg_address(list);
          hr:=get_scratch_reg_address(list);
          a_loadaddr_ref_reg(list,r,hr);
          a_loadaddr_ref_reg(list,r,hr);
-         a_param_reg(list,OS_ADDR,hr,nr);
+         a_param_reg(list,OS_ADDR,hr,locpara);
          free_scratch_reg(list,hr);
          free_scratch_reg(list,hr);
       end;
       end;
 
 
@@ -894,14 +894,15 @@ unit cgobj;
 
 
     procedure tcg.g_copyshortstring(list : taasmoutput;const source,dest : treference;len:byte;delsource,loadref : boolean);
     procedure tcg.g_copyshortstring(list : taasmoutput;const source,dest : treference;len:byte;delsource,loadref : boolean);
       begin
       begin
-        a_paramaddr_ref(list,dest,3);
+        {$warning FIX ME!}
+        a_paramaddr_ref(list,dest,getintparaloc(3));
         if loadref then
         if loadref then
-         a_param_ref(list,OS_ADDR,source,2)
+          a_param_ref(list,OS_ADDR,source,getintparaloc(2))
         else
         else
-         a_paramaddr_ref(list,source,2);
+          a_paramaddr_ref(list,source,getintparaloc(2));
         if delsource then
         if delsource then
          reference_release(list,source);
          reference_release(list,source);
-        a_param_const(list,OS_INT,len,1);
+        a_param_const(list,OS_INT,len,getintparaloc(1));
         a_call_name(list,'FPC_SHORTSTR_COPY');
         a_call_name(list,'FPC_SHORTSTR_COPY');
         g_maybe_loadself(list);
         g_maybe_loadself(list);
       end;
       end;
@@ -927,14 +928,14 @@ unit cgobj;
          { call the special incr function or the generic addref }
          { call the special incr function or the generic addref }
          if incrfunc<>'' then
          if incrfunc<>'' then
           begin
           begin
-            a_param_ref(list,OS_ADDR,ref,1);
+            a_param_ref(list,OS_ADDR,ref,getintparaloc(1));
             a_call_name(list,incrfunc);
             a_call_name(list,incrfunc);
           end
           end
          else
          else
           begin
           begin
             reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
             reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
-            a_paramaddr_ref(list,href,2);
-            a_paramaddr_ref(list,ref,1);
+            a_paramaddr_ref(list,href,getintparaloc(2));
+            a_paramaddr_ref(list,ref,getintparaloc(1));
             a_call_name(list,'FPC_ADDREF');
             a_call_name(list,'FPC_ADDREF');
          end;
          end;
       end;
       end;
@@ -958,14 +959,14 @@ unit cgobj;
          { call the special decr function or the generic decref }
          { call the special decr function or the generic decref }
          if decrfunc<>'' then
          if decrfunc<>'' then
           begin
           begin
-            a_paramaddr_ref(list,ref,1);
+            a_paramaddr_ref(list,ref,getintparaloc(1));
             a_call_name(list,decrfunc);
             a_call_name(list,decrfunc);
           end
           end
          else
          else
           begin
           begin
             reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
             reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
-            a_paramaddr_ref(list,href,2);
-            a_paramaddr_ref(list,ref,1);
+            a_paramaddr_ref(list,href,getintparaloc(2));
+            a_paramaddr_ref(list,ref,getintparaloc(1));
             a_call_name(list,'FPC_DECREF');
             a_call_name(list,'FPC_DECREF');
          end;
          end;
       end;
       end;
@@ -982,11 +983,11 @@ unit cgobj;
          else
          else
            begin
            begin
               reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
               reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
-              a_paramaddr_ref(list,href,2);
+              a_paramaddr_ref(list,href,getintparaloc(2));
               if loadref then
               if loadref then
-                a_param_ref(list,OS_ADDR,ref,1)
+                a_param_ref(list,OS_ADDR,ref,getintparaloc(1))
               else
               else
-                a_paramaddr_ref(list,ref,1);
+                a_paramaddr_ref(list,ref,getintparaloc(1));
               a_call_name(list,'FPC_INITIALIZE');
               a_call_name(list,'FPC_INITIALIZE');
            end;
            end;
       end;
       end;
@@ -1003,11 +1004,11 @@ unit cgobj;
          else
          else
            begin
            begin
               reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
               reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
-              a_paramaddr_ref(list,href,2);
+              a_paramaddr_ref(list,href,getintparaloc(2));
               if loadref then
               if loadref then
-                a_param_ref(list,OS_ADDR,ref,1)
+                a_param_ref(list,OS_ADDR,ref,getintparaloc(1))
               else
               else
-                a_paramaddr_ref(list,ref,1);
+                a_paramaddr_ref(list,ref,getintparaloc(1));
               a_call_name(list,'FPC_FINALIZE');
               a_call_name(list,'FPC_FINALIZE');
            end;
            end;
       end;
       end;
@@ -1137,7 +1138,7 @@ unit cgobj;
     procedure tcg.g_stackcheck(list : taasmoutput;stackframesize : longint);
     procedure tcg.g_stackcheck(list : taasmoutput;stackframesize : longint);
 
 
       begin
       begin
-         a_param_const(list,OS_32,stackframesize,1);
+         a_param_const(list,OS_32,stackframesize,getintparaloc(1));
          a_call_name(list,'FPC_STACKCHECK');
          a_call_name(list,'FPC_STACKCHECK');
       end;
       end;
 
 
@@ -1190,10 +1191,11 @@ unit cgobj;
             {!! this is a terrible hack, normally the helper should get three params : }
             {!! this is a terrible hack, normally the helper should get three params : }
             {    one with self register, one with flag and one with VMT pointer        }
             {    one with self register, one with flag and one with VMT pointer        }
             {reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset+POINTER_SIZE);}
             {reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset+POINTER_SIZE);}
-            a_param_reg(list, OS_ADDR, SELF_POINTER_REG, 2);
+            a_param_reg(list, OS_ADDR, SELF_POINTER_REG, getintparaloc(2);
+
             { parameter 1 : vmt pointer (stored at the selfpointer address on stack)  }
             { parameter 1 : vmt pointer (stored at the selfpointer address on stack)  }
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset);
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset);
-            a_param_ref(list, OS_ADDR,href,1);
+            a_param_ref(list, OS_ADDR,href,getintparaloc(1));
             a_call_name(list,'FPC_NEW_CLASS');
             a_call_name(list,'FPC_NEW_CLASS');
             a_load_reg_reg(list,OS_ADDR,accumulator,SELF_POINTER_REG);
             a_load_reg_reg(list,OS_ADDR,accumulator,SELF_POINTER_REG);
             { save the self pointer result }
             { save the self pointer result }
@@ -1203,19 +1205,19 @@ unit cgobj;
         else if is_object(procinfo^._class) then
         else if is_object(procinfo^._class) then
           begin
           begin
             { parameter 3 :vmt_offset     }
             { parameter 3 :vmt_offset     }
-            a_param_const(list, OS_32, procinfo^._class.vmt_offset, 3);
+            a_param_const(list, OS_32, procinfo^._class.vmt_offset, getintparaloc(3));
             { parameter 2 : address of pointer to vmt }
             { parameter 2 : address of pointer to vmt }
             {  this is the first(?) parameter which was pushed to the constructor }
             {  this is the first(?) parameter which was pushed to the constructor }
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset-POINTER_SIZE);
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset-POINTER_SIZE);
             hregister:=get_scratch_reg_address(list);
             hregister:=get_scratch_reg_address(list);
             a_loadaddr_ref_reg(list, href, hregister);
             a_loadaddr_ref_reg(list, href, hregister);
-            a_param_reg(list, OS_ADDR,hregister,2);
+            a_param_reg(list, OS_ADDR,hregister,getintparaloc(2));
             free_scratch_reg(list, hregister);
             free_scratch_reg(list, hregister);
             { parameter 1 : address of self pointer   }
             { parameter 1 : address of self pointer   }
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset);
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset);
             hregister:=get_scratch_reg_address(list);
             hregister:=get_scratch_reg_address(list);
             a_loadaddr_ref_reg(list, href, hregister);
             a_loadaddr_ref_reg(list, href, hregister);
-            a_param_reg(list, OS_ADDR,hregister,1);
+            a_param_reg(list, OS_ADDR,hregister,getintparaloc(1));
             free_scratch_reg(list, hregister);
             free_scratch_reg(list, hregister);
             a_call_name(list,'FPC_HELP_CONSTRUCTOR');
             a_call_name(list,'FPC_HELP_CONSTRUCTOR');
             a_load_reg_reg(list,OS_ADDR,accumulator,SELF_POINTER_REG);
             a_load_reg_reg(list,OS_ADDR,accumulator,SELF_POINTER_REG);
@@ -1236,10 +1238,10 @@ unit cgobj;
          begin
          begin
            { 2nd parameter  : flag }
            { 2nd parameter  : flag }
            reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset+POINTER_SIZE);
            reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset+POINTER_SIZE);
-           a_param_ref(list, OS_ADDR,href,2);
+           a_param_ref(list, OS_ADDR,href,getintparaloc(2));
            { 1st parameter to destructor : self }
            { 1st parameter to destructor : self }
            reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset);
            reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset);
-           a_param_ref(list, OS_ADDR,href,1);
+           a_param_ref(list, OS_ADDR,href,getintparaloc(1));
            a_call_name(list,'FPC_DISPOSE_CLASS')
            a_call_name(list,'FPC_DISPOSE_CLASS')
          end
          end
         else if is_object(procinfo^._class) then
         else if is_object(procinfo^._class) then
@@ -1256,16 +1258,16 @@ unit cgobj;
             end;
             end;
            { actually call destructor }
            { actually call destructor }
             { parameter 3 :vmt_offset     }
             { parameter 3 :vmt_offset     }
-            a_param_const(list, OS_32, procinfo^._class.vmt_offset, 3);
+            a_param_const(list, OS_32, procinfo^._class.vmt_offset, getintparaloc(3));
             { parameter 2 : pointer to vmt }
             { parameter 2 : pointer to vmt }
             {  this is the first parameter which was pushed to the destructor }
             {  this is the first parameter which was pushed to the destructor }
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset-POINTER_SIZE);
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset-POINTER_SIZE);
-            a_param_ref(list, OS_ADDR, href ,2);
+            a_param_ref(list, OS_ADDR, href ,getintparaloc(2));
             { parameter 1 : address of self pointer   }
             { parameter 1 : address of self pointer   }
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset);
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset);
             hregister:=get_scratch_reg_address(list);
             hregister:=get_scratch_reg_address(list);
             a_loadaddr_ref_reg(list, href, hregister);
             a_loadaddr_ref_reg(list, href, hregister);
-            a_param_reg(list, OS_ADDR,hregister,1);
+            a_param_reg(list, OS_ADDR,hregister,getintparaloc(1));
             free_scratch_reg(list, hregister);
             free_scratch_reg(list, hregister);
             a_call_name(list,'FPC_HELP_DESTRUCTOR');
             a_call_name(list,'FPC_HELP_DESTRUCTOR');
          end
          end
@@ -1281,8 +1283,8 @@ unit cgobj;
       begin
       begin
         if is_class(procinfo^._class) then
         if is_class(procinfo^._class) then
           begin
           begin
-            { 
-              Dispose of the class then set self_pointer to nil 
+            {
+              Dispose of the class then set self_pointer to nil
               both in stack and in self register.
               both in stack and in self register.
             }
             }
             { 2nd parameter  : flag }
             { 2nd parameter  : flag }
@@ -1299,19 +1301,19 @@ unit cgobj;
         else if is_object(procinfo^._class) then
         else if is_object(procinfo^._class) then
           begin
           begin
             { parameter 3 :vmt_offset     }
             { parameter 3 :vmt_offset     }
-            a_param_const(list, OS_32, procinfo^._class.vmt_offset, 3);
+            a_param_const(list, OS_32, procinfo^._class.vmt_offset, getintparaloc(3));
             { parameter 2 : address of pointer to vmt }
             { parameter 2 : address of pointer to vmt }
             {  this is the first(?) parameter which was pushed to the constructor }
             {  this is the first(?) parameter which was pushed to the constructor }
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset-POINTER_SIZE);
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset-POINTER_SIZE);
             hregister:=get_scratch_reg_address(list);
             hregister:=get_scratch_reg_address(list);
             a_loadaddr_ref_reg(list, href, hregister);
             a_loadaddr_ref_reg(list, href, hregister);
-            a_param_reg(list, OS_ADDR,hregister,2);
+            a_param_reg(list, OS_ADDR,hregister,getintparaloc(2));
             free_scratch_reg(list, hregister);
             free_scratch_reg(list, hregister);
             { parameter 1 : address of self pointer   }
             { parameter 1 : address of self pointer   }
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset);
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset);
             hregister:=get_scratch_reg_address(list);
             hregister:=get_scratch_reg_address(list);
             a_loadaddr_ref_reg(list, href, hregister);
             a_loadaddr_ref_reg(list, href, hregister);
-            a_param_reg(list, OS_ADDR,hregister,1);
+            a_param_reg(list, OS_ADDR,hregister,getintparaloc(1));
             free_scratch_reg(list, hregister);
             free_scratch_reg(list, hregister);
             a_call_name(list,'FPC_HELP_FAIL');
             a_call_name(list,'FPC_HELP_FAIL');
             { SET SELF TO NIL }
             { SET SELF TO NIL }
@@ -1342,7 +1344,11 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.32  2002-07-06 20:09:10  carl
+  Revision 1.33  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.32  2002/07/06 20:09:10  carl
   * updated generic constructor / destructor calling
   * updated generic constructor / destructor calling
 
 
   Revision 1.31  2002/07/02 11:40:00  jonas
   Revision 1.31  2002/07/02 11:40:00  jonas
@@ -1482,4 +1488,4 @@ end.
   Revision 1.7  2002/03/04 19:10:11  peter
   Revision 1.7  2002/03/04 19:10:11  peter
     * removed compiler warnings
     * removed compiler warnings
 
 
-}
+}

+ 6 - 3
compiler/cutils.pas

@@ -452,8 +452,7 @@ uses
      var
      var
         hs : string;
         hs : string;
      begin
      begin
-        str(i,hs);
-        tostr:=hs;
+        str(i,result);
      end;
      end;
 
 
 
 
@@ -804,7 +803,11 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.18  2002-07-01 18:46:22  peter
+  Revision 1.19  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.18  2002/07/01 18:46:22  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 8 - 2
compiler/i386/ag386att.pas

@@ -20,6 +20,8 @@
 
 
  ****************************************************************************
  ****************************************************************************
 }
 }
+{ This unit implements an asmoutput class for i386 AT&T syntax
+}
 unit ag386att;
 unit ag386att;
 
 
 {$i fpcdefs.inc}
 {$i fpcdefs.inc}
@@ -34,7 +36,7 @@ interface
     type
     type
       T386ATTAssembler=class(TGNUassembler)
       T386ATTAssembler=class(TGNUassembler)
       public
       public
-        procedure WriteInstruction(hp: tai);  override;
+        procedure WriteInstruction(hp: tai);override;
       end;
       end;
 
 
     TAttSuffix = (AttSufNONE,AttSufINT,AttSufFPU,AttSufFPUint);
     TAttSuffix = (AttSufNONE,AttSufINT,AttSufFPU,AttSufFPUint);
@@ -338,7 +340,11 @@ initialization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.23  2002-07-01 18:46:29  peter
+  Revision 1.24  2002-07-07 09:52:33  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.23  2002/07/01 18:46:29  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 20 - 15
compiler/i386/cgcpu.pas

@@ -20,7 +20,8 @@
 
 
  ****************************************************************************
  ****************************************************************************
 }
 }
-
+{ This unit implements the code generator for the i386.
+}
 unit cgcpu;
 unit cgcpu;
 
 
 {$i fpcdefs.inc}
 {$i fpcdefs.inc}
@@ -30,7 +31,7 @@ unit cgcpu;
     uses
     uses
        cginfo,cgbase,cgobj,cg64f32,
        cginfo,cgbase,cgobj,cg64f32,
        aasmbase,aasmtai,aasmcpu,
        aasmbase,aasmtai,aasmcpu,
-       cpubase,cpuinfo,
+       cpubase,cpuinfo,cpupara,
        node,symconst;
        node,symconst;
 
 
     type
     type
@@ -41,10 +42,10 @@ unit cgcpu;
         { left to right), this allows to move the parameter to    }
         { left to right), this allows to move the parameter to    }
         { register, if the cpu supports register calling          }
         { register, if the cpu supports register calling          }
         { conventions                                             }
         { conventions                                             }
-        procedure a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;nr : longint);override;
-        procedure a_param_const(list : taasmoutput;size : tcgsize;a : aword;nr : longint);override;
-        procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;nr : longint);override;
-        procedure a_paramaddr_ref(list : taasmoutput;const r : treference;nr : longint);override;
+        procedure a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;const locpara : tparalocation);override;
+        procedure a_param_const(list : taasmoutput;size : tcgsize;a : aword;const locpara : tparalocation);override;
+        procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const locpara : tparalocation);override;
+        procedure a_paramaddr_ref(list : taasmoutput;const r : treference;const locpara : tparalocation);override;
 
 
 
 
         procedure a_call_name(list : taasmoutput;const s : string);override;
         procedure a_call_name(list : taasmoutput;const s : string);override;
@@ -318,7 +319,7 @@ unit cgcpu;
     { we implement the following routines because otherwise we can't }
     { we implement the following routines because otherwise we can't }
     { instantiate the class since it's abstract                      }
     { instantiate the class since it's abstract                      }
 
 
-    procedure tcg386.a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;nr : longint);
+    procedure tcg386.a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;const locpara : tparalocation);
       begin
       begin
         case size of
         case size of
           OS_8,OS_S8,
           OS_8,OS_S8,
@@ -337,7 +338,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure tcg386.a_param_const(list : taasmoutput;size : tcgsize;a : aword;nr : longint);
+    procedure tcg386.a_param_const(list : taasmoutput;size : tcgsize;a : aword;const locpara : tparalocation);
 
 
       begin
       begin
         case size of
         case size of
@@ -356,7 +357,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure tcg386.a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;nr : longint);
+    procedure tcg386.a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;const locpara : tparalocation);
 
 
       var
       var
         tmpreg: tregister;
         tmpreg: tregister;
@@ -382,7 +383,7 @@ unit cgcpu;
       end;
       end;
 
 
 
 
-    procedure tcg386.a_paramaddr_ref(list : taasmoutput;const r : treference;nr : longint);
+    procedure tcg386.a_paramaddr_ref(list : taasmoutput;const r : treference;const locpara : tparalocation);
 
 
       var
       var
         tmpreg: tregister;
         tmpreg: tregister;
@@ -1341,13 +1342,13 @@ unit cgcpu;
          tempaddr:=exceptbuf;
          tempaddr:=exceptbuf;
          tempbuf:=exceptbuf;
          tempbuf:=exceptbuf;
          inc(tempbuf.offset,12);
          inc(tempbuf.offset,12);
-         a_paramaddr_ref(list,tempaddr,3);
-         a_paramaddr_ref(list,tempbuf,2);
-         a_param_const(list,OS_INT,l,1);
+         a_paramaddr_ref(list,tempaddr,getintparaloc(3));
+         a_paramaddr_ref(list,tempbuf,getintparaloc(2));
+         a_param_const(list,OS_INT,l,getintparaloc(1));
          a_call_name(list,'FPC_PUSHEXCEPTADDR');
          a_call_name(list,'FPC_PUSHEXCEPTADDR');
 
 
          a_reg_alloc(list,accumulator);
          a_reg_alloc(list,accumulator);
-         a_param_reg(list,OS_ADDR,accumulator,1);
+         a_param_reg(list,OS_ADDR,accumulator,getintparaloc(1));
          a_reg_dealloc(list,accumulator);
          a_reg_dealloc(list,accumulator);
          a_call_name(list,'FPC_SETJMP');
          a_call_name(list,'FPC_SETJMP');
          list.concat(tai_regalloc.Alloc(accumulator));
          list.concat(tai_regalloc.Alloc(accumulator));
@@ -1784,7 +1785,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.25  2002-07-01 18:46:30  peter
+  Revision 1.26  2002-07-07 09:52:33  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.25  2002/07/01 18:46:30  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 37 - 3
compiler/i386/cpubase.pas

@@ -95,12 +95,12 @@ uses
         R_XMM0,R_XMM1,R_XMM2,R_XMM3,R_XMM4,R_XMM5,R_XMM6,R_XMM7
         R_XMM0,R_XMM1,R_XMM2,R_XMM3,R_XMM4,R_XMM5,R_XMM6,R_XMM7
       );
       );
 
 
-      {# A type to store register locations for 64 Bit values. }
+      { A type to store register locations for 64 Bit values. }
       tregister64 = packed record
       tregister64 = packed record
         reglo,reghi : tregister;
         reglo,reghi : tregister;
       end;
       end;
 
 
-      {# alias for compact code }
+      { alias for compact code }
       treg64 = tregister64;
       treg64 = tregister64;
 
 
       {# Set type definition for registers }
       {# Set type definition for registers }
@@ -210,6 +210,13 @@ uses
          options     : trefoptions;
          options     : trefoptions;
       end;
       end;
 
 
+      { reference record }
+      pparareference = ^tparareference;
+      tparareference = packed record
+         index       : tregister;
+         offset      : longint;
+      end;
+
 {*****************************************************************************
 {*****************************************************************************
                                 Operands
                                 Operands
 *****************************************************************************}
 *****************************************************************************}
@@ -249,6 +256,29 @@ uses
         LOC_CSSEREGISTER
         LOC_CSSEREGISTER
       );
       );
 
 
+      { 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
+         loc  : TLoc;
+         sp_fixup : longint;
+         case TLoc 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);
+                { overlay a 64 Bit register type }
+                3 : (reg64 : tregister64);
+                4 : (register64 : tregister64);
+              );
+            { it's only for better handling }
+            LOC_MMXREGISTER,LOC_CMMXREGISTER : (mmxreg : tregister);
+      end;
+
       tlocation = packed record
       tlocation = packed record
          loc  : TLoc;
          loc  : TLoc;
          size : TCGSize;
          size : TCGSize;
@@ -456,7 +486,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.25  2002-07-01 18:46:30  peter
+  Revision 1.26  2002-07-07 09:52:33  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.25  2002/07/01 18:46:30  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 68 - 0
compiler/i386/cpupara.pas

@@ -0,0 +1,68 @@
+{
+    $Id$
+    Copyright (c) 2002 by Florian Klaempfl
+
+    Generates the argument location information for i386
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published bymethodpointer
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+{ Generates the argument location information for i386.
+}
+unit cpupara;
+
+  interface
+
+    uses
+       cpubase,
+       symdef;
+
+    var
+       paralocdummy : tparalocation;
+
+    { Returns the location for the nr-st 32 Bit int parameter
+      if every parameter before is an 32 Bit int parameter as well
+      and if the calling conventions for the helper routines of the
+      rtl are used.
+    }
+    function getintparaloc(nr : longint) : tparalocation;
+    procedure create_param_loc_info(const p : tparaitem);
+
+  implementation
+
+    function getintparaloc(nr : longint) : tparalocation;
+
+      begin
+      end;
+    procedure create_param_loc_info(const p : tparaitem);
+
+      begin
+         { set default para_alignment to target_info.stackalignment }
+         { if para_alignment=0 then
+           para_alignment:=aktalignment.paraalign;
+         }
+      end;
+
+
+
+end.
+{
+  $Log$
+  Revision 1.1  2002-07-07 09:52:33  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+}

+ 10 - 5
compiler/i386/n386add.pas

@@ -58,6 +58,7 @@ interface
       cutils,verbose,globals,
       cutils,verbose,globals,
       symconst,symdef,aasmbase,aasmtai,aasmcpu,types,htypechk,
       symconst,symdef,aasmbase,aasmtai,aasmcpu,types,htypechk,
       cgbase,pass_2,regvars,
       cgbase,pass_2,regvars,
+      cpupara,
       ncon,nset,
       ncon,nset,
       cga,ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32;
       cga,ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32;
 
 
@@ -378,13 +379,13 @@ interface
                         remove_non_regvars_from_loc(right.location,regstopush);
                         remove_non_regvars_from_loc(right.location,regstopush);
                         rg.saveusedregisters(exprasmlist,pushed,regstopush);
                         rg.saveusedregisters(exprasmlist,pushed,regstopush);
                         { push the maximum possible length of the result }
                         { push the maximum possible length of the result }
-                        cg.a_paramaddr_ref(exprasmlist,left.location.reference,2);
+                        cg.a_paramaddr_ref(exprasmlist,left.location.reference,getintparaloc(2));
                         { the optimizer can more easily put the          }
                         { the optimizer can more easily put the          }
                         { deallocations in the right place if it happens }
                         { deallocations in the right place if it happens }
                         { too early than when it happens too late (if    }
                         { too early than when it happens too late (if    }
                         { the pushref needs a "lea (..),edi; push edi")  }
                         { the pushref needs a "lea (..),edi; push edi")  }
                         location_release(exprasmlist,right.location);
                         location_release(exprasmlist,right.location);
-                        cg.a_paramaddr_ref(exprasmlist,right.location.reference,1);
+                        cg.a_paramaddr_ref(exprasmlist,right.location.reference,getintparaloc(1));
                         rg.saveregvars(exprasmlist,regstopush);
                         rg.saveregvars(exprasmlist,regstopush);
                         cg.a_call_name(exprasmlist,'FPC_SHORTSTR_CONCAT');
                         cg.a_call_name(exprasmlist,'FPC_SHORTSTR_CONCAT');
                         tg.ungetiftemp(exprasmlist,right.location.reference);
                         tg.ungetiftemp(exprasmlist,right.location.reference);
@@ -398,10 +399,10 @@ interface
                        rg.saveusedregisters(exprasmlist,pushed,all_registers);
                        rg.saveusedregisters(exprasmlist,pushed,all_registers);
                        secondpass(left);
                        secondpass(left);
                        location_release(exprasmlist,left.location);
                        location_release(exprasmlist,left.location);
-                       cg.a_paramaddr_ref(exprasmlist,left.location.reference,2);
+                       cg.a_paramaddr_ref(exprasmlist,left.location.reference,getintparaloc(2));
                        secondpass(right);
                        secondpass(right);
                        location_release(exprasmlist,right.location);
                        location_release(exprasmlist,right.location);
-                       cg.a_paramaddr_ref(exprasmlist,right.location.reference,1);
+                       cg.a_paramaddr_ref(exprasmlist,right.location.reference,getintparaloc(1));
                        rg.saveregvars(exprasmlist,all_registers);
                        rg.saveregvars(exprasmlist,all_registers);
                        cg.a_call_name(exprasmlist,'FPC_SHORTSTR_COMPARE');
                        cg.a_call_name(exprasmlist,'FPC_SHORTSTR_COMPARE');
                        cg.g_maybe_loadself(exprasmlist);
                        cg.g_maybe_loadself(exprasmlist);
@@ -1571,7 +1572,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.41  2002-07-01 18:46:31  peter
+  Revision 1.42  2002-07-07 09:52:33  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.41  2002/07/01 18:46:31  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 50 - 45
compiler/i386/n386cal.pas

@@ -61,7 +61,8 @@ implementation
       gdb,
       gdb,
 {$endif GDB}
 {$endif GDB}
       cginfo,cgbase,pass_2,
       cginfo,cgbase,pass_2,
-      cpubase,aasmbase,aasmtai,aasmcpu,
+      cpubase,cpupara,
+      aasmbase,aasmtai,aasmcpu,
       nmem,nld,ncnv,
       nmem,nld,ncnv,
       ncgutil,cga,cgobj,tgobj,regvars,rgobj,rgcpu,cg64f32,cgcpu;
       ncgutil,cga,cgobj,tgobj,regvars,rgobj,rgcpu,cg64f32,cgcpu;
 
 
@@ -81,7 +82,7 @@ implementation
             begin
             begin
               secondpass(hightree);
               secondpass(hightree);
               { this is a longint anyway ! }
               { this is a longint anyway ! }
-              push_value_para(hightree,inlined,false,para_offset,4);
+              push_value_para(hightree,inlined,false,para_offset,4,paralocdummy);
             end;
             end;
         end;
         end;
 
 
@@ -119,11 +120,11 @@ implementation
              if push_addr_param(left.resulttype.def) then
              if push_addr_param(left.resulttype.def) then
                begin
                begin
                  inc(pushedparasize,4);
                  inc(pushedparasize,4);
-                 cg.a_paramaddr_ref(exprasmlist,left.location.reference,-1);
+                 cg.a_paramaddr_ref(exprasmlist,left.location.reference,paralocdummy);
                  location_release(exprasmlist,left.location);
                  location_release(exprasmlist,left.location);
                end
                end
              else
              else
-               push_value_para(left,inlined,is_cdecl,para_offset,para_alignment);
+               push_value_para(left,inlined,is_cdecl,para_offset,para_alignment,paralocdummy);
            end
            end
          { filter array constructor with c styled args }
          { filter array constructor with c styled args }
          else if is_array_constructor(left.resulttype.def) and (nf_cargs in left.flags) then
          else if is_array_constructor(left.resulttype.def) and (nf_cargs in left.flags) then
@@ -150,7 +151,7 @@ implementation
                        cg.a_load_loc_ref(exprasmlist,left.location,href);
                        cg.a_load_loc_ref(exprasmlist,left.location,href);
                     end
                     end
                   else
                   else
-                    cg.a_param_loc(exprasmlist,left.location,-1);
+                    cg.a_param_loc(exprasmlist,left.location,paralocdummy);
                   location_release(exprasmlist,left.location);
                   location_release(exprasmlist,left.location);
                 end
                 end
               else
               else
@@ -168,7 +169,7 @@ implementation
                            cg.free_scratch_reg(exprasmlist,tmpreg);
                            cg.free_scratch_reg(exprasmlist,tmpreg);
                          end
                          end
                        else
                        else
-                         cg.a_paramaddr_ref(exprasmlist,left.location.reference,-1);
+                         cg.a_paramaddr_ref(exprasmlist,left.location.reference,paralocdummy);
                        location_release(exprasmlist,left.location);
                        location_release(exprasmlist,left.location);
                      end;
                      end;
                 end;
                 end;
@@ -200,7 +201,7 @@ implementation
                    cg.free_scratch_reg(exprasmlist,tmpreg);
                    cg.free_scratch_reg(exprasmlist,tmpreg);
                 end
                 end
               else
               else
-                cg.a_paramaddr_ref(exprasmlist,left.location.reference,-1);
+                cg.a_paramaddr_ref(exprasmlist,left.location.reference,paralocdummy);
               location_release(exprasmlist,left.location);
               location_release(exprasmlist,left.location);
            end
            end
          else
          else
@@ -247,13 +248,13 @@ implementation
                         cg.free_scratch_reg(exprasmlist,tmpreg);
                         cg.free_scratch_reg(exprasmlist,tmpreg);
                      end
                      end
                    else
                    else
-                     cg.a_paramaddr_ref(exprasmlist,left.location.reference,-1);
+                     cg.a_paramaddr_ref(exprasmlist,left.location.reference,paralocdummy);
                    location_release(exprasmlist,left.location);
                    location_release(exprasmlist,left.location);
                 end
                 end
               else
               else
                 begin
                 begin
                    push_value_para(left,inlined,is_cdecl,
                    push_value_para(left,inlined,is_cdecl,
-                     para_offset,para_alignment);
+                     para_offset,para_alignment,paralocdummy);
                 end;
                 end;
            end;
            end;
          truelabel:=otlabel;
          truelabel:=otlabel;
@@ -549,7 +550,7 @@ implementation
                   cg.free_scratch_reg(exprasmlist,hregister);
                   cg.free_scratch_reg(exprasmlist,hregister);
                end
                end
              else
              else
-               cg.a_paramaddr_ref(exprasmlist,funcretref,-1);
+               cg.a_paramaddr_ref(exprasmlist,funcretref,paralocdummy);
            end;
            end;
 
 
          { procedure variable or normal function call ? }
          { procedure variable or normal function call ? }
@@ -639,15 +640,15 @@ implementation
                                     if is_class(tobjectdef(methodpointer.resulttype.def)) and
                                     if is_class(tobjectdef(methodpointer.resulttype.def)) and
                                        (procdefinition.proctypeoption=potype_destructor) then
                                        (procdefinition.proctypeoption=potype_destructor) then
                                       begin
                                       begin
-                                        cg.a_param_const(exprasmlist,OS_ADDR,0,2);
-                                        cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,1);
+                                        cg.a_param_const(exprasmlist,OS_ADDR,0,getintparaloc(2));
+                                        cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,getintparaloc(1));
                                       end;
                                       end;
 
 
                                     if not(is_con_or_destructor and
                                     if not(is_con_or_destructor and
                                            is_class(methodpointer.resulttype.def) and
                                            is_class(methodpointer.resulttype.def) and
                                            (procdefinition.proctypeoption in [potype_constructor,potype_destructor])
                                            (procdefinition.proctypeoption in [potype_constructor,potype_destructor])
                                           ) then
                                           ) then
-                                      cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,1);
+                                      cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,getintparaloc(1));
                                     { if an inherited con- or destructor should be  }
                                     { if an inherited con- or destructor should be  }
                                     { called in a con- or destructor then a warning }
                                     { called in a con- or destructor then a warning }
                                     { will be made                                  }
                                     { will be made                                  }
@@ -670,8 +671,8 @@ implementation
                                       begin
                                       begin
                                          { a constructor needs also a flag }
                                          { a constructor needs also a flag }
                                          if is_class(methodpointer.resulttype.def) then
                                          if is_class(methodpointer.resulttype.def) then
-                                           cg.a_param_const(exprasmlist,OS_ADDR,0,2);
-                                         cg.a_param_const(exprasmlist,OS_ADDR,0,1);
+                                           cg.a_param_const(exprasmlist,OS_ADDR,0,getintparaloc(2));
+                                         cg.a_param_const(exprasmlist,OS_ADDR,0,getintparaloc(1));
                                       end;
                                       end;
                                  end;
                                  end;
                                hnewn:
                                hnewn:
@@ -680,10 +681,10 @@ implementation
                                     { ESI must be zero }
                                     { ESI must be zero }
                                     rg.getexplicitregisterint(exprasmlist,R_ESI);
                                     rg.getexplicitregisterint(exprasmlist,R_ESI);
                                     cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg);
                                     cg.a_load_const_reg(exprasmlist,OS_ADDR,0,self_pointer_reg);
-                                    cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,2);
+                                    cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,getintparaloc(2));
                                     { insert the vmt }
                                     { insert the vmt }
                                     reference_reset_symbol(href,newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
                                     reference_reset_symbol(href,newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
-                                    cg.a_paramaddr_ref(exprasmlist,href,1);
+                                    cg.a_paramaddr_ref(exprasmlist,href,getintparaloc(1));
                                     extended_new:=true;
                                     extended_new:=true;
                                  end;
                                  end;
                                hdisposen:
                                hdisposen:
@@ -695,9 +696,9 @@ implementation
                                     rg.getexplicitregisterint(exprasmlist,R_ESI);
                                     rg.getexplicitregisterint(exprasmlist,R_ESI);
                                     emit_ref_reg(A_LEA,S_L,methodpointer.location.reference,R_ESI);
                                     emit_ref_reg(A_LEA,S_L,methodpointer.location.reference,R_ESI);
                                     reference_release(exprasmlist,methodpointer.location.reference);
                                     reference_release(exprasmlist,methodpointer.location.reference);
-                                    cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,2);
+                                    cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,getintparaloc(2));
                                     reference_reset_symbol(href,newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
                                     reference_reset_symbol(href,newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
-                                    cg.a_paramaddr_ref(exprasmlist,href,1);
+                                    cg.a_paramaddr_ref(exprasmlist,href,getintparaloc(1));
                                  end;
                                  end;
                                else
                                else
                                  begin
                                  begin
@@ -740,14 +741,14 @@ implementation
                                         { direct call to destructor: remove data }
                                         { direct call to destructor: remove data }
                                         if (procdefinition.proctypeoption=potype_destructor) and
                                         if (procdefinition.proctypeoption=potype_destructor) and
                                            is_class(methodpointer.resulttype.def) then
                                            is_class(methodpointer.resulttype.def) then
-                                          cg.a_param_const(exprasmlist,OS_INT,1,1);
+                                          cg.a_param_const(exprasmlist,OS_INT,1,getintparaloc(1));
 
 
                                         { direct call to class constructor, don't allocate memory }
                                         { direct call to class constructor, don't allocate memory }
                                         if (procdefinition.proctypeoption=potype_constructor) and
                                         if (procdefinition.proctypeoption=potype_constructor) and
                                            is_class(methodpointer.resulttype.def) then
                                            is_class(methodpointer.resulttype.def) then
                                           begin
                                           begin
-                                             cg.a_param_const(exprasmlist,OS_INT,0,2);
-                                             cg.a_param_const(exprasmlist,OS_INT,0,1);
+                                             cg.a_param_const(exprasmlist,OS_INT,0,getintparaloc(2));
+                                             cg.a_param_const(exprasmlist,OS_INT,0,getintparaloc(1));
                                           end
                                           end
                                         else
                                         else
                                           begin
                                           begin
@@ -755,8 +756,8 @@ implementation
                                              if (procdefinition.proctypeoption=potype_constructor) and
                                              if (procdefinition.proctypeoption=potype_constructor) and
                                                 (methodpointer.resulttype.def.deftype=classrefdef) and
                                                 (methodpointer.resulttype.def.deftype=classrefdef) and
                                                 is_class(tclassrefdef(methodpointer.resulttype.def).pointertype.def) then
                                                 is_class(tclassrefdef(methodpointer.resulttype.def).pointertype.def) then
-                                               cg.a_param_const(exprasmlist,OS_INT,1,1);
-                                             cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,1);
+                                               cg.a_param_const(exprasmlist,OS_INT,1,getintparaloc(1));
+                                             cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,getintparaloc(1));
                                           end;
                                           end;
                                       end;
                                       end;
 
 
@@ -770,12 +771,12 @@ implementation
                                                   { it's no bad idea, to insert the VMT }
                                                   { it's no bad idea, to insert the VMT }
                                                   reference_reset_symbol(href,newasmsymbol(
                                                   reference_reset_symbol(href,newasmsymbol(
                                                      tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
                                                      tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
-                                                  cg.a_paramaddr_ref(exprasmlist,href,1);
+                                                  cg.a_paramaddr_ref(exprasmlist,href,getintparaloc(1));
                                                 end
                                                 end
                                               { destructors haven't to dispose the instance, if this is }
                                               { destructors haven't to dispose the instance, if this is }
                                               { a direct call                                           }
                                               { a direct call                                           }
                                               else
                                               else
-                                                cg.a_param_const(exprasmlist,OS_INT,0,1);
+                                                cg.a_param_const(exprasmlist,OS_INT,0,getintparaloc(1));
                                            end;
                                            end;
                                       end;
                                       end;
                                  end;
                                  end;
@@ -805,32 +806,32 @@ implementation
                           begin
                           begin
                              if (procdefinition.proctypeoption=potype_destructor) then
                              if (procdefinition.proctypeoption=potype_destructor) then
                                begin
                                begin
-                                  cg.a_param_const(exprasmlist,OS_INT,0,2);
-                                  cg.a_param_reg(exprasmlist,OS_ADDR,R_ESI,1);
+                                  cg.a_param_const(exprasmlist,OS_INT,0,getintparaloc(2));
+                                  cg.a_param_reg(exprasmlist,OS_ADDR,R_ESI,getintparaloc(1));
                                end
                                end
                              else if (procdefinition.proctypeoption=potype_constructor) then
                              else if (procdefinition.proctypeoption=potype_constructor) then
                                begin
                                begin
-                                  cg.a_param_const(exprasmlist,OS_INT,0,2);
-                                  cg.a_param_const(exprasmlist,OS_INT,0,1);
+                                  cg.a_param_const(exprasmlist,OS_INT,0,getintparaloc(2));
+                                  cg.a_param_const(exprasmlist,OS_INT,0,getintparaloc(1));
                                end
                                end
                              else
                              else
-                               cg.a_param_reg(exprasmlist,OS_ADDR,R_ESI,1);
+                               cg.a_param_reg(exprasmlist,OS_ADDR,R_ESI,getintparaloc(1));
                           end
                           end
                         else if is_object(procinfo^._class) then
                         else if is_object(procinfo^._class) then
                           begin
                           begin
-                             cg.a_param_reg(exprasmlist,OS_ADDR,R_ESI,1);
+                             cg.a_param_reg(exprasmlist,OS_ADDR,R_ESI,getintparaloc(1));
                              if is_con_or_destructor then
                              if is_con_or_destructor then
                                begin
                                begin
                                   if (procdefinition.proctypeoption=potype_constructor) then
                                   if (procdefinition.proctypeoption=potype_constructor) then
                                     begin
                                     begin
                                       { it's no bad idea, to insert the VMT }
                                       { it's no bad idea, to insert the VMT }
                                       reference_reset_symbol(href,newasmsymbol(procinfo^._class.vmt_mangledname),0);
                                       reference_reset_symbol(href,newasmsymbol(procinfo^._class.vmt_mangledname),0);
-                                      cg.a_paramaddr_ref(exprasmlist,href,1);
+                                      cg.a_paramaddr_ref(exprasmlist,href,getintparaloc(1));
                                     end
                                     end
                                   { destructors haven't to dispose the instance, if this is }
                                   { destructors haven't to dispose the instance, if this is }
                                   { a direct call                                           }
                                   { a direct call                                           }
                                   else
                                   else
-                                    cg.a_param_const(exprasmlist,OS_INT,0,1);
+                                    cg.a_param_const(exprasmlist,OS_INT,0,getintparaloc(1));
                                end;
                                end;
                           end
                           end
                         else
                         else
@@ -846,7 +847,7 @@ implementation
                    (inlined or
                    (inlined or
                    (right=nil)) then
                    (right=nil)) then
                   begin
                   begin
-                     cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,1);
+                     cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,getintparaloc(1));
                      reference_reset_base(href,self_pointer_reg,0);
                      reference_reset_base(href,self_pointer_reg,0);
                      tmpreg:=cg.get_scratch_reg_address(exprasmlist);
                      tmpreg:=cg.get_scratch_reg_address(exprasmlist);
                      cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,tmpreg);
                      cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,tmpreg);
@@ -876,13 +877,13 @@ implementation
                      if lexlevel=(tprocdef(procdefinition).parast.symtablelevel) then
                      if lexlevel=(tprocdef(procdefinition).parast.symtablelevel) then
                        begin
                        begin
                           reference_reset_base(href,procinfo^.framepointer,procinfo^.framepointer_offset);
                           reference_reset_base(href,procinfo^.framepointer,procinfo^.framepointer_offset);
-                          cg.a_param_ref(exprasmlist,OS_ADDR,href,-1);
+                          cg.a_param_ref(exprasmlist,OS_ADDR,href,paralocdummy);
                        end
                        end
                        { this is only true if the difference is one !!
                        { this is only true if the difference is one !!
                          but it cannot be more !! }
                          but it cannot be more !! }
                      else if (lexlevel=(tprocdef(procdefinition).parast.symtablelevel)-1) then
                      else if (lexlevel=(tprocdef(procdefinition).parast.symtablelevel)-1) then
                        begin
                        begin
-                          cg.a_param_reg(exprasmlist,OS_ADDR,procinfo^.framepointer,-1);
+                          cg.a_param_reg(exprasmlist,OS_ADDR,procinfo^.framepointer,paralocdummy);
                        end
                        end
                      else if (lexlevel>(tprocdef(procdefinition).parast.symtablelevel)) then
                      else if (lexlevel>(tprocdef(procdefinition).parast.symtablelevel)) then
                        begin
                        begin
@@ -896,7 +897,7 @@ implementation
                                reference_reset_base(href,hregister,procinfo^.framepointer_offset);
                                reference_reset_base(href,hregister,procinfo^.framepointer_offset);
                                cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,hregister);
                                cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,hregister);
                             end;
                             end;
-                          cg.a_param_reg(exprasmlist,OS_ADDR,hregister,-1);
+                          cg.a_param_reg(exprasmlist,OS_ADDR,hregister,paralocdummy);
                           rg.ungetregisterint(exprasmlist,hregister);
                           rg.ungetregisterint(exprasmlist,hregister);
                        end
                        end
                      else
                      else
@@ -956,13 +957,13 @@ implementation
                         if (cs_check_object in aktlocalswitches) then
                         if (cs_check_object in aktlocalswitches) then
                           begin
                           begin
                              reference_reset_symbol(hrefvmt,newasmsymbol(tprocdef(procdefinition)._class.vmt_mangledname),0);
                              reference_reset_symbol(hrefvmt,newasmsymbol(tprocdef(procdefinition)._class.vmt_mangledname),0);
-                             cg.a_paramaddr_ref(exprasmlist,hrefvmt,2);
-                             cg.a_param_reg(exprasmlist,OS_ADDR,href.base,1);
+                             cg.a_paramaddr_ref(exprasmlist,hrefvmt,getintparaloc(2));
+                             cg.a_param_reg(exprasmlist,OS_ADDR,href.base,getintparaloc(1));
                              cg.a_call_name(exprasmlist,'FPC_CHECK_OBJECT_EXT');
                              cg.a_call_name(exprasmlist,'FPC_CHECK_OBJECT_EXT');
                           end
                           end
                         else if (cs_check_range in aktlocalswitches) then
                         else if (cs_check_range in aktlocalswitches) then
                           begin
                           begin
-                             cg.a_param_reg(exprasmlist,OS_ADDR,href.base,1);
+                             cg.a_param_reg(exprasmlist,OS_ADDR,href.base,getintparaloc(1));
                              cg.a_call_name(exprasmlist,'FPC_CHECK_OBJECT');
                              cg.a_call_name(exprasmlist,'FPC_CHECK_OBJECT');
                           end;
                           end;
                      end;
                      end;
@@ -1026,7 +1027,7 @@ implementation
                        rg.getexplicitregisterint(exprasmlist,R_ESI);
                        rg.getexplicitregisterint(exprasmlist,R_ESI);
                        cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,self_pointer_reg);
                        cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,self_pointer_reg);
                        { push self pointer }
                        { push self pointer }
-                       cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,-1);
+                       cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,paralocdummy);
                      end;
                      end;
 
 
                    rg.saveregvars(exprasmlist,ALL_REGISTERS);
                    rg.saveregvars(exprasmlist,ALL_REGISTERS);
@@ -1127,7 +1128,7 @@ implementation
            begin
            begin
               getlabel(constructorfailed);
               getlabel(constructorfailed);
               emitjmp(C_Z,constructorfailed);
               emitjmp(C_Z,constructorfailed);
-              cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,1);
+              cg.a_param_reg(exprasmlist,OS_ADDR,self_pointer_reg,getintparaloc(1));
               reference_reset_base(href,self_pointer_reg,0);
               reference_reset_base(href,self_pointer_reg,0);
               tmpreg:=cg.get_scratch_reg_address(exprasmlist);
               tmpreg:=cg.get_scratch_reg_address(exprasmlist);
               cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,tmpreg);
               cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,tmpreg);
@@ -1234,7 +1235,7 @@ implementation
          if iolabel<>nil then
          if iolabel<>nil then
            begin
            begin
               reference_reset_symbol(href,iolabel,0);
               reference_reset_symbol(href,iolabel,0);
-              cg.a_paramaddr_ref(exprasmlist,href,1);
+              cg.a_paramaddr_ref(exprasmlist,href,getintparaloc(1));
               cg.a_call_name(exprasmlist,'FPC_IOCHECK');
               cg.a_call_name(exprasmlist,'FPC_IOCHECK');
            end;
            end;
          if pop_size>0 then
          if pop_size>0 then
@@ -1480,7 +1481,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.57  2002-07-06 20:27:26  carl
+  Revision 1.58  2002-07-07 09:52:34  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.57  2002/07/06 20:27:26  carl
   + generic set handling
   + generic set handling
 
 
   Revision 1.56  2002/07/01 18:46:31  peter
   Revision 1.56  2002/07/01 18:46:31  peter

+ 24 - 20
compiler/i386/n386flw.pas

@@ -54,7 +54,7 @@ implementation
       verbose,systems,
       verbose,systems,
       symsym,aasmbase,aasmtai,aasmcpu,
       symsym,aasmbase,aasmtai,aasmcpu,
       cgbase,pass_2,
       cgbase,pass_2,
-      cpuinfo,cpubase,
+      cpuinfo,cpubase,cpupara,
       nld,ncon,
       nld,ncon,
       cga,cgobj,tgobj,rgobj;
       cga,cgobj,tgobj,rgobj;
 
 
@@ -78,28 +78,28 @@ implementation
                       secondpass(frametree);
                       secondpass(frametree);
                       if codegenerror then
                       if codegenerror then
                        exit;
                        exit;
-                      cg.a_param_loc(exprasmlist,frametree.location,2);
+                      cg.a_param_loc(exprasmlist,frametree.location,getintparaloc(2));
                     end
                     end
                   else
                   else
-                    cg.a_param_const(exprasmlist,OS_INT,0,2);
+                    cg.a_param_const(exprasmlist,OS_INT,0,getintparaloc(2));
                   { push address }
                   { push address }
                   secondpass(right);
                   secondpass(right);
                   if codegenerror then
                   if codegenerror then
                    exit;
                    exit;
-                  cg.a_param_loc(exprasmlist,right.location,1);
+                  cg.a_param_loc(exprasmlist,right.location,getintparaloc(1));
                 end
                 end
               else
               else
                 begin
                 begin
                    getaddrlabel(a);
                    getaddrlabel(a);
                    cg.a_label(exprasmlist,a);
                    cg.a_label(exprasmlist,a);
-                   cg.a_param_reg(exprasmlist,OS_INT,R_EBP,2);
+                   cg.a_param_reg(exprasmlist,OS_INT,R_EBP,getintparaloc(2));
                    emit_sym(A_PUSH,S_L,a);
                    emit_sym(A_PUSH,S_L,a);
                 end;
                 end;
               { push object }
               { push object }
               secondpass(left);
               secondpass(left);
               if codegenerror then
               if codegenerror then
                 exit;
                 exit;
-              cg.a_param_loc(exprasmlist,left.location,1);
+              cg.a_param_loc(exprasmlist,left.location,getintparaloc(1));
               cg.a_call_name(exprasmlist,'FPC_RAISEEXCEPTION');
               cg.a_call_name(exprasmlist,'FPC_RAISEEXCEPTION');
            end
            end
          else
          else
@@ -202,10 +202,10 @@ implementation
 
 
          tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
          tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
          tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
          tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
-         cg.a_paramaddr_ref(exprasmlist,tempaddr,3);
-         cg.a_paramaddr_ref(exprasmlist,tempbuf,2);
+         cg.a_paramaddr_ref(exprasmlist,tempaddr,getintparaloc(3));
+         cg.a_paramaddr_ref(exprasmlist,tempbuf,getintparaloc(2));
          { push type of exceptionframe }
          { push type of exceptionframe }
-         cg.a_param_const(exprasmlist,OS_INT,1,1);
+         cg.a_param_const(exprasmlist,OS_INT,1,getintparaloc(1));
          cg.a_call_name(exprasmlist,'FPC_PUSHEXCEPTADDR');
          cg.a_call_name(exprasmlist,'FPC_PUSHEXCEPTADDR');
 
 
          { allocate eax }
          { allocate eax }
@@ -269,7 +269,7 @@ implementation
               { FPC_CATCHES must be called with
               { FPC_CATCHES must be called with
                 'default handler' flag (=-1)
                 'default handler' flag (=-1)
               }
               }
-              cg.a_param_const(exprasmlist,OS_INT,aword(-1),1);
+              cg.a_param_const(exprasmlist,OS_INT,aword(-1),getintparaloc(1));
               cg.a_call_name(exprasmlist,'FPC_CATCHES');
               cg.a_call_name(exprasmlist,'FPC_CATCHES');
               cg.g_maybe_loadself(exprasmlist);
               cg.g_maybe_loadself(exprasmlist);
 
 
@@ -280,10 +280,10 @@ implementation
 
 
               tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
               tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
               tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
               tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
-              cg.a_paramaddr_ref(exprasmlist,tempaddr,3);
-              cg.a_paramaddr_ref(exprasmlist,tempbuf,2);
+              cg.a_paramaddr_ref(exprasmlist,tempaddr,getintparaloc(3));
+              cg.a_paramaddr_ref(exprasmlist,tempbuf,getintparaloc(2));
               { push type of exceptionframe }
               { push type of exceptionframe }
-              cg.a_param_const(exprasmlist,OS_INT,1,1);
+              cg.a_param_const(exprasmlist,OS_INT,1,getintparaloc(1));
               cg.a_call_name(exprasmlist,'FPC_PUSHEXCEPTADDR');
               cg.a_call_name(exprasmlist,'FPC_PUSHEXCEPTADDR');
 
 
               { allocate eax }
               { allocate eax }
@@ -449,9 +449,9 @@ implementation
 
 
          tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
          tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
          tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
          tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
-         cg.a_paramaddr_ref(exprasmlist,tempaddr,3);
-         cg.a_paramaddr_ref(exprasmlist,tempbuf,2);
-         cg.a_param_const(exprasmlist,OS_INT,1,1);
+         cg.a_paramaddr_ref(exprasmlist,tempaddr,getintparaloc(3));
+         cg.a_paramaddr_ref(exprasmlist,tempbuf,getintparaloc(2));
+         cg.a_param_const(exprasmlist,OS_INT,1,getintparaloc(1));
          cg.a_call_name(exprasmlist,'FPC_PUSHEXCEPTADDR');
          cg.a_call_name(exprasmlist,'FPC_PUSHEXCEPTADDR');
 
 
          exprasmList.concat(tai_regalloc.Alloc(R_EAX));
          exprasmList.concat(tai_regalloc.Alloc(R_EAX));
@@ -603,10 +603,10 @@ implementation
 
 
          tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
          tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
          tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
          tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
-         cg.a_paramaddr_ref(exprasmlist,tempaddr,3);
-         cg.a_paramaddr_ref(exprasmlist,tempbuf,2);
+         cg.a_paramaddr_ref(exprasmlist,tempaddr,getintparaloc(3));
+         cg.a_paramaddr_ref(exprasmlist,tempbuf,getintparaloc(2));
          { Type of stack-frame must be pushed}
          { Type of stack-frame must be pushed}
-         cg.a_param_const(exprasmlist,OS_INT,1,1);
+         cg.a_param_const(exprasmlist,OS_INT,1,getintparaloc(1));
          cg.a_call_name(exprasmlist,'FPC_PUSHEXCEPTADDR');
          cg.a_call_name(exprasmlist,'FPC_PUSHEXCEPTADDR');
 
 
          { allocate eax }
          { allocate eax }
@@ -726,7 +726,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.28  2002-07-01 18:46:33  peter
+  Revision 1.29  2002-07-07 09:52:34  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.28  2002/07/01 18:46:33  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 10 - 6
compiler/i386/n386inl.pas

@@ -42,7 +42,7 @@ implementation
       symconst,symdef,types,
       symconst,symdef,types,
       aasmbase,aasmtai,aasmcpu,
       aasmbase,aasmtai,aasmcpu,
       cginfo,cgbase,pass_1,pass_2,
       cginfo,cgbase,pass_1,pass_2,
-      cpubase,
+      cpubase,cpupara,
       nbas,ncon,ncal,ncnv,nld,
       nbas,ncon,ncal,ncnv,nld,
       cga,tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu;
       cga,tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu;
 
 
@@ -92,20 +92,20 @@ implementation
                  maketojumpbool(exprasmlist,tcallparanode(left).left,lr_load_regvars);
                  maketojumpbool(exprasmlist,tcallparanode(left).left,lr_load_regvars);
                  cg.a_label(exprasmlist,falselabel);
                  cg.a_label(exprasmlist,falselabel);
                  { erroraddr }
                  { erroraddr }
-                 cg.a_param_reg(exprasmlist,OS_ADDR,R_EBP,4);
+                 cg.a_param_reg(exprasmlist,OS_ADDR,R_EBP,getintparaloc(4));
                  { lineno }
                  { lineno }
-                 cg.a_param_const(exprasmlist,OS_INT,aktfilepos.line,3);
+                 cg.a_param_const(exprasmlist,OS_INT,aktfilepos.line,getintparaloc(3));
                  { filename string }
                  { filename string }
                  hp2:=cstringconstnode.createstr(current_module.sourcefiles.get_file_name(aktfilepos.fileindex),st_shortstring);
                  hp2:=cstringconstnode.createstr(current_module.sourcefiles.get_file_name(aktfilepos.fileindex),st_shortstring);
                  firstpass(hp2);
                  firstpass(hp2);
                  secondpass(hp2);
                  secondpass(hp2);
                  if codegenerror then
                  if codegenerror then
                   exit;
                   exit;
-                 cg.a_paramaddr_ref(exprasmlist,hp2.location.reference,2);
+                 cg.a_paramaddr_ref(exprasmlist,hp2.location.reference,getintparaloc(2));
                  hp2.free;
                  hp2.free;
                  { push msg }
                  { push msg }
                  secondpass(tcallparanode(tcallparanode(left).right).left);
                  secondpass(tcallparanode(tcallparanode(left).right).left);
-                 cg.a_paramaddr_ref(exprasmlist,tcallparanode(tcallparanode(left).right).left.location.reference,1);
+                 cg.a_paramaddr_ref(exprasmlist,tcallparanode(tcallparanode(left).right).left.location.reference,getintparaloc(1));
                  { call }
                  { call }
                  cg.a_call_name(exprasmlist,'FPC_ASSERT');
                  cg.a_call_name(exprasmlist,'FPC_ASSERT');
                  cg.a_label(exprasmlist,truelabel);
                  cg.a_label(exprasmlist,truelabel);
@@ -461,7 +461,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.46  2002-07-01 18:46:33  peter
+  Revision 1.47  2002-07-07 09:52:34  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.46  2002/07/01 18:46:33  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 13 - 9
compiler/i386/n386mem.pas

@@ -54,7 +54,7 @@ implementation
       aasmbase,aasmtai,aasmcpu,
       aasmbase,aasmtai,aasmcpu,
       cginfo,cgbase,pass_2,
       cginfo,cgbase,pass_2,
       pass_1,nld,ncon,nadd,
       pass_1,nld,ncon,nadd,
-      cpubase,
+      cpubase,cpupara,
       cgobj,cga,tgobj,rgobj,ncgutil;
       cgobj,cga,tgobj,rgobj,ncgutil;
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -89,7 +89,7 @@ implementation
             (cs_gdb_heaptrc in aktglobalswitches) and
             (cs_gdb_heaptrc in aktglobalswitches) and
             (cs_checkpointer in aktglobalswitches) then
             (cs_checkpointer in aktglobalswitches) then
           begin
           begin
-            cg.a_param_reg(exprasmlist, OS_ADDR,location.reference.base,1);
+            cg.a_param_reg(exprasmlist, OS_ADDR,location.reference.base,getintparaloc(1));
             cg.a_call_name(exprasmlist,'FPC_CHECKPOINTER');
             cg.a_call_name(exprasmlist,'FPC_CHECKPOINTER');
           end;
           end;
       end;
       end;
@@ -165,7 +165,7 @@ implementation
                         exit;
                         exit;
                      end;
                      end;
                    rg.saveusedregisters(exprasmlist,pushed,all_registers);
                    rg.saveusedregisters(exprasmlist,pushed,all_registers);
-                   cg.a_paramaddr_ref(exprasmlist,left.location.reference,1);
+                   cg.a_paramaddr_ref(exprasmlist,left.location.reference,getintparaloc(1));
                    rg.saveregvars(exprasmlist,all_registers);
                    rg.saveregvars(exprasmlist,all_registers);
                    cg.a_call_name(exprasmlist,'FPC_'+Upper(tstringdef(left.resulttype.def).stringtypname)+'_UNIQUE');
                    cg.a_call_name(exprasmlist,'FPC_'+Upper(tstringdef(left.resulttype.def).stringtypname)+'_UNIQUE');
                    cg.g_maybe_loadself(exprasmlist);
                    cg.g_maybe_loadself(exprasmlist);
@@ -192,7 +192,7 @@ implementation
               if (cs_check_range in aktlocalswitches) then
               if (cs_check_range in aktlocalswitches) then
                 begin
                 begin
                    rg.saveusedregisters(exprasmlist,pushed,all_registers);
                    rg.saveusedregisters(exprasmlist,pushed,all_registers);
-                   cg.a_param_reg(exprasmlist,OS_ADDR,location.reference.base,1);
+                   cg.a_param_reg(exprasmlist,OS_ADDR,location.reference.base,getintparaloc(1));
                    rg.saveregvars(exprasmlist,all_registers);
                    rg.saveregvars(exprasmlist,all_registers);
                    cg.a_call_name(exprasmlist,'FPC_'+Upper(tstringdef(left.resulttype.def).stringtypname)+'_CHECKZERO');
                    cg.a_call_name(exprasmlist,'FPC_'+Upper(tstringdef(left.resulttype.def).stringtypname)+'_CHECKZERO');
                    cg.g_maybe_loadself(exprasmlist);
                    cg.g_maybe_loadself(exprasmlist);
@@ -294,10 +294,10 @@ implementation
                         st_ansistring:
                         st_ansistring:
                           begin
                           begin
                              rg.saveusedregisters(exprasmlist,pushed,all_registers);
                              rg.saveusedregisters(exprasmlist,pushed,all_registers);
-                             cg.a_param_const(exprasmlist,OS_INT,tordconstnode(right).value,2);
+                             cg.a_param_const(exprasmlist,OS_INT,tordconstnode(right).value,getintparaloc(2));
                              href:=location.reference;
                              href:=location.reference;
                              dec(href.offset,7);
                              dec(href.offset,7);
-                             cg.a_param_ref(exprasmlist,OS_INT,href,1);
+                             cg.a_param_ref(exprasmlist,OS_INT,href,getintparaloc(1));
                              rg.saveregvars(exprasmlist,all_registers);
                              rg.saveregvars(exprasmlist,all_registers);
                              cg.a_call_name(exprasmlist,'FPC_'+Upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK');
                              cg.a_call_name(exprasmlist,'FPC_'+Upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK');
                              rg.restoreusedregisters(exprasmlist,pushed);
                              rg.restoreusedregisters(exprasmlist,pushed);
@@ -451,10 +451,10 @@ implementation
                          st_ansistring:
                          st_ansistring:
                            begin
                            begin
                               rg.saveusedregisters(exprasmlist,pushed,all_registers);
                               rg.saveusedregisters(exprasmlist,pushed,all_registers);
-                              cg.a_param_reg(exprasmlist,OS_INT,right.location.register,1);
+                              cg.a_param_reg(exprasmlist,OS_INT,right.location.register,getintparaloc(1));
                               href:=location.reference;
                               href:=location.reference;
                               dec(href.offset,7);
                               dec(href.offset,7);
-                              cg.a_param_ref(exprasmlist,OS_INT,href,1);
+                              cg.a_param_ref(exprasmlist,OS_INT,href,getintparaloc(1));
                               rg.saveregvars(exprasmlist,all_registers);
                               rg.saveregvars(exprasmlist,all_registers);
                               cg.a_call_name(exprasmlist,'FPC_'+Upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK');
                               cg.a_call_name(exprasmlist,'FPC_'+Upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK');
                               rg.restoreusedregisters(exprasmlist,pushed);
                               rg.restoreusedregisters(exprasmlist,pushed);
@@ -520,7 +520,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.35  2002-07-01 18:46:33  peter
+  Revision 1.36  2002-07-07 09:52:34  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.35  2002/07/01 18:46:33  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 8 - 4
compiler/i386/n386opt.pas

@@ -46,7 +46,7 @@ uses
   symdef,
   symdef,
   aasmbase,aasmtai,aasmcpu,
   aasmbase,aasmtai,aasmcpu,
   ncnv, ncon, pass_2,
   ncnv, ncon, pass_2,
-  cginfo, cgbase, cpubase,
+  cginfo, cgbase, cpubase, cpupara,
   tgobj, rgobj, cgobj, ncgutil;
   tgobj, rgobj, cgobj, ncgutil;
 
 
 
 
@@ -226,13 +226,13 @@ begin
   remove_non_regvars_from_loc(right.location,regstopush);
   remove_non_regvars_from_loc(right.location,regstopush);
   rg.saveusedregisters(exprasmlist,pushedregs,regstopush);
   rg.saveusedregisters(exprasmlist,pushedregs,regstopush);
   { push the maximum possible length of the result }
   { push the maximum possible length of the result }
-  cg.a_paramaddr_ref(exprasmlist,left.location.reference,2);
+  cg.a_paramaddr_ref(exprasmlist,left.location.reference,getintparaloc(2));
   { the optimizer can more easily put the          }
   { the optimizer can more easily put the          }
   { deallocations in the right place if it happens }
   { deallocations in the right place if it happens }
   { too early than when it happens too late (if    }
   { too early than when it happens too late (if    }
   { the pushref needs a "lea (..),edi; push edi")  }
   { the pushref needs a "lea (..),edi; push edi")  }
   reference_release(exprasmlist,right.location.reference);
   reference_release(exprasmlist,right.location.reference);
-  cg.a_paramaddr_ref(exprasmlist,right.location.reference,1);
+  cg.a_paramaddr_ref(exprasmlist,right.location.reference,getintparaloc(1));
   rg.saveregvars(exprasmlist,regstopush);
   rg.saveregvars(exprasmlist,regstopush);
   cg.a_call_name(exprasmlist,'FPC_SHORTSTR_CONCAT');
   cg.a_call_name(exprasmlist,'FPC_SHORTSTR_CONCAT');
   tg.ungetiftemp(exprasmlist,right.location.reference);
   tg.ungetiftemp(exprasmlist,right.location.reference);
@@ -248,7 +248,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.18  2002-07-01 18:46:33  peter
+  Revision 1.19  2002-07-07 09:52:34  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.18  2002/07/01 18:46:33  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 11 - 7
compiler/ncgcnv.pas

@@ -64,7 +64,7 @@ interface
       cutils,verbose,
       cutils,verbose,
       aasmbase,aasmtai,aasmcpu,symconst,symdef,
       aasmbase,aasmtai,aasmcpu,symconst,symdef,
       ncon,ncal,
       ncon,ncal,
-      cpubase,cpuinfo,
+      cpubase,cpuinfo,cpupara,
       pass_2,
       pass_2,
       cginfo,cgbase,
       cginfo,cgbase,
       cgobj,cgcpu,
       cgobj,cgcpu,
@@ -450,10 +450,10 @@ interface
            { instance to check }
            { instance to check }
            secondpass(left);
            secondpass(left);
            rg.saveusedregisters(exprasmlist,pushed,all_registers);
            rg.saveusedregisters(exprasmlist,pushed,all_registers);
-           cg.a_param_loc(exprasmlist,left.location,2);
+           cg.a_param_loc(exprasmlist,left.location,getintparaloc(2));
            { type information }
            { type information }
            secondpass(right);
            secondpass(right);
-           cg.a_paramaddr_ref(exprasmlist,right.location.reference,1);
+           cg.a_paramaddr_ref(exprasmlist,right.location.reference,getintparaloc(1));
            location_release(exprasmlist,right.location);
            location_release(exprasmlist,right.location);
            { call helper }
            { call helper }
            if is_class(left.resulttype.def) then
            if is_class(left.resulttype.def) then
@@ -468,10 +468,10 @@ interface
            { instance to check }
            { instance to check }
            secondpass(left);
            secondpass(left);
            rg.saveusedregisters(exprasmlist,pushed,all_registers);
            rg.saveusedregisters(exprasmlist,pushed,all_registers);
-           cg.a_param_loc(exprasmlist,left.location,2);
+           cg.a_param_loc(exprasmlist,left.location,getintparaloc(2));
            { type information }
            { type information }
            secondpass(right);
            secondpass(right);
-           cg.a_param_loc(exprasmlist,right.location,1);
+           cg.a_param_loc(exprasmlist,right.location,getintparaloc(1));
            location_release(exprasmlist,right.location);
            location_release(exprasmlist,right.location);
            { call helper }
            { call helper }
            cg.a_call_name(exprasmlist,'FPC_DO_AS');
            cg.a_call_name(exprasmlist,'FPC_DO_AS');
@@ -490,7 +490,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.18  2002-07-04 20:43:01  florian
+  Revision 1.19  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.18  2002/07/04 20:43:01  florian
     * first x86-64 patches
     * first x86-64 patches
 
 
   Revision 1.17  2002/07/01 18:46:22  peter
   Revision 1.17  2002/07/01 18:46:22  peter
@@ -583,4 +587,4 @@ end.
     - list field removed of the tnode class because it's not used currently
     - list field removed of the tnode class because it's not used currently
       and can cause hard-to-find bugs
       and can cause hard-to-find bugs
 
 
-}
+}

+ 9 - 5
compiler/ncgld.pas

@@ -57,7 +57,7 @@ implementation
       ncnv,ncon,nmem,
       ncnv,ncon,nmem,
       aasmbase,aasmtai,aasmcpu,regvars,
       aasmbase,aasmtai,aasmcpu,regvars,
       cginfo,cgbase,pass_2,
       cginfo,cgbase,pass_2,
-      cpubase,cpuinfo,
+      cpubase,cpuinfo,cpupara,
       tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu;
       tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu;
 
 
 {*****************************************************************************
 {*****************************************************************************
@@ -132,7 +132,7 @@ implementation
                     begin
                     begin
                        rg.saveusedregisters(exprasmlist,pushed,[accumulator]);
                        rg.saveusedregisters(exprasmlist,pushed,[accumulator]);
                        reference_reset_symbol(href,newasmsymbol(tvarsym(symtableentry).mangledname),0);
                        reference_reset_symbol(href,newasmsymbol(tvarsym(symtableentry).mangledname),0);
-                       cg.a_param_ref(exprasmlist,OS_ADDR,href,1);
+                       cg.a_param_ref(exprasmlist,OS_ADDR,href,getintparaloc(1));
                        { the called procedure isn't allowed to change }
                        { the called procedure isn't allowed to change }
                        { any register except EAX                    }
                        { any register except EAX                    }
                        cg.a_call_name(exprasmlist,'FPC_RELOCATE_THREADVAR');
                        cg.a_call_name(exprasmlist,'FPC_RELOCATE_THREADVAR');
@@ -845,13 +845,13 @@ implementation
                     if vaddr then
                     if vaddr then
                      begin
                      begin
                        location_force_mem(exprasmlist,hp.left.location);
                        location_force_mem(exprasmlist,hp.left.location);
-                       cg.a_paramaddr_ref(exprasmlist,hp.left.location.reference,-1);
+                       cg.a_paramaddr_ref(exprasmlist,hp.left.location.reference,paralocdummy);
                        location_release(exprasmlist,hp.left.location);
                        location_release(exprasmlist,hp.left.location);
                        if freetemp then
                        if freetemp then
                         location_freetemp(exprasmlist,hp.left.location);
                         location_freetemp(exprasmlist,hp.left.location);
                      end
                      end
                     else
                     else
-                     cg.a_param_loc(exprasmlist,hp.left.location,-1);
+                     cg.a_param_loc(exprasmlist,hp.left.location,paralocdummy);
                     inc(pushedparasize,pointer_size);
                     inc(pushedparasize,pointer_size);
                   end
                   end
                  else
                  else
@@ -921,7 +921,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.11  2002-07-01 18:46:23  peter
+  Revision 1.12  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.11  2002/07/01 18:46:23  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 10 - 3
compiler/ncgmem.pas

@@ -21,6 +21,8 @@
 
 
  ****************************************************************************
  ****************************************************************************
 }
 }
+{ This unit generate assembler for memory related nodes.
+}
 unit ncgmem;
 unit ncgmem;
 
 
 {$i fpcdefs.inc}
 {$i fpcdefs.inc}
@@ -76,7 +78,8 @@ implementation
       aasmbase,aasmtai,aasmcpu,
       aasmbase,aasmtai,aasmcpu,
       cgbase,pass_2,
       cgbase,pass_2,
       nld,ncon,nadd,
       nld,ncon,nadd,
-      cpuinfo,cpubase,cgobj,cgcpu,
+      cpuinfo,cpubase,cpupara,
+      cgobj,cgcpu,
       tgobj,rgobj
       tgobj,rgobj
 {$ifdef GDB}
 {$ifdef GDB}
   {$ifdef delphi}
   {$ifdef delphi}
@@ -243,7 +246,7 @@ implementation
          if (cs_gdb_heaptrc in aktglobalswitches) and
          if (cs_gdb_heaptrc in aktglobalswitches) and
             (cs_checkpointer in aktglobalswitches) then
             (cs_checkpointer in aktglobalswitches) then
           begin
           begin
-            cg.a_param_reg(exprasmlist, OS_ADDR,location.reference.base,1);
+            cg.a_param_reg(exprasmlist, OS_ADDR,location.reference.base,getintparaloc(1));
             cg.a_call_name(exprasmlist,'FPC_CHECKPOINTER');
             cg.a_call_name(exprasmlist,'FPC_CHECKPOINTER');
           end;
           end;
       end;
       end;
@@ -463,7 +466,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.15  2002-07-01 18:46:23  peter
+  Revision 1.16  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.15  2002/07/01 18:46:23  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 24 - 16
compiler/ncgutil.pas

@@ -28,7 +28,9 @@ interface
 
 
     uses
     uses
       node,
       node,
-      cginfo,cpubase,aasmbase,aasmtai,aasmcpu,
+      cpubase,cpupara,
+      aasmbase,aasmtai,aasmcpu,
+      cginfo,
       rgobj;
       rgobj;
 
 
     type
     type
@@ -51,7 +53,8 @@ interface
     function  maybe_pushfpu(list:taasmoutput;needed : byte;var l:tlocation) : boolean;
     function  maybe_pushfpu(list:taasmoutput;needed : byte;var l:tlocation) : boolean;
 
 
     procedure push_value_para(p:tnode;inlined,is_cdecl:boolean;
     procedure push_value_para(p:tnode;inlined,is_cdecl:boolean;
-                              para_offset:longint;alignment : longint);
+                              para_offset:longint;alignment : longint;
+                              const locpara : tparalocation);
 
 
     procedure genentrycode(list : TAAsmoutput;
     procedure genentrycode(list : TAAsmoutput;
                            make_global:boolean;
                            make_global:boolean;
@@ -590,7 +593,8 @@ implementation
 *****************************************************************************}
 *****************************************************************************}
 
 
     procedure push_value_para(p:tnode;inlined,is_cdecl:boolean;
     procedure push_value_para(p:tnode;inlined,is_cdecl:boolean;
-                              para_offset:longint;alignment : longint);
+                              para_offset:longint;alignment : longint;
+                              const locpara : tparalocation);
       var
       var
         tempreference : treference;
         tempreference : treference;
         href : treference;
         href : treference;
@@ -657,7 +661,7 @@ implementation
                        cg.a_load_ref_ref(exprasmlist,cgsize,tempreference,href);
                        cg.a_load_ref_ref(exprasmlist,cgsize,tempreference,href);
                      end
                      end
                     else
                     else
-                     cg.a_param_ref(exprasmlist,cgsize,tempreference,-1);
+                     cg.a_param_ref(exprasmlist,cgsize,tempreference,locpara);
                   end;
                   end;
                end;
                end;
              else
              else
@@ -698,7 +702,7 @@ implementation
                           cg64.a_load64_loc_ref(exprasmlist,p.location,href);
                           cg64.a_load64_loc_ref(exprasmlist,p.location,href);
                         end
                         end
                        else
                        else
-                        cg64.a_param64_loc(exprasmlist,p.location,-1);
+                        cg64.a_param64_loc(exprasmlist,p.location,locpara);
                      end
                      end
                     else
                     else
                      begin
                      begin
@@ -729,7 +733,7 @@ implementation
                           cg.a_load_loc_ref(exprasmlist,p.location,href);
                           cg.a_load_loc_ref(exprasmlist,p.location,href);
                         end
                         end
                        else
                        else
-                        cg.a_param_loc(exprasmlist,p.location,-1);
+                        cg.a_param_loc(exprasmlist,p.location,locpara);
                        { restore old register }
                        { restore old register }
                        if p.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
                        if p.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
                          p.location.register:=hreg;
                          p.location.register:=hreg;
@@ -797,9 +801,9 @@ implementation
         if (tsym(p).typ=varsym) and
         if (tsym(p).typ=varsym) and
            (vo_is_thread_var in tvarsym(p).varoptions) then
            (vo_is_thread_var in tvarsym(p).varoptions) then
          begin
          begin
-           cg.a_param_const(list,OS_INT,tvarsym(p).getsize,2);
+           cg.a_param_const(list,OS_INT,tvarsym(p).getsize,getintparaloc(2));
            reference_reset_symbol(href,newasmsymbol(tvarsym(p).mangledname),0);
            reference_reset_symbol(href,newasmsymbol(tvarsym(p).mangledname),0);
-           cg.a_paramaddr_ref(list,href,2);
+           cg.a_paramaddr_ref(list,href,getintparaloc(1));
            rg.saveregvars(list,all_registers);
            rg.saveregvars(list,all_registers);
            cg.a_call_name(list,'FPC_INIT_THREADVAR');
            cg.a_call_name(list,'FPC_INIT_THREADVAR');
          end;
          end;
@@ -947,20 +951,20 @@ implementation
              tt_freeansistring :
              tt_freeansistring :
                begin
                begin
                  reference_reset_base(href,procinfo^.framepointer,hp^.pos);
                  reference_reset_base(href,procinfo^.framepointer,hp^.pos);
-                 cg.a_paramaddr_ref(list,href,1);
+                 cg.a_paramaddr_ref(list,href,getintparaloc(1));
                  cg.a_call_name(list,'FPC_ANSISTR_DECR_REF');
                  cg.a_call_name(list,'FPC_ANSISTR_DECR_REF');
                end;
                end;
              tt_widestring,
              tt_widestring,
              tt_freewidestring :
              tt_freewidestring :
                begin
                begin
                  reference_reset_base(href,procinfo^.framepointer,hp^.pos);
                  reference_reset_base(href,procinfo^.framepointer,hp^.pos);
-                 cg.a_paramaddr_ref(list,href,1);
+                 cg.a_paramaddr_ref(list,href,getintparaloc(2));
                  cg.a_call_name(list,'FPC_WIDESTR_DECR_REF');
                  cg.a_call_name(list,'FPC_WIDESTR_DECR_REF');
                end;
                end;
              tt_interfacecom :
              tt_interfacecom :
                begin
                begin
                  reference_reset_base(href,procinfo^.framepointer,hp^.pos);
                  reference_reset_base(href,procinfo^.framepointer,hp^.pos);
-                 cg.a_paramaddr_ref(list,href,1);
+                 cg.a_paramaddr_ref(list,href,getintparaloc(2));
                  cg.a_call_name(list,'FPC_INTF_DECR_REF');
                  cg.a_call_name(list,'FPC_INTF_DECR_REF');
                end;
                end;
            end;
            end;
@@ -1342,14 +1346,14 @@ implementation
                             cg.a_cmp_const_ref_label(list,OS_ADDR,OC_EQ,0,href,nodestroycall);
                             cg.a_cmp_const_ref_label(list,OS_ADDR,OC_EQ,0,href,nodestroycall);
                             if is_class(procinfo^._class) then
                             if is_class(procinfo^._class) then
                              begin
                              begin
-                               cg.a_param_const(list,OS_INT,1,2);
-                               cg.a_param_reg(list,OS_ADDR,self_pointer_reg,1);
+                               cg.a_param_const(list,OS_INT,1,getintparaloc(2));
+                               cg.a_param_reg(list,OS_ADDR,self_pointer_reg,getintparaloc(1));
                              end
                              end
                             else if is_object(procinfo^._class) then
                             else if is_object(procinfo^._class) then
                              begin
                              begin
-                               cg.a_param_reg(list,OS_ADDR,self_pointer_reg,2);
+                               cg.a_param_reg(list,OS_ADDR,self_pointer_reg,getintparaloc(2));
                                reference_reset_symbol(href,newasmsymbol(procinfo^._class.vmt_mangledname),0);
                                reference_reset_symbol(href,newasmsymbol(procinfo^._class.vmt_mangledname),0);
-                               cg.a_paramaddr_ref(list,href,1);
+                               cg.a_paramaddr_ref(list,href,getintparaloc(1));
                              end
                              end
                             else
                             else
                              Internalerror(200006164);
                              Internalerror(200006164);
@@ -1611,7 +1615,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.19  2002-07-01 18:46:23  peter
+  Revision 1.20  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.19  2002/07/01 18:46:23  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 7 - 3
compiler/psub.pas

@@ -279,7 +279,7 @@ implementation
          { reset the temporary memory }
          { reset the temporary memory }
          rg.cleartempgen;
          rg.cleartempgen;
          rg.usedinproc:=[];
          rg.usedinproc:=[];
-         
+
          { save entry info }
          { save entry info }
          entrypos:=aktfilepos;
          entrypos:=aktfilepos;
          entryswitches:=aktlocalswitches;
          entryswitches:=aktlocalswitches;
@@ -816,7 +816,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.55  2002-07-04 20:43:01  florian
+  Revision 1.56  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.55  2002/07/04 20:43:01  florian
     * first x86-64 patches
     * first x86-64 patches
 
 
   Revision 1.54  2002/07/01 18:46:25  peter
   Revision 1.54  2002/07/01 18:46:25  peter
@@ -901,4 +905,4 @@ end.
   Revision 1.42  2002/01/19 15:12:34  peter
   Revision 1.42  2002/01/19 15:12:34  peter
     * check for unresolved forward classes in the interface
     * check for unresolved forward classes in the interface
 
 
-}
+}

+ 10 - 1
compiler/psystem.pas

@@ -253,6 +253,11 @@ begin
   s64floattype.setdef(tfloatdef.create(s64real));
   s64floattype.setdef(tfloatdef.create(s64real));
   s80floattype.setdef(tfloatdef.create(s80real));
   s80floattype.setdef(tfloatdef.create(s80real));
 {$endif x86}
 {$endif x86}
+{$ifdef powerpc}
+  s32floattype.setdef(tfloatdef.create(s32real));
+  s64floattype.setdef(tfloatdef.create(s64real));
+  s80floattype.setdef(tfloatdef.create(s80real));
+{$endif powerpc}
 {$ifdef sparc}
 {$ifdef sparc}
   s32floattype.setdef(tfloatdef.create(s32real));
   s32floattype.setdef(tfloatdef.create(s32real));
   s64floattype.setdef(tfloatdef.create(s64real));
   s64floattype.setdef(tfloatdef.create(s64real));
@@ -284,7 +289,11 @@ end;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.29  2002-07-06 20:18:47  carl
+  Revision 1.30  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.29  2002/07/06 20:18:47  carl
   + more SPARC patches from Mazen
   + more SPARC patches from Mazen
 
 
   Revision 1.28  2002/07/04 20:43:02  florian
   Revision 1.28  2002/07/04 20:43:02  florian

+ 8 - 2
compiler/rgobj.pas

@@ -378,13 +378,15 @@ unit rgobj;
     procedure trgobj.ungetregister(list: taasmoutput; r : tregister);
     procedure trgobj.ungetregister(list: taasmoutput; r : tregister);
 
 
       begin
       begin
+         if r=R_NO then
+           exit;
          if r in intregs then
          if r in intregs then
            ungetregisterint(list,r)
            ungetregisterint(list,r)
          else if r in fpuregs then
          else if r in fpuregs then
            ungetregisterfpu(list,r)
            ungetregisterfpu(list,r)
          else if r in mmregs then
          else if r in mmregs then
            ungetregistermm(list,r)
            ungetregistermm(list,r)
-         else internalerror(18);
+         else internalerror(2002070602);
       end;
       end;
 
 
 
 
@@ -854,7 +856,11 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.12  2002-07-01 18:46:26  peter
+  Revision 1.13  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.12  2002/07/01 18:46:26  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer
 
 

+ 9 - 1
compiler/symdef.pas

@@ -97,6 +97,7 @@ interface
           paratype     : ttype;
           paratype     : ttype;
           parasym      : tsym;
           parasym      : tsym;
           paratyp      : tvarspez;
           paratyp      : tvarspez;
+          paraloc      : tparalocation;
           argconvtyp   : targconvtyp;
           argconvtyp   : targconvtyp;
           convertlevel : byte;
           convertlevel : byte;
           defaultvalue : tsym; { tconstsym }
           defaultvalue : tsym; { tconstsym }
@@ -3158,6 +3159,8 @@ implementation
             ppufile.gettype(hp.paratype);
             ppufile.gettype(hp.paratype);
             hp.defaultvalue:=tsym(ppufile.getderef);
             hp.defaultvalue:=tsym(ppufile.getderef);
             hp.parasym:=tsym(ppufile.getderef);
             hp.parasym:=tsym(ppufile.getderef);
+            { later, we'll gerate this on the fly (FK) }
+            ppufile.getdata(hp.paraloc,sizeof(tparalocation));
             if not assigned(hp.defaultvalue) then
             if not assigned(hp.defaultvalue) then
              inc(minparacount);
              inc(minparacount);
             inc(maxparacount);
             inc(maxparacount);
@@ -3191,6 +3194,7 @@ implementation
             ppufile.puttype(hp.paratype);
             ppufile.puttype(hp.paratype);
             ppufile.putderef(hp.defaultvalue);
             ppufile.putderef(hp.defaultvalue);
             ppufile.putderef(hp.parasym);
             ppufile.putderef(hp.parasym);
+            ppufile.putdata(hp.paraloc,sizeof(tparalocation));
             hp:=TParaItem(hp.next);
             hp:=TParaItem(hp.next);
           end;
           end;
       end;
       end;
@@ -5478,7 +5482,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.81  2002-07-01 18:46:26  peter
+  Revision 1.82  2002-07-07 09:52:32  florian
+    * powerpc target fixed, very simple units can be compiled
+    * some basic stuff for better callparanode handling, far from being finished
+
+  Revision 1.81  2002/07/01 18:46:26  peter
     * internal linker
     * internal linker
     * reorganized aasm layer
     * reorganized aasm layer