浏览代码

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

florian 23 年之前
父节点
当前提交
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
   are then overriden for each assembler writer to actually write the data in these
   classes to an assembler file.
@@ -781,7 +781,11 @@ implementation
 end.
 {
   $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
     * 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;
 
@@ -796,7 +796,11 @@ var
 end.
 {
   $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
     * reorganized aasm layer
 

+ 7 - 2
compiler/aoptbase.pas

@@ -25,7 +25,8 @@ unit aoptbase;
 
 Interface
 
-uses aasm, cpuasm,cpubase;
+uses aasmbase,aasmcpu,aasmtai,
+  cpubase;
 
 { the number of tai objects processed by an optimizer object since the last }
 { time a register was modified                                              }
@@ -261,7 +262,11 @@ End.
 
 {
   $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
 
   Revision 1.4  2002/05/16 19:46:34  carl

+ 8 - 3
compiler/aoptobj.pas

@@ -29,7 +29,8 @@ Unit AoptObj;
 
 Interface
 
-uses aasm, cclasses, cpuinfo, cpubase, cpuasm, aoptbase, aoptcpub;
+uses aasmbase,aasmcpu,aasmtai,
+  cclasses, cpuinfo, cpubase, aoptbase, aoptcpub;
 
 { ************************************************************************* }
 { ********************************* Constants ***************************** }
@@ -277,7 +278,7 @@ Type
 
 Implementation
 
-uses globtype, globals, cgbase, tainst;
+uses globtype, globals, cgbase;
 
 { ************************************************************************* }
 { ******************************** TUsedRegs ****************************** }
@@ -787,7 +788,11 @@ End.
 
 {
  $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
    * 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_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;
           const todef: tdef); override;
@@ -364,56 +364,60 @@ unit cg64f32;
       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
-         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 }
          { maybe the parameter numbering needs }
          { to take care of this on 32 Bit      }
          { systems FK                          }
-         cg.a_param_reg(list,OS_32,reg.reglo,nr+1);
+         cg.a_param_reg(list,OS_32,reg.reglo,locpara);
       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
+{$warning FIX ME}
         if target_info.endian<>source_info.endian then
           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 }
          { maybe the parameter numbering needs }
          { to take care of this on 32 Bit      }
          { systems FK                          }
-         cg.a_param_const(list,OS_32,lo(value),nr+1);
+         cg.a_param_const(list,OS_32,lo(value),locpara);
       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
         tmpref: treference;
       begin
+{$warning FIX ME}
         tmpref := r;
         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 }
         { maybe the parameter numbering needs }
         { to take care of this on 32 Bit      }
         { systems FK                          }
-        cg.a_param_ref(list,OS_32,r,nr+1);
+        cg.a_param_ref(list,OS_32,r,locpara);
       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
+{$warning FIX ME}
         case l.loc of
           LOC_REGISTER,
           LOC_CREGISTER :
-            a_param64_reg(list,l.register64,nr);
+            a_param64_reg(list,l.register64,locpara);
           LOC_CONSTANT :
-            a_param64_const(list,l.valueqword,nr);
+            a_param64_const(list,l.valueqword,locpara);
           LOC_CREFERENCE,
           LOC_REFERENCE :
-            a_param64_ref(list,l.reference,nr);
+            a_param64_ref(list,l.reference,locpara);
         else
           internalerror(200203287);
         end;
@@ -587,7 +591,11 @@ begin
 end.
 {
   $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
     * reorganized aasm layer
 

+ 12 - 3
compiler/cginfo.pas

@@ -93,15 +93,24 @@ interface
        tcgsize2tfloat: array[OS_F32..OS_C64] of tfloattype =
          (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
 
 end.
 {
   $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
     * basics for currency
     * asnode updates for class and interface (not finished)

+ 60 - 54
compiler/cgobj.pas

@@ -33,7 +33,7 @@ unit cgobj;
 
     uses
        cclasses,aasmbase,aasmtai,aasmcpu,symtable,
-       cpubase,cpuinfo,
+       cpubase,cpuinfo,cpupara,
        cginfo,
        symconst,symbase,symtype,node;
 
@@ -109,7 +109,7 @@ unit cgobj;
              @param(r register source of the operand)
              @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.
 
              A generic version is provided.
@@ -118,7 +118,7 @@ unit cgobj;
              @param(a value of constant to send)
              @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.
 
              A generic version is provided.
@@ -127,7 +127,7 @@ unit cgobj;
              @param(r Memory reference of value to send)
              @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,
              to a routine.
 
@@ -136,7 +136,7 @@ unit cgobj;
              @param(l location of the operand to send)
              @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.
 
              A generic version is provided.
@@ -144,7 +144,7 @@ unit cgobj;
              @param(r reference to get address from)
              @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: }
@@ -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_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 }
         procedure g_rangecheck64(list: taasmoutput; const p: tnode;
@@ -467,7 +467,7 @@ unit cgobj;
           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
          hr : tregister;
@@ -475,11 +475,11 @@ unit cgobj;
       begin
          hr:=get_scratch_reg_int(list);
          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);
       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
          hr : tregister;
@@ -487,30 +487,30 @@ unit cgobj;
       begin
          hr:=get_scratch_reg_int(list);
          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);
       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
         case l.loc of
           LOC_REGISTER,
           LOC_CREGISTER :
