Преглед на файлове

* moved generic code from n386cal to ncgcal, i386 now also
uses the generic ncgcal

peter преди 22 години
родител
ревизия
6a16389f67
променени са 5 файла, в които са добавени 507 реда и са изтрити 1580 реда
  1. 82 1079
      compiler/i386/n386cal.pas
  2. 13 1
      compiler/ncal.pas
  3. 398 494
      compiler/ncgcal.pas
  4. 7 3
      compiler/powerpc/nppccal.pas
  5. 7 3
      compiler/sparc/ncpucall.pas

+ 82 - 1079
compiler/i386/n386cal.pas

@@ -29,27 +29,23 @@ interface
 { $define AnsiStrRef}
 
     uses
-      globtype,
-      symdef,
-      node,ncal,ncgcal;
+      ncgcal;
 
     type
-       ti386callparanode = class(tcallparanode)
-          procedure secondcallparan(push_from_left_to_right:boolean;calloption:tproccalloption;
-                para_alignment,para_offset : longint);override;
-       end;
-
        ti386callnode = class(tcgcallnode)
-          procedure pass_2;override;
+       protected
+          function  align_parasize(parasize,para_alignment:longint):longint;override;
+          procedure pop_parasize(pop_size:longint);override;
+          procedure extra_interrupt_code;override;
        end;
 
 
 implementation
 
     uses
-      systems,
+      globtype,systems,
       cutils,verbose,globals,
-      symconst,symbase,symsym,symtable,defutil,
+      symconst,symbase,symdef,symsym,symtable,defutil,
 {$ifdef GDB}
   {$ifdef delphi}
       sysutils,
@@ -61,457 +57,59 @@ implementation
       cginfo,cgbase,pass_2,
       cpubase,paramgr,
       aasmbase,aasmtai,aasmcpu,
-      nbas,nmem,nld,ncnv,
+      node,ncal,nbas,nmem,nld,ncnv,
       ncgutil,cga,cgobj,tgobj,regvars,rgobj,rgcpu,cg64f32,cgcpu,cpuinfo;
 
+
 {*****************************************************************************
-                             TI386CALLPARANODE
+                             TI386CALLNODE
 *****************************************************************************}
 
-    procedure ti386callparanode.secondcallparan(push_from_left_to_right:boolean;calloption:tproccalloption;para_alignment,para_offset : longint);
-
-      procedure maybe_push_high;
-        begin
-           { open array ? }
-           { paraitem.data can be nil for read/write }
-           if assigned(paraitem.paratype.def) and
-              assigned(hightree) then
-            begin
-              secondpass(hightree);
-              { this is a longint anyway ! }
-              push_value_para(exprasmlist,hightree,calloption,para_offset,4,paralocdummy);
-            end;
-        end;
 
+    procedure ti386callnode.extra_interrupt_code;
       var
-         otlabel,oflabel : tasmlabel;
-         { temporary variables: }
-         tempdeftype : tdeftype;
-         tmpreg : tregister;
-         href   : treference;
-
+        r : Tregister;
       begin
