Browse Source

* only compile cs_fp_emulation support when cpufpuemu is defined
* define cpufpuemu for m68k only

peter 23 years ago
parent
commit
cab4c8879f
8 changed files with 74 additions and 14 deletions
  1. 11 1
      compiler/fpcdefs.inc
  2. 9 1
      compiler/fppu.pas
  3. 13 1
      compiler/nadd.pas
  4. 12 6
      compiler/ncal.pas
  5. 8 2
      compiler/options.pas
  6. 7 1
      compiler/paramgr.pas
  7. 7 1
      compiler/pmodules.pas
  8. 7 1
      compiler/psystem.pas

+ 11 - 1
compiler/fpcdefs.inc

@@ -52,9 +52,19 @@
   {$define cpu64bit}
   {$define cpu64bit}
   {$undef cpuflags}
   {$undef cpuflags}
 {$endif alpha}
 {$endif alpha}
+
+{ FPU Emulator support }
+{$ifdef m68k}
+  {$define cpufpemu}
+{$endif m68k}
+
 {
 {
   $Log$
   $Log$
-  Revision 1.13  2002-10-16 19:01:43  peter
+  Revision 1.14  2002-12-06 16:56:57  peter
+    * only compile cs_fp_emulation support when cpufpuemu is defined
+    * define cpufpuemu for m68k only
+
+  Revision 1.13  2002/10/16 19:01:43  peter
     + $IMPLICITEXCEPTIONS switch to turn on/off generation of the
     + $IMPLICITEXCEPTIONS switch to turn on/off generation of the
       implicit exception frames for procedures with initialized variables
       implicit exception frames for procedures with initialized variables
       and for constructors. The default is on for compatibility
       and for constructors. The default is on for compatibility

+ 9 - 1
compiler/fppu.pas

@@ -181,6 +181,7 @@ uses
            Message(unit_u_ppu_invalid_target);
            Message(unit_u_ppu_invalid_target);
            exit;
            exit;
          end;
          end;
+{$ifdef cpufpemu}
        { check if floating point emulation is on?}
        { check if floating point emulation is on?}
         if ((ppufile.header.flags and uf_fpu_emulation)<>0) and
         if ((ppufile.header.flags and uf_fpu_emulation)<>0) and
             (cs_fp_emulation in aktmoduleswitches) then
             (cs_fp_emulation in aktmoduleswitches) then
@@ -190,6 +191,7 @@ uses
            Message(unit_u_ppu_invalid_fpumode);
            Message(unit_u_ppu_invalid_fpumode);
            exit;
            exit;
          end;
          end;
+{$endif cpufpemu}
 
 
       { Load values to be access easier }
       { Load values to be access easier }
         flags:=ppufile.header.flags;
         flags:=ppufile.header.flags;
@@ -860,8 +862,10 @@ uses
           flags:=flags or uf_local_browser;
           flags:=flags or uf_local_browser;
          if do_release then
          if do_release then
           flags:=flags or uf_release;
           flags:=flags or uf_release;
+{$ifdef cpufpemu}
          if (cs_fp_emulation in aktmoduleswitches) then
          if (cs_fp_emulation in aktmoduleswitches) then
            flags:=flags or uf_fpu_emulation;
            flags:=flags or uf_fpu_emulation;
+{$endif cpufpemu}
 {$ifdef Test_Double_checksum_write}
 {$ifdef Test_Double_checksum_write}
          Assign(CRCFile,s+'.IMP');
          Assign(CRCFile,s+'.IMP');
          Rewrite(CRCFile);
          Rewrite(CRCFile);
@@ -1325,7 +1329,11 @@ uses
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.27  2002-11-20 12:36:24  mazen
+  Revision 1.28  2002-12-06 16:56:57  peter
+    * only compile cs_fp_emulation support when cpufpuemu is defined
+    * define cpufpuemu for m68k only
+
+  Revision 1.27  2002/11/20 12:36:24  mazen
   * $UNITPATH directive is now working
   * $UNITPATH directive is now working
 
 
   Revision 1.26  2002/11/15 01:58:46  peter
   Revision 1.26  2002/11/15 01:58:46  peter

+ 13 - 1
compiler/nadd.pas

@@ -45,6 +45,7 @@ interface
           { only implements "muln" nodes, the rest always has to be done in }
           { only implements "muln" nodes, the rest always has to be done in }
           { the code generator for performance reasons (JM)                 }
           { the code generator for performance reasons (JM)                 }
           function first_add64bitint: tnode; virtual;
           function first_add64bitint: tnode; virtual;
+{$ifdef cpufpemu}
           { This routine calls internal runtime library helpers
           { This routine calls internal runtime library helpers
             for all floating point arithmetic in the case
             for all floating point arithmetic in the case
             where the emulation switches is on. Otherwise
             where the emulation switches is on. Otherwise
@@ -52,6 +53,7 @@ interface
             the code generation phase.
             the code generation phase.
           }
           }
           function first_addfloat : tnode; virtual;
           function first_addfloat : tnode; virtual;
+{$endif cpufpemu}
        end;
        end;
        taddnodeclass = class of taddnode;
        taddnodeclass = class of taddnode;
 
 
@@ -1523,6 +1525,7 @@ implementation
       end;
       end;
 
 
 
 
+{$ifdef cpufpemu}
     function taddnode.first_addfloat: tnode;
     function taddnode.first_addfloat: tnode;
       var
       var
         procname: string[31];
         procname: string[31];
@@ -1576,6 +1579,7 @@ implementation
         right := nil;
         right := nil;
         firstpass(result);
         firstpass(result);
       end;
       end;
+{$endif cpufpemu}
 
 
 
 
     function taddnode.pass_1 : tnode;
     function taddnode.pass_1 : tnode;
@@ -1601,9 +1605,11 @@ implementation
          { int/int gives real/real! }
          { int/int gives real/real! }
          if nodetype=slashn then
          if nodetype=slashn then
            begin
            begin
+{$ifdef cpufpemu}
              result := first_addfloat;
              result := first_addfloat;
              if assigned(result) then
              if assigned(result) then
                exit;
                exit;
+{$endif cpufpemu}
              location.loc:=LOC_FPUREGISTER;
              location.loc:=LOC_FPUREGISTER;
              { maybe we need an integer register to save }
              { maybe we need an integer register to save }
              { a reference                               }
              { a reference                               }
@@ -1781,9 +1787,11 @@ implementation
          { is one a real float ? }
          { is one a real float ? }
          else if (rd.deftype=floatdef) or (ld.deftype=floatdef) then
          else if (rd.deftype=floatdef) or (ld.deftype=floatdef) then
             begin
             begin
+{$ifdef cpufpemu}
               result := first_addfloat;
               result := first_addfloat;
               if assigned(result) then
               if assigned(result) then
                 exit;
                 exit;
+{$endif cpufpemu}
               location.loc:=LOC_FPUREGISTER;
               location.loc:=LOC_FPUREGISTER;
               calcregisters(self,0,1,0);
               calcregisters(self,0,1,0);
               { an add node always first loads both the left and the    }
               { an add node always first loads both the left and the    }
@@ -1914,7 +1922,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.76  2002-11-30 21:32:24  carl
+  Revision 1.77  2002-12-06 16:56:57  peter
+    * only compile cs_fp_emulation support when cpufpuemu is defined
+    * define cpufpuemu for m68k only
+
+  Revision 1.76  2002/11/30 21:32:24  carl
     + Add loading of softfpu in emulation mode
     + Add loading of softfpu in emulation mode
     + Correct routine call for softfpu
     + Correct routine call for softfpu
     * Extended type must also be defined even with softfpu
     * Extended type must also be defined even with softfpu

+ 12 - 6
compiler/ncal.pas

@@ -2526,15 +2526,17 @@ type
                    floatdef :
                    floatdef :
                      begin
                      begin
                        location.loc:=LOC_FPUREGISTER;
                        location.loc:=LOC_FPUREGISTER;
+{$ifdef cpufpemu}
+                       if (cs_fp_emulation in aktmoduleswitches) then
+                         registers32:=1
+                       else
+{$endif cpufpemu}
 {$ifdef m68k}
 {$ifdef m68k}
-                       if (cs_fp_emulation in aktmoduleswitches) or
-                          (tfloatdef(resulttype.def).typ=s32real) then
+                        if (tfloatdef(resulttype.def).typ=s32real) then
                          registers32:=1
                          registers32:=1
                        else
                        else
+{$endif m68k}
                          registersfpu:=1;
                          registersfpu:=1;
-{$else not m68k}
-                        registersfpu:=1;
-{$endif not m68k}
                      end;
                      end;
                    else
                    else
                      begin
                      begin
@@ -2838,7 +2840,11 @@ begin
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.113  2002-11-27 20:04:38  peter
+  Revision 1.114  2002-12-06 16:56:58  peter
+    * only compile cs_fp_emulation support when cpufpuemu is defined
+    * define cpufpuemu for m68k only
+
+  Revision 1.113  2002/11/27 20:04:38  peter
     * cdecl array of const fixes
     * cdecl array of const fixes
 
 
   Revision 1.112  2002/11/27 15:33:46  peter
   Revision 1.112  2002/11/27 15:33:46  peter

+ 8 - 2
compiler/options.pas

@@ -474,13 +474,15 @@ begin
                           IllegalPara(opt);
                           IllegalPara(opt);
                          break;
                          break;
                        end;
                        end;
+{$ifdef cpufpemu}
                     'e' :
                     'e' :
                        begin
                        begin
                          If UnsetBool(More, j) then
                          If UnsetBool(More, j) then
                            exclude(initmoduleswitches,cs_fp_emulation)
                            exclude(initmoduleswitches,cs_fp_emulation)
                          Else
                          Else
                            include(initmoduleswitches,cs_fp_emulation);
                            include(initmoduleswitches,cs_fp_emulation);
-                       end; 
+                       end;
+{$endif cpufpemu}
                     'h' :
                     'h' :
                        begin
                        begin
                          val(copy(more,j+1,length(more)-j),heapsize,code);
                          val(copy(more,j+1,length(more)-j),heapsize,code);
@@ -1887,7 +1889,11 @@ finalization
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.90  2002-11-30 23:14:55  carl
+  Revision 1.91  2002-12-06 16:56:58  peter
+    * only compile cs_fp_emulation support when cpufpuemu is defined
+    * define cpufpuemu for m68k only
+
+  Revision 1.90  2002/11/30 23:14:55  carl
     - removed cs_fp_emulation checking for m68k, its now controled
     - removed cs_fp_emulation checking for m68k, its now controled
       by a global switch
       by a global switch
     + added powerpc/sparc/vis message options support
     + added powerpc/sparc/vis message options support

+ 7 - 1
compiler/paramgr.pas

@@ -301,9 +301,11 @@ unit paramgr;
            floatdef :
            floatdef :
              begin
              begin
                result.loc := LOC_FPUREGISTER;
                result.loc := LOC_FPUREGISTER;
+{$ifdef cpufpemu}
                if cs_fp_emulation in aktmoduleswitches then
                if cs_fp_emulation in aktmoduleswitches then
                   result.register := accumulator
                   result.register := accumulator
                else
                else
+{$endif cpufpemu}
                   result.register := FPU_RESULT_REG;
                   result.register := FPU_RESULT_REG;
              end;
              end;
           else
           else
@@ -412,7 +414,11 @@ end.
 
 
 {
 {
    $Log$
    $Log$
-   Revision 1.26  2002-11-27 20:04:09  peter
+   Revision 1.27  2002-12-06 16:56:58  peter
+     * only compile cs_fp_emulation support when cpufpuemu is defined
+     * define cpufpuemu for m68k only
+
+   Revision 1.26  2002/11/27 20:04:09  peter
      * tvarsym.get_push_size replaced by paramanager.push_size
      * tvarsym.get_push_size replaced by paramanager.push_size
 
 
    Revision 1.25  2002/11/27 02:33:19  peter
    Revision 1.25  2002/11/27 02:33:19  peter

+ 7 - 1
compiler/pmodules.pas

@@ -441,6 +441,7 @@ implementation
         make_ref:=false;
         make_ref:=false;
         readconstdefs;
         readconstdefs;
         make_ref:=true;
         make_ref:=true;
+{$ifdef cpufpemu}
       { Floating point emulation unit? }
       { Floating point emulation unit? }
         if (cs_fp_emulation in aktmoduleswitches) then
         if (cs_fp_emulation in aktmoduleswitches) then
          begin
          begin
@@ -453,6 +454,7 @@ implementation
            inc(unitsym.refs);
            inc(unitsym.refs);
            refsymtable.insert(unitsym);
            refsymtable.insert(unitsym);
          end;
          end;
+{$endif cpufpemu}
       { Thread support unit? }
       { Thread support unit? }
         if (cs_threading in aktmoduleswitches) then
         if (cs_threading in aktmoduleswitches) then
          begin
          begin
@@ -1453,7 +1455,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.85  2002-11-30 21:32:24  carl
+  Revision 1.86  2002-12-06 16:56:58  peter
+    * only compile cs_fp_emulation support when cpufpuemu is defined
+    * define cpufpuemu for m68k only
+
+  Revision 1.85  2002/11/30 21:32:24  carl
     + Add loading of softfpu in emulation mode
     + Add loading of softfpu in emulation mode
     + Correct routine call for softfpu
     + Correct routine call for softfpu
     * Extended type must also be defined even with softfpu
     * Extended type must also be defined even with softfpu

+ 7 - 1
compiler/psystem.pas

@@ -125,6 +125,7 @@ implementation
         vmtarraytype : ttype;
         vmtarraytype : ttype;
         vmtsymtable  : tsymtable;
         vmtsymtable  : tsymtable;
       begin
       begin
+{$ifdef cpufpemu}
         { Normal types }
         { Normal types }
         if (cs_fp_emulation in aktmoduleswitches) then
         if (cs_fp_emulation in aktmoduleswitches) then
           begin
           begin
@@ -136,6 +137,7 @@ implementation
             addtype('Extended',pbestrealtype^);
             addtype('Extended',pbestrealtype^);
           end
           end
         else
         else
+{$endif cpufpemu}
           begin
           begin
             addtype('Single',s32floattype);
             addtype('Single',s32floattype);
             addtype('Double',s64floattype);
             addtype('Double',s64floattype);
@@ -477,7 +479,11 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.43  2002-11-30 21:32:26  carl
+  Revision 1.44  2002-12-06 16:56:59  peter
+    * only compile cs_fp_emulation support when cpufpuemu is defined
+    * define cpufpuemu for m68k only
+
+  Revision 1.43  2002/11/30 21:32:26  carl
     + Add loading of softfpu in emulation mode
     + Add loading of softfpu in emulation mode
     + Correct routine call for softfpu
     + Correct routine call for softfpu
     * Extended type must also be defined even with softfpu
     * Extended type must also be defined even with softfpu