cpuinfo.pas 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. { target cpu string (used by compiler options) }
  50. {$ifdef MIPSEL}
  51. target_cpu_string = 'mipsel';
  52. {$else MIPSEL}
  53. target_cpu_string = 'mips';
  54. {$endif MIPSEL}
  55. { calling conventions supported by the code generator }
  56. supported_calling_conventions : tproccalloptions = [
  57. pocall_internproc,
  58. pocall_stdcall,
  59. { same as stdcall only different name mangling }
  60. pocall_cdecl,
  61. { same as stdcall only different name mangling }
  62. pocall_cppdecl
  63. ];
  64. { cpu strings as accepted by
  65. GNU assembler in -arch=XXX option
  66. this ilist needs to be uppercased }
  67. cputypestr : array[tcputype] of string[8] = ('',
  68. { cpu_mips1 } 'MIPS1',
  69. { cpu_mips2 } 'MIPS2',
  70. { cpu_mips3 } 'MIPS3',
  71. { cpu_mips4 } 'MIPS4',
  72. { cpu_mips5 } 'MIPS5',
  73. { cpu_mips32 } 'MIPS32',
  74. { cpu_mips32r2 } 'MIPS32R2'
  75. );
  76. fputypestr : array[tfputype] of string[9] = ('',
  77. 'SOFT',
  78. 'FPU_MIPS2','FPU_MIPS3'
  79. );
  80. { abi strings as accepted by
  81. GNU assembler in -abi=XXX option }
  82. abitypestr : array[tabitype] of string[4] =
  83. ({ abi_none } '',
  84. { abi_default } '32',
  85. { abi_o32 } '32',
  86. { abi_n32 } 'n32',
  87. { abi_o64 } 'o64',
  88. { abi_n64 } '64',
  89. { abi_eabi } 'eabi'
  90. );
  91. mips_abi : tabitype = abi_default;
  92. { Supported optimizations, only used for information }
  93. supported_optimizerswitches = [cs_opt_regvar,cs_opt_loopunroll,cs_opt_nodecse,
  94. cs_opt_reorder_fields,cs_opt_fastmath];
  95. level1optimizerswitches = [];
  96. level2optimizerswitches = level1optimizerswitches + [cs_opt_regvar,cs_opt_stackframe,cs_opt_nodecse];
  97. level3optimizerswitches = level2optimizerswitches + [cs_opt_loopunroll];
  98. level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
  99. function SetMipsABIType(const s : string) : boolean;
  100. Implementation
  101. uses
  102. cutils;
  103. function SetMipsABIType(const s : string) : boolean;
  104. var
  105. abi : tabitype;
  106. begin
  107. SetMipsABIType:=false;
  108. for abi := low(tabitype) to high(tabitype) do
  109. if (lower(s)=abitypestr[abi]) then
  110. begin
  111. mips_abi:=abi;
  112. SetMipsABIType:=true;
  113. break;
  114. end;
  115. end;
  116. end.