ncpumem.pas 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. {
  2. Copyright (c) 1998-2020 by Florian Klaempfl
  3. Generate xtensa assembler for in memory related nodes
  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. }
  17. unit ncpumem;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. globtype,
  22. cgbase,cpubase,
  23. symtype,
  24. nmem,ncgmem;
  25. type
  26. tcpuvecnode = class(tcgvecnode)
  27. procedure update_reference_reg_mul(maybe_const_reg: tregister; regsize: tdef; l: aint);override;
  28. end;
  29. implementation
  30. uses
  31. cutils,verbose,
  32. aasmdata,aasmcpu,
  33. cgutils,cgobj,
  34. symconst,symcpu;
  35. {*****************************************************************************
  36. TCPUVECNODE
  37. *****************************************************************************}
  38. procedure tcpuvecnode.update_reference_reg_mul(maybe_const_reg: tregister; regsize: tdef; l: aint);
  39. var
  40. hreg: tregister;
  41. op: TAsmOp;
  42. begin
  43. if (l in [2,4,8]) and ((location.reference.base<>NR_NO) or (location.reference.index<>NR_NO)) then
  44. begin
  45. case l of
  46. 2 : op:=A_ADDX2;
  47. 4 : op:=A_ADDX4;
  48. 8 : op:=A_ADDX8;
  49. else
  50. Internalerror(2020042201);
  51. end;
  52. hreg:=cg.getaddressregister(current_asmdata.CurrAsmList);
  53. if location.reference.base<>NR_NO then
  54. begin
  55. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op,hreg,maybe_const_reg,location.reference.base));
  56. location.reference.base:=hreg;
  57. end
  58. else if location.reference.index<>NR_NO then
  59. begin
  60. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg_reg(op,hreg,maybe_const_reg,location.reference.index));
  61. location.reference.index:=hreg;
  62. end
  63. else
  64. Internalerror(2020042214);
  65. { update alignment }
  66. if (location.reference.alignment=0) then
  67. internalerror(2020042217);
  68. location.reference.alignment:=newalignment(location.reference.alignment,l);
  69. end
  70. else
  71. inherited update_reference_reg_mul(maybe_const_reg,regsize,l);
  72. end;
  73. begin
  74. cvecnode:=tcpuvecnode;
  75. end.