-         { set default para_alignment to target_info.stackalignment }
-         if para_alignment=0 then
-          para_alignment:=aktalignment.paraalign;
-
-         { push from left to right if specified }
-         if push_from_left_to_right and assigned(right) then
-          begin
-            if (nf_varargs_para in flags) then
-              tcallparanode(right).secondcallparan(push_from_left_to_right,
-                                                   calloption,para_alignment,para_offset)
-            else
-              tcallparanode(right).secondcallparan(push_from_left_to_right,
-                                                   calloption,para_alignment,para_offset);
-          end;
-
-         otlabel:=truelabel;
-         oflabel:=falselabel;
-         objectlibrary.getlabel(truelabel);
-         objectlibrary.getlabel(falselabel);
-         secondpass(left);
-         { handle varargs first, because paraitem is not valid }
-         if (nf_varargs_para in flags) then
-           begin
-             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(exprasmlist,left,calloption,para_offset,para_alignment,paralocdummy);
-           end
-         { filter array constructor with c styled args }
-         else if is_array_of_const(left.resulttype.def) and (nf_cargs in left.flags) then
-           begin
-             { nothing, everything is already pushed }
-           end
-         { in codegen.handleread.. paraitem.data is set to nil }
-         else if assigned(paraitem.paratype.def) and
-                 (paraitem.paratype.def.deftype=formaldef) then
-           begin
-              { allow passing of a constant to a const formaldef }
-              if (paraitem.paratyp=vs_const) and
-                 (left.location.loc=LOC_CONSTANT) then
-                location_force_mem(exprasmlist,left.location);
-
-              { allow @var }
-              inc(pushedparasize,4);
-              if (left.nodetype=addrn) and
-                 (not(nf_procvarload in left.flags)) then
-                begin
-                  if calloption=pocall_inline then
-                    begin
-                       reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
-                       cg.a_load_loc_ref(exprasmlist,left.location,href);
-                    end
-                  else
-                    cg.a_param_loc(exprasmlist,left.location,paralocdummy);
-                  location_release(exprasmlist,left.location);
-                end
-              else
-                begin
-                   if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
-                     CGMessage(type_e_mismatch)
-                   else
-                     begin
-                       if calloption=pocall_inline then
-                         begin
-                           tmpreg:=cg.get_scratch_reg_address(exprasmlist);
-                           cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,tmpreg);
-                           reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
-                           cg.a_load_reg_ref(exprasmlist,OS_ADDR,tmpreg,href);
-                           cg.free_scratch_reg(exprasmlist,tmpreg);
-                         end
-                       else
-                         cg.a_paramaddr_ref(exprasmlist,left.location.reference,paralocdummy);
-                       location_release(exprasmlist,left.location);
-                     end;
-                end;
-           end
-         { handle call by reference parameter }
-         else if (paraitem.paratyp in [vs_var,vs_out]) then
-           begin
-              if (left.location.loc<>LOC_REFERENCE) then
-               begin
-                 { passing self to a var parameter is allowed in
-                   TP and delphi }
-                 if not((left.location.loc=LOC_CREFERENCE) and
-                        (left.nodetype=selfn)) then
-                  internalerror(200106041);
-               end;
-{$ifdef unused}
-              if not push_from_left_to_right then
-{$endif unused}
-                maybe_push_high;
-              if (paraitem.paratyp=vs_out) and
-                 assigned(paraitem.paratype.def) and
-                 not is_class(paraitem.paratype.def) and
-                 paraitem.paratype.def.needs_inittable then
-                cg.g_finalize(exprasmlist,paraitem.paratype.def,left.location.reference,false);
-              inc(pushedparasize,4);
-              if calloption=pocall_inline then
-                begin
-                   tmpreg:=cg.get_scratch_reg_address(exprasmlist);
-                   cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,tmpreg);
-                   reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
-                   cg.a_load_reg_ref(exprasmlist,OS_ADDR,tmpreg,href);
-                   cg.free_scratch_reg(exprasmlist,tmpreg);
-                end
-              else
-                cg.a_paramaddr_ref(exprasmlist,left.location.reference,paralocdummy);
-              location_release(exprasmlist,left.location);
-{$ifdef unused}
-              if push_from_left_to_right then
-                maybe_push_high;
-{$endif unused}
-           end
-         else
-           begin
-              tempdeftype:=resulttype.def.deftype;
-              if tempdeftype=filedef then
-               CGMessage(cg_e_file_must_call_by_reference);
-              { open array must always push the address, this is needed to
-                also push addr of small open arrays and with cdecl functions (PFV) }
-              if (
-                  assigned(paraitem.paratype.def) and
-                  (is_open_array(paraitem.paratype.def) or
-                   is_array_of_const(paraitem.paratype.def))
-                 ) or
-                 (
-                  paramanager.push_addr_param(resulttype.def,calloption)
-                 ) then
-                begin
-                   if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
-                    begin
-                      { allow passing nil to a procvardef (methodpointer) }
-                      if (left.nodetype=typeconvn) and
-                         (left.resulttype.def.deftype=procvardef) and
-                         (ttypeconvnode(left).left.nodetype=niln) then
-                       begin
-                         tg.GetTemp(exprasmlist,tcgsize2size[left.location.size],tt_normal,href);
-                         cg.a_load_loc_ref(exprasmlist,left.location,href);
-                         location_reset(left.location,LOC_REFERENCE,left.location.size);
-                         left.location.reference:=href;
-                       end
-                      else
-                       internalerror(200204011);
-                    end;
-
-{$ifdef unused}
-                   if not push_from_left_to_right then
-{$endif unused}
-                     maybe_push_high;
-                   inc(pushedparasize,4);
-                   if calloption=pocall_inline then
-                     begin
-                        tmpreg:=cg.get_scratch_reg_address(exprasmlist);
-                        cg.a_loadaddr_ref_reg(exprasmlist,left.location.reference,tmpreg);
-                        reference_reset_base(href,procinfo.framepointer,para_offset-pushedparasize);
-                        cg.a_load_reg_ref(exprasmlist,OS_ADDR,tmpreg,href);
-                        cg.free_scratch_reg(exprasmlist,tmpreg);
-                     end
-                   else
-                     cg.a_paramaddr_ref(exprasmlist,left.location.reference,paralocdummy);
-                   location_release(exprasmlist,left.location);
-{$ifdef unused}
-                   if push_from_left_to_right then
-                     maybe_push_high;
-{$endif unused}
-                end
-              else
-                begin
-                   push_value_para(exprasmlist,left,calloption,
-                     para_offset,para_alignment,paralocdummy);
-                end;
-           end;
-         truelabel:=otlabel;
-         falselabel:=oflabel;
-         { push from right to left }
-         if not push_from_left_to_right and assigned(right) then
-          begin
-            if (nf_varargs_para in flags) then
-              tcallparanode(right).secondcallparan(push_from_left_to_right,
-                                                   calloption,para_alignment,para_offset)
-            else
-              tcallparanode(right).secondcallparan(push_from_left_to_right,
-                                                   calloption,para_alignment,para_offset);
-          end;
+        emit_none(A_PUSHF,S_L);
+        r.enum:=R_CS;
+        emit_reg(A_PUSH,S_L,r);
       end;
 
 
-{*****************************************************************************
-                             TI386CALLNODE
-*****************************************************************************}
-
-    procedure ti386callnode.pass_2;
+    function ti386callnode.align_parasize(parasize,para_alignment:longint):longint;
       var
-         regs_to_push_int : Tsupregset;
-         regs_to_push_other : tregisterset;
-         unusedstate: pointer;
-         pushed : tpushedsaved;
-         pushed_int : tpushedsavedint;
-         hregister : tregister;
-         oldpushedparasize : longint;
-         { true if a virtual method must be called directly }
-         no_virtual_call : boolean;
-         { true if we produce a con- or destrutor in a call }
-         is_con_or_destructor : boolean;
-         { true if a constructor is called again }
-         extended_new : boolean;
-         { adress returned from an I/O-error }
-         iolabel : tasmlabel;
-         { lexlevel count }
-         i : longint;
-         { help reference pointer }
-         href : treference;
-         hp : tnode;
-         pp : tbinarynode;
-         params : tnode;
-         inlined : boolean;
-         inlinecode : tprocinlinenode;
-         store_parast_fixup,
-         para_alignment,
-         para_offset : longint;
-         { instruction for alignement correction }
-{        corr : paicpu;}
-         { we must pop this size also after !! }
-{        must_pop : boolean; }
          pop_size : longint;
 {$ifdef OPTALIGN}
          pop_esp : boolean;
          push_size : longint;
 {$endif OPTALIGN}
-         pop_allowed : boolean;
-         returnref,
-         pararef : treference;
-         r,rsp : Tregister;
-         vmtloc,selfloc : tlocation;
-         self_is_vmt,
-         vmtrefaddr,
-         selfrefaddr : boolean;
-
-      label
-         dont_call;
-
-         procedure selfloc_to_register;
-         var
-           hregister : tregister;
-         begin
-           case selfloc.loc of
-             LOC_REGISTER :
-               hregister:=selfloc.register;
-             LOC_CREFERENCE,
-             LOC_REFERENCE :
-               begin
-                 hregister:=rg.getaddressregister(exprasmlist);
-                 if selfrefaddr then
-                   begin
-                     cg.a_loadaddr_ref_reg(exprasmlist,selfloc.reference,hregister);
-                     selfrefaddr:=false;
-                   end
-                 else
-                   cg.a_load_ref_reg(exprasmlist,OS_ADDR,selfloc.reference,hregister);
-                 reference_release(exprasmlist,selfloc.reference);
-               end;
-             else
-               internalerror(200303269);
-           end;
-           location_reset(selfloc,LOC_REGISTER,OS_ADDR);
-           selfloc.register:=hregister;
-         end;
-
+         i : integer;
+         rsp : tregister;
       begin
