nrv64add.pas 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. {
  2. Copyright (c) 2000-2002 by Florian Klaempfl and Jonas Maebe
  3. Code generation for add nodes on the Risc-V64
  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 nrv64add;
  18. {$I fpcdefs.inc}
  19. interface
  20. uses
  21. node, ncgadd, aasmbase, nrvadd, cpubase;
  22. type
  23. trv64addnode = class(trvaddnode)
  24. protected
  25. function pass_1: tnode; override;
  26. procedure second_add64bit; override;
  27. function use_generic_mul32to64: boolean; override;
  28. end;
  29. implementation
  30. uses
  31. systems,
  32. cutils,verbose,
  33. paramgr,procinfo,
  34. aasmtai,aasmdata,aasmcpu,defutil,
  35. cgbase,cgcpu,cgutils,
  36. globals,
  37. pass_1,
  38. CPUInfo,cpupara,
  39. ncon,nset,nadd,
  40. symconst,
  41. hlcgobj, ncgutil,cgobj;
  42. function trv64addnode.pass_1: tnode;
  43. begin
  44. if (nodetype=muln) and
  45. (left.resultdef.typ=orddef) and (left.resultdef.typ=orddef) and
  46. (CPURV_HAS_MUL in cpu_capabilities[current_settings.cputype]) then
  47. begin
  48. result:=nil;
  49. firstpass(left);
  50. firstpass(right);
  51. expectloc:=LOC_REGISTER;
  52. end
  53. else if (nodetype=muln) and
  54. (not (CPURV_HAS_MUL in cpu_capabilities[current_settings.cputype])) and
  55. (is_64bit(left.resultdef) or
  56. is_64bit(right.resultdef)) then
  57. begin
  58. result:=first_add64bitint;
  59. end
  60. else
  61. Result:=inherited pass_1;
  62. if expectloc=LOC_FLAGS then
  63. expectloc:=LOC_REGISTER;
  64. end;
  65. procedure trv64addnode.second_add64bit;
  66. begin
  67. second_addordinal;
  68. end;
  69. function trv64addnode.use_generic_mul32to64: boolean;
  70. begin
  71. result:=false;
  72. end;
  73. begin
  74. caddnode := trv64addnode;
  75. end.