cpupi.pas 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. tcpuprocinfo=class(tcgprocinfo)
  26. public
  27. constructor create(aparent:tprocinfo);override;
  28. function calc_stackframe_size:longint;override;
  29. end;
  30. implementation
  31. uses
  32. systems,globals,
  33. cpubase,cgbase,
  34. tgobj,paramgr,symconst;
  35. constructor tcpuprocinfo.create(aparent:tprocinfo);
  36. begin
  37. inherited create(aparent);
  38. maxpushedparasize:=0;
  39. got:=NR_L7;
  40. end;
  41. function tcpuprocinfo.calc_stackframe_size:longint;
  42. begin
  43. {
  44. Stackframe layout:
  45. %fp
  46. <locals>
  47. <temp>
  48. <arguments 6-n for calling>
  49. %sp+92
  50. <space for arguments 0-5> \
  51. <return pointer for calling> | included in first_parm_offset
  52. <register window save area for calling> /
  53. %sp
  54. Alignment must be the max available, as doubles require
  55. 8 byte alignment
  56. }
  57. if (po_nostackframe in procdef.procoptions) then
  58. result:=Align(tg.direction*tg.lasttemp+maxpushedparasize,current_settings.alignment.localalignmax)
  59. else
  60. result:=Align(tg.direction*tg.lasttemp+maxpushedparasize+target_info.first_parm_offset,current_settings.alignment.localalignmax);
  61. end;
  62. begin
  63. cprocinfo:=tcpuprocinfo;
  64. end.