-         rsp.enum:=R_INTREGISTER;
-         rsp.number:=NR_ESP;
-         extended_new:=false;
-         iolabel:=nil;
-         inlinecode:=nil;
-         inlined:=false;
-         no_virtual_call:=false;
-         rg.saveunusedstate(unusedstate);
-
-         { if we allocate the temp. location for ansi- or widestrings }
-         { already here, we avoid later a push/pop                    }
-         if is_widestring(resulttype.def) then
-           begin
-             tg.GetTemp(exprasmlist,pointer_size,tt_widestring,refcountedtemp);
-             cg.g_decrrefcount(exprasmlist,resulttype.def,refcountedtemp);
-           end
-         else if is_ansistring(resulttype.def) then
-           begin
-             tg.GetTemp(exprasmlist,pointer_size,tt_ansistring,refcountedtemp);
-             cg.g_decrrefcount(exprasmlist,resulttype.def,refcountedtemp);
-           end;
-
-         if (procdefinition.proccalloption in [pocall_cdecl,pocall_cppdecl,pocall_stdcall]) then
-          para_alignment:=4
-         else
-          para_alignment:=aktalignment.paraalign;
-
-         if not assigned(procdefinition) then
-          exit;
-
-         { Deciding whether we may still need the parameters happens next (JM) }
-         if assigned(left) then
-           params:=left.getcopy
-         else
-           params := nil;
-
-         if (procdefinition.proccalloption=pocall_inline) then
-           begin
-              inlined:=true;
-              inlinecode:=tprocinlinenode(right);
-              right:=nil;
-              { set it to the same lexical level as the local symtable, becuase
-                the para's are stored there }
-              tprocdef(procdefinition).parast.symtablelevel:=aktprocdef.localst.symtablelevel;
-              if assigned(params) then
-               begin
-                 inlinecode.para_size:=tprocdef(procdefinition).para_size(para_alignment);
-                 tg.GetTemp(exprasmlist,inlinecode.para_size,tt_persistant,pararef);
-                 inlinecode.para_offset:=pararef.offset;
-               end;
-              store_parast_fixup:=tprocdef(procdefinition).parast.address_fixup;
-              tprocdef(procdefinition).parast.address_fixup:=inlinecode.para_offset;
-{$ifdef extdebug}
-             Comment(V_debug,
-               'inlined parasymtable is at offset '
-               +tostr(tprocdef(procdefinition).parast.address_fixup));
-             exprasmList.concat(tai_comment.Create(
-               strpnew('inlined parasymtable is at offset '
-               +tostr(tprocdef(procdefinition).parast.address_fixup))));
-{$endif extdebug}
-           end;
-         { only if no proc var }
-         if inlined or
-            not(assigned(right)) then
-           is_con_or_destructor:=(procdefinition.proctypeoption in [potype_constructor,potype_destructor]);
-         { proc variables destroy all registers }
-         if (inlined or
-            (right=nil)) and
-            { virtual methods too }
-            not(po_virtualmethod in procdefinition.procoptions) then
-           begin
-              if (cs_check_io in aktlocalswitches) and
-                 (po_iocheck in procdefinition.procoptions) and
-                 not(po_iocheck in aktprocdef.procoptions) then
-                begin
-                   objectlibrary.getaddrlabel(iolabel);
-                   cg.a_label(exprasmlist,iolabel);
-                end
-              else
-                iolabel:=nil;
-
-              { save all used registers and possible registers
-                used for the return value }
-              regs_to_push_int := tprocdef(procdefinition).usedintregisters;
-              regs_to_push_other := tprocdef(procdefinition).usedotherregisters;
-              if (not is_void(resulttype.def)) and
-                 (not paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption)) then
-               begin
-                 include(regs_to_push_int,RS_ACCUMULATOR);
-                 if resulttype.def.size>sizeof(aword) then
-                   include(regs_to_push_int,RS_ACCUMULATORHIGH);
-               end;
-              rg.saveusedintregisters(exprasmlist,pushed_int,regs_to_push_int);
-              rg.saveusedotherregisters(exprasmlist,pushed,regs_to_push_other);
-
-              { give used registers through }
-              rg.usedintinproc:=rg.usedintinproc + tprocdef(procdefinition).usedintregisters;
-              rg.usedinproc:=rg.usedinproc + tprocdef(procdefinition).usedotherregisters;
-           end
-         else
-           begin
-              regs_to_push_int := all_intregisters;
-              regs_to_push_other:=all_registers;
-              rg.saveusedintregisters(exprasmlist,pushed_int,regs_to_push_int);
-              rg.saveusedotherregisters(exprasmlist,pushed,regs_to_push_other);
-              rg.usedintinproc:=all_intregisters;
-              rg.usedinproc:=all_registers;
-              { no IO check for methods and procedure variables }
-              iolabel:=nil;
-           end;
-
-         { generate the code for the parameter and push them }
-         oldpushedparasize:=pushedparasize;
-         pushedparasize:=0;
-         pop_size:=0;
-         { no inc esp for inlined procedure
-           and for objects constructors PM }
-         if inlined or
-            ((procdefinition.proctypeoption=potype_constructor) and
-            { quick'n'dirty check if it is a class or an object }
-             (resulttype.def.deftype=orddef)) then
-           pop_allowed:=false
-         else
-           pop_allowed:=true;
-         if pop_allowed then
-          begin
-          { Old pushedsize aligned on 4 ? }
-            i:=oldpushedparasize and 3;
-            if i>0 then
-             inc(pop_size,4-i);
-          { This parasize aligned on 4 ? }
-            i:=procdefinition.para_size(para_alignment) and 3;
-            if i>0 then
-             inc(pop_size,4-i);
-          { insert the opcode and update pushedparasize }
-          { never push 4 or more !! }
-            pop_size:=pop_size mod 4;
-            if pop_size>0 then
-             begin
-               inc(pushedparasize,pop_size);
-               emit_const_reg(A_SUB,S_L,pop_size,rsp);
+        pop_size:=0;
+        { Old pushedsize aligned on 4 ? }
+        i:=parasize and 3;
+        if i>0 then
+         inc(pop_size,4-i);
+        { This parasize aligned on 4 ? }
+        i:=procdefinition.para_size(para_alignment) and 3;
+        if i>0 then
+         inc(pop_size,4-i);
+        { insert the opcode and update pushedparasize }
+        { never push 4 or more !! }
+        pop_size:=pop_size mod 4;
+        if pop_size>0 then
+         begin
+           inc(pushedparasize,pop_size);
+           rsp.enum:=R_INTREGISTER;
+           rsp.number:=NR_ESP;
+           exprasmlist.concat(taicpu.op_const_reg(A_SUB,S_L,pop_size,rsp));
 {$ifdef GDB}
