Selaa lähdekoodia

* pass proccalloption to ret_in_xxx and push_xxx functions

peter 23 vuotta sitten
vanhempi
commit
a496dbe1ff

+ 5 - 2
compiler/aoptobj.pas

@@ -708,7 +708,7 @@ Begin
             new_one.next := foll;
             prev.next := new_one;
             foll.previous := new_one;
-            Tai(new_one).fileinfo := Tai(foll).fileinfo
+            Tailineinfo(new_one).fileinfo := Tailineinfo(foll).fileinfo
           End
       End
     Else AsmL.Concat(new_one)
@@ -788,7 +788,10 @@ End.
 
 {
  $Log$
- Revision 1.7  2002-08-18 18:16:55  florian
+ Revision 1.8  2002-11-18 17:31:54  peter
+   * pass proccalloption to ret_in_xxx and push_xxx functions
+
+ Revision 1.7  2002/08/18 18:16:55  florian
    * fixed compilation error
 
  Revision 1.6  2002/07/07 09:52:32  florian

+ 9 - 6
compiler/cgbase.pas

@@ -421,7 +421,7 @@ implementation
          { because we don't know yet where the address is }
          if not is_void(aktprocdef.rettype.def) then
            begin
-              if paramanager.ret_in_reg(aktprocdef.rettype.def) then
+              if paramanager.ret_in_reg(aktprocdef.rettype.def,aktprocdef.proccalloption) then
                 begin
                    { the space has been set in the local symtable }
                    procinfo.return_offset:=tg.direction*tfuncretsym(aktprocdef.funcretsym).address;
@@ -430,7 +430,7 @@ implementation
                      otsym.address:=tfuncretsym(aktprocdef.funcretsym).address;
 
                    rg.usedinproc := rg.usedinproc +
-                      getfuncretusedregisters(aktprocdef.rettype.def);
+                      getfuncretusedregisters(aktprocdef.rettype.def,aktprocdef.proccalloption);
                 end;
            end;
       end;
@@ -438,16 +438,16 @@ implementation
     { updates usedinproc depending on the resulttype }
     procedure tprocinfo.update_usedinproc_result;
       begin
-         if paramanager.ret_in_reg(procdef.rettype.def) then
+         if paramanager.ret_in_reg(procdef.rettype.def,procdef.proccalloption) then
            begin
               rg.usedinproc := rg.usedinproc +
-              getfuncretusedregisters(procdef.rettype.def);
+              getfuncretusedregisters(procdef.rettype.def,procdef.proccalloption);
            end;
       end;
 
     procedure tprocinfo.set_result_offset;
       begin
-         if paramanager.ret_in_reg(aktprocdef) then
+         if paramanager.ret_in_reg(aktprocdef,procdef.proccalloption) then
            procinfo.return_offset:=-tfuncretsym(procdef.funcretsym).address;
       end;
 
@@ -658,7 +658,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.32  2002-10-05 12:43:23  carl
+  Revision 1.33  2002-11-18 17:31:54  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.32  2002/10/05 12:43:23  carl
     * fixes for Delphi 6 compilation
      (warning : Some features do not work under Delphi)
 

+ 15 - 11
compiler/i386/cpupara.pas

@@ -30,6 +30,7 @@ unit cpupara;
 
     uses
        cpubase,
+       globtype,
        symtype,symdef,paramgr;
 
     type
@@ -39,8 +40,8 @@ unit cpupara;
          rtl are used.
        }
        ti386paramanager = class(tparamanager)
-          function ret_in_acc(def : tdef) : boolean;override;
-          function ret_in_param(def : tdef) : boolean;override;
+          function ret_in_acc(def : tdef;calloption : tproccalloption) : boolean;override;
+          function ret_in_param(def : tdef;calloption : tproccalloption) : boolean;override;
           function getintparaloc(nr : longint) : tparalocation;override;
           procedure create_param_loc_info(p : tabstractprocdef);override;
           function getselflocation(p : tabstractprocdef) : tparalocation;override;
@@ -49,30 +50,30 @@ unit cpupara;
   implementation
 
     uses
+       systems,
+       symconst,
        verbose;
 
-    function ti386paramanager.ret_in_acc(def : tdef) : boolean;
+    function ti386paramanager.ret_in_acc(def : tdef;calloption : tproccalloption) : boolean;
       begin
-{$ifdef TEST_WIN32_RECORDS}
         { Win32 returns small records in the accumulator }
         if ((target_info.system=system_i386_win32) and
+            (calloption=pocall_stdcall) and
             (def.deftype=recorddef) and (def.size<=8)) then
           result:=true
         else
-{$endif TEST_WIN32_RECORDS}
-          result:=inherited ret_in_acc(def);
+          result:=inherited ret_in_acc(def,calloption);
       end;
 
-    function ti386paramanager.ret_in_param(def : tdef) : boolean;
+    function ti386paramanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean;
       begin
-{$ifdef TEST_WIN32_RECORDS}
         { Win32 returns small records in the accumulator }
         if ((target_info.system=system_i386_win32) and
+            (calloption=pocall_stdcall) and
             (def.deftype=recorddef) and (def.size<=8)) then
           result:=false
         else
-{$endif TEST_WIN32_RECORDS}
-          result:=inherited ret_in_param(def);
+          result:=inherited ret_in_param(def,calloption);
       end;
 
     function ti386paramanager.getintparaloc(nr : longint) : tparalocation;
@@ -99,7 +100,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.4  2002-11-15 01:58:56  peter
+  Revision 1.5  2002-11-18 17:32:00  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.4  2002/11/15 01:58:56  peter
     * merged changes from 1.0.7 up to 04-11
       - -V option for generating bug report tracing
       - more tracing for option parsing

+ 29 - 26
compiler/i386/n386cal.pas

@@ -29,13 +29,15 @@ interface
 { $define AnsiStrRef}
 
     uses
-      symdef,node,ncal,ncgcal;
+      globtype,
+      symdef,
+      node,ncal,ncgcal;
 
     type
        ti386callparanode = class(tcallparanode)
           procedure secondcallparan(defcoll : TParaItem;
-                   push_from_left_to_right,inlined,is_cdecl : boolean;
-                   para_alignment,para_offset : longint);override;
+                push_from_left_to_right:boolean;calloption:tproccalloption;
+                para_alignment,para_offset : longint);override;
        end;
 
        ti386callnode = class(tcgcallnode)
@@ -46,7 +48,7 @@ interface
 implementation
 
     uses
-      globtype,systems,
+      systems,
       cutils,verbose,globals,
       symconst,symbase,symsym,symtable,defbase,
 {$ifdef GDB}
@@ -68,7 +70,7 @@ implementation
 *****************************************************************************}
 
     procedure ti386callparanode.secondcallparan(defcoll : TParaItem;
-                push_from_left_to_right,inlined,is_cdecl : boolean;para_alignment,para_offset : longint);
+                push_from_left_to_right:boolean;calloption:tproccalloption;para_alignment,para_offset : longint);
 
       procedure maybe_push_high;
         begin
@@ -79,7 +81,7 @@ implementation
             begin
               secondpass(hightree);
               { this is a longint anyway ! }
-              push_value_para(hightree,inlined,false,para_offset,4,paralocdummy);
+              push_value_para(hightree,calloption,para_offset,4,paralocdummy);
             end;
         end;
 
@@ -100,10 +102,10 @@ implementation
           begin
             if (nf_varargs_para in flags) then
               tcallparanode(right).secondcallparan(defcoll,push_from_left_to_right,
-                                                   inlined,is_cdecl,para_alignment,para_offset)
+                                                   calloption,para_alignment,para_offset)
             else
               tcallparanode(right).secondcallparan(TParaItem(defcoll.next),push_from_left_to_right,
-                                                   inlined,is_cdecl,para_alignment,para_offset);
+                                                   calloption,para_alignment,para_offset);
           end;
 
          otlabel:=truelabel;
@@ -114,14 +116,14 @@ implementation
          { handle varargs first, because defcoll is not valid }
          if (nf_varargs_para in flags) then
            begin
-             if paramanager.push_addr_param(left.resulttype.def,is_cdecl) then
+             if paramanager.push_addr_param(left.resulttype.def,calloption) then
                begin
                  inc(pushedparasize,4);
                  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,paralocdummy);
+               push_value_para(left,calloption,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
@@ -142,7 +144,7 @@ implementation
               if (left.nodetype=addrn) and
                  (not(nf_procvarload in left.flags)) then
                 begin
-                  if inlined then
+                  if calloption=pocall_inline then
                     begin
                        reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
                        cg.a_load_loc_ref(exprasmlist,left.location,href);
@@ -157,7 +159,7 @@ implementation
                      CGMessage(type_e_mismatch)
                    else
                      begin
-                       if inlined then
+                       if calloption=pocall_inline then
                          begin
                            tmpreg:=cg.get_scratch_reg_address(exprasmlist);
                            cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,tmpreg);
