cpuinfo.pas 5.8 KB

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