cg64f64.pas 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. {
  2. $Id$
  3. Copyright (c) 2002 by Florian Klaempfl
  4. Member of the Free Pascal development team
  5. This unit implements the code generation for 64 bit int
  6. arithmethics on 64 bit processors
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. ****************************************************************************
  19. }
  20. {# This unit implements the code generation for 64 bit int arithmethics on
  21. 64 bit processors.
  22. }
  23. unit cg64f64;
  24. {$i fpcdefs.inc}
  25. interface
  26. uses
  27. aasmbase,aasmtai,aasmcpu,
  28. cpuinfo, cpubase,
  29. cginfo, cgobj,
  30. node,symtype;
  31. type
  32. {# Defines all the methods required on 32-bit processors
  33. to handle 64-bit integers.
  34. }
  35. tcg64f64 = class(tcg64)
  36. procedure a_reg_alloc(list : taasmoutput;r : tregister64);override;
  37. procedure a_reg_dealloc(list : taasmoutput;r : tregister64);override;
  38. procedure a_load64_const_ref(list : taasmoutput;value : AWord;const ref : treference);override;
  39. procedure a_load64_reg_ref(list : taasmoutput;reg : tregister64;const ref : treference);override;
  40. procedure a_load64_ref_reg(list : taasmoutput;const ref : treference;reg : tregister64);override;
  41. procedure a_load64_reg_reg(list : taasmoutput;regsrc,regdst : tregister64);override;
  42. procedure a_load64_const_reg(list : taasmoutput;value: qword;reg : tregister64);override;
  43. procedure a_load64_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister64);override;
  44. procedure a_load64_loc_ref(list : taasmoutput;const l : tlocation;const ref : treference);override;
  45. procedure a_load64_const_loc(list : taasmoutput;value : qword;const l : tlocation);override;
  46. procedure a_load64_reg_loc(list : taasmoutput;reg : tregister64;const l : tlocation);override;
  47. procedure a_load64high_reg_ref(list : taasmoutput;reg : tregister;const ref : treference);override;
  48. procedure a_load64low_reg_ref(list : taasmoutput;reg : tregister;const ref : treference);override;
  49. procedure a_load64high_ref_reg(list : taasmoutput;const ref : treference;reg : tregister);override;
  50. procedure a_load64low_ref_reg(list : taasmoutput;const ref : treference;reg : tregister);override;
  51. procedure a_load64high_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister);override;
  52. procedure a_load64low_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister);override;
  53. procedure a_op64_reg_ref(list : taasmoutput;op:TOpCG;regsrc : tregister64;const ref : treference);override;
  54. procedure a_op64_ref_reg(list : taasmoutput;op:TOpCG;const ref : treference;reg : tregister64);override;
  55. procedure a_op64_const_loc(list : taasmoutput;op:TOpCG;value:qword;const l: tlocation);override;
  56. procedure a_op64_reg_loc(list : taasmoutput;op:TOpCG;reg : tregister64;const l : tlocation);override;
  57. procedure a_op64_loc_reg(list : taasmoutput;op:TOpCG;const l : tlocation;reg : tregister64);override;
  58. procedure a_op64_const_reg(list : taasmoutput;op:TOpCG;value : qword;regdst : tregister64);override;
  59. procedure a_op64_const_ref(list : taasmoutput;op:TOpCG;value : qword;const ref : treference);override;
  60. procedure a_param64_reg(list : taasmoutput;reg : tregister64;const locpara : tparalocation);override;
  61. procedure a_param64_const(list : taasmoutput;value : qword;const locpara : tparalocation);override;
  62. procedure a_param64_ref(list : taasmoutput;const r : treference;const locpara : tparalocation);override;
  63. procedure a_param64_loc(list : taasmoutput;const l : tlocation;const locpara : tparalocation);override;
  64. function optimize64_op_const_reg(list: taasmoutput; var op: topcg; var a : qword; var reg: tregister64): boolean;override;
  65. { override to catch 64bit rangechecks }
  66. procedure g_rangecheck64(list: taasmoutput; const p: tnode;
  67. const todef: tdef); override;
  68. end;
  69. implementation
  70. procedure tcg64f64.a_load64_const_ref(list : taasmoutput;value : qword;const ref : treference);
  71. begin
  72. cg.a_load_const_ref(list,OS_64,value,ref);
  73. end;
  74. procedure tcg64f64.a_load64_reg_ref(list : taasmoutput;reg : tregister64;const ref : treference);
  75. begin
  76. cg.a_load_reg_ref(list,OS_64,reg,ref);
  77. end;
  78. procedure tcg64f64.a_load64_ref_reg(list : taasmoutput;const ref : treference;reg : tregister64);
  79. begin
  80. cg.a_load_ref_reg(list,OS_64,ref,reg);
  81. end;
  82. procedure tcg64f64.a_load64_reg_reg(list : taasmoutput;regsrc,regdst : tregister64);
  83. begin
  84. cg.a_load_reg_reg(list,OS_64,OS_64,regsrc,regdst);
  85. end;
  86. procedure tcg64f64.a_load64_const_reg(list : taasmoutput;value : qword;reg : tregister64);
  87. begin
  88. cg.a_load_const_reg(list,OS_64,value,reg);
  89. end;
  90. procedure tcg64f64.a_load64_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister64);
  91. begin
  92. cg.a_load_loc_reg(list,l,reg);
  93. end;
  94. procedure tcg64f64.a_load64_loc_ref(list : taasmoutput;const l : tlocation;const ref : treference);
  95. begin
  96. cg.a_load_loc_ref(list,l,ref);
  97. end;
  98. procedure tcg64f64.a_load64_const_loc(list : taasmoutput;value : qword;const l : tlocation);
  99. begin
  100. cg.a_load_const_loc(list,value,l);
  101. end;
  102. procedure tcg64f64.a_load64_reg_loc(list : taasmoutput;reg : tregister64;const l : tlocation);
  103. begin
  104. cg.a_load_reg_loc(list,OS_64,reg,l);
  105. end;
  106. procedure tcg64f64.a_load64high_reg_ref(list : taasmoutput;reg : tregister;const ref : treference);
  107. begin
  108. end;
  109. procedure tcg64f64.a_load64low_reg_ref(list : taasmoutput;reg : tregister;const ref : treference);
  110. begin
  111. end;
  112. procedure tcg64f64.a_load64high_ref_reg(list : taasmoutput;const ref : treference;reg : tregister);
  113. begin
  114. end;
  115. procedure tcg64f64.a_load64low_ref_reg(list : taasmoutput;const ref : treference;reg : tregister);
  116. begin
  117. end;
  118. procedure tcg64f64.a_load64high_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister);
  119. begin
  120. end;
  121. procedure tcg64f64.a_load64low_loc_reg(list : taasmoutput;const l : tlocation;reg : tregister);
  122. begin
  123. end;
  124. procedure tcg64f64.a_op64_ref_reg(list : taasmoutput;op:TOpCG;const ref : treference;reg : tregister64);
  125. begin
  126. cg.a_op_ref_reg(list,op,OS_64,ref,reg);
  127. end;
  128. procedure tcg64f64.a_op64_reg_ref(list : taasmoutput;op:TOpCG;regsrc : tregister64;const ref : treference);
  129. begin
  130. end;
  131. procedure tcg64f64.a_op64_const_reg(list : taasmoutput;op:TOpCG;value : qword;regdst : tregister64);
  132. begin
  133. end;
  134. procedure tcg64f64.a_op64_const_ref(list : taasmoutput;op:TOpCG;value : qword;const ref : treference);
  135. begin
  136. end;
  137. procedure tcg64f64.a_op64_const_loc(list : taasmoutput;op:TOpCG;value : qword;const l: tlocation);
  138. begin
  139. end;
  140. procedure tcg64f64.a_op64_reg_loc(list : taasmoutput;op:TOpCG;reg : tregister64;const l : tlocation);
  141. begin
  142. end;
  143. procedure tcg64f64.a_op64_loc_reg(list : taasmoutput;op:TOpCG;const l : tlocation;reg : tregister64);
  144. begin
  145. end;
  146. procedure tcg64f64.a_param64_reg(list : taasmoutput;reg64 : tregister;const locpara : tparalocation);
  147. begin
  148. end;
  149. procedure tcg64f64.a_param64_const(list : taasmoutput;value : qword;const locpara : tparalocation);
  150. begin
  151. end;
  152. procedure tcg64f64.a_param64_ref(list : taasmoutput;const r : treference;const locpara : tparalocation);
  153. begin
  154. end;
  155. procedure tcg64f64.a_param64_loc(list : taasmoutput;const l : tlocation;const locpara : tparalocation);
  156. begin
  157. end;
  158. procedure tcg64f64.g_rangecheck64(list: taasmoutput; const p: tnode;
  159. const todef: tdef);
  160. begin
  161. end;
  162. function tcg64f64.optimize64_op_const_reg(list: taasmoutput; var op: topcg; var a : qword; var reg: tregister64): boolean;
  163. begin
  164. { this should be the same routine as optimize_const_reg!!!!!!!! }
  165. end;
  166. procedure tcg64f64.a_reg_alloc(list : taasmoutput;r : tregister64);
  167. begin
  168. list.concat(tai_regalloc.alloc(r));
  169. end;
  170. procedure tcg64f64.a_reg_dealloc(list : taasmoutput;r : tregister64);
  171. begin
  172. list.concat(tai_regalloc.dealloc(r));
  173. end;
  174. end.
  175. {
  176. $Log$
  177. Revision 1.6 2003-01-05 13:36:53 florian
  178. * x86-64 compiles
  179. + very basic support for float128 type (x86-64 only)
  180. Revision 1.5 2002/09/07 15:25:00 peter
  181. * old logs removed and tabs fixed
  182. Revision 1.4 2002/08/19 18:17:48 carl
  183. + optimize64_op_const_reg implemented (optimizes 64-bit constant opcodes)
  184. * more fixes to m68k for 64-bit operations
  185. Revision 1.3 2002/08/17 22:09:43 florian
  186. * result type handling in tcgcal.pass_2 overhauled
  187. * better tnode.dowrite
  188. * some ppc stuff fixed
  189. Revision 1.2 2002/07/01 16:23:52 peter
  190. * cg64 patch
  191. * basics for currency
  192. * asnode updates for class and interface (not finished)
  193. Revision 1.1 2002/06/08 19:36:54 florian
  194. * initial release
  195. }