cginfo.pas 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. This unit exports some types and constants for the code generation
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. {# This unit exports some types which are used across the code generator }
  19. unit cginfo;
  20. {$i fpcdefs.inc}
  21. interface
  22. uses cpuinfo,symconst;
  23. type
  24. {# Generic opcodes, which must be supporrted by all processors }
  25. TOpCg =
  26. (
  27. OP_NONE,
  28. OP_ADD, { simple addition }
  29. OP_AND, { simple logical and }
  30. OP_DIV, { simple unsigned division }
  31. OP_IDIV, { simple signed division }
  32. OP_IMUL, { simple signed multiply }
  33. OP_MUL, { simple unsigned multiply }
  34. OP_NEG, { simple negate }
  35. OP_NOT, { simple logical not }
  36. OP_OR, { simple logical or }
  37. OP_SAR, { arithmetic shift-right }
  38. OP_SHL, { logical shift left }
  39. OP_SHR, { logical shift right }
  40. OP_SUB, { simple subtraction }
  41. OP_XOR { simple exclusive or }
  42. );
  43. {# Generic flag values - used for jump locations }
  44. TOpCmp =
  45. (
  46. OC_NONE,
  47. OC_EQ, { equality comparison }
  48. OC_GT,
  49. OC_LT,
  50. OC_GTE,
  51. OC_LTE,
  52. OC_NE,
  53. OC_BE,
  54. OC_B,
  55. OC_AE,
  56. OC_A
  57. );
  58. { OS_NO is also used memory references with large data that can
  59. not be loaded in a register directly }
  60. TCgSize = (OS_NO,
  61. { integer registers }
  62. OS_8,OS_16,OS_32,OS_64,OS_S8,OS_S16,OS_S32,OS_S64,
  63. { single,double,extended,comp }
  64. OS_F32,OS_F64,OS_F80,OS_C64,
  65. { multi-media sizes: split in byte, word, dword, ... }
  66. { entities, then the signed counterparts }
  67. OS_M8,OS_M16,OS_M32,OS_M64,OS_M128,OS_MS8,OS_MS16,OS_MS32,
  68. OS_MS64,OS_MS128);
  69. const
  70. tcgsize2size : Array[tcgsize] of integer =
  71. { integer values }
  72. (0,1,2,4,8,1,2,4,8,
  73. { floating point values }
  74. 4,8,EXTENDED_SIZE,8,
  75. { multimedia values }
  76. 1,2,4,8,16,1,2,4,8,16);
  77. tfloat2tcgsize: array[tfloattype] of tcgsize =
  78. (OS_F32,OS_F64,OS_F80,OS_C64);
  79. tcgsize2tfloat: array[OS_F32..OS_C64] of tfloattype =
  80. (s32real,s64real,s80real,s64comp);
  81. implementation
  82. end.
  83. {
  84. $Log$
  85. Revision 1.9 2002-05-16 19:46:35 carl
  86. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  87. + try to fix temp allocation (still in ifdef)
  88. + generic constructor calls
  89. + start of tassembler / tmodulebase class cleanup
  90. Revision 1.7 2002/05/13 19:54:36 peter
  91. * removed n386ld and n386util units
  92. * maybe_save/maybe_restore added instead of the old maybe_push
  93. Revision 1.6 2002/05/06 19:48:26 carl
  94. + added more patches from Mazen for SPARC port
  95. Revision 1.5 2002/04/21 19:46:52 carl
  96. + added patch for SPARC from Mazen (to move to cpuinfo)
  97. Revision 1.4 2002/04/21 15:26:15 carl
  98. * move stuff to cpuinfo and cpubase
  99. + documented
  100. Revision 1.3 2002/04/20 21:32:23 carl
  101. + generic FPC_CHECKPOINTER
  102. + first parameter offset in stack now portable
  103. * rename some constants
  104. + move some cpu stuff to other units
  105. - remove unused constents
  106. * fix stacksize for some targets
  107. * fix generic size problems which depend now on EXTEND_SIZE constant
  108. Revision 1.2 2002/04/19 15:46:01 peter
  109. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  110. in most cases and not written to the ppu
  111. * add mangeledname_prefix() routine to generate the prefix of
  112. manglednames depending on the current procedure, object and module
  113. * removed static procprefix since the mangledname is now build only
  114. on demand from tprocdef.mangledname
  115. Revision 1.1 2002/04/02 18:09:47 jonas
  116. + initial implementation (Peter forgot to commit it)
  117. }