-            a_param_reg(list,l.size,l.register,nr);
+            a_param_reg(list,l.size,l.register,locpara);
           LOC_CONSTANT :
-            a_param_const(list,l.size,l.value,nr);
+            a_param_const(list,l.size,l.value,locpara);
           LOC_CREFERENCE,
           LOC_REFERENCE :
-            a_param_ref(list,l.size,l.reference,nr);
+            a_param_ref(list,l.size,l.reference,locpara);
         else
           internalerror(2002032211);
         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
          hr : tregister;
@@ -518,7 +518,7 @@ unit cgobj;
       begin
          hr:=get_scratch_reg_address(list);
          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);
       end;
 
@@ -894,14 +894,15 @@ unit cgobj;
 
     procedure tcg.g_copyshortstring(list : taasmoutput;const source,dest : treference;len:byte;delsource,loadref : boolean);
       begin
-        a_paramaddr_ref(list,dest,3);
+        {$warning FIX ME!}
+        a_paramaddr_ref(list,dest,getintparaloc(3));
         if loadref then
-         a_param_ref(list,OS_ADDR,source,2)
+          a_param_ref(list,OS_ADDR,source,getintparaloc(2))
         else
-         a_paramaddr_ref(list,source,2);
+          a_paramaddr_ref(list,source,getintparaloc(2));
         if delsource then
          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');
         g_maybe_loadself(list);
       end;
@@ -927,14 +928,14 @@ unit cgobj;
          { call the special incr function or the generic addref }
          if incrfunc<>'' then
           begin
-            a_param_ref(list,OS_ADDR,ref,1);
+            a_param_ref(list,OS_ADDR,ref,getintparaloc(1));
             a_call_name(list,incrfunc);
           end
          else
           begin
             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');
          end;
       end;
@@ -958,14 +959,14 @@ unit cgobj;
          { call the special decr function or the generic decref }
          if decrfunc<>'' then
           begin
-            a_paramaddr_ref(list,ref,1);
+            a_paramaddr_ref(list,ref,getintparaloc(1));
             a_call_name(list,decrfunc);
           end
          else
           begin
             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');
          end;
       end;
@@ -982,11 +983,11 @@ unit cgobj;
          else
            begin
               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
-                a_param_ref(list,OS_ADDR,ref,1)
+                a_param_ref(list,OS_ADDR,ref,getintparaloc(1))
               else
-                a_paramaddr_ref(list,ref,1);
+                a_paramaddr_ref(list,ref,getintparaloc(1));
               a_call_name(list,'FPC_INITIALIZE');
            end;
       end;
@@ -1003,11 +1004,11 @@ unit cgobj;
          else
            begin
               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
-                a_param_ref(list,OS_ADDR,ref,1)
+                a_param_ref(list,OS_ADDR,ref,getintparaloc(1))
               else
-                a_paramaddr_ref(list,ref,1);
+                a_paramaddr_ref(list,ref,getintparaloc(1));
               a_call_name(list,'FPC_FINALIZE');
            end;
       end;
@@ -1137,7 +1138,7 @@ unit cgobj;
     procedure tcg.g_stackcheck(list : taasmoutput;stackframesize : longint);
 
       begin
-         a_param_const(list,OS_32,stackframesize,1);
+         a_param_const(list,OS_32,stackframesize,getintparaloc(1));
          a_call_name(list,'FPC_STACKCHECK');
       end;
 
@@ -1190,10 +1191,11 @@ unit cgobj;
             {!! this is a terrible hack, normally the helper should get three params : }
             {    one with self register, one with flag and one with VMT pointer        }
             {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)  }
             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_load_reg_reg(list,OS_ADDR,accumulator,SELF_POINTER_REG);
             { save the self pointer result }
@@ -1203,19 +1205,19 @@ unit cgobj;
         else if is_object(procinfo^._class) then
           begin
             { 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 }
             {  this is the first(?) parameter which was pushed to the constructor }
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset-POINTER_SIZE);
             hregister:=get_scratch_reg_address(list);
             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);
             { parameter 1 : address of self pointer   }
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset);
             hregister:=get_scratch_reg_address(list);
             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);
             a_call_name(list,'FPC_HELP_CONSTRUCTOR');
             a_load_reg_reg(list,OS_ADDR,accumulator,SELF_POINTER_REG);
@@ -1236,10 +1238,10 @@ unit cgobj;
          begin
            { 2nd parameter  : flag }
            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 }
            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')
          end
         else if is_object(procinfo^._class) then
@@ -1256,16 +1258,16 @@ unit cgobj;
             end;
            { actually call destructor }
             { 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 }
             {  this is the first parameter which was pushed to the destructor }
             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   }
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset);
             hregister:=get_scratch_reg_address(list);
             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);
             a_call_name(list,'FPC_HELP_DESTRUCTOR');
          end
