symcpu.pas 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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): 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. tcpunamespacesym = class(tnamespacesym)
  98. end;
  99. tcpunamespacesymclass = class of tcpunamespacesym;
  100. tcpuprocsym = class(tprocsym)
  101. end;
  102. tcpuprocsymclass = class of tcpuprocsym;
  103. tcputypesym = class(ttypesym)
  104. end;
  105. tcpuypesymclass = class of tcputypesym;
  106. tcpufieldvarsym = class(tfieldvarsym)
  107. end;
  108. tcpufieldvarsymclass = class of tcpufieldvarsym;
  109. tcpulocalvarsym = class(tlocalvarsym)
  110. end;
  111. tcpulocalvarsymclass = class of tcpulocalvarsym;
  112. tcpuparavarsym = class(tparavarsym)
  113. end;
  114. tcpuparavarsymclass = class of tcpuparavarsym;
  115. tcpustaticvarsym = class(tstaticvarsym)
  116. end;
  117. tcpustaticvarsymclass = class of tcpustaticvarsym;
  118. tcpuabsolutevarsym = class(tabsolutevarsym)
  119. end;
  120. tcpuabsolutevarsymclass = class of tcpuabsolutevarsym;
  121. tcpupropertysym = class(tpropertysym)
  122. end;
  123. tcpupropertysymclass = class of tcpupropertysym;
  124. tcpuconstsym = class(tconstsym)
  125. end;
  126. tcpuconstsymclass = class of tcpuconstsym;
  127. tcpuenumsym = class(tenumsym)
  128. end;
  129. tcpuenumsymclass = class of tcpuenumsym;
  130. tcpusyssym = class(tsyssym)
  131. end;
  132. tcpusyssymclass = class of tcpusyssym;
  133. const
  134. pbestrealtype : ^tdef = @s64floattype;
  135. implementation
  136. {****************************************************************************
  137. tcpuprocdef
  138. ****************************************************************************}
  139. procedure tcpuprocdef.ppuload_platform(ppufile: tcompilerppufile);
  140. begin
  141. inherited;
  142. if po_syscall_has_libsym in procoptions then
  143. ppufile.getderef(libsymderef);
  144. end;
  145. procedure tcpuprocdef.ppuwrite_platform(ppufile: tcompilerppufile);
  146. begin
  147. inherited;
  148. if po_syscall_has_libsym in procoptions then
  149. ppufile.putderef(libsymderef);
  150. end;
  151. function tcpuprocdef.getcopyas(newtyp: tdeftyp; copytyp: tproccopytyp): tstoreddef;
  152. begin
  153. result:=inherited;
  154. if newtyp=procdef then
  155. tcpuprocdef(result).libsym:=libsym;
  156. end;
  157. procedure tcpuprocdef.buildderef;
  158. begin
  159. inherited;
  160. if po_syscall_has_libsym in procoptions then
  161. libsymderef.build(libsym);
  162. end;
  163. procedure tcpuprocdef.deref;
  164. begin
  165. inherited;
  166. if po_syscall_has_libsym in procoptions then
  167. libsym:=tsym(libsymderef.resolve)
  168. else
  169. libsym:=nil;
  170. end;
  171. begin
  172. { used tdef classes }
  173. cfiledef:=tcpufiledef;
  174. cvariantdef:=tcpuvariantdef;
  175. cformaldef:=tcpuformaldef;
  176. cforwarddef:=tcpuforwarddef;
  177. cundefineddef:=tcpuundefineddef;
  178. cerrordef:=tcpuerrordef;
  179. cpointerdef:=tcpupointerdef;
  180. crecorddef:=tcpurecorddef;
  181. cimplementedinterface:=tcpuimplementedinterface;
  182. cobjectdef:=tcpuobjectdef;
  183. cclassrefdef:=tcpuclassrefdef;
  184. carraydef:=tcpuarraydef;
  185. corddef:=tcpuorddef;
  186. cfloatdef:=tcpufloatdef;
  187. cprocvardef:=tcpuprocvardef;
  188. cprocdef:=tcpuprocdef;
  189. cstringdef:=tcpustringdef;
  190. cenumdef:=tcpuenumdef;
  191. csetdef:=tcpusetdef;
  192. { used tsym classes }
  193. clabelsym:=tcpulabelsym;
  194. cunitsym:=tcpuunitsym;
  195. cnamespacesym:=tcpunamespacesym;
  196. cprocsym:=tcpuprocsym;
  197. ctypesym:=tcputypesym;
  198. cfieldvarsym:=tcpufieldvarsym;
  199. clocalvarsym:=tcpulocalvarsym;
  200. cparavarsym:=tcpuparavarsym;
  201. cstaticvarsym:=tcpustaticvarsym;
  202. cabsolutevarsym:=tcpuabsolutevarsym;
  203. cpropertysym:=tcpupropertysym;
  204. cconstsym:=tcpuconstsym;
  205. cenumsym:=tcpuenumsym;
  206. csyssym:=tcpusyssym;
  207. end.