symcpu.pas 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. {
  2. Copyright (c) 2014 by Florian Klaempfl
  3. Symbol table overrides for ARM
  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. symtype,symdef,symsym,symconst,globtype;
  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. { the arm paramanager might need to know the total size of the stackframe
  71. to avoid cyclic unit dependencies or global variables, this information is
  72. stored in total_stackframe_size }
  73. total_stackframe_size : aint;
  74. procedure ppuload_platform(ppufile: tcompilerppufile); override;
  75. procedure ppuwrite_platform(ppufile: tcompilerppufile); override;
  76. public
  77. { library symbol for AROS }
  78. libsym : tsym;
  79. libsymderef : tderef;
  80. function getcopyas(newtyp: tdeftyp; copytyp: tproccopytyp; const paraprefix: string): tstoreddef; override;
  81. procedure buildderef; override;
  82. procedure deref; override;
  83. end;
  84. tcpuprocdefclass = class of tcpuprocdef;
  85. tcpustringdef = class(tstringdef)
  86. end;
  87. tcpustringdefclass = class of tcpustringdef;
  88. tcpuenumdef = class(tenumdef)
  89. end;
  90. tcpuenumdefclass = class of tcpuenumdef;
  91. tcpusetdef = class(tsetdef)
  92. end;
  93. tcpusetdefclass = class of tcpusetdef;
  94. { syms }
  95. tcpulabelsym = class(tlabelsym)
  96. end;
  97. tcpulabelsymclass = class of tcpulabelsym;
  98. tcpuunitsym = class(tunitsym)
  99. end;
  100. tcpuunitsymclass = class of tcpuunitsym;
  101. tcpuprogramparasym = class(tprogramparasym)
  102. end;
  103. tcpuprogramparasymclass = class(tprogramparasym);
  104. tcpunamespacesym = class(tnamespacesym)
  105. end;
  106. tcpunamespacesymclass = class of tcpunamespacesym;
  107. tcpuprocsym = class(tprocsym)
  108. end;
  109. tcpuprocsymclass = class of tcpuprocsym;
  110. tcputypesym = class(ttypesym)
  111. end;
  112. tcpuypesymclass = class of tcputypesym;
  113. tcpufieldvarsym = class(tfieldvarsym)
  114. end;
  115. tcpufieldvarsymclass = class of tcpufieldvarsym;
  116. tcpulocalvarsym = class(tlocalvarsym)
  117. end;
  118. tcpulocalvarsymclass = class of tcpulocalvarsym;
  119. tcpuparavarsym = class(tparavarsym)
  120. end;
  121. tcpuparavarsymclass = class of tcpuparavarsym;
  122. tcpustaticvarsym = class(tstaticvarsym)
  123. end;
  124. tcpustaticvarsymclass = class of tcpustaticvarsym;
  125. tcpuabsolutevarsym = class(tabsolutevarsym)
  126. end;
  127. tcpuabsolutevarsymclass = class of tcpuabsolutevarsym;
  128. tcpupropertysym = class(tpropertysym)
  129. end;
  130. tcpupropertysymclass = class of tcpupropertysym;
  131. tcpuconstsym = class(tconstsym)
  132. end;
  133. tcpuconstsymclass = class of tcpuconstsym;
  134. tcpuenumsym = class(tenumsym)
  135. end;
  136. tcpuenumsymclass = class of tcpuenumsym;
  137. tcpusyssym = class(tsyssym)
  138. end;
  139. tcpusyssymclass = class of tcpusyssym;
  140. const
  141. pbestrealtype : ^tdef = @s64floattype;
  142. implementation
  143. {****************************************************************************
  144. tcpuprocdef
  145. ****************************************************************************}
  146. procedure tcpuprocdef.ppuload_platform(ppufile: tcompilerppufile);
  147. begin
  148. inherited;
  149. if po_syscall_has_libsym in procoptions then
  150. ppufile.getderef(libsymderef);
  151. end;
  152. procedure tcpuprocdef.ppuwrite_platform(ppufile: tcompilerppufile);
  153. begin
  154. inherited;
  155. if po_syscall_has_libsym in procoptions then
  156. ppufile.putderef(libsymderef);
  157. end;
  158. function tcpuprocdef.getcopyas(newtyp: tdeftyp; copytyp: tproccopytyp; const paraprefix: string): tstoreddef;
  159. begin
  160. result:=inherited;
  161. if newtyp=procdef then
  162. tcpuprocdef(result).libsym:=libsym;
  163. end;
  164. procedure tcpuprocdef.buildderef;
  165. begin
  166. inherited;
  167. if po_syscall_has_libsym in procoptions then
  168. libsymderef.build(libsym);
  169. end;
  170. procedure tcpuprocdef.deref;
  171. begin
  172. inherited;
  173. if po_syscall_has_libsym in procoptions then
  174. libsym:=tsym(libsymderef.resolve)
  175. else
  176. libsym:=nil;
  177. end;
  178. begin
  179. { used tdef classes }
  180. cfiledef:=tcpufiledef;
  181. cvariantdef:=tcpuvariantdef;
  182. cformaldef:=tcpuformaldef;
  183. cforwarddef:=tcpuforwarddef;
  184. cundefineddef:=tcpuundefineddef;
  185. cerrordef:=tcpuerrordef;
  186. cpointerdef:=tcpupointerdef;
  187. crecorddef:=tcpurecorddef;
  188. cimplementedinterface:=tcpuimplementedinterface;
  189. cobjectdef:=tcpuobjectdef;
  190. cclassrefdef:=tcpuclassrefdef;
  191. carraydef:=tcpuarraydef;
  192. corddef:=tcpuorddef;
  193. cfloatdef:=tcpufloatdef;
  194. cprocvardef:=tcpuprocvardef;
  195. cprocdef:=tcpuprocdef;
  196. cstringdef:=tcpustringdef;
  197. cenumdef:=tcpuenumdef;
  198. csetdef:=tcpusetdef;
  199. { used tsym classes }
  200. clabelsym:=tcpulabelsym;
  201. cunitsym:=tcpuunitsym;
  202. cprogramparasym:=tcpuprogramparasym;
  203. cnamespacesym:=tcpunamespacesym;
  204. cprocsym:=tcpuprocsym;
  205. ctypesym:=tcputypesym;
  206. cfieldvarsym:=tcpufieldvarsym;
  207. clocalvarsym:=tcpulocalvarsym;
  208. cparavarsym:=tcpuparavarsym;
  209. cstaticvarsym:=tcpustaticvarsym;
  210. cabsolutevarsym:=tcpuabsolutevarsym;
  211. cpropertysym:=tcpupropertysym;
  212. cconstsym:=tcpuconstsym;
  213. cenumsym:=tcpuenumsym;
  214. csyssym:=tcpusyssym;
  215. end.