rgcpu.pas 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. {
  2. Copyright (c) 1998-2002 by Florian Klaempfl
  3. This unit implements the Xtensa 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. unit rgcpu;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. aasmbase,aasmcpu,aasmtai,aasmdata,
  22. cgbase,cgutils,
  23. cpubase,
  24. globtype,
  25. rgobj;
  26. type
  27. trgcpu=class(trgobj)
  28. procedure do_spill_read(list: TAsmList; pos: tai; const spilltemp: treference; tempreg: tregister; orgsupreg: tsuperregister); override;
  29. procedure do_spill_written(list: TAsmList; pos: tai; const spilltemp: treference; tempreg: tregister; orgsupreg: tsuperregister); override;
  30. protected
  31. procedure do_spill_op(list: tasmlist; op: tasmop; pos: tai; const spilltemp: treference; tempreg: tregister; orgsupreg: tsuperregister);
  32. end;
  33. trgintcpu=class(trgcpu)
  34. procedure add_cpu_interferences(p: tai); override;
  35. end;
  36. implementation
  37. uses
  38. verbose,cutils,
  39. cgobj;
  40. procedure trgcpu.do_spill_read(list: TAsmList; pos: tai; const spilltemp: treference; tempreg: tregister; orgsupreg: tsuperregister);
  41. begin
  42. do_spill_op(list,A_L32I,pos,spilltemp,tempreg,orgsupreg);
  43. end;
  44. procedure trgcpu.do_spill_written(list: TAsmList; pos: tai; const spilltemp: treference; tempreg: tregister; orgsupreg: tsuperregister);
  45. begin
  46. do_spill_op(list,A_S32I,pos,spilltemp,tempreg,orgsupreg);
  47. end;
  48. procedure trgcpu.do_spill_op(list: tasmlist; op: tasmop; pos: tai; const spilltemp: treference; tempreg: tregister; orgsupreg: tsuperregister);
  49. var
  50. helpins : tai;
  51. tmpref : treference;
  52. helplist : TAsmList;
  53. hreg : tregister;
  54. isload : boolean;
  55. begin
  56. isload:=op in [A_L32I,A_LSI];
  57. //{ offset out of range for regular load/store? }
  58. //if simple_ref_type(op,reg_cgsize(tempreg),PF_None,spilltemp)<>sr_simple then
  59. // begin
  60. // helplist:=TAsmList.create;
  61. //
  62. // if getregtype(tempreg)=R_INTREGISTER then
  63. // hreg:=tempreg
  64. // else
  65. // hreg:=cg.getaddressregister(helplist);
  66. //
  67. // cg.a_load_const_reg(helplist,OS_ADDR,spilltemp.offset,hreg);
  68. // reference_reset_base(tmpref,spilltemp.base,0,spilltemp.temppos,sizeof(pint),[]);
  69. // tmpref.index:=hreg;
  70. // if isload then
  71. // helpins:=spilling_create_load(tmpref,tempreg)
  72. // else
  73. // helpins:=spilling_create_store(tempreg,tmpref);
  74. // helplist.concat(helpins);
  75. // add_cpu_interferences(helpins);
  76. // list.insertlistafter(pos,helplist);
  77. // helplist.free;
  78. // end
  79. //else
  80. if isload then
  81. inherited do_spill_read(list,pos,spilltemp,tempreg,orgsupreg)
  82. else
  83. inherited do_spill_written(list,pos,spilltemp,tempreg,orgsupreg)
  84. end;
  85. procedure trgintcpu.add_cpu_interferences(p: tai);
  86. var
  87. i, j: longint;
  88. begin
  89. if p.typ=ait_instruction then
  90. begin
  91. end;
  92. end;
  93. end.