cpupi.pas 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. {
  2. Copyright (c) 2002 by Florian Klaempfl
  3. This unit contains the CPU specific part of tprocinfo
  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 cpupi;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. cutils,
  22. procinfo,cpuinfo,
  23. psub;
  24. type
  25. TSparcProcInfo=class(tcgprocinfo)
  26. public
  27. constructor create(aparent:tprocinfo);override;
  28. procedure allocate_push_parasize(size:longint);override;
  29. function calc_stackframe_size:longint;override;
  30. end;
  31. implementation
  32. uses
  33. systems,globals,
  34. tgobj,paramgr,symconst;
  35. constructor tsparcprocinfo.create(aparent:tprocinfo);
  36. begin
  37. inherited create(aparent);
  38. maxpushedparasize:=0;
  39. end;
  40. procedure tsparcprocinfo.allocate_push_parasize(size:longint);
  41. begin
  42. if size>maxpushedparasize then
  43. maxpushedparasize:=size;
  44. end;
  45. function TSparcProcInfo.calc_stackframe_size:longint;
  46. begin
  47. {
  48. Stackframe layout:
  49. %fp
  50. <locals>
  51. <temp>
  52. <arguments 6-n for calling>
  53. %sp+92
  54. <space for arguments 0-5> \
  55. <return pointer for calling> | included in first_parm_offset
  56. <register window save area for calling> /
  57. %sp
  58. Alignment must be the max available, as doubles require
  59. 8 byte alignment
  60. }
  61. result:=Align(tg.direction*tg.lasttemp+maxpushedparasize+target_info.first_parm_offset,aktalignment.localalignmax);
  62. end;
  63. begin
  64. cprocinfo:=TSparcProcInfo;
  65. end.