cpuinfo.pas 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Basic Processor information
  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 cpuinfo;
  19. {$i fpcdefs.inc}
  20. Interface
  21. uses
  22. globtype;
  23. Type
  24. { Natural integer register type and size for the target machine }
  25. AWord = longword;
  26. AInt = longint;
  27. PAWord = ^AWord;
  28. { This must be an ordinal type with the same size as a pointer
  29. Note: Must be unsigned! Otherwise, ugly code like
  30. pointer(-1) will result in a pointer with the value
  31. $fffffffffffffff on a 32bit machine if the compiler uses
  32. int64 constants internally (JM) }
  33. TConstPtrUInt = longword;
  34. bestreal = extended;
  35. ts32real = single;
  36. ts64real = double;
  37. ts80real = extended;
  38. ts128real = type extended;
  39. ts64comp = type extended;
  40. pbestreal=^bestreal;
  41. { possible supported processors for this target }
  42. tprocessors =
  43. (no_processor,
  44. Class386,
  45. ClassPentium,
  46. ClassPentium2,
  47. ClassPentium3,
  48. ClassPentium4
  49. );
  50. tfputype =
  51. (no_fpuprocessor,
  52. fpu_soft,
  53. fpu_x87,
  54. fpu_sse,
  55. fpu_sse2
  56. );
  57. Const
  58. {# Size of native extended floating point type }
  59. extended_size = 10;
  60. {# Size of a pointer }
  61. pointer_size = 4;
  62. {# Size of a multimedia register }
  63. mmreg_size = 8;
  64. { target cpu string (used by compiler options) }
  65. target_cpu_string = 'i386';
  66. { size of the buffer used for setjump/longjmp
  67. the size of this buffer is deduced from the
  68. jmp_buf structure in setjumph.inc file
  69. }
  70. jmp_buf_size = 24;
  71. { calling conventions supported by the code generator }
  72. supported_calling_conventions = [
  73. pocall_internproc,
  74. pocall_compilerproc,
  75. pocall_inline,
  76. pocall_register,
  77. pocall_safecall,
  78. pocall_stdcall,
  79. pocall_cdecl,
  80. pocall_cppdecl,
  81. pocall_far16,
  82. pocall_pascal,
  83. pocall_oldfpccall
  84. ];
  85. processorsstr : array[tprocessors] of string[10] = ('',
  86. '386',
  87. 'PENTIUM',
  88. 'PENTIUM2',
  89. 'PENTIUM3',
  90. 'PENTIUM4'
  91. );
  92. fputypestr : array[tfputype] of string[6] = ('',
  93. 'SOFT',
  94. 'X87',
  95. 'SSE',
  96. 'SSE2'
  97. );
  98. sse_singlescalar : set of tfputype = [fpu_sse,fpu_sse2];
  99. sse_doublescalar : set of tfputype = [fpu_sse2];
  100. Implementation
  101. end.
  102. {
  103. $Log$
  104. Revision 1.23 2004-02-27 10:21:05 florian
  105. * top_symbol killed
  106. + refaddr to treference added
  107. + refsymbol to treference added
  108. * top_local stuff moved to an extra record to save memory
  109. + aint introduced
  110. * tppufile.get/putint64/aint implemented
  111. Revision 1.22 2003/12/25 12:01:35 florian
  112. + possible sse2 unit usage for double calculations
  113. * some sse2 assembler issues fixed
  114. Revision 1.21 2003/12/25 01:07:09 florian
  115. + $fputype directive support
  116. + single data type operations with sse unit
  117. * fixed more x86-64 stuff
  118. Revision 1.20 2003/12/01 18:43:31 peter
  119. * s128real type is not compatible with s80real
  120. Revision 1.19 2003/11/12 16:05:39 florian
  121. * assembler readers OOPed
  122. + typed currency constants
  123. + typed 128 bit float constants if the CPU supports it
  124. Revision 1.18 2003/11/07 15:58:32 florian
  125. * Florian's culmutative nr. 1; contains:
  126. - invalid calling conventions for a certain cpu are rejected
  127. - arm softfloat calling conventions
  128. - -Sp for cpu dependend code generation
  129. - several arm fixes
  130. - remaining code for value open array paras on heap
  131. Revision 1.17 2003/09/03 11:18:37 florian
  132. * fixed arm concatcopy
  133. + arm support in the common compiler sources added
  134. * moved some generic cg code around
  135. + tfputype added
  136. * ...
  137. Revision 1.16 2002/12/05 14:18:09 florian
  138. * two comments fixed
  139. Revision 1.15 2002/09/07 20:48:43 carl
  140. * cardinal -> longword
  141. Revision 1.14 2002/09/07 15:25:10 peter
  142. * old logs removed and tabs fixed
  143. Revision 1.13 2002/08/15 15:15:55 carl
  144. * jmpbuf size allocation for exceptions is now cpu specific (as it should)
  145. * more generic nodes for maths
  146. * several fixes for better m68k support
  147. Revision 1.12 2002/08/12 15:08:41 carl
  148. + stab register indexes for powerpc (moved from gdb to cpubase)
  149. + tprocessor enumeration moved to cpuinfo
  150. + linker in target_info is now a class
  151. * many many updates for m68k (will soon start to compile)
  152. - removed some ifdef or correct them for correct cpu
  153. Revision 1.11 2002/08/10 14:47:50 carl
  154. + moved target_cpu_string to cpuinfo
  155. * renamed asmmode enum.
  156. * assembler reader has now less ifdef's
  157. * move from nppcmem.pas -> ncgmem.pas vec. node.
  158. Revision 1.10 2002/05/18 13:34:22 peter
  159. * readded missing revisions
  160. Revision 1.9 2002/05/16 19:46:50 carl
  161. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  162. + try to fix temp allocation (still in ifdef)
  163. + generic constructor calls
  164. + start of tassembler / tmodulebase class cleanup
  165. Revision 1.7 2002/04/20 21:37:07 carl
  166. + generic FPC_CHECKPOINTER
  167. + first parameter offset in stack now portable
  168. * rename some constants
  169. + move some cpu stuff to other units
  170. - remove unused constents
  171. * fix stacksize for some targets
  172. * fix generic size problems which depend now on EXTEND_SIZE constant
  173. * removing frame pointer in routines is only available for : i386,m68k and vis targets
  174. Revision 1.6 2002/04/07 13:41:50 carl
  175. - moved type constant
  176. Revision 1.5 2002/04/02 17:11:34 peter
  177. * tlocation,treference update
  178. * LOC_CONSTANT added for better constant handling
  179. * secondadd splitted in multiple routines
  180. * location_force_reg added for loading a location to a register
  181. of a specified size
  182. * secondassignment parses now first the right and then the left node
  183. (this is compatible with Kylix). This saves a lot of push/pop especially
  184. with string operations
  185. * adapted some routines to use the new cg methods
  186. }