mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 15:39:24 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			191 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			191 lines
		
	
	
		
			6.4 KiB
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
{
 | 
						|
    $Id$
 | 
						|
    Copyright (c) 1998-2000 by Florian Klaempfl, Pierre Muller
 | 
						|
 | 
						|
    interprets the commandline options which are iSPARC specific
 | 
						|
 | 
						|
    This program is free software; you can redistribute it and/or modify
 | 
						|
    it under the terms of the GNU General Public License as published by
 | 
						|
    the Free Software Foundation; either version 2 of the License, or
 | 
						|
    (at your option) any later version.
 | 
						|
 | 
						|
    This program is distributed in the hope that it will be useful,
 | 
						|
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
						|
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
						|
    GNU General Public License for more details.
 | 
						|
 | 
						|
    You should have received a copy of the GNU General Public License
 | 
						|
    along with this program; if not, write to the Free Software
 | 
						|
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 | 
						|
 | 
						|
 ****************************************************************************
 | 
						|
}
 | 
						|
unit cpuswtch;
 | 
						|
 | 
						|
{$INCLUDE fpcdefs.inc}
 | 
						|
 | 
						|
interface
 | 
						|
 | 
						|
uses
 | 
						|
  options;
 | 
						|
 | 
						|
type
 | 
						|
  toptionSPARC=class(toption)
 | 
						|
    procedure interpret_proc_specific_options(const opt:string);override;
 | 
						|
  end;
 | 
						|
 | 
						|
implementation
 | 
						|
 | 
						|
uses
 | 
						|
  cutils,globtype,systems,globals,cpuinfo;
 | 
						|
 | 
						|
procedure toptionSPARC.interpret_proc_specific_options(const opt:string);
 | 
						|
var
 | 
						|
  j     : longint;
 | 
						|
  More  : string;
 | 
						|
begin
 | 
						|
  More:=Upper(copy(opt,3,length(opt)-2));
 | 
						|
  case opt[2] of
 | 
						|
   'O' : Begin
 | 
						|
           j := 3;
 | 
						|
           While (j <= Length(Opt)) Do
 | 
						|
             Begin
 | 
						|
               case opt[j] of
 | 
						|
                 '-' :
 | 
						|
                   begin
 | 
						|
                     initglobalswitches:=initglobalswitches-[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_littlesize,
 | 
						|
                       cs_regalloc,cs_uncertainopts];
 | 
						|
                     FillChar(ParaAlignment,sizeof(ParaAlignment),0);
 | 
						|
                   end;
 | 
						|
                 'a' :
 | 
						|
                   begin
 | 
						|
                     UpdateAlignmentStr(Copy(Opt,j+1,255),ParaAlignment);
 | 
						|
                     j:=length(Opt);
 | 
						|
                   end;
 | 
						|
                 'g' : initglobalswitches:=initglobalswitches+[cs_littlesize];
 | 
						|
                 'G' : initglobalswitches:=initglobalswitches-[cs_littlesize];
 | 
						|
                 'r' :
 | 
						|
                   begin
 | 
						|
                     initglobalswitches:=initglobalswitches+[cs_regalloc];
 | 
						|
                     Simplify_ppu:=false;
 | 
						|
                   end;
 | 
						|
                 'u' : initglobalswitches:=initglobalswitches+[cs_uncertainopts];
 | 
						|
                 '1' : initglobalswitches:=initglobalswitches-[cs_fastoptimize,cs_slowoptimize]+[cs_optimize];
 | 
						|
                 '2' : initglobalswitches:=initglobalswitches-[cs_slowoptimize]+[cs_optimize,cs_fastoptimize];
 | 
						|
                 '3' : initglobalswitches:=initglobalswitches+[cs_optimize,cs_fastoptimize,cs_slowoptimize];
 | 
						|
                 'p' :
 | 
						|
                   Begin
 | 
						|
                     If j < Length(Opt) Then
 | 
						|
                       Begin
 | 
						|
                         Case opt[j+1] Of
 | 
						|
                           '1': initoptprocessor := SPARC_V8;
 | 
						|
                           '2': initoptprocessor := SPARC_V9;
 | 
						|
                           '3': initoptprocessor := SPARC_V9;
 | 
						|
                           Else IllegalPara(Opt)
 | 
						|
                         End;
 | 
						|
                         Inc(j);
 | 
						|
                       End
 | 
						|
                     Else IllegalPara(opt)
 | 
						|
                   End;
 | 
						|
{$ifdef USECMOV}
 | 
						|
                 's' :
 | 
						|
                   Begin
 | 
						|
                     If j < Length(Opt) Then
 | 
						|
                       Begin
 | 
						|
                         Case opt[j+1] Of
 | 
						|
                           '3': initspecificoptprocessor:=ClassP6
 | 
						|
                           Else IllegalPara(Opt)
 | 
						|
                         End;
 | 
						|
                         Inc(j);
 | 
						|
                       End
 | 
						|
                     Else IllegalPara(opt)
 | 
						|
                   End
 | 
						|
{$endif USECMOV}
 | 
						|
                 else IllegalPara(opt);
 | 
						|
               End;
 | 
						|
               Inc(j)
 | 
						|
             end;
 | 
						|
         end;
 | 
						|
   'R' : begin
 | 
						|
           if More='ATT' then
 | 
						|
            initasmmode:=asmmode_i386_att
 | 
						|
           else
 | 
						|
            if More='INTEL' then
 | 
						|
             initasmmode:=asmmode_i386_intel
 | 
						|
           else
 | 
						|
            if More='DIRECT' then
 | 
						|
             initasmmode:=asmmode_direct
 | 
						|
           else
 | 
						|
            IllegalPara(opt);
 | 
						|
         end;
 | 
						|
  else
 | 
						|
   IllegalPara(opt);
 | 
						|
  end;
 | 
						|