@@ -1281,8 +1283,8 @@ unit cgobj;
       begin
         if is_class(procinfo^._class) then
           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.
             }
             { 2nd parameter  : flag }
@@ -1299,19 +1301,19 @@ unit cgobj;
         else if is_object(procinfo^._class) then
           begin
             { 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 }
             {  this is the first(?) parameter which was pushed to the constructor }
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset-POINTER_SIZE);
             hregister:=get_scratch_reg_address(list);
             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);
             { parameter 1 : address of self pointer   }
             reference_reset_base(href, procinfo^.framepointer,procinfo^.selfpointer_offset);
             hregister:=get_scratch_reg_address(list);
             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);
             a_call_name(list,'FPC_HELP_FAIL');
             { SET SELF TO NIL }
@@ -1342,7 +1344,11 @@ finalization
 end.
 {
   $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
 
   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
     * removed compiler warnings
 
-}
+}

+ 6 - 3
compiler/cutils.pas

@@ -452,8 +452,7 @@ uses
      var
         hs : string;
      begin
-        str(i,hs);
-        tostr:=hs;
+        str(i,result);
      end;
 
 
@@ -804,7 +803,11 @@ initialization
 end.
 {
   $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
     * 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;
 
 {$i fpcdefs.inc}
@@ -34,7 +36,7 @@ interface
     type
       T386ATTAssembler=class(TGNUassembler)
       public
-        procedure WriteInstruction(hp: tai);  override;
+        procedure WriteInstruction(hp: tai);override;
       end;
 
     TAttSuffix = (AttSufNONE,AttSufINT,AttSufFPU,AttSufFPUint);
@@ -338,7 +340,11 @@ initialization
 end.
 {
   $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
     * reorganized aasm layer
 

+ 20 - 15
compiler/i386/cgcpu.pas

@@ -20,7 +20,8 @@
 
  ****************************************************************************
 }
-
+{ This unit implements the code generator for the i386.
+}
 unit cgcpu;
 
 {$i fpcdefs.inc}
@@ -30,7 +31,7 @@ unit cgcpu;
     uses
        cginfo,cgbase,cgobj,cg64f32,
        aasmbase,aasmtai,aasmcpu,
-       cpubase,cpuinfo,
+       cpubase,cpuinfo,cpupara,
        node,symconst;
 
     type
@@ -41,10 +42,10 @@ unit cgcpu;
         { left to right), this allows to move the parameter to    }
         { register, if the cpu supports register calling          }
         { 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;
@@ -318,7 +319,7 @@ unit cgcpu;
     { we implement the following routines because otherwise we can't }
     { 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
         case size of
           OS_8,OS_S8,
@@ -337,7 +338,7 @@ unit cgcpu;
       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
         case size of
@@ -356,7 +357,7 @@ unit cgcpu;
       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
         tmpreg: tregister;
@@ -382,7 +383,7 @@ unit cgcpu;
       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
         tmpreg: tregister;
@@ -1341,13 +1342,13 @@ unit cgcpu;
          tempaddr:=exceptbuf;
          tempbuf:=exceptbuf;
          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_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_call_name(list,'FPC_SETJMP');
          list.concat(tai_regalloc.Alloc(accumulator));
@@ -1784,7 +1785,11 @@ begin
 end.
 {
   $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
     * 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
       );
 
-      {# A type to store register locations for 64 Bit values. }
+      { A type to store register locations for 64 Bit values. }
       tregister64 = packed record
         reglo,reghi : tregister;
       end;
 
-      {# alias for compact code }
+      { alias for compact code }
       treg64 = tregister64;
 
       {# Set type definition for registers }
@@ -210,6 +210,13 @@ uses
          options     : trefoptions;
       end;
 
+      { reference record }
+      pparareference = ^tparareference;
+      tparareference = packed record
+         index       : tregister;
+         offset      : longint;
+      end;
+
 {*****************************************************************************
                                 Operands
 *****************************************************************************}
@@ -249,6 +256,29 @@ uses
         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
          loc  : TLoc;
          size : TCGSize;
@@ -456,7 +486,11 @@ implementation
 end.
 {
   $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
     * 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,
       symconst,symdef,aasmbase,aasmtai,aasmcpu,types,htypechk,
       cgbase,pass_2,regvars,
+      cpupara,
       ncon,nset,
       cga,ncgutil,tgobj,rgobj,rgcpu,cgobj,cg64f32;
 
@@ -378,13 +379,13 @@ interface
                         remove_non_regvars_from_loc(right.location,regstopush);
                         rg.saveusedregisters(exprasmlist,pushed,regstopush);
                         { 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          }
                         { deallocations in the right place if it happens }
                         { too early than when it happens too late (if    }
                         { the pushref needs a "lea (..),edi; push edi")  }
                         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);
                         cg.a_call_name(exprasmlist,'FPC_SHORTSTR_CONCAT');
                         tg.ungetiftemp(exprasmlist,right.location.reference);
@@ -398,10 +399,10 @@ interface
                        rg.saveusedregisters(exprasmlist,pushed,all_registers);
                        secondpass(left);
                        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);
                        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);
                        cg.a_call_name(exprasmlist,'FPC_SHORTSTR_COMPARE');
                        cg.g_maybe_loadself(exprasmlist);
@@ -1571,7 +1572,11 @@ begin
 end.
 {
   $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
     * reorganized aasm layer
 

+ 50 - 45
compiler/i386/n386cal.pas

@@ -61,7 +61,8 @@ implementation
       gdb,
 {$endif GDB}
       cginfo,cgbase,pass_2,
-      cpubase,aasmbase,aasmtai,aasmcpu,
+      cpubase,cpupara,
+      aasmbase,aasmtai,aasmcpu,
       nmem,nld,ncnv,
       ncgutil,cga,cgobj,tgobj,regvars,rgobj,rgcpu,cg64f32,cgcpu;
 
@@ -81,7 +82,7 @@ implementation
             begin
               secondpass(hightree);
               { 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;
 
@@ -119,11 +120,11 @@ implementation
              if push_addr_param(left.resulttype.def) then
                begin
                  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);
                end
              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
          { filter array constructor with c styled args }
          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);
                     end
                   else
-                    cg.a_param_loc(exprasmlist,left.location,-1);
+                    cg.a_param_loc(exprasmlist,left.location,paralocdummy);
                   location_release(exprasmlist,left.location);
                 end
               else
@@ -168,7 +169,7 @@ implementation
                            cg.free_scratch_reg(exprasmlist,tmpreg);
                          end
                        else
-                         cg.a_paramaddr_ref(exprasmlist,left.location.reference,-1);
+                         cg.a_paramaddr_ref(exprasmlist,left.location.reference,paralocdummy);
                        location_release(exprasmlist,left.location);
                      end;
                 end;
@@ -200,7 +201,7 @@ implementation
                    cg.free_scratch_reg(exprasmlist,tmpreg);
                 end
               else
-                cg.a_paramaddr_ref(exprasmlist,left.location.reference,-1);
+                cg.a_paramaddr_ref(exprasmlist,left.location.reference,paralocdummy);
               location_release(exprasmlist,left.location);
            end
          else
@@ -247,13 +248,13 @@ implementation
                         cg.free_scratch_reg(exprasmlist,tmpreg);
                      end
                    else
-                     cg.a_paramaddr_ref(exprasmlist,left.location.reference,-1);
+                     cg.a_paramaddr_ref(exprasmlist,left.location.reference,paralocdummy);
                    location_release(exprasmlist,left.location);
                 end
               else
                 begin
                    push_value_para(left,inlined,is_cdecl,
-                     para_offset,para_alignment);
+                     para_offset,para_alignment,paralocdummy);
                 end;
            end;
          truelabel:=otlabel;
@@ -549,7 +550,7 @@ implementation
                   cg.free_scratch_reg(exprasmlist,hregister);
                end
              else
-               cg.a_paramaddr_ref(exprasmlist,funcretref,-1);
+               cg.a_paramaddr_ref(exprasmlist,funcretref,paralocdummy);
            end;
 
          { procedure variable or normal function call ? }
@@ -639,15 +640,15 @@ implementation
                                     if is_class(tobjectdef(methodpointer.resulttype.def)) and
                                        (procdefinition.proctypeoption=potype_destructor) then
                                       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;
 
                                     if not(is_con_or_destructor and
                                            is_class(methodpointer.resulttype.def) and
                                            (procdefinition.proctypeoption in [potype_constructor,potype_destructor])
                                           ) 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  }
                                     { called in a con- or destructor then a warning }
                                     { will be made                                  }
@@ -670,8 +671,8 @@ implementation
                                       begin
                                          { a constructor needs also a flag }
                                          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;
                                hnewn:
@@ -680,10 +681,10 @@ implementation
                                     { ESI must be zero }
                                     rg.getexplicitregisterint(exprasmlist,R_ESI);
                                     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 }
                                     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;
                                  end;
                                hdisposen:
@@ -695,9 +696,9 @@ implementation
                                     rg.getexplicitregisterint(exprasmlist,R_ESI);
                                     emit_ref_reg(A_LEA,S_L,methodpointer.location.reference,R_ESI);
                                     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);