@@ -190,7 +192,7 @@ implementation
                  defcoll.paratype.def.needs_inittable then
                 cg.g_finalize(exprasmlist,defcoll.paratype.def,left.location.reference,false);
               inc(pushedparasize,4);
-              if inlined then
+              if calloption=pocall_inline then
                 begin
                    tmpreg:=cg.get_scratch_reg_address(exprasmlist);
                    cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,tmpreg);
@@ -217,7 +219,7 @@ implementation
                    is_array_of_const(defcoll.paratype.def))
                  ) or
                  (
-                  paramanager.push_addr_param(resulttype.def,is_cdecl)
+                  paramanager.push_addr_param(resulttype.def,calloption)
                  ) then
                 begin
                    if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
@@ -239,7 +241,7 @@ implementation
                    if not push_from_left_to_right then
                      maybe_push_high;
                    inc(pushedparasize,4);
-                   if inlined then
+                   if calloption=pocall_inline then
                      begin
                         tmpreg:=cg.get_scratch_reg_address(exprasmlist);
                         cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,tmpreg);
@@ -255,7 +257,7 @@ implementation
                 end
               else
                 begin
-                   push_value_para(left,inlined,is_cdecl,
+                   push_value_para(left,calloption,
                      para_offset,para_alignment,paralocdummy);
                 end;
            end;
@@ -266,10 +268,10 @@ implementation
           begin
             if (nf_varargs_para in flags) then
               tcallparanode(right).secondcallparan(defcoll,push_from_left_to_right,
-                                                   inlined,is_cdecl,para_alignment,para_offset)
+                                                   calloption,para_alignment,para_offset)
             else
               tcallparanode(right).secondcallparan(TParaItem(defcoll.next),push_from_left_to_right,
-                                                   inlined,is_cdecl,para_alignment,para_offset);
+                                                   calloption,para_alignment,para_offset);
           end;
       end;
 
@@ -412,7 +414,7 @@ implementation
                 used for the return value }
               regs_to_push := tprocdef(procdefinition).usedregisters;
               if (not is_void(resulttype.def)) and
-                 (not paramanager.ret_in_param(resulttype.def)) then
+                 (not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
                begin
                  include(regs_to_push,accumulator);
                  if resulttype.def.size>sizeof(aword) then
@@ -505,13 +507,11 @@ implementation
               if not(inlined) and
                  assigned(right) then
                 tcallparanode(params).secondcallparan(TParaItem(tabstractprocdef(right.resulttype.def).Para.first),
-                  (po_leftright in procdefinition.procoptions),inlined,
-                  (procdefinition.proccalloption in [pocall_cdecl,pocall_cppdecl]),
+                  (po_leftright in procdefinition.procoptions),procdefinition.proccalloption,
                   para_alignment,para_offset)
               else
                 tcallparanode(params).secondcallparan(TParaItem(procdefinition.Para.first),
-                  (po_leftright in procdefinition.procoptions),inlined,
-                  (procdefinition.proccalloption in [pocall_cdecl,pocall_cppdecl]),
+                  (po_leftright in procdefinition.procoptions),procdefinition.proccalloption,
                   para_alignment,para_offset);
            end;
 
@@ -524,7 +524,7 @@ implementation
           end;
 
          { Allocate return value when returned in argument }
-         if paramanager.ret_in_param(resulttype.def) then
+         if paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
            begin
              if assigned(funcretrefnode) then
               begin
@@ -1210,7 +1210,7 @@ implementation
            params.free;
 
          { from now on the result can be freed normally }
-         if inlined and paramanager.ret_in_param(resulttype.def) then
+         if inlined and paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
            tg.ChangeTempType(exprasmlist,funcretref,tt_normal);
 
          { if return value is not used }
@@ -1242,7 +1242,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.74  2002-11-15 01:58:57  peter
+  Revision 1.75  2002-11-18 17:32:00  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.74  2002/11/15 01:58:57  peter
     * merged changes from 1.0.7 up to 04-11
       - -V option for generating bug report tracing
       - more tracing for option parsing

+ 5 - 2
compiler/i386/radirect.pas

@@ -138,7 +138,7 @@ interface
                                  { is the last written character an special }
                                  { char ?                                   }
                                  if (s[length(s)]='%') and
-                                    paramanager.ret_in_acc(aktprocdef.rettype.def) and
+                                    paramanager.ret_in_acc(aktprocdef.rettype.def,aktprocdef.proccalloption) and
                                     ((pos('AX',upper(hs))>0) or
                                     (pos('AL',upper(hs))>0)) then
                                    tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_assigned;
@@ -304,7 +304,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.3  2002-09-03 16:26:28  daniel
+  Revision 1.4  2002-11-18 17:32:00  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.3  2002/09/03 16:26:28  daniel
     * Make Tprocdef.defs protected
 
   Revision 1.2  2002/08/17 09:23:47  florian

+ 8 - 5
compiler/m68k/cgcpu.pas

@@ -227,15 +227,15 @@ Implementation
         fixref(list,href);
         list.concat(taicpu.op_ref(A_JSR,S_NO,href));
       end;
-      
+
     procedure tcg68k.a_call_reg(list : taasmoutput;reg : tregister);
      var
-       href : treference; 
+       href : treference;
      begin
        reference_reset_base(href, reg, 0);
        a_call_ref(list,href);
      end;
-      
+
 
 
     procedure tcg68k.a_load_const_reg(list : taasmoutput;size : tcgsize;a : aword;register : tregister);
@@ -1000,7 +1000,7 @@ Implementation
          if (po_clearstack in aktprocdef.procoptions) then
            begin
              { complex return values are removed from stack in C code PM }
-             if paramanager.ret_in_param(aktprocdef.rettype.def) then
+             if paramanager.ret_in_param(aktprocdef.rettype.def,aktprocdef.proccalloption) then
                list.concat(taicpu.op_const(A_RTD,S_NO,4))
              else
                list.concat(taicpu.op_none(A_RTS,S_NO));
@@ -1250,7 +1250,10 @@ end.
 
 {
   $Log$
-  Revision 1.10  2002-09-22 14:15:31  carl
+  Revision 1.11  2002-11-18 17:32:00  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.10  2002/09/22 14:15:31  carl
     + a_call_reg
 
   Revision 1.9  2002/09/17 18:54:05  jonas

+ 20 - 24
compiler/ncal.pas

@@ -28,13 +28,8 @@ unit ncal;
 
 interface
 
-{$ifdef DEBUG}
- {$ifdef i386}
-  {$define TEST_WIN32_RECORDS}
- {$endif i386}
-{$endif DEBUG}
-
     uses
+       globtype,
        node,
        {$ifdef state_tracking}
        nstate,
@@ -115,9 +110,9 @@ interface
           procedure insert_typeconv(defcoll : tparaitem;do_count : boolean);
           procedure det_registers;
           procedure firstcallparan(defcoll : tparaitem;do_count : boolean);
-          procedure secondcallparan(defcoll : tparaitem;
-                   push_from_left_to_right,inlined,is_cdecl : boolean;
-                   para_alignment,para_offset : longint);virtual;abstract;
+          procedure secondcallparan(defcoll : TParaItem;
+                push_from_left_to_right:boolean;calloption:tproccalloption;
+                para_alignment,para_offset : longint);virtual;abstract;
           function docompare(p: tnode): boolean; override;
        end;
        tcallparanodeclass = class of tcallparanode;
@@ -150,7 +145,7 @@ interface
 implementation
 
     uses
-      cutils,globtype,systems,
+      cutils,systems,
       verbose,globals,
       symconst,paramgr,defbase,
       htypechk,pass_1,cpuinfo,cpubase,
@@ -457,7 +452,7 @@ implementation
          if not(assigned(aktcallprocdef) and
                 (aktcallprocdef.proccalloption in [pocall_cppdecl,pocall_cdecl]) and
                 (po_external in aktcallprocdef.procoptions)) and
-            paramanager.push_high_param(defcoll.paratype.def) then
+            paramanager.push_high_param(defcoll.paratype.def,aktcallprocdef.proccalloption) then
            gen_high_tree(is_open_string(defcoll.paratype.def));
 
          { test conversions }
@@ -472,7 +467,7 @@ implementation
                        left.resulttype.def.typename,defcoll.paratype.def.typename);
                   end;
               { Process open parameters }
-              if paramanager.push_high_param(defcoll.paratype.def) then
+              if paramanager.push_high_param(defcoll.paratype.def,aktcallprocdef.proccalloption) then
                begin
                  { insert type conv but hold the ranges of the array }
                  oldtype:=left.resulttype;
@@ -739,7 +734,8 @@ implementation
         restypeset := true;
         { both the normal and specified resulttype either have to be returned via a }
         { parameter or not, but no mixing (JM)                                      }
-        if paramanager.ret_in_param(restype.def) xor paramanager.ret_in_param(symtableprocentry.first_procdef.rettype.def) then
+        if paramanager.ret_in_param(restype.def,pocall_compilerproc) xor
+           paramanager.ret_in_param(symtableprocentry.first_procdef.rettype.def,symtableprocentry.first_procdef.proccalloption) then
           internalerror(200108291);
       end;
 
@@ -748,7 +744,7 @@ implementation
       begin
         self.createintern(name,params);
         funcretrefnode:=returnnode;
-        if not paramanager.ret_in_param(symtableprocentry.first_procdef.rettype.def) then
+        if not paramanager.ret_in_param(symtableprocentry.first_procdef.rettype.def,symtableprocentry.first_procdef.proccalloption) then
           internalerror(200204247);
       end;
 
@@ -2212,7 +2208,7 @@ implementation
          { modify the exit code, in case of special cases }
          if (not is_void(resulttype.def)) then
           begin
-            if paramanager.ret_in_reg(resulttype.def) then
+            if paramanager.ret_in_reg(resulttype.def,procdefinition.proccalloption) then
              begin
                { wide- and ansistrings are returned in EAX    }
                { but they are imm. moved to a memory location }
@@ -2350,17 +2346,14 @@ implementation
          { get a register for the return value }
          if (not is_void(resulttype.def)) then
            begin
-{$ifdef TEST_WIN32_RECORDS}
-             if (target_info.system=system_i386_win32) and
-                (resulttype.def.deftype=recorddef) then
+             { for win32 records returned in EDX:EAX, we
+               move them to memory after ... }
+             if (resulttype.def.deftype=recorddef) then
               begin
-                { for win32 records returned in EDX:EAX, we
-                  move them to memory after ... }
                 location.loc:=LOC_CREFERENCE;
               end
              else
-{$endif TEST_WIN32_RECORDS}
-              if paramanager.ret_in_param(resulttype.def) then
+              if paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
                begin
                  location.loc:=LOC_CREFERENCE;
                end
@@ -2629,7 +2622,7 @@ implementation
          retoffset:=-POINTER_SIZE; { less dangerous as zero (PM) }
          para_offset:=0;
          para_size:=inlineprocdef.para_size(target_info.alignment.paraalign);
-         if paramanager.ret_in_param(inlineprocdef.rettype.def) then
+         if paramanager.ret_in_param(inlineprocdef.rettype.def,inlineprocdef.proccalloption) then
            inc(para_size,POINTER_SIZE);
          result:=nil;
       end;
@@ -2662,7 +2655,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.107  2002-11-15 01:58:50  peter
+  Revision 1.108  2002-11-18 17:31:54  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.107  2002/11/15 01:58:50  peter
     * merged changes from 1.0.7 up to 04-11
       - -V option for generating bug report tracing
       - more tracing for option parsing

+ 28 - 26
compiler/ncgcal.pas

@@ -30,13 +30,14 @@ interface
 
     uses
       cpubase,
+      globtype,
       symdef,node,ncal;
 
     type
        tcgcallparanode = class(tcallparanode)
           procedure secondcallparan(defcoll : TParaItem;
-                   push_from_left_to_right,inlined,is_cdecl : boolean;
-                   para_alignment,para_offset : longint);override;
+                push_from_left_to_right:boolean;calloption:tproccalloption;
+                para_alignment,para_offset : longint);override;
        end;
 
        tcgcallnode = class(tcallnode)
