Pārlūkot izejas kodu

+ more documentation

carl 23 gadi atpakaļ
vecāks
revīzija
021a0670c2
4 mainītis faili ar 65 papildinājumiem un 7 dzēšanām
  1. 10 1
      compiler/aasm.pas
  2. 33 1
      compiler/assemble.pas
  3. 12 2
      compiler/cg64f32.pas
  4. 10 3
      compiler/cgobj.pas

+ 10 - 1
compiler/aasm.pas

@@ -20,6 +20,12 @@
 
 
  ****************************************************************************
  ****************************************************************************
 }
 }
+{# @abstract(This unit implements an abstract asm output class for all processor types)
+  This unit implements an abstract assembler output class for all processors, these
+  are then overriden for each assembler writer to actually write the data in these
+  classes to an assembler file.
+}  
+   
 unit aasm;
 unit aasm;
 
 
 {$i defines.inc}
 {$i defines.inc}
@@ -1131,7 +1137,10 @@ uses
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.21  2002-04-07 10:17:40  carl
+  Revision 1.22  2002-04-07 13:18:19  carl
+  + more documentation
+
+  Revision 1.21  2002/04/07 10:17:40  carl
   - remove packenumfixed (requires version 1.0.2 or later to compile now!)
   - remove packenumfixed (requires version 1.0.2 or later to compile now!)
   + changing some comments so its commented automatically
   + changing some comments so its commented automatically
 
 

+ 33 - 1
compiler/assemble.pas

@@ -20,6 +20,11 @@
 
 
  ****************************************************************************
  ****************************************************************************
 }
 }
+{# @abstract(This unit handles the assembler file write and assembler calls of FPC)
+   Handles the calls to the actual external assemblers, as well as the generation
+   of object files for smart linking. Also contains the base class for writing
+   the assembler statements to file.
+}
 unit assemble;
 unit assemble;
 
 
 {$i defines.inc}
 {$i defines.inc}
@@ -60,6 +65,10 @@ interface
         procedure MakeObject;virtual;abstract;
         procedure MakeObject;virtual;abstract;
       end;
       end;
 
 
+      {# This is the base class which should be overriden for each each
+         assembler writer. It is used to actually assembler a file, 
+         and write the output to the assembler file.
+      }
       TExternalAssembler=class(TAssembler)
       TExternalAssembler=class(TAssembler)
       private
       private
         procedure CreateSmartLinkPath(const s:string);
         procedure CreateSmartLinkPath(const s:string);
@@ -71,19 +80,39 @@ interface
         outbuf   : array[0..AsmOutSize-1] of char;
         outbuf   : array[0..AsmOutSize-1] of char;
         outfile  : file;
         outfile  : file;
       public
       public
+        {# Returns the complete path and executable name of the assembler program. 
+           
+           It first tries looking in the UTIL directory if specified, otherwise
+           it searches in the free pascal binary directory, in the current
+           working directory and the in the  directories in the $PATH environment.
+        }
         Function  FindAssembler:string;
         Function  FindAssembler:string;
+        {# Actually does the call to the assembler file. Returns false
+           if the assembling of the file failed.
+        }
         Function  CallAssembler(const command,para:string):Boolean;
         Function  CallAssembler(const command,para:string):Boolean;
         Function  DoAssemble:boolean;virtual;
         Function  DoAssemble:boolean;virtual;
         Procedure RemoveAsm;
         Procedure RemoveAsm;
         Procedure AsmFlush;
         Procedure AsmFlush;
         Procedure AsmClear;
         Procedure AsmClear;