-                                    cg.a_paramaddr_ref(exprasmlist,href,1);
+                                    cg.a_paramaddr_ref(exprasmlist,href,getintparaloc(1));
                                  end;
                                else
                                  begin
@@ -740,14 +741,14 @@ implementation
                                         { direct call to destructor: remove data }
                                         if (procdefinition.proctypeoption=potype_destructor) and
                                            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 }
                                         if (procdefinition.proctypeoption=potype_constructor) and
                                            is_class(methodpointer.resulttype.def) then
                                           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
                                         else
                                           begin
@@ -755,8 +756,8 @@ implementation
                                              if (procdefinition.proctypeoption=potype_constructor) and
                                                 (methodpointer.resulttype.def.deftype=classrefdef) and
                                                 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;
 
@@ -770,12 +771,12 @@ implementation
                                                   { it's no bad idea, to insert the VMT }
                                                   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
                                               { destructors haven't to dispose the instance, if this is }
                                               { a direct call                                           }
                                               else
-                                                cg.a_param_const(exprasmlist,OS_INT,0,1);
+                                                cg.a_param_const(exprasmlist,OS_INT,0,getintparaloc(1));
                                            end;
                                       end;
                                  end;
@@ -805,32 +806,32 @@ implementation
                           begin
                              if (procdefinition.proctypeoption=potype_destructor) then
                                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
                              else if (procdefinition.proctypeoption=potype_constructor) then
                                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
                              else
-                               cg.a_param_reg(exprasmlist,OS_ADDR,R_ESI,1);
+                               cg.a_param_reg(exprasmlist,OS_ADDR,R_ESI,getintparaloc(1));
                           end
                         else if is_object(procinfo^._class) then
                           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
                                begin
                                   if (procdefinition.proctypeoption=potype_constructor) then
                                     begin
                                       { it's no bad idea, to insert the VMT }
                                       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
                                   { destructors haven't to dispose the instance, if this is }
                                   { a direct call                                           }
                                   else
-                                    cg.a_param_const(exprasmlist,OS_INT,0,1);
+                                    cg.a_param_const(exprasmlist,OS_INT,0,getintparaloc(1));
                                end;
                           end
                         else
@@ -846,7 +847,7 @@ implementation
                    (inlined or
                    (right=nil)) then
                   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);
                      tmpreg:=cg.get_scratch_reg_address(exprasmlist);
                      cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,tmpreg);
@@ -876,13 +877,13 @@ implementation
                      if lexlevel=(tprocdef(procdefinition).parast.symtablelevel) then
                        begin
                           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
                        { this is only true if the difference is one !!
                          but it cannot be more !! }
                      else if (lexlevel=(tprocdef(procdefinition).parast.symtablelevel)-1) then
                        begin
-                          cg.a_param_reg(exprasmlist,OS_ADDR,procinfo^.framepointer,-1);
+                          cg.a_param_reg(exprasmlist,OS_ADDR,procinfo^.framepointer,paralocdummy);
                        end
                      else if (lexlevel>(tprocdef(procdefinition).parast.symtablelevel)) then
                        begin
@@ -896,7 +897,7 @@ implementation
                                reference_reset_base(href,hregister,procinfo^.framepointer_offset);
                                cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,hregister);
                             end;
-                          cg.a_param_reg(exprasmlist,OS_ADDR,hregister,-1);
+                          cg.a_param_reg(exprasmlist,OS_ADDR,hregister,paralocdummy);
                           rg.ungetregisterint(exprasmlist,hregister);
                        end
                      else
@@ -956,13 +957,13 @@ implementation
                         if (cs_check_object in aktlocalswitches) then
                           begin
                              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');
                           end
                         else if (cs_check_range in aktlocalswitches) then
                           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');
                           end;
                      end;
@@ -1026,7 +1027,7 @@ implementation
                        rg.getexplicitregisterint(exprasmlist,R_ESI);
                        cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,self_pointer_reg);
                        { 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;
 
                    rg.saveregvars(exprasmlist,ALL_REGISTERS);
@@ -1127,7 +1128,7 @@ implementation
            begin
               getlabel(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);
               tmpreg:=cg.get_scratch_reg_address(exprasmlist);
               cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,tmpreg);
