Browse Source

* fixed stackcheck that would be called recursively when a stack
error was found
* generic changeregsize(reg,size) for i386 register resizing
* removed some more routines from cga unit
* fixed returnvalue handling
* fixed default stacksize of linux and go32v2, 8kb was a bit small :-)

peter 23 years ago
parent
commit
3bcfe33002

+ 60 - 52
compiler/cgobj.pas

@@ -21,7 +21,7 @@
 
  ****************************************************************************
 }
-{# @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.
 }
@@ -39,15 +39,15 @@ unit cgobj;
 
     type
        talignment = (AM_NATURAL,AM_NONE,AM_2BYTE,AM_4BYTE,AM_8BYTE);
-       
-        
-       {# @abstract(Abstract code generator) 
-          This class implements an abstract instruction generator. Some of 
+
+
+       {# @abstract(Abstract code generator)
+          This class implements an abstract instruction generator. Some of
           the methods of this class are generic, while others must
           be overriden for all new processors which will be supported
           by Free Pascal. For 32-bit processors, the base class
           sould be @link(tcg64f32) and not @var(tcg).
-       }   
+       }
        tcg = class
           scratch_register_array_pointer : aword;
           {# List of currently unused scratch registers }
@@ -66,16 +66,16 @@ unit cgobj;
           {# Deallocates register r by inserting a pa_regdealloc record}
           procedure a_reg_dealloc(list : taasmoutput;r : tregister);
 
-          {# @abstract(Returns a register for use as scratch register) 
+          {# @abstract(Returns a register for use as scratch register)
              This routine returns a register which can be used by
              the code generator as a scratch register. Since
              scratch_registers are scarce resources, the register
-             should be freed by calling @link(get_scratch_reg) as 
+             should be freed by calling @link(get_scratch_reg) as
              soon as it is no longer required.
           }
           function get_scratch_reg(list : taasmoutput) : tregister;
-          {# @abstract(Releases a scratch register) 
-          
+          {# @abstract(Releases a scratch register)
+
              Releases a scratch register.
              This routine is used to free a register which
              was previously allocated using @link(get_scratch_reg).
@@ -120,52 +120,52 @@ unit cgobj;
           { left to right), this allows to move the parameter to    }
           { register, if the cpu supports register calling          }
           { conventions                                             }
-          
+
           {# Pass a parameter, which is located in a register, to a routine.
-             
+
              This routine should push/send the parameter to the routine, as
              required by the specific processor ABI. This must be overriden for
              each CPU target.
-             
+
              @param(size size of the operand in the register)
              @param(r register source of the operand)
              @param(nr parameter number (starting from one) of routine (from left to right))
-          }   
+          }
           procedure a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;nr : longint);virtual; abstract;
           {# Pass a parameter, which is a constant, to a routine.
-             
+
              A generic version is provided.
-             
+
              @param(size size of the operand in constant)
              @param(a value of constant to send)
              @param(nr parameter number (starting from one) of routine (from left to right))
-          }   
+          }
           procedure a_param_const(list : taasmoutput;size : tcgsize;a : aword;nr : longint);virtual;
           {# Pass the value of a parameter, which is located in memory, to a routine.
-             
+
              A generic version is provided.
-             
+
              @param(size size of the operand in constant)
              @param(r Memory reference of value to send)
              @param(nr parameter number (starting from one) of routine (from left to right))
-          }   
+          }
           procedure a_param_ref(list : taasmoutput;size : tcgsize;const r : treference;nr : longint);virtual;
-          {# Pass the value of a parameter, which can be located either in a register or memory location, 
+          {# Pass the value of a parameter, which can be located either in a register or memory location,
              to a routine.
-             
+
              A generic version is provided.
-             
+
              @param(l location of the operand to send)
              @param(nr parameter number (starting from one) of routine (from left to right))
-          }   
+          }
           procedure a_param_loc(list : taasmoutput;const l : tlocation;nr : longint);
           {# Pass the address of a reference to a routine.
-             
+
              A generic version is provided.
-             
+
              @param(r reference to get address from)
              @param(nr parameter number (starting from one) of routine (from left to right))
-          }   
+          }
           procedure a_paramaddr_ref(list : taasmoutput;const r : treference;nr : longint);virtual;
 
           {**********************************}
@@ -277,51 +277,51 @@ unit cgobj;
           {********************************************************}
           { these methods can be overriden for extra functionality }
 
