rgcpu.pas 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. {
  2. $Id$
  3. Copyright (c) 1998-2003 by Florian Klaempfl
  4. This unit implements the arm specific class for the register
  5. allocator
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17. ****************************************************************************
  18. }
  19. unit rgcpu;
  20. {$i fpcdefs.inc}
  21. interface
  22. uses
  23. aasmbase,aasmtai,
  24. cgbase,
  25. cpubase,
  26. rgobj;
  27. type
  28. trgcpu = class(trgobj)
  29. {
  30. function getexplicitregisterfpu(list : taasmoutput; r : Toldregister) : tregister;override;
  31. procedure ungetregisterfpu(list: taasmoutput; r : tregister; size:TCGsize);override;
  32. procedure cleartempgen; override;
  33. private
  34. usedpararegs: Tsupregset;
  35. usedparafpuregs: tregisterset;
  36. }
  37. end;
  38. implementation
  39. uses
  40. cgobj, verbose, cutils;
  41. {
  42. function trgcpu.getexplicitregisterfpu(list : taasmoutput; r : Toldregister) : tregister;
  43. begin
  44. if (r in [R_F0..R_F3]) and
  45. not is_reg_var_other[r] then
  46. begin
  47. if r in usedparafpuregs then
  48. internalerror(2003060902);
  49. include(usedparafpuregs,r);
  50. result.enum := r;
  51. cg.a_reg_alloc(list,result);
  52. end
  53. else
  54. result:=inherited getexplicitregisterfpu(list,r);
  55. end;
  56. procedure trgcpu.ungetregisterfpu(list: taasmoutput; r : tregister; size:TCGsize);
  57. begin
  58. if (r.enum in [R_F0..R_F3]) and
  59. not is_reg_var_other[r.enum] then
  60. begin
  61. if not(r.enum in usedparafpuregs) then
  62. internalerror(2003060903);
  63. exclude(usedparafpuregs,r.enum);
  64. cg.a_reg_dealloc(list,r);
  65. end
  66. else
  67. inherited ungetregisterfpu(list,r,size);
  68. end;
  69. procedure trgcpu.cleartempgen;
  70. begin
  71. inherited cleartempgen;
  72. usedpararegs := [];
  73. usedparafpuregs := [];
  74. end;
  75. }
  76. end.
  77. {
  78. $Log$
  79. Revision 1.5 2003-11-02 14:30:03 florian
  80. * fixed ARM for new reg. allocation scheme
  81. Revision 1.4 2003/09/11 11:55:00 florian
  82. * improved arm code generation
  83. * move some protected and private field around
  84. * the temp. register for register parameters/arguments are now released
  85. before the move to the parameter register is done. This improves
  86. the code in a lot of cases.
  87. Revision 1.3 2003/09/04 00:15:29 florian
  88. * first bunch of adaptions of arm compiler for new register type
  89. Revision 1.2 2003/08/25 23:20:38 florian
  90. + started to implement FPU support for the ARM
  91. * fixed a lot of other things
  92. Revision 1.1 2003/08/16 13:23:01 florian
  93. * several arm related stuff fixed
  94. }