+        {# Write a string to the assembler file }
         Procedure AsmWrite(const s:string);
         Procedure AsmWrite(const s:string);
+        {# Write a string to the assembler file }
         Procedure AsmWritePChar(p:pchar);
         Procedure AsmWritePChar(p:pchar);
+        {# Write a string to the assembler file followed by a new line }
         Procedure AsmWriteLn(const s:string);
         Procedure AsmWriteLn(const s:string);
+        {# Write a new line to the assembler file }
         Procedure AsmLn;
         Procedure AsmLn;
         procedure AsmCreate(Aplace:tcutplace);
         procedure AsmCreate(Aplace:tcutplace);
         procedure AsmClose;
         procedure AsmClose;
+        {# This routine should be overriden for each assembler, it is used 
+           to actually write the abstract assembler stream to file. 
+        }
         procedure WriteTree(p:TAAsmoutput);virtual;
         procedure WriteTree(p:TAAsmoutput);virtual;
+        {# This routine should be overriden for each assembler, it is used 
+           to actually write all the different abstract assembler streams
+           by calling for each stream type, the @var(WriteTree) method.
+        }
         procedure WriteAsmList;virtual;
         procedure WriteAsmList;virtual;
       public
       public
         Constructor Create(smart:boolean);override;
         Constructor Create(smart:boolean);override;
@@ -1552,7 +1581,10 @@ Implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.31  2002-04-04 19:05:54  peter
+  Revision 1.32  2002-04-07 13:19:14  carl
+  + more documentation
+
+  Revision 1.31  2002/04/04 19:05:54  peter
     * removed unused units
     * removed unused units
     * use tlocation.size in cg.a_*loc*() routines
     * use tlocation.size in cg.a_*loc*() routines
 
 

+ 12 - 2
compiler/cg64f32.pas

@@ -22,7 +22,10 @@
 
 
  ****************************************************************************
  ****************************************************************************
 }
 }
-
+{# This unit implements the code generation for 64 bit int arithmethics on 
+   32 bit processors. All 32-bit processors should use this class as
+   the base code generator class instead of tcg.
+}   
 unit cg64f32;
 unit cg64f32;
 
 
   {$i defines.inc}
   {$i defines.inc}
@@ -36,6 +39,10 @@ unit cg64f32;
        node,symtype;
        node,symtype;
 
 
     type
     type
+      {# Defines all the methods required on 32-bit processors 
+         to handle 64-bit integers. All 32-bit processors should
+         create derive a class of this type instead of @var(tcg).
+      }
       tcg64f32 = class(tcg)
       tcg64f32 = class(tcg)
         procedure a_load64_const_ref(list : taasmoutput;valuelo, valuehi : AWord;const ref : treference);
         procedure a_load64_const_ref(list : taasmoutput;valuelo, valuehi : AWord;const ref : treference);
         procedure a_load64_reg_ref(list : taasmoutput;reglo, reghi : tregister;const ref : treference);
         procedure a_load64_reg_ref(list : taasmoutput;reglo, reghi : tregister;const ref : treference);
@@ -584,7 +591,10 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.6  2002-04-03 10:41:35  jonas
+  Revision 1.7  2002-04-07 13:21:18  carl
+  + more documentation
+
+  Revision 1.6  2002/04/03 10:41:35  jonas
     + a_load64_const_loc method
     + a_load64_const_loc method
 
 
   Revision 1.5  2002/04/02 17:11:27  peter
   Revision 1.5  2002/04/02 17:11:27  peter

+ 10 - 3
compiler/cgobj.pas

@@ -21,7 +21,10 @@
 
 
  ****************************************************************************
  ****************************************************************************
 }
 }
-{# @abstract(Abstract code generator unit) }
+{# @abstract(Abstract code generator unit) 
+   Abstreact code generator unit. This contains the base class
+   to implement for all new supported processors.
+}
 unit cgobj;
 unit cgobj;
 
 
 {$i defines.inc}
 {$i defines.inc}
@@ -42,7 +45,8 @@ unit cgobj;
           This class implements an abstract instruction generator. Some of 
           This class implements an abstract instruction generator. Some of 
           the methods of this class are generic, while others must
           the methods of this class are generic, while others must
           be overriden for all new processors which will be supported
           be overriden for all new processors which will be supported
-          by Free Pascal.
+          by Free Pascal. For 32-bit processors, the base class
+          sould be @link(tcg64f32) and not @var(tcg).
        }   
        }   
        tcg = class
        tcg = class
           scratch_register_array_pointer : aword;
           scratch_register_array_pointer : aword;
@@ -1656,7 +1660,10 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.12  2002-04-07 09:12:46  carl
+  Revision 1.13  2002-04-07 13:22:11  carl
+  + more documentation
+
+  Revision 1.12  2002/04/07 09:12:46  carl
   + documentation
   + documentation
 
 
   Revision 1.11  2002/04/06 18:10:42  jonas
   Revision 1.11  2002/04/06 18:10:42  jonas