cpubase.inc 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl and Peter Vreman
  4. Contains the basic declarations for the i386 architecture
  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 include file contains the basic declarations for the i386 architecture.
  19. }
  20. {*****************************************************************************
  21. Operand Sizes
  22. *****************************************************************************}
  23. type
  24. topsize = (S_NO,
  25. S_B,S_W,S_L,S_BW,S_BL,S_WL,
  26. S_IS,S_IL,S_IQ,
  27. S_FS,S_FL,S_FX,S_D,S_Q,S_FV,S_FXX,
  28. S_NEAR,S_FAR,S_SHORT
  29. );
  30. {*****************************************************************************
  31. Registers
  32. *****************************************************************************}
  33. const
  34. {# Standard opcode string table (for each tasmop enumeration). The
  35. opcode strings should conform to the names as defined by the
  36. processor manufacturer.
  37. }
  38. std_op2str:op2strtable={$i i386int.inc}
  39. {*****************************************************************************
  40. Constants
  41. *****************************************************************************}
  42. c_countusableregsint = 4;
  43. {
  44. firstsaveintreg = RS_EAX;
  45. lastsaveintreg = RS_EDX;
  46. firstsavefpureg = RS_INVALID;
  47. lastsavefpureg = RS_INVALID;
  48. firstsavemmreg = RS_MM0;
  49. lastsavemmreg = RS_MM7;
  50. general_superregisters = [RS_EAX,RS_EBX,RS_ECX,RS_EDX];
  51. maxvarregs = 4;
  52. varregs : array[1..maxvarregs] of tsuperregister =
  53. (RS_EBX,RS_EDX,RS_ECX,RS_EAX);
  54. maxfpuvarregs = 8;
  55. maxmmvarregs = 8;
  56. }
  57. {*****************************************************************************
  58. GDB Information
  59. *****************************************************************************}
  60. {# Register indexes for stabs information, when some
  61. parameters or variables are stored in registers.
  62. Taken from i386.c (dbx_register_map) and i386.h
  63. (FIXED_REGISTERS) from GCC 3.x source code
  64. }
  65. reg_stab_table : array[tregisterindex] of shortint = (
  66. {$i r386stab.inc}
  67. );
  68. {*****************************************************************************
  69. Default generic sizes
  70. *****************************************************************************}
  71. {# Defines the default address size for a processor, }
  72. OS_ADDR = OS_32;
  73. {# the natural int size for a processor, }
  74. OS_INT = OS_32;
  75. {# the maximum float size for a processor, }
  76. OS_FLOAT = OS_F80;
  77. {# the size of a vector register for a processor }
  78. OS_VECTOR = OS_M64;
  79. {*****************************************************************************
  80. Generic Register names
  81. *****************************************************************************}
  82. {# Stack pointer register }
  83. NR_STACK_POINTER_REG = NR_ESP;
  84. RS_STACK_POINTER_REG = RS_ESP;
  85. {# Frame pointer register }
  86. RS_FRAME_POINTER_REG = RS_EBP;
  87. NR_FRAME_POINTER_REG = NR_EBP;
  88. {# Register for addressing absolute data in a position independant way,
  89. such as in PIC code. The exact meaning is ABI specific. For
  90. further information look at GCC source : PIC_OFFSET_TABLE_REGNUM
  91. }
  92. NR_PIC_OFFSET_REG = NR_EBX;
  93. { Results are returned in this register (32-bit values) }
  94. NR_FUNCTION_RETURN_REG = NR_EAX;
  95. RS_FUNCTION_RETURN_REG = RS_EAX;
  96. { Low part of 64bit return value }
  97. NR_FUNCTION_RETURN64_LOW_REG = NR_EAX;
  98. RS_FUNCTION_RETURN64_LOW_REG = RS_EAX;
  99. { High part of 64bit return value }
  100. NR_FUNCTION_RETURN64_HIGH_REG = NR_EDX;
  101. RS_FUNCTION_RETURN64_HIGH_REG = RS_EDX;
  102. { The value returned from a function is available in this register }
  103. NR_FUNCTION_RESULT_REG = NR_FUNCTION_RETURN_REG;
  104. RS_FUNCTION_RESULT_REG = RS_FUNCTION_RETURN_REG;
  105. { The lowh part of 64bit value returned from a function }
  106. NR_FUNCTION_RESULT64_LOW_REG = NR_FUNCTION_RETURN64_LOW_REG;
  107. RS_FUNCTION_RESULT64_LOW_REG = RS_FUNCTION_RETURN64_LOW_REG;
  108. { The high part of 64bit value returned from a function }
  109. NR_FUNCTION_RESULT64_HIGH_REG = NR_FUNCTION_RETURN64_HIGH_REG;
  110. RS_FUNCTION_RESULT64_HIGH_REG = RS_FUNCTION_RETURN64_HIGH_REG;
  111. { WARNING: don't change to R_ST0!! See comments above implementation of }
  112. { a_loadfpu* methods in rgcpu (JM) }
  113. NR_fpu_result_reg = NR_ST;
  114. NR_mm_result_reg = NR_MM0;
  115. { Offset where the parent framepointer is pushed }
  116. PARENT_FRAMEPOINTER_OFFSET = 8;
  117. {*****************************************************************************
  118. GCC /ABI linking information
  119. *****************************************************************************}
  120. const
  121. {# Registers which must be saved when calling a routine declared as
  122. cppdecl, cdecl, stdcall, safecall, palmossyscall. The registers
  123. saved should be the ones as defined in the target ABI and / or GCC.
  124. This value can be deduced from the CALLED_USED_REGISTERS array in the
  125. GCC source.
  126. }
  127. saved_standard_registers : array[0..2] of tsuperregister = (RS_EBX,RS_ESI,RS_EDI);
  128. {# Required parameter alignment when calling a routine declared as
  129. stdcall and cdecl. The alignment value should be the one defined
  130. by GCC or the target ABI.
  131. The value of this constant is equal to the constant
  132. PARM_BOUNDARY / BITS_PER_UNIT in the GCC source.
  133. }
  134. std_param_align = 4;
  135. {
  136. $Log$
  137. Revision 1.11 2004-01-14 23:39:05 florian
  138. * another bunch of x86-64 fixes mainly calling convention and
  139. assembler reader related
  140. Revision 1.10 2003/10/17 14:38:32 peter
  141. * 64k registers supported
  142. * fixed some memory leaks
  143. Revision 1.9 2003/09/03 15:55:01 peter
  144. * NEWRA branch merged
  145. Revision 1.8 2003/09/03 11:18:37 florian
  146. * fixed arm concatcopy
  147. + arm support in the common compiler sources added
  148. * moved some generic cg code around
  149. + tfputype added
  150. * ...
  151. Revision 1.7.2.3 2003/08/29 17:29:00 peter
  152. * next batch of updates
  153. Revision 1.7.2.2 2003/08/28 18:35:08 peter
  154. * tregister changed to cardinal
  155. Revision 1.7.2.1 2003/08/27 20:05:04 peter
  156. * forgotten
  157. Revision 1.7 2003/07/06 17:58:22 peter
  158. * framepointer fixes for sparc
  159. * parent framepointer code more generic
  160. Revision 1.6 2003/06/03 13:01:59 daniel
  161. * Register allocator finished
  162. Revision 1.5 2003/05/31 15:05:28 peter
  163. * FUNCTION_RESULT64_LOW/HIGH_REG added for int64 results
  164. Revision 1.4 2003/05/30 23:57:08 peter
  165. * more sparc cleanup
  166. * accumulator removed, splitted in function_return_reg (called) and
  167. function_result_reg (caller)
  168. Revision 1.3 2003/05/16 14:33:31 peter
  169. * regvar fixes
  170. Revision 1.2 2002/04/25 16:12:09 florian
  171. * fixed more problems with cpubase and x86-64
  172. Revision 1.1 2003/04/25 11:12:09 florian
  173. * merged i386/cpubase and x86_64/cpubase to x86/cpubase;
  174. different stuff went to cpubase.inc
  175. }