aasmcpu.pas 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. {
  2. $Id$
  3. Copyright (c) 1999-2002 by Mazen Neifer
  4. Contains the assembler object for the SPARC
  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. unit aasmcpu;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. cclasses,aasmtai,
  23. aasmbase,globals,verbose,
  24. cpubase,cpuinfo;
  25. type
  26. taicpu = class(taicpu_abstract)
  27. constructor op_none(op : tasmop);
  28. constructor op_reg(op : tasmop;_op1 : tregister);
  29. constructor op_ref(op : tasmop;const _op1 : treference);
  30. constructor op_const(op : tasmop;_op1 : aword);
  31. constructor op_reg_reg(op : tasmop;_op1,_op2 : tregister);
  32. constructor op_reg_ref(op : tasmop;_op1 : tregister;const _op2 : treference);
  33. constructor op_reg_const(op:tasmop; _op1: tregister; _op2: aword);
  34. constructor op_const_reg(op:tasmop; _op1: aword; _op2: tregister);
  35. constructor op_ref_reg(op : tasmop;const _op1 : treference;_op2 : tregister);
  36. constructor op_reg_reg_reg(op : tasmop;_op1,_op2,_op3 : tregister);
  37. constructor op_reg_ref_reg(op:tasmop;_op1:TRegister;_op2:TReference;_op3:tregister);
  38. constructor op_reg_const_reg(op:tasmop;_op1:TRegister;_op2:aword;_op3:tregister);
  39. constructor op_const_ref_reg(op:tasmop;_op1:aword;const _op2:treference;_op3:tregister);
  40. constructor op_const_reg_ref(op:tasmop;_op1:aword;_op2:tregister;const _op3:treference);
  41. { this is for Jmp instructions }
  42. constructor op_cond_sym(op : tasmop;cond:TAsmCond;_op1 : tasmsymbol);
  43. constructor op_sym(op : tasmop;_op1 : tasmsymbol);
  44. constructor op_sym_ofs(op : tasmop;_op1 : tasmsymbol;_op1ofs:longint);
  45. end;
  46. tai_align = class(tai_align_abstract)
  47. { nothing to add }
  48. end;
  49. procedure InitAsm;
  50. procedure DoneAsm;
  51. implementation
  52. {*****************************************************************************
  53. taicpu Constructors
  54. *****************************************************************************}
  55. constructor taicpu.op_none(op : tasmop);
  56. begin
  57. inherited create(op);
  58. end;
  59. constructor taicpu.op_reg(op : tasmop;_op1 : tregister);
  60. begin
  61. inherited create(op);
  62. if (_op1.enum = R_INTREGISTER) and (_op1.number = NR_NO) then
  63. internalerror(2003031207);
  64. ops:=1;
  65. loadreg(0,_op1);
  66. end;
  67. constructor taicpu.op_ref(op : tasmop;const _op1 : treference);
  68. begin
  69. inherited create(op);
  70. ops:=1;
  71. loadref(0,_op1);
  72. end;
  73. constructor taicpu.op_const(op : tasmop;_op1 : aword);
  74. begin
  75. inherited create(op);
  76. ops:=1;
  77. loadconst(0,_op1);
  78. end;
  79. constructor taicpu.op_reg_reg(op : tasmop;_op1,_op2 : tregister);
  80. begin
  81. inherited create(op);
  82. if (_op1.enum = R_INTREGISTER) and (_op1.number = NR_NO) then
  83. internalerror(2003031205);
  84. if (_op2.enum = R_INTREGISTER) and (_op2.number = NR_NO) then
  85. internalerror(2003031206);
  86. ops:=2;
  87. loadreg(0,_op1);
  88. loadreg(1,_op2);
  89. end;
  90. constructor taicpu.op_reg_const(op:tasmop; _op1: tregister; _op2: aword);
  91. begin
  92. inherited create(op);
  93. if (_op1.enum = R_INTREGISTER) and (_op1.number = NR_NO) then
  94. internalerror(2003031208);
  95. ops:=2;
  96. loadreg(0,_op1);
  97. loadconst(1,_op2);
  98. end;
  99. constructor taicpu.op_const_reg(op:tasmop; _op1: aword; _op2: tregister);
  100. begin
  101. inherited create(op);
  102. if (_op2.enum = R_INTREGISTER) and (_op2.number = NR_NO) then
  103. internalerror(2003031209);
  104. ops:=2;
  105. loadconst(0,_op1);
  106. loadreg(1,_op2);
  107. end;
  108. constructor taicpu.op_reg_ref(op : tasmop;_op1 : tregister;const _op2 : treference);
  109. begin
  110. inherited create(op);
  111. if (_op1.enum = R_INTREGISTER) and (_op1.number = NR_NO) then
  112. internalerror(2003031210);
  113. ops:=2;
  114. loadreg(0,_op1);
  115. loadref(1,_op2);
  116. end;
  117. constructor taicpu.op_ref_reg(op : tasmop;const _op1 : treference;_op2 : tregister);
  118. begin
  119. inherited create(op);
  120. if (_op2.enum = R_INTREGISTER) and (_op2.number = NR_NO) then
  121. internalerror(2003031210);
  122. ops:=2;
  123. loadref(0,_op1);
  124. loadreg(1,_op2);
  125. end;
  126. constructor taicpu.op_reg_reg_reg(op : tasmop;_op1,_op2,_op3 : tregister);
  127. begin
  128. inherited create(op);
  129. if (_op1.enum = R_INTREGISTER) and (_op1.number = NR_NO) then
  130. internalerror(2003031211);
  131. if (_op2.enum = R_INTREGISTER) and (_op2.number = NR_NO) then
  132. internalerror(2003031212);
  133. if (_op3.enum = R_INTREGISTER) and (_op3.number = NR_NO) then
  134. internalerror(2003031213);
  135. ops:=3;
  136. loadreg(0,_op1);
  137. loadreg(1,_op2);
  138. loadreg(2,_op3);
  139. end;
  140. constructor taicpu.op_reg_ref_reg(op:tasmop;_op1:TRegister;_op2:TReference;_op3:tregister);
  141. begin
  142. inherited create(op);
  143. if (_op1.enum = R_INTREGISTER) and (_op1.number = NR_NO) then
  144. internalerror(2003031214);
  145. if (_op3.enum = R_INTREGISTER) and (_op3.number = NR_NO) then
  146. internalerror(2003031215);
  147. ops:=3;
  148. loadreg(0,_op1);
  149. loadref(1,_op2);
  150. loadreg(2,_op3);
  151. end;
  152. constructor taicpu.op_reg_const_reg(op:tasmop;_op1:TRegister;_op2:aword;_op3:tregister);
  153. begin
  154. inherited create(op);
  155. if (_op1.enum = R_INTREGISTER) and (_op1.number = NR_NO) then
  156. internalerror(2003031216);
  157. if (_op3.enum = R_INTREGISTER) and (_op3.number = NR_NO) then
  158. internalerror(2003031217);
  159. ops:=3;
  160. loadreg(0,_op1);
  161. loadconst(1,_op2);
  162. loadreg(2,_op3);
  163. end;
  164. constructor taicpu.op_const_ref_reg(op:tasmop;_op1:aword;const _op2:treference;_op3:tregister);
  165. begin
  166. inherited create(op);
  167. if (_op3.enum = R_INTREGISTER) and (_op3.number = NR_NO) then
  168. internalerror(2003031218);
  169. ops:=3;
  170. loadconst(0,_op1);
  171. loadref(1,_op2);
  172. loadreg(2,_op3);
  173. end;
  174. constructor taicpu.op_const_reg_ref(op:tasmop;_op1:aword;_op2:tregister;const _op3:treference);
  175. begin
  176. inherited create(op);
  177. if (_op2.enum = R_INTREGISTER) and (_op2.number = NR_NO) then
  178. internalerror(2003031219);
  179. ops:=3;
  180. loadconst(0,_op1);
  181. loadreg(1,_op2);
  182. loadref(2,_op3);
  183. end;
  184. constructor taicpu.op_cond_sym(op:tasmop;cond:TAsmCond;_op1:tasmsymbol);
  185. begin
  186. inherited create(op);
  187. condition:=cond;
  188. ops:=1;
  189. loadsymbol(0,_op1,0);
  190. end;
  191. constructor taicpu.op_sym(op : tasmop;_op1 : tasmsymbol);
  192. begin
  193. inherited create(op);
  194. ops:=1;
  195. loadsymbol(0,_op1,0);
  196. end;
  197. constructor taicpu.op_sym_ofs(op : tasmop;_op1 : tasmsymbol;_op1ofs:longint);
  198. begin
  199. inherited create(op);
  200. ops:=1;
  201. loadsymbol(0,_op1,_op1ofs);
  202. end;
  203. procedure InitAsm;
  204. begin
  205. end;
  206. procedure DoneAsm;
  207. begin
  208. end;
  209. end.
  210. {
  211. $Log$
  212. Revision 1.27 2003-05-30 23:57:08 peter
  213. * more sparc cleanup
  214. * accumulator removed, splitted in function_return_reg (called) and
  215. function_result_reg (caller)
  216. }