فهرست منبع

* changed optimizer switches + cleanup of DestroyRefs in daopt386.pas

Jonas Maebe 27 سال پیش
والد
کامیت
f2da32cd91

+ 17 - 5
compiler/aopt386.pas

@@ -31,18 +31,27 @@ Procedure Optimize(AsmL: PAasmOutput);
 
 Implementation
 
-Uses i386, DAOpt386, POpt386, CSOpt386;
+Uses globals, i386, DAOpt386, POpt386, CSOpt386;
 
 Procedure Optimize(AsmL: PAasmOutput);
 Var BlockEnd: Pai;
 Begin
+{setup labeltable, always necessary}
   DFAPass1(AsmL);
+{peephole optimizations}
   PeepHoleOptPass1(AsmL);
   PeepHoleOptPass1(AsmL);
-  BlockEnd := DFAPass2(AsmL);
-  If BlockEnd <> Nil Then
-    CSE(AsmL, Pai(AsmL^.First), BlockEnd);
+{data flow analyzer}
+  If (cs_slowoptimize in aktglobalswitches) Then
+    Begin
+      BlockEnd := DFAPass2(AsmL);
+      If BlockEnd <> Nil Then
+{common subexpression elimination}
+        CSE(AsmL, Pai(AsmL^.First), BlockEnd);
+    End;
+{more peephole optimizations}
   PeepHoleOptPass2(AsmL);
+{dispose labeltabel}
   ShutDownDFA;
 End;
 
