cpuswtch.pas 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 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 fpcdefs.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,cpuinfo;
  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. '-' :
  43. begin
  44. initglobalswitches:=initglobalswitches-[cs_optimize,cs_fastoptimize,cs_slowoptimize,cs_littlesize,
  45. cs_regvars,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_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. Else IllegalPara(Opt)
  74. End;
  75. Inc(j);
  76. End
  77. Else IllegalPara(opt)
  78. End;
  79. else IllegalPara(opt);
  80. End;
  81. Inc(j)
  82. end;
  83. end;
  84. 'R' : begin
  85. if More='ATT' then
  86. initasmmode:=asmmode_i386_att
  87. else
  88. if More='INTEL' then
  89. initasmmode:=asmmode_i386_intel
  90. else
  91. if More='DIRECT' then
  92. initasmmode:=asmmode_direct
  93. else
  94. IllegalPara(opt);
  95. end;
  96. else
  97. IllegalPara(opt);
  98. end;
  99. end;
  100. initialization
  101. coption:=toption386;
  102. end.
  103. {
  104. $Log$
  105. Revision 1.11 2003-11-07 15:58:32 florian
  106. * Florian's culmutative nr. 1; contains:
  107. - invalid calling conventions for a certain cpu are rejected
  108. - arm softfloat calling conventions
  109. - -Sp for cpu dependend code generation
  110. - several arm fixes
  111. - remaining code for value open array paras on heap
  112. Revision 1.10 2003/08/09 18:56:54 daniel
  113. * cs_regalloc renamed to cs_regvars to avoid confusion with register
  114. allocator
  115. * Some preventive changes to i386 spillinh code
  116. Revision 1.9 2002/08/12 15:08:42 carl
  117. + stab register indexes for powerpc (moved from gdb to cpubase)
  118. + tprocessor enumeration moved to cpuinfo
  119. + linker in target_info is now a class
  120. * many many updates for m68k (will soon start to compile)
  121. - removed some ifdef or correct them for correct cpu
  122. Revision 1.8 2002/08/10 14:47:50 carl
  123. + moved target_cpu_string to cpuinfo
  124. * renamed asmmode enum.
  125. * assembler reader has now less ifdef's
  126. * move from nppcmem.pas -> ncgmem.pas vec. node.
  127. Revision 1.7 2002/05/18 13:34:22 peter
  128. * readded missing revisions
  129. Revision 1.6 2002/05/16 19:46:50 carl
  130. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  131. + try to fix temp allocation (still in ifdef)
  132. + generic constructor calls
  133. + start of tassembler / tmodulebase class cleanup
  134. }