-               if (cs_debuginfo in aktmoduleswitches) and
-                  (exprasmList.first=exprasmList.last) then
-                 exprasmList.concat(Tai_force_line.Create);
+           if (cs_debuginfo in aktmoduleswitches) and
+              (exprasmList.first=exprasmList.last) then
+             exprasmList.concat(Tai_force_line.Create);
 {$endif GDB}
-             end;
-          end;
+         end;
 {$ifdef OPTALIGN}
          if pop_allowed and (cs_align in aktglobalswitches) then
            begin
@@ -537,656 +135,61 @@ implementation
          else
            pop_esp:=false;
 {$endif OPTALIGN}
+        align_parasize:=pop_size;
+      end;
 
-         { Push parameters }
-         if assigned(params) then
-           begin
-              { be found elsewhere }
-              if inlined then
-                para_offset:=tprocdef(procdefinition).parast.address_fixup+
-                  tprocdef(procdefinition).parast.datasize
-              else
-                para_offset:=0;
-              if not(inlined) and
-                 assigned(right) then
-                tcallparanode(params).secondcallparan(
-                { TParaItem(tabstractprocdef(right.resulttype.def).Para.first), }
-                  (po_leftright in procdefinition.procoptions),procdefinition.proccalloption,
-                  para_alignment,para_offset)
-              else
-                tcallparanode(params).secondcallparan(
-                  { TParaItem(procdefinition.Para.first), }
-                  (po_leftright in procdefinition.procoptions),procdefinition.proccalloption,
-                  para_alignment,para_offset);
-           end;
 
-         { Allocate return value for inlined routines }
-         if inlined and
-            (resulttype.def.size>0) then
+    procedure ti386callnode.pop_parasize(pop_size:longint);
+      var
+        hreg : tregister;
+      begin
+        { better than an add on all processors }
+        if pop_size=4 then
           begin
