cpupi.pas 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 set_first_temp_offset;override;
  33. procedure allocate_push_parasize(size: longint);override;
  34. function calc_stackframe_size:longint;override;
  35. end;
  36. implementation
  37. uses
  38. globtype,globals,systems,
  39. cpubase,
  40. aasmtai,
  41. tgobj,
  42. symconst,symsym,paramgr;
  43. constructor tarmprocinfo.create(aparent:tprocinfo);
  44. begin
  45. inherited create(aparent);
  46. maxpushedparasize:=0;
  47. end;
  48. (*
  49. procedure tarmprocinfo.handle_body_start;
  50. var
  51. ofs : aword;
  52. begin
  53. if not(po_assembler in procdef.procoptions) then
  54. begin
  55. {!!!!!!!!
  56. case target_info.abi of
  57. abi_powerpc_aix:
  58. ofs:=align(maxpushedparasize+LinkageAreaSizeAIX,16);
  59. abi_powerpc_sysv:
  60. ofs:=align(maxpushedparasize+LinkageAreaSizeSYSV,16);
  61. end;
  62. }
  63. inc(procdef.parast.address_fixup,ofs);
  64. procdef.localst.address_fixup:=procdef.parast.address_fixup+procdef.parast.datasize;
  65. end;
  66. inherited handle_body_start;
  67. end;
  68. procedure tarmprocinfo.after_pass1;
  69. begin
  70. if not(po_assembler in procdef.procoptions) then
  71. begin
  72. if cs_asm_source in aktglobalswitches then
  73. aktproccode.insert(Tai_comment.Create(strpnew('Parameter copies start at: r1+'+tostr(procdef.parast.address_fixup))));
  74. if cs_asm_source in aktglobalswitches then
  75. aktproccode.insert(Tai_comment.Create(strpnew('Locals start at: r1+'+tostr(procdef.localst.address_fixup))));
  76. firsttemp_offset:=align(procdef.localst.address_fixup+procdef.localst.datasize,16);
  77. if cs_asm_source in aktglobalswitches then
  78. aktproccode.insert(Tai_comment.Create(strpnew('Temp. space start: r1+'+tostr(firsttemp_offset))));
  79. //!!!! tg.setfirsttemp(firsttemp_offset);
  80. tg.firsttemp:=firsttemp_offset;
  81. tg.lasttemp:=firsttemp_offset;
  82. inherited after_pass1;
  83. end;
  84. end;
  85. *)
  86. procedure tarmprocinfo.set_first_temp_offset;
  87. begin
  88. tg.setfirsttemp(0);
  89. end;
  90. procedure tarmprocinfo.allocate_push_parasize(size:longint);
  91. begin
  92. if size>maxpushedparasize then
  93. maxpushedparasize:=size;
  94. end;
  95. function tarmprocinfo.calc_stackframe_size:longint;
  96. begin
  97. { align to 4 bytes at least }
  98. result:=Align(tg.direction*tg.lasttemp,max(aktalignment.localalignmin,4));
  99. end;
  100. begin
  101. cprocinfo:=tarmprocinfo;
  102. end.
  103. {
  104. $Log$
  105. Revision 1.4 2003-11-30 19:35:29 florian
  106. * fixed several arm related problems
  107. Revision 1.3 2003/11/24 15:17:37 florian
  108. * changed some types to prevend range check errors
  109. Revision 1.2 2003/11/02 14:30:03 florian
  110. * fixed ARM for new reg. allocation scheme
  111. Revision 1.1 2003/08/20 15:50:13 florian
  112. * more arm stuff
  113. }