@@ -1234,7 +1235,7 @@ implementation
          if iolabel<>nil then
            begin
               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');
            end;
          if pop_size>0 then
@@ -1480,7 +1481,11 @@ begin
 end.
 {
   $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
 
   Revision 1.56  2002/07/01 18:46:31  peter

+ 24 - 20
compiler/i386/n386flw.pas

@@ -54,7 +54,7 @@ implementation
       verbose,systems,
       symsym,aasmbase,aasmtai,aasmcpu,
       cgbase,pass_2,
-      cpuinfo,cpubase,
+      cpuinfo,cpubase,cpupara,
       nld,ncon,
       cga,cgobj,tgobj,rgobj;
 
@@ -78,28 +78,28 @@ implementation
                       secondpass(frametree);
                       if codegenerror then
                        exit;
-                      cg.a_param_loc(exprasmlist,frametree.location,2);
+                      cg.a_param_loc(exprasmlist,frametree.location,getintparaloc(2));
                     end
                   else
-                    cg.a_param_const(exprasmlist,OS_INT,0,2);
+                    cg.a_param_const(exprasmlist,OS_INT,0,getintparaloc(2));
                   { push address }
                   secondpass(right);
                   if codegenerror then
                    exit;
-                  cg.a_param_loc(exprasmlist,right.location,1);
+                  cg.a_param_loc(exprasmlist,right.location,getintparaloc(1));
                 end
               else
                 begin
                    getaddrlabel(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);
                 end;
               { push object }
               secondpass(left);
               if codegenerror then
                 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');
            end
          else
@@ -202,10 +202,10 @@ implementation
 
          tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
          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 }
