cpupi.pas 5.9 KB

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