Selaa lähdekoodia

* move stuff to cpuinfo and cpubase
+ documented

carl 23 vuotta sitten
vanhempi
commit
aab3219beb
1 muutettua tiedostoa jossa 51 lisäystä ja 33 poistoa
  1. 51 33
      compiler/cginfo.pas

+ 51 - 33
compiler/cginfo.pas

@@ -20,22 +20,51 @@
 
 
  ****************************************************************************
  ****************************************************************************
 }
 }
+{# This unit exports some types which are used across the code generator }
 unit cginfo;
 unit cginfo;
 
 
 {$i defines.inc}
 {$i defines.inc}
 
 
 interface
 interface
 
 
-  uses cpuinfo;
+  uses cpuinfo,symconst;
 
 
     type
     type
-       TOpCg = (OP_NONE,
-                OP_ADD,OP_AND,OP_DIV,OP_IDIV,OP_IMUL,OP_MUL,OP_NEG,OP_NOT,
-                OP_OR,OP_SAR,OP_SHL,OP_SHR,OP_SUB,OP_XOR
-               );
-
-       TOpCmp = (OC_NONE,OC_EQ,OC_GT,OC_LT,OC_GTE,OC_LTE,OC_NE,OC_BE,OC_B,
-                 OC_AE,OC_A);
+       {# Generic opcodes, which must be supporrted by all processors }
+       TOpCg = 
+       (
+          OP_NONE,
+          OP_ADD,       { simple addition          }
+          OP_AND,       { simple logical and       }
+          OP_DIV,       { simple unsigned division }
+          OP_IDIV,      { simple signed division   }
+          OP_IMUL,      { simple signed multiply   }
+          OP_MUL,       { simple unsigned multiply }
+          OP_NEG,       { simple negate            }
+          OP_NOT,       { simple logical not       }
+          OP_OR,        { simple logical or        }
+          OP_SAR,       { arithmetic shift-right   }
+          OP_SHL,       { logical shift left       }
+          OP_SHR,       { logical shift right      }
+          OP_SUB,       { simple subtraction       }
+          OP_XOR        { simple exclusive or      }
+        );
+
+       {# Generic flag values - used for jump locations }
+       TOpCmp = 
+       (
+          OC_NONE,          
+          OC_EQ,           { equality comparison }
+          OC_GT,
+          OC_LT,
+          OC_GTE,
+          OC_LTE,
+          OC_NE,
+          OC_BE,
+          OC_B,
+          OC_AE,
+          OC_A
+        );
 
 
        { OS_NO is also used memory references with large data that can
        { OS_NO is also used memory references with large data that can
          not be loaded in a register directly }
          not be loaded in a register directly }
@@ -49,29 +78,6 @@ interface
                   OS_M8,OS_M16,OS_M32,OS_M64,OS_M128,OS_MS8,OS_MS16,OS_MS32,
                   OS_M8,OS_M16,OS_M32,OS_M64,OS_M128,OS_MS8,OS_MS16,OS_MS32,
                   OS_MS64,OS_MS128);
                   OS_MS64,OS_MS128);
 
 
-    const
-       { defines the default address size for a processor, }
-       { the natural int size for a processor,             }
-       { the maximum float size for a processor,           }
-       { the size of a vector register for a processor     }
-{$ifdef i386}
-       OS_ADDR = OS_32;
-       OS_INT = OS_32;
-       OS_FLOAT = OS_F80;
-       OS_VECTOR = OS_M64;
-{$endif i386}
-{$ifdef m68k}
-       OS_ADDR = OS_32;
-       OS_INT = OS_32;
-       OS_FLOAT = OS_F??; { processor supports 64bit, but does the compiler? }
-       OS_VECTOR = OS_NO;
-{$endif m68k}
-{$ifdef alpha}
-       OS_ADDR = OS_64;
-       OS_INT = OS_64;
-       OS_FLOAT = OS_F??;
-       OS_VECTOR = OS_NO;
-{$endif alpha}
 {$ifdef powerpc}
 {$ifdef powerpc}
        OS_ADDR = OS_32;
        OS_ADDR = OS_32;
        OS_INT = OS_32;
        OS_INT = OS_32;
@@ -86,13 +92,21 @@ interface
 {$endif ia64}
 {$endif ia64}
 
 
     const
     const
-      TCGSize2Size : Array[tcgsize] of integer =
+       tcgsize2size : Array[tcgsize] of integer =
          { integer values }
          { integer values }
         (0,1,2,4,8,1,2,4,8,
         (0,1,2,4,8,1,2,4,8,
          { floating point values } 
          { floating point values } 
          4,8,EXTENDED_SIZE,8,
          4,8,EXTENDED_SIZE,8,
          { multimedia values }
          { multimedia values }
          1,2,4,8,16,1,2,4,8,16);
          1,2,4,8,16,1,2,4,8,16);
+         
+       tfloat2tcgsize: array[tfloattype] of tcgsize =
+         (OS_F32,OS_F64,OS_F80,OS_C64);
+
+       tcgsize2tfloat: array[OS_F32..OS_C64] of tfloattype =
+         (s32real,s64real,s80real,s64comp);
+
+         
 
 
 
 
 implementation
 implementation
@@ -100,7 +114,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.3  2002-04-20 21:32:23  carl
+  Revision 1.4  2002-04-21 15:26:15  carl
+  * move stuff to cpuinfo and cpubase
+  + documented
+
+  Revision 1.3  2002/04/20 21:32:23  carl
   + generic FPC_CHECKPOINTER
   + generic FPC_CHECKPOINTER
   + first parameter offset in stack now portable
   + first parameter offset in stack now portable
   * rename some constants
   * rename some constants