cpupi.pas 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. {
  2. $Id$
  3. Copyright (c) 2002 by Florian Klaempfl
  4. This unit contains the CPU specific part of tprocinfo
  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 cpupi;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. cutils,
  23. procinfo,cpuinfo,
  24. psub;
  25. type
  26. TSparcProcInfo=class(tcgprocinfo)
  27. private
  28. maxpushedparasize : longint;
  29. public
  30. constructor create(aparent:tprocinfo);override;
  31. procedure allocate_push_parasize(size:longint);override;
  32. function calc_stackframe_size:longint;override;
  33. end;
  34. implementation
  35. uses
  36. globtype,systems,
  37. tgobj,paramgr,symconst,symsym;
  38. constructor tsparcprocinfo.create(aparent:tprocinfo);
  39. begin
  40. inherited create(aparent);
  41. maxpushedparasize:=0;
  42. end;
  43. procedure tsparcprocinfo.allocate_push_parasize(size:longint);
  44. begin
  45. if size>maxpushedparasize then
  46. maxpushedparasize:=size;
  47. end;
  48. function TSparcProcInfo.calc_stackframe_size:longint;
  49. var
  50. savearea : longint;
  51. begin
  52. { ABI requires at least space to save 6 arguments }
  53. savearea:=max(maxpushedparasize,6*4);
  54. {
  55. Stackframe layout:
  56. %fp
  57. <locals>
  58. <temp>
  59. <arguments for calling>
  60. <return pointer for calling>
  61. <register window save area for calling>
  62. %sp
  63. }
  64. result:=Align(tg.direction*tg.lasttemp+savearea+target_info.first_parm_offset,4);
  65. end;
  66. begin
  67. cprocinfo:=TSparcProcInfo;
  68. end.
  69. {
  70. $Log$
  71. Revision 1.22 2003-10-01 20:34:50 peter
  72. * procinfo unit contains tprocinfo
  73. * cginfo renamed to cgbase
  74. * moved cgmessage to verbose
  75. * fixed ppc and sparc compiles
  76. Revision 1.21 2003/09/14 19:19:05 peter
  77. * updates for new ra
  78. Revision 1.20 2003/09/03 15:55:01 peter
  79. * NEWRA branch merged
  80. Revision 1.19.2.1 2003/09/01 21:02:55 peter
  81. * sparc updates for new tregister
  82. Revision 1.19 2003/08/20 17:48:49 peter
  83. * fixed stackalloc to not allocate localst.datasize twice
  84. * order of stackalloc code fixed for implicit init/final
  85. Revision 1.18 2003/07/06 17:58:22 peter
  86. * framepointer fixes for sparc
  87. * parent framepointer code more generic
  88. Revision 1.17 2003/06/13 21:19:32 peter
  89. * current_procdef removed, use current_procinfo.procdef instead
  90. Revision 1.16 2003/05/30 23:57:08 peter
  91. * more sparc cleanup
  92. * accumulator removed, splitted in function_return_reg (called) and
  93. function_result_reg (caller)
  94. Revision 1.15 2003/05/23 22:33:48 florian
  95. * fix some small flaws which prevent sparc linux system unit from compiling
  96. * some reformatting done
  97. Revision 1.14 2003/04/27 11:21:36 peter
  98. * aktprocdef renamed to current_procinfo.procdef
  99. * procinfo renamed to current_procinfo
  100. * procinfo will now be stored in current_module so it can be
  101. cleaned up properly
  102. * gen_main_procsym changed to create_main_proc and release_main_proc
  103. to also generate a tprocinfo structure
  104. * fixed unit implicit initfinal
  105. Revision 1.13 2003/04/27 07:48:05 peter
  106. * updated for removed lexlevel
  107. Revision 1.12 2003/02/06 22:36:55 mazen
  108. * fixing bug related to errornous program main entry stack frame
  109. Revision 1.11 2003/01/05 21:32:35 mazen
  110. * fixing several bugs compiling the RTL
  111. Revision 1.10 2002/12/24 21:30:20 mazen
  112. - some writeln(s) removed in compiler
  113. + many files added to RTL
  114. * some errors fixed in RTL
  115. Revision 1.9 2002/12/21 23:21:47 mazen
  116. + added support for the shift nodes
  117. + added debug output on screen with -an command line option
  118. Revision 1.8 2002/11/17 17:49:09 mazen
  119. + return_result_reg and FUNCTION_RESULT_REG are now used, in all plateforms, to pass functions result between called function and its caller. See the explanation of each one
  120. Revision 1.7 2002/11/14 21:42:08 mazen
  121. * fixing return value variable address
  122. Revision 1.6 2002/11/10 19:07:46 mazen
  123. * SPARC calling mechanism almost OK (as in GCC./mppcsparc )
  124. Revision 1.5 2002/11/03 20:22:40 mazen
  125. * parameter handling updated
  126. Revision 1.4 2002/10/20 19:01:38 mazen
  127. + op_raddr_reg and op_caddr_reg added to fix functions prologue
  128. Revision 1.3 2002/10/10 15:10:39 mazen
  129. * Internal error fixed, but usually i386 parameter model used
  130. Revision 1.2 2002/08/29 11:02:36 mazen
  131. added support for SPARC processors
  132. Revision 1.1 2002/08/23 10:08:28 mazen
  133. *** empty log message ***
  134. Revision 1.2 2002/08/18 20:06:30 peter
  135. * inlining is now also allowed in interface
  136. * renamed write/load to ppuwrite/ppuload
  137. * tnode storing in ppu
  138. * nld,ncon,nbas are already updated for storing in ppu
  139. Revision 1.1 2002/08/17 09:23:49 florian
  140. * first part of procinfo rewrite
  141. }