cpuswtch.pas 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl, Pierre Muller
  4. interprets the commandline options which are iSPARC specific
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit cpuswtch;
  19. {$INCLUDE fpcdefs.inc}
  20. interface
  21. uses
  22. options;
  23. type
  24. toptionSPARC=class(toption)
  25. procedure interpret_proc_specific_options(const opt:string);override;
  26. end;
  27. implementation
  28. uses
  29. cutils,globtype,systems,globals,cpuinfo;
  30. procedure toptionSPARC.interpret_proc_specific_options(const opt:string);
  31. var
  32. j : longint;
  33. More : string;
  34. begin
  35. More:=Upper(copy(opt,3,length(opt)-2));
  36. case opt[2] of
  37. 'O' : Begin
  38. j := 3;
  39. While (j <= Length(Opt)) Do
  40. Begin
  41. case opt[j] of
  42. '-' :
  43. begin
  44. initglobalswitches:=initglobalswitches-[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_littlesize,
  45. cs_regalloc,cs_uncertainopts];
  46. FillChar(ParaAlignment,sizeof(ParaAlignment),0);
  47. end;
  48. 'a' :
  49. begin
  50. UpdateAlignmentStr(Copy(Opt,j+1,255),ParaAlignment);
  51. j:=length(Opt);
  52. end;
  53. 'g' : initglobalswitches:=initglobalswitches+[cs_littlesize];
  54. 'G' : initglobalswitches:=initglobalswitches-[cs_littlesize];
  55. 'r' :
  56. begin
  57. initglobalswitches:=initglobalswitches+[cs_regalloc];
  58. Simplify_ppu:=false;
  59. end;
  60. 'u' : initglobalswitches:=initglobalswitches+[cs_uncertainopts];
  61. '1' : initglobalswitches:=initglobalswitches-[cs_fastoptimize,cs_slowoptimize]+[cs_optimize];
  62. '2' : initglobalswitches:=initglobalswitches-[cs_slowoptimize]+[cs_optimize,cs_fastoptimize];
  63. '3' : initglobalswitches:=initglobalswitches+[cs_optimize,cs_fastoptimize,cs_slowoptimize];
  64. 'p' :
  65. Begin
  66. If j < Length(Opt) Then
  67. Begin
  68. Case opt[j+1] Of
  69. '1': initoptprocessor := SPARC_V8;
  70. '2': initoptprocessor := SPARC_V9;
  71. '3': initoptprocessor := SPARC_V9;
  72. Else IllegalPara(Opt)
  73. End;
  74. Inc(j);
  75. End
  76. Else IllegalPara(opt)
  77. End;
  78. {$ifdef USECMOV}
  79. 's' :
  80. Begin
  81. If j < Length(Opt) Then
  82. Begin
  83. Case opt[j+1] Of
  84. '3': initspecificoptprocessor:=ClassP6
  85. Else IllegalPara(Opt)
  86. End;
  87. Inc(j);
  88. End
  89. Else IllegalPara(opt)
  90. End
  91. {$endif USECMOV}
  92. else IllegalPara(opt);
  93. End;
  94. Inc(j)
  95. end;
  96. end;
  97. 'R' : begin
  98. if More='ATT' then
  99. initasmmode:=asmmode_i386_att
  100. else
  101. if More='INTEL' then
  102. initasmmode:=asmmode_i386_intel
  103. else
  104. if More='DIRECT' then
  105. initasmmode:=asmmode_direct
  106. else
  107. IllegalPara(opt);
  108. end;
  109. else
  110. IllegalPara(opt);
  111. end;
  112. end;
  113. initialization
  114. coption:=toptionSPARC;
  115. end.
  116. {
  117. $Log$
  118. Revision 1.2 2002-08-23 10:08:28 mazen
  119. *** empty log message ***
  120. Revision 1.1 2002/08/22 08:30:50 mazen
  121. first insertion 2002\08\22
  122. Revision 1.4 2001/07/01 20:16:20 peter
  123. * alignmentinfo record added
  124. * -Oa argument supports more alignment settings that can be specified
  125. per type: PROC,LOOP,VARMIN,VARMAX,CONSTMIN,CONSTMAX,RECORDMIN
  126. RECORDMAX,LOCALMIN,LOCALMAX. It is possible to set the mimimum
  127. required alignment and the maximum usefull alignment. The final
  128. alignment will be choosen per variable size dependent on these
  129. settings
  130. Revision 1.3 2001/05/12 12:11:31 peter
  131. * simplify_ppu is now the default, a recompile of the compiler now
  132. only compiles pp.pas
  133. Revision 1.2 2000/12/23 19:46:49 peter
  134. * object to class conversion
  135. * more verbosity for -vt and -vd
  136. * -i options can be put after eachother so the Makefiles only need
  137. to call fpc once for all info (will be twice as the first one will
  138. be to check the version if fpc supports multiple info)
  139. Revision 1.1 2000/11/30 22:42:50 florian
  140. * renamed
  141. Revision 1.1 2000/11/30 22:21:56 florian
  142. * moved to iSPARC
  143. Revision 1.6 2000/10/24 10:40:53 jonas
  144. + register renaming ("fixes" bug1088)
  145. * changed command line options meanings for optimizer:
  146. O2 now means peepholopts, CSE and register renaming in 1 pass
  147. O3 is the same, but repeated until no further optimizations are
  148. possible or until 5 passes have been done (to avoid endless loops)
  149. * changed aoptSPARC so it does this looping
  150. * added some procedures from csoptSPARC to the interface because they're
  151. used by rroptSPARC as well
  152. * some changes to csoptSPARC and daoptSPARC so that newly added instructions
  153. by the CSE get optimizer info (they were simply skipped previously),
  154. this fixes some bugs
  155. Revision 1.5 2000/09/24 15:06:20 peter
  156. * use defines.inc
  157. Revision 1.4 2000/08/27 16:11:51 peter
  158. * moved some util functions from globals,cobjects to cutils
  159. * splitted files into finput,fmodule
  160. Revision 1.3 2000/07/27 13:03:36 jonas
  161. * release alignopts
  162. Revision 1.2 2000/07/13 11:32:44 michael
  163. + removed logs
  164. }