rgcpu.pas 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. cginfo,
  25. cpubase,
  26. rgobj;
  27. type
  28. trgcpu = class(trgobj)
  29. function getexplicitregisterfpu(list : taasmoutput; r : Toldregister) : tregister;override;
  30. procedure ungetregisterfpu(list: taasmoutput; r : tregister; size:TCGsize);override;
  31. procedure cleartempgen; override;
  32. private
  33. usedpararegs: Tsupregset;
  34. usedparafpuregs: tregisterset;
  35. end;
  36. implementation
  37. uses
  38. cgobj, verbose, cutils;
  39. function trgcpu.getexplicitregisterfpu(list : taasmoutput; r : Toldregister) : tregister;
  40. begin
  41. if (r in [R_F0..R_F3]) and
  42. not is_reg_var_other[r] then
  43. begin
  44. if r in usedparafpuregs then
  45. internalerror(2003060902);
  46. include(usedparafpuregs,r);
  47. result.enum := r;
  48. cg.a_reg_alloc(list,result);
  49. end
  50. else
  51. result:=inherited getexplicitregisterfpu(list,r);
  52. end;
  53. procedure trgcpu.ungetregisterfpu(list: taasmoutput; r : tregister; size:TCGsize);
  54. begin
  55. if (r.enum in [R_F0..R_F3]) and
  56. not is_reg_var_other[r.enum] then
  57. begin
  58. if not(r.enum in usedparafpuregs) then
  59. internalerror(2003060903);
  60. exclude(usedparafpuregs,r.enum);
  61. cg.a_reg_dealloc(list,r);
  62. end
  63. else
  64. inherited ungetregisterfpu(list,r,size);
  65. end;
  66. procedure trgcpu.cleartempgen;
  67. begin
  68. inherited cleartempgen;
  69. usedpararegs := [];
  70. usedparafpuregs := [];
  71. end;
  72. initialization
  73. rg := trgcpu.create(last_supreg-first_supreg+1);
  74. end.
  75. {
  76. $Log$
  77. Revision 1.2 2003-08-25 23:20:38 florian
  78. + started to implement FPU support for the ARM
  79. * fixed a lot of other things
  80. Revision 1.1 2003/08/16 13:23:01 florian
  81. * several arm related stuff fixed
  82. }