cpuswtch.pas 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl, Pierre Muller
  4. interprets the commandline options which are i386 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. {$i defines.inc}
  20. interface
  21. uses
  22. options;
  23. type
  24. toption386=class(toption)
  25. procedure interpret_proc_specific_options(const opt:string);override;
  26. end;
  27. implementation
  28. uses
  29. cutils,globtype,systems,globals;
  30. procedure toption386.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. '-' : initglobalswitches:=initglobalswitches-[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_littlesize,
  43. cs_regalloc,cs_uncertainopts,cs_align];
  44. 'a' : initglobalswitches:=initglobalswitches+[cs_align];
  45. 'g' : initglobalswitches:=initglobalswitches+[cs_littlesize];
  46. 'G' : initglobalswitches:=initglobalswitches-[cs_littlesize];
  47. 'r' :
  48. begin
  49. initglobalswitches:=initglobalswitches+[cs_regalloc];
  50. Simplify_ppu:=false;
  51. end;
  52. 'u' : initglobalswitches:=initglobalswitches+[cs_uncertainopts];
  53. '1' : initglobalswitches:=initglobalswitches-[cs_fastoptimize,cs_slowoptimize]+[cs_optimize];
  54. '2' : initglobalswitches:=initglobalswitches-[cs_slowoptimize]+[cs_optimize,cs_fastoptimize];
  55. '3' : initglobalswitches:=initglobalswitches+[cs_optimize,cs_fastoptimize,cs_slowoptimize];
  56. 'p' :
  57. Begin
  58. If j < Length(Opt) Then
  59. Begin
  60. Case opt[j+1] Of
  61. '1': initoptprocessor := Class386;
  62. '2': initoptprocessor := ClassP5;
  63. '3': initoptprocessor := ClassP6
  64. Else IllegalPara(Opt)
  65. End;
  66. Inc(j);
  67. End
  68. Else IllegalPara(opt)
  69. End;
  70. {$ifdef USECMOV}
  71. 's' :
  72. Begin
  73. If j < Length(Opt) Then
  74. Begin
  75. Case opt[j+1] Of
  76. '3': initspecificoptprocessor:=ClassP6
  77. Else IllegalPara(Opt)
  78. End;
  79. Inc(j);
  80. End
  81. Else IllegalPara(opt)
  82. End
  83. {$endif USECMOV}
  84. else IllegalPara(opt);
  85. End;
  86. Inc(j)
  87. end;
  88. end;
  89. 'R' : begin
  90. if More='ATT' then
  91. initasmmode:=asmmode_i386_att
  92. else
  93. if More='INTEL' then
  94. initasmmode:=asmmode_i386_intel
  95. else
  96. if More='DIRECT' then
  97. initasmmode:=asmmode_i386_direct
  98. else
  99. IllegalPara(opt);
  100. end;
  101. else
  102. IllegalPara(opt);
  103. end;
  104. end;
  105. initialization
  106. coption:=toption386;
  107. end.
  108. {
  109. $Log$
  110. Revision 1.3 2001-05-12 12:11:31 peter
  111. * simplify_ppu is now the default, a recompile of the compiler now
  112. only compiles pp.pas
  113. Revision 1.2 2000/12/23 19:46:49 peter
  114. * object to class conversion
  115. * more verbosity for -vt and -vd
  116. * -i options can be put after eachother so the Makefiles only need
  117. to call fpc once for all info (will be twice as the first one will
  118. be to check the version if fpc supports multiple info)
  119. Revision 1.1 2000/11/30 22:42:50 florian
  120. * renamed
  121. Revision 1.1 2000/11/30 22:21:56 florian
  122. * moved to i386
  123. Revision 1.6 2000/10/24 10:40:53 jonas
  124. + register renaming ("fixes" bug1088)
  125. * changed command line options meanings for optimizer:
  126. O2 now means peepholopts, CSE and register renaming in 1 pass
  127. O3 is the same, but repeated until no further optimizations are
  128. possible or until 5 passes have been done (to avoid endless loops)
  129. * changed aopt386 so it does this looping
  130. * added some procedures from csopt386 to the interface because they're
  131. used by rropt386 as well
  132. * some changes to csopt386 and daopt386 so that newly added instructions
  133. by the CSE get optimizer info (they were simply skipped previously),
  134. this fixes some bugs
  135. Revision 1.5 2000/09/24 15:06:20 peter
  136. * use defines.inc
  137. Revision 1.4 2000/08/27 16:11:51 peter
  138. * moved some util functions from globals,cobjects to cutils
  139. * splitted files into finput,fmodule
  140. Revision 1.3 2000/07/27 13:03:36 jonas
  141. * release alignopts
  142. Revision 1.2 2000/07/13 11:32:44 michael
  143. + removed logs
  144. }