rgcpu.pas 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. This unit implements the powerpc 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. cpubase,
  25. rgobj;
  26. type
  27. trgcpu = class(trgobj)
  28. function getexplicitregisterint(list: taasmoutput; reg: Tnewregister): tregister; override;
  29. procedure ungetregisterint(list: taasmoutput; reg: tregister); override;
  30. end;
  31. implementation
  32. uses
  33. cgobj;
  34. function trgcpu.getexplicitregisterint(list: taasmoutput; reg: Tnewregister): tregister;
  35. var r:Tregister;
  36. begin
  37. if reg = NR_R0 then
  38. begin
  39. r.enum:=R_INTREGISTER;
  40. r.number:=NR_R0;
  41. cg.a_reg_alloc(list,r);
  42. result := r;
  43. end
  44. else result := inherited getexplicitregisterint(list,reg);
  45. end;
  46. procedure trgcpu.ungetregisterint(list: taasmoutput; reg: tregister);
  47. begin
  48. if reg.enum = R_0 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.5 2003-02-19 22:00:16 daniel
  59. * Code generator converted to new register notation
  60. - Horribily outdated todo.txt removed
  61. Revision 1.4 2003/01/08 18:43:58 daniel
  62. * Tregister changed into a record
  63. Revision 1.3 2002/07/07 09:44:32 florian
  64. * powerpc target fixed, very simple units can be compiled
  65. Revision 1.2 2002/05/16 19:46:53 carl
  66. + defines.inc -> fpcdefs.inc to avoid conflicts if compiling by hand
  67. + try to fix temp allocation (still in ifdef)
  68. + generic constructor calls
  69. + start of tassembler / tmodulebase class cleanup
  70. Revision 1.1 2002/04/06 18:13:02 jonas
  71. * several powerpc-related additions and fixes
  72. }