cpuinfo.pas 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. {
  2. Copyright (c) 1998-2002 by the Free Pascal development team
  3. Basic Processor information for the ARM
  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 = type double;
  19. ts128real = type double;
  20. ts64comp = comp;
  21. pbestreal=^bestreal;
  22. { possible supported processors for this target }
  23. tcputype =
  24. (cpu_none,
  25. cpu_mips1,
  26. cpu_mips2,
  27. cpu_mips3,
  28. cpu_mips4,
  29. cpu_mips5,
  30. cpu_mips32,
  31. cpu_mips32r2
  32. );
  33. tfputype =(fpu_none,fpu_soft,fpu_mips2,fpu_mips3);
  34. tabitype =
  35. (
  36. abi_none,
  37. abi_default,
  38. abi_o32,
  39. abi_n32,
  40. abi_o64,
  41. abi_n64,
  42. abi_eabi
  43. );
  44. Const
  45. {# Size of native extended floating point type }
  46. extended_size = 8;
  47. {# Size of a multimedia register }
  48. mmreg_size = 0;
  49. { calling conventions supported by the code generator }
  50. supported_calling_conventions : tproccalloptions = [
  51. pocall_internproc,
  52. pocall_stdcall,
  53. { same as stdcall only different name mangling }
  54. pocall_cdecl,
  55. { same as stdcall only different name mangling }
  56. pocall_cppdecl
  57. ];
  58. { cpu strings as accepted by
  59. GNU assembler in -arch=XXX option
  60. this ilist needs to be uppercased }
  61. cputypestr : array[tcputype] of string[8] = ('',
  62. { cpu_mips1 } 'MIPS1',
  63. { cpu_mips2 } 'MIPS2',
  64. { cpu_mips3 } 'MIPS3',
  65. { cpu_mips4 } 'MIPS4',
  66. { cpu_mips5 } 'MIPS5',
  67. { cpu_mips32 } 'MIPS32',
  68. { cpu_mips32r2 } 'MIPS32R2'
  69. );
  70. fputypestr : array[tfputype] of string[9] = ('',
  71. 'SOFT',
  72. 'FPU_MIPS2','FPU_MIPS3'
  73. );
  74. { abi strings as accepted by
  75. GNU assembler in -abi=XXX option }
  76. abitypestr : array[tabitype] of string[4] =
  77. ({ abi_none } '',
  78. { abi_default } '32',
  79. { abi_o32 } '32',
  80. { abi_n32 } 'n32',
  81. { abi_o64 } 'o64',
  82. { abi_n64 } '64',
  83. { abi_eabi } 'eabi'
  84. );
  85. mips_abi : tabitype = abi_default;
  86. { Supported optimizations, only used for information }
  87. supported_optimizerswitches = [cs_opt_regvar,cs_opt_loopunroll,cs_opt_nodecse,
  88. cs_opt_reorder_fields,cs_opt_fastmath];
  89. level1optimizerswitches = [cs_opt_level1];
  90. level2optimizerswitches = level1optimizerswitches + [cs_opt_regvar,cs_opt_stackframe,cs_opt_nodecse];
  91. level3optimizerswitches = level2optimizerswitches + [cs_opt_loopunroll];
  92. level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
  93. function SetMipsABIType(const s : string) : boolean;
  94. Implementation
  95. uses
  96. cutils;
  97. function SetMipsABIType(const s : string) : boolean;
  98. var
  99. abi : tabitype;
  100. begin
  101. SetMipsABIType:=false;
  102. for abi := low(tabitype) to high(tabitype) do
  103. if (lower(s)=abitypestr[abi]) then
  104. begin
  105. mips_abi:=abi;
  106. SetMipsABIType:=true;
  107. break;
  108. end;
  109. end;
  110. end.