-            tg.GetTemp(exprasmlist,Align(resulttype.def.size,aktalignment.paraalign),tt_persistant,returnref);
-            inlinecode.retoffset:=returnref.offset;
-          end;
-
-         { Allocate return value when returned in argument }
-         if paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
-           begin
-             if assigned(funcretrefnode) then
-              begin
-                secondpass(funcretrefnode);
-                if codegenerror then
-                 exit;
-                if (funcretrefnode.location.loc<>LOC_REFERENCE) then
-                 internalerror(200204246);
-                funcretref:=funcretrefnode.location.reference;
-              end
-             else
-              begin
-                if inlined then
-                 begin
-                   tg.GetTemp(exprasmlist,resulttype.def.size,tt_persistant,funcretref);
-{$ifdef extdebug}
-                   Comment(V_debug,'function return value is at offset '
-                                   +tostr(funcretref.offset));
-                   exprasmlist.concat(tai_comment.create(
-                                       strpnew('function return value is at offset '
-                                               +tostr(funcretref.offset))));
-{$endif extdebug}
-                 end
-                else
-                 tg.GetTemp(exprasmlist,resulttype.def.size,tt_normal,funcretref);
-              end;
-
-             { This must not be counted for C code
-               complex return address is removed from stack
-               by function itself !   }
-{$ifdef OLD_C_STACK}
-             inc(pushedparasize,4); { lets try without it PM }
-{$endif not OLD_C_STACK}
-             if inlined then
-               begin
-                  hregister:=cg.get_scratch_reg_address(exprasmlist);
-                  cg.a_loadaddr_ref_reg(exprasmlist,funcretref,hregister);
-                  reference_reset_base(href,procinfo.framepointer,inlinecode.retoffset);
-                  cg.a_load_reg_ref(exprasmlist,OS_ADDR,hregister,href);
-                  cg.free_scratch_reg(exprasmlist,hregister);
-               end
-             else
-               cg.a_paramaddr_ref(exprasmlist,funcretref,paralocdummy);
-           end;
-
-         { procedure variable or normal function call ? }
-         if inlined or
-            (right=nil) then
-           begin
-              { Normal function call }
-              location_reset(vmtloc,LOC_CONSTANT,OS_ADDR);
-              location_reset(selfloc,LOC_CONSTANT,OS_ADDR);
-              vmtrefaddr:=false;
-              selfrefaddr:=false;
-              self_is_vmt:=false;
-
-              { push self }
-              if assigned(symtableproc) and
-                 ((symtableproc.symtabletype in [objectsymtable,withsymtable])) then
-                begin
-                   { generate fake methodpointer node for withsymtable }
-                   if (symtableproc.symtabletype=withsymtable) then
-                    begin
-                      methodpointer:=cnothingnode.create;
-                      methodpointer.resulttype:=twithnode(twithsymtable(symtableproc).withnode).left.resulttype;
-                    end;
-
-                   if assigned(methodpointer) then
-                     begin
-                       case methodpointer.nodetype of
-                         typen:
-                           begin
-                              { direct call to inherited method }
-                              if (po_abstractmethod in procdefinition.procoptions) then
-                                begin
-                                   CGMessage(cg_e_cant_call_abstract_method);
-                                   goto dont_call;
-                                end;
-
-                              { generate no virtual call }
-                              no_virtual_call:=true;
-
-                              if (sp_static in symtableprocentry.symoptions) then
-                                begin
-                                   self_is_vmt:=true;
-                                   if (oo_has_vmt in tobjectdef(methodpointer.resulttype.def).objectoptions) then
-                                     begin
-                                       location_reset(vmtloc,LOC_REFERENCE,OS_NO);
-                                       reference_reset_symbol(vmtloc.reference,objectlibrary.newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
-                                       vmtrefaddr:=true;
-                                     end;
-                                end
-                              else
-                                begin
-                                  { member call, load self }
-                                  location_reset(selfloc,LOC_REGISTER,OS_ADDR);
-                                  selfloc.register:=cg.g_load_self(exprasmlist);
-                                end;
-
-                              if is_con_or_destructor then
-                               begin
-                                 if is_object(methodpointer.resulttype.def) then
-                                  begin
-                                    { object }
-                                    { if an inherited con- or destructor should be  }
-                                    { called in a con- or destructor then a warning }
-                                    { will be made                                  }
-                                    { con- and destructors need a pointer to the vmt }
-                                    if not(aktprocdef.proctypeoption in
-                                           [potype_constructor,potype_destructor]) then
-                                      CGMessage(cg_w_member_cd_call_from_method);
-
-                                    { reset self when calling constructor from destructor }
-                                    if (procdefinition.proctypeoption=potype_constructor) and
-                                       assigned(aktprocdef) and
-                                       (aktprocdef.proctypeoption=potype_destructor) then
-                                     begin
-                                       location_release(exprasmlist,selfloc);
-                                       location_reset(selfloc,LOC_CONSTANT,OS_ADDR);
-                                     end;
-                                  end;
-                               end;
-                           end;
-                         hnewn:
-                           begin
-                              { constructor with extended syntax called from new }
-                              { vmt }
-                              location_reset(vmtloc,LOC_REFERENCE,OS_ADDR);
-                              reference_reset_symbol(vmtloc.reference,objectlibrary.newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
-                              vmtrefaddr:=true;
-                              extended_new:=true;
-                           end;
-                         hdisposen:
-                           begin
-                              { destructor with extended syntax called from dispose }
-                              { hdisposen always deliver LOC_REFERENCE }
-                              secondpass(methodpointer);
-                              { vmt }
-                              location_reset(vmtloc,LOC_REFERENCE,OS_ADDR);
-                              reference_reset_symbol(vmtloc.reference,objectlibrary.newasmsymbol(tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
-                              vmtrefaddr:=true;
-                              { self, load in register first when it requires a virtual call }
-                              location_reset(selfloc,LOC_REFERENCE,OS_ADDR);
-                              selfloc.reference:=methodpointer.location.reference;
-                              selfrefaddr:=true;
-                           end;
-                         else
-                           begin
-                              { call to an instance member }
-                              if (symtableproc.symtabletype<>withsymtable) then
-                                begin
-                                   secondpass(methodpointer);
-                                   case methodpointer.location.loc of
-                                      LOC_CREGISTER,
-                                      LOC_REGISTER:
-                                        begin
-                                          location_reset(selfloc,LOC_REGISTER,OS_ADDR);
-                                          selfloc.register:=methodpointer.location.register;
-                                        end;
-                                      LOC_CREFERENCE,
-                                      LOC_REFERENCE :
-                                        begin
-                                          location_reset(selfloc,LOC_REFERENCE,OS_ADDR);
-                                          selfloc.reference:=methodpointer.location.reference;
-                                          if (methodpointer.resulttype.def.deftype<>classrefdef) and
-                                             not(is_class_or_interface(methodpointer.resulttype.def)) then
-                                            selfrefaddr:=true;
-                                        end;
-                                      else
-                                        internalerror(200303212);
-                                   end;
-                                end
-                              else
-                                begin
-                                  location_reset(selfloc,LOC_REFERENCE,OS_ADDR);
-                                  selfloc.reference:=twithnode(twithsymtable(symtableproc).withnode).withreference;
-                                  if (nf_islocal in twithnode(twithsymtable(symtableproc).withnode).flags) and
-                                     (twithsymtable(symtableproc).direct_with) and
-                                     not(is_class_or_interface(twithnode(twithsymtable(symtableproc).withnode).left.resulttype.def)) then
-                                    selfrefaddr:=true;
-                                end;
-
-                              if (po_staticmethod in procdefinition.procoptions) or
-                                 (po_classmethod in procdefinition.procoptions) then
-                                begin
-                                  self_is_vmt:=true;
-                                  { classref are already loaded with VMT }
-                                  if (methodpointer.resulttype.def.deftype=classrefdef) then
-                                   location_copy(vmtloc,selfloc)
-                                  else
-                                   begin
-                                     if (oo_has_vmt in tprocdef(procdefinition)._class.objectoptions) then
-                                       begin
-                                         { load VMT from passed self }
-                                         selfloc_to_register;
-                                         cg.g_maybe_testself(exprasmlist,selfloc.register);
-                                         location_copy(vmtloc,selfloc);
-                                         reference_reset_base(href,vmtloc.register,tprocdef(procdefinition)._class.vmt_offset);
-                                         cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,vmtloc.register);
-                                       end;
-                                   end;
-                                  { reset self }
-                                  location_reset(selfloc,LOC_CONSTANT,OS_ADDR);
-                                end;
-
-                              if is_con_or_destructor then
-                               begin
-                                 { constructor call via classreference => allocate memory }
-                                 if (methodpointer.resulttype.def.deftype=classrefdef) then
-                                   begin
-                                     if (procdefinition.proctypeoption=potype_constructor) and
-                                        is_class(tclassrefdef(methodpointer.resulttype.def).pointertype.def) then
-                                      begin
-                                        self_is_vmt:=true;
-                                        { vmt load from provided methodpointer that
-                                          was already loaded in selfloc }
-                                        location_copy(vmtloc,selfloc);
-                                        { reset self }
-                                        location_reset(selfloc,LOC_CONSTANT,OS_ADDR);
-                                      end;
-                                  end
-                                 else
-                                 { class }
-                                  if is_class(methodpointer.resulttype.def) then
-                                   begin
-                                     { destructor: release instance, flag(vmt)=1
-                                       constructor: direct call, do nothing, leave vmt=0 }
-                                     if (procdefinition.proctypeoption=potype_destructor) then
-                                      begin
-                                        { flag 1 for destructor: remove data }
-                                        location_reset(vmtloc,LOC_CONSTANT,OS_ADDR);
-                                        vmtloc.value:=1;
-                                      end;
-                                   end
-                                 else
-                                 { object }
-                                  begin
-                                    { destructor: direct call, no dispose, vmt=0
-                                      constructor: initialize object, load vmt }
-                                    if (procdefinition.proctypeoption=potype_constructor) then
-                                     begin
-                                       { vmt }
-                                       location_reset(vmtloc,LOC_REFERENCE,OS_ADDR);
-                                       reference_reset_symbol(vmtloc.reference,objectlibrary.newasmsymbol(
-                                          tobjectdef(methodpointer.resulttype.def).vmt_mangledname),0);
-                                       vmtrefaddr:=true;
-                                     end;
-                                  end;
-                               end;
-                           end;
-                       end;
-                     end
-                   else
-                     { No methodpointer }
-                     begin
-                        if (po_staticmethod in procdefinition.procoptions) or
-                           (po_classmethod in procdefinition.procoptions) then
-                         begin
-                           self_is_vmt:=true;
-                           { Load VMT from self? }
-                           if (
-                               (po_classmethod in procdefinition.procoptions) and
-                               not(assigned(aktprocdef) and
-                                   (po_classmethod in aktprocdef.procoptions))
-                              ) or
-                              (
-                               (po_staticmethod in procdefinition.procoptions) and
-                                not(assigned(aktprocdef) and
-                                    (po_staticmethod in aktprocdef.procoptions))
-                              ) then
-                             begin
-                               if (oo_has_vmt in tprocdef(procdefinition)._class.objectoptions) then
-                                begin
-                                  { load vmt from self passed to the current method }
-                                  location_reset(vmtloc,LOC_REGISTER,OS_ADDR);
-                                  vmtloc.register:=cg.g_load_self(exprasmlist);
-                                  cg.g_maybe_testself(exprasmlist,vmtloc.register);
-                                  reference_reset_base(href,vmtloc.register,tprocdef(procdefinition)._class.vmt_offset);
-                                  cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,vmtloc.register);
-                                end;
-                             end
-                            else
-                             begin
-                               { self is already VMT }
-                               location_reset(vmtloc,LOC_REGISTER,OS_ADDR);
-                               vmtloc.register:=cg.g_load_self(exprasmlist);
-                             end;
-                          end
-                        else
-                          begin
-                             { member call, load self }
-                             location_reset(selfloc,LOC_REGISTER,OS_ADDR);
-                             selfloc.register:=cg.g_load_self(exprasmlist);
-                          end;
-                     end;
-
-                   { Do we need to push the VMT as self for
-                     class methods and static methods? }
-                   if self_is_vmt then
-                     begin
-                       location_release(exprasmlist,selfloc);
-                       location_copy(selfloc,vmtloc);
-                     end;
-
-                   { already load self into register when we know that
-                     we need to call a virtual method }
-                   if (po_virtualmethod in procdefinition.procoptions) and
-                      not(no_virtual_call) then
-                     selfloc_to_register;
-
-                   { constructor/destructor need vmt }
-                   if is_con_or_destructor then
-                    begin
-                      if vmtrefaddr then
-                        cg.a_paramaddr_ref(exprasmlist,vmtloc.reference,paramanager.getintparaloc(2))
-                      else
-                        cg.a_param_loc(exprasmlist,vmtloc,paramanager.getintparaloc(2));
-                    end;
-                   if not self_is_vmt then
-                     location_release(exprasmlist,vmtloc);
-
-                   { push self }
-                   if selfrefaddr then
-                     cg.a_paramaddr_ref(exprasmlist,selfloc.reference,paramanager.getintparaloc(1))
-                   else
-                     cg.a_param_loc(exprasmlist,selfloc,paramanager.getintparaloc(1));
-                end;
-
-              { push base pointer ?}
-              { never when inlining, since if necessary, the base pointer }
-              { can/will be gottten from the current procedure's symtable }
-              { (JM)                                                      }
-              if not inlined then
-                begin
-                  if (lexlevel>=normal_function_level) and assigned(tprocdef(procdefinition).parast) and
-                    ((tprocdef(procdefinition).parast.symtablelevel)>normal_function_level) then
-                    begin
-                       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,paramanager.getintparaloc(1));
-                         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,paramanager.getintparaloc(1));
-                         end
-                       else if (lexlevel>(tprocdef(procdefinition).parast.symtablelevel)) then
-                         begin
-                            hregister:=rg.getregisterint(exprasmlist,OS_ADDR);
-                            reference_reset_base(href,procinfo.framepointer,procinfo.framepointer_offset);
-                            cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,hregister);
-                            for i:=(tprocdef(procdefinition).parast.symtablelevel) to lexlevel-1 do
-                              begin
-                                 {we should get the correct frame_pointer_offset at each level
-                                 how can we do this !!! }
-                                 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,paramanager.getintparaloc(1));
-                            rg.ungetregisterint(exprasmlist,hregister);
-                         end
-                       else
-                         internalerror(25000);
-                    end;
-                end;
-
-              rg.saveintregvars(exprasmlist,regs_to_push_int);
-
-              if (po_virtualmethod in procdefinition.procoptions) and
-                 not(no_virtual_call) then
-                begin
-                   { virtual methods require an index }
-                   if tprocdef(procdefinition).extnumber=-1 then
-                     internalerror(44584);
-
-                   { self should already be loaded in a register }
-                   if selfloc.register.number=NR_NO then
-                     internalerror(2003032611);
-
-                   { load vmt from self, this is already done
-                     for static/class methods }
-                   if not self_is_vmt then
-                    begin
-                      cg.g_maybe_testself(exprasmlist,selfloc.register);
-                      { this is one point where we need vmt_offset (PM) }
-                      reference_reset_base(href,selfloc.register,tprocdef(procdefinition)._class.vmt_offset);
-                      cg.a_load_ref_reg(exprasmlist,OS_ADDR,href,selfloc.register);
-                    end;
-
-                   { test validity of VMT }
-                   if not(is_interface(tprocdef(procdefinition)._class)) and
-                      not(is_cppclass(tprocdef(procdefinition)._class)) then
-                     cg.g_maybe_testvmt(exprasmlist,selfloc.register,tprocdef(procdefinition)._class);
-
-                   { call method }
-                   reference_reset_base(href,selfloc.register,
-                      tprocdef(procdefinition)._class.vmtmethodoffset(tprocdef(procdefinition).extnumber));
-                   cg.a_call_ref(exprasmlist,href);
-
-                   { release self }
-                   location_release(exprasmlist,selfloc);
-                end
-              else
-                begin
-                  { self is not needed }
-                  location_release(exprasmlist,selfloc);
-
-                  if not inlined then
-                   begin
-                     { We can call interrupts from within the smae code
-                       by just pushing the flags and CS PM }
-                     if (po_interrupt in procdefinition.procoptions) then
-                       begin
-                           emit_none(A_PUSHF,S_L);
-                           r.enum:=R_INTREGISTER;
-                           r.number:=NR_CS;
-                           emit_reg(A_PUSH,S_L,r);
-                       end;
-                     cg.a_call_name(exprasmlist,tprocdef(procdefinition).mangledname);
-                   end
-                  else { inlined proc }
-                   begin
-                     { process the inlinecode }
-                     secondpass(tnode(inlinecode));
-                     { free the args }
-                     if tprocdef(procdefinition).parast.datasize>0 then
-                       tg.UnGetTemp(exprasmlist,pararef);
-                   end;
-               end;
-           end
-         else
-           { now procedure variable case }
-           begin
-              secondpass(right);
-              if (po_interrupt in procdefinition.procoptions) then
-                begin
-                    emit_none(A_PUSHF,S_L);
-                    r.enum:=R_INTREGISTER;
-                    r.number:=NR_CS;
-                    emit_reg(A_PUSH,S_L,r);
-                end;
-              { procedure of object? }
-              if (po_methodpointer in procdefinition.procoptions) then
-                begin
-                   { push self, but not if it's already explicitly pushed }
-                   if not(po_containsself in procdefinition.procoptions) then
-                     begin
-                       { push self }
-                       href:=right.location.reference;
-                       inc(href.offset,POINTER_SIZE);
-                       cg.a_param_ref(exprasmlist,OS_ADDR,href,paramanager.getintparaloc(1));
-                     end;
-
-                   rg.saveintregvars(exprasmlist,ALL_INTREGISTERS);
-                   rg.saveotherregvars(exprasmlist,ALL_REGISTERS);
-                   cg.a_call_ref(exprasmlist,right.location.reference);
-
-                   reference_release(exprasmlist,right.location.reference);
-                   tg.Ungetiftemp(exprasmlist,right.location.reference);
-                end
-              else
-                begin
-                   rg.saveintregvars(exprasmlist,ALL_INTREGISTERS);
-                   rg.saveotherregvars(exprasmlist,ALL_REGISTERS);
-                   cg.a_call_loc(exprasmlist,right.location);
-                   location_release(exprasmlist,right.location);
-                   location_freetemp(exprasmlist,right.location);
-                end;
-           end;
+            hreg:=cg.get_scratch_reg_int(exprasmlist,OS_INT);
+            exprasmlist.concat(taicpu.op_reg(A_POP,S_L,hreg));
+            cg.free_scratch_reg(exprasmlist,hreg);
+          end
+        { the pentium has two pipes and pop reg is pairable }
+        { but the registers must be different!        }
+        else
+          if (pop_size=8) and
+             not(cs_littlesize in aktglobalswitches) and
+             (aktoptprocessor=ClassP5) and
+             (rg.countunusedregsint>0) then
+            begin
+               hreg:=cg.get_scratch_reg_int(exprasmlist,OS_INT);
+               exprasmlist.concat(taicpu.op_reg(A_POP,S_L,hreg));
+               cg.free_scratch_reg(exprasmlist,hreg);
+               hreg:=rg.getregisterint(exprasmlist,OS_INT);
+               exprasmlist.concat(taicpu.op_reg(A_POP,S_L,hreg));
+               rg.ungetregisterint(exprasmlist,hreg);
+            end
+        else
+          if pop_size<>0 then
+            begin
+              hreg.enum:=R_INTREGISTER;
+              hreg.number:=NR_ESP;
+              exprasmlist.concat(taicpu.op_const_reg(A_ADD,S_L,pop_size,hreg));
+            end;
 
-           { this was only for normal functions
-             displaced here so we also get
-             it to work for procvars PM }
-           if (not inlined) and (po_clearstack in procdefinition.procoptions) then
-             begin
-                { we also add the pop_size which is included in pushedparasize }
-                pop_size:=0;
-                { better than an add on all processors }
-                if pushedparasize=4 then
-                  begin
-                    r:=rg.getexplicitregisterint(exprasmlist,NR_EDI);
-                    emit_reg(A_POP,S_L,r);
-                    rg.ungetregisterint(exprasmlist,r);
-                  end
-                { the pentium has two pipes and pop reg is pairable }
-                { but the registers must be different!        }
-                else if (pushedparasize=8) and
-                  not(cs_littlesize in aktglobalswitches) and
-                  (aktoptprocessor=ClassP5) and
-                  (procinfo._class=nil) then
-                    begin
-                       r:=rg.getexplicitregisterint(exprasmlist,NR_EDI);
-                       emit_reg(A_POP,S_L,r);
-                       rg.ungetregisterint(exprasmlist,r);
-                       r:=rg.getexplicitregisterint(exprasmlist,NR_ESI);
-                       emit_reg(A_POP,S_L,r);
-                       rg.ungetregisterint(exprasmlist,r);
-                    end
-                else if pushedparasize<>0 then
-                  emit_const_reg(A_ADD,S_L,pushedparasize,rsp);
-             end;
 {$ifdef OPTALIGN}
-         if pop_esp then
-           emit_reg(A_POP,S_L,rsp);
+        if pop_esp then
+          emit_reg(A_POP,S_L,rsp);
 {$endif OPTALIGN}
-      dont_call:
-         pushedparasize:=oldpushedparasize;
-         rg.restoreunusedstate(unusedstate);
-{$ifdef TEMPREGDEBUG}
-         testregisters32;
-{$endif TEMPREGDEBUG}
-
-         { Called an constructor ? }
-         if (inlined or
-             (right=nil)) and
-            (procdefinition.proctypeoption=potype_constructor) and
-            assigned(methodpointer) then
-          begin
-            { calling inherited constructor failed? Yes, goto fail }
-            if (methodpointer.nodetype=typen) and
-               (aktprocdef.proctypeoption=potype_constructor) then
-             begin
-               r.enum:=R_INTREGISTER;
-               r.number:=NR_ACCUMULATOR;
-               cg.a_reg_alloc(exprasmlist,r);
-               cg.a_cmp_const_reg_label(exprasmlist,OS_ADDR,OC_EQ,0,r,faillabel);
-               cg.a_reg_dealloc(exprasmlist,r);
-             end;
-           end;
-
-         { handle function results }
-         if (not is_void(resulttype.def)) then
-          handle_return_value(inlined,extended_new);
-
-         { perhaps i/o check ? }
-         if iolabel<>nil then
-           begin
-              reference_reset_symbol(href,iolabel,0);
-              cg.a_paramaddr_ref(exprasmlist,href,paramanager.getintparaloc(1));
-              cg.a_call_name(exprasmlist,'FPC_IOCHECK');
-           end;
-         if pop_size>0 then
-           emit_const_reg(A_ADD,S_L,pop_size,rsp);
-
-         { restore registers }
-         rg.restoreusedotherregisters(exprasmlist,pushed);
-         rg.restoreusedintregisters(exprasmlist,pushed_int);
-
-         pp:=tbinarynode(params);
-         while assigned(pp) do
-           begin
-              if assigned(pp.left) then
-                begin
-                  location_freetemp(exprasmlist,pp.left.location);
-                  { process also all nodes of an array of const }
-                  if pp.left.nodetype=arrayconstructorn then
-                    begin
-                      if assigned(tarrayconstructornode(pp.left).left) then
-                       begin
-                         hp:=pp.left;
-                         while assigned(hp) do
-                          begin
-                            location_freetemp(exprasmlist,tarrayconstructornode(hp).left.location);
-                            hp:=tarrayconstructornode(hp).right;
-                          end;
-                       end;
-                    end;
-                end;
-              pp:=tbinarynode(pp.right);
-           end;
-         if inlined then
-           begin
-             if (resulttype.def.size>0) then
-               tg.UnGetTemp(exprasmlist,returnref);
-             tprocdef(procdefinition).parast.address_fixup:=store_parast_fixup;
-             right:=inlinecode;
-           end;
-         if assigned(params) then
-           params.free;
-
-         { from now on the result can be freed normally }
-         if inlined and paramanager.ret_in_param(resulttype.def,procdefinition.proccalloption) then
-           tg.ChangeTempType(exprasmlist,funcretref,tt_normal);
-
-         { if return value is not used }
-         if (not(nf_return_value_used in flags)) and (not is_void(resulttype.def)) then
-           begin
-              if location.loc in [LOC_CREFERENCE,LOC_REFERENCE] then
-                begin
-                   { data which must be finalized ? }
-                   if (resulttype.def.needs_inittable) then
-                      cg.g_finalize(exprasmlist,resulttype.def,location.reference,false);
-                   { release unused temp }
-                   tg.ungetiftemp(exprasmlist,location.reference)
-                end
-              else if location.loc=LOC_FPUREGISTER then
-                begin
-                  { release FPU stack }
-                  r.enum:=R_ST;
-                  emit_reg(A_FSTP,S_NO,r);
-                  {
-                    dec(trgcpu(rg).fpuvaroffset);
-                    do NOT decrement as the increment before
-                    is not called for unused results PM }
-                end;
-           end;
       end;
 
+
 begin
-   ccallparanode:=ti386callparanode;
    ccallnode:=ti386callnode;
 end.
 {
   $Log$
-  Revision 1.86  2003-03-30 20:59:07  peter
+  Revision 1.87  2003-04-04 15:38:56  peter
+    * moved generic code from n386cal to ncgcal, i386 now also
+      uses the generic ncgcal
+
+  Revision 1.86  2003/03/30 20:59:07  peter
     * fix classmethod from classmethod call
     * move BeforeDestruction/AfterConstruction calls to
       genentrycode/genexitcode instead of generating them on the fly

+ 13 - 1
compiler/ncal.pas

@@ -1938,6 +1938,14 @@ type
             tcallparanode(left).insert_typeconv(tparaitem(procdefinition.Para.first),true);
           end;
 
+         { direct call to inherited abstract method, then we
+           can already give a error in the compiler instead
+           of a runtime error }
+         if assigned(methodpointer) and
+            (methodpointer.nodetype=typen) and
+            (po_abstractmethod in procdefinition.procoptions) then
+           CGMessage(cg_e_cant_call_abstract_method);
+
       errorexit:
          aktcallprocdef:=oldcallprocdef;
       end;
@@ -2399,7 +2407,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.131  2003-03-17 18:54:23  peter
+  Revision 1.132  2003-04-04 15:38:56  peter
+    * moved generic code from n386cal to ncgcal, i386 now also
+      uses the generic ncgcal
+
+  Revision 1.131  2003/03/17 18:54:23  peter
     * fix missing self setting for method to procvar conversion in
       tp_procvar mode
 

Файловите разлики са ограничени, защото са твърде много
+ 398 - 494
compiler/ncgcal.pas


+ 7 - 3
compiler/powerpc/nppccal.pas

@@ -32,7 +32,7 @@ interface
     type
        tppccallnode = class(tcgcallnode)
           function pass_1 : tnode;override;
-          procedure load_framepointer;override;
+          procedure push_framepointer;override;
        end;
 
 implementation
@@ -71,7 +71,7 @@ implementation
          end;
     end;
 
-  procedure tppccallnode.load_framepointer;
+  procedure tppccallnode.push_framepointer;
 
     begin
        {
@@ -111,7 +111,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.4  2002-12-05 14:28:12  florian
+  Revision 1.5  2003-04-04 15:38:56  peter
+    * moved generic code from n386cal to ncgcal, i386 now also
+      uses the generic ncgcal
+
+  Revision 1.4  2002/12/05 14:28:12  florian
     * some variant <-> dyn. array stuff
 
   Revision 1.3  2002/11/25 17:43:28  peter

+ 7 - 3
compiler/sparc/ncpucall.pas

@@ -31,7 +31,7 @@ type
 which is part of the stardrad calling mechanism. This function will do nothing.
 the frame pointer register is the stack pointer register of the caller, and is
 set when generating function prologue in cgcpu.tcgSPARC.g_stackframe_entry}
-    procedure load_framepointer;override;
+    procedure push_framepointer;override;
   end;
 implementation
 uses
@@ -54,7 +54,7 @@ function TSparcCallNode.pass_1:TNode;
         then
           TSparcProcInfo(procinfo).maxpushedparasize:=datasize;
   end;
-procedure TSparcCallNode.load_framepointer;
+procedure TSparcCallNode.push_framepointer;
   begin
     InternalError(2002101000);
   end;
@@ -63,7 +63,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.8  2003-02-05 22:44:55  mazen
+  Revision 1.9  2003-04-04 15:38:56  peter
+    * moved generic code from n386cal to ncgcal, i386 now also
+      uses the generic ncgcal
+
+  Revision 1.8  2003/02/05 22:44:55  mazen
   * making UNIT lower case.
 
   Revision 1.7  2003/02/04 21:50:54  mazen

Някои файлове не бяха показани, защото твърде много файлове са промени