cpupi.pas 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. { This unit contains the CPU specific part of tprocinfo. }
  19. unit cpupi;
  20. {$i fpcdefs.inc}
  21. interface
  22. uses
  23. cutils,
  24. procinfo,cpuinfo,psub;
  25. type
  26. tarmprocinfo = class(tcgprocinfo)
  27. { max. of space need for parameters, currently used by the PowerPC port only }
  28. maxpushedparasize : aword;
  29. constructor create(aparent:tprocinfo);override;
  30. // procedure handle_body_start;override;
  31. // procedure after_pass1;override;
  32. procedure allocate_push_parasize(size: longint);override;
  33. function calc_stackframe_size:longint;override;
  34. end;
  35. implementation
  36. uses
  37. globtype,globals,systems,
  38. cpubase,
  39. aasmtai,
  40. tgobj,
  41. symconst,symsym,paramgr;
  42. constructor tarmprocinfo.create(aparent:tprocinfo);
  43. begin
  44. inherited create(aparent);
  45. maxpushedparasize:=0;
  46. end;
  47. (*
  48. procedure tarmprocinfo.handle_body_start;
  49. var
  50. ofs : aword;
  51. begin
  52. if not(po_assembler in procdef.procoptions) then
  53. begin
  54. {!!!!!!!!
  55. case target_info.abi of
  56. abi_powerpc_aix:
  57. ofs:=align(maxpushedparasize+LinkageAreaSizeAIX,16);
  58. abi_powerpc_sysv:
  59. ofs:=align(maxpushedparasize+LinkageAreaSizeSYSV,16);
  60. end;
  61. }
  62. inc(procdef.parast.address_fixup,ofs);
  63. procdef.localst.address_fixup:=procdef.parast.address_fixup+procdef.parast.datasize;
  64. end;
  65. inherited handle_body_start;
  66. end;
  67. procedure tarmprocinfo.after_pass1;
  68. begin
  69. if not(po_assembler in procdef.procoptions) then
  70. begin
  71. if cs_asm_source in aktglobalswitches then
  72. aktproccode.insert(Tai_comment.Create(strpnew('Parameter copies start at: r1+'+tostr(procdef.parast.address_fixup))));
  73. if cs_asm_source in aktglobalswitches then
  74. aktproccode.insert(Tai_comment.Create(strpnew('Locals start at: r1+'+tostr(procdef.localst.address_fixup))));
  75. firsttemp_offset:=align(procdef.localst.address_fixup+procdef.localst.datasize,16);
  76. if cs_asm_source in aktglobalswitches then
  77. aktproccode.insert(Tai_comment.Create(strpnew('Temp. space start: r1+'+tostr(firsttemp_offset))));
  78. //!!!! tg.setfirsttemp(firsttemp_offset);
  79. tg.firsttemp:=firsttemp_offset;
  80. tg.lasttemp:=firsttemp_offset;
  81. inherited after_pass1;
  82. end;
  83. end;
  84. *)
  85. procedure tarmprocinfo.allocate_push_parasize(size:longint);
  86. begin
  87. if size>maxpushedparasize then
  88. maxpushedparasize:=size;
  89. end;
  90. function tarmprocinfo.calc_stackframe_size:longint;
  91. begin
  92. { more or less copied from cgcpu.pas/g_stackframe_entry }
  93. if not (po_assembler in procdef.procoptions) then
  94. result := align(align((31-13+1)*4+(31-14+1)*8,16)+tg.lasttemp,16)
  95. else
  96. result := align(tg.lasttemp,16);
  97. end;
  98. begin
  99. cprocinfo:=tarmprocinfo;
  100. end.
  101. {
  102. $Log$
  103. Revision 1.2 2003-11-02 14:30:03 florian
  104. * fixed ARM for new reg. allocation scheme
  105. Revision 1.1 2003/08/20 15:50:13 florian
  106. * more arm stuff
  107. }