rgcpu.pas 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. {******************************************************************************
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  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. unit rgcpu;
  17. { This unit implements the processor specific class for the register allocator}
  18. {$INCLUDE fpcdefs.inc}
  19. interface
  20. uses
  21. cpubase,
  22. cpuinfo,
  23. aasmcpu,
  24. aasmtai,
  25. cclasses,globtype,cgbase,aasmbase,rgobj;
  26. type
  27. trgcpu=class(trgobj)
  28. { to keep the same allocation order as with the old routines }
  29. procedure UngetregisterInt(list:taasmoutput;Reg:tregister);override;
  30. function GetExplicitRegisterInt(list:taasmoutput;Reg:tregister):tregister;override;
  31. end;
  32. implementation
  33. uses
  34. cgobj;
  35. function trgcpu.GetExplicitRegisterInt(list:taasmoutput;reg:tregister):tregister;
  36. begin
  37. if reg in [R_O7,R_I7]
  38. then
  39. begin
  40. cg.a_reg_alloc(list,Reg);
  41. result := Reg;
  42. end
  43. else result := inherited GetExplicitRegisterInt(list,reg);
  44. end;
  45. procedure trgcpu.UngetregisterInt(list: taasmoutput; reg: tregister);
  46. begin
  47. if reg in [R_O7,R_I7]
  48. then
  49. cg.a_reg_dealloc(list,reg)
  50. else
  51. inherited ungetregisterint(list,reg);
  52. end;
  53. initialization
  54. rg := trgcpu.create;
  55. end.
  56. {
  57. $Log$
  58. Revision 1.3 2002-10-12 19:03:23 mazen
  59. * Get/Unget expilit registers to be re-examined
  60. }