Parcourir la source

* made tclassheader using class of to implement cpu dependent code

peter il y a 24 ans
Parent
commit
b87b73d9bf
5 fichiers modifiés avec 56 ajouts et 24 suppressions
  1. 6 3
      compiler/compiler.pas
  2. 7 2
      compiler/i386/cpunode.pas
  3. 22 10
      compiler/i386/n386obj.pas
  4. 14 5
      compiler/nobj.pas
  5. 7 4
      compiler/pdecobj.pas

+ 6 - 3
compiler/compiler.pas

@@ -100,12 +100,12 @@ uses
   assemble,link,import,export,tokens,pass_1
   { cpu overrides }
   ,cpuswtch
-  { cpu targets }
-  ,cputarg
   { cpu codegenerator }
 {$ifndef NOPASS2}
   ,cpunode
 {$endif}
+  { cpu targets }
+  ,cputarg
   ;
 
 function Compile(const cmd:string):longint;
@@ -328,7 +328,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.19  2001-04-18 22:01:53  peter
+  Revision 1.20  2001-04-21 13:37:16  peter
+    * made tclassheader using class of to implement cpu dependent code
+
+  Revision 1.19  2001/04/18 22:01:53  peter
     * registration of targets and assemblers
 
   Revision 1.18  2001/04/13 18:08:36  peter

+ 7 - 2
compiler/i386/cpunode.pas

@@ -30,12 +30,17 @@ unit cpunode;
 
     uses
        n386bas,n386ld,n386add,n386cal,n386con,n386flw,n386mat,n386mem,
-       n386set,n386inl,n386opt;
+       n386set,n386inl,n386opt,
+       { this not really a node }
+       n386obj;
 
 end.
 {
   $Log$
-  Revision 1.2  2000-12-31 11:14:11  jonas
+  Revision 1.3  2001-04-21 13:37:17  peter
+    * made tclassheader using class of to implement cpu dependent code
+
+  Revision 1.2  2000/12/31 11:14:11  jonas
     + implemented/fixed docompare() mathods for all nodes (not tested)
     + nopt.pas, nadd.pas, i386/n386opt.pas: optimized nodes for adding strings
       and constant strings/chars together

+ 22 - 10
compiler/i386/n386ic.pas → compiler/i386/n386obj.pas

@@ -20,26 +20,31 @@
 
  ****************************************************************************
 }
-unit n386ic;
+unit n386obj;
 
-interface
+{$i defines.inc }
 
-uses
-  aasm,
-  symbase,symtype,symtable,symdef,symsym;
+interface
 
-procedure cgintfwrapper(asmlist: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint);
 
 implementation
 
 uses
   systems,
-  verbose, globals,
-  symconst,
+  verbose,globals,
+  aasm,
+  symconst,symbase,symtype,symtable,symdef,symsym,
+  nobj,
   temp_gen,
   cpubase,
   cgai386, tgcpu;
 
+   type
+     ti386classheader=class(tclassheader)
+     protected
+       procedure cgintfwrapper(asmlist: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint);override;
+     end;
+     
 {
 possible calling conventions:
               default stdcall cdecl pascal popstack register saveregisters
@@ -94,7 +99,8 @@ begin
 end;
 
 
-procedure cgintfwrapper(asmlist: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint);
+procedure ti386classheader.cgintfwrapper(asmlist: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint);
+
   procedure checkvirtual;
   begin
     if (procdef.extnumber=-1) then
@@ -199,10 +205,16 @@ begin
   exprasmlist:=oldexprasmlist;
 end;
 
+
+initialization
+  cclassheader:=ti386classheader;
 end.
 {
   $Log$
-  Revision 1.5  2001-04-13 01:22:19  peter
+  Revision 1.1  2001-04-21 13:37:17  peter
+    * made tclassheader using class of to implement cpu dependent code
+
+  Revision 1.5  2001/04/13 01:22:19  peter
     * symtable change to classes
     * range check generation and errors fixed, make cycle DEBUG=1 works
     * memory leaks fixed

+ 14 - 5
compiler/hcgdata.pas → compiler/nobj.pas

@@ -21,7 +21,7 @@
 
  ****************************************************************************
 }
-unit hcgdata;
+unit nobj;
 
 {$i defines.inc}
 
@@ -96,6 +96,8 @@ interface
         function  gintfgetcprocdef(proc: tprocdef;const name: string): tprocdef;
         procedure gintfdoonintf(intf: tobjectdef; intfindex: longint);
         procedure gintfwalkdowninterface(intf: tobjectdef; intfindex: longint);
+      protected
+        procedure cgintfwrapper(asmlist: TAAsmoutput; procdef: tprocdef; const labelname: string; ioffset: longint);virtual;abstract;
       public
         constructor create(c:tobjectdef);
         { generates the message tables for a class }
@@ -115,7 +117,12 @@ interface
         procedure writeinterfaceids;
       end;
 
+      tclassheaderclass=class of tclassheader;
 
+    var     
+      cclassheader : tclassheaderclass;
+
+      
 implementation
 
     uses
@@ -130,9 +137,6 @@ implementation
        gdb,
 {$endif GDB}
        systems
-{$ifdef i386}
-       ,n386ic
-{$endif}
        ;
 
 
@@ -1263,10 +1267,15 @@ implementation
       end;
 
 
+initialization
+  cclassheader:=tclassheader;
 end.
 {
   $Log$
-  Revision 1.20  2001-04-18 22:01:54  peter
+  Revision 1.1  2001-04-21 13:37:16  peter
+    * made tclassheader using class of to implement cpu dependent code
+
+  Revision 1.20  2001/04/18 22:01:54  peter
     * registration of targets and assemblers
 
   Revision 1.19  2001/04/13 01:22:07  peter

+ 7 - 4
compiler/pdecobj.pas

@@ -38,8 +38,8 @@ implementation
       cutils,cclasses,
       globals,verbose,systems,tokens,
       aasm,symconst,symbase,symsym,symtable,types,
-      hcodegen,hcgdata,
-      node,nld,ncon,ncnv,pass_1,
+      hcodegen,
+      node,nld,ncon,ncnv,nobj,pass_1,
       scanner,
       pbase,pexpr,pdecsub,pdecvar,ptype;
 
@@ -1007,7 +1007,7 @@ implementation
          if (cs_create_smart in aktmoduleswitches) then
            dataSegment.concat(Tai_cut.Create);
 
-         ch:=tclassheader.create(aktclass);
+         ch:=cclassheader.create(aktclass);
          if is_interface(aktclass) then
            ch.writeinterfaceids;
          if (oo_has_vmt in aktclass.objectoptions) then
@@ -1032,7 +1032,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.22  2001-04-18 22:01:54  peter
+  Revision 1.23  2001-04-21 13:37:16  peter
+    * made tclassheader using class of to implement cpu dependent code
+
+  Revision 1.22  2001/04/18 22:01:54  peter
     * registration of targets and assemblers
 
   Revision 1.21  2001/04/13 01:22:11  peter