cginfo.pas 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 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, { greater than (signed) }
  49. OC_LT, { less than (signed) }
  50. OC_GTE, { greater or equal than (signed) }
  51. OC_LTE, { less or equal than (signed) }
  52. OC_NE, { not equal }
  53. OC_BE, { less or equal than (unsigned) }
  54. OC_B, { less than (unsigned) }
  55. OC_AE, { greater or equal than (unsigned) }
  56. OC_A { greater than (unsigned) }
  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,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.12 2002-07-01 16:23:52 peter
  86. * cg64 patch
  87. * basics for currency
  88. * asnode updates for class and interface (not finished)
  89. Revision 1.11 2002/05/27 19:16:08 carl
  90. + added comments to virtual comparison flags
  91. Revision 1.10 2002/05/18 13:34:05 peter
  92. * readded missing revisions
  93. Revision 1.9 2002/05/16 19:46:35 carl
  94. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  95. + try to fix temp allocation (still in ifdef)
  96. + generic constructor calls
  97. + start of tassembler / tmodulebase class cleanup
  98. Revision 1.7 2002/05/13 19:54:36 peter
  99. * removed n386ld and n386util units
  100. * maybe_save/maybe_restore added instead of the old maybe_push
  101. Revision 1.6 2002/05/06 19:48:26 carl
  102. + added more patches from Mazen for SPARC port
  103. Revision 1.5 2002/04/21 19:46:52 carl
  104. + added patch for SPARC from Mazen (to move to cpuinfo)
  105. Revision 1.4 2002/04/21 15:26:15 carl
  106. * move stuff to cpuinfo and cpubase
  107. + documented
  108. Revision 1.3 2002/04/20 21:32:23 carl
  109. + generic FPC_CHECKPOINTER
  110. + first parameter offset in stack now portable
  111. * rename some constants
  112. + move some cpu stuff to other units
  113. - remove unused constents
  114. * fix stacksize for some targets
  115. * fix generic size problems which depend now on EXTEND_SIZE constant
  116. Revision 1.2 2002/04/19 15:46:01 peter
  117. * mangledname rewrite, tprocdef.mangledname is now created dynamicly
  118. in most cases and not written to the ppu
  119. * add mangeledname_prefix() routine to generate the prefix of
  120. manglednames depending on the current procedure, object and module
  121. * removed static procprefix since the mangledname is now build only
  122. on demand from tprocdef.mangledname
  123. Revision 1.1 2002/04/02 18:09:47 jonas
  124. + initial implementation (Peter forgot to commit it)
  125. }