@@ -58,7 +59,7 @@ interface
 implementation
 
     uses
-      globtype,systems,
+      systems,
       cutils,verbose,globals,
       symconst,symbase,symsym,symtable,defbase,paramgr,
 {$ifdef GDB}
@@ -82,7 +83,7 @@ implementation
 *****************************************************************************}
 
     procedure tcgcallparanode.secondcallparan(defcoll : TParaItem;
-                push_from_left_to_right,inlined,is_cdecl : boolean;para_alignment,para_offset : longint);
+                push_from_left_to_right:boolean;calloption:tproccalloption;para_alignment,para_offset : longint);
 
       { goes to pass 1 }
       procedure maybe_push_high;
@@ -94,7 +95,7 @@ implementation
             begin
               secondpass(hightree);
               { this is a longint anyway ! }
-              push_value_para(hightree,inlined,false,para_offset,4,defcoll.paraloc);
+              push_value_para(hightree,calloption,para_offset,4,defcoll.paraloc);
             end;
         end;
 
@@ -112,10 +113,10 @@ implementation
           begin
             if (nf_varargs_para in flags) then
               tcallparanode(right).secondcallparan(defcoll,push_from_left_to_right,
-                                                   inlined,is_cdecl,para_alignment,para_offset)
+                                                   calloption,para_alignment,para_offset)
             else
               tcallparanode(right).secondcallparan(TParaItem(defcoll.next),push_from_left_to_right,
-                                                   inlined,is_cdecl,para_alignment,para_offset);
+                                                   calloption,para_alignment,para_offset);
           end;
 
          otlabel:=truelabel;
@@ -126,14 +127,14 @@ implementation
          { handle varargs first, because defcoll is not valid }
          if (nf_varargs_para in flags) then
            begin
-             if paramanager.push_addr_param(left.resulttype.def,is_cdecl) then
+             if paramanager.push_addr_param(left.resulttype.def,calloption) then
                begin
                  inc(pushedparasize,4);
                  cg.a_paramaddr_ref(exprasmlist,left.location.reference,defcoll.paraloc);
                  location_release(exprasmlist,left.location);
                end
              else
-               push_value_para(left,inlined,is_cdecl,para_offset,para_alignment,defcoll.paraloc);
+               push_value_para(left,calloption,para_offset,para_alignment,defcoll.paraloc);
            end
          { filter array constructor with c styled args }
          else if is_array_constructor(left.resulttype.def) and (nf_cargs in left.flags) then
@@ -154,7 +155,7 @@ implementation
               if (left.nodetype=addrn) and
                  (not(nf_procvarload in left.flags)) then
                 begin
-                  if inlined then
+                  if calloption=pocall_inline then
                     begin
                        reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
                        cg.a_load_loc_ref(exprasmlist,left.location,href);
@@ -171,7 +172,7 @@ implementation
                      end
                    else
                      begin
-                       if inlined then
+                       if calloption=pocall_inline then
                          begin
                            tmpreg:=cg.get_scratch_reg_address(exprasmlist);
                            cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,tmpreg);
@@ -204,7 +205,7 @@ implementation
                  defcoll.paratype.def.needs_inittable then
                 cg.g_finalize(exprasmlist,defcoll.paratype.def,left.location.reference,false);
               inc(pushedparasize,4);
-              if inlined then
+              if calloption=pocall_inline then
                 begin
                    tmpreg:=cg.get_scratch_reg_address(exprasmlist);
                    cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,tmpreg);
@@ -231,7 +232,7 @@ implementation
                    is_array_of_const(defcoll.paratype.def))
                  ) or
                  (
-                  paramanager.push_addr_param(resulttype.def,is_cdecl)
+                  paramanager.push_addr_param(resulttype.def,calloption)
                  ) then
                 begin
                    if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
@@ -258,7 +259,7 @@ implementation
                    if not push_from_left_to_right then
                      maybe_push_high;
                    inc(pushedparasize,4);
-                   if inlined then
+                   if calloption=pocall_inline then
                      begin
                         tmpreg:=cg.get_scratch_reg_address(exprasmlist);
                         cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,tmpreg);
@@ -274,7 +275,7 @@ implementation
                 end
               else
                 begin
-                   push_value_para(left,inlined,is_cdecl,
+                   push_value_para(left,calloption,
                      para_offset,para_alignment,defcoll.paraloc);
                 end;
            end;
@@ -285,10 +286,10 @@ implementation
           begin
             if (nf_varargs_para in flags) then
               tcallparanode(right).secondcallparan(defcoll,push_from_left_to_right,
-                                                   inlined,is_cdecl,para_alignment,para_offset)
+                                                   calloption,para_alignment,para_offset)
             else
               tcallparanode(right).secondcallparan(TParaItem(defcoll.next),push_from_left_to_right,
-                                                   inlined,is_cdecl,para_alignment,para_offset);
+                                                   calloption,para_alignment,para_offset);
           end;
       end;
 
@@ -316,7 +317,7 @@ implementation
       begin
         { structured results are easy to handle.... }
         { needed also when result_no_used !! }
-        if paramanager.ret_in_param(resulttype.def) then
+        if paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
          begin
            location_reset(location,LOC_CREFERENCE,def_cgsize(resulttype.def));
            location.reference.symbol:=nil;
@@ -557,7 +558,7 @@ implementation
                 used for the return value }
               regs_to_push := tprocdef(procdefinition).usedregisters;
               if (not is_void(resulttype.def)) and
