symcpu.pas 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. {
  2. Copyright (c) 2014 by Florian Klaempfl
  3. Symbol table overrides for PowerPC
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit symcpu;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. symconst,symtype,symdef,symsym;
  22. type
  23. { defs }
  24. tcpufiledef = class(tfiledef)
  25. end;
  26. tcpufiledefclass = class of tcpufiledef;
  27. tcpuvariantdef = class(tvariantdef)
  28. end;
  29. tcpuvariantdefclass = class of tcpuvariantdef;
  30. tcpuformaldef = class(tformaldef)
  31. end;
  32. tcpuformaldefclass = class of tcpuformaldef;
  33. tcpuforwarddef = class(tforwarddef)
  34. end;
  35. tcpuforwarddefclass = class of tcpuforwarddef;
  36. tcpuundefineddef = class(tundefineddef)
  37. end;
  38. tcpuundefineddefclass = class of tcpuundefineddef;
  39. tcpuerrordef = class(terrordef)
  40. end;
  41. tcpuerrordefclass = class of tcpuerrordef;
  42. tcpupointerdef = class(tpointerdef)
  43. end;
  44. tcpupointerdefclass = class of tcpupointerdef;
  45. tcpurecorddef = class(trecorddef)
  46. end;
  47. tcpurecorddefclass = class of tcpurecorddef;
  48. tcpuimplementedinterface = class(timplementedinterface)
  49. end;
  50. tcpuimplementedinterfaceclass = class of tcpuimplementedinterface;
  51. tcpuobjectdef = class(tobjectdef)
  52. end;
  53. tcpuobjectdefclass = class of tcpuobjectdef;
  54. tcpuclassrefdef = class(tclassrefdef)
  55. end;
  56. tcpuclassrefdefclass = class of tcpuclassrefdef;
  57. tcpuarraydef = class(tarraydef)
  58. end;
  59. tcpuarraydefclass = class of tcpuarraydef;
  60. tcpuorddef = class(torddef)
  61. end;
  62. tcpuorddefclass = class of tcpuorddef;
  63. tcpufloatdef = class(tfloatdef)
  64. end;
  65. tcpufloatdefclass = class of tcpufloatdef;
  66. tcpuprocvardef = class(tprocvardef)
  67. end;
  68. tcpuprocvardefclass = class of tcpuprocvardef;
  69. tcpuprocdef = class(tprocdef)
  70. procedure ppuload_platform(ppufile: tcompilerppufile); override;
  71. procedure ppuwrite_platform(ppufile: tcompilerppufile); override;
  72. public
  73. { library symbol for AmigaOS/MorphOS }
  74. libsym : tsym;
  75. libsymderef : tderef;
  76. function getcopyas(newtyp: tdeftyp; copytyp: tproccopytyp; const paraprefix: string): tstoreddef; override;
  77. procedure buildderef; override;
  78. procedure deref; override;
  79. end;
  80. tcpuprocdefclass = class of tcpuprocdef;
  81. tcpustringdef = class(tstringdef)
  82. end;
  83. tcpustringdefclass = class of tcpustringdef;
  84. tcpuenumdef = class(tenumdef)
  85. end;
  86. tcpuenumdefclass = class of tcpuenumdef;
  87. tcpusetdef = class(tsetdef)
  88. end;
  89. tcpusetdefclass = class of tcpusetdef;
  90. { syms }
  91. tcpulabelsym = class(tlabelsym)
  92. end;
  93. tcpulabelsymclass = class of tcpulabelsym;
  94. tcpuunitsym = class(tunitsym)
  95. end;
  96. tcpuunitsymclass = class of tcpuunitsym;
  97. tcpuprogramparasym = class(tprogramparasym)
  98. end;
  99. tcpuprogramparasymclass = class(tprogramparasym);
  100. tcpunamespacesym = class(tnamespacesym)
  101. end;
  102. tcpunamespacesymclass = class of tcpunamespacesym;
  103. tcpuprocsym = class(tprocsym)
  104. end;
  105. tcpuprocsymclass = class of tcpuprocsym;
  106. tcputypesym = class(ttypesym)
  107. end;
  108. tcpuypesymclass = class of tcputypesym;
  109. tcpufieldvarsym = class(tfieldvarsym)
  110. end;
  111. tcpufieldvarsymclass = class of tcpufieldvarsym;
  112. tcpulocalvarsym = class(tlocalvarsym)
  113. end;
  114. tcpulocalvarsymclass = class of tcpulocalvarsym;
  115. tcpuparavarsym = class(tparavarsym)
  116. end;
  117. tcpuparavarsymclass = class of tcpuparavarsym;
  118. tcpustaticvarsym = class(tstaticvarsym)
  119. end;
  120. tcpustaticvarsymclass = class of tcpustaticvarsym;
  121. tcpuabsolutevarsym = class(tabsolutevarsym)
  122. end;
  123. tcpuabsolutevarsymclass = class of tcpuabsolutevarsym;
  124. tcpupropertysym = class(tpropertysym)
  125. end;
  126. tcpupropertysymclass = class of tcpupropertysym;
  127. tcpuconstsym = class(tconstsym)
  128. end;
  129. tcpuconstsymclass = class of tcpuconstsym;
  130. tcpuenumsym = class(tenumsym)
  131. end;
  132. tcpuenumsymclass = class of tcpuenumsym;
  133. tcpusyssym = class(tsyssym)
  134. end;
  135. tcpusyssymclass = class of tcpusyssym;
  136. const
  137. pbestrealtype : ^tdef = @s64floattype;
  138. implementation
  139. {****************************************************************************
  140. tcpuprocdef
  141. ****************************************************************************}
  142. procedure tcpuprocdef.ppuload_platform(ppufile: tcompilerppufile);
  143. begin
  144. inherited;
  145. if po_syscall_has_libsym in procoptions then
  146. ppufile.getderef(libsymderef);
  147. end;
  148. procedure tcpuprocdef.ppuwrite_platform(ppufile: tcompilerppufile);
  149. begin
  150. inherited;
  151. if po_syscall_has_libsym in procoptions then
  152. ppufile.putderef(libsymderef);
  153. end;
  154. function tcpuprocdef.getcopyas(newtyp: tdeftyp; copytyp: tproccopytyp; const paraprefix: string): tstoreddef;
  155. begin
  156. result:=inherited;
  157. if newtyp=procdef then
  158. tcpuprocdef(result).libsym:=libsym;
  159. end;
  160. procedure tcpuprocdef.buildderef;
  161. begin
  162. inherited;
  163. if po_syscall_has_libsym in procoptions then
  164. libsymderef.build(libsym);
  165. end;
  166. procedure tcpuprocdef.deref;
  167. begin
  168. inherited;
  169. if po_syscall_has_libsym in procoptions then
  170. libsym:=tsym(libsymderef.resolve)
  171. else
  172. libsym:=nil;
  173. end;
  174. begin
  175. { used tdef classes }
  176. cfiledef:=tcpufiledef;
  177. cvariantdef:=tcpuvariantdef;
  178. cformaldef:=tcpuformaldef;
  179. cforwarddef:=tcpuforwarddef;
  180. cundefineddef:=tcpuundefineddef;
  181. cerrordef:=tcpuerrordef;
  182. cpointerdef:=tcpupointerdef;
  183. crecorddef:=tcpurecorddef;
  184. cimplementedinterface:=tcpuimplementedinterface;
  185. cobjectdef:=tcpuobjectdef;
  186. cclassrefdef:=tcpuclassrefdef;
  187. carraydef:=tcpuarraydef;
  188. corddef:=tcpuorddef;
  189. cfloatdef:=tcpufloatdef;
  190. cprocvardef:=tcpuprocvardef;
  191. cprocdef:=tcpuprocdef;
  192. cstringdef:=tcpustringdef;
  193. cenumdef:=tcpuenumdef;
  194. csetdef:=tcpusetdef;
  195. { used tsym classes }
  196. clabelsym:=tcpulabelsym;
  197. cunitsym:=tcpuunitsym;
  198. cprogramparasym:=tcpuprogramparasym;
  199. cnamespacesym:=tcpunamespacesym;
  200. cprocsym:=tcpuprocsym;
  201. ctypesym:=tcputypesym;
  202. cfieldvarsym:=tcpufieldvarsym;
  203. clocalvarsym:=tcpulocalvarsym;
  204. cparavarsym:=tcpuparavarsym;
  205. cstaticvarsym:=tcpustaticvarsym;
  206. cabsolutevarsym:=tcpuabsolutevarsym;
  207. cpropertysym:=tcpupropertysym;
  208. cconstsym:=tcpuconstsym;
  209. cenumsym:=tcpuenumsym;
  210. csyssym:=tcpusyssym;
  211. end.