瀏覽代碼

* remove copy_value_on_stack and a_param_copy_ref

peter 20 年之前
父節點
當前提交
35e466d971

+ 4 - 15
compiler/cgobj.pas

@@ -166,8 +166,6 @@ unit cgobj;
           }
           procedure a_paramaddr_ref(list : taasmoutput;const r : treference;const cgpara : TCGPara);virtual;
 
-          { Copies a whole memory block to the stack, the cgpara must be a memory location }
-          procedure a_param_copy_ref(list : taasmoutput;size : aint;const r : treference;const cgpara : TCGPara);virtual;
           { Remarks:
             * If a method specifies a size you have only to take care
               of that number of bits, i.e. load_const_reg with OP_8 must
@@ -798,18 +796,6 @@ implementation
       end;
 
 
-    procedure tcg.a_param_copy_ref(list : taasmoutput;size : aint;const r : treference;const cgpara : TCGPara);
-      var
-        ref : treference;
-      begin
-         cgpara.check_simple_location;
-         if not(cgpara.location^.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
-           internalerror(2003010901);
-         reference_reset_base(ref,cgpara.location^.reference.index,cgpara.location^.reference.offset);
-         g_concatcopy(list,r,ref,size);
-      end;
-
-
 {****************************************************************************
                        some generic implementations
 ****************************************************************************}
@@ -2045,7 +2031,10 @@ finalization
 end.
 {
   $Log$
-  Revision 1.189  2005-01-20 16:38:45  peter
+  Revision 1.190  2005-01-20 17:47:01  peter
+    * remove copy_value_on_stack and a_param_copy_ref
+
+  Revision 1.189  2005/01/20 16:38:45  peter
     * load jmp_buf_size from system unit
 
   Revision 1.188  2005/01/18 22:19:20  peter

+ 5 - 2
compiler/m68k/ncpuadd.pas

@@ -187,7 +187,7 @@ implementation
         if (right.location.loc = LOC_CONSTANT) then
           begin
 {$ifdef extdebug}
-            if (right.location.size in [OS_64,OS_S64]) and (hi(right.location.valueqword)<>0) and ((hi(right.location.valueqword)<>-1) or unsigned) then
+            if (right.location.size in [OS_64,OS_S64]) and (hi(right.location.value64)<>0) and ((hi(right.location.value64)<>-1) or unsigned) then
               internalerror(2002080301);
 {$endif extdebug}
             if (nodetype in [equaln,unequaln]) then
@@ -426,7 +426,10 @@ end.
 
 {
   $Log$
-  Revision 1.7  2005-01-08 04:10:36  karoly
+  Revision 1.8  2005-01-20 17:47:01  peter
+    * remove copy_value_on_stack and a_param_copy_ref
+
+  Revision 1.7  2005/01/08 04:10:36  karoly
     * made m68k to compile again
 
   Revision 1.6  2004/10/31 21:45:03  peter

+ 22 - 35
compiler/ncgcal.pas

@@ -275,44 +275,28 @@ implementation
          end
         else
          begin
-{$ifndef i386}
-{$warning TODO This can be removed, a_param_ref shall support this construct}
-           { copy the value on the stack or use normal parameter push?
-             Check for varargs first because that has no parasym }
-           if not(cpf_varargs_para in callparaflags) and
-              paramanager.copy_value_on_stack(parasym.varspez,left.resulttype.def,
-                  aktcallnode.procdefinition.proccalloption) then
-            begin
-              if not (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
-                internalerror(200204241);
-              cg.a_param_copy_ref(exprasmlist,left.resulttype.def.size,left.location.reference,tempcgpara);
-            end
-           else
-{$endif i386}
-            begin
-              case left.location.loc of
-                LOC_CONSTANT,
-                LOC_REGISTER,
-                LOC_CREGISTER,
-                LOC_REFERENCE,
-                LOC_CREFERENCE :
-                  begin
+           case left.location.loc of
+             LOC_CONSTANT,
+             LOC_REGISTER,
+             LOC_CREGISTER,
+             LOC_REFERENCE,
+             LOC_CREFERENCE :
+               begin
 {$ifndef cpu64bit}
-                    { use cg64 only for int64, not for 8 byte records }
-                    if is_64bit(left.resulttype.def) then
-                      cg64.a_param64_loc(exprasmlist,left.location,tempcgpara)
-                    else
+                 { use cg64 only for int64, not for 8 byte records }
+                 if is_64bit(left.resulttype.def) then
+                   cg64.a_param64_loc(exprasmlist,left.location,tempcgpara)
+                 else
 {$endif cpu64bit}
-                      cg.a_param_loc(exprasmlist,left.location,tempcgpara);
-                  end;
+                   cg.a_param_loc(exprasmlist,left.location,tempcgpara);
+               end;
 {$ifdef SUPPORT_MMX}
-                LOC_MMXREGISTER,
-                LOC_CMMXREGISTER:
-                  cg.a_parammm_reg(exprasmlist,left.location.register);
+             LOC_MMXREGISTER,
+             LOC_CMMXREGISTER:
+               cg.a_parammm_reg(exprasmlist,left.location.register);
 {$endif SUPPORT_MMX}
-                else
-                  internalerror(200204241);
-              end;
+             else
+               internalerror(200204241);
            end;
          end;
       end;
@@ -1229,7 +1213,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.196  2005-01-18 22:19:20  peter
+  Revision 1.197  2005-01-20 17:47:01  peter
+    * remove copy_value_on_stack and a_param_copy_ref
+
+  Revision 1.196  2005/01/18 22:19:20  peter
     * multiple location support for i386 a_param_ref
     * remove a_param_copy_ref for i386
 

+ 6 - 2
compiler/ncgutil.pas

@@ -1330,7 +1330,8 @@ implementation
          end;
 
       var
-        i, sizeleft : aint;
+        i : longint;
+        sizeleft : aint;
         currpara : tparavarsym;
         paraloc : pcgparalocation;
 {$ifdef sparc}
@@ -2364,7 +2365,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.256  2005-01-20 16:38:45  peter
+  Revision 1.257  2005-01-20 17:47:01  peter
+    * remove copy_value_on_stack and a_param_copy_ref
+
+  Revision 1.256  2005/01/20 16:38:45  peter
     * load jmp_buf_size from system unit
 
   Revision 1.255  2005/01/19 20:04:46  florian

+ 4 - 36
compiler/paramgr.pas

@@ -55,10 +55,6 @@ unit paramgr;
           function push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;virtual;
           { return the size of a push }
           function push_size(varspez:tvarspez;def : tdef;calloption : tproccalloption) : longint;
-          { Returns true if a parameter needs to be copied on the stack, this
-            is required for cdecl procedures
-          }
-          function copy_value_on_stack(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;virtual;
           {# Returns a structure giving the information on
             the storage of the parameter (which must be
             an integer parameter). This is only used when calling
@@ -208,37 +204,6 @@ implementation
       end;
 
 
-    { true if a parameter is too large to push and needs a concatcopy to get the value on the stack }
-    function tparamanager.copy_value_on_stack(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
-      begin
-        copy_value_on_stack:=false;
-        { this is only for cdecl procedures with vs_const,vs_value }
-        if not(
-               (calloption in [pocall_cdecl,pocall_cppdecl]) and
-               (varspez in [vs_value,vs_const])
-              ) then
-          exit;
-        case def.deftype of
-          variantdef,
-          formaldef :
-            copy_value_on_stack:=true;
-          recorddef :
-            copy_value_on_stack:=(def.size>sizeof(aint));
-          arraydef :
-            copy_value_on_stack:=(tarraydef(def).highrange>=tarraydef(def).lowrange) and
-                                 (def.size>sizeof(aint));
-          objectdef :
-            copy_value_on_stack:=is_object(def);
-          stringdef :
-            copy_value_on_stack:=tstringdef(def).string_typ in [st_shortstring,st_longstring];
-          procvardef :
-            copy_value_on_stack:=(po_methodpointer in tprocvardef(def).procoptions);
-          setdef :
-            copy_value_on_stack:=(tsetdef(def).settype<>smallset);
-        end;
-      end;
-
-
     { return the size of a push }
     function tparamanager.push_size(varspez:tvarspez;def : tdef;calloption : tproccalloption) : longint;
       begin
@@ -468,7 +433,10 @@ end.
 
 {
    $Log$
-   Revision 1.84  2005-01-18 22:19:20  peter
+   Revision 1.85  2005-01-20 17:47:01  peter
+     * remove copy_value_on_stack and a_param_copy_ref
+
+   Revision 1.84  2005/01/18 22:19:20  peter
      * multiple location support for i386 a_param_ref
      * remove a_param_copy_ref for i386
 

+ 7 - 13
compiler/powerpc/cpupara.pas

@@ -43,8 +43,7 @@ unit cpupara;
           function create_paraloc_info(p : tabstractprocdef; side: tcallercallee):longint;override;
           function create_varargs_paraloc_info(p : tabstractprocdef; varargspara:tvarargsparalist):longint;override;
           procedure create_funcretloc_info(p : tabstractprocdef; side: tcallercallee);
-         
-          function copy_value_on_stack(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean; override;
+
          private
           procedure init_values(var curintreg, curfloatreg, curmmreg: tsuperregister; var cur_stack_offset: aword);
           function create_paraloc_info_intern(p : tabstractprocdef; side: tcallercallee; paras:tparalist;
@@ -219,14 +218,6 @@ unit cpupara;
       end;
 
 
-    function tppcparamanager.copy_value_on_stack(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
-      begin
-        result := false;
-        if (target_info.abi <> abi_powerpc_aix) then
-          result := inherited copy_value_on_stack(varspez,def,calloption);
-      end;
-
-
     procedure tppcparamanager.create_funcretloc_info(p : tabstractprocdef; side: tcallercallee);
       var
         retcgsize  : tcgsize;
@@ -404,7 +395,7 @@ unit cpupara;
                     paralen := paradef.size
                   else
                     paralen := tcgsize2size[def_cgsize(paradef)];
-                  if (target_info.abi = abi_powerpc_aix) and 
+                  if (target_info.abi = abi_powerpc_aix) and
                      (paradef.deftype = recorddef) and
                      (hp.varspez in [vs_value,vs_const]) then
                     begin
@@ -629,7 +620,7 @@ unit cpupara;
                 paraloc^.reference.offset:=56
               { 'A7' is the stack pointer on 68k, can't be overwritten
                 by API calls, so it has no offset }
-              { 'R12' is special, used internally to support r12base sysv 
+              { 'R12' is special, used internally to support r12base sysv
                 calling convention }
               else if s='R12' then
                 begin
@@ -655,7 +646,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.84  2005-01-14 20:59:17  jonas
+  Revision 1.85  2005-01-20 17:47:01  peter
+    * remove copy_value_on_stack and a_param_copy_ref
+
+  Revision 1.84  2005/01/14 20:59:17  jonas
     * fixed overallocation of stack space for parameters under SYSV
       (introduced in one of my previous commits)
     * unified code of get_volatile_registers_fpu for SYSV and AIX

+ 6 - 3
compiler/powerpc/nppcld.pas

@@ -60,7 +60,7 @@ unit nppcld;
               if (symtableentry.typ = procsym) and
                  (tprocsym(symtableentry).owner.symtabletype in [staticsymtable,globalsymtable]) and
                  (
-                  (not tabstractunitsymtable(tprocsym(symtableentry).owner).iscurrentmodule) or
+                  (not tprocsym(symtableentry).owner.iscurrentunit) or
                   (po_external in tprocsym(symtableentry).procdef[1].procoptions)
                  ) then
                 begin
@@ -94,7 +94,7 @@ unit nppcld;
             begin
               if (vo_is_dll_var in tglobalvarsym(symtableentry).varoptions) and
                  (tglobalvarsym(symtableentry).owner.symtabletype in [staticsymtable,globalsymtable]) and
-                 not(tabstractunitsymtable(tglobalvarsym(symtableentry).owner).iscurrentmodule) then
+                 not(tglobalvarsym(symtableentry).owner.iscurrentunit) then
                 begin
                   l:=objectlibrary.getasmsymbol('L'+tglobalvarsym(symtableentry).mangledname+'$non_lazy_ptr');
                   if not(assigned(l)) then
@@ -125,7 +125,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.6  2005-01-19 22:19:41  peter
+  Revision 1.7  2005-01-20 17:47:01  peter
+    * remove copy_value_on_stack and a_param_copy_ref
+
+  Revision 1.6  2005/01/19 22:19:41  peter
     * unit mapping rewrite
     * new derefmap added
 

+ 4 - 8
compiler/sparc/cpupara.pas

@@ -33,7 +33,6 @@ interface
 
     type
       TSparcParaManager=class(TParaManager)
-        function  copy_value_on_stack(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
         function  push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;override;
         function  get_volatile_registers_int(calloption : tproccalloption):TCpuRegisterSet;override;
         function  get_volatile_registers_fpu(calloption : tproccalloption):TCpuRegisterSet;override;
@@ -108,12 +107,6 @@ implementation
       end;
 
 
-    function tsparcparamanager.copy_value_on_stack(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
-      begin
-        result:=false;
-      end;
-
-
     { true if a parameter is too large to copy and only the address is pushed }
     function tsparcparamanager.push_addr_param(varspez:tvarspez;def : tdef;calloption : tproccalloption) : boolean;
       begin
@@ -329,7 +322,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.53  2005-01-10 21:50:05  jonas
+  Revision 1.54  2005-01-20 17:47:01  peter
+    * remove copy_value_on_stack and a_param_copy_ref
+
+  Revision 1.53  2005/01/10 21:50:05  jonas
     + support for passing records in registers under darwin
     * tcgpara now also has an intsize field, which contains the size in
       bytes of the whole parameter