cpupi.pas 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. {
  2. Copyright (c) 2002-2009 by Florian Klaempfl and David Zhang
  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. globtype,
  23. procinfo,cpuinfo,cpupara,
  24. psub;
  25. type
  26. { TMIPSProcInfo }
  27. TMIPSProcInfo=class(tcgprocinfo)
  28. intregstart,
  29. floatregstart : aint;
  30. intregssave,
  31. floatregssave : byte;
  32. register_used : tparasupregsused;
  33. register_offset : tparasupregsoffset;
  34. constructor create(aparent:tprocinfo);override;
  35. function calc_stackframe_size:longint;override;
  36. procedure set_first_temp_offset;override;
  37. end;
  38. implementation
  39. uses
  40. systems,globals,
  41. cpubase,cgbase,cgobj,
  42. tgobj,paramgr,symconst;
  43. constructor TMIPSProcInfo.create(aparent: tprocinfo);
  44. var
  45. i : longint;
  46. begin
  47. inherited create(aparent);
  48. for i:=low(tparasupregs) to high(tparasupregs) do
  49. begin
  50. register_used[i]:=false;
  51. register_offset[i]:=-1;
  52. end;
  53. floatregssave:=11;
  54. intregssave:=10;
  55. end;
  56. procedure TMIPSProcInfo.set_first_temp_offset;
  57. begin
  58. { We allocate enough space to save all registers because we can't determine
  59. the necessary space because the used registers aren't known before
  60. secondpass is run. }
  61. if tg.direction = -1 then
  62. tg.setfirsttemp(0)
  63. else
  64. tg.setfirsttemp(maxpushedparasize+floatregssave*sizeof(aint)+intregssave*sizeof(aint));
  65. end;
  66. function TMIPSProcInfo.calc_stackframe_size:longint;
  67. var
  68. r : byte;
  69. regs: tcpuregisterset;
  70. begin
  71. result:=maxpushedparasize;
  72. floatregstart:=result;
  73. inc(result,floatregssave*4);
  74. intregstart:=result;
  75. inc(result,intregssave*4);
  76. result:=Align(tg.lasttemp,max(current_settings.alignment.localalignmin,8));
  77. end;
  78. begin
  79. cprocinfo:=TMIPSProcInfo;
  80. end.