-         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');
 
          { allocate eax }
@@ -269,7 +269,7 @@ implementation
               { FPC_CATCHES must be called with
                 '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.g_maybe_loadself(exprasmlist);
 
@@ -280,10 +280,10 @@ implementation
 
               tg.gettempofsizereferencepersistant(exprasmlist,24,tempbuf);
               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 }
-              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');
 
               { allocate eax }
@@ -449,9 +449,9 @@ implementation
 
          tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
          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');
 
          exprasmList.concat(tai_regalloc.Alloc(R_EAX));
@@ -603,10 +603,10 @@ implementation
 
          tg.gettempofsizereferencepersistant(exprasmlist,12,tempaddr);
          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}
-         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');
 
          { allocate eax }
@@ -726,7 +726,11 @@ begin
 end.
 {
   $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
     * reorganized aasm layer
 

+ 10 - 6
compiler/i386/n386inl.pas

@@ -42,7 +42,7 @@ implementation
       symconst,symdef,types,
       aasmbase,aasmtai,aasmcpu,
       cginfo,cgbase,pass_1,pass_2,
-      cpubase,
+      cpubase,cpupara,
       nbas,ncon,ncal,ncnv,nld,
       cga,tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu;
 
@@ -92,20 +92,20 @@ implementation
                  maketojumpbool(exprasmlist,tcallparanode(left).left,lr_load_regvars);
                  cg.a_label(exprasmlist,falselabel);
                  { erroraddr }
-                 cg.a_param_reg(exprasmlist,OS_ADDR,R_EBP,4);
+                 cg.a_param_reg(exprasmlist,OS_ADDR,R_EBP,getintparaloc(4));
                  { lineno }
-                 cg.a_param_const(exprasmlist,OS_INT,aktfilepos.line,3);
+                 cg.a_param_const(exprasmlist,OS_INT,aktfilepos.line,getintparaloc(3));
                  { filename string }
                  hp2:=cstringconstnode.createstr(current_module.sourcefiles.get_file_name(aktfilepos.fileindex),st_shortstring);
                  firstpass(hp2);
                  secondpass(hp2);
                  if codegenerror then
                   exit;
-                 cg.a_paramaddr_ref(exprasmlist,hp2.location.reference,2);
+                 cg.a_paramaddr_ref(exprasmlist,hp2.location.reference,getintparaloc(2));
                  hp2.free;
                  { push msg }
                  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 }
                  cg.a_call_name(exprasmlist,'FPC_ASSERT');
                  cg.a_label(exprasmlist,truelabel);
@@ -461,7 +461,11 @@ begin
 end.
 {
   $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
     * reorganized aasm layer
 

+ 13 - 9
compiler/i386/n386mem.pas

@@ -54,7 +54,7 @@ implementation
       aasmbase,aasmtai,aasmcpu,
       cginfo,cgbase,pass_2,
       pass_1,nld,ncon,nadd,
-      cpubase,
+      cpubase,cpupara,
       cgobj,cga,tgobj,rgobj,ncgutil;
 
 {*****************************************************************************
@@ -89,7 +89,7 @@ implementation
             (cs_gdb_heaptrc in aktglobalswitches) and
             (cs_checkpointer in aktglobalswitches) then
           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');
           end;
       end;
@@ -165,7 +165,7 @@ implementation
                         exit;
                      end;
                    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);
                    cg.a_call_name(exprasmlist,'FPC_'+Upper(tstringdef(left.resulttype.def).stringtypname)+'_UNIQUE');
                    cg.g_maybe_loadself(exprasmlist);
@@ -192,7 +192,7 @@ implementation
               if (cs_check_range in aktlocalswitches) then
                 begin
                    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);
                    cg.a_call_name(exprasmlist,'FPC_'+Upper(tstringdef(left.resulttype.def).stringtypname)+'_CHECKZERO');
                    cg.g_maybe_loadself(exprasmlist);
@@ -294,10 +294,10 @@ implementation
                         st_ansistring:
                           begin
                              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;
                              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);
                              cg.a_call_name(exprasmlist,'FPC_'+Upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK');
                              rg.restoreusedregisters(exprasmlist,pushed);
@@ -451,10 +451,10 @@ implementation
                          st_ansistring:
                            begin
                               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;
                               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);
                               cg.a_call_name(exprasmlist,'FPC_'+Upper(tstringdef(left.resulttype.def).stringtypname)+'_RANGECHECK');
                               rg.restoreusedregisters(exprasmlist,pushed);
