cpuinfo.pas 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. {
  2. Copyright (c) 1998-2002 by the Free Pascal development team
  3. Basic Processor information for AArch64
  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. {$i fpcdefs.inc}
  12. Interface
  13. uses
  14. globtype;
  15. Type
  16. bestreal = double;
  17. {$if FPC_FULLVERSION>20700}
  18. bestrealrec = TDoubleRec;
  19. {$endif FPC_FULLVERSION>20700}
  20. ts32real = single;
  21. ts64real = double;
  22. ts80real = type extended;
  23. ts128real = type extended;
  24. ts64comp = comp;
  25. pbestreal=^bestreal;
  26. { possible supported processors for this target }
  27. tcputype =
  28. (cpu_none,
  29. cpu_armv8,
  30. cpu_armv8a,
  31. cpu_armv81a,
  32. cpu_armv82a,
  33. cpu_armv83a,
  34. cpu_armv84a,
  35. cpu_armv85a,
  36. cpu_armv86a
  37. );
  38. Type
  39. tfputype =
  40. (fpu_none,
  41. fpu_vfp
  42. );
  43. tcontrollertype =
  44. (ct_none
  45. );
  46. tcontrollerdatatype = record
  47. controllertypestr, controllerunitstr: string[20];
  48. cputype: tcputype; fputype: tfputype;
  49. flashbase, flashsize, srambase, sramsize, eeprombase, eepromsize, bootbase, bootsize: dword;
  50. end;
  51. Const
  52. fputypestrllvm : array[tfputype] of string[6] = ('',
  53. ''
  54. );
  55. { Is there support for dealing with multiple microcontrollers available }
  56. { for this platform? }
  57. ControllerSupport = false; (* Not yet at least ;-) *)
  58. {# Size of native extended floating point type }
  59. extended_size = 8;
  60. { target cpu string (used by compiler options) }
  61. target_cpu_string = 'aarch64';
  62. { We know that there are fields after sramsize
  63. but we don't care about this warning }
  64. {$PUSH}
  65. {$WARN 3177 OFF}
  66. embedded_controllers : array [tcontrollertype] of tcontrollerdatatype =
  67. (
  68. (controllertypestr:''; controllerunitstr:''; cputype:cpu_none; fputype:fpu_none; flashbase:0; flashsize:0; srambase:0; sramsize:0));
  69. {$POP}
  70. { calling conventions supported by the code generator }
  71. supported_calling_conventions : tproccalloptions = [
  72. pocall_internproc,
  73. pocall_safecall,
  74. pocall_stdcall,
  75. { same as stdcall only different name mangling }
  76. pocall_cdecl,
  77. { same as stdcall only different name mangling }
  78. pocall_cppdecl,
  79. { same as stdcall but floating point numbers are handled like equal sized integers }
  80. pocall_softfloat,
  81. { same as stdcall (requires that all const records are passed by
  82. reference, but that's already done for stdcall) }
  83. pocall_mwpascal,
  84. { used for interrupt handling }
  85. pocall_interrupt
  86. ];
  87. cputypestr : array[tcputype] of string[9] = ('',
  88. 'ARMV8',
  89. 'ARMV8-A',
  90. 'ARMV8.1-A',
  91. 'ARMV8.2-A',
  92. 'ARMV8.3-A',
  93. 'ARMV8.4-A',
  94. 'ARMV8.5-A',
  95. 'ARMV8.6-A'
  96. );
  97. fputypestr : array[tfputype] of string[9] = ('',
  98. 'VFP'
  99. );
  100. { Supported optimizations, only used for information }
  101. supported_optimizerswitches = genericlevel1optimizerswitches+
  102. genericlevel2optimizerswitches+
  103. genericlevel3optimizerswitches-
  104. { no need to write info about those }
  105. [cs_opt_level1,cs_opt_level2,cs_opt_level3]+
  106. [{$ifndef llvm}cs_opt_regvar,{$endif}cs_opt_loopunroll,cs_opt_tailrecursion,
  107. cs_opt_nodecse,cs_opt_reorder_fields,cs_opt_fastmath];
  108. level1optimizerswitches = genericlevel1optimizerswitches;
  109. level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches +
  110. [{$ifndef llvm}cs_opt_regvar,{$endif}cs_opt_stackframe,cs_opt_tailrecursion,cs_opt_nodecse];
  111. level3optimizerswitches = genericlevel3optimizerswitches + level2optimizerswitches + [{,cs_opt_loopunroll}];
  112. level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
  113. type
  114. tcpuflags =
  115. (CPUAARCH64_HAS_LSE { CPU supports Large System Extensions }
  116. );
  117. tfpuflags =
  118. (CPUAARCH64_HAS_VFP { CPU supports VFP }
  119. );
  120. const
  121. cpu_capabilities : array[tcputype] of set of tcpuflags =
  122. ( { cpu_none } [],
  123. { cpu_armv8 } [],
  124. { cpu_armv8a } [],
  125. { cpu_armv81a } [CPUAARCH64_HAS_LSE],
  126. { cpu_armv82a } [CPUAARCH64_HAS_LSE],
  127. { cpu_armv83a } [CPUAARCH64_HAS_LSE],
  128. { cpu_armv84a } [CPUAARCH64_HAS_LSE],
  129. { cpu_armv85a } [CPUAARCH64_HAS_LSE],
  130. { cpu_armv86a } [CPUAARCH64_HAS_LSE]
  131. );
  132. fpu_capabilities : array[tfputype] of set of tfpuflags =
  133. ( { fpu_none } [],
  134. { fpu_vfp } [CPUAARCH64_HAS_VFP]
  135. );
  136. Implementation
  137. end.