-                 (not paramanager.ret_in_param(resulttype.def)) then
+                 (not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
                begin
                  include(regs_to_push,accumulator);
 {$ifndef cpu64bit}
@@ -656,13 +657,11 @@ implementation
               if not(inlined) and
                  assigned(right) then
                 tcallparanode(params).secondcallparan(TParaItem(tabstractprocdef(right.resulttype.def).Para.first),
-                  (po_leftright in procdefinition.procoptions),inlined,
-                  (procdefinition.proccalloption in [pocall_cdecl,pocall_cppdecl]),
+                  (po_leftright in procdefinition.procoptions),procdefinition.proccalloption,
                   para_alignment,para_offset)
               else
                 tcallparanode(params).secondcallparan(TParaItem(procdefinition.Para.first),
-                  (po_leftright in procdefinition.procoptions),inlined,
-                  (procdefinition.proccalloption in [pocall_cdecl,pocall_cppdecl]),
+                  (po_leftright in procdefinition.procoptions),procdefinition.proccalloption,
                   para_alignment,para_offset);
            end;
 
@@ -675,7 +674,7 @@ implementation
            end;
 
          { Allocate return value when returned in argument }
-         if paramanager.ret_in_param(resulttype.def) then
+         if paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
            begin
              if assigned(funcretrefnode) then
               begin
@@ -1328,7 +1327,7 @@ implementation
            params.free;
 
          { from now on the result can be freed normally }
-         if inlined and paramanager.ret_in_param(resulttype.def) then
+         if inlined and paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
            tg.ChangeTempType(exprasmlist,funcretref,tt_normal);
 
          { if return value is not used }
@@ -1542,7 +1541,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.27  2002-11-16 15:34:30  florian
+  Revision 1.28  2002-11-18 17:31:54  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.27  2002/11/16 15:34:30  florian
     * generic location for float results
 
   Revision 1.26  2002/11/15 01:58:51  peter

+ 8 - 5
compiler/ncgld.pas

@@ -276,8 +276,7 @@ implementation
                       if (tvarsym(symtableentry).varspez in [vs_var,vs_out]) or
                          is_open_array(tvarsym(symtableentry).vartype.def) or
                          is_array_of_const(tvarsym(symtableentry).vartype.def) or
-                         paramanager.push_addr_param(tvarsym(symtableentry).vartype.def,
-                             (tprocdef(symtable.defowner).proccalloption in [pocall_cdecl,pocall_cppdecl])) then
+                         paramanager.push_addr_param(tvarsym(symtableentry).vartype.def,tprocdef(symtable.defowner).proccalloption) then
                         begin
                            if hregister=R_NO then
                              hregister:=rg.getaddressregister(exprasmlist);
@@ -738,7 +737,8 @@ implementation
              location.reference.base:=procinfo.framepointer;
              location.reference.offset:=procinfo.return_offset;
            end;
-         if paramanager.ret_in_param(funcretsym.returntype.def) then
+         if paramanager.ret_in_param(funcretsym.returntype.def,
+                                     tprocdef(funcretsym.owner.defowner).proccalloption) then
            begin
               { the parameter is actual a pointer to the value }
               if not hr_valid then
@@ -915,7 +915,7 @@ implementation
                      end
                     else
                       if vtype in [vtInt64,vtQword,vtExtended] then
-                        push_value_para(hp.left,false,true,0,4,paralocdummy)
+                        push_value_para(hp.left,pocall_cdecl,0,4,paralocdummy)
                     else
                       begin
                         cg.a_param_loc(exprasmlist,hp.left.location,paralocdummy);
@@ -989,7 +989,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.37  2002-11-15 21:16:39  jonas
+  Revision 1.38  2002-11-18 17:31:54  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.37  2002/11/15 21:16:39  jonas
     * proper fix for tw2110, also fixes tb0416 (funcretnode of parent
       function was handled wrong inside nested functions/procedures)
 

+ 26 - 22
compiler/ncgutil.pas

@@ -28,6 +28,7 @@ interface
 
     uses
       node,cpuinfo,
+      globtype,
       cpubase,cpupara,
       aasmbase,aasmtai,aasmcpu,
       cginfo,symbase,symdef,symtype,
@@ -55,7 +56,7 @@ interface
     procedure maybe_restore(list:taasmoutput;var l:tlocation;const s:tmaybesave);
     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;calloption:tproccalloption;
                               para_offset:longint;alignment : longint;
                               const locpara : tparalocation);
 
@@ -96,7 +97,8 @@ implementation
 {$else}
     strings,
 {$endif}
-    cutils,cclasses,globtype,globals,systems,verbose,
+    cutils,cclasses,
+    globals,systems,verbose,
     symconst,symsym,symtable,defbase,paramgr,
     fmodule,
     cgbase,regvars,
@@ -688,7 +690,7 @@ implementation
                                 Push Value Para
 *****************************************************************************}
 
-    procedure push_value_para(p:tnode;inlined,is_cdecl:boolean;
+    procedure push_value_para(p:tnode;calloption:tproccalloption;
                               para_offset:longint;alignment : longint;
                               const locpara : tparalocation);
       var
@@ -716,7 +718,7 @@ implementation
                begin
                   size:=align(tfloatdef(p.resulttype.def).size,alignment);
                   inc(pushedparasize,size);
-                  if not inlined then
+                  if calloption<>pocall_inline then
                    cg.a_op_const_reg(exprasmlist,OP_SUB,size,STACK_POINTER_REG);
 {$ifdef GDB}
                   if (cs_debuginfo in aktmoduleswitches) and
@@ -725,7 +727,7 @@ implementation
 {$endif GDB}
 
                   { this is the easiest case for inlined !! }
-                  if inlined then
+                  if calloption=pocall_inline then
                    reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize)
                   else
                    reference_reset_base(href,stack_pointer_reg,0);
@@ -755,7 +757,7 @@ implementation
                        dec(tempreference.offset,2);
                        dec(sizetopush,2);
                      end;
-                    if inlined then
+                    if calloption=pocall_inline then
                      begin
                        reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
                        cg.a_load_ref_ref(exprasmlist,cgsize,tempreference,href);
@@ -771,8 +773,8 @@ implementation
         else
          begin
            { call by value open array ? }
-           if is_cdecl and
-              paramanager.push_addr_param(p.resulttype.def,false) then
+           if (calloption in [pocall_cdecl,pocall_cppdecl]) and
+              paramanager.push_addr_param(p.resulttype.def,calloption) then
             begin
               if not (p.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
                 internalerror(200204241);
@@ -796,7 +798,7 @@ implementation
                     if cgsize in [OS_64,OS_S64] then
                      begin
                        inc(pushedparasize,8);
-                       if inlined then
+                       if calloption=pocall_inline then
                         begin
                           reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
                           if p.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
@@ -833,7 +835,7 @@ implementation
                           p.location.register:=rg.makeregsize(p.location.register,cgsize);
                         end;
                        inc(pushedparasize,alignment);
-                       if inlined then
+                       if calloption=pocall_inline then
                         begin
                           reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
                           if p.location.loc in [LOC_REFERENCE,LOC_CREFERENCE] then
@@ -857,7 +859,7 @@ implementation
                 LOC_CMMXREGISTER:
                   begin
                      inc(pushedparasize,8);
-                     if inlined then
+                     if calloption=pocall_inline then
                        begin
                           reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
                           cg.a_loadmm_reg_ref(exprasmlist,p.location.register,href);
@@ -886,7 +888,7 @@ implementation
         list:=taasmoutput(arg);
         if (tsym(p).typ=varsym) and
            (tvarsym(p).varspez=vs_value) and
-           (paramanager.push_addr_param(tvarsym(p).vartype.def,false)) then
+           (paramanager.push_addr_param(tvarsym(p).vartype.def,procinfo.procdef.proccalloption)) then
          begin
            reference_reset_base(href1,procinfo.framepointer,tvarsym(p).address+procinfo.para_offset);
            if is_open_array(tvarsym(p).vartype.def) or
@@ -914,7 +916,7 @@ implementation
            (tvarsym(p).varspez=vs_value) and
            (is_open_array(tvarsym(p).vartype.def) or
             is_array_of_const(tvarsym(p).vartype.def)) and
-           (paramanager.push_addr_param(tvarsym(p).vartype.def,false)) then
+           (paramanager.push_addr_param(tvarsym(p).vartype.def,procinfo.procdef.proccalloption)) then
          begin
            reference_reset_base(href1,procinfo.framepointer,tvarsym(p).address+procinfo.para_offset);
            cg.g_removevaluepara_openarray(list,href1,tarraydef(tvarsym(p).vartype.def).elesize);
@@ -1151,7 +1153,7 @@ function returns in a register and the caller receives it in an other one}
                end;
              else
                begin
-                 if paramanager.ret_in_acc(aktprocdef.rettype.def) then
+                 if paramanager.ret_in_acc(aktprocdef.rettype.def,aktprocdef.proccalloption) then
                   begin
                     uses_acc:=true;
                     cg.a_reg_alloc(list,accumulator);
@@ -1203,7 +1205,7 @@ function returns in a register and the caller receives it in an other one}
                end;
              else
                begin
