2
0

rgcpu.pas 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. {
  2. Copyright (c) 1998-2008 by Florian Klaempfl
  3. This unit implements the avr specific class for the register
  4. allocator
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program; if not, write to the Free Software
  15. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. ****************************************************************************
  17. }
  18. unit rgcpu;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. aasmbase,aasmtai,aasmdata,aasmcpu,
  23. cgbase,cgutils,
  24. cpubase,
  25. rgobj;
  26. type
  27. trgcpu = class(trgobj)
  28. procedure add_constraints(reg:tregister);override;
  29. procedure do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);override;
  30. procedure do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);override;
  31. end;
  32. trgintcpu = class(trgcpu)
  33. procedure add_cpu_interferences(p : tai);override;
  34. end;
  35. implementation
  36. uses
  37. verbose, cutils,
  38. cgobj,
  39. procinfo;
  40. procedure trgcpu.add_constraints(reg:tregister);
  41. var
  42. supreg,i : Tsuperregister;
  43. begin
  44. case getsubreg(reg) of
  45. { Let 64bit floats conflict with all odd float regs }
  46. R_SUBFD:
  47. begin
  48. {
  49. supreg:=getsupreg(reg);
  50. i:=RS_F1;
  51. while (i<=RS_F31) do
  52. begin
  53. add_edge(supreg,i);
  54. inc(i,2);
  55. end;
  56. }
  57. end;
  58. { Let 64bit ints conflict with all odd int regs }
  59. R_SUBQ:
  60. begin
  61. supreg:=getsupreg(reg);
  62. {
  63. i:=RS_G1;
  64. while (i<=RS_I7) do
  65. begin
  66. add_edge(supreg,i);
  67. inc(i,2);
  68. end;
  69. }
  70. end;
  71. end;
  72. end;
  73. procedure trgcpu.do_spill_read(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);
  74. begin
  75. inherited do_spill_read(list,pos,spilltemp,tempreg);
  76. end;
  77. procedure trgcpu.do_spill_written(list:TAsmList;pos:tai;const spilltemp:treference;tempreg:tregister);
  78. begin
  79. inherited do_spill_written(list,pos,spilltemp,tempreg);
  80. end;
  81. procedure trgintcpu.add_cpu_interferences(p : tai);
  82. var
  83. r : tregister;
  84. begin
  85. if p.typ=ait_instruction then
  86. begin
  87. case taicpu(p).opcode of
  88. A_LD:
  89. ;
  90. end;
  91. end;
  92. end;
  93. end.