end;
 | 
						|
 | 
						|
 | 
						|
initialization
 | 
						|
  coption:=toptionSPARC;
 | 
						|
end.
 | 
						|
{
 | 
						|
  $Log$
 | 
						|
  Revision 1.2  2002-08-23 10:08:28  mazen
 | 
						|
  *** empty log message ***
 | 
						|
 | 
						|
  Revision 1.1  2002/08/22 08:30:50  mazen
 | 
						|
  first insertion 2002\08\22
 | 
						|
 | 
						|
  Revision 1.4  2001/07/01 20:16:20  peter
 | 
						|
    * alignmentinfo record added
 | 
						|
    * -Oa argument supports more alignment settings that can be specified
 | 
						|
      per type: PROC,LOOP,VARMIN,VARMAX,CONSTMIN,CONSTMAX,RECORDMIN
 | 
						|
      RECORDMAX,LOCALMIN,LOCALMAX. It is possible to set the mimimum
 | 
						|
      required alignment and the maximum usefull alignment. The final
 | 
						|
      alignment will be choosen per variable size dependent on these
 | 
						|
      settings
 | 
						|
 | 
						|
  Revision 1.3  2001/05/12 12:11:31  peter
 | 
						|
    * simplify_ppu is now the default, a recompile of the compiler now
 | 
						|
      only compiles pp.pas
 | 
						|
 | 
						|
  Revision 1.2  2000/12/23 19:46:49  peter
 | 
						|
    * object to class conversion
 | 
						|
    * more verbosity for -vt and -vd
 | 
						|
    * -i options can be put after eachother so the Makefiles only need
 | 
						|
      to call fpc once for all info (will be twice as the first one will
 | 
						|
      be to check the version if fpc supports multiple info)
 | 
						|
 | 
						|
  Revision 1.1  2000/11/30 22:42:50  florian
 | 
						|
  * renamed
 | 
						|
 | 
						|
  Revision 1.1  2000/11/30 22:21:56  florian
 | 
						|
    * moved to iSPARC
 | 
						|
 | 
						|
  Revision 1.6  2000/10/24 10:40:53  jonas
 | 
						|
    + register renaming ("fixes" bug1088)
 | 
						|
    * changed command line options meanings for optimizer:
 | 
						|
        O2 now means peepholopts, CSE and register renaming in 1 pass
 | 
						|
        O3 is the same, but repeated until no further optimizations are
 | 
						|
          possible or until 5 passes have been done (to avoid endless loops)
 | 
						|
    * changed aoptSPARC so it does this looping
 | 
						|
    * added some procedures from csoptSPARC to the interface because they're
 | 
						|
      used by rroptSPARC as well
 | 
						|
    * some changes to csoptSPARC and daoptSPARC so that newly added instructions
 | 
						|
      by the CSE get optimizer info (they were simply skipped previously),
 | 
						|
      this fixes some bugs
 | 
						|
 | 
						|
  Revision 1.5  2000/09/24 15:06:20  peter
 | 
						|
    * use defines.inc
 | 
						|
 | 
						|
  Revision 1.4  2000/08/27 16:11:51  peter
 | 
						|
    * moved some util functions from globals,cobjects to cutils
 | 
						|
    * splitted files into finput,fmodule
 | 
						|
 | 
						|
  Revision 1.3  2000/07/27 13:03:36  jonas
 | 
						|
    * release alignopts
 | 
						|
 | 
						|
  Revision 1.2  2000/07/13 11:32:44  michael
 | 
						|
  + removed logs
 | 
						|
 | 
						|
}
 |