-                 if paramanager.ret_in_acc(aktprocdef.rettype.def) then
+                 if paramanager.ret_in_acc(aktprocdef.rettype.def,aktprocdef.proccalloption) then
                   cg.a_load_reg_ref(list,cgsize,accumulator,href);
                end;
            end;
@@ -1219,7 +1221,6 @@ function returns in a register and the caller receives it in an other one}
       var
         hs : string;
         href : treference;
-        p : tsymtable;
         stackalloclist : taasmoutput;
         hp : tparaitem;
         paraloc : tparalocation;
@@ -1271,7 +1272,7 @@ function returns in a register and the caller receives it in an other one}
         if not is_void(aktprocdef.rettype.def) then
           begin
              { for now the pointer to the result can't be a register }
-             if not(paramanager.ret_in_reg(aktprocdef.rettype.def)) then
+             if not(paramanager.ret_in_reg(aktprocdef.rettype.def,aktprocdef.proccalloption)) then
                begin
                   paraloc:=paramanager.getfuncretparaloc(aktprocdef);
                   reference_reset_base(href,procinfo.framepointer,procinfo.return_offset);
@@ -1297,7 +1298,7 @@ function returns in a register and the caller receives it in an other one}
                   if (cs_implicit_exceptions in aktmoduleswitches) then
                     procinfo.flags:=procinfo.flags or pi_needs_implicit_finally;
                   reference_reset_base(href,procinfo.framepointer,procinfo.return_offset);
-                  cg.g_initialize(list,aktprocdef.rettype.def,href,paramanager.ret_in_param(aktprocdef.rettype.def));
+                  cg.g_initialize(list,aktprocdef.rettype.def,href,paramanager.ret_in_param(aktprocdef.rettype.def,aktprocdef.proccalloption));
                end;
           end;
 
@@ -1629,7 +1630,7 @@ function returns in a register and the caller receives it in an other one}
                     not is_class(aktprocdef.rettype.def)) then
                   begin
                      reference_reset_base(href,procinfo.framepointer,procinfo.return_offset);
-                     cg.g_finalize(list,aktprocdef.rettype.def,href,paramanager.ret_in_param(aktprocdef.rettype.def));
+                     cg.g_finalize(list,aktprocdef.rettype.def,href,paramanager.ret_in_param(aktprocdef.rettype.def,aktprocdef.proccalloption));
                   end;
               end;
 
@@ -1784,7 +1785,7 @@ function returns in a register and the caller receives it in an other one}
 
             if (not is_void(aktprocdef.rettype.def)) then
               begin
-                if paramanager.ret_in_param(aktprocdef.rettype.def) then
+                if paramanager.ret_in_param(aktprocdef.rettype.def,aktprocdef.proccalloption) then
                   list.concat(Tai_stabs.Create(strpnew(
                    '"'+aktprocsym.name+':X*'+tstoreddef(aktprocdef.rettype.def).numberstring+'",'+
                    tostr(N_tsym)+',0,0,'+tostr(procinfo.return_offset))))
@@ -1793,7 +1794,7 @@ function returns in a register and the caller receives it in an other one}
                    '"'+aktprocsym.name+':X'+tstoreddef(aktprocdef.rettype.def).numberstring+'",'+
                    tostr(N_tsym)+',0,0,'+tostr(procinfo.return_offset))));
                 if (m_result in aktmodeswitches) then
-                  if paramanager.ret_in_param(aktprocdef.rettype.def) then
+                  if paramanager.ret_in_param(aktprocdef.rettype.def,aktprocdef.proccalloption) then
                     list.concat(Tai_stabs.Create(strpnew(
                      '"RESULT:X*'+tstoreddef(aktprocdef.rettype.def).numberstring+'",'+
                      tostr(N_tsym)+',0,0,'+tostr(procinfo.return_offset))))
@@ -1875,7 +1876,10 @@ function returns in a register and the caller receives it in an other one}
 end.
 {
   $Log$
-  Revision 1.61  2002-11-17 17:49:08  mazen
+  Revision 1.62  2002-11-18 17:31:55  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.61  2002/11/17 17:49:08  mazen
   + return_result_reg and function_result_reg are now used, in all plateforms, to pass functions result between called function and its caller. See the explanation of each one
 
   Revision 1.60  2002/11/17 16:31:56  carl

+ 5 - 2
compiler/nflw.pas

@@ -826,7 +826,7 @@ implementation
            if assigned(left) then
             begin
               inserttypeconv(left,aktprocdef.rettype);
-              if paramanager.ret_in_param(aktprocdef.rettype.def) or
+              if paramanager.ret_in_param(aktprocdef.rettype.def,aktprocdef.proccalloption) or
                  (procinfo.no_fast_exit) or
                  ((procinfo.flags and pi_uses_exceptions)<>0) then
                begin
@@ -1412,7 +1412,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.54  2002-10-20 15:31:49  peter
+  Revision 1.55  2002-11-18 17:31:56  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.54  2002/10/20 15:31:49  peter
     * set funcret state for exit(0)
 
   Revision 1.53  2002/10/05 12:43:25  carl

+ 5 - 2
compiler/ninl.pas

@@ -2022,7 +2022,7 @@ implementation
             end;
           in_sizeof_x:
             begin
-              if paramanager.push_high_param(left.resulttype.def) then
+              if paramanager.push_high_param(left.resulttype.def,aktprocdef.proccalloption) then
                begin
                  srsym:=searchsymonlyin(tloadnode(left).symtable,'high'+tvarsym(tloadnode(left).symtableentry).name);
                  hp:=caddnode.create(addn,cloadnode.create(srsym,tloadnode(left).symtable),
@@ -2401,7 +2401,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.95  2002-11-16 17:59:31  peter
+  Revision 1.96  2002-11-18 17:31:57  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.95  2002/11/16 17:59:31  peter
     * load threadvar input/output variable in temp
 
   Revision 1.94  2002/11/15 01:58:52  peter

+ 6 - 3
compiler/nld.pas

@@ -412,7 +412,7 @@ implementation
                    { we need a register for call by reference parameters }
                    if (tvarsym(symtableentry).varspez in [vs_var,vs_out]) or
                       ((tvarsym(symtableentry).varspez=vs_const) and
-                      paramanager.push_addr_param(tvarsym(symtableentry).vartype.def,false)) or
+                      paramanager.push_addr_param(tvarsym(symtableentry).vartype.def,pocall_none)) or
                       { call by value open arrays are also indirect addressed }
                       is_open_array(tvarsym(symtableentry).vartype.def) then
                      registers32:=1;
@@ -778,7 +778,7 @@ implementation
       begin
          result:=nil;
          location.loc:=LOC_REFERENCE;
-         if paramanager.ret_in_param(resulttype.def) or
+         if paramanager.ret_in_param(resulttype.def,tprocdef(funcretsym.owner.defowner).proccalloption) or
             (lexlevel<>funcretsym.owner.symtablelevel) then
            registers32:=1;
       end;
@@ -1181,7 +1181,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.64  2002-11-15 01:58:52  peter
+  Revision 1.65  2002-11-18 17:31:57  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.64  2002/11/15 01:58:52  peter
     * merged changes from 1.0.7 up to 04-11
       - -V option for generating bug report tracing
       - more tracing for option parsing

+ 29 - 25
compiler/paramgr.pas

@@ -30,6 +30,7 @@ unit paramgr;
 
     uses
        cpubase,
+       globtype,
        symtype,symdef;
 
     type
@@ -38,25 +39,25 @@ unit paramgr;
        }
        tparamanager = class
           {# Returns true if the return value can be put in accumulator }
-          function ret_in_acc(def : tdef) : boolean;virtual;
+          function ret_in_acc(def : tdef;calloption : tproccalloption) : boolean;virtual;
           {# Returns true if the return value is put in a register
 
              Either a floating point register, or a general purpose
              register.
           }
-          function ret_in_reg(def : tdef) : boolean;virtual;
+          function ret_in_reg(def : tdef;calloption : tproccalloption) : boolean;virtual;
 
           {# Returns true if the return value is actually a parameter
              pointer.
           }
-          function ret_in_param(def : tdef) : boolean;virtual;
+          function ret_in_param(def : tdef;calloption : tproccalloption) : boolean;virtual;
 
-          function push_high_param(def : tdef) : boolean;virtual;
+          function push_high_param(def : tdef;calloption : tproccalloption) : boolean;virtual;
 
           {# Returns true if a parameter is too large to copy and only
             the address is pushed
           }
-          function push_addr_param(def : tdef;is_cdecl:boolean) : boolean;virtual;
+          function push_addr_param(def : tdef;calloption : tproccalloption) : boolean;virtual;
           {# Returns a structure giving the information on
              the storage of the parameter (which must be
              an integer parameter)
@@ -91,11 +92,11 @@ unit paramgr;
 
             @param(def The definition of the result type of the function)
           }
-          function getfuncresultloc(def : tdef): tparalocation; virtual;
+          function getfuncresultloc(def : tdef;calloption:tproccalloption): tparalocation; virtual;
        end;
 
     procedure setparalocs(p : tprocdef);
-    function getfuncretusedregisters(def : tdef): tregisterset;
+    function getfuncretusedregisters(def : tdef;calloption:tproccalloption): tregisterset;
 
     var
        paralocdummy : tparalocation;
@@ -104,13 +105,13 @@ unit paramgr;
   implementation
 
     uses
-       cpuinfo,globals,globtype,systems,
+       cpuinfo,globals,systems,
        symconst,symbase,symsym,
        rgobj,
        defbase,cgbase,cginfo,verbose;
 
     { true if the return value is in accumulator (EAX for i386), D0 for 68k }
-    function tparamanager.ret_in_acc(def : tdef) : boolean;
+    function tparamanager.ret_in_acc(def : tdef;calloption : tproccalloption) : boolean;
       begin
          ret_in_acc:=(def.deftype in [orddef,pointerdef,enumdef,classrefdef]) or
                      ((def.deftype=stringdef) and (tstringdef(def).string_typ in [st_ansistring,st_widestring])) or
@@ -119,13 +120,13 @@ unit paramgr;
                      ((def.deftype=setdef) and (tsetdef(def).settype=smallset));
       end;
 
-    function tparamanager.ret_in_reg(def : tdef) : boolean;
+    function tparamanager.ret_in_reg(def : tdef;calloption : tproccalloption) : boolean;
       begin
-        ret_in_reg:=ret_in_acc(def) or (def.deftype=floatdef);
+        ret_in_reg:=ret_in_acc(def,calloption) or (def.deftype=floatdef);
       end;
 
     { true if uses a parameter as return value }
-    function tparamanager.ret_in_param(def : tdef) : boolean;
+    function tparamanager.ret_in_param(def : tdef;calloption : tproccalloption) : boolean;
       begin
          ret_in_param:=(def.deftype in [arraydef,recorddef]) or
            ((def.deftype=stringdef) and (tstringdef(def).string_typ in [st_shortstring,st_longstring])) or
@@ -136,7 +137,7 @@ unit paramgr;
       end;
 
 
-    function tparamanager.push_high_param(def : tdef) : boolean;
+    function tparamanager.push_high_param(def : tdef;calloption : tproccalloption) : boolean;
       begin
          push_high_param:=is_open_array(def) or
                           is_open_string(def) or
@@ -145,7 +146,7 @@ unit paramgr;
 
 
     { true if a parameter is too large to copy and only the address is pushed }
-    function tparamanager.push_addr_param(def : tdef;is_cdecl:boolean) : boolean;
+    function tparamanager.push_addr_param(def : tdef;calloption : tproccalloption) : boolean;
       begin
         push_addr_param:=false;
         if never_copy_const_param then
@@ -157,14 +158,14 @@ unit paramgr;
              formaldef :
                push_addr_param:=true;
              recorddef :
-               push_addr_param:=(not is_cdecl) and (def.size>pointer_size);
+               push_addr_param:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and (def.size>pointer_size);
              arraydef :
                push_addr_param:=(
                                  (tarraydef(def).highrange>=tarraydef(def).lowrange) and
                                   (
                                    not(target_info.system=system_i386_win32) or
                                    ((def.size>pointer_size) and
-                                    (not is_cdecl))
+                                    not(calloption in [pocall_cdecl,pocall_cppdecl]))
                                   )
                                 ) or
                                 is_open_array(def) or