@@ -520,7 +520,11 @@ begin
 end.
 {
   $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
     * reorganized aasm layer
 

+ 8 - 4
compiler/i386/n386opt.pas

@@ -46,7 +46,7 @@ uses
   symdef,
   aasmbase,aasmtai,aasmcpu,
   ncnv, ncon, pass_2,
-  cginfo, cgbase, cpubase,
+  cginfo, cgbase, cpubase, cpupara,
   tgobj, rgobj, cgobj, ncgutil;
 
 
@@ -226,13 +226,13 @@ begin
   remove_non_regvars_from_loc(right.location,regstopush);
   rg.saveusedregisters(exprasmlist,pushedregs,regstopush);
   { 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          }
   { deallocations in the right place if it happens }
   { too early than when it happens too late (if    }
   { the pushref needs a "lea (..),edi; push edi")  }
   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);
   cg.a_call_name(exprasmlist,'FPC_SHORTSTR_CONCAT');
   tg.ungetiftemp(exprasmlist,right.location.reference);
@@ -248,7 +248,11 @@ end.
 
 {
   $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
     * reorganized aasm layer
 

+ 11 - 7
compiler/ncgcnv.pas

@@ -64,7 +64,7 @@ interface
       cutils,verbose,
       aasmbase,aasmtai,aasmcpu,symconst,symdef,
       ncon,ncal,
-      cpubase,cpuinfo,
+      cpubase,cpuinfo,cpupara,
       pass_2,
       cginfo,cgbase,
       cgobj,cgcpu,
@@ -450,10 +450,10 @@ interface
            { instance to check }
            secondpass(left);
            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 }
            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);
            { call helper }
            if is_class(left.resulttype.def) then
@@ -468,10 +468,10 @@ interface
            { instance to check }
            secondpass(left);
            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 }
            secondpass(right);
-           cg.a_param_loc(exprasmlist,right.location,1);
+           cg.a_param_loc(exprasmlist,right.location,getintparaloc(1));
            location_release(exprasmlist,right.location);
            { call helper }
            cg.a_call_name(exprasmlist,'FPC_DO_AS');
@@ -490,7 +490,11 @@ end.
 
 {
   $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
 
   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
       and can cause hard-to-find bugs
 
-}
+}

+ 9 - 5
compiler/ncgld.pas

@@ -57,7 +57,7 @@ implementation
       ncnv,ncon,nmem,
       aasmbase,aasmtai,aasmcpu,regvars,
       cginfo,cgbase,pass_2,
-      cpubase,cpuinfo,
+      cpubase,cpuinfo,cpupara,
       tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu;
 
 {*****************************************************************************
@@ -132,7 +132,7 @@ implementation
                     begin
                        rg.saveusedregisters(exprasmlist,pushed,[accumulator]);
                        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 }
                        { any register except EAX                    }
                        cg.a_call_name(exprasmlist,'FPC_RELOCATE_THREADVAR');
@@ -845,13 +845,13 @@ implementation
                     if vaddr then
                      begin
                        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);
                        if freetemp then
                         location_freetemp(exprasmlist,hp.left.location);
                      end
                     else
-                     cg.a_param_loc(exprasmlist,hp.left.location,-1);
+                     cg.a_param_loc(exprasmlist,hp.left.location,paralocdummy);
                     inc(pushedparasize,pointer_size);
                   end
                  else
@@ -921,7 +921,11 @@ begin
 end.
 {
   $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
     * reorganized aasm layer
 

+ 10 - 3
compiler/ncgmem.pas

@@ -21,6 +21,8 @@
 
  ****************************************************************************
 }
+{ This unit generate assembler for memory related nodes.
+}
 unit ncgmem;
 
 {$i fpcdefs.inc}
@@ -76,7 +78,8 @@ implementation
       aasmbase,aasmtai,aasmcpu,
       cgbase,pass_2,
       nld,ncon,nadd,
-      cpuinfo,cpubase,cgobj,cgcpu,
+      cpuinfo,cpubase,cpupara,
+      cgobj,cgcpu,
       tgobj,rgobj
 {$ifdef GDB}
   {$ifdef delphi}
@@ -243,7 +246,7 @@ implementation
          if (cs_gdb_heaptrc in aktglobalswitches) and
             (cs_checkpointer in aktglobalswitches) then
           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');
           end;
       end;
@@ -463,7 +466,11 @@ begin
 end.
 {
   $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
     * reorganized aasm layer
 

+ 24 - 16
compiler/ncgutil.pas

@@ -28,7 +28,9 @@ interface
 
     uses
       node,
-      cginfo,cpubase,aasmbase,aasmtai,aasmcpu,
+      cpubase,cpupara,
+      aasmbase,aasmtai,aasmcpu,
+      cginfo,
       rgobj;
 
     type
@@ -51,7 +53,8 @@ interface
     function  maybe_pushfpu(list:taasmoutput;needed : byte;var l:tlocation) : 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;
                            make_global:boolean;
@@ -590,7 +593,8 @@ implementation
 *****************************************************************************}
 
     procedure push_value_para(p:tnode;inlined,is_cdecl:boolean;
-                              para_offset:longint;alignment : longint);
+                              para_offset:longint;alignment : longint;
+                              const locpara : tparalocation);
       var
         tempreference : treference;
         href : treference;
