浏览代码

* fixes to common code to get the alpha compiler compiled applied

florian 23 年之前
父节点
当前提交
d5f0cbbf2b
共有 11 个文件被更改,包括 125 次插入46 次删除
  1. 6 3
      compiler/cgbase.pas
  2. 5 2
      compiler/defbase.pas
  3. 11 3
      compiler/fpcdefs.inc
  4. 9 2
      compiler/ncgcal.pas
  5. 26 14
      compiler/ncgflw.pas
  6. 11 2
      compiler/ncginl.pas
  7. 7 2
      compiler/ncgld.pas
  8. 31 9
      compiler/ncgutil.pas
  9. 6 3
      compiler/ncnv.pas
  10. 6 2
      compiler/paramgr.pas
  11. 7 4
      compiler/pexpr.pas

+ 6 - 3
compiler/cgbase.pas

@@ -234,7 +234,7 @@ unit cgbase;
     {# From a constant numeric value, return the abstract code generator
        size.
     }
-    function int_cgsize(const l: aword): tcgsize;
+    function int_cgsize(const l: byte): tcgsize;
 
     {# return the inverse condition of opcmp }
     function inverse_opcmp(opcmp: topcmp): topcmp;
@@ -594,7 +594,7 @@ implementation
         end;
       end;
 
-    function int_cgsize(const l: aword): tcgsize;
+    function int_cgsize(const l: byte): tcgsize;
       begin
         case l of
           1 :
@@ -654,7 +654,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.29  2002-09-07 19:35:45  florian
+  Revision 1.30  2002-09-30 07:00:44  florian
+    * fixes to common code to get the alpha compiler compiled applied
+
+  Revision 1.29  2002/09/07 19:35:45  florian
     + tcg.direction is used now
 
   Revision 1.28  2002/09/07 15:25:01  peter

+ 5 - 2
compiler/defbase.pas

@@ -1630,7 +1630,7 @@ implementation
                       end;
                     recorddef :
                       begin
-                        { tvarrec -> array of constconst }
+                        { tvarrec -> array of const }
                          if is_array_of_const(def_to) and
                             is_equal(def_from,tarraydef(def_to).elementtype.def) then
                           begin
@@ -1960,7 +1960,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.13  2002-09-22 14:02:34  carl
+  Revision 1.14  2002-09-30 07:00:44  florian
+    * fixes to common code to get the alpha compiler compiled applied
+
+  Revision 1.13  2002/09/22 14:02:34  carl
     * stack checking cannot be called before system unit is initialized
     * MC68020 define
 

+ 11 - 3
compiler/fpcdefs.inc

@@ -27,6 +27,10 @@
   {$define USEEXCEPT}
 {$endif}
 
+
+{ assume a processor with flags }
+{$define cpuflags}
+
 {$ifdef i386}
   {$define x86}
 {$else}
@@ -34,14 +38,18 @@
 {$endif i386}
 {$ifdef x86_64}
   {$define x86}
-  {$define 64bit}
+  {$define cpu64bit}
 {$endif x86_64}
 {$ifdef alpha}
-  {$define 64bit}
+  {$define cpu64bit}
+  {$undef cpuflags}
 {$endif alpha}
 {
   $Log$
-  Revision 1.10  2002-09-29 23:19:05  florian
+  Revision 1.11  2002-09-30 07:00:45  florian
+    * fixes to common code to get the alpha compiler compiled applied
+
+  Revision 1.10  2002/09/29 23:19:05  florian
     + added define 64bit
 
   Revision 1.9  2002/09/07 15:25:02  peter

+ 9 - 2
compiler/ncgcal.pas

@@ -68,7 +68,7 @@ implementation
 {$ifdef i386}
       cga,
 {$endif i386}
-      ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu,cg64f32,cgcpu;
+      ncgutil,cgobj,tgobj,regvars,rgobj,rgcpu,cgcpu;
 
 {*****************************************************************************
                              TCGCALLPARANODE
@@ -433,8 +433,10 @@ implementation
                  (not paramanager.ret_in_param(resulttype.def)) then
                begin
                  include(regs_to_push,accumulator);
+{$ifndef cpu64bit}
                  if resulttype.def.size>sizeof(aword) then
                    include(regs_to_push,accumulatorhigh);
+{$endif cpu64bit}
                end;
               rg.saveusedregisters(exprasmlist,pushed,regs_to_push);
 
@@ -1186,6 +1188,7 @@ implementation
                     LOC_REGISTER:
                       begin
                          location_reset(location,LOC_REGISTER,cgsize);
+{$ifndef cpu64bit}
                          if cgsize in [OS_64,OS_S64] then
                            begin
                               cg64.a_reg_alloc(exprasmlist,resultloc.register64);
@@ -1197,6 +1200,7 @@ implementation
                               cg64.a_load64_reg_reg(exprasmlist,resultloc.register64,location.register64);
                            end
                          else
+{$endif cpu64bit}
                            begin
                               cg.a_reg_alloc(exprasmlist,resultloc.register);
                               location.register:=rg.getexplicitregisterint(exprasmlist,resultloc.register);
@@ -1488,7 +1492,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.23  2002-09-17 18:54:02  jonas
+  Revision 1.24  2002-09-30 07:00:45  florian
+    * fixes to common code to get the alpha compiler compiled applied
+
+  Revision 1.23  2002/09/17 18:54:02  jonas
     * a_load_reg_reg() now has two size parameters: source and dest. This
       allows some optimizations on architectures that don't encode the
       register size in the register name.

+ 26 - 14
compiler/ncgflw.pas

@@ -95,7 +95,11 @@ implementation
       nld,ncon,
       ncgutil,
       tgobj,rgobj,paramgr,
-      regvars,cgobj,cgcpu,cg64f32;
+      regvars,cgobj,cgcpu
+{$ifndef cpu64bit}
+      ,cg64f32
+{$endif cpu64bit}
+      ;
 
     const
       EXCEPT_BUF_SIZE = 12;
@@ -492,6 +496,7 @@ implementation
                   case left.location.loc of
                     LOC_FPUREGISTER :
                       goto do_jmp;
+{$ifdef cpuflags}
                     LOC_FLAGS :
                       begin
                         cg.a_reg_alloc(exprasmlist,accumulator);
@@ -499,6 +504,7 @@ implementation
                         cg.g_flags2reg(exprasmlist,OS_INT,left.location.resflags,accumulator);
                         goto do_jmp;
                       end;
+{$endif cpuflags}
                     LOC_JUMP :
                       begin
                         cg.a_reg_alloc(exprasmlist,accumulator);
@@ -533,20 +539,21 @@ implementation
                         cgsize:=def_cgsize(aktprocdef.rettype.def);
                         cg.a_reg_alloc(exprasmlist,accumulator);
                         allocated_acc := true;
-                        case cgsize of
-                          OS_64,OS_S64 :
-                            begin
-                              cg.a_reg_alloc(exprasmlist,accumulatorhigh);
-                              allocated_acchigh := true;
-                              cg64.a_load64_loc_reg(exprasmlist,left.location,
-                                  joinreg64(accumulator,accumulatorhigh));
-                            end
-                          else
-                            begin
+{$ifndef cpu64bit}
+
+                        if cgsize in [OS_64,OS_S64] then
+                          begin
+                             cg.a_reg_alloc(exprasmlist,accumulatorhigh);
+                             allocated_acchigh := true;
+                             cg64.a_load64_loc_reg(exprasmlist,left.location,
+                                 joinreg64(accumulator,accumulatorhigh));
+                           end
+                         else
+{$endif cpu64bit}
+                           begin
                               hreg:=rg.makeregsize(accumulator,cgsize);
                               cg.a_load_loc_reg(exprasmlist,left.location,hreg);
-                            end;
-                        end;
+                           end;
                      end;
                   end;
 
@@ -556,8 +563,10 @@ implementation
                   cg.a_jmp_always(exprasmlist,aktexit2label);
                   if allocated_acc then
                     cg.a_reg_dealloc(exprasmlist,accumulator);
+{$ifndef cpu64bit}
                   if allocated_acchigh then
                     cg.a_reg_dealloc(exprasmlist,accumulatorhigh);
+{$endif cpu64bit}
 {$ifndef i386}
                   if (aktprocdef.rettype.def.deftype = floatdef) then
                     cg.a_reg_dealloc(exprasmlist,FPU_RESULT_REG);
@@ -1238,7 +1247,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.42  2002-09-07 15:25:02  peter
+  Revision 1.43  2002-09-30 07:00:45  florian
+    * fixes to common code to get the alpha compiler compiled applied
+
+  Revision 1.42  2002/09/07 15:25:02  peter
     * old logs removed and tabs fixed
 
   Revision 1.41  2002/09/01 18:47:00  peter

+ 11 - 2
compiler/ncginl.pas

@@ -59,7 +59,11 @@ implementation
       cginfo,cgbase,pass_1,pass_2,
       cpubase,paramgr,
       nbas,ncon,ncal,ncnv,nld,
-      tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu;
+      tgobj,ncgutil,cgobj,rgobj,rgcpu
+{$ifndef cpu64bit}
+      ,cg64f32
+{$endif cpu64bit}
+      ;
 
 
 {*****************************************************************************
@@ -378,10 +382,12 @@ implementation
             end
            else
              begin
+{$ifndef cpu64bit}
                if cgsize in [OS_64,OS_S64] then
                  cg64.a_op64_reg_loc(exprasmlist,addsubop[inlinenumber],
                    joinreg64(hregister,hregisterhi),tcallparanode(left).left.location)
                else
+{$endif cpu64bit}
                  cg.a_op_reg_loc(exprasmlist,addsubop[inlinenumber],
                    hregister,tcallparanode(left).left.location);
                  location_release(exprasmlist,tcallparanode(tcallparanode(left).right).left.location);
@@ -604,7 +610,10 @@ end.
 
 {
   $Log$
-  Revision 1.14  2002-09-17 18:54:02  jonas
+  Revision 1.15  2002-09-30 07:00:46  florian
+    * fixes to common code to get the alpha compiler compiled applied
+
+  Revision 1.14  2002/09/17 18:54:02  jonas
     * a_load_reg_reg() now has two size parameters: source and dest. This
       allows some optimizations on architectures that don't encode the
       register size in the register name.

+ 7 - 2
compiler/ncgld.pas

@@ -58,7 +58,7 @@ implementation
       aasmbase,aasmtai,aasmcpu,regvars,
       cginfo,cgbase,pass_2,
       cpubase,cpuinfo,cpupara,
-      tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu;
+      tgobj,ncgutil,cgobj,rgobj,rgcpu;
 
 {*****************************************************************************
                              SecondLoad
@@ -653,6 +653,7 @@ implementation
                   cg.a_load_const_loc(exprasmlist,0,left.location);
                   cg.a_label(exprasmlist,hlabel);
                 end;
+{$ifdef cpuflags}
               LOC_FLAGS :
                 begin
                   // this can be a wordbool or longbool too, no?
@@ -665,6 +666,7 @@ implementation
                       cg.g_flags2ref(exprasmlist,def_cgsize(left.resulttype.def),right.location.resflags,left.location.reference);
                     end;
                 end;
+{$endif cpuflags}
             end;
 
          end;
@@ -957,7 +959,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.31  2002-09-26 15:02:05  florian
+  Revision 1.32  2002-09-30 07:00:46  florian
+    * fixes to common code to get the alpha compiler compiled applied
+
+  Revision 1.31  2002/09/26 15:02:05  florian
     + support of passing variants to "array of const"
 
   Revision 1.30  2002/09/17 18:54:02  jonas

+ 31 - 9
compiler/ncgutil.pas

@@ -31,6 +31,9 @@ interface
       cpubase,cpupara,
       aasmbase,aasmtai,aasmcpu,
       cginfo,symbase,symdef,symtype,
+{$ifndef cpu64bit}
+      cg64f32,
+{$endif cpu64bit}
       rgobj;
 
     type
@@ -101,7 +104,7 @@ implementation
     gdb,
 {$endif GDB}
     ncon,
-    tgobj,cgobj,cgcpu,cg64f32;
+    tgobj,cgobj,cgcpu;
 
 
 {*****************************************************************************
@@ -194,12 +197,14 @@ implementation
                          location_release(list,p.location);
                          cg.a_jmp_always(list,falselabel);
                        end;
+{$ifdef cpuflags}
                      LOC_FLAGS :
                        begin
                          cg.a_jmp_flags(list,p.location.resflags,
                            truelabel);
                          cg.a_jmp_always(list,falselabel);
                        end;
+{$endif cpuflags}
                    end;
                 end;
            end
@@ -269,8 +274,9 @@ implementation
                                      TLocation
 *****************************************************************************}
 
+{$ifndef cpu64bit}
     { 32-bit version }
-    procedure location_force_reg32(list: TAAsmoutput;var l:tlocation;dst_size:TCGSize;maybeconst:boolean);
+    procedure location_force(list: TAAsmoutput;var l:tlocation;dst_size:TCGSize;maybeconst:boolean);
       var
         hregister,
         hregisterhi : tregister;
@@ -418,8 +424,10 @@ implementation
          end;
      end;
 
+{$else cpu64bit}
+
     { 64-bit version }
-    procedure location_force_reg64(list: TAAsmoutput;var l:tlocation;dst_size:TCGSize;maybeconst:boolean);
+    procedure location_force(list: TAAsmoutput;var l:tlocation;dst_size:TCGSize;maybeconst:boolean);
       var
         hregister : tregister;
         hl : tasmlabel;
@@ -434,8 +442,11 @@ implementation
                hregister:=rg.getregisterint(list);
               { load value in low register }
               case l.loc of
+{$ifdef cpuflags}
                 LOC_FLAGS :
                   cg.g_flags2reg(list,OS_INT,l.resflags,hregister);
+{$endif cpuflags}
+
                 LOC_JUMP :
                   begin
                     cg.a_label(list,truelabel);
@@ -472,8 +483,10 @@ implementation
            hregister:=rg.makeregsize(hregister,dst_size);
            { load value in new register }
            case l.loc of
+{$ifdef cpuflags}
              LOC_FLAGS :
                cg.g_flags2reg(list,dst_size,l.resflags,hregister);
+{$endif cpuflags}
              LOC_JUMP :
                begin
                  cg.a_label(list,truelabel);
@@ -509,6 +522,7 @@ implementation
            l.register:=hregister;
          end;
      end;
+{$endif cpu64bit}
 
     procedure location_force_reg(list: TAAsmoutput;var l:tlocation;dst_size:TCGSize;maybeconst:boolean);
       begin
@@ -518,10 +532,7 @@ implementation
            location_freetemp(list,l);
            location_release(list,l);
          end;
-        if sizeof(aword) < 8 then
-          location_force_reg32(list, l, dst_size, maybeconst)
-        else
-          location_force_reg64(list, l, dst_size, maybeconst);
+        location_force(list, l, dst_size, maybeconst)
       end;
 
 
@@ -575,12 +586,14 @@ implementation
            case l.loc of
              LOC_REGISTER :
                begin
+{$ifndef cpu64bit}
                  if l.size in [OS_64,OS_S64] then
                   begin
                     tg.GetTemp(exprasmlist,8,tt_normal,s.ref);
                     cg64.a_load64_reg_ref(exprasmlist,joinreg64(l.registerlow,l.registerhigh),s.ref);
                   end
                  else
+{$endif cpu64bit}
                   begin
                     tg.GetTemp(exprasmlist,TCGSize2Size[l.size],tt_normal,s.ref);
                     cg.a_load_reg_ref(exprasmlist,l.size,l.register,s.ref);
@@ -632,6 +645,7 @@ implementation
         case l.loc of
           LOC_REGISTER :
             begin
+{$ifndef cpu64bit}
               if l.size in [OS_64,OS_S64] then
                begin
                  l.registerlow:=rg.getregisterint(exprasmlist);
@@ -639,6 +653,7 @@ implementation
                  cg64.a_load64_ref_reg(exprasmlist,s.ref,joinreg64(l.registerlow,l.registerhigh));
                end
               else
+{$endif cpu64bit}
                begin
                  l.register:=rg.getregisterint(exprasmlist);
                  cg.a_load_ref_reg(exprasmlist,OS_INT,s.ref,l.register);
@@ -1109,6 +1124,7 @@ implementation
                begin
                  uses_acc:=true;
                  cg.a_reg_alloc(list,accumulator);
+{$ifndef cpu64bit}
                  if cgsize in [OS_64,OS_S64] then
                   begin
                     uses_acchi:=true;
@@ -1116,6 +1132,7 @@ implementation
                     cg64.a_load64_ref_reg(list,href,joinreg64(accumulator,accumulatorhigh));
                   end
                  else
+{$endif cpu64bit}
                   begin
                     hreg:=rg.makeregsize(accumulator,cgsize);
                     cg.a_load_ref_reg(list,cgsize,href,hreg);
@@ -1154,9 +1171,11 @@ implementation
              orddef,
              enumdef :
                begin
+{$ifndef cpu64bit}
                  if cgsize in [OS_64,OS_S64] then
                    cg64.a_load64_reg_ref(list,joinreg64(accumulator,accumulatorhigh),href)
                  else
+{$endif cpu64bit}
                   begin
                     hreg:=rg.makeregsize(accumulator,cgsize);
                     cg.a_load_reg_ref(list,cgsize,hreg,href);
@@ -1459,7 +1478,7 @@ implementation
 
               { never call stack checking before the standard system unit
                 has not been initialized
-              }  
+              }
               if (cs_check_stack in aktlocalswitches) and (aktprocdef.proctypeoption<>potype_proginit) then
                 cg.g_stackcheck(stackalloclist,stackframe);
             end;
@@ -1834,7 +1853,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.51  2002-09-22 14:02:35  carl
+  Revision 1.52  2002-09-30 07:00:46  florian
+    * fixes to common code to get the alpha compiler compiled applied
+
+  Revision 1.51  2002/09/22 14:02:35  carl
     * stack checking cannot be called before system unit is initialized
     * MC68020 define
 

+ 6 - 3
compiler/ncnv.pas

@@ -943,7 +943,7 @@ implementation
         { remove obsolete type conversions }
         if is_equal(left.resulttype.def,resulttype.def) then
           begin
-          { becuase is_equal only checks the basetype for sets we need to
+          { because is_equal only checks the basetype for sets we need to
             check here if we are loading a smallset into a normalset }
             if (resulttype.def.deftype=setdef) and
                (left.resulttype.def.deftype=setdef) and
@@ -999,7 +999,7 @@ implementation
                begin
                  if is_procsym_call(left) then
                   begin
-        currprocdef:=Tprocsym(Tcallnode(left).symtableprocentry).search_procdef_byprocvardef(Tprocvardef(resulttype.def));
+                    currprocdef:=Tprocsym(Tcallnode(left).symtableprocentry).search_procdef_byprocvardef(Tprocvardef(resulttype.def));
                     hp:=cloadnode.create_procvar(tprocsym(tcallnode(left).symtableprocentry),
                         currprocdef,tcallnode(left).symtableproc);
                     if (tcallnode(left).symtableprocentry.owner.symtabletype=objectsymtable) and
@@ -2043,7 +2043,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.81  2002-09-16 14:11:13  peter
+  Revision 1.82  2002-09-30 07:00:47  florian
+    * fixes to common code to get the alpha compiler compiled applied
+
+  Revision 1.81  2002/09/16 14:11:13  peter
     * add argument to equal_paras() to support default values or not
 
   Revision 1.80  2002/09/07 20:40:23  carl

+ 6 - 2
compiler/paramgr.pas

@@ -217,7 +217,7 @@ unit paramgr;
                   result.register64.reglo:=accumulator;
                 end
                else
-                  result.register:=accumulator;
+               result.register:=accumulator;
              end;
            floatdef :
              begin
@@ -331,7 +331,10 @@ end.
 
 {
    $Log$
-   Revision 1.18  2002-09-09 09:10:51  florian
+   Revision 1.19  2002-09-30 07:00:47  florian
+     * fixes to common code to get the alpha compiler compiled applied
+
+   Revision 1.18  2002/09/09 09:10:51  florian
      + added generic tparamanager.getframepointerloc
 
    Revision 1.17  2002/09/07 19:40:39  florian
@@ -406,3 +409,4 @@ end.
      * start of the new generic parameter handling
 }
 
+

+ 7 - 4
compiler/pexpr.pas

@@ -667,12 +667,12 @@ implementation
               { generate a methodcallnode or proccallnode }
               { we shouldn't convert things like @tcollection.load }
               if assigned(getprocvardef) then
-               aprocdef:=Tprocsym(sym).search_procdef_byprocvardef(getprocvardef)
+                aprocdef:=Tprocsym(sym).search_procdef_byprocvardef(getprocvardef)
               else
-               aprocdef:=nil;
+                aprocdef:=nil;
               p2:=cloadnode.create_procvar(sym,aprocdef,st);
               if assigned(p1) then
-               tloadnode(p2).set_mp(p1);
+                tloadnode(p2).set_mp(p1);
               p1:=p2;
 
               { no postfix operators }
@@ -2254,7 +2254,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.81  2002-09-16 19:06:14  peter
+  Revision 1.82  2002-09-30 07:00:48  florian
+    * fixes to common code to get the alpha compiler compiled applied
+
+  Revision 1.81  2002/09/16 19:06:14  peter
     * allow ^ after nil
 
   Revision 1.80  2002/09/07 15:25:07  peter