@@ -175,9 +176,9 @@ unit paramgr;
              stringdef :
                push_addr_param:=tstringdef(def).string_typ in [st_shortstring,st_longstring];
              procvardef :
-               push_addr_param:=(not is_cdecl) and (po_methodpointer in tprocvardef(def).procoptions);
+               push_addr_param:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and (po_methodpointer in tprocvardef(def).procoptions);
              setdef :
-               push_addr_param:=(not is_cdecl) and (tsetdef(def).settype<>smallset);
+               push_addr_param:=not(calloption in [pocall_cdecl,pocall_cppdecl]) and (tsetdef(def).settype<>smallset);
            end;
          end;
       end;
@@ -203,7 +204,7 @@ unit paramgr;
       end;
 
 
-    function tparamanager.getfuncresultloc(def : tdef): tparalocation;
+    function tparamanager.getfuncresultloc(def : tdef;calloption:tproccalloption): tparalocation;
       begin
          fillchar(result,sizeof(tparalocation),0);
          if is_void(def) then exit;
@@ -234,7 +235,7 @@ unit paramgr;
              end;
           else
              begin
-                if ret_in_reg(def) then
+                if ret_in_reg(def,calloption) then
                   begin
                     result.loc := LOC_REGISTER;
                     result.register := accumulator;
@@ -261,7 +262,7 @@ unit paramgr;
       end;
 
 
-    function getfuncretusedregisters(def : tdef): tregisterset;
+    function getfuncretusedregisters(def : tdef;calloption:tproccalloption): tregisterset;
       var
         paramloc : tparalocation;
         regset : tregisterset;
@@ -272,9 +273,9 @@ unit paramgr;
           its useless to continue on in this
           routine
         }
-        if not paramanager.ret_in_reg(def) then
+        if not paramanager.ret_in_reg(def,calloption) then
           exit;
-        paramloc := paramanager.getfuncresultloc(def);
+        paramloc := paramanager.getfuncresultloc(def,calloption);
         case paramloc.loc of
           LOC_FPUREGISTER,
           LOC_CFPUREGISTER,
@@ -310,7 +311,7 @@ unit paramgr;
                  (
                   (vo_regable in tvarsym(hp.parasym).varoptions) or
                   (vo_fpuregable in tvarsym(hp.parasym).varoptions) or
-                   paramanager.push_addr_param(hp.paratype.def,p.proccalloption in [pocall_cdecl,pocall_cppdecl]) or
+                   paramanager.push_addr_param(hp.paratype.def,p.proccalloption) or
                    (hp.paratyp in [vs_var,vs_out])
                  ) then
                 begin
