cpuswtch.pas 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl, Pierre Muller
  3. interprets the commandline options which are i386 specific
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit cpuswtch;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. options;
  22. type
  23. toption386=class(toption)
  24. procedure interpret_proc_specific_options(const opt:string);override;
  25. end;
  26. implementation
  27. uses
  28. cutils,globtype,systems,globals,cpuinfo;
  29. procedure toption386.interpret_proc_specific_options(const opt:string);
  30. var
  31. j : longint;
  32. More : string;
  33. begin
  34. More:=Upper(copy(opt,3,length(opt)-2));
  35. case opt[2] of
  36. 'O' : Begin
  37. j := 3;
  38. While (j <= Length(Opt)) Do
  39. Begin
  40. case opt[j] of
  41. '-' :
  42. begin
  43. initglobalswitches:=initglobalswitches-[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_littlesize,
  44. cs_regvars,cs_uncertainopts];
  45. FillChar(ParaAlignment,sizeof(ParaAlignment),0);
  46. end;
  47. 'a' :
  48. begin
  49. if not(UpdateAlignmentStr(Copy(Opt,j+1,255),ParaAlignment)) then
  50. IllegalPara(opt);
  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_regvars];
  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 := Class386;
  70. '2': initoptprocessor := ClassPentium;
  71. '3': initoptprocessor := ClassPentium2;
  72. '4': initoptprocessor := ClassPentium4;
  73. '5': initoptprocessor := ClassPentiumM;
  74. Else IllegalPara(Opt)
  75. End;
  76. Inc(j);
  77. End
  78. Else IllegalPara(opt)
  79. End;
  80. else IllegalPara(opt);
  81. End;
  82. Inc(j)
  83. end;
  84. end;
  85. 'R' : begin
  86. if More='ATT' then
  87. initasmmode:=asmmode_i386_att
  88. else
  89. if More='INTEL' then
  90. initasmmode:=asmmode_i386_intel
  91. else
  92. if (More='STANDARD') or (More='DEFAULT') then
  93. initasmmode:=asmmode_standard
  94. else
  95. IllegalPara(opt);
  96. end;
  97. else
  98. IllegalPara(opt);
  99. end;
  100. end;
  101. initialization
  102. coption:=toption386;
  103. end.