@@ -657,7 +661,7 @@ implementation
                        cg.a_load_ref_ref(exprasmlist,cgsize,tempreference,href);
                      end
                     else
-                     cg.a_param_ref(exprasmlist,cgsize,tempreference,-1);
+                     cg.a_param_ref(exprasmlist,cgsize,tempreference,locpara);
                   end;
                end;
              else
@@ -698,7 +702,7 @@ implementation
                           cg64.a_load64_loc_ref(exprasmlist,p.location,href);
                         end
                        else
-                        cg64.a_param64_loc(exprasmlist,p.location,-1);
+                        cg64.a_param64_loc(exprasmlist,p.location,locpara);
                      end
                     else
                      begin
@@ -729,7 +733,7 @@ implementation
                           cg.a_load_loc_ref(exprasmlist,p.location,href);
                         end
                        else
-                        cg.a_param_loc(exprasmlist,p.location,-1);
+                        cg.a_param_loc(exprasmlist,p.location,locpara);
                        { restore old register }
                        if p.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
                          p.location.register:=hreg;
@@ -797,9 +801,9 @@ implementation
         if (tsym(p).typ=varsym) and
            (vo_is_thread_var in tvarsym(p).varoptions) then
          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);
-           cg.a_paramaddr_ref(list,href,2);
+           cg.a_paramaddr_ref(list,href,getintparaloc(1));
            rg.saveregvars(list,all_registers);
            cg.a_call_name(list,'FPC_INIT_THREADVAR');
          end;
@@ -947,20 +951,20 @@ implementation
              tt_freeansistring :
                begin
                  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');
                end;
              tt_widestring,
              tt_freewidestring :
                begin
                  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');
                end;
              tt_interfacecom :
                begin
                  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');
                end;
            end;
@@ -1342,14 +1346,14 @@ implementation
                             cg.a_cmp_const_ref_label(list,OS_ADDR,OC_EQ,0,href,nodestroycall);
                             if is_class(procinfo^._class) then
                              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
                             else if is_object(procinfo^._class) then
                              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);
-                               cg.a_paramaddr_ref(list,href,1);
+                               cg.a_paramaddr_ref(list,href,getintparaloc(1));
                              end
                             else
                              Internalerror(200006164);
@@ -1611,7 +1615,11 @@ implementation
 end.
 {
   $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
     * reorganized aasm layer
 

+ 7 - 3
compiler/psub.pas

@@ -279,7 +279,7 @@ implementation
          { reset the temporary memory }
          rg.cleartempgen;
          rg.usedinproc:=[];
-         
+
          { save entry info }
          entrypos:=aktfilepos;
          entryswitches:=aktlocalswitches;
@@ -816,7 +816,11 @@ implementation
 end.
 {
   $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
 
   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
     * check for unresolved forward classes in the interface
 
-}
+}

+ 10 - 1
compiler/psystem.pas

@@ -253,6 +253,11 @@ begin
   s64floattype.setdef(tfloatdef.create(s64real));
   s80floattype.setdef(tfloatdef.create(s80real));
 {$endif x86}
+{$ifdef powerpc}
+  s32floattype.setdef(tfloatdef.create(s32real));
+  s64floattype.setdef(tfloatdef.create(s64real));
+  s80floattype.setdef(tfloatdef.create(s80real));
+{$endif powerpc}
 {$ifdef sparc}
   s32floattype.setdef(tfloatdef.create(s32real));
   s64floattype.setdef(tfloatdef.create(s64real));
@@ -284,7 +289,11 @@ end;
 end.
 {
   $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
 
   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);
 
       begin
+         if r=R_NO then
+           exit;
          if r in intregs then
            ungetregisterint(list,r)
          else if r in fpuregs then
            ungetregisterfpu(list,r)
          else if r in mmregs then
            ungetregistermm(list,r)
-         else internalerror(18);
+         else internalerror(2002070602);
       end;
 
 
@@ -854,7 +856,11 @@ end.
 
 {
   $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
     * reorganized aasm layer
 

+ 9 - 1
compiler/symdef.pas

@@ -97,6 +97,7 @@ interface
           paratype     : ttype;
           parasym      : tsym;
           paratyp      : tvarspez;
+          paraloc      : tparalocation;
           argconvtyp   : targconvtyp;
           convertlevel : byte;
           defaultvalue : tsym; { tconstsym }
@@ -3158,6 +3159,8 @@ implementation
             ppufile.gettype(hp.paratype);
             hp.defaultvalue:=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
              inc(minparacount);
             inc(maxparacount);
@@ -3191,6 +3194,7 @@ implementation
             ppufile.puttype(hp.paratype);
             ppufile.putderef(hp.defaultvalue);
             ppufile.putderef(hp.parasym);
+            ppufile.putdata(hp.paraloc,sizeof(tparalocation));
             hp:=TParaItem(hp.next);
           end;
       end;
@@ -5478,7 +5482,11 @@ implementation
 end.
 {
   $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
     * reorganized aasm layer