cpuinfo.pas 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. {
  2. Copyright (c) 1998-2002 by the Free Pascal development team
  3. Basic Processor information for the m68k
  4. See the file COPYING.FPC, included in this distribution,
  5. for details about the copyright.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. **********************************************************************}
  10. Unit CPUInfo;
  11. Interface
  12. uses
  13. globtype;
  14. Type
  15. bestreal = double;
  16. ts32real = single;
  17. ts64real = double;
  18. ts80real = extended;
  19. ts128real = type extended;
  20. ts64comp = extended;
  21. pbestreal=^bestreal;
  22. { possible supported processors for this target }
  23. tcputype =
  24. (cpu_none,
  25. cpu_MC68000,
  26. cpu_MC68020,
  27. cpu_MC68040,
  28. cpu_isa_a,
  29. cpu_isa_a_p,
  30. cpu_isa_b,
  31. cpu_isa_c
  32. );
  33. tfputype =
  34. (fpu_none,
  35. fpu_soft,
  36. fpu_libgcc,
  37. fpu_68881
  38. );
  39. Const
  40. { calling conventions supported by the code generator }
  41. supported_calling_conventions : tproccalloptions = [
  42. pocall_internproc,
  43. pocall_stdcall,
  44. { the difference to stdcall is only the name mangling }
  45. pocall_cdecl,
  46. { the difference to stdcall is only the name mangling }
  47. pocall_cppdecl,
  48. { this used by the PalmOS port only }
  49. pocall_syscall
  50. ];
  51. cputypestr : array[tcputype] of string[8] = ('',
  52. '68000',
  53. '68020',
  54. '68040',
  55. 'ISAA',
  56. 'ISAA+',
  57. 'ISAB',
  58. 'ISAC'
  59. );
  60. gascputypestr : array[tcputype] of string[8] = ('',
  61. '68000',
  62. '68020',
  63. '68040',
  64. 'isaa',
  65. 'isaaplus',
  66. 'isab',
  67. 'isac'
  68. );
  69. fputypestr : array[tfputype] of string[6] = ('',
  70. 'SOFT',
  71. 'LIBGCC',
  72. '68881'
  73. );
  74. { Supported optimizations, only used for information }
  75. supported_optimizerswitches = genericlevel1optimizerswitches+
  76. genericlevel2optimizerswitches+
  77. genericlevel3optimizerswitches-
  78. { no need to write info about those }
  79. [cs_opt_level1,cs_opt_level2,cs_opt_level3]+
  80. [cs_opt_regvar,cs_opt_loopunroll,cs_opt_nodecse,
  81. cs_opt_reorder_fields,cs_opt_fastmath];
  82. level1optimizerswitches = genericlevel1optimizerswitches;
  83. level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches +
  84. [cs_opt_regvar,cs_opt_stackframe,cs_opt_nodecse];
  85. level3optimizerswitches = genericlevel3optimizerswitches + level2optimizerswitches + [{,cs_opt_loopunroll}];
  86. level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
  87. type
  88. tcpuflags =
  89. (CPUM68K_HAS_DBRA, { CPU supports the DBRA instruction }
  90. CPUM68K_HAS_CAS, { CPU supports the CAS instruction }
  91. CPUM68K_HAS_TAS, { CPU supports the TAS instruction }
  92. CPUM68K_HAS_BRAL, { CPU supports the BRA.L/Bcc.L instructions }
  93. CPUM68K_HAS_ROLROR, { CPU supports the ROL/ROR and ROXL/ROXR instructions }
  94. CPUM68K_HAS_BYTEREV { CPU supports the BYTEREV instruction }
  95. );
  96. const
  97. cpu_capabilities : array[tcputype] of set of tcpuflags =
  98. ( { cpu_none } [],
  99. { cpu_68000 } [CPUM68K_HAS_DBRA,CPUM68K_HAS_TAS,CPUM68K_HAS_ROLROR],
  100. { cpu_68020 } [CPUM68K_HAS_DBRA,CPUM68K_HAS_CAS,CPUM68K_HAS_TAS,CPUM68K_HAS_BRAL,CPUM68K_HAS_ROLROR],
  101. { cpu_68040 } [CPUM68K_HAS_DBRA,CPUM68K_HAS_CAS,CPUM68K_HAS_TAS,CPUM68K_HAS_BRAL,CPUM68K_HAS_ROLROR],
  102. { cpu_isaa } [],
  103. { cpu_isaap } [CPUM68K_HAS_BRAL,CPUM68K_HAS_BYTEREV],
  104. { cpu_isab } [CPUM68K_HAS_TAS,CPUM68K_HAS_BRAL],
  105. { cpu_isac } [CPUM68K_HAS_TAS,CPUM68K_HAS_BYTEREV]
  106. );
  107. { all CPUs commonly called "coldfire" }
  108. cpu_coldfire = [cpu_isa_a,cpu_isa_a_p,cpu_isa_b,cpu_isa_c];
  109. Implementation
  110. end.