Browse Source

* moved definition of maxcpuregister and tcpuregisterset from cgbase to
cgutils, and define them so they are no larger than what is required by
the current target platform
* added cgutils to the uses clause of several units that use the
tcpuregisterset type

git-svn-id: trunk@21624 -

Jonas Maebe 13 years ago
parent
commit
0fc422f244

+ 1 - 1
compiler/arm/cpupi.pas

@@ -50,7 +50,7 @@ unit cpupi;
        aasmtai,aasmdata,
        aasmtai,aasmdata,
        tgobj,
        tgobj,
        symconst,symsym,paramgr,
        symconst,symsym,paramgr,
-       cgbase,
+       cgbase,cgutils,
        cgobj;
        cgobj;
 
 
     procedure tarmprocinfo.set_first_temp_offset;
     procedure tarmprocinfo.set_first_temp_offset;

+ 1 - 1
compiler/arm/raarmgas.pas

@@ -62,7 +62,7 @@ Unit raarmgas;
       procinfo,
       procinfo,
       itcpugas,
       itcpugas,
       rabase,rautils,
       rabase,rautils,
-      cgbase,cgobj
+      cgbase,cgutils,cgobj
       ;
       ;
 
 
 
 

+ 1 - 1
compiler/avr/raavrgas.pas

@@ -59,7 +59,7 @@ Unit raavrgas;
       procinfo,
       procinfo,
       itcpugas,
       itcpugas,
       rabase,rautils,
       rabase,rautils,
-      cgbase,cgobj
+      cgbase,cgutils,cgobj
       ;
       ;
 
 
 
 

+ 0 - 5
compiler/cgbase.pas

@@ -220,7 +220,6 @@ interface
       end;
       end;
 
 
       { Set type definition for registers }
       { Set type definition for registers }
-      tcpuregisterset = set of byte;
       tsuperregisterset = array[byte] of set of byte;
       tsuperregisterset = array[byte] of set of byte;
 
 
       pmmshuffle = ^tmmshuffle;
       pmmshuffle = ^tmmshuffle;
@@ -264,10 +263,6 @@ interface
        { Invalid register number }
        { Invalid register number }
        RS_INVALID    = high(tsuperregister);
        RS_INVALID    = high(tsuperregister);
 
 
-       { Maximum number of cpu registers per register type,
-         this must fit in tcpuregisterset }
-       maxcpuregister = 32;
-
        tcgsize2size : Array[tcgsize] of integer =
        tcgsize2size : Array[tcgsize] of integer =
          { integer values }
          { integer values }
         (0,1,2,4,8,16,1,2,4,8,16,
         (0,1,2,4,8,16,1,2,4,8,16,

+ 10 - 0
compiler/cgutils.pas

@@ -32,7 +32,17 @@ unit cgutils;
       aasmbase,
       aasmbase,
       cpubase,cgbase;
       cpubase,cgbase;
 
 
+    const
+      { implementation of max function using only functionality that can be
+        evaluated as a constant expression by the compiler -- this is
+        basically maxcpureg = max(max(first_int_imreg,first_fpu_imreg),first_mm_imreg)-1 }
+      tmpmaxcpufpuintreg = first_int_imreg + ((first_fpu_imreg - first_int_imreg) * ord(first_int_imreg < first_fpu_imreg));
+      maxcpuregister = (tmpmaxcpufpuintreg + ((first_mm_imreg - tmpmaxcpufpuintreg) * ord(tmpmaxcpufpuintreg < first_mm_imreg)))-1;
+
     type
     type
+      { Set type definition for cpuregisters }
+      tcpuregisterset = set of 0..maxcpuregister;
+
 {$ifdef jvm}
 {$ifdef jvm}
       tarrayreftype = (art_none,art_indexreg,art_indexref,art_indexconst);
       tarrayreftype = (art_none,art_indexreg,art_indexref,art_indexconst);
 {$endif jvm}
 {$endif jvm}

+ 1 - 1
compiler/m68k/ra68kmot.pas

@@ -99,7 +99,7 @@ Implementation
        systems,
        systems,
        { aasm }
        { aasm }
        cpuinfo,aasmtai,aasmdata,aasmcpu,
        cpuinfo,aasmtai,aasmdata,aasmcpu,
-       cgbase,
+       cgbase,cgutils,
        { symtable }
        { symtable }
        symbase,symtype,symsym,symdef,symtable,
        symbase,symtype,symsym,symdef,symtable,
        { pass 1 }
        { pass 1 }

+ 2 - 2
compiler/mips/cpupara.pas

@@ -28,7 +28,7 @@ interface
       cclasses,
       cclasses,
       aasmtai,
       aasmtai,
       cpubase,cpuinfo,
       cpubase,cpuinfo,
-      symconst,symbase,symsym,symtype,symdef,paramgr,parabase,cgbase;
+      symconst,symbase,symsym,symtype,symdef,paramgr,parabase,cgbase,cgutils;
 
 
     const
     const
       MIPS_MAX_OFFSET = 20;
       MIPS_MAX_OFFSET = 20;
@@ -92,7 +92,7 @@ implementation
     uses
     uses
       cutils,verbose,systems,
       cutils,verbose,systems,
       defutil, cpupi, procinfo,
       defutil, cpupi, procinfo,
-      cgutils,cgobj;
+      cgobj;
 
 
 
 
 
 

+ 1 - 1
compiler/mips/cpupi.pas

@@ -57,7 +57,7 @@ implementation
 
 
     uses
     uses
       systems,globals,verbose,
       systems,globals,verbose,
-      cpubase,cgbase,cgobj,
+      cpubase,cgbase,cgutils,cgobj,
       tgobj,paramgr,symconst;
       tgobj,paramgr,symconst;
 
 
     constructor TMIPSProcInfo.create(aparent: tprocinfo);
     constructor TMIPSProcInfo.create(aparent: tprocinfo);

+ 1 - 1
compiler/rgobj.pas

@@ -191,7 +191,7 @@ unit rgobj;
         {# Highest register allocated until now.}
         {# Highest register allocated until now.}
         reginfo           : PReginfo;
         reginfo           : PReginfo;
         usable_registers_cnt : word;
         usable_registers_cnt : word;
-        usable_registers  : array[0..maxcpuregister-1] of tsuperregister;
+        usable_registers  : array[0..maxcpuregister] of tsuperregister;
         ibitmap           : Tinterferencebitmap;
         ibitmap           : Tinterferencebitmap;
         spillednodes,
         spillednodes,
         simplifyworklist,
         simplifyworklist,