@@ -50,7 +59,10 @@ End.
 
 {
  $Log$
- Revision 1.21  1998-08-06 19:40:29  jonas
+ Revision 1.22  1998-08-19 16:07:57  jonas
+   * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
+
+ Revision 1.21  1998/08/06 19:40:29  jonas
    * removed $ before and after Log in comment
 
  Revision 1.20  1998/08/05 16:00:08  florian

+ 5 - 2
compiler/cg386cal.pas

@@ -1126,7 +1126,7 @@ implementation
                 { but the registers must be different!              }
                 else if (pushedparasize=8) and
                   not(cs_littlesize in aktglobalswitches) and
-                  (aktoptprocessor=pentium) and
+                  (aktoptprocessor=ClassP5) and
                   (procinfo._class=nil) then
                     begin
                        exprasmlist^.concat(new(pai386,op_reg(A_POP,S_L,R_EDI)));
@@ -2314,7 +2314,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.16  1998-08-18 09:24:36  pierre
+  Revision 1.17  1998-08-19 16:07:36  jonas
+    * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
+
+  Revision 1.16  1998/08/18 09:24:36  pierre
     * small warning position bug fixed
     * support_mmx switches splitting was missing
     * rhide error and warning output corrected

+ 7 - 4
compiler/cg386set.pas

@@ -732,11 +732,11 @@ implementation
                    else
                      max_linear_list:=2;
                    { a jump table crashes the pipeline! }
-                   if aktoptprocessor=int486 then
+                   if aktoptprocessor=Class386 then
                      inc(max_linear_list,3);
-                       if aktoptprocessor=pentium then
+                       if aktoptprocessor=ClassP5 then
                      inc(max_linear_list,6);
-                   if aktoptprocessor>=pentiumpro then
+                   if aktoptprocessor>=ClassP6 then
                      inc(max_linear_list,9);
 
                    if (labels<=max_linear_list) then
@@ -782,7 +782,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.6  1998-08-18 09:24:39  pierre
+  Revision 1.7  1998-08-19 16:07:38  jonas
+    * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
+
+  Revision 1.6  1998/08/18 09:24:39  pierre
     * small warning position bug fixed
     * support_mmx switches splitting was missing
     * rhide error and warning output corrected

+ 6 - 3
compiler/cg68k.pas

@@ -1259,7 +1259,7 @@ implementation
          else
            begin
               { quick hack, to overcome Delphi 2 }
-              if (cs_maxoptimize in aktglobalswitches) and
+              if (cs_regalloc in aktglobalswitches) and
                 (p^.left^.resulttype^.deftype=arraydef) then
                 begin
                    extraoffset:=0;
@@ -5327,7 +5327,7 @@ end;
            begin
               { max. optimizations     }
               { only if no asm is used }
-              if (cs_maxoptimize in aktglobalswitches) and
+              if (cs_regalloc in aktglobalswitches) and
                 ((procinfo.flags and pi_uses_asm)=0) then
                 begin
                    { can we omit the stack frame ? }
@@ -5475,7 +5475,10 @@ end.
 
 {
   $Log$
-  Revision 1.13  1998-08-10 14:43:14  peter
+  Revision 1.14  1998-08-19 16:07:39  jonas
+    * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
+
+  Revision 1.13  1998/08/10 14:43:14  peter
     * string type st_ fixed
 
   Revision 1.12  1998/07/15 16:41:01  jonas

+ 5 - 2
compiler/cgi386.pas

@@ -357,7 +357,7 @@ implementation
               { max. optimizations     }
               { only if no asm is used }
               { and no try statement   }
-              if (cs_maxoptimize in aktglobalswitches) and
+              if (cs_regalloc in aktglobalswitches) and
                 ((procinfo.flags and (pi_uses_asm or pi_uses_exceptions))=0) then
                 begin
                    { can we omit the stack frame ? }
@@ -506,7 +506,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.48  1998-08-14 18:18:43  peter
+  Revision 1.49  1998-08-19 16:07:42  jonas
+    * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
+
+  Revision 1.48  1998/08/14 18:18:43  peter
     + dynamic set contruction
     * smallsets are now working (always longint size)
 

+ 52 - 47
compiler/daopt386.pas

@@ -908,57 +908,59 @@ Begin {checks whether two Pai386 instructions are equal}
 End;
 
 
-Procedure DestroyRefs(p: pai; Const Ref: TReference; WhichRegNot: TRegister);
-{destroys all registers which possibly contain a reference to Ref}
+Procedure DestroyRefs(p: pai; Const Ref: TReference; WhichReg: TRegister);
+{destroys all registers which possibly contain a reference to Ref, WhichReg
+ is the register whose contents are being written to memory (if this proc
+ is called because of a "mov?? %reg, (mem)" instruction)}
 Var Counter: TRegister;
 Begin
-WhichRegNot := Reg32(WhichRegNot);
-If Not(Assigned(Ref.Symbol))
-  Then
-    Begin
-      If (Ref.base = ProcInfo.FramePointer) And
-         (Ref.Index = R_NO)
-        Then
-{write something to a parameter or a local variable}
-          For Counter := R_EAX to R_EDI Do
-            With PPaiProp(p^.fileinfo.line)^.Regs[Counter] Do
-              Begin
-                If (typ = Con_Ref) And
- {StarMod is always of the type ait_instruction}
-                   (Pai386(StartMod)^.op1t = top_ref) And
-                   ((RefsEqual(TReference(Pai386(StartMod)^.op1^), Ref) And
-                    ((Counter <> WhichRegNot) Or (NrOfMods <> 1))) Or
-                    (Not(cs_UncertainOpts in aktglobalswitches) And
-                     (NrOfMods <> 1)))
-                  Then DestroyReg(PPaiProp(p^.fileinfo.line), Counter)
-              End
-        Else
-          {writing something to a pointer location}
-          For Counter := R_EAX to R_EDI Do
-            With PPaiProp(p^.fileinfo.line)^.Regs[Counter] Do
+  WhichReg := Reg32(WhichReg);
+  If ((Ref.base = ProcInfo.FramePointer) And
+      (Ref.Index = R_NO)) Or
+     Assigned(Ref.Symbol)
+    Then
+{write something to a parameter, a local or global variable, so
+   * with uncertzain optimizations on:
+      - destroy the contents of registers <> WhichReg whose StartMod is of
+        the form "mov?? (Ref), %reg". WhichReg is destroyed if it's StartMod
+        is of that form and NrOfMods > 1 (so if it is a pointer based on Ref)
+    * with uncertzain optimizations off:
+       - also destroy registers that contain any pointer}
+      For Counter := R_EAX to R_EDI Do
+        With PPaiProp(p^.fileinfo.line)^.Regs[Counter] Do
+          Begin
             If (typ = Con_Ref) And
-               (Not(cs_UncertainOpts in aktglobalswitches) Or
-              {for movsl}
-                (Ref.Base = R_EDI) Or
-              {don't destroy if reg contains a parameter or local variable}
-                (Not((NrOfMods = 1) And
-                    (Pai386(StartMod)^.op1t = top_ref) And
-                    (PReference(Pai386(StartMod)^.op1)^.base = ProcInfo.FramePointer))))
-              Then
-{we don't know what memory location the reference points to, so we just
- destroy every register which contains a memory reference}
-                DestroyReg(PPaiProp(p^.FileInfo.Line), Counter)
-    End
-  Else {the ref is a var name or we just have a reference an absolute offset}
-    Begin
+ {StarMod is always of the type ait_instruction}
+               (Pai386(StartMod)^.op1t = top_ref) And
+               ((RefsEqual(TReference(Pai386(StartMod)^.op1^), Ref) And
+                ((Counter <> WhichReg) Or (NrOfMods <> 1))) Or
+                (Not(cs_UncertainOpts in aktglobalswitches) And
+                 (NrOfMods <> 1)))
+              Then DestroyReg(PPaiProp(p^.fileinfo.line), Counter)
+          End
+    Else
+{write something to a pointer location, so
+   * with uncertain optimzations on:
+      - do not destroy registers which contain a local/global variable or a
+        parameter, except if DestroyRefs is called because of a "movsl"
+   * with uncertain optimzations off:
+      - destroy every register which contains a memory location
+      }
       For Counter := R_EAX to R_EDI Do
-        If (Counter <> WhichRegNot) And
-           (PPaiProp(p^.fileinfo.line)^.Regs[Counter].typ = Con_Ref) And
+        With PPaiProp(p^.fileinfo.line)^.Regs[Counter] Do
+        If (typ = Con_Ref) And
            (Not(cs_UncertainOpts in aktglobalswitches) Or
-            RefsEqual(Ref,
-                     TReference(Pai386(PPaiProp(p^.fileinfo.line)^.Regs[Counter].StartMod)^.op1^))) Then
-          DestroyReg(PPaiProp(p^.fileinfo.line), Counter)
-    End;
+        {for movsl}
+            (Ref.Base = R_EDI) Or
+        {don't destroy if reg contains a parameter, local or global variable}
+            Not((NrOfMods = 1) And
+                (Pai386(StartMod)^.op1t = top_ref) And
+                ((PReference(Pai386(StartMod)^.op1)^.base = ProcInfo.FramePointer) Or
+                  Assigned(PReference(Pai386(StartMod)^.op1)^.Symbol)
+                )
+               )
+           )
+          Then DestroyReg(PPaiProp(p^.FileInfo.Line), Counter)
 End;
 
 Procedure DestroyAllRegs(p: PPaiProp);
@@ -1443,7 +1445,10 @@ End.
 
 {
  $Log$
- Revision 1.6  1998-08-10 14:49:57  peter
+ Revision 1.7  1998-08-19 16:07:44  jonas
+   * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
+
+ Revision 1.6  1998/08/10 14:49:57  peter
    + localswitches, moduleswitches, globalswitches splitting
 
  Revision 1.5  1998/08/09 13:56:24  jonas

+ 16 - 17
compiler/optione.msg

@@ -72,9 +72,9 @@ Report bugs,suggestions etc to:
 **2Fu<x>_adds <x> to unit path
 **1k<x>_Pass <x> to the linker
 **1L_set language
-**2LD_german
-**2LE_english
-**2LN_dutch
+**2LD_German
+**2LE_English
+**2LN_Dutch
 **1l_write logo
 **1i_information
 **1n_don't read the default config file
@@ -133,28 +133,27 @@ Report bugs,suggestions etc to:
 3*2Ratt_read AT&T style assembler
 3*2Rintel_read Intel style assembler
 3*2Rdirect_copy assembler text directly to assembler file
-3*1O_optimizations
-3*2Oa_turn on the optimizer
+3*1O<x>_optimizations
 3*2Og_generate smaller code
 3*2OG_generate faster code (default)
-3*2Ox_optimize maximum (still BUGGY!!!)
-3*2Oz_uncertain optimizations (see docs)
-3*2O2_set target processor to Pentium II (tm)
-3*2O3_set target processor to i386
-3*2O4_set target processor to i486
-3*2O5_set target processor to Pentium (tm)
-3*2O6_set target processor to PentiumPro (tm)
-3*2O7_set target processor to Cyrix 6x86
-3*2O8_set target processor to AMD K6
+3*2Or_keep certain variables in registers (still BUGGY!!!)
+3*2Ou_enable uncertain optimizations (see docs)
+3*2O1_level 1 optimizations (quick optimizations)
+3*2O2_level 2 optimizations (-O1 + slower optimizations)
+3*2O3_level 3 optimizations (same as -O2u)
+3*2Op_target processor
+3*3Op1_set target processor to 386/486
+3*3Op2_set target processor to Pentium/PentiumMMX (tm)
+3*3Op3_set target processor to PPro/PII/c6x86/K6 (tm)
 6*1A_output format
 6*2Ao_Unix o-file using GNU AS
 6*2Agas_GNU Motorola assembler
 6*2Amit_MIT Syntax (old GAS)
 6*2Amot_Standard Motorola assembler
 6*1O_optimizations
-6*2Oa_ turn on the optimizer
-6*2Og_ generate smaller code
-6*2OG_ generate faster code (default)
+6*2Oa_turn on the optimizer
+6*2Og_generate smaller code
+6*2OG_generate faster code (default)
 6*2Ox_optimize maximum (still BUGGY!!!)
 6*2O2_set target processor to a MC68020+
 **1*_

+ 48 - 49
compiler/optmsg.inc

@@ -1,4 +1,4 @@
-const optiontxt : array[0..00019,1..255] of char=(
+const optiontxt : array[0..00021,1..240] of char=(
   ' [options] <inputfile> [options]'#000+
   'Only one source file supported'#000+
   'DEF file can be created only for OS/2'#000+
@@ -6,104 +6,104 @@ const optiontxt : array[0..00019,1..255] of char=(
   'No source file name in command line'#000+
   'Illegal parameter: $1'#000+
   '-? writes help pages'#000+
-  'Unable to open file $1'#000+
-  'Reading fur','ther options from $1'#000+
+  'Unable to open file',' $1'#000+
+  'Reading further options from $1'#000+
   'Target is already set to: $1'#000+
   'Shared libs not supported on DOS platform, reverting to static'#000+
   'too many IF(N)DEFs'#000+
   'too many ENDIFs'#000+
   'open conditional at the end of the file'#000+
-  'Debug information generation is not supported by this executable'#000+
-  'Tr','y recompiling with -dGDB'#000+
+  'Debug information generation is not s','upported by this executable'#000+
+  'Try recompiling with -dGDB'#000+
   'Free Pascal Compiler version $VER for $TARGET'#000+
   'Copyright (c) 1993-98 by Florian Klaempfl'#000+
   'Free Pascal Compiler version $VER'#000+
   #000+
   'This program comes under the GNU General Public Licence'#000+
-  'For more information read COPYING'#000+
+  'For mo','re information read COPYING'#000+
   #000+
-  'Report bugs,sugg','estions etc to:'#000+
+  'Report bugs,suggestions etc to:'#000+
   '                [email protected]'#000+
   '**0*_+ switch option on, - off'#000+
   '**1a_the compiler doesn'#039't delete the generated assembler file'#000+
   '*t1b_use EMS'#000+
   '**1B+_build'#000+
-  '**1C_code generation options'#000+
+  '**1C_code generation opt','ions'#000+
   '**2Ca_not implemented'#000+
   '**2Ce_not implemented'#000+
-  '3*2CD_Dynam','ic linking'#000+
+  '3*2CD_Dynamic linking'#000+
   '**2Ch<n>_<n> bytes heap (between 1023 and 67107840)'#000+
   '**2Ci_IO-checking'#000+
   '**2Cn_omit linking stage'#000+
   '**2Co_check overflow of integer operations'#000+
   '**2Cr_range checking'#000+
-  '*O2Cs<n>_set stack size to <n>'#000+
+  '*O2Cs<n>_s','et stack size to <n>'#000+
   '**2Ct_stack checking'#000+
   '3*2CS_static linking'#000+
-  '**1d<x>_defi','nes the symbol <x>'#000+
+  '**1d<x>_defines the symbol <x>'#000+
   '*O1D_controls the generation of DEF file (only OS/2)'#000+
   '*O2Dd<x>_set description to <x>'#000+
   '*O2Do_generate DEF file'#000+
   '*O2Dw_PM application'#000+
-  '*L1e<x>_set path to executables'#000+
+  '*L1e<x>_set path',' to executables'#000+
   '**1E_same as -Cn'#000+
   '**1g_generate debugger information'#000+
-  '**1F_set file names an','d paths'#000+
+  '**1F_set file names and paths'#000+
   '**2Fe<x>_redirect error output to <x>'#000+
   '*L2Fg<x>_<x> search path for the GNU C lib'#000+
   '*L2Fr<x>_<x> search path for the error message file'#000+
-  '**2Fi<x>_adds <x> to include path'#000+
+  '**2Fi<x>_','adds <x> to include path'#000+
   '**2Fl<x>_adds <x> to library path'#000+
   '*L2FL<x>_uses <x> as dynamic linker'#000+
-  '**2Fu<x>_a','dds <x> to unit path'#000+
+  '**2Fu<x>_adds <x> to unit path'#000+
   '**1k<x>_Pass <x> to the linker'#000+
   '**1L_set language'#000+
-  '**2LD_german'#000+
-  '**2LE_english'#000+
-  '**2LN_dutch'#000+
+  '**2LD_German'#000+
+  '**2LE_English'#000+
+  '**2LN_Dutch'#000+
   '**1l_write logo'#000+
-  '**1i_information'#000+
+  '**1i_infor','mation'#000+
   '**1n_don'#039't read the default config file'#000+
   '**1o<x>_change the name of the executable produced to <x>'#000+
-  '**1pg_generate ','profile code for gprof'#000+
+  '**1pg_generate profile code for gprof'#000+
   '*L1P_use pipes instead of creating temporary assembler files'#000+
   '**1S_syntax options'#000+
-  '**2S2_switch some Delphi 2 extension on'#000+
+  '**2S2_switch som','e Delphi 2 extension on'#000+
   '**2Sc_supports operators like C (*=,+=,/= and -=)'#000+
-  '**2Sd_compiler disposes asm lists (uses less memory but slowe','r)'#000+
+  '**2Sd_compiler disposes asm lists (uses less memory but slower)'#000+
   '**2Se_compiler stops after the first error'#000+
   '**2Sg_allows LABEL and GOTO'#000+
-  '**2Si_support C++ stlyed INLINE'#000+
+  '**2Si_support C++ stlyed INLINE',#000+
   '**2Sm_support macros like C (global)'#000+
   '**2So_tries to be TP/BP 7.0 compatible'#000+
   '**2Ss_constructor name must be init (destructor must be done)'#000+
-  '**2St_allow','s static keyword in objects'#000+
+  '**2St_allows static keyword in objects'#000+
   '**1s_don'#039't call assembler and linker (only with -a)'#000+
-  '**1T<x>_Target operating system'#000+
+  '**1T<x>_Ta','rget operating system'#000+
   '3*2TGO32V1_version 1 of DJ Delorie DOS extender'#000+
   '3*2TGO32V2_version 2 of DJ Delorie DOS extender'#000+
   '3*2TLINUX_Linux'#000+
   '3*2TOS2_OS/2 2.x'#000+
-  '3*2TWin32_Wind','ows 32 Bit'#000+
+  '3*2TWin32_Windows 32 Bit'#000+
   '6*2TAMIGA_Commodore Amiga'#000+
   '6*2TATARI_Atari ST/STe/TT'#000+
-  '6*2TMACOS_Macintosh m68k'#000+
+  '6*2TMACOS_Ma','cintosh m68k'#000+
   '6*2TLINUX_Linux-68k'#000+
   '**1u<x>_undefines the symbol <x>'#000+
   '**1U_unit options'#000+
   '**2Uls_make static library from unit'#000+
   '**2Uld_make dynamic library from unit'#000+
-  '**2Un_don'#039't check the',' unit name'#000+
+  '**2Un_don'#039't check the unit name'#000+
   '**2Up<x>_same as -Fu<x>'#000+
-  '**2Us_compile a system unit'#000+
+  '**2Us_compile a system un','it'#000+
   '**1v<x>_Be verbose. <x> is a combination of the following letters :'#000+
   '**2*_e : Show errors (default)       d : Show debug info'#000+
   '**2*_w : Show warnings               u : Show used files'#000+
-  '**2*_n : S','how notes                  t : Show tried files'#000+
+  '**2*_n : Show notes                  t : Show tried fil','es'#000+
   '**2*_h : Show hints                  m : Show defined macros'#000+
   '**2*_i : Show general info           p : Show compiled procedures'#000+
   '**2*_l : Show linenumbers            c : Show conditionals'#000+
-  '**2*_a : Show everyth','ing             0 : Show nothing (except errors'+
+  '**2*_a : Show everything             0 : Show nothi','ng (except errors'+
   ')'#000+
   '**1X_executable options'#000+
   '*L2Xc_link with the c library'#000+
@@ -111,8 +111,8 @@ const optiontxt : array[0..00019,1..255] of char=(
   '**0*_Processor specific options:'#000+
   '3*1A_output format'#000+
   '3*2Ao_coff file using GNU AS'#000+
-  '3*2Anasmcoff_coff file using Na','sm'#000+
-  '3*2Anasmelf_elf32 (linux) file using Nasm'#000+
+  '3*2Anasmcoff_coff file using Nasm'#000+
+  '3*2Anasmelf_','elf32 (linux) file using Nasm'#000+
   '3*2Anasmobj_obj file using Nasm'#000+
   '3*2Amasm_obj using Masm (Mircosoft)'#000+
   '3*2Atasm_obj using Tasm (Borland)'#000+
@@ -120,31 +120,30 @@ const optiontxt : array[0..00019,1..255] of char=(
   '3*2Ratt_read AT&T style assembler'#000+
   '3*2Rintel_read Intel style assembler'#000+
   '3*2Rdire','ct_copy assembler text directly to assembler file'#000+
-  '3*1O_optimizations'#000+
-  '3*2Oa_turn on the optimizer'#000+
+  '3*1O<x>_optimizations'#000+
   '3*2Og_generate smaller code'#000+
   '3*2OG_generate faster code (default)'#000+
-  '3*2Ox_optimize maximum (still BUGGY!!!)'#000+
-  '3*2Oz_uncertain optimizations (see docs)'#000+
-  '3*2O2_set ta','rget processor to Pentium II (tm)'#000+
-  '3*2O3_set target processor to i386'#000+
-  '3*2O4_set target processor to i486'#000+
-  '3*2O5_set target processor to Pentium (tm)'#000+
-  '3*2O6_set target processor to PentiumPro (tm)'#000+
-  '3*2O7_set target processor to Cyrix 6x86'#000+
-  '3*2O8_set target proc','essor to AMD K6'#000+
+  '3*2Or_keep certain variables in registers (still BUGGY!!!)'#000+
+  '3*2Ou_enable uncertain optimizations (see do','cs)'#000+
+  '3*2O1_level 1 optimizations (quick optimizations)'#000+
+  '3*2O2_level 2 optimizations (-O1 + slower optimizations)'#000+
+  '3*2O3_level 3 optimizations (same as -O2u)'#000+
+  '3*2Op_target processor'#000+
+  '3*3Op1_set target processor to 386/486'#000+
+  '3*3Op2_set target proces','sor to Pentium/PentiumMMX (tm)'#000+
+  '3*3Op3_set target processor to PPro/PII/c6x86/K6 (tm)'#000+
   '6*1A_output format'#000+
   '6*2Ao_Unix o-file using GNU AS'#000+
   '6*2Agas_GNU Motorola assembler'#000+
   '6*2Amit_MIT Syntax (old GAS)'#000+
   '6*2Amot_Standard Motorola assembler'#000+
-  '6*1O_optimizations'#000+
-  '6*2Oa_ turn on the optimizer'#000+
-  '6*2Og_ generate smaller code'#000+
-  '6*2OG_ generate ','faster code (default)'#000+
+  '6*1O_opti','mizations'#000+
+  '6*2Oa_turn on the optimizer'#000+
+  '6*2Og_generate smaller code'#000+
+  '6*2OG_generate faster code (default)'#000+
   '6*2Ox_optimize maximum (still BUGGY!!!)'#000+
   '6*2O2_set target processor to a MC68020+'#000+
   '**1*_'#000+
   '**1?_shows this help'#000+
-  '**1h_shows this help without waiting'#000
+  '**1h_shows this help without ','waiting'#000
 );

+ 45 - 32
compiler/opts386.pas

@@ -50,37 +50,47 @@ begin
            else
             IllegalPara(opt);
          end;
-   'O' : begin
-           for j:=3 to length(opt) do
-           case opt[j] of
-            '-' : initglobalswitches:=initglobalswitches-[cs_optimize,cs_maxoptimize,cs_littlesize];
-            'a' : initglobalswitches:=initglobalswitches+[cs_optimize];
-            'g' : initglobalswitches:=initglobalswitches+[cs_littlesize];
-            'G' : initglobalswitches:=initglobalswitches-[cs_littlesize];
-            'x' : initglobalswitches:=initglobalswitches+[cs_optimize,cs_maxoptimize];
-            'z' : initglobalswitches:=initglobalswitches+[cs_optimize,cs_uncertainopts];
-            '2' : initoptprocessor:=pentium2;
-            '3' : initoptprocessor:=int386;
-            '4' : initoptprocessor:=int486;
-            '5' : initoptprocessor:=pentium;
-            '6' : initoptprocessor:=pentiumpro;
-            '7' : initoptprocessor:=cx6x86;
-            '8' : initoptprocessor:=amdk6
-            else IllegalPara(opt);
-            end;
-          end;
-    'R' : begin
-            if More='ATT' then
-             initasmmode:=I386_ATT
-            else
-             if More='INTEL' then
-              initasmmode:=I386_INTEL
-            else
-             if More='DIRECT' then
-              initasmmode:=I386_DIRECT
-            else
-             IllegalPara(opt);
-          end;
+   'O' : Begin
+           j := 3;
+           While (j <= Length(Opt)) Do
+             Begin
+               case opt[j] of
+                 '-' : initglobalswitches:=initglobalswitches-[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_littlesize,
+                           cs_regalloc,cs_uncertainopts];
+                 'g' : initglobalswitches:=initglobalswitches+[cs_littlesize];
+                 'G' : initglobalswitches:=initglobalswitches-[cs_littlesize];
+                 'r' : initglobalswitches:=initglobalswitches+[cs_optimize,cs_regalloc];
+                 'u' : initglobalswitches:=initglobalswitches+[cs_optimize,cs_uncertainopts];
+                 '1' : initglobalswitches:=initglobalswitches+[cs_optimize,cs_fastoptimize];
+                 '2' : initglobalswitches:=initglobalswitches+[cs_optimize,cs_fastoptimize,cs_slowoptimize];
+                 '3' : initglobalswitches:=initglobalswitches+[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_uncertainopts];
+                 'p' :
+                   Begin
+                     Case opt[j+1] Of
+                       '1': initoptprocessor := Class386;
+                       '2': initoptprocessor := ClassP5;
+                       '3': initoptprocessor := ClassP6
+                       Else IllegalPara(Opt)
+                     End;
+                     Inc(j);
+                   End
+                 else IllegalPara(opt);
+               End;
+               Inc(j)
+             end;
+         end;
+   'R' : begin
+           if More='ATT' then
+            initasmmode:=I386_ATT
+           else
+            if More='INTEL' then
+             initasmmode:=I386_INTEL
+           else
+            if More='DIRECT' then
+             initasmmode:=I386_DIRECT
+           else
+            IllegalPara(opt);
+         end;
   else
    IllegalPara(opt);
   end;
@@ -89,7 +99,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.9  1998-08-10 14:50:04  peter
+  Revision 1.10  1998-08-19 16:07:49  jonas
+    * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
+
+  Revision 1.9  1998/08/10 14:50:04  peter
     + localswitches, moduleswitches, globalswitches splitting
 
   Revision 1.8  1998/06/16 08:56:22  peter

+ 6 - 3
compiler/opts68k.pas

@@ -52,11 +52,11 @@ begin
    'O' : begin
            for j:=3 to length(opt) do
             case opt[j] of
-             '-' : initglobalswitches:=initglobalswitches-[cs_optimize,cs_maxoptimize,cs_littlesize];
+             '-' : initglobalswitches:=initglobalswitches-[cs_optimize,cs_regalloc,cs_littlesize];
              'a' : initglobalswitches:=initglobalswitches+[cs_optimize];
              'g' : initglobalswitches:=initglobalswitches+[cs_littlesize];
              'G' : initglobalswitches:=initglobalswitches-[cs_littlesize];
-             'x' : initglobalswitches:=initglobalswitches+[cs_optimize,cs_maxoptimize];
+             'x' : initglobalswitches:=initglobalswitches+[cs_optimize,cs_regalloc];
              '2' : initoptprocessor:=MC68020;
              else
               IllegalPara(opt);
@@ -75,7 +75,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.3  1998-08-10 14:50:06  peter
+  Revision 1.4  1998-08-19 16:07:50  jonas
+    * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
+
+  Revision 1.3  1998/08/10 14:50:06  peter
     + localswitches, moduleswitches, globalswitches splitting
 
   Revision 1.2  1998/06/04 23:51:47  peter

+ 5 - 2
compiler/pass_1.pas

@@ -4422,7 +4422,7 @@ unit pass_1;
          hp:=p^.left;
          while assigned(hp) do
            begin
-              if cs_maxoptimize in aktglobalswitches then
+              if cs_regalloc in aktglobalswitches then
                 begin
                    { Codeumstellungen }
 
@@ -5258,7 +5258,10 @@ unit pass_1;
 end.
 {
   $Log$
-  Revision 1.57  1998-08-19 00:42:39  peter
+  Revision 1.58  1998-08-19 16:07:51  jonas
+    * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
+
+  Revision 1.57  1998/08/19 00:42:39  peter
     + subrange types for enums
     + checking for bounds type with ranges
 

+ 13 - 12
compiler/popt386.pas

@@ -292,7 +292,7 @@ Begin
                      (Pai386(p)^.Size = S_L) And
                      ((Pai386(p)^.op3t = Top_Reg) or
                       (Pai386(p)^.op3t = Top_None)) And
-                     (aktoptprocessor < PentiumPro) And
+                     (aktoptprocessor < ClassP6) And
                      (Longint(Pai386(p)^.op1) <= 12) And
                      Not(CS_LittleSize in aktglobalswitches) And
                      (Not(GetNextInstruction(p, hp1)) Or
@@ -349,7 +349,7 @@ Begin
                              imul 6, reg1 to
                                lea (reg1,reg1,2), reg1
                                add reg1, reg1}
-                              If (aktoptprocessor <= int486)
+                              If (aktoptprocessor <= Class386)
                                 Then
                                   Begin
                                     TmpRef^.Index := TRegister(Pai386(p)^.op2);
@@ -419,7 +419,7 @@ Begin
                              imul 10, reg1 to
                                lea (reg1,reg1,4), reg1
                                add reg1, reg1}
-                               If (aktoptprocessor <= int486) Then
+                               If (aktoptprocessor <= Class386) Then
                                  Begin
                                    If (Pai386(p)^.op3t = Top_Reg)
                                      Then
@@ -454,7 +454,7 @@ Begin
                              imul 12, reg1 to
                                lea (reg1,reg1,2), reg1
                                lea (,reg1,4), reg1}
-                               If (aktoptprocessor <= int486)
+                               If (aktoptprocessor <= Class386)
                                  Then
                                    Begin
                                      TmpRef^.Index := TRegister(Pai386(p)^.op2);
@@ -967,7 +967,7 @@ Begin
                       (Pai386(hp1)^._operator=A_PUSH) and
                       (Pai386(hp1)^.op1t = top_reg) And
                       (Pai386(hp1)^.op1=Pai386(p)^.op1) then
-                     If (Not(cs_maxoptimize in aktglobalswitches)) Then
+                     If (Not(cs_regalloc in aktglobalswitches)) Then
                        Begin
                          hp2:=pai(hp1^.next);
                          asml^.remove(p);
@@ -1065,7 +1065,7 @@ Begin
                                   End;
                           End;
                         If TmpBool2 Or
-                           ((aktoptprocessor < PentiumPro) And
+                           ((aktoptprocessor < ClassP6) And
                             (Longint(Pai386(p)^.op1) <= 3) And
                             Not(CS_LittleSize in aktglobalswitches))
                           Then
@@ -1087,7 +1087,7 @@ Begin
                             End;
                       End
                     Else
-                      If (aktoptprocessor < PentiumPro) And
+                      If (aktoptprocessor < ClassP6) And
                          (Pai386(p)^.op1t = top_const) And
                          (Pai386(p)^.op2t = top_reg) Then
                         If (Longint(Pai386(p)^.op1) = 1)
@@ -1313,8 +1313,7 @@ Begin
                             Begin
                               If IsGP32Reg(TRegister(Pai386(p)^.op2)) And
                                  Not(CS_LittleSize in aktglobalswitches) And
-                                 (aktoptprocessor >= Pentium) And
-                                 (aktoptprocessor < PentiumPro)
+                                 (aktoptprocessor = ClassP5)
                                 Then
                                   {Change "movzbl %reg1, %reg2" to
                                    "xorl %reg2, %reg2; movb %reg1, %reg2" for Pentium and
@@ -1338,8 +1337,7 @@ Begin
                            (PReference(Pai386(p)^.op1)^.index <> TRegister(Pai386(p)^.op2)) And
                            Not(CS_LittleSize in aktglobalswitches) And
                            IsGP32Reg(TRegister(Pai386(p)^.op2)) And
-                           (aktoptprocessor >= Pentium) And
-                           (aktoptprocessor < PentiumPro) And
+                           (aktoptprocessor = ClassP5) And
                            (Pai386(p)^.Size = S_BL)
                           Then
                             {changes "movzbl mem, %reg" to "xorl %reg, %reg; movb mem, %reg8" for
@@ -1365,7 +1363,10 @@ End.
 
 {
  $Log$
- Revision 1.6  1998-08-10 14:50:14  peter
+ Revision 1.7  1998-08-19 16:07:53  jonas
+   * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
+
+ Revision 1.6  1998/08/10 14:50:14  peter
    + localswitches, moduleswitches, globalswitches splitting
 
  Revision 1.5  1998/08/06 19:40:28  jonas

+ 5 - 2
compiler/ra386att.pas

@@ -1523,7 +1523,7 @@ const
     { the att version only if the processor > i386 or we are compiling  }
     { the system unit then this will be allowed...                      }
     if (instruc >= lastop_in_table) and
-       ((cs_compilesystem in aktmoduleswitches) or (aktoptprocessor>int386)) then
+       ((cs_compilesystem in aktmoduleswitches) or (aktoptprocessor=Class386)) then
       begin
          Message1(assem_w_opcode_not_in_table,att_op2str[instruc]);
          fits:=true;
@@ -3675,7 +3675,10 @@ end.
 
 {
   $Log$
-  Revision 1.7  1998-08-10 23:57:23  peter
+  Revision 1.8  1998-08-19 16:07:54  jonas
+    * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
+
+  Revision 1.7  1998/08/10 23:57:23  peter
     * use bestreal instead of extended
 
   Revision 1.6  1998/08/10 14:50:21  peter

+ 5 - 2
compiler/systems.pas

@@ -33,7 +33,7 @@ unit systems;
 
        tprocessors = (
        {$ifdef i386}
-              int386,int486,pentium,pentiumpro,cx6x86,pentium2,amdk6
+              Class386,ClassP5,ClassP6
        {$endif}
        {$ifdef m68k}
               MC68000,MC68020
@@ -876,7 +876,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.25  1998-08-18 09:24:45  pierre
+  Revision 1.26  1998-08-19 16:07:55  jonas
+    * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
+
+  Revision 1.25  1998/08/18 09:24:45  pierre
     * small warning position bug fixed
     * support_mmx switches splitting was missing
     * rhide error and warning output corrected

+ 6 - 3
compiler/tgeni386.pas

@@ -185,7 +185,7 @@ unit tgeni386;
     procedure ungetregister32(r : tregister);
 
       begin
-         if cs_maxoptimize in aktglobalswitches then
+         if cs_regalloc in aktglobalswitches then
            begin
               { takes much time }
               if not(r in usableregs) then
@@ -227,7 +227,7 @@ unit tgeni386;
     procedure ungetregistermmx(r : tregister);
 
       begin
-         if cs_maxoptimize in aktglobalswitches then
+         if cs_regalloc in aktglobalswitches then
            begin
               { takes much time }
               if not(r in usableregs) then
@@ -313,7 +313,10 @@ begin
 end.
 {
   $Log$
-  Revision 1.8  1998-08-10 14:50:34  peter
+  Revision 1.9  1998-08-19 16:07:56  jonas
+    * changed optimizer switches + cleanup of DestroyRefs in daopt386.pas
+
+  Revision 1.8  1998/08/10 14:50:34  peter
     + localswitches, moduleswitches, globalswitches splitting
 
   Revision 1.7  1998/06/08 13:13:47  pierre