@@ -338,7 +339,10 @@ end.
 
 {
    $Log$
-   Revision 1.22  2002-11-16 18:00:04  peter
+   Revision 1.23  2002-11-18 17:31:58  peter
+     * pass proccalloption to ret_in_xxx and push_xxx functions
+
+   Revision 1.22  2002/11/16 18:00:04  peter
      * only push small arrays on the stack for win32
 
    Revision 1.21  2002/10/05 12:43:25  carl

+ 7 - 4
compiler/pdecsub.pas

@@ -332,13 +332,13 @@ implementation
                      vs.vartype:=tt;
                      vs.varspez:=varspez;
                      if (varspez in [vs_var,vs_const,vs_out]) and
-                        paramanager.push_addr_param(tt.def,false) then
+                        paramanager.push_addr_param(tt.def,aktprocdef.proccalloption) then
                        include(vs.varoptions,vo_regable);
 
                      { do we need a local copy? Then rename the varsym, do this after the
                        insert so the dup id checking is done correctly }
                      if (varspez=vs_value) and
-                        paramanager.push_addr_param(tt.def,aktprocdef.proccalloption in [pocall_cdecl,pocall_cppdecl]) and
+                        paramanager.push_addr_param(tt.def,aktprocdef.proccalloption) and
                         not(is_open_array(tt.def) or is_array_of_const(tt.def)) then
                        currparast.rename(vs.name,'val'+vs.name);
 
@@ -2027,7 +2027,7 @@ const
          begin
            if not parse_only then
             begin
-              if paramanager.ret_in_param(aprocdef.rettype.def) then
+              if paramanager.ret_in_param(aprocdef.rettype.def,aprocdef.proccalloption) then
                begin
                  aprocdef.parast.insert(otsym);
                  { this allows to read the funcretoffset }
@@ -2054,7 +2054,10 @@ const
 end.
 {
   $Log$
-  Revision 1.80  2002-11-17 16:31:56  carl
+  Revision 1.81  2002-11-18 17:31:58  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.80  2002/11/17 16:31:56  carl
     * memory optimization (3-4%) : cleanup of tai fields,
        cleanup of tdef and tsym fields.
     * make it work for m68k

+ 8 - 1
compiler/pexpr.pas

@@ -611,6 +611,10 @@ implementation
       begin
          prevafterassn:=afterassignment;
          afterassignment:=false;
+{$ifdef EXTDEBUG}
+         if p1.nodetype<>calln then
+           internalerror(20021118);
+{$endif EXTDEBUG}
          { want we only determine the address of }
          { a subroutine ?                       }
          if not(getaddr) then
@@ -2263,7 +2267,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.86  2002-10-05 00:48:57  peter
+  Revision 1.87  2002-11-18 17:31:58  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.86  2002/10/05 00:48:57  peter
     * support inherited; support for overload as it is handled by
       delphi. This is only for delphi mode as it is working is
       undocumented and hard to predict what is done

+ 6 - 3
compiler/powerpc/cpupara.pas

@@ -137,7 +137,7 @@ unit cpupara;
          { pointer for structured results ? }
          if not is_void(p.rettype.def) then
            begin
-              if not(ret_in_reg(p.rettype.def)) then
+              if not(ret_in_reg(p.rettype.def,p.proccalloption)) then
                 inc(nextintreg);
            end;
 
@@ -216,7 +216,7 @@ unit cpupara;
                  LOC_REFERENCE:
                    begin
                       hp.paraloc.size:=OS_ADDR;
-                      if push_addr_param(hp.paratype.def,p.proccalloption in [pocall_cdecl,pocall_cppdecl]) or (hp.paratyp in [vs_var,vs_out]) then
+                      if push_addr_param(hp.paratype.def,p.proccalloption) or (hp.paratyp in [vs_var,vs_out]) then
                         begin
                            if nextintreg<=R_10 then
                              begin
@@ -295,7 +295,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.15  2002-10-02 13:33:36  jonas
+  Revision 1.16  2002-11-18 17:32:01  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.15  2002/10/02 13:33:36  jonas
     + set, variant support in getfuncretparaloc
 
   Revision 1.14  2002/09/28 21:27:16  florian

+ 7 - 4
compiler/powerpc/cpupi.pas

@@ -71,7 +71,7 @@ unit cpupi;
               procinfo.framepointer_offset:=procdef.parast.address_fixup;
               inc(procdef.parast.address_fixup,4);
            end;
-         if paramanager.ret_in_param(procdef.rettype.def) then
+         if paramanager.ret_in_param(procdef.rettype.def,procdef.proccalloption) then
            begin
               procinfo.return_offset:=procdef.parast.address_fixup;
               inc(procdef.parast.address_fixup,4);
@@ -84,7 +84,7 @@ unit cpupi;
          { this value is necessary for nested procedures }
          procdef.localst.address_fixup:=align(procdef.parast.address_fixup+procdef.parast.datasize,16);
          if assigned(aktprocdef.funcretsym) and
-           not(paramanager.ret_in_param(procdef.rettype.def)) then
+           not(paramanager.ret_in_param(procdef.rettype.def,procdef.proccalloption)) then
            procinfo.return_offset:=tg.direction*tfuncretsym(aktprocdef.funcretsym).address+procdef.localst.address_fixup;
      end;
 
@@ -103,7 +103,7 @@ unit cpupi;
          procdef.localst.address_fixup:=align(procdef.parast.address_fixup+procdef.parast.datasize,16);
 
          if assigned(aktprocdef.funcretsym) and
-           not(paramanager.ret_in_param(procdef.rettype.def)) then
+           not(paramanager.ret_in_param(procdef.rettype.def,procdef.proccalloption)) then
            procinfo.return_offset:=tg.direction*tfuncretsym(aktprocdef.funcretsym).address+procdef.localst.address_fixup;
 
          if cs_asm_source in aktglobalswitches then
@@ -123,7 +123,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.4  2002-09-10 20:30:42  florian
+  Revision 1.5  2002-11-18 17:32:01  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.4  2002/09/10 20:30:42  florian
     * fixed offset calculation for symtables etc.
 
   Revision 1.3  2002/09/07 17:54:59  florian

+ 7 - 4
compiler/pstatmnt.pas

@@ -710,7 +710,7 @@ implementation
       var
         asmstat : tasmnode;
         Marker  : tai;
-        r,r2    : tregister;
+        r       : tregister;
         found   : boolean;
         hs      : string;
       begin
@@ -1121,7 +1121,7 @@ implementation
             (aktprocdef.owner.symtabletype<>objectsymtable) and
             (not assigned(aktprocdef.funcretsym) or
              (tfuncretsym(aktprocdef.funcretsym).refcount<=1)) and
-            not(paramanager.ret_in_param(aktprocdef.rettype.def)) and
+            not(paramanager.ret_in_param(aktprocdef.rettype.def,aktprocdef.proccalloption)) and
             (target_cpu in [cpu_i386,cpu_m68k,cpu_vm])
 {$ifdef CHECKFORPUSH}
             and not(UsesPush(tasmnode(p)))
@@ -1133,7 +1133,7 @@ implementation
           register.
         }
         if assigned(aktprocdef.funcretsym) and
-           paramanager.ret_in_reg(aktprocdef.rettype.def) then
+           paramanager.ret_in_reg(aktprocdef.rettype.def,aktprocdef.proccalloption) then
           tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_assigned;
 
         { because the END is already read we need to get the
@@ -1146,7 +1146,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.78  2002-09-07 19:34:08  florian
+  Revision 1.79  2002-11-18 17:31:58  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.78  2002/09/07 19:34:08  florian
     + tcg.direction is used now
 
   Revision 1.77  2002/09/07 15:25:07  peter

+ 5 - 2
compiler/psub.pas

@@ -621,7 +621,7 @@ implementation
 {$endif i386}
 
          { pointer to the return value ? }
-         if paramanager.ret_in_param(aktprocdef.rettype.def)
+         if paramanager.ret_in_param(aktprocdef.rettype.def,aktprocdef.proccalloption)
 {$ifdef m68k}
             and not (aktprocdef.proccalloption in [pocall_cdecl])
 {$endif m68k}
@@ -802,7 +802,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.75  2002-11-17 16:31:57  carl
+  Revision 1.76  2002-11-18 17:31:58  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.75  2002/11/17 16:31:57  carl
     * memory optimization (3-4%) : cleanup of tai fields,
        cleanup of tdef and tsym fields.
     * make it work for m68k

+ 7 - 4
compiler/rautils.pas

@@ -736,7 +736,7 @@ Begin
   if (not is_void(aktprocdef.rettype.def)) then
    begin
      if (m_tp7 in aktmodeswitches) and
-        paramanager.ret_in_reg(aktprocdef.rettype.def) then
+        paramanager.ret_in_reg(aktprocdef.rettype.def,aktprocdef.proccalloption) then
        begin
          Message(asmr_e_cannot_use_RESULT_here);
          exit;
@@ -874,7 +874,7 @@ Begin
                 end;
               if (tvarsym(sym).varspez=vs_var) or
                  ((tvarsym(sym).varspez=vs_const) and
-                  paramanager.push_addr_param(tvarsym(sym).vartype.def,false)) then
+                  paramanager.push_addr_param(tvarsym(sym).vartype.def,aktprocdef.proccalloption)) then
                 SetSize(pointer_size,false);
             end;
           localsymtable :
@@ -914,7 +914,7 @@ Begin
                 end;
               if (tvarsym(sym).varspez in [vs_var,vs_out]) or
                  ((tvarsym(sym).varspez=vs_const) and
-                  paramanager.push_addr_param(tvarsym(sym).vartype.def,false)) then
+                  paramanager.push_addr_param(tvarsym(sym).vartype.def,aktprocdef.proccalloption)) then
                 SetSize(pointer_size,false);
             end;
         end;
@@ -1592,7 +1592,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.47  2002-11-15 16:29:31  peter
+  Revision 1.48  2002-11-18 17:31:59  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.47  2002/11/15 16:29:31  peter
     * made tasmsymbol.refs private (merged)
 
   Revision 1.46  2002/09/03 16:26:27  daniel

+ 6 - 3
compiler/regvars.pas

@@ -178,7 +178,7 @@ implementation
                       { call by reference/const ? }
                       if (regvarinfo^.regvars[i].varspez in [vs_var,vs_out]) or
                          ((regvarinfo^.regvars[i].varspez=vs_const) and
-                           paramanager.push_addr_param(regvarinfo^.regvars[i].vartype.def,false)) then
+                           paramanager.push_addr_param(regvarinfo^.regvars[i].vartype.def,aktprocdef.proccalloption)) then
                         begin
                            regvarinfo^.regvars[i].reg:=varregs[i];
                         end
@@ -316,7 +316,7 @@ implementation
           hr.base:=procinfo.framepointer;
           if (vsym.varspez in [vs_var,vs_out]) or
              ((vsym.varspez=vs_const) and
-               paramanager.push_addr_param(vsym.vartype.def,false)) then
+               paramanager.push_addr_param(vsym.vartype.def,aktprocdef.proccalloption)) then
             opsize := OS_ADDR
           else
             opsize := def_cgsize(vsym.vartype.def);
