cpupi.pas 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. { This unit contains the CPU specific part of tprocinfo. }
  18. unit cpupi;
  19. {$INCLUDE fpcdefs.inc}
  20. interface
  21. uses
  22. cutils,
  23. cgbase,cpuinfo;
  24. type
  25. TSparcprocinfo=class(TProcInfo)
  26. {overall size of allocated stack space, currently this is used for the
  27. PowerPC only}
  28. localsize:aword;
  29. {max of space need for parameters, currently used by the PowerPC port only}
  30. maxpushedparasize:aword;
  31. constructor create;override;
  32. {According the the SPARC ABI the standard stack frame must include :
  33. * 16 word save for the in and local registers in case of overflow/underflow.
  34. this save area always must exist at the %o6+0,
  35. * software conventions requires space for the aggregate return value pointer, even if the word is not used,
  36. * althogh the first six words of arguments reside in registers, the standard
  37. stack frame reserves space for them. Arguments beond the sixth reside on the
  38. stack as in the Intel architecture,
  39. * other areas depend on the compiler and the code being compiled. The
  40. standard calling sequence does not define a maximum stack frame size, nor does
  41. it restrict how a language system uses the "unspecified" areas of the standard
  42. stack frame.}
  43. procedure after_header;override;
  44. procedure after_pass1;override;
  45. end;
  46. implementation
  47. uses
  48. globtype,globals,
  49. aasmtai,
  50. tgobj;
  51. constructor TSparcprocinfo.create;
  52. begin
  53. inherited create;
  54. maxpushedparasize:=0;
  55. localsize:=0;
  56. end;
  57. procedure TSparcprocinfo.after_header;
  58. begin
  59. {Reserve the stack for copying parameters passeѕ into registers}
  60. procdef.parast.address_fixup:=(16+1)*4;
  61. end;
  62. procedure TSparcProcInfo.after_pass1;
  63. begin
  64. if(procdef.parast.datasize>6*4)
  65. then
  66. procdef.localst.address_fixup:=procdef.parast.datasize+(16+1)*4
  67. else
  68. procdef.localst.address_fixup:=6*4+(16+1)*4;
  69. procinfo.firsttemp_offset:=procdef.localst.address_fixup+procdef.localst.datasize;
  70. WriteLn('Parameter copies start at: %i6-'+tostr(procdef.parast.address_fixup));
  71. WriteLn('Locals start at: %o6-'+tostr(procdef.localst.address_fixup));
  72. WriteLn('Temp. space start: %o6-'+tostr(procinfo.firsttemp_offset));
  73. tg.firsttemp:=procinfo.firsttemp_offset;
  74. tg.lasttemp:=procinfo.firsttemp_offset;
  75. end;
  76. begin
  77. cprocinfo:=TSparcProcInfo;
  78. end.
  79. {
  80. $Log$
  81. Revision 1.5 2002-11-03 20:22:40 mazen
  82. * parameter handling updated
  83. Revision 1.4 2002/10/20 19:01:38 mazen
  84. + op_raddr_reg and op_caddr_reg added to fix functions prologue
  85. Revision 1.3 2002/10/10 15:10:39 mazen
  86. * Internal error fixed, but usually i386 parameter model used
  87. Revision 1.2 2002/08/29 11:02:36 mazen
  88. added support for SPARC processors
  89. Revision 1.1 2002/08/23 10:08:28 mazen
  90. *** empty log message ***
  91. Revision 1.2 2002/08/18 20:06:30 peter
  92. * inlining is now also allowed in interface
  93. * renamed write/load to ppuwrite/ppuload
  94. * tnode storing in ppu
  95. * nld,ncon,nbas are already updated for storing in ppu
  96. Revision 1.1 2002/08/17 09:23:49 florian
  97. * first part of procinfo rewrite
  98. }