opts386.pas 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 opts386;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. options;
  23. type
  24. poption386=^toption386;
  25. toption386=object(toption)
  26. procedure interpret_proc_specific_options(const opt:string);virtual;
  27. end;
  28. implementation
  29. uses
  30. cutils,globtype,systems,globals;
  31. procedure toption386.interpret_proc_specific_options(const opt:string);
  32. var
  33. j : longint;
  34. More : string;
  35. begin
  36. More:=Upper(copy(opt,3,length(opt)-2));
  37. case opt[2] of
  38. 'O' : Begin
  39. j := 3;
  40. While (j <= Length(Opt)) Do
  41. Begin
  42. case opt[j] of
  43. '-' : initglobalswitches:=initglobalswitches-[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_littlesize,
  44. cs_regalloc,cs_uncertainopts,cs_align];
  45. 'a' : initglobalswitches:=initglobalswitches+[cs_align];
  46. 'g' : initglobalswitches:=initglobalswitches+[cs_littlesize];
  47. 'G' : initglobalswitches:=initglobalswitches-[cs_littlesize];
  48. 'r' : initglobalswitches:=initglobalswitches+[cs_regalloc];
  49. 'u' : initglobalswitches:=initglobalswitches+[cs_uncertainopts];
  50. '1' : initglobalswitches:=initglobalswitches-[cs_fastoptimize,cs_slowoptimize]+[cs_optimize];
  51. '2' : initglobalswitches:=initglobalswitches-[cs_slowoptimize]+[cs_optimize,cs_fastoptimize];
  52. '3' : initglobalswitches:=initglobalswitches+[cs_optimize,cs_fastoptimize,cs_slowoptimize];
  53. 'p' :
  54. Begin
  55. If j < Length(Opt) Then
  56. Begin
  57. Case opt[j+1] Of
  58. '1': initoptprocessor := Class386;
  59. '2': initoptprocessor := ClassP5;
  60. '3': initoptprocessor := ClassP6
  61. Else IllegalPara(Opt)
  62. End;
  63. Inc(j);
  64. End
  65. Else IllegalPara(opt)
  66. End;
  67. {$ifdef USECMOV}
  68. 's' :
  69. Begin
  70. If j < Length(Opt) Then
  71. Begin
  72. Case opt[j+1] Of
  73. '3': initspecificoptprocessor:=ClassP6
  74. Else IllegalPara(Opt)
  75. End;
  76. Inc(j);
  77. End
  78. Else IllegalPara(opt)
  79. End
  80. {$endif USECMOV}
  81. else IllegalPara(opt);
  82. End;
  83. Inc(j)
  84. end;
  85. end;
  86. 'R' : begin
  87. if More='ATT' then
  88. initasmmode:=asmmode_i386_att
  89. else
  90. if More='INTEL' then
  91. initasmmode:=asmmode_i386_intel
  92. else
  93. if More='DIRECT' then
  94. initasmmode:=asmmode_i386_direct
  95. else
  96. IllegalPara(opt);
  97. end;
  98. else
  99. IllegalPara(opt);
  100. end;
  101. end;
  102. end.
  103. {
  104. $Log$
  105. Revision 1.6 2000-10-24 10:40:53 jonas
  106. + register renaming ("fixes" bug1088)
  107. * changed command line options meanings for optimizer:
  108. O2 now means peepholopts, CSE and register renaming in 1 pass
  109. O3 is the same, but repeated until no further optimizations are
  110. possible or until 5 passes have been done (to avoid endless loops)
  111. * changed aopt386 so it does this looping
  112. * added some procedures from csopt386 to the interface because they're
  113. used by rropt386 as well
  114. * some changes to csopt386 and daopt386 so that newly added instructions
  115. by the CSE get optimizer info (they were simply skipped previously),
  116. this fixes some bugs
  117. Revision 1.5 2000/09/24 15:06:20 peter
  118. * use defines.inc
  119. Revision 1.4 2000/08/27 16:11:51 peter
  120. * moved some util functions from globals,cobjects to cutils
  121. * splitted files into finput,fmodule
  122. Revision 1.3 2000/07/27 13:03:36 jonas
  123. * release alignopts
  124. Revision 1.2 2000/07/13 11:32:44 michael
  125. + removed logs
  126. }