@@ -469,7 +469,10 @@ end.
 
 {
   $Log$
-  Revision 1.41  2002-08-25 19:25:20  peter
+  Revision 1.42  2002-11-18 17:31:59  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.41  2002/08/25 19:25:20  peter
     * sym.insert_in_data removed
     * symtable.insertvardata/insertconstdata added
     * removed insert_in_data call from symtable.insert, it needs to be

+ 7 - 4
compiler/sparc/cpupara.pas

@@ -206,7 +206,7 @@ WriteLn('***********************************************');
                  LOC_REFERENCE:
                    begin
                       hp.paraloc.size:=OS_ADDR;
-                      if push_addr_param(hp.paratype.def,p.proccalloption in [pocall_cdecl,pocall_cppdecl]) or (hp.paratyp in [vs_var,vs_out]) then
+                      if push_addr_param(hp.paratype.def,p.proccalloption) or (hp.paratyp in [vs_var,vs_out]) then
                         begin
                            if nextintreg<=R_O5 then
                              begin
@@ -283,7 +283,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.9  2002-11-03 20:22:40  mazen
+  Revision 1.10  2002-11-18 17:32:01  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.9  2002/11/03 20:22:40  mazen
   * parameter handling updated
 
   Revision 1.8  2002/10/13 21:46:07  mazen
@@ -297,10 +300,10 @@ end.
 
   Revision 1.5  2002/10/09 13:52:19  mazen
   just incase some one wolud help me debugging that\!
-  
+
   Revision 1.4  2002/10/08 21:02:22  mazen
   * debugging register allocation
-  
+
   Revision 1.3  2002/10/07 20:33:05  mazen
   word alignement modified in g_stack_frame
 

+ 5 - 2
compiler/sparc/radirect.pas

@@ -148,7 +148,7 @@ end;
                                  { is the last written character an special }
                                  { char ?                                   }
                                  if (s[length(s)]='%') and
-                                    paramanager.ret_in_acc(aktprocdef.rettype.def) and
+                                    paramanager.ret_in_acc(aktprocdef.rettype.def,aktprocdef.proccalloption) and
                                     ((pos('AX',upper(hs))>0) or
                                     (pos('AL',upper(hs))>0)) then
                                    tfuncretsym(aktprocdef.funcretsym).funcretstate:=vs_assigned;
@@ -314,7 +314,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.2  2002-09-19 20:24:47  mazen
+  Revision 1.3  2002-11-18 17:32:01  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.2  2002/09/19 20:24:47  mazen
   + call support
 
   Revision 1.1  2002/08/23 10:08:28  mazen

+ 7 - 6
compiler/symdef.pas

@@ -3143,10 +3143,8 @@ implementation
       var
          pdc : TParaItem;
          l : longint;
-         is_cdecl : boolean;
       begin
          l:=0;
-         is_cdecl:=(proccalloption in [pocall_cdecl,pocall_cppdecl]);
          pdc:=TParaItem(Para.first);
          while assigned(pdc) do
           begin
@@ -3157,7 +3155,7 @@ implementation
               vs_value,
               vs_const :
                 begin
-                  if paramanager.push_addr_param(pdc.paratype.def,is_cdecl) then
+                  if paramanager.push_addr_param(pdc.paratype.def,proccalloption) then
                     inc(l,POINTER_SIZE)
                   else
                     inc(l,pdc.paratype.def.size);
@@ -4129,7 +4127,7 @@ implementation
          iidstr:=nil;
          if objecttype in [odt_interfacecom,odt_interfacecorba] then
            begin
-              new(iidguid); 
+              new(iidguid);
               ppufile.getguid(iidguid^);
               iidstr:=stringdup(ppufile.getstring);
               lastvtableindex:=ppufile.getlongint;
@@ -4244,7 +4242,7 @@ implementation
            implementedinterfaces.deref;
       end;
 
-    
+
     procedure tobjectdef.prepareguid;
       begin
         { set up guid }
@@ -5520,7 +5518,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.105  2002-11-17 16:31:57  carl
+  Revision 1.106  2002-11-18 17:31:59  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.105  2002/11/17 16:31:57  carl
     * memory optimization (3-4%) : cleanup of tai fields,
        cleanup of tdef and tsym fields.
     * make it work for m68k

+ 10 - 9
compiler/symsym.pas

@@ -29,7 +29,7 @@ interface
        { common }
        cutils,
        { target }
-       cpuinfo,
+       cpuinfo,globtype,
        { symtable }
        symconst,symbase,symtype,symdef,
        { ppu }
@@ -193,7 +193,7 @@ interface
           procedure set_mangledname(const s:string);
           function  getsize : longint;
           function  getvaluesize : longint;
-          function  getpushsize(is_cdecl:boolean): longint;
+          function  getpushsize(calloption:tproccalloption): longint;
 {$ifdef var_notification}
           function register_notification(flags:Tnotification_flags;
                                          callback:Tnotification_callback):cardinal;
@@ -378,7 +378,7 @@ implementation
        strings,
 {$endif Delphi}
        { global }
-       globtype,verbose,
+       verbose,
        { target }
        systems,
        { symtable }
@@ -1665,7 +1665,7 @@ implementation
       end;
 
 
-    function tvarsym.getpushsize(is_cdecl:boolean) : longint;
+    function tvarsym.getpushsize(calloption:tproccalloption) : longint;
       begin
          getpushsize:=-1;
          if assigned(vartype.def) then
@@ -1677,7 +1677,7 @@ implementation
                 vs_value,
                 vs_const :
                   begin
-                      if paramanager.push_addr_param(vartype.def,is_cdecl) then
+                      if paramanager.push_addr_param(vartype.def,calloption) then
                         getpushsize:=pointer_size
                       else
                         getpushsize:=vartype.def.size;
@@ -1705,7 +1705,6 @@ implementation
     function tvarsym.stabstring : pchar;
      var
        st : string;
-       is_cdecl : boolean;
      begin
        st:=tstoreddef(vartype.def).numberstring;
        if (owner.symtabletype = objectsymtable) and
@@ -1733,12 +1732,11 @@ implementation
          end
        else if (owner.symtabletype in [parasymtable,inlineparasymtable]) then
          begin
-            is_cdecl:=(tprocdef(owner.defowner).proccalloption in [pocall_cdecl,pocall_cppdecl]);
             case varspez of
                vs_out,
                vs_var   : st := 'v'+st;
                vs_value,
-               vs_const : if paramanager.push_addr_param(vartype.def,is_cdecl) then
+               vs_const : if paramanager.push_addr_param(vartype.def,tprocdef(owner.defowner).proccalloption) then
                             st := 'v'+st { should be 'i' but 'i' doesn't work }
                           else
                             st := 'p'+st;
@@ -2506,7 +2504,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.72  2002-11-17 16:31:57  carl
+  Revision 1.73  2002-11-18 17:31:59  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.72  2002/11/17 16:31:57  carl
     * memory optimization (3-4%) : cleanup of tai fields,
        cleanup of tdef and tsym fields.
     * make it work for m68k

+ 7 - 5
compiler/symtable.pas

@@ -1324,7 +1324,8 @@ implementation
               else
                begin
                  { allocate space in local if ret in register }
-                 if paramanager.ret_in_reg(tfuncretsym(sym).returntype.def) then
+                 if paramanager.ret_in_reg(tfuncretsym(sym).returntype.def,
+                                           tprocdef(sym.owner.defowner).proccalloption) then
                   begin
                     l:=tfuncretsym(sym).returntype.def.size;
                     varalign:=size_2_align(l);
@@ -1432,17 +1433,15 @@ implementation
     procedure tparasymtable.insertvardata(sym : tsymentry);
       var
         l,varalign : longint;
-        is_cdecl : boolean;
       begin
         if sym.typ<>varsym then
           internalerror(200208253);
         { retrieve cdecl status }
         if defowner.deftype<>procdef then
           internalerror(200208256);
-        is_cdecl:=(tprocdef(defowner).proccalloption in [pocall_cdecl,pocall_cppdecl]);
         { here we need the size of a push instead of the
           size of the data }
-        l:=tvarsym(sym).getpushsize(is_cdecl);
+        l:=tvarsym(sym).getpushsize(tprocdef(defowner).proccalloption);
         varalign:=size_2_align(l);
         tvarsym(sym).varstate:=vs_assigned;
         { we need the new datasize already aligned so we can't
@@ -2343,7 +2342,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.77  2002-11-15 01:58:54  peter
+  Revision 1.78  2002-11-18 17:32:00  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.77  2002/11/15 01:58:54  peter
     * merged changes from 1.0.7 up to 04-11
       - -V option for generating bug report tracing
       - more tracing for option parsing

+ 5 - 2
compiler/x86/cgx86.pas

@@ -1510,7 +1510,7 @@ unit cgx86;
         if (po_clearstack in aktprocdef.procoptions) then
          begin
            { complex return values are removed from stack in C code PM }
-           if paramanager.ret_in_param(aktprocdef.rettype.def) then
+           if paramanager.ret_in_param(aktprocdef.rettype.def,aktprocdef.proccalloption) then
              list.concat(Taicpu.Op_const(A_RET,S_NO,4))
            else
              list.concat(Taicpu.Op_none(A_RET,S_NO));
@@ -1682,7 +1682,10 @@ unit cgx86;
 end.
 {
   $Log$
-  Revision 1.20  2002-11-09 21:18:31  carl
+  Revision 1.21  2002-11-18 17:32:01  peter
+    * pass proccalloption to ret_in_xxx and push_xxx functions
+
+  Revision 1.20  2002/11/09 21:18:31  carl
     * flags2reg() was not extending the byte register to the correct result size
 
   Revision 1.19  2002/10/16 19:01:43  peter