cpuinfo.pas 3.6 KB

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