-          {# Emits instructions which should be emitted when entering 
+          {# Emits instructions which should be emitted when entering
              a routine declared as @var(interrupt). The default
              behavior does nothing, should be overriden as required.
           }
           procedure g_interrupt_stackframe_entry(list : taasmoutput);virtual;
-          
+
           {# Emits instructions which should be emitted when exiting
              a routine declared as @var(interrupt). The default
              behavior does nothing, should be overriden as required.
           }
           procedure g_interrupt_stackframe_exit(list : taasmoutput);virtual;
-    
+
           {# Emits instructions when compilation is done in profile
              mode (this is set as a command line option). The default
              behavior does nothing, should be overriden as required.
           }
           procedure g_profilecode(list : taasmoutput);virtual;
-          
+
           {# Emits the call to the stack checking routine of
-             the runtime library. The default behavior 
+             the runtime library. The default behavior
              does not need to be modified, as it is generic
              for all platforms.
           }
           procedure g_stackcheck(list : taasmoutput;stackframesize : longint);virtual;
 
           procedure g_maybe_loadself(list : taasmoutput);virtual; abstract;
-          {# This should emit the opcode to copy len bytes from the source 
-             to destination, if loadref is true, it assumes that it first must load 
-             the source address from the memory location where   
+          {# This should emit the opcode to copy len bytes from the source
+             to destination, if loadref is true, it assumes that it first must load
+             the source address from the memory location where
              source points to.
-             
+
              It must be overriden for each new target processor.
-             
+
              @param(source Source reference of copy)
              @param(dest Destination reference of copy)
              @param(delsource Indicates if the source reference's resources should be freed)
              @param(loadref Is the source reference a pointer to the actual source (TRUE), is it the actual source address (FALSE))
-             
+
           }
           procedure g_concatcopy(list : taasmoutput;const source,dest : treference;len : aword;delsource,loadref : boolean);virtual; abstract;
 
           {# Generates range checking code. It is to note
              that this routine does not need to be overriden,
              as it takes care of everything.
-             
+
              @param(p Node which contains the value to check)
              @param(todef Type definition of node to range check)
           }
@@ -416,7 +416,7 @@ unit cgobj;
 
       begin
 {$ifdef i386}
-         include(unusedscratchregisters,makereg32(r));
+         include(unusedscratchregisters,changeregsize(r,S_L));
 {$else i386}
          include(unusedscratchregisters,r);
 {$endif i386}
@@ -1258,21 +1258,21 @@ unit cgobj;
           LOC_REFERENCE,LOC_CREFERENCE:
             begin
 {$ifdef i386}
-              case loc.size of
-                OS_8,OS_S8:
-                  tmpreg := reg32toreg8(rg.getregisterint(exprasmlist));
-                OS_16,OS_S16:
-                  tmpreg := reg32toreg16(get_scratch_reg(list));
-                else
-                  tmpreg := get_scratch_reg(list);
-              end;
-{$else i386}
+              { the following is done with defines to avoid a speed penalty,  }
+              { since all this is only necessary for the 80x86 (because EDI   }
+              { doesn't have an 8bit component which is directly addressable) }
+              if loc.size in [OS_8,OS_S8] then
+                tmpreg := rg.getregisterint(exprasmlist)
+              else
+{$endif i386}
               tmpreg := get_scratch_reg(list);
+{$ifdef i386}
+              makeregsize(tmpreg,loc.size);
 {$endif i386}
               a_load_ref_reg(list,loc.size,loc.reference,tmpreg);
               a_load_reg_ref(list,loc.size,tmpreg,ref);
 {$ifdef i386}
-              if not (loc.size in [OS_32,OS_S32]) then
+              if loc.size in [OS_8,OS_S8] then
                 rg.ungetregister(exprasmlist,tmpreg)
               else
 {$endif i386}
@@ -1519,7 +1519,7 @@ unit cgobj;
               a_load_ref_reg(list,size,loc.reference,tmpreg);
               a_cmp_ref_reg_label(list,size,cmp_op,ref,tmpreg,l);
 {$ifdef i386}
-              if makereg32(tmpreg) <> R_EDI then
+              if size in [OS_8,OS_S8] then
                 rg.ungetregister(exprasmlist,tmpreg)
               else
 {$endif i386}
@@ -1660,7 +1660,15 @@ finalization
 end.
 {
   $Log$
-  Revision 1.13  2002-04-07 13:22:11  carl
+  Revision 1.14  2002-04-15 19:44:18  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.13  2002/04/07 13:22:11  carl
   + more documentation
 
   Revision 1.12  2002/04/07 09:12:46  carl

+ 22 - 182
compiler/i386/cga.pas

@@ -28,7 +28,7 @@ unit cga;
 interface
 
     uses
-       cpuinfo,cpubase,cpuasm,
+       cpuinfo,cpubase,cpuasm,cginfo,
        symconst,symtype,symdef,aasm;
 
 {$define TESTGETTEMP to store const that
@@ -37,18 +37,9 @@ interface
     function def_opsize(p1:tdef):topsize;
     function def2def_opsize(p1,p2:tdef):topsize;
     function def_getreg(p1:tdef):tregister;
-    function makereg8(r:tregister):tregister;
-    function makereg16(r:tregister):tregister;
-    function makereg32(r:tregister):tregister;
-
-
-    procedure locflags2reg(var l:tlocation;opsize:topsize);
-    procedure locjump2reg(var l:tlocation;opsize:topsize; otl, ofl: tasmlabel);
-
 
     procedure emitlab(var l : tasmlabel);
     procedure emitjmp(c : tasmcond;var l : tasmlabel);
-    procedure emit_flag2reg(flag:tresflags;hregister:tregister);
 
     procedure emit_none(i : tasmop;s : topsize);
 
@@ -76,12 +67,8 @@ interface
     procedure emit_mov_ref_reg64(r : treference;rl,rh : tregister);
     procedure emit_lea_loc_ref(const t:tlocation;const ref:treference;freetemp:boolean);
     procedure emit_lea_loc_reg(const t:tlocation;reg:tregister;freetemp:boolean);
-//    procedure emit_push_loc(const t:tlocation);
     procedure emit_push_mem_size(const t: treference; size: longint);
 
-    { pushes qword location to the stack }
-//    procedure emit_pushq_loc(const t : tlocation);
-
     { remove non regvar registers in loc from regs (in the format }
     { pushusedregisters uses)                                     }
     procedure remove_non_regvars_from_loc(const t: tlocation; var regs: tregisterset);
@@ -89,8 +76,6 @@ interface
     procedure emit_pushw_loc(const t:tlocation);
     procedure emit_push_lea_loc(const t:tlocation;freetemp:boolean);
     procedure emit_to_mem(var t:tlocation;def:tdef);
-    procedure emit_to_reg16(var hr:tregister);
-    procedure emit_to_reg32(var hr:tregister);
 
     procedure copyshortstring(const dref,sref : treference;len : byte;
                         loadref, del_sref: boolean);
@@ -156,18 +141,18 @@ implementation
 {$endif}
        ;
 
-{$ifdef NOTARGETWIN32} 
+{$ifdef NOTARGETWIN32}
  {$define __NOWINPECOFF__}
 {$endif}
 
-{$ifdef NOTARGETWDOSX} 
+{$ifdef NOTARGETWDOSX}
  {$define __NOWINPECOFF__}
 {$endif}
 
 {$ifndef __NOWINPECOFF__}
   const
      winstackpagesize = 4096;
-{$endif} 
+{$endif}
 
 
 {*****************************************************************************
@@ -226,97 +211,7 @@ implementation
 
     function def_getreg(p1:tdef):tregister;
       begin
-        case p1.size of
-         1 : def_getreg:=reg32toreg8(rg.getregisterint(exprasmlist));
-         2 : def_getreg:=reg32toreg16(rg.getregisterint(exprasmlist));
-         4 : def_getreg:=rg.getregisterint(exprasmlist);
-        else
-         internalerror(130820003);
-        end;
-      end;
-
-
-    function makereg8(r:tregister):tregister;
-      begin
-        makereg8 := r;
-        case r of
-          R_EAX,R_EBX,R_ECX,R_EDX:
-            makereg8:=reg32toreg8(r);
-          R_AX,R_BX,R_CX,R_DX:
-            makereg8:=reg16toreg8(r);
-        end;
-      end;
-
-
-    function makereg16(r:tregister):tregister;
-      begin
-        makereg16 := r;
-        case r of
-          R_EAX,R_EBX,R_ECX,R_EDX,R_EDI,R_ESI,R_ESP,R_EBP :
-            makereg16:=reg32toreg16(r);
-          R_AL,R_BL,R_CL,R_DL :
-            makereg16:=reg8toreg16(r);
-        end;
-      end;
-
-
-    function makereg32(r:tregister):tregister;
-      begin
-        makereg32 := r;
-        case r of
-          R_AX,R_BX,R_CX,R_DX,R_DI,R_SI,R_SP,R_BP :
-            makereg32:=reg16toreg32(r);
-          R_AL,R_BL,R_CL,R_DL :
-            makereg32:=reg8toreg32(r);
-        end;
-      end;
-
-
-    procedure locflags2reg(var l:tlocation;opsize:topsize);
-      var
-        hregister : tregister;
-      begin
-        if (l.loc=LOC_FLAGS) then
-         begin
-           hregister:=rg.getregisterint(exprasmlist);
-           case opsize of
-            S_W : hregister:=reg32toreg16(hregister);
-            S_B : hregister:=reg32toreg8(hregister);
-           end;
-           emit_flag2reg(l.resflags,hregister);
-           l.loc:=LOC_REGISTER;
-           l.register:=hregister;
-         end
-        else internalerror(270720001);
-      end;
-
-
-    procedure locjump2reg(var l:tlocation;opsize:topsize; otl, ofl: tasmlabel);
-      var
-        hregister : tregister;
-        hl : tasmlabel;
-      begin
-         if l.loc = LOC_JUMP then
-           begin
-             hregister:=rg.getregisterint(exprasmlist);
-             case opsize of
-               S_W : hregister:=reg32toreg16(hregister);
-               S_B : hregister:=reg32toreg8(hregister);
-             end;
-             l.loc:=LOC_REGISTER;
-             l.register:=hregister;
-             emitlab(truelabel);
-             truelabel:=otl;
-             emit_const_reg(A_MOV,opsize,1,hregister);
-             getlabel(hl);
-             emitjmp(C_None,hl);
-             emitlab(falselabel);
-             falselabel:=ofl;
-             emit_reg_reg(A_XOR,S_L,makereg32(hregister),
-             makereg32(hregister));
-             emitlab(hl);
-           end
-        else internalerror(270720002);
+        def_getreg:=changeregsize(rg.getregisterint(exprasmlist),def_opsize(p1));
       end;
 
 
@@ -348,25 +243,6 @@ implementation
       end;
 
 
-    procedure emit_flag2reg(flag:tresflags;hregister:tregister);
-      var
-        ai : taicpu;
-        hreg : tregister;
-      begin
-         hreg:=makereg8(hregister);
-         ai:=Taicpu.Op_reg(A_Setcc,S_B,hreg);
-         ai.SetCondition(flags_to_cond(flag));
-         exprasmList.concat(ai);
-         if hreg<>hregister then
-          begin
-            if hregister in regset16bit then
-             emit_to_reg16(hreg)
-            else
-             emit_to_reg32(hreg);
-          end;
-      end;
-
-
     procedure emit_none(i : tasmop;s : topsize);
       begin
          exprasmList.concat(Taicpu.Op_none(i,s));
@@ -499,9 +375,9 @@ implementation
           LOC_REGISTER,
          LOC_CREGISTER : begin
                            if aktalignment.paraalign=4 then
-                             exprasmList.concat(Taicpu.Op_reg(A_PUSH,S_L,makereg32(t.register)))
+                             exprasmList.concat(Taicpu.Op_reg(A_PUSH,S_L,changeregsize(t.register,S_L)))
                            else
-                             exprasmList.concat(Taicpu.Op_reg(A_PUSH,S_W,makereg16(t.register)));
+                             exprasmList.concat(Taicpu.Op_reg(A_PUSH,S_W,changeregsize(t.register,S_W)));
                          end;
          LOC_CONSTANT : begin
                            if aktalignment.paraalign=4 then
@@ -624,50 +500,6 @@ implementation
       end;
 
 
-    procedure emit_to_reg16(var hr:tregister);
-      begin
-        { ranges are a little bit bug sensitive ! }
-        case hr of
-           R_EAX,R_EBX,R_ECX,R_EDX,R_EDI,R_ESI,R_ESP,R_EBP:
-             begin
-               hr:=reg32toreg16(hr);
-             end;
-           R_AL,R_BL,R_CL,R_DL:
-             begin
-               hr:=reg8toreg16(hr);
-               emit_const_reg(A_AND,S_W,$ff,hr);
-             end;
-           R_AH,R_BH,R_CH,R_DH:
-             begin
-               hr:=reg8toreg16(hr);
-               emit_const_reg(A_AND,S_W,$ff00,hr);
-             end;
-        end;
-      end;
-
-
-    procedure emit_to_reg32(var hr:tregister);
-      begin
-        { ranges are a little bit bug sensitive ! }
-        case hr of
-           R_AX,R_BX,R_CX,R_DX,R_DI,R_SI,R_SP,R_BP:
-             begin
-                hr:=reg16toreg32(hr);
-                emit_const_reg(A_AND,S_L,$ffff,hr);
-             end;
-           R_AL,R_BL,R_CL,R_DL:
-             begin
-                hr:=reg8toreg32(hr);
-                emit_const_reg(A_AND,S_L,$ff,hr);
-             end;
-           R_AH,R_BH,R_CH,R_DH:
-             begin
-                hr:=reg8toreg32(hr);
-                emit_const_reg(A_AND,S_L,$ff00,hr);
-             end;
-        end;
-      end;
-
     procedure emit_mov_ref_reg64(r : treference;rl,rh : tregister);
 
       var
@@ -924,10 +756,10 @@ implementation
                 begin
                    { and now look for an 8 bit register }
                    swap:=false;
-                   if R_EAX in rg.unusedregsint then reg8:=reg32toreg8(rg.getexplicitregisterint(exprasmlist,R_EAX))
-                   else if R_EDX in rg.unusedregsint then reg8:=reg32toreg8(rg.getexplicitregisterint(exprasmlist,R_EDX))
-                   else if R_EBX in rg.unusedregsint then reg8:=reg32toreg8(rg.getexplicitregisterint(exprasmlist,R_EBX))
-                   else if R_ECX in rg.unusedregsint then reg8:=reg32toreg8(rg.getexplicitregisterint(exprasmlist,R_ECX))
+                   if R_EAX in rg.unusedregsint then reg8:=changeregsize(rg.getexplicitregisterint(exprasmlist,R_EAX),S_B)
+                   else if R_EDX in rg.unusedregsint then reg8:=changeregsize(rg.getexplicitregisterint(exprasmlist,R_EDX),S_B)
+                   else if R_EBX in rg.unusedregsint then reg8:=changeregsize(rg.getexplicitregisterint(exprasmlist,R_EBX),S_B)
+                   else if R_ECX in rg.unusedregsint then reg8:=changeregsize(rg.getexplicitregisterint(exprasmlist,R_ECX),S_B)
                    else
                       begin
                          swap:=true;
@@ -1446,9 +1278,9 @@ implementation
       r    : treference;
       power,len  : longint;
       opsize : topsize;
-{$ifndef __NOWINPECOFF__} 
+{$ifndef __NOWINPECOFF__}
       again,ok : tasmlabel;
-{$endif} 
+{$endif}
     begin
        if (tsym(p).typ=varsym) and
           (tvarsym(p).varspez=vs_value) and
@@ -2570,7 +2402,15 @@ implementation
 end.
 {
   $Log$
-  Revision 1.22  2002-04-14 20:54:17  carl
+  Revision 1.23  2002-04-15 19:44:20  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.22  2002/04/14 20:54:17  carl
   + stack checking enabled for all targets (it is simulated now)
 
   Revision 1.21  2002/04/04 19:06:08  peter

+ 63 - 57
compiler/i386/cgcpu.pas

@@ -114,7 +114,7 @@ unit cgcpu;
        private
 
         procedure get_64bit_ops(op:TOpCG;var op1,op2:TAsmOp);
-        procedure sizes2load(s1: tcgsize; s2: topsize; var op: tasmop; var s3: topsize);
+        procedure sizes2load(s1 : tcgsize;s2 : topsize; var op: tasmop; var s3: topsize);
 
         procedure floatload(list: taasmoutput; t : tcgsize;const ref : treference);
         procedure floatstore(list: taasmoutput; t : tcgsize;const ref : treference);
@@ -136,6 +136,20 @@ unit cgcpu;
         (S_NO,S_B,S_W,S_L,S_L,S_B,S_W,S_L,S_L,
          S_FS,S_FL,S_FX,S_IQ,
          S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO,S_NO);
+{
+      TReg2CGSize: Array[tregister] of tcgsize = (OS_NO,
+         S_L,S_L,S_L,S_L,S_L,S_L,S_L,S_L,
+         S_W,S_W,S_W,S_W,S_W,S_W,S_W,S_W,
+         S_B,S_B,S_B,S_B,S_B,S_B,S_B,S_B,
+         S_W,S_W,S_W,S_W,S_W,S_W,
+         S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,
+         S_L,S_L,S_L,S_L,S_L,S_L,
+         S_L,S_L,S_L,S_L,
+         S_L,S_L,S_L,S_L,S_L,
+         OS_NO,OS_NO,OS_NO,OS_NO,OS_NO,OS_NO,OS_NO,OS_NO,
+         OS_NO,OS_NO,OS_NO,OS_NO,OS_NO,OS_NO,OS_NO,OS_NO
+      );
+ }
 
 
   implementation
@@ -150,19 +164,13 @@ unit cgcpu;
     procedure tcg386.a_param_reg(list : taasmoutput;size : tcgsize;r : tregister;nr : longint);
       begin
         case size of
-          OS_8,OS_S8 :
-            begin
-              if target_info.alignment.paraalign = 2 then
-                list.concat(taicpu.op_reg(A_PUSH,S_W,makereg16(r)))
-              else
-                list.concat(taicpu.op_reg(A_PUSH,S_L,makereg32(r)));
-            end;
+          OS_8,OS_S8,
           OS_16,OS_S16:
             begin
               if target_info.alignment.paraalign = 2 then
-                list.concat(taicpu.op_reg(A_PUSH,S_W,r))
+                list.concat(taicpu.op_reg(A_PUSH,S_W,changeregsize(r,S_W)))
               else
-                list.concat(taicpu.op_reg(A_PUSH,S_L,makereg32(r)));
+                list.concat(taicpu.op_reg(A_PUSH,S_L,changeregsize(r,S_L)));
             end;
           OS_32,OS_S32:
             list.concat(taicpu.op_reg(A_PUSH,S_L,r));
@@ -198,12 +206,13 @@ unit cgcpu;
 
       begin
         case size of
-          OS_8,OS_S8,OS_16,OS_S16:
+          OS_8,OS_S8,
+          OS_16,OS_S16:
             begin
               tmpreg := get_scratch_reg(list);
               a_load_ref_reg(list,size,r,tmpreg);
               if target_info.alignment.paraalign = 2 then
-                list.concat(taicpu.op_reg(A_PUSH,S_W,makereg16(tmpreg)))
+                list.concat(taicpu.op_reg(A_PUSH,S_W,changeregsize(tmpreg,S_W)))
               else
                 list.concat(taicpu.op_reg(A_PUSH,S_L,tmpreg));
               free_scratch_reg(list,tmpreg);
@@ -241,8 +250,7 @@ unit cgcpu;
           end;
       end;
 
-    procedure tcg386.a_call_name(list : taasmoutput;const s : string;
-      offset : longint);
+    procedure tcg386.a_call_name(list : taasmoutput;const s : string; offset : longint);
 
       begin
         list.concat(taicpu.op_sym_ofs(A_CALL,S_NO,newasmsymbol(s),offset));
@@ -257,8 +265,7 @@ unit cgcpu;
       begin
         { the optimizer will change it to "xor reg,reg" when loading zero, }
         { no need to do it here too (JM)                                   }
-        list.concat(taicpu.op_const_reg(A_MOV,TCGSize2OpSize[size],
-          a,reg))
+        list.concat(taicpu.op_const_reg(A_MOV,TCGSize2OpSize[size],a,reg))
       end;
 
 
@@ -275,8 +282,7 @@ unit cgcpu;
           inherited a_load_const_ref(list,size,a,ref)
         else
 {$endif OPTLOAD0}
-          list.concat(taicpu.op_const_ref(A_MOV,TCGSize2OpSize[size],
-            a,ref));
+          list.concat(taicpu.op_const_ref(A_MOV,TCGSize2OpSize[size],a,ref));
       end;
 
 
@@ -295,7 +301,7 @@ unit cgcpu;
         s: topsize;
 
       begin
-        sizes2load(size,regsize(reg),op,s);
+        sizes2load(size,reg2opsize[reg],op,s);
         list.concat(taicpu.op_ref_reg(op,s,ref,reg));
       end;
 
@@ -307,8 +313,8 @@ unit cgcpu;
         s: topsize;
 
       begin
-        sizes2load(size,regsize(reg2),op,s);
-        if (makereg32(reg1) = makereg32(reg2)) then
+        sizes2load(size,reg2opsize[reg2],op,s);
+        if (changeregsize(reg1,S_L) = changeregsize(reg2,S_L)) then
          begin
            { "mov reg1, reg1" doesn't make sense }
            if op = A_MOV then
@@ -319,12 +325,12 @@ unit cgcpu;
               case size of
                 OS_8:
                   begin
-                    list.concat(taicpu.op_const_reg(A_AND,regsize(reg2),255,reg2));
+                    list.concat(taicpu.op_const_reg(A_AND,reg2opsize[reg2],255,reg2));
                     exit;
                   end;
                 OS_16:
                   begin
-                    list.concat(taicpu.op_const_reg(A_AND,regsize(reg2),65535,reg2));
+                    list.concat(taicpu.op_const_reg(A_AND,reg2opsize[reg2],65535,reg2));
                     exit;
                   end;
               end;
@@ -418,7 +424,7 @@ unit cgcpu;
                     OP_IDIV:
                       opcode := A_SAR;
                   end;
-                  list.concat(taicpu.op_const_reg(opcode,regsize(reg),power,
+                  list.concat(taicpu.op_const_reg(opcode,reg2opsize[reg],power,
                     reg));
                   exit;
                 end;
@@ -431,12 +437,12 @@ unit cgcpu;
               if not(cs_check_overflow in aktlocalswitches) and
                  ispowerof2(a,power) then
                 begin
-                  list.concat(taicpu.op_const_reg(A_SHL,regsize(reg),power,
+                  list.concat(taicpu.op_const_reg(A_SHL,reg2opsize[reg],power,
                     reg));
                   exit;
                 end;
               if op = OP_IMUL then
-                list.concat(taicpu.op_const_reg(A_IMUL,regsize(reg),
+                list.concat(taicpu.op_const_reg(A_IMUL,reg2opsize[reg],
                   a,reg))
               else
                 { OP_MUL should be handled specifically in the code        }
@@ -448,14 +454,14 @@ unit cgcpu;
                (a = 1) and
                (op in [OP_ADD,OP_SUB]) then
               if op = OP_ADD then
-                list.concat(taicpu.op_reg(A_INC,regsize(reg),reg))
+                list.concat(taicpu.op_reg(A_INC,reg2opsize[reg],reg))
               else
-                list.concat(taicpu.op_reg(A_DEC,regsize(reg),reg))
+                list.concat(taicpu.op_reg(A_DEC,reg2opsize[reg],reg))
             else if (a = 0) then
               if (op <> OP_AND) then
                 exit
               else
-                list.concat(taicpu.op_const_reg(A_MOV,regsize(reg),0,reg))
+                list.concat(taicpu.op_const_reg(A_MOV,reg2opsize[reg],0,reg))
             else if (a = high(aword)) and
                     (op in [OP_AND,OP_OR,OP_XOR]) then
                    begin
@@ -463,19 +469,19 @@ unit cgcpu;
                        OP_AND:
                          exit;
                        OP_OR:
-                         list.concat(taicpu.op_const_reg(A_MOV,regsize(reg),high(aword),reg));
+                         list.concat(taicpu.op_const_reg(A_MOV,reg2opsize[reg],high(aword),reg));
                        OP_XOR:
-                         list.concat(taicpu.op_reg(A_NOT,regsize(reg),reg));
+                         list.concat(taicpu.op_reg(A_NOT,reg2opsize[reg],reg));
                      end
                    end
             else
-              list.concat(taicpu.op_const_reg(TOpCG2AsmOp[op],regsize(reg),
+              list.concat(taicpu.op_const_reg(TOpCG2AsmOp[op],reg2opsize[reg],
                 a,reg));
           OP_SHL,OP_SHR,OP_SAR:
             begin
               if (a and 31) <> 0 Then
                 list.concat(taicpu.op_const_reg(
-                  TOpCG2AsmOp[op],regsize(reg),a and 31,reg));
+                  TOpCG2AsmOp[op],reg2opsize[reg],a and 31,reg));
               if (a shr 5) <> 0 Then
                 internalerror(68991);
             end
@@ -596,7 +602,7 @@ unit cgcpu;
                 { is ecx, save it to a temp for now                         }
                 if dst in [R_ECX,R_CX,R_CL] then
                   begin
-                    case regsize(dst) of
+                    case reg2opsize[dst] of
                       S_B: regloadsize := OS_8;
                       S_W: regloadsize := OS_16;
                       else regloadsize := OS_32;
@@ -617,7 +623,7 @@ unit cgcpu;
                         list.concat(taicpu.op_reg(A_PUSH,S_L,R_ECX));
                         popecx := true;
                       end;
-                    a_load_reg_reg(list,OS_8,makereg8(src),R_CL);
+                    a_load_reg_reg(list,OS_8,changeregsize(src,S_B),R_CL);
                   end
                 else
                   src := R_CL;
@@ -640,7 +646,7 @@ unit cgcpu;
               end;
             else
               begin
-                if regsize(src) <> dstsize then
+                if reg2opsize[src] <> dstsize then
                   internalerror(200109226);
                 list.concat(taicpu.op_reg_reg(TOpCG2AsmOp[op],dstsize,
                   src,dst));
@@ -711,7 +717,7 @@ unit cgcpu;
         power: longint;
         opsize: topsize;
       begin
-        opsize := regsize(src);
+        opsize := reg2opsize[src];
         if (opsize <> S_L) or
            not (size in [OS_32,OS_S32]) then
           begin
@@ -754,9 +760,9 @@ unit cgcpu;
         tmpref: treference;
         opsize: topsize;
       begin
-        opsize := regsize(src1);
+        opsize := reg2opsize[src1];
         if (opsize <> S_L) or
-           (regsize(src2) <> S_L) or
+           (reg2opsize[src2] <> S_L) or
            not (size in [OS_32,OS_S32]) then
           begin
             inherited a_op_reg_reg_reg(list,op,size,src1,src2,dst);
@@ -789,9 +795,9 @@ unit cgcpu;
 
         begin
           if (a = 0) then
-            list.concat(taicpu.op_reg_reg(A_TEST,regsize(reg),reg,reg))
+            list.concat(taicpu.op_reg_reg(A_TEST,reg2opsize[reg],reg,reg))
           else
-            list.concat(taicpu.op_const_reg(A_CMP,regsize(reg),a,reg));
+            list.concat(taicpu.op_const_reg(A_CMP,reg2opsize[reg],a,reg));
           a_jmp_cond(list,cmp_op,l);
         end;
 
@@ -807,9 +813,9 @@ unit cgcpu;
         reg1,reg2 : tregister;l : tasmlabel);
 
         begin
-          if regsize(reg1) <> regsize(reg2) then
+          if reg2opsize[reg1] <> reg2opsize[reg2] then
             internalerror(200109226);
-          list.concat(taicpu.op_reg_reg(A_CMP,regsize(reg1),reg1,reg2));
+          list.concat(taicpu.op_reg_reg(A_CMP,reg2opsize[reg1],reg1,reg2));
           a_jmp_cond(list,cmp_op,l);
         end;
 
@@ -857,17 +863,12 @@ unit cgcpu;
          ai : taicpu;
          hreg : tregister;
        begin
-          hreg := makereg8(reg);
+          hreg := changeregsize(reg,S_B);
           ai:=Taicpu.Op_reg(A_Setcc,S_B,hreg);
           ai.SetCondition(flags_to_cond(f));
           list.concat(ai);
           if hreg<>reg then
-           begin
-             if reg in regset16bit then
-              emit_to_reg16(hreg)
-             else
-              emit_to_reg32(hreg);
-           end;
+           a_load_reg_reg(exprasmlist,OS_8,hreg,reg);
        end;
 
 
@@ -934,19 +935,16 @@ unit cgcpu;
             end;
           OS_8,OS_S8:
             begin
-              reg := makereg8(reg);
               result := S_B;
             end;
           OS_16,OS_S16:
             begin
-              if reg in [R_AL..R_BH] then
-                internalerror(2001092314);
-              reg := makereg16(reg);
               result := S_W;
             end;
           else
             internalerror(2001092312);
         end;
+        reg := changeregsize(reg,result);
       end;
 
 
@@ -1085,13 +1083,13 @@ unit cgcpu;
       const
         regsize_2_cgsize: array[S_B..S_L] of tcgsize = (OS_8,OS_16,OS_32);
       begin
-        result := regsize_2_cgsize[regsize(reg)];
+        result := regsize_2_cgsize[reg2opsize[reg]];
       end;
 
 
 {***************** This is private property, keep out! :) *****************}
 
-    procedure tcg386.sizes2load(s1: tcgsize; s2: topsize; var op: tasmop; var s3: topsize);
+    procedure tcg386.sizes2load(s1 : tcgsize;s2: topsize; var op: tasmop; var s3: topsize);
 
        begin
          case s2 of
@@ -1220,7 +1218,15 @@ begin
 end.
 {
   $Log$
-  Revision 1.11  2002-04-04 19:06:10  peter
+  Revision 1.12  2002-04-15 19:44:20  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.11  2002/04/04 19:06:10  peter
     * removed unused units
     * use tlocation.size in cg.a_*loc*() routines
 

+ 10 - 2
compiler/i386/cpuasm.pas

@@ -636,7 +636,7 @@ begin
     begin
       case typ of
         top_reg :
-          ot:=reg_2_type[reg];
+          ot:=reg2type[reg];
         top_ref :
           begin
           { create ot field }
@@ -1680,7 +1680,15 @@ end;
 end.
 {
   $Log$
-  Revision 1.19  2002-04-15 19:12:09  carl
+  Revision 1.20  2002-04-15 19:44:20  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.19  2002/04/15 19:12:09  carl
   + target_info.size_of_pointer -> pointer_size
   + some cleanup of unused types/variables
   * move several constants from cpubase to their specific units

+ 157 - 80
compiler/i386/cpubase.pas

@@ -204,9 +204,6 @@ Const
   lastop  = high(tasmop);
 
 
-
-
-
 {*****************************************************************************
                                 Operand Sizes
 *****************************************************************************}
@@ -267,13 +264,25 @@ const
     C_S,C_Z,C_NO,C_NP,C_NP,C_P,C_NS,C_NZ
   );
 
+<<<<<<< cpubase.pas
+const
+  CondAsmOps=3;
+  CondAsmOp:array[0..CondAsmOps-1] of TasmOp=(
+    A_CMOVcc, A_Jcc, A_SETcc
+  );
+  CondAsmOpStr:array[0..CondAsmOps-1] of string[4]=(
+    'CMOV','J','SET'
+  );
+=======
+>>>>>>> 1.14
+
 
 {*****************************************************************************
                                   Registers
 *****************************************************************************}
 
 type
-  {# Enumeration for all possible registers for cpu. It 
+  {# Enumeration for all possible registers for cpu. It
     is to note that all registers of the same type
     (for example all FPU registers), should be grouped
     together.
@@ -311,7 +320,42 @@ const
   regset8bit  : tregisterset = [R_AL..R_DH];
   regset16bit : tregisterset = [R_AX..R_DI,R_CS..R_SS];
   regset32bit : tregisterset = [R_EAX..R_EDI];
+<<<<<<< cpubase.pas
+
+  { Convert reg to opsize }
+  reg2opsize : array[firstreg..lastreg] of topsize = (S_NO,
+    S_L,S_L,S_L,S_L,S_L,S_L,S_L,S_L,
+    S_W,S_W,S_W,S_W,S_W,S_W,S_W,S_W,
+    S_B,S_B,S_B,S_B,S_B,S_B,S_B,S_B,
+    S_W,S_W,S_W,S_W,S_W,S_W,
+    S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,S_FL,
+    S_L,S_L,S_L,S_L,S_L,S_L,
+    S_L,S_L,S_L,S_L,
+    S_L,S_L,S_L,S_L,S_L,
+    S_D,S_D,S_D,S_D,S_D,S_D,S_D,S_D,
+    S_D,S_D,S_D,S_D,S_D,S_D,S_D,S_D
+  );
+=======
+>>>>>>> 1.14
+
+<<<<<<< cpubase.pas
+  { Convert reg to operand type }
+  reg2type : array[firstreg..lastreg] of longint = (OT_NONE,
+    OT_REG_EAX,OT_REG_ECX,OT_REG32,OT_REG32,OT_REG32,OT_REG32,OT_REG32,OT_REG32,
+    OT_REG_AX,OT_REG_CX,OT_REG_DX,OT_REG16,OT_REG16,OT_REG16,OT_REG16,OT_REG16,
+    OT_REG_AL,OT_REG_CL,OT_REG8,OT_REG8,OT_REG8,OT_REG8,OT_REG8,OT_REG8,
+    OT_REG_CS,OT_REG_DESS,OT_REG_DESS,OT_REG_DESS,OT_REG_FSGS,OT_REG_FSGS,
+    OT_FPU0,OT_FPU0,OT_FPUREG,OT_FPUREG,OT_FPUREG,OT_FPUREG,OT_FPUREG,OT_FPUREG,OT_FPUREG,
+    OT_REG_DREG,OT_REG_DREG,OT_REG_DREG,OT_REG_DREG,OT_REG_DREG,OT_REG_DREG,
+    OT_REG_CREG,OT_REG_CREG,OT_REG_CREG,OT_REG_CR4,
+    OT_REG_TREG,OT_REG_TREG,OT_REG_TREG,OT_REG_TREG,OT_REG_TREG,
+    OT_MMXREG,OT_MMXREG,OT_MMXREG,OT_MMXREG,OT_MMXREG,OT_MMXREG,OT_MMXREG,OT_MMXREG,
+    OT_XMMREG,OT_XMMREG,OT_XMMREG,OT_XMMREG,OT_XMMREG,OT_XMMREG,OT_XMMREG,OT_XMMREG
+  );
 
+{$ifdef INTELOP}
+  int_reg2str : reg2strtable = ('',
+=======
   {# Standard opcode string table (for each tasmop enumeration). The
      opcode strings should conform to the names as defined by the
      processor manufacturer.
@@ -323,6 +367,7 @@ const
      by the processor manufacturer
   }
   std_reg2str : reg2strtable = ('',
+>>>>>>> 1.14
     'eax','ecx','edx','ebx','esp','ebp','esi','edi',
     'ax','cx','dx','bx','sp','bp','si','di',
     'al','cl','dl','bl','ah','ch','bh','dh',
@@ -509,11 +554,49 @@ const
   pointer_size  = 4;
   extended_size = 10;
   mmreg_size = 8;
+<<<<<<< cpubase.pas
+  sizepostfix_pointer = S_L;
 
 
+{*****************************************************************************
+                              Instruction table
+*****************************************************************************}
+=======
+>>>>>>> 1.14
+
+<<<<<<< cpubase.pas
+{$ifndef NOAG386BIN}
+type
+  tinsentry=packed record
+    opcode  : tasmop;
+    ops     : byte;
+    optypes : array[0..2] of longint;
+    code    : array[0..maxinfolen] of char;
+    flags   : longint;
+  end;
+  pinsentry=^tinsentry;
+=======
+>>>>>>> 1.14
+
+<<<<<<< cpubase.pas
+  TInsTabCache=array[TasmOp] of longint;
+  PInsTabCache=^TInsTabCache;
+=======
+>>>>>>> 1.14
+
+<<<<<<< cpubase.pas
+const
+  InsTab:array[0..instabentries-1] of TInsEntry=
+{$i i386tab.inc}
+
+var
+  InsTabCache : PInsTabCache;
+{$endif NOAG386BIN}
 
+=======
   procedure InitCpu;
   procedure DoneCpu;
+>>>>>>> 1.14
 
 {*****************************************************************************
                    Opcode propeties (needed for optimizer)
@@ -572,6 +655,9 @@ const
        maxintregs = maxvarregs;
        maxfpuregs = maxfpuvarregs;
 
+<<<<<<< cpubase.pas
+    function imm_2_type(l:longint):longint;
+=======
     { the following functions allow to convert registers }
     { for example reg8toreg32(R_AL) returns R_EAX        }
     { for example reg16toreg32(R_AL) gives an undefined  }
@@ -589,12 +675,11 @@ const
     function regtoreg8(reg : tregister) : tregister;
     function regtoreg16(reg : tregister) : tregister;
     function regtoreg32(reg : tregister) : tregister;
+>>>>>>> 1.14
 
-    { can be ignored on 32 bit systems }
-    function regtoreg64(reg : tregister) : tregister;
+    function changeregsize(r:tregister;size:topsize):tregister;
 
-    { returns the operand prefix for a given register }
-    function regsize(reg : tregister) : topsize;
+    function reg2str(r : tregister) : string;
 
     function is_calljmp(o:tasmop):boolean;
 
@@ -610,6 +695,44 @@ implementation
 {$endif heaptrc}
       verbose;
 
+  const
+    reg2reg32 : array[tregister] of tregister = (R_NO,
+      R_EAX,R_ECX,R_EDX,R_EBX,R_ESP,R_EBP,R_ESI,R_EDI,
+      R_EAX,R_ECX,R_EDX,R_EBX,R_ESP,R_EBP,R_ESI,R_EDI,
+      R_EAX,R_ECX,R_EDX,R_EBX,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO
+    );
+    reg2reg16 : array[tregister] of tregister = (R_NO,
+      R_AX,R_CX,R_DX,R_BX,R_SP,R_BP,R_SI,R_DI,
+      R_AX,R_CX,R_DX,R_BX,R_SP,R_BP,R_SI,R_DI,
+      R_AX,R_CX,R_DX,R_BX,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO
+    );
+    reg2reg8 : array[tregister] of tregister = (R_NO,
+      R_AL,R_CL,R_DL,R_BL,R_NO,R_NO,R_NO,R_NO,
+      R_AL,R_CL,R_DL,R_BL,R_NO,R_NO,R_NO,R_NO,
+      R_AL,R_CL,R_DL,R_BL,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,
+      R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO,R_NO
+    );
+
 {*****************************************************************************
                                   Helpers
 *****************************************************************************}
@@ -635,77 +758,23 @@ implementation
       end;
 
 
-    function reg8toreg16(reg : tregister) : tregister;
-
-      begin
-         reg8toreg16:=reg32toreg16(reg8toreg32(reg));
-      end;
-
-    function reg16toreg8(reg : tregister) : tregister;
-
-      begin
-         reg16toreg8:=reg32toreg8(reg16toreg32(reg));
-      end;
-
-    function reg16toreg32(reg : tregister) : tregister;
-
-      begin
-         reg16toreg32:=tregister(byte(reg)-byte(R_EDI));
-      end;
-
-    function reg32toreg16(reg : tregister) : tregister;
-
+    function changeregsize(r:tregister;size:topsize):tregister;
+      var
+        reg : tregister;
       begin
-         reg32toreg16:=tregister(byte(reg)+byte(R_EDI));
-      end;
-
-    function reg32toreg8(reg : tregister) : tregister;
-
-      begin
-         reg32toreg8:=tregister(byte(reg)+byte(R_DI));
-      end;
-
-    function reg8toreg32(reg : tregister) : tregister;
-
-      begin
-         reg8toreg32:=tregister(byte(reg)-byte(R_DI));
-      end;
-
-    function regtoreg8(reg : tregister) : tregister;
-
-     begin
-        regtoreg8:=reg32toreg8(reg);
-     end;
-
-    function regtoreg16(reg : tregister) : tregister;
-
-     begin
-        regtoreg16:=reg32toreg16(reg);
-     end;
-
-    function regtoreg32(reg : tregister) : tregister;
-
-     begin
-        regtoreg32:=reg;
-     end;
-
-    function regtoreg64(reg : tregister) : tregister;
-
-     begin
-        { to avoid warning }
-        regtoreg64:=R_NO;
-     end;
-
-    function regsize(reg : tregister) : topsize;
-      begin
-         if reg in regset8bit then
-           regsize:=S_B
-         else if reg in regset16bit then
-           regsize:=S_W
-         else if reg in regset32bit then
-           regsize:=S_L
-         else
-           internalerror(200203261);
+        case size of
+          S_B :
+            reg:=reg2reg8[r];
+          S_W :
+            reg:=reg2reg16[r];
+          S_L :
+            reg:=reg2reg32[r];
+          else
+            internalerror(200204101);
+        end;
+        if reg=R_NO then
+         internalerror(200204102);
+        changeregsize:=reg;
       end;
 
 
@@ -731,7 +800,7 @@ implementation
     procedure InitCpu;
      begin
      end;
-     
+
     procedure DoneCpu;
      begin
      end;
@@ -739,7 +808,15 @@ implementation
 end.
 {
   $Log$
-  Revision 1.14  2002-04-15 19:12:09  carl
+  Revision 1.15  2002-04-15 19:44:20  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.14  2002/04/15 19:12:09  carl
   + target_info.size_of_pointer -> pointer_size
   + some cleanup of unused types/variables
   * move several constants from cpubase to their specific units

+ 24 - 15
compiler/i386/csopt386.pas

@@ -41,7 +41,7 @@ Implementation
 
 Uses
   {$ifdef replaceregdebug}cutils,{$endif}
-  globtype, verbose, cgbase, globals, daopt386, rgobj, rropt386;
+  globtype, verbose, cgbase, globals, daopt386, cginfo, rgobj, rropt386;
 
 {
 Function TaiInSequence(P: Tai; Const Seq: TContent): Boolean;
@@ -821,11 +821,14 @@ begin
   changeReg := true;
   if reg = newReg then
     reg := orgReg
-  else if reg = regtoreg8(newReg) then
-         reg := regtoreg8(orgReg)
-  else if reg = regtoreg16(newReg) then
-         reg := regtoreg16(orgReg)
-  else changeReg := false;
+  else if (reg in regset8bit) and
+          (reg = Changeregsize(newReg,S_B)) then
+    reg := Changeregsize(orgReg,S_B)
+  else if (reg in regset16bit) and
+          (reg = Changeregsize(newReg,S_W)) then
+    reg := Changeregsize(orgReg,S_W)
+  else
+    changeReg := false;
 end;
 
 function changeOp(var o: toper; newReg, orgReg: tregister): boolean;
@@ -1382,9 +1385,9 @@ begin
             begin
               case t.opsize of
                 S_B,S_BW,S_BL:
-                  memtoreg := reg32toreg8(regcounter);
+                  memtoreg := Changeregsize(regcounter,S_B);
                 S_W,S_WL:
-                  memtoreg := reg32toreg16(regcounter);
+                  memtoreg := Changeregsize(regcounter,S_W);
                 S_L:
                   memtoreg := regcounter;
               end;
@@ -1812,9 +1815,8 @@ Begin
                                 begin
                                   hp1 := Tai_Marker.Create(NoPropInfoEnd);
                                   insertllitem(asml,p,p.next,hp1);
-                                  hp1 := taicpu.op_reg_ref(A_MOV,
-                                    regsize(regcounter),regcounter,
-                                    taicpu(p).oper[0].ref^);
+                                  hp1 := taicpu.op_reg_ref(A_MOV,reg2opsize[regcounter],
+                                     regcounter,taicpu(p).oper[0].ref^);
                                   new(pTaiprop(hp1.optinfo));
                                   pTaiProp(hp1.optinfo)^ := pTaiProp(p.optinfo)^;
                                   insertllitem(asml,p,p.next,hp1);
@@ -1865,9 +1867,8 @@ Begin
                                 begin
                                   hp1 := Tai_Marker.Create(NoPropInfoEnd);
                                   insertllitem(asml,p,p.next,hp1);
-                                  hp1 := taicpu.op_reg_ref(A_MOV,
-                                    regsize(regcounter),regcounter,
-                                    taicpu(p).oper[1].ref^);
+                                  hp1 := taicpu.op_reg_ref(A_MOV,reg2opsize[regcounter],
+                                    regcounter,taicpu(p).oper[1].ref^);
                                   new(pTaiprop(hp1.optinfo));
                                   pTaiProp(hp1.optinfo)^ := pTaiProp(p.optinfo)^;
                                   insertllitem(asml,p,p.next,hp1);
@@ -1983,7 +1984,15 @@ End.
 
 {
   $Log$
-  Revision 1.29  2002-04-15 19:12:09  carl
+  Revision 1.30  2002-04-15 19:44:20  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.29  2002/04/15 19:12:09  carl
   + target_info.size_of_pointer -> pointer_size
   + some cleanup of unused types/variables
   * move several constants from cpubase to their specific units

+ 29 - 21
compiler/i386/daopt386.pas

@@ -226,7 +226,7 @@ Var
 Implementation
 
 Uses
-  globals, systems, verbose, cgbase, symconst, symsym, tainst, rgobj;
+  globals, systems, verbose, cgbase, symconst, symsym, tainst, cginfo, rgobj;
 
 Type
   TRefCompare = function(const r1, r2: TReference): Boolean;
@@ -586,10 +586,10 @@ Begin
   If (Reg >= R_AX)
     Then
       If (Reg <= R_DI)
-        Then Reg32 := Reg16ToReg32(Reg)
+        Then Reg32 := ChangeRegsize(Reg,S_L)
         Else
           If (Reg <= R_BL)
-            Then Reg32 := Reg8toReg32(Reg);
+            Then Reg32 := ChangeRegsize(Reg,S_L);
 End;
 
 { inserts new_one between prev and foll }
@@ -641,37 +641,37 @@ Begin
       Case OldReg Of
         R_EAX..R_EDI:
           Begin
-            NewRegsEncountered := NewRegsEncountered + [Reg32toReg16(NewReg)];
-            OldRegsEncountered := OldRegsEncountered + [Reg32toReg16(OldReg)];
-            New2OldReg[Reg32toReg16(NewReg)] := Reg32toReg16(OldReg);
+            NewRegsEncountered := NewRegsEncountered + [ChangeRegsize(NewReg,S_W)];
+            OldRegsEncountered := OldRegsEncountered + [ChangeRegsize(OldReg,S_W)];
+            New2OldReg[Changeregsize(NewReg,S_W)] := Changeregsize(OldReg,S_W);
             If (NewReg in [R_EAX..R_EBX]) And
                (OldReg in [R_EAX..R_EBX]) Then
               Begin
-                NewRegsEncountered := NewRegsEncountered + [Reg32toReg8(NewReg)];
-                OldRegsEncountered := OldRegsEncountered + [Reg32toReg8(OldReg)];
-                New2OldReg[Reg32toReg8(NewReg)] := Reg32toReg8(OldReg);
+                NewRegsEncountered := NewRegsEncountered + [Changeregsize(NewReg,S_B)];
+                OldRegsEncountered := OldRegsEncountered + [Changeregsize(OldReg,S_B)];
+                New2OldReg[Changeregsize(NewReg,S_B)] := Changeregsize(OldReg,S_B);
               End;
           End;
         R_AX..R_DI:
           Begin
-            NewRegsEncountered := NewRegsEncountered + [Reg16toReg32(NewReg)];
-            OldRegsEncountered := OldRegsEncountered + [Reg16toReg32(OldReg)];
-            New2OldReg[Reg16toReg32(NewReg)] := Reg16toReg32(OldReg);
+            NewRegsEncountered := NewRegsEncountered + [Changeregsize(NewReg,S_L)];
+            OldRegsEncountered := OldRegsEncountered + [Changeregsize(OldReg,S_L)];
+            New2OldReg[Changeregsize(NewReg,S_L)] := Changeregsize(OldReg,S_L);
             If (NewReg in [R_AX..R_BX]) And
                (OldReg in [R_AX..R_BX]) Then
               Begin
-                NewRegsEncountered := NewRegsEncountered + [Reg16toReg8(NewReg)];
-                OldRegsEncountered := OldRegsEncountered + [Reg16toReg8(OldReg)];
-                New2OldReg[Reg16toReg8(NewReg)] := Reg16toReg8(OldReg);
+                NewRegsEncountered := NewRegsEncountered + [Changeregsize(NewReg,S_B)];
+                OldRegsEncountered := OldRegsEncountered + [Changeregsize(OldReg,S_B)];
+                New2OldReg[Changeregsize(NewReg,S_B)] := Changeregsize(OldReg,S_B);
               End;
           End;
         R_AL..R_BL:
           Begin
-            NewRegsEncountered := NewRegsEncountered + [Reg8toReg32(NewReg)]
-                               + [Reg8toReg16(NewReg)];
-            OldRegsEncountered := OldRegsEncountered + [Reg8toReg32(OldReg)]
-                               + [Reg8toReg16(OldReg)];
-            New2OldReg[Reg8toReg32(NewReg)] := Reg8toReg32(OldReg);
+            NewRegsEncountered := NewRegsEncountered + [Changeregsize(NewReg,S_L)]
+                               + [Changeregsize(NewReg,S_W)];
+            OldRegsEncountered := OldRegsEncountered + [Changeregsize(OldReg,S_L)]
+                               + [Changeregsize(OldReg,S_B)];
+            New2OldReg[Changeregsize(NewReg,S_L)] := Changeregsize(OldReg,S_L);
           End;
       End;
     End;
@@ -2586,7 +2586,15 @@ End.
 
 {
   $Log$
-  Revision 1.30  2002-04-15 19:12:09  carl
+  Revision 1.31  2002-04-15 19:44:20  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.30  2002/04/15 19:12:09  carl
   + target_info.size_of_pointer -> pointer_size
   + some cleanup of unused types/variables
   * move several constants from cpubase to their specific units

+ 97 - 147
compiler/i386/n386cal.pas

@@ -63,7 +63,7 @@ implementation
       cginfo,cgbase,pass_2,
       cpubase,
       nmem,nld,ncnv,
-      tainst,cga,cgobj,tgobj,n386ld,n386util,regvars,rgobj,rgcpu,cg64f32;
+      tainst,cga,cgobj,tgobj,n386ld,n386util,regvars,rgobj,rgcpu,cg64f32,cgcpu;
 
 {*****************************************************************************
                              TI386CALLPARANODE
@@ -90,7 +90,6 @@ implementation
          { temporary variables: }
          tempdeftype : tdeftype;
          href   : treference;
-         cgsize : tcgsize;
 
       begin
          { set default para_alignment to target_info.stackalignment }
@@ -151,16 +150,6 @@ implementation
                 end
               else
                 begin
-                   { get temp for constants }
-                   if left.location.loc=LOC_CONSTANT then
-                    begin
-                      cgsize:=def_cgsize(left.resulttype.def);
-                      tg.gettempofsizereference(exprasmlist,left.resulttype.def.size,href);
-                      cg.a_load_loc_ref(exprasmlist,left.location,href);
-                      location_reset(left.location,LOC_REFERENCE,cgsize);
-                      left.location.reference:=href;
-                    end;
-
                    if not(left.location.loc in [LOC_CREFERENCE,LOC_REFERENCE]) then
                      CGMessage(type_e_mismatch)
                    else
@@ -185,10 +174,9 @@ implementation
               { get temp for constants }
               if left.location.loc=LOC_CONSTANT then
                begin
-                 cgsize:=def_cgsize(left.resulttype.def);
                  tg.gettempofsizereference(exprasmlist,left.resulttype.def.size,href);
                  cg.a_load_loc_ref(exprasmlist,left.location,href);
-                 location_reset(left.location,LOC_REFERENCE,cgsize);
+                 location_reset(left.location,LOC_REFERENCE,def_cgsize(left.resulttype.def));
                  left.location.reference:=href;
                end;
 
@@ -321,6 +309,7 @@ implementation
          store_parast_fixup,
          para_alignment,
          para_offset : longint;
+         cgsize : tcgsize;
          { instruction for alignement correction }
 {        corr : paicpu;}
          { we must pop this size also after !! }
@@ -331,14 +320,12 @@ implementation
          push_size : longint;
 {$endif OPTALIGN}
          pop_allowed : boolean;
-         cgsize : tcgsize;
          constructorfailed : tasmlabel;
 
       label
          dont_call;
 
       begin
-         location_reset(location,LOC_REFERENCE,def_cgsize(resulttype.def));
          extended_new:=false;
          iolabel:=nil;
          inlinecode:=nil;
@@ -573,7 +560,7 @@ implementation
                 begin
                    { dirty trick to avoid the secondcall below }
                    methodpointer:=ccallparanode.create(nil,nil);
-                   methodpointer.location.loc:=LOC_REGISTER;
+                   location_reset(methodpointer.location,LOC_REGISTER,OS_ADDR);
                    rg.getexplicitregisterint(exprasmlist,R_ESI);
                    methodpointer.location.register:=R_ESI;
                    { ARGHHH this is wrong !!!
@@ -1149,136 +1136,95 @@ implementation
            end;
 
          { handle function results }
-         { structured results are easy to handle.... }
-         { needed also when result_no_used !! }
-         if (not is_void(resulttype.def)) and ret_in_param(resulttype.def) then
-           begin
-              location.loc:=LOC_CREFERENCE;
-              location.reference.symbol:=nil;
-              location.reference:=funcretref;
-           end;
-         { we have only to handle the result if it is used, but }
-         { ansi/widestrings must be registered, so we can dispose them }
-         if (not is_void(resulttype.def)) and ((nf_return_value_used in flags) or
-           is_ansistring(resulttype.def) or is_widestring(resulttype.def)) then
-           begin
-              { a contructor could be a function with boolean result }
-              if (inlined or
-                  (right=nil)) and
-                 (procdefinition.proctypeoption=potype_constructor) and
-                 { quick'n'dirty check if it is a class or an object }
-                 (resulttype.def.deftype=orddef) then
-                begin
-                   if extended_new then
-                     begin
-{$ifdef test_dest_loc}
-                        if dest_loc_known and (dest_loc_tree=p) then
-                          mov_reg_to_dest(p,S_L,R_EAX)
-                        else
-{$endif test_dest_loc}
+         if (not is_void(resulttype.def)) then
+          begin
+            { structured results are easy to handle.... }
+            { needed also when result_no_used !! }
+            if ret_in_param(resulttype.def) then
+             begin
+               location_reset(location,LOC_CREFERENCE,def_cgsize(resulttype.def));
+               location.reference.symbol:=nil;
+               location.reference:=funcretref;
+             end
+            else
+            { ansi/widestrings must be registered, so we can dispose them }
+             if is_ansistring(resulttype.def) or
+                is_widestring(resulttype.def) then
+              begin
+                location_reset(location,LOC_CREFERENCE,OS_ADDR);
+                location.reference:=refcountedtemp;
+                cg.a_reg_alloc(exprasmlist,accumulator);
+                cg.a_load_reg_ref(exprasmlist,OS_ADDR,accumulator,location.reference);
+                cg.a_reg_dealloc(exprasmlist,accumulator);
+              end
+            else
+            { we have only to handle the result if it is used }
+             if (nf_return_value_used in flags) then
+              begin
+                case resulttype.def.deftype of
+                  enumdef,
+                  orddef :
+                    begin
+                      cgsize:=def_cgsize(resulttype.def);
+                      { an object constructor is a function with boolean result }
+                      if (inlined or (right=nil)) and
+                         (procdefinition.proctypeoption=potype_constructor) then
+                       begin
+                         if extended_new then
+                          cgsize:=OS_INT
+                         else
                           begin
-                             cg.a_reg_alloc(exprasmlist,R_EAX);
-                             hregister:=rg.getexplicitregisterint(exprasmlist,R_EAX);
-                             emit_reg_reg(A_MOV,S_L,R_EAX,hregister);
-                             location_reset(location,LOC_REGISTER,OS_NO);
-                             location.register:=hregister;
+                            cgsize:=OS_NO;
+                            { this fails if popsize > 0 PM }
+                            location_reset(location,LOC_FLAGS,OS_NO);
+                            location.resflags:=F_NE;
                           end;
-                     end
-                   else
-                     begin
-                       { this fails if popsize > 0 PM }
-                       location_reset(location,LOC_FLAGS,OS_NO);
-                       location.resflags:=F_NE;
-                     end;
-                end
-               { structed results are easy to handle.... }
-              else if ret_in_param(resulttype.def) then
-                begin
-                   {location.loc:=LOC_MEM;
-                   stringdispose(location.reference.symbol);
-                   location.reference:=funcretref;
-                   already done above (PM) }
-                end
-              else
-                begin
-                   if (resulttype.def.deftype in [orddef,enumdef]) then
-                     begin
-                        cg.a_reg_alloc(exprasmlist,R_EAX);
-                        cgsize:=def_cgsize(resulttype.def);
-                        location_reset(location,LOC_REGISTER,cgsize);
-                        if cgsize in [OS_64,OS_S64] then
-                         begin
-                           cg.a_reg_alloc(exprasmlist,R_EDX);
-                           if R_EDX in rg.unusedregsint then
-                             begin
-                                location.registerhigh:=rg.getexplicitregisterint(exprasmlist,R_EDX);
-                                location.registerlow:=rg.getexplicitregisterint(exprasmlist,R_EAX);
-                             end
-                           else
-                             begin
-                                location.registerhigh:=rg.getexplicitregisterint(exprasmlist,R_EDX);
-                                location.registerlow:=rg.getexplicitregisterint(exprasmlist,R_EAX);
-                             end;
-                           tcg64f32(cg).a_load64_reg_reg(exprasmlist,R_EAX,R_EDX,location.registerlow,location.registerhigh);
-                         end
-                        else
-                         begin
-                           location.register:=rg.getexplicitregisterint(exprasmlist,R_EAX);
-                           case cgsize of
-                             OS_8,OS_S8 :
-                               begin
-                                 hregister:=R_AL;
-                                 location.register:=makereg8(location.register);
-                               end;
-                             OS_16,OS_S16 :
-                               begin
-                                 hregister:=R_AX;
-                                 location.register:=makereg16(location.register);
-                               end;
-                             OS_32,OS_S32 :
-                               hregister:=R_EAX;
-                             else
-                               internalerror(200203281);
-                           end;
-{$ifdef test_dest_loc}
-{$error Don't know what to do here}
-                               if dest_loc_known and (dest_loc_tree=p) then
-                                 mov_reg_to_dest(p,S_L,R_EAX)
-{$endif test_dest_loc}
-                           cg.a_load_reg_reg(exprasmlist,cgsize,hregister,location.register);
-                         end
-                     end
-              else if (resulttype.def.deftype=floatdef) then
-                begin
-                  location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
-                  location.register:=R_ST;
-                  inc(trgcpu(rg).fpuvaroffset);
-                end
-              else if is_ansistring(resulttype.def) or
-                      is_widestring(resulttype.def) then
-                begin
-                   location_reset(location,LOC_CREFERENCE,OS_ADDR);
-                   location.reference:=refcountedtemp;
-                   cg.a_reg_alloc(exprasmlist,R_EAX);
-                   cg.a_load_reg_ref(exprasmlist,OS_ADDR,R_EAX,location.reference);
-                   cg.a_reg_dealloc(exprasmlist,R_EAX);
-                end
-              else
-                begin
-                   location_reset(location,LOC_REGISTER,OS_INT);
-{$ifdef test_dest_loc}
-                   if dest_loc_known and (dest_loc_tree=p) then
-                     mov_reg_to_dest(p,S_L,R_EAX)
-                   else
-{$endif test_dest_loc}
+                       end;
+
+                      if cgsize<>OS_NO then
+                       begin
+                         location_reset(location,LOC_REGISTER,cgsize);
+                         cg.a_reg_alloc(exprasmlist,accumulator);
+                         if cgsize in [OS_64,OS_S64] then
+                          begin
+                            cg.a_reg_alloc(exprasmlist,accumulatorhigh);
+                            if accumulatorhigh in rg.unusedregsint then
+                              begin
+                                 location.registerhigh:=rg.getexplicitregisterint(exprasmlist,accumulatorhigh);
+                                 location.registerlow:=rg.getexplicitregisterint(exprasmlist,accumulator);
+                              end
+                            else
+                              begin
+                                 location.registerhigh:=rg.getexplicitregisterint(exprasmlist,accumulatorhigh);
+                                 location.registerlow:=rg.getexplicitregisterint(exprasmlist,accumulator);
+                              end;
+                            tcg64f32(cg).a_load64_reg_reg(exprasmlist,accumulator,accumulatorhigh,
+                                location.registerlow,location.registerhigh);
+                          end
+                         else
+                          begin
+                            location.register:=rg.getexplicitregisterint(exprasmlist,accumulator);
+                            hregister:=changeregsize(accumulator,TCGSize2Opsize[cgsize]);
+                            location.register:=changeregsize(location.register,TCGSize2Opsize[cgsize]);
+                            cg.a_load_reg_reg(exprasmlist,cgsize,hregister,location.register);
+                          end;
+                       end;
+                    end;
+                  floatdef :
+                    begin
+                      location_reset(location,LOC_FPUREGISTER,def_cgsize(resulttype.def));
+                      location.register:=R_ST;
+                      inc(trgcpu(rg).fpuvaroffset);
+                    end;
+                  else
                     begin
-                       cg.a_reg_alloc(exprasmlist,R_EAX);
-                       location.register:=rg.getexplicitregisterint(exprasmlist,R_EAX);
-                       cg.a_load_reg_reg(exprasmlist,OS_INT,R_EAX,location.register);
+                      location_reset(location,LOC_REGISTER,OS_INT);
+                      location.register:=rg.getexplicitregisterint(exprasmlist,accumulator);
+                      cg.a_load_reg_reg(exprasmlist,OS_INT,accumulator,location.register);
                     end;
                 end;
              end;
-           end;
+          end;
 
          { perhaps i/o check ? }
          if iolabel<>nil then
@@ -1397,11 +1343,7 @@ implementation
                   for i := 1 to maxvarregs do
                     if assigned(regvars[i]) then
                       begin
-                        case regsize(regvars[i].reg) of
-                          S_B: tmpreg := reg8toreg32(regvars[i].reg);
-                          S_W: tmpreg := reg16toreg32(regvars[i].reg);
-                          S_L: tmpreg := regvars[i].reg;
-                        end;
+                        tmpreg:=changeregsize(regvars[i].reg,S_L);
                         rg.makeregvar(tmpreg);
                       end;
             end;
@@ -1535,7 +1477,15 @@ begin
 end.
 {
   $Log$
-  Revision 1.44  2002-04-04 19:06:10  peter
+  Revision 1.45  2002-04-15 19:44:21  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.44  2002/04/04 19:06:10  peter
     * removed unused units
     * use tlocation.size in cg.a_*loc*() routines
 

+ 30 - 79
compiler/i386/n386cnv.pas

@@ -72,48 +72,19 @@ implementation
 
     procedure ti386typeconvnode.second_int_to_int;
       var
-        newsize,
-        oldsize    : tcgsize;
+        newsize : tcgsize;
       begin
         newsize:=def_cgsize(resulttype.def);
-        oldsize:=def_cgsize(left.resulttype.def);
 
         { insert range check if not explicit conversion }
         if not(nf_explizit in flags) then
           cg.g_rangecheck(exprasmlist,left,resulttype.def);
 
         { is the result size smaller ? }
-        if resulttype.def.size<left.resulttype.def.size then
+        if resulttype.def.size<>left.resulttype.def.size then
           begin
             { reuse the left location by default }
             location_copy(location,left.location);
-            location.size:=newsize;
-
-            { update the register to use }
-            if (location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
-             begin
-               if oldsize in [OS_64,OS_S64] then
-                begin
-                  { we can release the upper register }
-                  rg.ungetregisterint(exprasmlist,location.registerhigh);
-                  location.registerhigh:=R_NO;
-                end;
-               case newsize of
-                 OS_8,OS_S8 :
-                   location.register:=makereg8(location.register);
-                 OS_16,OS_S16 :
-                   location.register:=makereg16(location.register);
-                 OS_32,OS_S32 :
-                   location.register:=makereg32(location.register);
-               end;
-             end;
-          end
-
-        { is the result size bigger ? }
-        else if resulttype.def.size>left.resulttype.def.size then
-          begin
-            { we need to load the value in a register }
-            location_copy(location,left.location);
             location_force_reg(location,newsize,false);
           end
         else
@@ -251,9 +222,8 @@ implementation
     procedure ti386typeconvnode.second_int_to_bool;
       var
         hregister : tregister;
-        leftopsize,
-        opsize    : topsize;
         pref      : treference;
+        resflags  : tresflags;
         hlabel,oldtruelabel,oldfalselabel : tasmlabel;
       begin
          oldtruelabel:=truelabel;
@@ -274,15 +244,15 @@ implementation
               falselabel:=oldfalselabel;
               exit;
            end;
-         location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def));
-         location_release(exprasmlist,left.location);
 
-         opsize:=def_opsize(resulttype.def);
-         leftopsize:=def_opsize(left.resulttype.def);
+         { Load left node into flag F_NE/F_E }
+         resflags:=F_NE;
+         location_release(exprasmlist,left.location);
          case left.location.loc of
-            LOC_CREFERENCE,LOC_REFERENCE :
+            LOC_CREFERENCE,
+            LOC_REFERENCE :
               begin
-                if is_64bitint(left.resulttype.def) then
+                if left.location.size in [OS_64,OS_S64] then
                  begin
                    hregister:=rg.getregisterint(exprasmlist);
                    emit_ref_reg(A_MOV,S_L,left.location.reference,hregister);
@@ -292,60 +262,37 @@ implementation
                  end
                 else
                  begin
-                   hregister:=def_getreg(left.resulttype.def);
-                   emit_ref_reg(A_MOV,leftopsize,left.location.reference,hregister);
-                 end;
-              end;
-            LOC_CONSTANT :
-              begin
-                if is_64bitint(left.resulttype.def) then
-                 begin
-                   hregister:=def_getreg(left.resulttype.def);
-                   emit_const_reg(A_MOV,S_L,left.location.valuelow,hregister);
-                   emit_const_reg(A_OR,S_L,left.location.valuehigh,hregister);
-                 end
-                else
-                 begin
-                   hregister:=def_getreg(left.resulttype.def);
-                   emit_const_reg(A_MOV,leftopsize,left.location.value,hregister);
+                   location_force_reg(left.location,left.location.size,true);
+                   cg.a_op_reg_reg(exprasmlist,OP_OR,left.location.size,left.location.register,left.location.register);
                  end;
               end;
             LOC_FLAGS :
               begin
-                hregister:=def_getreg(left.resulttype.def);
-                emit_flag2reg(left.location.resflags,hregister);
+                resflags:=left.location.resflags;
               end;
             LOC_REGISTER,LOC_CREGISTER :
               begin
-                hregister:=left.location.register;
+                cg.a_op_reg_reg(exprasmlist,OP_OR,left.location.size,left.location.register,left.location.register);
               end;
             LOC_JUMP :
               begin
-                hregister:=def_getreg(left.resulttype.def);
+                hregister:=rg.getregisterint(exprasmlist);
                 getlabel(hlabel);
                 cg.a_label(exprasmlist,truelabel);
-                cg.a_load_const_reg(exprasmlist,def_cgsize(left.resulttype.def),1,hregister);
+                cg.a_load_const_reg(exprasmlist,OS_INT,1,hregister);
                 cg.a_jmp_cond(exprasmlist,OC_NONE,hlabel);
                 cg.a_label(exprasmlist,falselabel);
-                cg.a_load_const_reg(exprasmlist,def_cgsize(left.resulttype.def),0,hregister);
+                cg.a_load_const_reg(exprasmlist,OS_INT,0,hregister);
                 cg.a_label(exprasmlist,hlabel);
+                cg.a_op_reg_reg(exprasmlist,OP_OR,OS_INT,hregister,hregister);
               end;
             else
               internalerror(10062);
          end;
-         emit_reg(A_NEG,leftopsize,hregister);
-         case opsize of
-           S_B :
-             location.register:=makereg8(hregister);
-           S_W :
-             location.register:=makereg16(hregister);
-           S_L :
-             location.register:=makereg32(hregister);
-           else
-            internalerror(10064);
-         end;
-         emit_reg_reg(A_SBB,opsize,location.register,location.register);
-         emit_reg(A_NEG,opsize,location.register);
+         { load flags to register }
+         location_reset(location,LOC_REGISTER,def_cgsize(resulttype.def));
+         location.register:=def_getreg(resulttype.def);
+         cg.g_flags2reg(exprasmlist,resflags,location.register);
          truelabel:=oldtruelabel;
          falselabel:=oldfalselabel;
        end;
@@ -468,7 +415,15 @@ begin
 end.
 {
   $Log$
-  Revision 1.33  2002-04-04 19:06:10  peter
+  Revision 1.34  2002-04-15 19:44:21  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.33  2002/04/04 19:06:10  peter
     * removed unused units
     * use tlocation.size in cg.a_*loc*() routines
 
@@ -549,11 +504,7 @@ end.
   Revision 1.21  2001/08/28 13:24:47  jonas
     + compilerproc implementation of most string-related type conversions
     - removed all code from the compiler which has been replaced by
-<<<<<<< n386cnv.pas
-      compilerproc implementations (using "$ifdef hascompilerproc" is not
-=======
       compilerproc implementations (using $ifdef hascompilerproc is not
->>>>>>> 1.30
       necessary in the compiler)
 
   Revision 1.20  2001/08/26 13:36:57  florian

+ 13 - 12
compiler/i386/n386inl.pas

@@ -469,21 +469,14 @@ implementation
                         { need a cmp and jmp, but this should be done by the         }
                         { type cast code which does range checking if necessary (FK) }
                         begin
-                          hregister := tcallparanode(tcallparanode(left).right).left.location.register;
-                          emit_to_reg32(hregister);
+                          hregister := changeregsize(tcallparanode(tcallparanode(left).right).left.location.register,S_L);
                         end
                       else
                         begin
-                           rg.getexplicitregisterint(exprasmlist,R_EDI);
-                           hregister:=R_EDI;
-                           opsize:=def2def_opsize(
-                             tcallparanode(tcallparanode(left).right).left.resulttype.def,u32bittype.def);
-                           if opsize = S_L then
-                            op:=A_MOV
-                           else
-                            op:=A_MOVZX;
-                           emit_ref_reg(op,opsize,tcallparanode(tcallparanode(left).right).left.location.reference,R_EDI);
+                          rg.getexplicitregisterint(exprasmlist,R_EDI);
+                          hregister:=R_EDI;
                         end;
+                      cg.a_load_loc_reg(exprasmlist,tcallparanode(tcallparanode(left).right).left.location,hregister);
                       if (tcallparanode(left).left.location.loc=LOC_REFERENCE) then
                         emit_reg_ref(asmop,S_L,hregister,tcallparanode(left).left.location.reference)
                       else
@@ -600,7 +593,15 @@ begin
 end.
 {
   $Log$
-  Revision 1.35  2002-04-04 19:06:11  peter
+  Revision 1.36  2002-04-15 19:44:21  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.35  2002/04/04 19:06:11  peter
     * removed unused units
     * use tlocation.size in cg.a_*loc*() routines
 

+ 14 - 6
compiler/i386/n386ld.pas

@@ -152,13 +152,13 @@ implementation
                                    location.register:=tvarsym(symtableentry).reg;
                                 end
                               else
-                                if not(makereg32(tvarsym(symtableentry).reg) in [R_EAX..R_EBX]) or
-                                   rg.regvar_loaded[makereg32(tvarsym(symtableentry).reg)] then
+                                if not(changeregsize(tvarsym(symtableentry).reg,S_L) in [R_EAX..R_EBX]) or
+                                   rg.regvar_loaded[changeregsize(tvarsym(symtableentry).reg,S_L)] then
                                 begin
                                    location_reset(location,LOC_CREGISTER,
                                        cg.reg_cgsize(tvarsym(symtableentry).reg));
                                    location.register:=tvarsym(symtableentry).reg;
-                                   exclude(rg.unusedregsint,makereg32(tvarsym(symtableentry).reg));
+                                   exclude(rg.unusedregsint,changeregsize(tvarsym(symtableentry).reg,S_L));
                                 end
                               else
                                 begin
@@ -166,7 +166,7 @@ implementation
                                   location_reset(location,LOC_CREGISTER,
                                       cg.reg_cgsize(tvarsym(symtableentry).reg));
                                   location.register:=tvarsym(symtableentry).reg;
-                                  exclude(rg.unusedregsint,makereg32(tvarsym(symtableentry).reg));
+                                  exclude(rg.unusedregsint,changeregsize(tvarsym(symtableentry).reg,S_L));
                                 end
                            end
                          else
@@ -698,7 +698,7 @@ implementation
               LOC_FLAGS :
                 begin
                   if loc=LOC_CREGISTER then
-                    emit_flag2reg(right.location.resflags,left.location.register)
+                    cg.g_flags2reg(exprasmlist,right.location.resflags,left.location.register)
                   else
                     begin
                       if not(loc in [LOC_REFERENCE,LOC_CREFERENCE]) then
@@ -989,7 +989,15 @@ begin
 end.
 {
   $Log$
-  Revision 1.34  2002-04-07 09:16:07  carl
+  Revision 1.35  2002-04-15 19:44:21  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.34  2002/04/07 09:16:07  carl
   - remove unused variable
 
   Revision 1.33  2002/04/04 19:06:12  peter

+ 12 - 4
compiler/i386/n386opt.pas

@@ -117,7 +117,7 @@ begin
         { free the registers of right }
         reference_release(exprasmlist,right.location.reference);
         { get register for the char }
-        hreg := reg32toreg8(rg.getregisterint(exprasmlist));
+        hreg := changeregsize(rg.getregisterint(exprasmlist),S_B);
         emit_ref_reg(A_MOV,S_B,right.location.reference,hreg);
        { I don't think a temp char exists, but it won't hurt (JM) }
        tg.ungetiftemp(exprasmlist,right.location.reference);
@@ -181,8 +181,8 @@ begin
   else
     emit_const_ref(A_MOV,S_B,tordconstnode(right).value,href2);
   { increase the string length }
-  emit_reg(A_INC,S_B,reg32toreg8(lengthreg));
-  emit_reg_ref(A_MOV,S_B,reg32toreg8(lengthreg),left.location.reference);
+  emit_reg(A_INC,S_B,changeregsize(lengthreg,S_B));
+  emit_reg_ref(A_MOV,S_B,changeregsize(lengthreg,S_B),left.location.reference);
   rg.ungetregisterint(exprasmlist,lengthreg);
   if checklength then
     emitlab(l);
@@ -242,7 +242,15 @@ end.
 
 {
   $Log$
-  Revision 1.9  2002-04-04 19:06:12  peter
+  Revision 1.10  2002-04-15 19:44:21  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.9  2002/04/04 19:06:12  peter
     * removed unused units
     * use tlocation.size in cg.a_*loc*() routines
 

+ 43 - 92
compiler/i386/n386set.pas

@@ -50,7 +50,7 @@ implementation
       cginfo,cgbase,pass_2,
       ncon,
       cpubase,
-      cga,tgobj,n386util,regvars,rgobj;
+      cga,cgobj,tgobj,n386util,regvars,rgobj;
 
      const
        bytes2Sxx:array[1..8] of Topsize=(S_B,S_W,S_NO,S_L,S_NO,S_NO,S_NO,S_Q);
@@ -66,7 +66,7 @@ implementation
        { load first value in 32bit register }
          secondpass(left);
          if left.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
-           emit_to_reg32(left.location.register);
+           location_force_reg(left.location,OS_32,false);
 
        { also a second value ? }
          if assigned(right) then
@@ -78,7 +78,7 @@ implementation
              if pushed then
                restore(left,false);
              if right.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
-              emit_to_reg32(right.location.register);
+              location_force_reg(right.location,OS_32,false);
            end;
 
          { we doesn't modify the left side, we check only the type }
@@ -216,12 +216,12 @@ implementation
             { If register is used, use only lower 8 bits }
             if left.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
              begin
-               pleftreg:=left.location.register;
                { for ranges we always need a 32bit register, because then we }
                { use the register as base in a reference (JM)                }
                if ranges then
                  begin
-                   pleftreg := makereg32(pleftreg);
+                   pleftreg:=changeregsize(left.location.register,S_L);
+                   cg.a_load_reg_reg(exprasmlist,left.location.size,left.location.register,pleftreg);
                    if opsize <> S_L then
                      emit_const_reg(A_AND,S_L,255,pleftreg);
                    opsize := S_L;
@@ -230,7 +230,7 @@ implementation
                  { otherwise simply use the lower 8 bits (no "and" }
                  { necessary this way) (JM)                        }
                  begin
-                   pleftreg := makereg8(pleftreg);
+                   pleftreg:=changeregsize(left.location.register,S_B);
                    opsize := S_B;
                  end;
              end
@@ -382,8 +382,8 @@ implementation
                      LOC_REGISTER,
                      LOC_CREGISTER:
                        begin
-                          hr:=left.location.register;
-                          emit_to_reg32(hr);
+                          hr:=changeregsize(left.location.register,S_L);
+                          cg.a_load_reg_reg(exprasmlist,left.location.size,left.location.register,hr);
                        end;
                   else
                     begin
@@ -451,8 +451,8 @@ implementation
                      LOC_REGISTER,
                      LOC_CREGISTER:
                        begin
-                          hr:=left.location.register;
-                          emit_to_reg32(hr);
+                          hr:=changeregsize(left.location.register,S_L);
+                          cg.a_load_reg_reg(exprasmlist,left.location.size,left.location.register,hr);
                           emit_const_reg(A_CMP,S_L,31,hr);
                           emitjmp(C_NA,l);
                         { reset carry flag }
@@ -523,14 +523,16 @@ implementation
                     end
                   else
                     begin
-                      pleftreg := left.location.register;
+                      pleftreg := changeregsize(left.location.register,S_L);
                       opsize := def2def_opsize(left.resulttype.def,u32bittype.def);
                       if opsize <> S_L then
+                       begin
                          { this will change left, even if it's a LOC_CREGISTER, but }
                          { that doesn't matter: if left is an 8 bit def, then the   }
                          { upper 24 bits are undefined, so we can zero them without }
                          { any problem (JM)                                         }
-                         emit_to_reg32(pleftreg)
+                         cg.a_load_reg_reg(exprasmlist,left.location.size,left.location.register,pleftreg);
+                       end;
                     end;
                   emit_reg_ref(A_BT,S_L,pleftreg,right.location.reference);
                   rg.ungetregister(exprasmlist,pleftreg);
@@ -815,21 +817,21 @@ implementation
              begin
                 if with_sign then
                   emit_reg_reg(A_MOVSX,S_WL,hregister,
-                    reg16toreg32(hregister))
+                    changeregsize(hregister,S_L))
                 else
                   emit_reg_reg(A_MOVZX,S_WL,hregister,
-                    reg16toreg32(hregister));
-                hregister:=reg16toreg32(hregister);
+                    changeregsize(hregister,S_L));
+                hregister:=changeregsize(hregister,S_L);
              end
            else if opsize=S_B then
              begin
                 if with_sign then
                   emit_reg_reg(A_MOVSX,S_BL,hregister,
-                    reg8toreg32(hregister))
+                    changeregsize(hregister,S_L))
                 else
                   emit_reg_reg(A_MOVZX,S_BL,hregister,
-                    reg8toreg32(hregister));
-                hregister:=reg8toreg32(hregister);
+                    changeregsize(hregister,S_L));
+                hregister:=changeregsize(hregister,S_L);
              end;
            reference_reset_symbol(href,table,0);
            href.offset:=(-longint(min_))*4;
@@ -855,13 +857,12 @@ implementation
          labels : longint;
          max_linear_list : longint;
          otl, ofl: tasmlabel;
+         isjump : boolean;
 {$ifdef Delphi}
          dist : cardinal;
 {$else Delphi}
          dist : dword;
 {$endif Delphi}
-         href : treference;
-
       begin
          getlabel(endlabel);
          getlabel(elselabel);
@@ -883,86 +884,28 @@ implementation
               jmp_lee:=C_BE;
            end;
          rg.cleartempgen;
-         { save current truelabel and falselabel (they are restored in }
-         { locjump2reg) (JM)                                           }
+         { save current truelabel and falselabel }
+         isjump:=false;
          if left.location.loc=LOC_JUMP then
-           begin
+          begin
             otl:=truelabel;
             getlabel(truelabel);
             ofl:=falselabel;
             getlabel(falselabel);
-           end;
+            isjump:=true;
+          end;
          secondpass(left);
          { determines the size of the operand }
          opsize:=bytes2Sxx[left.resulttype.def.size];
          { copy the case expression to a register }
-         case left.location.loc of
-            LOC_REGISTER:
-              begin
-                 if opsize=S_Q then
-                   begin
-                      hregister:=left.location.registerlow;
-                      hregister2:=left.location.registerhigh;
-                   end
-                 else
-                   hregister:=left.location.register;
-              end;
-            LOC_FLAGS :
-              begin
-                locflags2reg(left.location,opsize);
-                hregister := left.location.register;
-              end;
-            LOC_JUMP:
-              begin
-                locjump2reg(left.location,opsize,otl,ofl);
-                hregister := left.location.register;
-              end;
-            LOC_CREGISTER:
-              begin
-                 hregister:=rg.getregisterint(exprasmlist);
-                 case opsize of
-                    S_B:
-                      hregister:=reg32toreg8(hregister);
-                    S_W:
-                      hregister:=reg32toreg16(hregister);
-                    S_Q:
-                      hregister2:=R_EDI;
-                 end;
-                 if opsize=S_Q then
-                   begin
-                      emit_reg_reg(A_MOV,S_L,left.location.registerlow,hregister);
-                      href:=left.location.reference;
-                      inc(href.offset,4);
-                      emit_reg_reg(A_MOV,S_L,left.location.registerhigh,hregister2);
-                   end
-                 else
-                   emit_reg_reg(A_MOV,opsize,
-                     left.location.register,hregister);
-              end;
-            LOC_CREFERENCE,LOC_REFERENCE:
-              begin
-                 location_release(exprasmlist,left.location);
-                 hregister:=rg.getregisterint(exprasmlist);
-                 case opsize of
-                    S_B:
-                      hregister:=reg32toreg8(hregister);
-                    S_W:
-                      hregister:=reg32toreg16(hregister);
-                    S_Q:
-                      hregister2:=R_EDI;
-                 end;
-                 if opsize=S_Q then
-                   begin
-                      emit_ref_reg(A_MOV,S_L,left.location.reference,hregister);
-                      href:=left.location.reference;
-                      inc(href.offset,4);
-                      emit_ref_reg(A_MOV,S_L,href,hregister2);
-                   end
-                 else
-                   emit_ref_reg(A_MOV,opsize,left.location.reference,hregister);
-              end;
-            else internalerror(2002);
-         end;
+         location_force_reg(left.location,left.location.size,false);
+         hregister:=left.location.register;
+         if isjump then
+          begin
+            truelabel:=otl;
+            falselabel:=ofl;
+          end;
+
          { we need the min_label always to choose between }
          { cmps and subs/decs                             }
          min_label:=case_get_min(nodes);
@@ -1087,7 +1030,15 @@ begin
 end.
 {
   $Log$
-  Revision 1.21  2002-04-02 17:11:36  peter
+  Revision 1.22  2002-04-15 19:44:21  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.21  2002/04/02 17:11:36  peter
     * tlocation,treference update
     * LOC_CONSTANT added for better constant handling
     * secondadd splitted in multiple routines

+ 36 - 76
compiler/i386/n386util.pas

@@ -66,7 +66,7 @@ implementation
        ncon,nld,
        pass_1,pass_2,
        cgbase,tgobj,
-       cga,regvars,cgobj,cg64f32,rgobj,rgcpu;
+       cga,regvars,cgobj,cg64f32,rgobj,rgcpu,cgcpu;
 
 
     procedure location_force_reg(var l:tlocation;size:TCGSize;maybeconst:boolean);
@@ -88,7 +88,7 @@ implementation
             begin
               { load a smaller size to OS_64 }
               if l.loc=LOC_REGISTER then
-               hregister:=makereg32(l.registerlow)
+               hregister:=Changeregsize(l.registerlow,S_L)
               else
                hregister:=rg.getregisterint(exprasmlist);
               { load value in low register }
@@ -164,14 +164,7 @@ implementation
                  rg.ungetregisterint(exprasmlist,l.registerhigh);
                  l.registerhigh:=R_NO;
                end;
-              case size of
-                OS_8,OS_S8 :
-                  hregister:=makereg8(l.register);
-                OS_16,OS_S16 :
-                  hregister:=makereg16(l.register);
-                OS_32,OS_S32 :
-                  hregister:=makereg32(l.register);
-              end;
+              hregister:=l.register;
             end
            else
             begin
@@ -181,16 +174,11 @@ implementation
                  (TCGSize2Size[size]=TCGSize2Size[l.size]) then
                hregister:=l.register
               else
-               begin
-                 hregister:=rg.getregisterint(exprasmlist);
-                 case size of
-                   OS_8,OS_S8 :
-                     hregister:=makereg8(hregister);
-                   OS_16,OS_S16 :
-                     hregister:=makereg16(hregister);
-                 end;
-               end;
+               hregister:=rg.getregisterint(exprasmlist);
             end;
+{$ifdef i386}
+           hregister:=Changeregsize(hregister,TCGSize2Opsize[size]);
+{$endif i386}
            { load value in new register }
            case l.loc of
              LOC_FLAGS :
@@ -209,22 +197,13 @@ implementation
                begin
                  { load_loc_reg can only handle size >= l.size, when the
                    new size is smaller then we need to adjust the size
-                   of the orignal and maybe recalculate l.register }
+                   of the orignal and maybe recalculate l.register for i386 }
                  if (TCGSize2Size[size]<TCGSize2Size[l.size]) then
                   begin
+{$ifdef i386}
                     if (l.loc in [LOC_REGISTER,LOC_CREGISTER]) then
-                     begin
-                       case size of
-                         OS_8,OS_S8 :
-                           l.register:=makereg8(l.register);
-                         OS_16,OS_S16 :
-                           l.register:=makereg16(l.register);
-                         OS_32,OS_S32 :
-                           l.register:=makereg32(l.register);
-                         else
-                           internalerror(200203295);
-                       end;
-                     end;
+                     l.register:=Changeregsize(l.register,TCGSize2Opsize[size]);
+{$endif i386}
                     l.size:=size;
                   end;
                  cg.a_load_loc_reg(exprasmlist,l,hregister);
@@ -472,8 +451,6 @@ implementation
 
 
     procedure pushsetelement(p : tnode);
-      var
-         hr,hr16,hr32 : tregister;
       begin
       { copy the element on the stack, slightly complicated }
         if p.nodetype=ordconstn then
@@ -489,29 +466,11 @@ implementation
              LOC_REGISTER,
              LOC_CREGISTER :
                begin
-                 hr:=p.location.register;
-                 case hr of
-                   R_EAX,R_EBX,R_ECX,R_EDX,R_EDI,R_ESI,R_ESP :
-                     begin
-                       hr16:=reg32toreg16(hr);
-                       hr32:=hr;
-                     end;
-                   R_AX,R_BX,R_CX,R_DX,R_DI,R_SI,R_SP :
-                     begin
-                       hr16:=hr;
-                       hr32:=reg16toreg32(hr);
-                     end;
-                   R_AL,R_BL,R_CL,R_DL :
-                     begin
-                       hr16:=reg8toreg16(hr);
-                       hr32:=reg8toreg32(hr);
-                     end;
-                 end;
                  if aktalignment.paraalign=4 then
-                   exprasmList.concat(Taicpu.Op_reg(A_PUSH,S_L,hr32))
+                   exprasmList.concat(Taicpu.Op_reg(A_PUSH,S_L,changeregsize(p.location.register,S_W)))
                  else
-                   exprasmList.concat(Taicpu.Op_reg(A_PUSH,S_W,hr16));
-                 rg.ungetregisterint(exprasmlist,hr32);
+                   exprasmList.concat(Taicpu.Op_reg(A_PUSH,S_W,changeregsize(p.location.register,S_L)));
+                 rg.ungetregisterint(exprasmlist,p.location.register);
                end;
            else
              begin
@@ -561,25 +520,19 @@ implementation
                     OS_8,OS_S8 :
                       begin
                         if alignment=4 then
-                         begin
-                           p.location.register:=makereg32(p.location.register);
-                           cgsize:=OS_32;
-                         end
+                         cgsize:=OS_32
                         else
-                         begin
-                           p.location.register:=makereg16(p.location.register);
-                           cgsize:=OS_16;
-                         end;
+                         cgsize:=OS_16;
                       end;
                     OS_16,OS_S16 :
                       begin
                         if alignment=4 then
-                         begin
-                           p.location.register:=makereg32(p.location.register);
-                           cgsize:=OS_32;
-                         end;
+                         cgsize:=OS_32;
                       end;
                   end;
+{$ifdef i386}
+                  p.location.register:=changeregsize(p.location.register,TCGSize2Opsize[cgsize]);
+{$endif i386}
                   inc(pushedparasize,alignment);
                   if inlined then
                    begin
@@ -945,13 +898,6 @@ implementation
              end;
            LOC_FLAGS:
              begin
-                if not(R_EAX in rg.unusedregsint) then
-                  begin
-                    rg.getexplicitregisterint(exprasmlist,R_EDI);
-                    emit_reg_reg(A_MOV,S_L,R_EAX,R_EDI);
-                  end;
-                emit_flag2reg(p.location.resflags,R_AL);
-                emit_reg_reg(A_MOVZX,S_BW,R_AL,R_AX);
                 if alignment=4 then
                  begin
                    opsize:=S_L;
@@ -964,6 +910,12 @@ implementation
                    hreg:=R_AX;
                    inc(pushedparasize,2);
                  end;
+                if not(R_EAX in rg.unusedregsint) then
+                  begin
+                    rg.getexplicitregisterint(exprasmlist,R_EDI);
+                    emit_reg_reg(A_MOV,S_L,R_EAX,R_EDI);
+                  end;
+                cg.g_flags2reg(exprasmlist,p.location.resflags,hreg);
                 if inlined then
                   begin
                      reference_reset_base(r,procinfo^.framepointer,para_offset-pushedparasize);
@@ -1132,7 +1084,7 @@ implementation
                            href := dest.location.reference;
                            emit_const_ref(A_MOV,S_B,1,href);
                            inc(href.offset,1);
-                           emit_reg_ref(A_MOV,S_B,makereg8(source.location.register),href);
+                           emit_reg_ref(A_MOV,S_B,changeregsize(source.location.register,S_B),href);
                         end
                       else
                       { not so elegant (goes better with extra register    }
@@ -1308,7 +1260,15 @@ implementation
 end.
 {
   $Log$
-  Revision 1.30  2002-04-04 19:06:12  peter
+  Revision 1.31  2002-04-15 19:44:21  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.30  2002/04/04 19:06:12  peter
     * removed unused units
     * use tlocation.size in cg.a_*loc*() routines
 

+ 19 - 11
compiler/i386/popt386.pas

@@ -41,7 +41,7 @@ Uses
 {$ifdef finaldestdebug}
   cobjects,
 {$endif finaldestdebug}
-  tainst,cpubase,cpuasm,DAOpt386,rgobj;
+  tainst,cpubase,cpuasm,DAOpt386,cginfo,rgobj;
 
 Function RegUsedAfterInstruction(Reg: TRegister; p: Tai; Var UsedRegs: TRegSet): Boolean;
 Begin
@@ -1213,7 +1213,7 @@ Begin
                       Case Taicpu(p).opsize of
                         S_BW:
                           Begin
-                            If (Taicpu(p).oper[0].reg = Reg16ToReg8(Taicpu(p).oper[1].reg)) And
+                            If (Taicpu(p).oper[0].reg = Changeregsize(Taicpu(p).oper[1].reg,S_B)) And
                                Not(CS_LittleSize In aktglobalswitches)
                               Then
                                 {Change "movzbw %al, %ax" to "andw $0x0ffh, %ax"}
@@ -1235,13 +1235,13 @@ Begin
                                     Begin
                                       Taicpu(p).opcode := A_MOV;
                                       Taicpu(p).changeopsize(S_W);
-                                      Taicpu(p).LoadReg(0,Reg8ToReg16(Taicpu(p).oper[0].reg));
+                                      Taicpu(p).LoadReg(0,Changeregsize(Taicpu(p).oper[0].reg,S_W));
                                       Taicpu(hp1).LoadConst(0,Taicpu(hp1).oper[0].val And $ff);
                                     End;
                           End;
                         S_BL:
                           Begin
-                            If (Taicpu(p).oper[0].reg = Reg32ToReg8(Taicpu(p).oper[1].reg)) And
+                            If (Taicpu(p).oper[0].reg = Changeregsize(Taicpu(p).oper[1].reg,S_B)) And
                                Not(CS_LittleSize in aktglobalswitches)
                               Then
                                 {Change "movzbl %al, %eax" to "andl $0x0ffh, %eax"}
@@ -1263,13 +1263,13 @@ Begin
                                     Begin
                                       Taicpu(p).opcode := A_MOV;
                                       Taicpu(p).changeopsize(S_L);
-                                      Taicpu(p).LoadReg(0,Reg8ToReg32(Taicpu(p).oper[0].reg));
+                                      Taicpu(p).LoadReg(0,Changeregsize(Taicpu(p).oper[0].reg,S_L));
                                       Taicpu(hp1).LoadConst(0,Taicpu(hp1).oper[0].val And $ff);
                                     End
                           End;
                         S_WL:
                           Begin
-                            If (Taicpu(p).oper[0].reg = Reg32ToReg16(Taicpu(p).oper[1].reg)) And
+                            If (Taicpu(p).oper[0].reg = Changeregsize(Taicpu(p).oper[1].reg,S_W)) And
                                Not(CS_LittleSize In aktglobalswitches)
                               Then
                                {Change "movzwl %ax, %eax" to "andl $0x0ffffh, %eax"}
@@ -1291,7 +1291,7 @@ Begin
                                     Begin
                                       Taicpu(p).opcode := A_MOV;
                                       Taicpu(p).changeopsize(S_L);
-                                      Taicpu(p).LoadReg(0,Reg16ToReg32(Taicpu(p).oper[0].reg));
+                                      Taicpu(p).LoadReg(0,Changeregsize(Taicpu(p).oper[0].reg,S_L));
                                       Taicpu(hp1).LoadConst(0,Taicpu(hp1).oper[0].val And $ffff);
                                     End;
                           End;
@@ -1596,7 +1596,7 @@ Begin
                             Begin
                               Taicpu(hp1).changeopsize(S_L);
                               if Taicpu(hp1).oper[0].typ=top_reg then
-                                Taicpu(hp1).LoadReg(0,Reg16ToReg32(Taicpu(hp1).oper[0].reg));
+                                Taicpu(hp1).LoadReg(0,Changeregsize(Taicpu(hp1).oper[0].reg,S_L));
                               hp1 := Tai(p.next);
                               asml.Remove(p);
                               p.free;
@@ -1955,7 +1955,7 @@ Begin
                                     InsertLLItem(AsmL,p.previous, p, hp1);
                                     Taicpu(p).opcode := A_MOV;
                                     Taicpu(p).changeopsize(S_B);
-                                    Taicpu(p).LoadReg(1,Reg32ToReg8(Taicpu(p).oper[1].reg));
+                                    Taicpu(p).LoadReg(1,Changeregsize(Taicpu(p).oper[1].reg,S_B));
                                   End;
                             End;
                         End
@@ -1975,7 +1975,7 @@ Begin
                                          Taicpu(p).oper[1].reg);
                               Taicpu(p).opcode := A_MOV;
                               Taicpu(p).changeopsize(S_B);
-                              Taicpu(p).LoadReg(1,Reg32ToReg8(Taicpu(p).oper[1].reg));
+                              Taicpu(p).LoadReg(1,Changeregsize(Taicpu(p).oper[1].reg,S_B));
                               InsertLLItem(AsmL,p.previous, p, hp1);
                             End;
                  End;
@@ -2040,7 +2040,15 @@ End.
 
 {
   $Log$
-  Revision 1.20  2002-04-02 20:30:16  jonas
+  Revision 1.21  2002-04-15 19:44:21  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.20  2002/04/02 20:30:16  jonas
     + support for folding inc/dec in shl/add/sub sequences toa single lea
       instruction
 

+ 10 - 2
compiler/i386/ra386int.pas

@@ -1564,7 +1564,7 @@ Begin
             Message(asmr_e_invalid_operand_type);
            opr.typ:=OPR_REGISTER;
            opr.reg:=tempreg;
-           size:=reg_2_opsize[opr.reg];
+           size:=reg2opsize[opr.reg];
          end;
       end;
 
@@ -1959,7 +1959,15 @@ finalization
 end.
 {
   $Log$
-  Revision 1.23  2002-04-15 19:12:09  carl
+  Revision 1.24  2002-04-15 19:44:22  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.23  2002/04/15 19:12:09  carl
   + target_info.size_of_pointer -> pointer_size
   + some cleanup of unused types/variables
   * move several constants from cpubase to their specific units

+ 13 - 3
compiler/i386/rgcpu.pas

@@ -73,7 +73,7 @@ unit rgcpu;
     uses
        systems,
        globals,verbose,
-       tgobj,cga;
+       cginfo,tgobj,cga;
 
 
     function trgcpu.getregisterint(list: taasmoutput): tregister;
@@ -137,7 +137,9 @@ unit rgcpu;
 
     procedure trgcpu.ungetregisterint(list: taasmoutput; r : tregister);
       begin
-         r := makereg32(r);
+         if r=R_NO then
+          exit;
+         r := changeregsize(r,S_L);
          if (r = R_EDI) or
             ((not assigned(procinfo^._class)) and (r = R_ESI)) then
            begin
@@ -330,7 +332,15 @@ end.
 
 {
   $Log$
-  Revision 1.3  2002-04-04 19:06:13  peter
+  Revision 1.4  2002-04-15 19:44:22  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.3  2002/04/04 19:06:13  peter
     * removed unused units
     * use tlocation.size in cg.a_*loc*() routines
 

+ 24 - 10
compiler/i386/rropt386.pas

@@ -35,7 +35,7 @@ Implementation
 
 Uses
   {$ifdef replaceregdebug}cutils,{$endif}
-  verbose,globals,cpubase,cpuasm,daopt386,csopt386,rgobj;
+  verbose,globals,cpubase,cpuasm,daopt386,csopt386,cginfo,rgobj;
 
 function canBeFirstSwitch(p: Taicpu; reg: tregister): boolean;
 { checks whether an operation on reg can be switched to another reg without an }
@@ -79,14 +79,20 @@ begin
     reg := reg2
   else if reg = reg2 then
     reg := reg1
-  else if reg = regtoreg8(reg1) then
-         reg := regtoreg8(reg2)
-  else if reg = regtoreg8(reg2) then
-         reg := regtoreg8(reg1)
-  else if reg = regtoreg16(reg1) then
-         reg := regtoreg16(reg2)
-  else if reg = regtoreg16(reg2) then
-         reg := regtoreg16(reg1)
+  else if (reg in regset8bit) then
+    begin
+      if (reg = Changeregsize(reg1,S_B)) then
+        reg := Changeregsize(reg2,S_B)
+      else if reg = Changeregsize(reg2,S_B) then
+        reg := Changeregsize(reg1,S_B);
+    end
+  else if (reg in regset16bit) then
+    begin
+      if reg = Changeregsize(reg1,S_W) then
+        reg := Changeregsize(reg2,S_W)
+      else if reg = Changeregsize(reg2,S_W) then
+        reg := Changeregsize(reg1,S_W);
+    end;
 end;
 
 
@@ -344,7 +350,15 @@ End.
 
 {
   $Log$
-  Revision 1.10  2002-04-02 17:11:39  peter
+  Revision 1.11  2002-04-15 19:44:22  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.10  2002/04/02 17:11:39  peter
     * tlocation,treference update
     * LOC_CONSTANT added for better constant handling
     * secondadd splitted in multiple routines

+ 0 - 3
compiler/msg/errore.msg

@@ -153,9 +153,6 @@ scan_w_comment_level=02005_W_Comment level $1 found
 scan_n_far_directive_ignored=02006_N_$F directive (FAR) ignored
 % The \var{FAR} directive is a 16-bit construction which is recorgnised
 % but ignored by the compiler, since it produces 32 bit code.
-scan_n_stack_check_global_under_linux=02007_N_Stack check is global under Linux
-% Stack checking with the \var{-Cs} switch is ignored under \linux, since
-% \linux does this for you. Only displayed when \var{-vn} is used.
 scan_n_ignored_switch=02008_N_Ignored compiler switch "$1"
 % With \var{-vn} on, the compiler warns if it ignores a switch
 scan_w_illegal_switch=02009_W_Illegal compiler switch "$1"

+ 1 - 2
compiler/msgidx.inc

@@ -23,7 +23,6 @@ const
   scan_t_start_include_file=02004;
   scan_w_comment_level=02005;
   scan_n_far_directive_ignored=02006;
-  scan_n_stack_check_global_under_linux=02007;
   scan_n_ignored_switch=02008;
   scan_w_illegal_switch=02009;
   scan_w_switch_is_global=02010;
@@ -604,7 +603,7 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 33913;
+  MsgTxtSize = 33871;
 
   MsgIdxMax : array[1..20] of longint=(
     17,62,184,38,41,41,98,17,35,42,

+ 281 - 283
compiler/msgtxt.inc

@@ -27,561 +27,559 @@ const msgtxt : array[0..000141,1..240] of char=(
   '02004_T_Start reading includefile $1'#000+
   '02005_W_Comment level $1 found'#000+
   '02006_N_$F directive (FAR) ignored'#000+
-  '02007_N_Stack check is g','lobal under Linux'#000+
-  '02008_N_Ignored compiler switch "$1"'#000+
+  '02008_N_Ignored compiler',' switch "$1"'#000+
   '02009_W_Illegal compiler switch "$1"'#000+
   '02010_W_This compiler switch has a global effect'#000+
   '02011_E_Illegal char constant'#000+
   '02012_F_Can'#039't open file "$1"'#000+
   '02013_F_Can'#039't open include file "$1"'#000+
-  '020','14_E_Too many $ENDIFs or $ELSEs'#000+
-  '02015_W_Records fields can be aligned to 1,2,4,8,16 or 32 bytes only'#000+
+  '02014_E_Too many $ENDIFs or $ELSEs'#000+
+  '02015_W_Re','cords fields can be aligned to 1,2,4,8,16 or 32 bytes only'+
+  #000+
   '02016_W_Enumerated can be saved in 1,2 or 4 bytes only'#000+
   '02017_E_$ENDIF expected for $1 $2 defined in $3 line $4'#000+
-  '02018_E_Syntax error while p','arsing a conditional compiling expressio'+
-  'n'#000+
+  '02018_E_Syntax error while parsing a conditional compiling expression'#000,
   '02019_E_Evaluating a conditional compiling expression'#000+
   '02020_W_Macro contents is cut after char 255 to evalute expression'#000+
   '02021_E_ENDIF without IF(N)DEF'#000+
   '02022_F_User defined: $1'#000+
-  '02023_E_User defined:',' $1'#000+
+  '02023_E_User defined: $1'#000+
   '02024_W_User defined: $1'#000+
-  '02025_N_User defined: $1'#000+
+  '02025_N_User ','defined: $1'#000+
   '02026_H_User defined: $1'#000+
   '02027_I_User defined: $1'#000+
   '02028_E_Keyword redefined as macro has no effect'#000+
   '02029_F_Macro buffer overflow while reading or expanding a macro'#000+
-  '02030_W_Extension of m','acros exceeds a deep of 16.'#000+
-  '02031_E_compiler switches aren'#039't allowed in (* ... *) styled comme'+
-  'nts'#000+
+  '02030_W_Extension of macros exceeds a deep of 16.'#000+
+  '02031_E_compil','er switches aren'#039't allowed in (* ... *) styled com'+
+  'ments'#000+
   '02032_D_Handling switch "$1"'#000+
   '02033_C_ENDIF $1 found'#000+
   '02034_C_IFDEF $1 found, $2'#000+
   '02035_C_IFOPT $1 found, $2'#000+
   '02036_C_IF $1 found, $2'#000+
-  '02037_C_IFND','EF $1 found, $2'#000+
-  '02038_C_ELSE $1 found, $2'#000+
+  '02037_C_IFNDEF $1 found, $2'#000+
+  '02038_C_ELSE $1 found, $2'#000,
   '02039_C_Skipping until...'#000+
   '02040_I_Press <return> to continue'#000+
   '02041_W_Unsupported switch "$1"'#000+
   '02042_W_Illegal compiler directive "$1"'#000+
   '02043_T_Back in $1'#000+
   '02044_W_Unsupported application type: "$1"'#000+
-  '020','45_W_APPTYPE isn'#039't support by the target OS'#000+
+  '02045_W_APPTYPE isn'#039't support by the target O','S'#000+
   '02046_W_DESCRIPTION is only supported for OS2 and Win32'#000+
   '02047_N_VERSION is not supported by target OS.'#000+
   '02048_N_VERSION only for exes or DLLs'#000+
   '02049_W_Wrong format for VERSION directive "$1"'#000+
-  '02050_W','_Unsupported assembler style specified "$1"'#000+
+  '02050_W_Unsupported assembler style specified "$1','"'#000+
   '02051_W_ASM reader switch is not possible inside asm statement, "$1" w'+
   'ill be effective only for next'#000+
   '02052_E_Wrong switch toggle, use ON/OFF or +/-'#000+
-  '02053_E_Resource files are not supported for thi','s target'#000+
-  '02054_W_Include environment "$1" not found in environment'#000+
+  '02053_E_Resource files are not supported for this target'#000+
+  '02054_W_Include environment "$1" ','not found in environment'#000+
   '02055_E_Illegal value for FPU register limit'#000+
   '02056_W_Only one resource file is supported for this target'#000+
   '02057_W_Macro support has been turned off'#000+
-  '02058_E_Illegal interface ','type specified. Valids are COM, CORBA or D'+
-  'EFAULT.'#000+
+  '02058_E_Illegal interface type specified. Valids are COM, CORBA or D','E'+
+  'FAULT.'#000+
   '02059_W_APPID is only supported for PalmOS'#000+
   '02060_W_APPNAME is only supported for PalmOS'#000+
   '02061_E_Constant strings can'#039't be longer than 255 chars'#000+
   '03000_E_Parser - Syntax Error'#000+
-  '03001_W_Procedur','e type FAR ignored'#000+
-  '03002_W_Procedure type NEAR ignored'#000+
+  '03001_W_Procedure type FAR ignored'#000+
+  '03002_W_Procedure type ','NEAR ignored'#000+
   '03003_W_Procedure type INTERRUPT ignored for not i386'#000+
   '03004_E_INTERRUPT procedure can'#039't be nested'#000+
   '03005_W_Procedure type "$1" ignored'#000+
-  '03006_E_Not all declarations of "$1" are declared w','ith OVERLOAD'#000+
-  '03007_E_No DLL File specified'#000+
+  '03006_E_Not all declarations of "$1" are declared with OVERLOAD'#000+
+  '03007_E_No DLL File specified',#000+
   '03008_E_Duplicate exported function name "$1"'#000+
   '03009_E_Duplicate exported function index $1'#000+
   '03010_E_Invalid index for exported function'#000+
-  '03011_W_Relocatable DLL or executable $1 debug info does not w','ork, d'+
-  'isabled.'#000+
-  '03012_W_To allow debugging for win32 code you need to disable relocati'+
-  'on with -WN option'#000+
+  '03011_W_Relocatable DLL or executable $1 debug info does not work, dis'+
+  'abled.'#000+
+  '03012_W_To allow debugging ','for win32 code you need to disable reloca'+
+  'tion with -WN option'#000+
   '03013_E_Constructor name must be INIT'#000+
   '03014_E_Destructor name must be DONE'#000+
   '03015_E_Illegal open parameter'#000+
-  '03016_E_Procedure type INLINE ','not supported'#000+
-  '03017_W_Private methods shouldn'#039't be VIRTUAL'#000+
+  '03016_E_Procedure type INLINE not supported'#000+
+  '03017_W_Private methods shou','ldn'#039't be VIRTUAL'#000+
   '03018_W_Constructor should be public'#000+
   '03019_W_Destructor should be public'#000+
   '03020_N_Class should have one destructor only'#000+
   '03021_E_Local class definitions are not allowed'#000+
-  '03022_F_Anonym',' class definitions are not allowed'#000+
-  '03023_E_The object "$1" has no VMT'#000+
+  '03022_F_Anonym class definitions are not allowed'#000+
+  '03023_E','_The object "$1" has no VMT'#000+
   '03024_E_Illegal parameter list'#000+
   '03025_E_Wrong parameter type specified for arg no. "$1"'#000+
   '03026_E_Wrong amount of parameters specified'#000+
-  '03027_E_overloaded identifier "$1" isn',#039't a function'#000+
-  '03028_E_overloaded functions have the same parameter list'#000+
+  '03027_E_overloaded identifier "$1" isn'#039't a function'#000+
+  '03028_E_overloaded functions',' have the same parameter list'#000+
   '03029_E_function header doesn'#039't match the forward declaration "$1"'+
   #000+
   '03030_E_function header "$1" doesn'#039't match forward : var name chan'+
   'ges $2 => $3'#000+
-  '03031_N_Values in enum','eration types have to be ascending'#000+
-  '03032_N_Interface and implementation names are different "$1" => "$2"'#000+
+  '03031_N_Values in enumeration types have to be ascending'#000+
+  '03032_N','_Interface and implementation names are different "$1" => "$2'+
+  '"'#000+
   '03033_E_With can not be used for variables in a different segment'#000+
   '03034_E_function nesting > 31'#000+
-  '03035_E_range check error while evaluat','ing constants'#000+
-  '03036_W_range check error while evaluating constants'#000+
+  '03035_E_range check error while evaluating constants'#000+
+  '03036_W_range check error wh','ile evaluating constants'#000+
   '03037_E_duplicate case label'#000+
   '03038_E_Upper bound of case range is less than lower bound'#000+
   '03039_E_typed constants of classes are not allowed'#000+
-  '03040_E_functions variables of ove','rloaded functions are not allowed'#000+
-  '03041_E_string length must be a value from 1 to 255'#000+
+  '03040_E_functions variables of overloaded functions are not allowed'#000+
+  '03041_E_','string length must be a value from 1 to 255'#000+
   '03042_W_use extended syntax of NEW and DISPOSE for instances of object'+
   's'#000+
   '03043_W_use of NEW or DISPOSE for untyped pointers is meaningless'#000+
-  '03044_E_use of N','EW or DISPOSE is not possible for untyped pointers'#000+
+  '03044_E_use of NEW or DISPOSE is not possible for untyped ','pointers'#000+
   '03045_E_class identifier expected'#000+
   '03046_E_type identifier not allowed here'#000+
   '03047_E_method identifier expected'#000+
   '03048_E_function header doesn'#039't match any method of this class "$1'+
   '"'#000+
-  '03049_P_pro','cedure/function $1'#000+
-  '03050_E_Illegal floating point constant'#000+
+  '03049_P_procedure/function $1'#000+
+  '03050_E_Illegal floatin','g point constant'#000+
   '03051_E_FAIL can be used in constructors only'#000+
   '03052_E_Destructors can'#039't have parameters'#000+
   '03053_E_Only class methods can be referred with class references'#000+
-  '03054_E_Only class methods c','an be accessed in class methods'#000+
-  '03055_E_Constant and CASE types do not match'#000+
+  '03054_E_Only class methods can be accessed in class methods'#000+
+  '03055_E_Co','nstant and CASE types do not match'#000+
   '03056_E_The symbol can'#039't be exported from a library'#000+
   '03057_W_An inherited method is hidden by "$1"'#000+
-  '03058_E_There is no method in an ancestor class to be overridden:',' "$'+
-  '1"'#000+
-  '03059_E_No member is provided to access property'#000+
+  '03058_E_There is no method in an ancestor class to be overridden: "$1"'+
+  #000+
+  '03059_E_No member is provided to acc','ess property'#000+
   '03060_W_Stored prorperty directive is not yet implemented'#000+
   '03061_E_Illegal symbol for property access'#000+
   '03062_E_Cannot access a protected field of an object here'#000+
-  '03063_E_Cannot access a pr','ivate field of an object here'#000+
-  '03064_W_overloaded method of virtual method should be virtual: "$1"'#000+
+  '03063_E_Cannot access a private field of an object here'#000+
+  '03064_W_over','loaded method of virtual method should be virtual: "$1"'#000+
   '03065_W_overloaded method of non-virtual method should be non-virtual:'+
   ' "$1"'#000+
-  '03066_E_overridden methods must have the same return type: "$2" is',' o'+
-  'verriden by "$1" which has another return type'#000+
+  '03066_E_overridden methods must have the same return type: "$2" is ove'+
+  'rriden by "$1" which has another retur','n type'#000+
   '03067_E_EXPORT declared functions can'#039't be nested'#000+
   '03068_E_methods can'#039't be EXPORTed'#000+
   '03069_E_call by var parameters have to match exactly: Got "$1" expecte'+
   'd "$2"'#000+
-  '03070_E_Class isn'#039't a parent c','lass of the current class'#000+
-  '03071_E_SELF is only allowed in methods'#000+
+  '03070_E_Class isn'#039't a parent class of the current class'#000+
+  '03071_E_SELF is ','only allowed in methods'#000+
   '03072_E_methods can be only in other methods called direct with type i'+
   'dentifier of the class'#000+
   '03073_E_Illegal use of '#039':'#039#000+
-  '03074_E_range check error in set constructor or duplic','ate set elemen'+
-  't'#000+
-  '03075_E_Pointer to object expected'#000+
+  '03074_E_range check error in set constructor or duplicate set element'#000+
+  '03075_E_Pointer to object ','expected'#000+
   '03076_E_Expression must be constructor call'#000+
   '03077_E_Expression must be destructor call'#000+
   '03078_E_Illegal order of record elements'#000+
   '03079_E_Expression type must be class or record type'#000+
-  '03080_E_','Procedures can'#039't return a value'#000+
-  '03081_E_constructors and destructors must be methods'#000+
+  '03080_E_Procedures can'#039't return a value'#000+
+  '03081_E_co','nstructors and destructors must be methods'#000+
   '03082_E_Operator is not overloaded'#000+
   '03083_E_Impossible to overload assignment for equal types'#000+
   '03084_E_Impossible operator overload'#000+
-  '03085_E_Re-raise isn'#039't po','ssible there'#000+
-  '03086_E_The extended syntax of new or dispose isn'#039't allowed for a '+
-  'class'#000+
+  '03085_E_Re-raise isn'#039't possible there'#000+
+  '03086_E_The extended syntax o','f new or dispose isn'#039't allowed for '+
+  'a class'#000+
   '03087_E_Assembler incompatible with function return type'#000+
   '03088_E_Procedure overloading is switched off'#000+
-  '03089_E_It is not possible to overload this operator',' (overload = ins'+
-  'tead)'#000+
-  '03090_E_Comparative operator must return a boolean value'#000+
+  '03089_E_It is not possible to overload this operator (overload = inste'+
+  'ad)'#000+
+  '03090_E_Comparative ','operator must return a boolean value'#000+
   '03091_E_Only virtual methods can be abstract'#000+
   '03092_F_Use of unsupported feature!'#000+
   '03093_E_The mix of different kind of objects (class, object, interface'+
-  ', raw inte','rface etc) isn'#039't allowed'#000+
-  '03094_W_Unknown procedure directive had to be ignored: "$1"'#000+
+  ', raw interface etc) isn'#039't allowed'#000+
+  '03094_W_Unknown p','rocedure directive had to be ignored: "$1"'#000+
   '03095_E_absolute can only be associated to ONE variable'#000+
   '03096_E_absolute can only be associated a var or const'#000+
-  '03097_E_Only ONE variable can be initialized',#000+
-  '03098_E_Abstract methods shouldn'#039't have any definition (with funct'+
-  'ion body)'#000+
+  '03097_E_Only ONE variable can be initialized'#000+
+  '03098_E_Abstract methods shouldn'#039't have a','ny definition (with fun'+
+  'ction body)'#000+
   '03099_E_This overloaded function can'#039't be local (must be exported)'+
   #000+
   '03100_W_Virtual methods are used without a constructor in "$1"'#000+
   '03101_M_Macro defined: $1'#000+
-  '03102_M','_Macro undefined: $1'#000+
-  '03103_M_Macro $1 set to $2'#000+
+  '03102_M_Macro undefined: $1'#000+
+  '03103_M_Macro $1 set ','to $2'#000+
   '03104_I_Compiling $1'#000+
   '03105_U_Parsing interface of unit $1'#000+
   '03106_U_Parsing implementation of $1'#000+
   '03107_D_Compiling $1 for the second time'#000+
   '03108_E_Array properties aren'#039't allowed here'#000+
-  '03109_E_No ','property found to override'#000+
-  '03110_E_Only one default property is allowed, found inherited default '+
-  'property in class "$1"'#000+
+  '03109_E_No property found to override'#000+
+  '03110_E_Only on','e default property is allowed, found inherited defaul'+
+  't property in class "$1"'#000+
   '03111_E_The default property must be an array property'#000+
-  '03112_E_Virtual constructors are only supported in class object m','ode'+
-  'l'#000+
-  '03113_E_No default property available'#000+
+  '03112_E_Virtual constructors are only supported in class object model'#000+
+  '03113_E_No default property available',#000+
   '03114_E_The class can'#039't have a published section, use the {$M+} sw'+
   'itch'#000+
   '03115_E_Forward declaration of class "$1" must be resolved here to use'+
   ' the class as ancestor'#000+
-  '03116_E_Local operators not suppo','rted'#000+
-  '03117_E_Procedure directive "$1" not allowed in interface section'#000+
+  '03116_E_Local operators not supported'#000+
+  '03117_E_Procedure directive "$1" not ','allowed in interface section'#000+
   '03118_E_Procedure directive "$1" not allowed in implementation section'+
   #000+
   '03119_E_Procedure directive "$1" not allowed in procvar declaration'#000+
-  '03120_E_Function is already de','clared Public/Forward "$1"'#000+
-  '03121_E_Can'#039't use both EXPORT and EXTERNAL'#000+
+  '03120_E_Function is already declared Public/Forward "$1"'#000+
+  '03121_E_Can'#039't u','se both EXPORT and EXTERNAL'#000+
   '03122_E_NAME keyword expected'#000+
   '03123_W_"$1" not yet supported inside inline procedure/function'#000+
   '03124_W_Inlining disabled'#000+
   '03125_I_Writing Browser log $1'#000+
-  '03126_H_may be poin','ter dereference is missing'#000+
-  '03127_F_Selected assembler reader not supported'#000+
+  '03126_H_may be pointer dereference is missing'#000+
+  '03127_F_Selecte','d assembler reader not supported'#000+
   '03128_E_Procedure directive "$1" has conflicts with other directives'#000+
   '03129_E_Calling convention doesn'#039't match forward'#000+
-  '03130_E_Register calling (fastcall) not support','ed'#000+
-  '03131_E_Property can'#039't have a default value'#000+
+  '03130_E_Register calling (fastcall) not supported'#000+
+  '03131_E_Property can'#039't have a default v','alue'#000+
   '03132_E_The default value of a property must be constant'#000+
   '03133_E_Symbol can'#039't be published, can be only a class'#000+
   '03134_E_That kind of property can'#039't be published'#000+
-  '03135_W_Empty import name specif','ied'#000+
+  '03135_W_Empty import name specified'#000+
   '03136_W_An import name is required'#000+
-  '03137_E_Function internal name changed after use of function'#000+
+  '031','37_E_Function internal name changed after use of function'#000+
   '03138_E_Division by zero'#000+
   '03139_E_Invalid floating point operation'#000+
   '03140_E_Upper bound of range is less than lower bound'#000+
-  '03141_W_string "$1" ','is longer than "$2"'#000+
-  '03142_E_string length is larger than array of char length'#000+
+  '03141_W_string "$1" is longer than "$2"'#000+
+  '03142_E_string length ','is larger than array of char length'#000+
   '03143_E_Illegal expression after message directive'#000+
   '03144_E_Message handlers can take only one call by ref. parameter'#000+
   '03145_E_Duplicate message label: "$1"'#000+
-  '03146_E','_Self can only be an explicit parameter in methods which are '+
+  '03146_E_Self can only be an explicit parameter in',' methods which are '+
   'message handlers'#000+
   '03147_E_Threadvars can be only static or global'#000+
   '03148_F_Direct assembler not supported for binary output format'#000+
-  '03149_W_Don'#039't load OBJPAS unit manual, use {$mode ','objfpc} or {$m'+
-  'ode delphi} instead'#000+
-  '03150_E_OVERRIDE can'#039't be used in objects'#000+
+  '03149_W_Don'#039't load OBJPAS unit manual, use {$mode objfpc} or {$mod'+
+  'e delphi} instead'#000+
+  '03150_E_','OVERRIDE can'#039't be used in objects'#000+
   '03151_E_Data types which require initialization/finalization can'#039't'+
   ' be used in variant records'#000+
   '03152_E_Resourcestrings can be only static or global'#000+
-  '03153_E_Exit with',' argument can'#039't be used here'#000+
-  '03154_E_The type of the storage symbol must be boolean'#000+
+  '03153_E_Exit with argument can'#039't be used here'#000+
+  '03154_E_The t','ype of the storage symbol must be boolean'#000+
   '03155_E_This symbol isn'#039't allowed as storage symbol'#000+
   '03156_E_Only class which are compiled in $M+ mode can be published'#000+
-  '03157_E_Procedure directive expected'#000,
-  '03158_E_The value for a property index must be of an ordinal type'#000+
+  '03157_E_Procedure directive expected'#000+
+  '03158_E_The value for a property index mus','t be of an ordinal type'#000+
   '03159_E_Procedure name to short to be exported'#000+
   '03160_E_No DEFFILE entry can be generated for unit global vars'#000+
   '03161_E_Compile without -WD option'#000+
-  '03162_F_You need ObjFpc (-S2)',' or Delphi (-Sd) mode to compile this m'+
-  'odule'#000+
+  '03162_F_You need ObjFpc (-S2) or Delphi (-Sd) mode to compile this mod'+
+  'u','le'#000+
   '03163_E_Can'#039't export with index under $1'#000+
   '03164_E_Exporting of variables is not supported under $1'#000+
   '03165_E_Improper GUID syntax'#000+
   '03166_F_An interface can'#039't have variables'#000+
-  '03167_F_An interface can'#039't',' have constructor or destructor'#000+
-  '03168_W_Procedure named "$1" not found that is suitable for implementi'+
-  'ng the $2.$3'#000+
+  '03167_F_An interface can'#039't have constructor or destructor'#000+
+  '03168_W_Pr','ocedure named "$1" not found that is suitable for implemen'+
+  'ting the $2.$3'#000+
   '03169_E_interface identifier expected'#000+
   '03170_E_Type "$1" can'#039't be used as array index type'#000+
-  '03171_E_Con- and destructors aren'#039't',' allowed in interfaces'#000+
-  '03172_E_Access specifiers can'#039't be used in INTERFACES'#000+
+  '03171_E_Con- and destructors aren'#039't allowed in interfaces'#000+
+  '03172_E_Access spec','ifiers can'#039't be used in INTERFACES'#000+
   '03173_E_An interface can'#039't contain fields'#000+
   '03174_E_Can'#039't declare local procedure as EXTERNAL'#000+
   '03175_W_Some fields coming before "$1" weren'#039't initialized'#000+
-  '03176_E_Some',' fields coming before "$1" weren'#039't initialized'#000+
+  '03176_E_Some fields coming before "$1" weren'#039't initial','ized'#000+
   '03177_H_Some fields coming after "$1" weren'#039't initialized'#000+
   '03178_E_VarArgs directive without CDecl and External'#000+
   '03179_E_Self must be a normal (call-by-value) parameter'#000+
-  '03180_E_Interface "$1" has',' no interface identification'#000+
-  '03181_E_Unknown class field or method identifier "$1"'#000+
+  '03180_E_Interface "$1" has no interface identification'#000+
+  '03181_E_Unkno','wn class field or method identifier "$1"'#000+
   '03182_W_Overriding calling convention "$1" with "$2"'#000+
   '03183_E_Typed constants of the type "procedure of object" can only be '+
   'initialized with NIL'#000+
-  '04000_E_Type ','mismatch'#000+
-  '04001_E_Incompatible types: got "$1" expected "$2"'#000+
+  '04000_E_Type mismatch'#000+
+  '04001_E_Incompatible types: got "','$1" expected "$2"'#000+
   '04002_E_Type mismatch between "$1" and "$2"'#000+
   '04003_E_Type identifier expected'#000+
   '04004_E_Variable identifier expected'#000+
   '04005_E_Integer expression expected, but got "$1"'#000+
-  '04006_E_Boolean ','expression expected, but got "$1"'#000+
-  '04007_E_Ordinal expression expected'#000+
+  '04006_E_Boolean expression expected, but got "$1"'#000+
+  '04007_E_','Ordinal expression expected'#000+
   '04008_E_pointer type expected, but got "$1"'#000+
   '04009_E_class type expected, but got "$1"'#000+
   '04010_E_Variable or type indentifier expected'#000+
-  '04011_E_Can'#039't evaluate constant expres','sion'#000+
-  '04012_E_Set elements are not compatible'#000+
+  '04011_E_Can'#039't evaluate constant expression'#000+
+  '04012_E_Set elements are not compatib','le'#000+
   '04013_E_Operation not implemented for sets'#000+
   '04014_W_Automatic type conversion from floating type to COMP which is '+
   'an integer type'#000+
   '04015_H_use DIV instead to get an integer result'#000+
-  '04016_E_string ty','pes doesn'#039't match, because of $V+ mode'#000+
-  '04017_E_succ or pred on enums with assignments not possible'#000+
+  '04016_E_string types doesn'#039't match, because of $V+ mode'#000+
+  '040','17_E_succ or pred on enums with assignments not possible'#000+
   '04018_E_Can'#039't read or write variables of this type'#000+
   '04019_E_Can'#039't use readln or writeln on typed file'#000+
-  '04020_E_Can'#039't use read or write on untyp','ed file.'#000+
-  '04021_E_Type conflict between set elements'#000+
+  '04020_E_Can'#039't use read or write on untyped file.'#000+
+  '04021_E_Type conflict between set',' elements'#000+
   '04022_W_lo/hi(dword/qword) returns the upper/lower word/dword'#000+
   '04023_E_Integer or real expression expected'#000+
   '04024_E_Wrong type "$1" in array constructor'#000+
-  '04025_E_Incompatible type for arg no.',' $1: Got "$2", expected "$3"'#000+
-  '04026_E_Method (variable) and Procedure (variable) are not compatible'#000+
+  '04025_E_Incompatible type for arg no. $1: Got "$2", expected "$3"'#000+
+  '04026_E_Metho','d (variable) and Procedure (variable) are not compatibl'+
+  'e'#000+
   '04027_E_Illegal constant passed to internal math function'#000+
   '04028_E_Can'#039't get the address of constants'#000+
   '04029_E_Argument can'#039't be assigned to'#000+
-  '04','030_E_Can'#039't assign local procedure/function to procedure varia'+
+  '04030_E_Can'#039't assign local procedure/functio','n to procedure varia'+
   'ble'#000+
   '04031_E_Can'#039't assign values to an address'#000+
   '04032_E_Can'#039't assign values to const variable'#000+
   '04033_E_Array type required'#000+
   '04034_E_interface type expected, but got "$1"'#000+
-  '04035_W_Mixi','ng signed expressions and cardinals gives a 64bit result'+
+  '04035_W_Mixing signed expressions and cardinals gives ','a 64bit result'+
   #000+
   '04036_W_Mixing signed expressions and cardinals here may cause a range'+
   ' check error'#000+
   '04037_E_Typecast has different size ($1 -> $2) in assignment'#000+
   '05000_E_Identifier not found "$1"'#000+
-  '05001','_F_Internal Error in SymTableStack()'#000+
-  '05002_E_Duplicate identifier "$1"'#000+
+  '05001_F_Internal Error in SymTableStack()'#000+
+  '05002','_E_Duplicate identifier "$1"'#000+
   '05003_H_Identifier already defined in $1 at line $2'#000+
   '05004_E_Unknown identifier "$1"'#000+
   '05005_E_Forward declaration not solved "$1"'#000+
-  '05006_F_Identifier type already defined a','s type'#000+
+  '05006_F_Identifier type already defined as type'#000+
   '05007_E_Error in type definition'#000+
-  '05008_E_Type identifier not defined'#000+
+  '05','008_E_Type identifier not defined'#000+
   '05009_E_Forward type not resolved "$1"'#000+
   '05010_E_Only static variables can be used in static methods or outside'+
   ' methods'#000+
-  '05011_E_Invalid call to tvarsym.mangledname()'#000,
+  '05011_E_Invalid call to tvarsym.mangledname()'#000+
   '05012_F_record or class type expected'#000+
-  '05013_E_Instances of classes or objects with an abstract method are no'+
-  't allowed'#000+
+  '0501','3_E_Instances of classes or objects with an abstract method are '+
+  'not allowed'#000+
   '05014_W_Label not defined "$1"'#000+
   '05015_E_Label used but not defined "$1"'#000+
   '05016_E_Illegal label declaration'#000+
-  '05017_E_GOTO and ','LABEL are not supported (use switch -Sg)'#000+
-  '05018_E_Label not found'#000+
+  '05017_E_GOTO and LABEL are not supported (use switch -Sg)'#000+
+  '0','5018_E_Label not found'#000+
   '05019_E_identifier isn'#039't a label'#000+
   '05020_E_label already defined'#000+
   '05021_E_illegal type declaration of set elements'#000+
   '05022_E_Forward class definition not resolved "$1"'#000+
-  '05023_H_Unit',' "$1" not used in $2'#000+
-  '05024_H_Parameter "$1" not used'#000+
+  '05023_H_Unit "$1" not used in $2'#000+
+  '05024_H_Parameter "$1','" not used'#000+
   '05025_N_Local variable "$1" not used'#000+
   '05026_H_Value parameter "$1" is assigned but never used'#000+
   '05027_N_Local variable "$1" is assigned but never used'#000+
   '05028_H_Local $1 "$2" is not used'#000+
-  '05029','_N_Private field "$1.$2" is never used'#000+
-  '05030_N_Private field "$1.$2" is assigned but never used'#000+
+  '05029_N_Private field "$1.$2" is never used'#000+
+  '050','30_N_Private field "$1.$2" is assigned but never used'#000+
   '05031_N_Private method "$1.$2" never used'#000+
   '05032_E_Set type expected'#000+
   '05033_W_Function result does not seem to be set'#000+
-  '05034_W_Type "$1" is not ali','gned correctly in current record for C'#000+
-  '05035_E_Unknown record field identifier "$1"'#000+
+  '05034_W_Type "$1" is not aligned correctly in current record for C'#000+
+  '050','35_E_Unknown record field identifier "$1"'#000+
   '05036_W_Local variable "$1" does not seem to be initialized'#000+
   '05037_W_Variable "$1" does not seem to be initialized'#000+
   '05038_E_identifier idents no member "$1"'#000+
-  '0','5039_B_Found declaration: $1'#000+
-  '05040_E_Data segment too large (max. 2GB)'#000+
+  '05039_B_Found declaration: $1'#000+
+  '05040_E_Data ','segment too large (max. 2GB)'#000+
   '06000_E_BREAK not allowed'#000+
   '06001_E_CONTINUE not allowed'#000+
   '06002_E_Expression too complicated - FPU stack overflow'#000+
   '06003_E_Illegal expression'#000+
-  '06004_E_Invalid integer express','ion'#000+
+  '06004_E_Invalid integer expression'#000+
   '06005_E_Illegal qualifier'#000+
-  '06006_E_High range limit < low range limit'#000+
+  '06006_E_High',' range limit < low range limit'#000+
   '06007_E_Illegal counter variable'#000+
   '06008_E_Can'#039't determine which overloaded function to call'#000+
   '06009_E_Parameter list size exceeds 65535 bytes'#000+
-  '06010_E_Illegal type convers','ion'#000+
-  '06011_D_Conversion between ordinals and pointers is not portable acros'+
-  's platforms'#000+
+  '06010_E_Illegal type conversion'#000+
+  '06011_D_Conversion between ordinals an','d pointers is not portable acr'+
+  'oss platforms'#000+
   '06012_E_File types must be var parameters'#000+
   '06013_E_The use of a far pointer isn'#039't allowed there'#000+
   '06014_E_illegal call by reference parameters'#000+
-  '06015_E_EXPORT',' declared functions can'#039't be called'#000+
-  '06016_W_Possible illegal call of constructor or destructor (doesn'#039't'+
-  ' match to this context)'#000+
+  '06015_E_EXPORT declared functions can'#039't be called'#000+
+  '06016_','W_Possible illegal call of constructor or destructor (doesn'#039+
+  't match to this context)'#000+
   '06017_N_Inefficient code'#000+
   '06018_W_unreachable code'#000+
   '06019_E_procedure call with stackframe ESP/SP'#000+
-  '06020_E_Abstract ','methods can'#039't be called directly'#000+
-  '06021_F_Internal Error in getfloatreg(), allocation failure'#000+
+  '06020_E_Abstract methods can'#039't be called directly'#000+
+  '06021_F_I','nternal Error in getfloatreg(), allocation failure'#000+
   '06022_F_Unknown float type'#000+
   '06023_F_SecondVecn() base defined twice'#000+
   '06024_F_Extended cg68k not supported'#000+
-  '06025_F_32-bit unsigned not supported in MC','68000 mode'#000+
-  '06026_F_Internal Error in secondinline()'#000+
+  '06025_F_32-bit unsigned not supported in MC68000 mode'#000+
+  '06026_F_Internal Error in secon','dinline()'#000+
   '06027_D_Register $1 weight $2 $3'#000+
   '06028_E_Stack limit excedeed in local routine'#000+
   '06029_D_Stack frame is omitted'#000+
   '06031_E_Object or class methods can'#039't be inline.'#000+
-  '06032_E_Procvar calls can'#039't b','e inline.'#000+
-  '06033_E_No code for inline procedure stored'#000+
+  '06032_E_Procvar calls can'#039't be inline.'#000+
+  '06033_E_No code for inline proce','dure stored'#000+
   '06034_E_Direct call of interrupt procedure "$1" is not possible'#000+
   '06035_E_Element zero of an ansi/wide- or longstring can'#039't be acces'+
   'sed, use (set)length instead'#000+
-  '06036_E_Include and exclude',' not implemented in this case'#000+
-  '06037_E_Constructors or destructors can not be called inside a '#039'wi'+
-  'th'#039' clause'#000+
+  '06036_E_Include and exclude not implemented in this case'#000+
+  '06037_E_Cons','tructors or destructors can not be called inside a '#039'w'+
+  'ith'#039' clause'#000+
   '06038_E_Cannot call message handler method directly'#000+
   '06039_E_Jump in or outside of an exception block'#000+
-  '06040_E_Control flow statements ','aren'#039't allowed in a finally bloc'+
-  'k'#000+
-  '07000_D_Starting $1 styled assembler parsing'#000+
+  '06040_E_Control flow statements aren'#039't allowed in a finally block'#000+
+  '07000_D_','Starting $1 styled assembler parsing'#000+
   '07001_D_Finished $1 styled assembler parsing'#000+
   '07002_E_Non-label pattern contains @'#000+
   '07003_W_Override operator not supported'#000+
   '07004_E_Error building record offset'#000+
-  '07','005_E_OFFSET used without identifier'#000+
-  '07006_E_TYPE used without identifier'#000+
+  '07005_E_OFFSET used without identifier'#000+
+  '07006','_E_TYPE used without identifier'#000+
   '07007_E_Cannot use local variable or parameters here'#000+
   '07008_E_need to use OFFSET here'#000+
   '07009_E_need to use $ here'#000+
   '07010_E_Cannot use multiple relocatable symbols'#000+
-  '07011_','E_Relocatable symbol can only be added'#000+
-  '07012_E_Invalid constant expression'#000+
+  '07011_E_Relocatable symbol can only be added'#000+
+  '070','12_E_Invalid constant expression'#000+
   '07013_E_Relocatable symbol is not allowed'#000+
   '07014_E_Invalid reference syntax'#000+
   '07015_E_You can not reach $1 from that code'#000+
-  '07016_E_Local symbols/labels aren'#039't allowed as',' references'#000+
-  '07017_E_Invalid base and index register usage'#000+
+  '07016_E_Local symbols/labels aren'#039't allowed as references'#000+
+  '07017_E_Invalid base and index',' register usage'#000+
   '07018_W_Possible error in object field handling'#000+
   '07019_E_Wrong scale factor specified'#000+
   '07020_E_Multiple index register usage'#000+
   '07021_E_Invalid operand type'#000+
-  '07022_E_Invalid string as opco','de operand: $1'#000+
-  '07023_W_@CODE and @DATA not supported'#000+
+  '07022_E_Invalid string as opcode operand: $1'#000+
+  '07023_W_@CODE and @DATA not',' supported'#000+
   '07024_E_Null label references are not allowed'#000+
   '07025_E_Divide by zero in asm evaluator'#000+
   '07026_E_Illegal expression'#000+
   '07027_E_escape sequence ignored: $1'#000+
   '07028_E_Invalid symbol reference'#000+
-  '07029','_W_Fwait can cause emulation problems with emu387'#000+
+  '07029_W_Fwait can cause emulation problems with',' emu387'#000+
   '07030_W_$1 without operand translated into $1P'#000+
   '07031_W_ENTER instruction is not supported by Linux kernel'#000+
   '07032_W_Calling an overload function in assembler'#000+
-  '07033_E_Unsupported symbol type fo','r operand'#000+
-  '07034_E_Constant value out of bounds'#000+
+  '07033_E_Unsupported symbol type for operand'#000+
+  '07034_E_Constant value out of bo','unds'#000+
   '07035_E_Error converting decimal $1'#000+
   '07036_E_Error converting octal $1'#000+
   '07037_E_Error converting binary $1'#000+
   '07038_E_Error converting hexadecimal $1'#000+
   '07039_H_$1 translated to $2'#000+
-  '07040_W_$1 is associ','ated to an overloaded function'#000+
-  '07041_E_Cannot use SELF outside a method'#000+
+  '07040_W_$1 is associated to an overloaded function'#000+
+  '07041_E_Can','not use SELF outside a method'#000+
   '07042_E_Cannot use OLDEBP outside a nested procedure'#000+
   '07043_W_Procedures can'#039't return any value in asm code'#000+
   '07044_E_SEG not supported'#000+
-  '07045_E_Size suffix and destination',' or source size do not match'#000+
-  '07046_W_Size suffix and destination or source size do not match'#000+
+  '07045_E_Size suffix and destination or source size do not match'#000+
+  '07046_W_Size ','suffix and destination or source size do not match'#000+
   '07047_E_Assembler syntax error'#000+
   '07048_E_Invalid combination of opcode and operands'#000+
   '07049_E_Assembler syntax error in operand'#000+
-  '07050_E_Assembler synta','x error in constant'#000+
-  '07051_E_Invalid String expression'#000+
+  '07050_E_Assembler syntax error in constant'#000+
+  '07051_E_Invalid String',' expression'#000+
   '07052_W_constant with symbol $1 for not 32bit address'#000+
   '07053_E_Unrecognized opcode $1'#000+
   '07054_E_Invalid or missing opcode'#000+
   '07055_E_Invalid combination of prefix and opcode: $1'#000+
-  '07056_E_Invali','d combination of override and opcode: $1'#000+
-  '07057_E_Too many operands on line'#000+
+  '07056_E_Invalid combination of override and opcode: $1'#000+
+  '0','7057_E_Too many operands on line'#000+
   '07058_W_NEAR ignored'#000+
   '07059_W_FAR ignored'#000+
   '07060_E_Duplicate local symbol $1'#000+
   '07061_E_Undefined local symbol $1'#000+
   '07062_E_Unknown label identifier $1'#000+
-  '07063_E_Invalid regi','ster name'#000+
-  '07064_E_Invalid floating point register name'#000+
+  '07063_E_Invalid register name'#000+
+  '07064_E_Invalid floating point r','egister name'#000+
   '07065_E_NOR not supported'#000+
   '07066_W_Modulo not supported'#000+
   '07067_E_Invalid floating point constant $1'#000+
   '07068_E_Invalid floating point expression'#000+
   '07069_E_Wrong symbol type'#000+
-  '07070_E_Cannot inde','x a local var or parameter with a register'#000+
+  '07070_E_Cannot index a local var or parameter with a register',#000+
   '07071_E_Invalid segment override expression'#000+
   '07072_W_Identifier $1 supposed external'#000+
   '07073_E_Strings not allowed as constants'#000+
   '07074_No type of variable specified'#000+
-  '07075_E_assembler code not returned ','to text section'#000+
-  '07076_E_Not a directive or local symbol $1'#000+
+  '07075_E_assembler code not returned to text section'#000+
+  '07076_E_Not a directive or',' local symbol $1'#000+
   '07077_E_Using a defined name as a local label'#000+
   '07078_E_Dollar token is used without an identifier'#000+
   '07079_W_32bit constant created for address'#000+
-  '07080_N_.align is target specific, use .b','align or .p2align'#000+
-  '07081_E_Can'#039't access fields directly for parameters'#000+
+  '07080_N_.align is target specific, use .balign or .p2align'#000+
+  '07081_E_Can'#039't access fie','lds directly for parameters'#000+
   '07082_E_Can'#039't access fields of objects/classes directly'#000+
   '07083_E_No size specified and unable to determine the size of the oper'+
   'ands'#000+
-  '07084_E_Cannot use RESULT in this funct','ion'#000+
+  '07084_E_Cannot use RESULT in this function'#000+
   '07085_H_RESULT is register $1'#000+
-  '07086_W_"$1" without operand translated into "$1 %st,%st(1)"'#000+
+  '07086_W_','"$1" without operand translated into "$1 %st,%st(1)"'#000+
   '07087_W_"$1 %st(n)" translated into "$1 %st,%st(n)"'#000+
   '07088_W_"$1 %st(n)" translated into "$1 %st(n),%st"'#000+
   '07089_E_Char < not allowed here'#000+
-  '07090_E_C','har > not allowed here'#000+
-  '07091_W_XDEF not supported'#000+
+  '07090_E_Char > not allowed here'#000+
+  '07091_W_XDEF not su','pported'#000+
   '07092_E_Invalid XDEF syntax'#000+
   '07093_W_ALIGN not supported'#000+
   '07094_E_Inc and Dec cannot be together'#000+
   '07095_E_Invalid reglist for movem'#000+
   '07096_E_Reglist invalid for opcode'#000+
-  '07097_E_68020 mode require','d'#000+
+  '07097_E_68020 mode required'#000+
   '08000_F_Too many assembler files'#000+
-  '08001_F_Selected assembler output not supported'#000+
+  '08001_F','_Selected assembler output not supported'#000+
   '08002_F_Comp not supported'#000+
   '08003_F_Direct not support for binary writers'#000+
   '08004_E_Allocating of data is only allowed in bss section'#000+
-  '08005_F_No binary writer s','elected'#000+
-  '08006_E_Asm: Opcode $1 not in table'#000+
+  '08005_F_No binary writer selected'#000+
+  '08006_E_Asm: Opcode $1 not in tabl','e'#000+
   '08007_E_Asm: $1 invalid combination of opcode and operands'#000+
   '08008_E_Asm: 16 Bit references not supported'#000+
   '08009_E_Asm: Invalid effective address'#000+
   '08010_E_Asm: Immediate or reference expected'#000+
-  '08011_E_','Asm: $1 value exceeds bounds $2'#000+
-  '08012_E_Asm: Short jump is out of range $1'#000+
+  '08011_E_Asm: $1 value exceeds bounds $2'#000+
+  '08012_E_As','m: Short jump is out of range $1'#000+
   '08013_E_Asm: Undefined label $1'#000+
   '08014_E_Asm: Comp type not supported for this target'#000+
   '08015_E_Asm: Extended type not supported for this target'#000+
-  '08016_E_Asm: Duplicate ','label $1'#000+
-  '09000_W_Source operating system redefined'#000+
+  '08016_E_Asm: Duplicate label $1'#000+
+  '09000_W_Source operating system r','edefined'#000+
   '09001_I_Assembling (pipe) $1'#000+
   '09002_E_Can'#039't create assember file: $1'#000+
   '09003_E_Can'#039't create object file: $1'#000+
   '09004_E_Can'#039't create archive file: $1'#000+
-  '09005_E_Assembler $1 not found, switching to e','xternal assembling'#000+
-  '09006_T_Using assembler: $1'#000+
+  '09005_E_Assembler $1 not found, switching to external assembling'#000+
+  '09006_T_Using assembler',': $1'#000+
   '09007_E_Error while assembling exitcode $1'#000+
   '09008_E_Can'#039't call the assembler, error $1 switching to external a'+
   'ssembling'#000+
   '09009_I_Assembling $1'#000+
   '09010_I_Assembling smartlink $1'#000+
-  '09011_W_Object $1 no','t found, Linking may fail !'#000+
-  '09012_W_Library $1 not found, Linking may fail !'#000+
+  '09011_W_Object $1 not found, Linking may fail !'#000+
+  '09012_W_Librar','y $1 not found, Linking may fail !'#000+
   '09013_E_Error while linking'#000+
   '09014_E_Can'#039't call the linker, switching to external linking'#000+
   '09015_I_Linking $1'#000+
-  '09016_E_Util $1 not found, switching to external linkin','g'#000+
+  '09016_E_Util $1 not found, switching to external linking'#000+
   '09017_T_Using util $1'#000+
-  '09018_E_Creation of Executables not supported'#000+
+  '09018_E_Creation o','f Executables not supported'#000+
   '09019_E_Creation of Dynamic/Shared Libraries not supported'#000+
   '09020_I_Closing script $1'#000+
   '09021_E_resource compiler not found, switching to external mode'#000+
-  '09022_I_Compiling res','ource $1'#000+
-  '09023_T_unit $1 can'#039't be static linked, switching to smart linking'+
-  #000+
+  '09022_I_Compiling resource $1'#000+
+  '09023_T_unit $1 can'#039't be static l','inked, switching to smart linki'+
+  'ng'#000+
   '09024_T_unit $1 can'#039't be smart linked, switching to static linking'+
   #000+
   '09025_T_unit $1 can'#039't be shared linked, switching to static linkin'+
   'g'#000+
-  '09026_E_unit $1 can'#039't be smar','t or static linked'#000+
-  '09027_E_unit $1 can'#039't be shared or static linked'#000+
+  '09026_E_unit $1 can'#039't be smart or static linked'#000+
+  '09027_E_unit $1 can'#039't b','e shared or static linked'#000+
   '09028_F_Can'#039't post process executable $1'#000+
   '09029_F_Can'#039't open executable $1'#000+
   '09030_X_Size of Code: $1 bytes'#000+
   '09031_X_Size of initialized data: $1 bytes'#000+
-  '09032_X_Size of uninitia','lized data: $1 bytes'#000+
-  '09033_X_Stack space reserved: $1 bytes'#000+
+  '09032_X_Size of uninitialized data: $1 bytes'#000+
+  '09033_X_Stack space r','eserved: $1 bytes'#000+
   '09034_X_Stack space commited: $1 bytes'#000+
   '10000_T_Unitsearch: $1'#000+
   '10001_T_PPU Loading $1'#000+
@@ -589,248 +587,248 @@ const msgtxt : array[0..000141,1..240] of char=(
   '10003_U_PPU Flags: $1'#000+
   '10004_U_PPU Crc: $1'#000+
   '10005_U_PPU Time: $1'#000+
-  '10006_U_PPU',' File too short'#000+
-  '10007_U_PPU Invalid Header (no PPU at the begin)'#000+
+  '10006_U_PPU File too short'#000+
+  '10007_U_PPU Invalid Header',' (no PPU at the begin)'#000+
   '10008_U_PPU Invalid Version $1'#000+
   '10009_U_PPU is compiled for an other processor'#000+
   '10010_U_PPU is compiled for an other target'#000+
   '10011_U_PPU Source: $1'#000+
   '10012_U_Writing $1'#000+
-  '10013_F_Can',#039't Write PPU-File'#000+
-  '10014_F_Error reading PPU-File'#000+
+  '10013_F_Can'#039't Write PPU-File'#000+
+  '10014_F_Error reading PP','U-File'#000+
   '10015_F_unexpected end of PPU-File'#000+
   '10016_F_Invalid PPU-File entry: $1'#000+
   '10017_F_PPU Dbx count problem'#000+
   '10018_E_Illegal unit name: $1'#000+
   '10019_F_Too much units'#000+
-  '10020_F_Circular unit reference betwee','n $1 and $2'#000+
-  '10021_F_Can'#039't compile unit $1, no sources available'#000+
+  '10020_F_Circular unit reference between $1 and $2'#000+
+  '10021_F_Can'#039't compile unit $1,',' no sources available'#000+
   '10022_F_Can'#039't find unit $1'#000+
   '10023_W_Unit $1 was not found but $2 exists'#000+
   '10024_F_Unit $1 searched but $2 found'#000+
   '10025_W_Compiling the system unit requires the -Us switch'#000+
-  '10026_F_T','here were $1 errors compiling module, stopping'#000+
+  '10026_F_There were $1 errors compiling module, stop','ping'#000+
   '10027_U_Load from $1 ($2) unit $3'#000+
   '10028_U_Recompiling $1, checksum changed for $2'#000+
   '10029_U_Recompiling $1, source found only'#000+
   '10030_U_Recompiling unit, static lib is older than ppufile'#000+
-  '10031_U_Re','compiling unit, shared lib is older than ppufile'#000+
+  '10031_U_Recompiling unit, shared lib is older than p','pufile'#000+
   '10032_U_Recompiling unit, obj and asm are older than ppufile'#000+
   '10033_U_Recompiling unit, obj is older than asm'#000+
   '10034_U_Parsing interface of $1'#000+
   '10035_U_Parsing implementation of $1'#000+
-  '10036_U_Secon','d load for unit $1'#000+
-  '10037_U_PPU Check file $1 time $2'#000+
+  '10036_U_Second load for unit $1'#000+
+  '10037_U_PPU Check file ','$1 time $2'#000+
   '10038_H_Conditional $1 was not set at startup in last compilation of $'+
   '2'#000+
   '10039_H_Conditional $1 was set at startup in last compilation of $2'#000+
-  '10040_W_Can'#039't recompile unit $1, but found modi','fed include files'+
-  #000+
-  '10041_H_File $1 is newer than Release PPU file $2'#000+
+  '10040_W_Can'#039't recompile unit $1, but found modifed include files'#000+
+  '10041_H_File $1 is newer',' than Release PPU file $2'#000+
   '11000_$1 [options] <inputfile> [options]'#000+
   '11001_W_Only one source file supported'#000+
   '11002_W_DEF file can be created only for OS/2'#000+
-  '11003_E_nested response files are not supporte','d'#000+
-  '11004_F_No source file name in command line'#000+
+  '11003_E_nested response files are not supported'#000+
+  '11004_F_No source file name in command l','ine'#000+
   '11005_N_No option inside $1 config file'#000+
   '11006_E_Illegal parameter: $1'#000+
   '11007_H_-? writes help pages'#000+
   '11008_F_Too many config files nested'#000+
   '11009_F_Unable to open file $1'#000+
-  '11010_D_Reading further opt','ions from $1'#000+
-  '11011_W_Target is already set to: $1'#000+
+  '11010_D_Reading further options from $1'#000+
+  '11011_W_Target is already set',' to: $1'#000+
   '11012_W_Shared libs not supported on DOS platform, reverting to static'+
   #000+
   '11013_F_too many IF(N)DEFs'#000+
   '11014_F_too many ENDIFs'#000+
   '11015_F_open conditional at the end of the file'#000+
-  '11016_W_Debug inform','ation generation is not supported by this execut'+
+  '11016_W_Debug information generation is not supported by this ','execut'+
   'able'#000+
   '11017_H_Try recompiling with -dGDB'#000+
   '11018_E_You are using the obsolete switch $1'#000+
   '11019_E_You are using the obsolete switch $1, please use $2'#000+
-  '11020_N_Switching assembler to default source w','riting assembler'#000+
-  '11021_W_Assembler output selected "$1" is not compatible with "$2"'#000+
+  '11020_N_Switching assembler to default source writing assembler'#000+
+  '11021_W_Assembler output ','selected "$1" is not compatible with "$2"'#000+
   '11022_W_"$1" assembler use forced'#000+
   '11026_T_Reading options from file $1'#000+
   '11027_T_Reading options from environment $1'#000+
   '11028_D_Handling option "$1"'#000+
-  '11029__*** p','ress enter ***'#000+
-  '11023_Free Pascal Compiler version $FPCVER [$FPCDATE] for $FPCTARGET'#010+
+  '11029__*** press enter ***'#000+
+  '11023_Free Pascal Compiler ','version $FPCVER [$FPCDATE] for $FPCTARGET'+
+  #010+
   'Copyright (c) 1993-2002 by Florian Klaempfl'#000+
   '11024_Free Pascal Compiler version $FPCVER'#010+
   #010+
   'Compiler Date  : $FPCDATE'#010+
   'Compiler Target: $FPCTARGET'#010+
   #010+
-  'Supported tar','gets:'#010+
+  'Supported targets:'#010+
   '  $OSTARGETS'#010+
   #010+
-  'This program comes under the GNU General Public Licence'#010+
+  'This program comes und','er the GNU General Public Licence'#010+
   'For more information read COPYING.FPC'#010+
   #010+
   'Report bugs,suggestions etc to:'#010+
   '                 [email protected]'#000+
-  '11025_**0*_put + after a boolean switch option to enab','le it, - to di'+
-  'sable it'#010+
-  '**1a_the compiler doesn'#039't delete the generated assembler file'#010+
+  '11025_**0*_put + after a boolean switch option to enable it, - to disa'+
+  'ble it'#010+
+  '**1a_the compiler d','oesn'#039't delete the generated assembler file'#010+
   '**2al_list sourcecode lines in assembler file'#010+
   '**2ar_list register allocation/release info in assembler file'#010+
-  '**2at_list temp allocation/release info in asse','mbler file'#010+
+  '**2at_list temp allocation/release info in assembler file'#010+
   '**1b_generate browser info'#010+
-  '**2bl_generate local symbol info'#010+
+  '**2b','l_generate local symbol info'#010+
   '**1B_build all modules'#010+
   '**1C<x>_code generation options:'#010+
   '**2CD_create also dynamic library (not supported)'#010+
   '**2Ch<n>_<n> bytes heap (between 1023 and 67107840)'#010+
-  '**2Ci_IO-ch','ecking'#010+
+  '**2Ci_IO-checking'#010+
   '**2Cn_omit linking stage'#010+
-  '**2Co_check overflow of integer operations'#010+
+  '**2Co_chec','k overflow of integer operations'#010+
   '**2Cr_range checking'#010+
   '**2CR_verify object method call validity'#010+
   '**2Cs<n>_set stack size to <n>'#010+
   '**2Ct_stack checking'#010+
   '**2CX_create also smartlinked library'#010+
-  '**1d<x>_defin','es the symbol <x>'#010+
-  '*O1D_generate a DEF file'#010+
+  '**1d<x>_defines the symbol <x>'#010+
+  '*O1D_generate a DEF file',#010+
   '*O2Dd<x>_set description to <x>'#010+
   '*O2Dw_PM application'#010+
   '**1e<x>_set path to executable'#010+
   '**1E_same as -Cn'#010+
   '**1F<x>_set file names and paths:'#010+
-  '**2FD<x>_sets the directory where to search for compiler utili','ties'#010+
-  '**2Fe<x>_redirect error output to <x>'#010+
+  '**2FD<x>_sets the directory where to search for compiler utilities'#010+
+  '**2Fe<x>_redirect error output to <x>',#010+
   '**2FE<x>_set exe/unit output path to <x>'#010+
   '**2Fi<x>_adds <x> to include path'#010+
   '**2Fl<x>_adds <x> to library path'#010+
   '*L2FL<x>_uses <x> as dynamic linker'#010+
   '**2Fo<x>_adds <x> to object path'#010+
-  '**2Fr<x>_load error',' message file <x>'#010+
-  '**2Fu<x>_adds <x> to unit path'#010+
+  '**2Fr<x>_load error message file <x>'#010+
+  '**2Fu<x>_adds <x> to uni','t path'#010+
   '**2FU<x>_set unit output path to <x>, overrides -FE'#010+
   '*g1g_generate debugger information:'#010+
   '*g2gg_use gsym'#010+
   '*g2gd_use dbx'#010+
   '*g2gh_use heap trace unit (for memory leak debugging)'#010+
-  '*g2gl_use line info ','unit to show more info for backtraces'#010+
-  '*g2gc_generate checks for pointers'#010+
+  '*g2gl_use line info unit to show more info for backtraces'#010+
+  '*g2g','c_generate checks for pointers'#010+
   '**1i_information'#010+
   '**2iD_return compiler date'#010+
   '**2iV_return compiler version'#010+
   '**2iSO_return compiler OS'#010+
   '**2iSP_return compiler processor'#010+
   '**2iTO_return target OS'#010+
-  '**2iTP_ret','urn target processor'#010+
-  '**1I<x>_adds <x> to include path'#010+
+  '**2iTP_return target processor'#010+
+  '**1I<x>_adds <x> to i','nclude path'#010+
   '**1k<x>_Pass <x> to the linker'#010+
   '**1l_write logo'#010+
   '**1n_don'#039't read the default config file'#010+
   '**1o<x>_change the name of the executable produced to <x>'#010+
-  '**1pg_generate profile code for gprof (de','fines FPC_PROFILE)'#010+
-  '*L1P_use pipes instead of creating temporary assembler files'#010+
+  '**1pg_generate profile code for gprof (defines FPC_PROFILE)'#010+
+  '*L1P_use pipes instead ','of creating temporary assembler files'#010+
   '**1S<x>_syntax options:'#010+
   '**2S2_switch some Delphi 2 extensions on'#010+
   '**2Sc_supports operators like C (*=,+=,/= and -=)'#010+
   '**2Sa_include assertion code.'#010+
-  '**2Sd_tries to ','be Delphi compatible'#010+
-  '**2Se<x>_compiler stops after the <x> errors (default is 1)'#010+
+  '**2Sd_tries to be Delphi compatible'#010+
+  '**2Se<x>_compiler sto','ps after the <x> errors (default is 1)'#010+
   '**2Sg_allow LABEL and GOTO'#010+
   '**2Sh_Use ansistrings'#010+
   '**2Si_support C++ styled INLINE'#010+
   '**2Sm_support macros like C (global)'#010+
   '**2So_tries to be TP/BP 7.0 compatible'#010+
-  '**','2Sp_tries to be gpc compatible'#010+
-  '**2Ss_constructor name must be init (destructor must be done)'#010+
+  '**2Sp_tries to be gpc compatible'#010+
+  '**2Ss_const','ructor name must be init (destructor must be done)'#010+
   '**2St_allow static keyword in objects'#010+
   '**1s_don'#039't call assembler and linker (only with -a)'#010+
   '**2st_Generate script to link on target'#010+
-  '**2sh_Generate sc','ript to link on host'#010+
-  '**1u<x>_undefines the symbol <x>'#010+
+  '**2sh_Generate script to link on host'#010+
+  '**1u<x>_undefines the',' symbol <x>'#010+
   '**1U_unit options:'#010+
   '**2Un_don'#039't check the unit name'#010+
   '**2Ur_generate release unit files'#010+
   '**2Us_compile a system unit'#010+
   '**1v<x>_Be verbose. <x> is a combination of the following letters:'#010+
-  '**2*_e',' : Show errors (default)       d : Show debug info'#010+
+  '**2*_e : Show errors (default)       d : Show de','bug info'#010+
   '**2*_w : Show warnings               u : Show unit info'#010+
   '**2*_n : Show notes                  t : Show tried/used files'#010+
   '**2*_h : Show hints                  m : Show defined macros'#010+
-  '**2*_i : ','Show general info           p : Show compiled procedures'#010+
+  '**2*_i : Show general info           p : Show compi','led procedures'#010+
   '**2*_l : Show linenumbers            c : Show conditionals'#010+
   '**2*_a : Show everything             0 : Show nothing (except errors)'#010+
-  '**2*_b : Show all procedure          r : Rhide/GCC com','patibility mod'+
-  'e'#010+
-  '**2*_    declarations if an error    x : Executable info (Win32 only)'#010+
+  '**2*_b : Show all procedure          r : Rhide/GCC compatibility mode'#010+
+  '**2*_    declarations if a','n error    x : Executable info (Win32 only'+
+  ')'#010+
   '**2*_    occurs'#010+
   '**1X_executable options:'#010+
   '*L2Xc_link with the c library'#010+
   '**2Xs_strip all symbols from executable'#010+
-  '**2XD_try to link dynamic          (defines',' FPC_LINK_DYNAMIC)'#010+
-  '**2XS_try to link static (default) (defines FPC_LINK_STATIC)'#010+
+  '**2XD_try to link dynamic          (defines FPC_LINK_DYNAMIC)'#010+
+  '**2XS_try to link stati','c (default) (defines FPC_LINK_STATIC)'#010+
   '**2XX_try to link smart            (defines FPC_LINK_SMART)'#010+
   '**0*_Processor specific options:'#010+
   '3*1A<x>_output format:'#010+
   '3*2Aas_assemble using GNU AS'#010+
-  '3*2Aasaout_asse','mble using GNU AS for aout (Go32v1)'#010+
-  '3*2Anasmcoff_coff (Go32v2) file using Nasm'#010+
+  '3*2Aasaout_assemble using GNU AS for aout (Go32v1)'#010+
+  '3*2Ana','smcoff_coff (Go32v2) file using Nasm'#010+
   '3*2Anasmelf_elf32 (Linux) file using Nasm'#010+
   '3*2Anasmobj_obj file using Nasm'#010+
   '3*2Amasm_obj file using Masm (Microsoft)'#010+
   '3*2Atasm_obj file using Tasm (Borland)'#010+
-  '3*2Acof','f_coff (Go32v2) using internal writer'#010+
-  '3*2Apecoff_pecoff (Win32) using internal writer'#010+
+  '3*2Acoff_coff (Go32v2) using internal writer'#010+
+  '3*2A','pecoff_pecoff (Win32) using internal writer'#010+
   '3*1R<x>_assembler reading style:'#010+
   '3*2Ratt_read AT&T style assembler'#010+
   '3*2Rintel_read Intel style assembler'#010+
-  '3*2Rdirect_copy assembler text directly to assembl','er file'#010+
+  '3*2Rdirect_copy assembler text directly to assembler file'#010+
   '3*1O<x>_optimizations:'#010+
-  '3*2Og_generate smaller code'#010+
+  '3*2Og_gener','ate smaller code'#010+
   '3*2OG_generate faster code (default)'#010+
   '3*2Or_keep certain variables in registers'#010+
   '3*2Ou_enable uncertain optimizations (see docs)'#010+
   '3*2O1_level 1 optimizations (quick optimizations)'#010+
-  '3*2O','2_level 2 optimizations (-O1 + slower optimizations)'#010+
+  '3*2O2_level 2 optimizations (-O1 + slower opti','mizations)'#010+
   '3*2O3_level 3 optimizations (-O2 repeatedly, max 5 times)'#010+
   '3*2Op<x>_target processor:'#010+
   '3*3Op1_set target processor to 386/486'#010+
   '3*3Op2_set target processor to Pentium/PentiumMMX (tm)'#010+
-  '3*3Op3_s','et target processor to PPro/PII/c6x86/K6 (tm)'#010+
+  '3*3Op3_set target processor to PPro/PII/c6x86/K6 (','tm)'#010+
   '3*1T<x>_Target operating system:'#010+
   '3*2TGO32V2_version 2 of DJ Delorie DOS extender'#010+
   '3*2TWDOSX DOS 32 Bit Extender'#010+
   '3*2TLINUX_Linux'#010+
   '3*2Tnetware_Novell Netware Module (experimental)'#010+
   '3*2TOS2_OS/2 2.x'#010+
-  '3','*2TSUNOS_SunOS/Solaris'#010+
-  '3*2TWin32_Windows 32 Bit'#010+
+  '3*2TSUNOS_SunOS/Solaris'#010+
+  '3*2TWin32_Windows 3','2 Bit'#010+
   '3*1W<x>_Win32 target options'#010+
   '3*2WB<x>_Set Image base to Hexadecimal <x> value'#010+
   '3*2WC_Specify console type application'#010+
   '3*2WD_Use DEFFILE to export functions of DLL or EXE'#010+
-  '3*2WF_Specify full-scre','en type application (OS/2 only)'#010+
-  '3*2WG_Specify graphic type application'#010+
+  '3*2WF_Specify full-screen type application (OS/2 only)'#010+
+  '3*2WG_Spec','ify graphic type application'#010+
   '3*2WN_Do not generate relocation code (necessary for debugging)'#010+
   '3*2WR_Generate relocation code'#010+
   '6*1A<x>_output format'#010+
   '6*2Aas_Unix o-file using GNU AS'#010+
-  '6*2Agas_GNU Motorola',' assembler'#010+
+  '6*2Agas_GNU Motorola assembler'#010+
   '6*2Amit_MIT Syntax (old GAS)'#010+
-  '6*2Amot_Standard Motorola assembler'#010+
+  '6*','2Amot_Standard Motorola assembler'#010+
   '6*1O_optimizations:'#010+
   '6*2Oa_turn on the optimizer'#010+
   '6*2Og_generate smaller code'#010+
   '6*2OG_generate faster code (default)'#010+
   '6*2Ox_optimize maximum (still BUGGY!!!)'#010+
-  '6*2O2_set t','arget processor to a MC68020+'#010+
-  '6*1R<x>_assembler reading style:'#010+
+  '6*2O2_set target processor to a MC68020+'#010+
+  '6*1R<x>_asse','mbler reading style:'#010+
   '6*2RMOT_read motorola style assembler'#010+
   '6*1T<x>_Target operating system:'#010+
   '6*2TAMIGA_Commodore Amiga'#010+
   '6*2TATARI_Atari ST/STe/TT'#010+
   '6*2TMACOS_Macintosh m68k'#010+
   '6*2TLINUX_Linux-68k'#010+
-  '6*2TPALMO','S_PalmOS'#010+
+  '6*2TPALMOS_PalmOS'#010+
   '**1*_'#010+
   '**1?_shows this help'#010+
-  '**1h_shows this help without waiting'#000
+  '**1h_s','hows this help without waiting'#000
 );

+ 58 - 48
compiler/ncal.pas

@@ -1530,6 +1530,9 @@ implementation
       label
         errorexit;
       begin
+         { the default is nothing to return }
+         location.loc:=LOC_INVALID;
+
          result:=nil;
          inlined:=false;
          inlinecode := nil;
@@ -1560,8 +1563,6 @@ implementation
          else
          { not a procedure variable }
            begin
-              location.loc:=LOC_CREFERENCE;
-
               { calc the correture value for the register }
               { handle predefined procedures }
               if (procdefinition.proccalloption=pocall_inline) then
@@ -1601,50 +1602,47 @@ implementation
          { get a register for the return value }
          if (not is_void(resulttype.def)) then
            begin
-              if (procdefinition.proctypeoption=potype_constructor) then
-                begin
-                   { extra handling of classes }
-                   { methodpointer should be assigned! }
-                   if assigned(methodpointer) and
-                      assigned(methodpointer.resulttype.def) and
-                      (methodpointer.resulttype.def.deftype=classrefdef) then
-                     begin
-                        location.loc:=LOC_REGISTER;
-                        registers32:=1;
-                     end
-                  { a object constructor returns the result with the flags }
-                   else
-                     location.loc:=LOC_FLAGS;
-                end
-              else
-                begin
-{$ifdef SUPPORT_MMX}
-                   if (cs_mmx in aktlocalswitches) and
-                     is_mmx_able_array(resulttype.def) then
-                     begin
-                        location.loc:=LOC_MMXREGISTER;
-                        registersmmx:=1;
-                     end
-                   else
-{$endif SUPPORT_MMX}
-                   if ret_in_acc(resulttype.def) then
+             if ret_in_param(resulttype.def) then
+              begin
+                location.loc:=LOC_CREFERENCE;
+              end
+             else
+             { ansi/widestrings must be registered, so we can dispose them }
+              if is_ansistring(resulttype.def) or
+                 is_widestring(resulttype.def) then
+               begin
+                 location.loc:=LOC_CREFERENCE;
+                 registers32:=1;
+               end
+             else
+             { we have only to handle the result if it is used }
+              if (nf_return_value_used in flags) then
+               begin
+                 case resulttype.def.deftype of
+                   enumdef,
+                   orddef :
                      begin
-                        location.loc:=LOC_REGISTER;
-                        if is_64bitint(resulttype.def) then
-                          registers32:=2
-                        else
-                          registers32:=1;
-
-                        { wide- and ansistrings are returned in EAX    }
-                        { but they are imm. moved to a memory location }
-                        if is_widestring(resulttype.def) or
-                           is_ansistring(resulttype.def) then
-                          begin
-                             location.loc:=LOC_CREFERENCE;
+                       if (procdefinition.proctypeoption=potype_constructor) then
+                        begin
+                          if assigned(methodpointer) and
+                             (methodpointer.resulttype.def.deftype=classrefdef) then
+                           begin
+                             location.loc:=LOC_REGISTER;
                              registers32:=1;
-                          end;
-                     end
-                   else if (resulttype.def.deftype=floatdef) then
+                           end
+                          else
+                           location.loc:=LOC_FLAGS;
+                        end
+                       else
+                        begin
+                          location.loc:=LOC_REGISTER;
+                          if is_64bitint(resulttype.def) then
+                            registers32:=2
+                          else
+                            registers32:=1;
+                        end;
+                     end;
+                   floatdef :
                      begin
                        location.loc:=LOC_FPUREGISTER;
 {$ifdef m68k}
@@ -1656,10 +1654,14 @@ implementation
 {$else not m68k}
                         registersfpu:=1;
 {$endif not m68k}
-                     end
+                     end;
                    else
-                     location.loc:=LOC_CREFERENCE;
-                end;
+                     begin
+                       location.loc:=LOC_REGISTER;
+                       registers32:=1;
+                     end;
+                 end;
+               end;
            end;
          { a fpu can be used in any procedure !! }
          registersfpu:=procdefinition.fpu_used;
@@ -1827,7 +1829,15 @@ begin
 end.
 {
   $Log$
-  Revision 1.68  2002-04-15 18:57:22  carl
+  Revision 1.69  2002-04-15 19:44:19  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.68  2002/04/15 18:57:22  carl
   + target_info.size_of_pointer -> pointer_Size
 
   Revision 1.67  2002/04/02 17:11:28  peter

+ 15 - 76
compiler/ncgcnv.pas

@@ -189,7 +189,6 @@ interface
          case tstringdef(resulttype.def).string_typ of
            st_shortstring :
              begin
-               secondpass(left);
                tg.gettempofsizereference(exprasmlist,256,location.reference);
                cg.a_load_loc_ref(exprasmlist,left.location,
                  location.reference);
@@ -253,89 +252,21 @@ interface
 
 
     procedure tcgtypeconvnode.second_bool_to_int;
-
       var
-         oldtruelabel,oldfalselabel,hlabel : tasmlabel;
-         newsize,
-         opsize : tcgsize;
-
+         oldtruelabel,oldfalselabel : tasmlabel;
       begin
          oldtruelabel:=truelabel;
          oldfalselabel:=falselabel;
          getlabel(truelabel);
          getlabel(falselabel);
          secondpass(left);
+         location_copy(location,left.location);
          { byte(boolean) or word(wordbool) or longint(longbool) must }
          { be accepted for var parameters                            }
-         if (nf_explizit in flags) and
-            (left.resulttype.def.size=resulttype.def.size) and
-            (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER]) then
-           begin
-              location_copy(location,left.location);
-              truelabel:=oldtruelabel;
-              falselabel:=oldfalselabel;
-              exit;
-           end;
-         { size of the boolean we're converting }
-         opsize := def_cgsize(left.resulttype.def);
-         { size of the destination }
-         newsize := def_cgsize(resulttype.def);
-         { reset location for destination }
-         location_reset(location,LOC_REGISTER,newsize);
-         location.register:=rg.getregisterint(exprasmlist);
-         { if the source size is bigger than the destination, we can }
-         { simply decrease the sources size (since wordbool(true) =   }
-         { boolean(true) etc... (JM)                                  }
-         case newsize of
-           OS_8,OS_S8:
-             begin
-               opsize := OS_8;
-{$ifdef i386}
-               location.register := makereg8(location.register);
-               if left.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
-                 makereg8(left.location.register);
-{$endif i386}
-             end;
-           OS_16,OS_S16:
-             begin
-{$ifdef i386}
-               location.register := makereg16(location.register);
-{$endif i386}
-               if opsize in [OS_32,OS_S32] then
-                 begin
-                   opsize := OS_16;
-{$ifdef i386}
-                   if (left.location.loc in [LOC_REGISTER,LOC_CREGISTER]) then
-                     makereg16(left.location.register);
-{$endif i386}
-                 end
-             end;
-         end;
-         case left.location.loc of
-            LOC_CREFERENCE,
-            LOC_REFERENCE :
-              cg.a_load_ref_reg(exprasmlist,opsize,left.location.reference,
-                location.register);
-            LOC_REGISTER,
-            LOC_CREGISTER :
-              if left.location.register<>location.register then
-                cg.a_load_reg_reg(exprasmlist,opsize,left.location.register,
-                  location.register);
-            LOC_FLAGS :
-              cg.g_flags2reg(exprasmlist,left.location.resflags,location.register);
-            LOC_JUMP :
-              begin
-                getlabel(hlabel);
-                cg.a_label(exprasmlist,truelabel);
-                cg.a_load_const_reg(exprasmlist,newsize,1,location.register);
-                cg.a_jmp_cond(exprasmlist,OC_NONE,hlabel);
-                cg.a_label(exprasmlist,falselabel);
-                cg.a_load_const_reg(exprasmlist,newsize,0,location.register);
-                cg.a_label(exprasmlist,hlabel);
-              end;
-            else
-              internalerror(10061);
-         end;
+         if not((nf_explizit in flags) and
+                (left.resulttype.def.size=resulttype.def.size) and
+                (left.location.loc in [LOC_REFERENCE,LOC_CREFERENCE,LOC_CREGISTER])) then
+           location_force_reg(location,def_cgsize(resulttype.def),false);
          truelabel:=oldtruelabel;
          falselabel:=oldfalselabel;
       end;
@@ -440,7 +371,15 @@ end.
 
 {
   $Log$
-  Revision 1.8  2002-04-06 18:10:42  jonas
+  Revision 1.9  2002-04-15 19:44:19  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.8  2002/04/06 18:10:42  jonas
     * several powerpc-related additions and fixes
 
   Revision 1.7  2002/04/04 19:05:57  peter

+ 11 - 10
compiler/ncgflw.pas

@@ -476,7 +476,7 @@ implementation
                   begin
                     cg.a_reg_alloc(exprasmlist,accumulator);
 {$ifdef i386}
-                    hreg:=makereg8(accumulator);
+                    hreg:=Changeregsize(accumulator,S_B);
 {$else i386}
                     hreg:=accumulator;
 {$endif i386}
@@ -520,14 +520,7 @@ implementation
                       else
                         begin
 {$ifdef i386}
-                          case cgsize of
-                            OS_8,OS_S8 :
-                              hreg:=makereg8(accumulator);
-                            OS_16,OS_S16 :
-                              hreg:=makereg16(accumulator);
-                            else
-                              hreg:=accumulator;
-                          end;
+                          hreg:=Changeregsize(accumulator,TCGsize2Opsize[cgsize]);
 {$else}
                           hreg:=accumulator;
 {$endif}
@@ -625,7 +618,15 @@ begin
 end.
 {
   $Log$
-  Revision 1.11  2002-04-04 19:05:57  peter
+  Revision 1.12  2002-04-15 19:44:19  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.11  2002/04/04 19:05:57  peter
     * removed unused units
     * use tlocation.size in cg.a_*loc*() routines
 

+ 31 - 16
compiler/regvars.pas

@@ -191,13 +191,13 @@ implementation
                        if (regvarinfo^.regvars[i].vartype.def.deftype in [orddef,enumdef]) and
                           (torddef(regvarinfo^.regvars[i].vartype.def).size=1) then
                         begin
-                          regvarinfo^.regvars[i].reg:=reg32toreg8(varregs[i]);
+                          regvarinfo^.regvars[i].reg:=changeregsize(varregs[i],S_B);
                         end
                       else
                        if (regvarinfo^.regvars[i].vartype.def.deftype in [orddef,enumdef]) and
                           (torddef(regvarinfo^.regvars[i].vartype.def).size=2) then
                          begin
-                           regvarinfo^.regvars[i].reg:=reg32toreg16(varregs[i]);
+                           regvarinfo^.regvars[i].reg:=changeregsize(varregs[i],S_W);
                          end
                       else
 {$endif i386}
@@ -275,9 +275,9 @@ implementation
         exit;
       for i := 1 to maxvarregs do
         if assigned(regvarinfo^.regvars[i]) and
-           (makereg32(regvarinfo^.regvars[i].reg) = reg) then
+           (changeregsize(regvarinfo^.regvars[i].reg,S_L) = reg) then
           begin
-            if rg.regvar_loaded[makereg32(reg)] then
+            if rg.regvar_loaded[changeregsize(reg,S_L)] then
               begin
                 vsym := tvarsym(regvarinfo^.regvars[i]);
                 { we only have to store the regvar back to memory if it's }
@@ -291,8 +291,8 @@ implementation
                     hr.base:=procinfo^.framepointer;
                     cg.a_load_reg_ref(asml,def_cgsize(vsym.vartype.def),vsym.reg,hr);
                   end;
-                asml.concat(Tairegalloc.dealloc(makereg32(reg)));
-                rg.regvar_loaded[makereg32(reg)] := false;
+                asml.concat(Tairegalloc.dealloc(changeregsize(reg,S_L)));
+                rg.regvar_loaded[changeregsize(reg,S_L)] := false;
               end;
             break;
           end;
@@ -302,10 +302,12 @@ implementation
     var
       hr: treference;
       opsize: tcgsize;
+      reg32 : tregister;
     begin
-      if not rg.regvar_loaded[makereg32(vsym.reg)] then
+      reg32:=changeregsize(vsym.reg,S_L);
+      if not rg.regvar_loaded[reg32] then
         begin
-          asml.concat(Tairegalloc.alloc(makereg32(vsym.reg)));
+          asml.concat(Tairegalloc.alloc(reg32));
           reference_reset(hr);
           if vsym.owner.symtabletype in [inlinelocalsymtable,localsymtable] then
             hr.offset:=-vsym.address+vsym.owner.address_fixup
@@ -317,8 +319,8 @@ implementation
             opsize := OS_ADDR
           else
             opsize := def_cgsize(vsym.vartype.def);
-          cg.a_load_ref_reg(asml,opsize,hr,makereg32(vsym.reg));
-          rg.regvar_loaded[makereg32(vsym.reg)] := true;
+          cg.a_load_ref_reg(asml,opsize,hr,reg32);
+          rg.regvar_loaded[reg32] := true;
         end;
     end;
 
@@ -326,14 +328,15 @@ implementation
     var
       i: longint;
       regvarinfo: pregvarinfo;
+      reg32 : tregister;
     begin
       regvarinfo := pregvarinfo(aktprocdef.regvarinfo);
       if not assigned(regvarinfo) then
         exit;
-      reg := makereg32(reg);
+      reg32 := changeregsize(reg,S_L);
       for i := 1 to maxvarregs do
         if assigned(regvarinfo^.regvars[i]) and
-           (makereg32(regvarinfo^.regvars[i].reg) = reg) then
+           (changeregsize(regvarinfo^.regvars[i].reg,S_L) = reg32) then
           load_regvar(asml,tvarsym(regvarinfo^.regvars[i]))
     end;
 
@@ -434,6 +437,7 @@ implementation
     procedure cleanup_regvars(asml: TAAsmoutput);
     var
       i: longint;
+      reg32 : tregister;
     begin
       { can happen when inlining assembler procedures (JM) }
       if not assigned(aktprocdef.regvarinfo) then
@@ -449,9 +453,12 @@ implementation
                 asml.concat(Taicpu.op_reg(A_FSTP,S_NO,R_ST0));
 {$endif i386}
             for i := 1 to maxvarregs do
-              if assigned(regvars[i]) and
-                 (rg.regvar_loaded[makereg32(regvars[i].reg)]) then
-                asml.concat(Tairegalloc.dealloc(makereg32(regvars[i].reg)));
+             begin
+               reg32:=changeregsize(regvars[i].reg,S_L);
+               if assigned(regvars[i]) and
+                  (rg.regvar_loaded[reg32]) then
+                asml.concat(Tairegalloc.dealloc(reg32));
+             end;
           end;
     end;
 
@@ -459,7 +466,15 @@ end.
 
 {
   $Log$
-  Revision 1.26  2002-04-15 19:04:04  carl
+  Revision 1.27  2002-04-15 19:44:19  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.26  2002/04/15 19:04:04  carl
   + reg2str -> std_reg2str()
 
   Revision 1.25  2002/04/06 18:13:01  jonas

+ 15 - 25
compiler/switches.pas

@@ -95,36 +95,18 @@ begin
                    if not localswitcheschanged then
                      nextaktlocalswitches:=aktlocalswitches;
                    if state='+' then
-                    nextaktlocalswitches:=nextaktlocalswitches+[tlocalswitch(setsw)]
+                    include(nextaktlocalswitches,tlocalswitch(setsw))
                    else
-                    nextaktlocalswitches:=nextaktlocalswitches-[tlocalswitch(setsw)];
+                    exclude(nextaktlocalswitches,tlocalswitch(setsw));
                    localswitcheschanged:=true;
-                 { Message for linux which has global checking only }
-                   if (switch='S') and (
-{$ifdef i386}
-                      (target_info.target = target_i386_linux)
-{$else}
-{$ifdef m68k}
-                      (target_info.target = target_m68k_linux)
-{$else}
-                       True
-{$endif m68k}
-{$endif i386}
-                       ) then
-                       Message(scan_n_stack_check_global_under_linux);
                  end;
       modulesw : begin
                    if current_module.in_global then
                     begin
                       if state='+' then
-                        aktmoduleswitches:=aktmoduleswitches+[tmoduleswitch(setsw)]
+                        include(aktmoduleswitches,tmoduleswitch(setsw))
                       else
-                        aktmoduleswitches:=aktmoduleswitches-[tmoduleswitch(setsw)];
-                      { can't have local browser when no global browser
-                        moved to end of global section
-                      if (cs_local_browser in aktmoduleswitches) and
-                         not(cs_browser in aktmoduleswitches) then
-                        aktmoduleswitches:=aktmoduleswitches-[cs_local_browser];}
+                        exclude(aktmoduleswitches,tmoduleswitch(setsw));
                     end
                    else
                     Message(scan_w_switch_is_global);
@@ -133,9 +115,9 @@ begin
                    if current_module.in_global and (current_module=main_module) then
                     begin
                       if state='+' then
-                       aktglobalswitches:=aktglobalswitches+[tglobalswitch(setsw)]
+                       include(aktglobalswitches,tglobalswitch(setsw))
                       else
-                       aktglobalswitches:=aktglobalswitches-[tglobalswitch(setsw)];
+                       exclude(aktglobalswitches,tglobalswitch(setsw));
                     end
                    else
                     Message(scan_w_switch_is_global);
@@ -177,7 +159,15 @@ end;
 end.
 {
   $Log$
-  Revision 1.8  2001-10-20 20:30:21  peter
+  Revision 1.9  2002-04-15 19:44:20  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.8  2001/10/20 20:30:21  peter
     * read only typed const support, switch $J-
 
   Revision 1.7  2001/05/18 22:56:05  peter

+ 11 - 3
compiler/targets/t_go32v2.pas

@@ -415,8 +415,8 @@ end;
               );
             size_of_longint : 4;
             heapsize     : 2048*1024;
-            maxheapsize  : 32768*1024;
-            stacksize    : 16384;
+            maxheapsize  : 32*1024*1024;
+            stacksize    : 32*1024*1024;
             DllScanSupported : false;
             use_bound_instruction : false;
             use_function_relative_addresses : true
@@ -429,7 +429,15 @@ initialization
 end.
 {
   $Log$
-  Revision 1.16  2002-04-15 19:16:57  carl
+  Revision 1.17  2002-04-15 19:44:23  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.16  2002/04/15 19:16:57  carl
   - remove size_of_pointer field
 
   Revision 1.15  2002/01/29 21:27:34  peter

+ 17 - 9
compiler/targets/t_linux.pas

@@ -539,8 +539,8 @@ end;
               );
             size_of_longint : 4;
             heapsize     : 256*1024;
-            maxheapsize  : 32768*1024;
-            stacksize    : 8192;
+            maxheapsize  : 32*1024*1024;
+            stacksize    : 32*1024*1024;
             DllScanSupported:false;
             use_bound_instruction : false;
             use_function_relative_addresses : true
@@ -594,8 +594,8 @@ end;
             maxCrecordalignment : 32;
             size_of_longint : 4;
             heapsize     : 128*1024;
-            maxheapsize  : 32768*1024;
-            stacksize    : 8192;
+            maxheapsize  : 32*1024*1024;
+            stacksize    : 32*1024*1024;
             DllScanSupported:false;
             use_bound_instruction : false;
             use_function_relative_addresses : true
@@ -647,8 +647,8 @@ end;
             maxCrecordalignment : 32;
             size_of_longint : 4;
             heapsize     : 256*1024;
-            maxheapsize  : 32768*1024;
-            stacksize    : 8192;
+            maxheapsize  : 32*1024*1024;
+            stacksize    : 32*1024*1024;
             DllScanSupported:false;
             use_bound_instruction : false;
             use_function_relative_addresses : true
@@ -702,8 +702,8 @@ end;
             maxCrecordalignment : 32;
             size_of_longint : 4;
             heapsize     : 256*1024;
-            maxheapsize  : 32768*1024;
-            stacksize    : 8192;
+            maxheapsize  : 32*1024*1024;
+            stacksize    : 32*1024*1024;
             DllScanSupported:false;
             use_bound_instruction : false;
             use_function_relative_addresses : true
@@ -739,7 +739,15 @@ initialization
 end.
 {
   $Log$
-  Revision 1.17  2002-04-15 19:16:57  carl
+  Revision 1.18  2002-04-15 19:44:23  peter
+    * fixed stackcheck that would be called recursively when a stack
+      error was found
+    * generic changeregsize(reg,size) for i386 register resizing
+    * removed some more routines from cga unit
+    * fixed returnvalue handling
+    * fixed default stacksize of linux and go32v2, 8kb was a bit small :-)
+
+  Revision 1.17  2002/04/15 19:16:57  carl
   - remove size_of_pointer field
 
   Revision 1.16  2002/01/29 21:27:34  peter