ncpuinln.pas 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Generate SPARC inline nodes
  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 ncpuinln;
  19. {$i fpcdefs.inc}
  20. interface
  21. uses
  22. node,ninl,ncginl;
  23. type
  24. tSparcInlineNode = class(tcgInlineNode)
  25. function first_abs_real: tnode; override;
  26. function first_sqr_real: tnode; override;
  27. function first_sqrt_real: tnode; override;
  28. procedure second_abs_real; override;
  29. procedure second_sqr_real; override;
  30. procedure second_sqrt_real; override;
  31. private
  32. procedure load_fpu_location;
  33. end;
  34. implementation
  35. uses
  36. globtype,systems,
  37. cutils,verbose,globals,fmodule,
  38. symconst,symdef,
  39. aasmbase,aasmtai,aasmcpu,
  40. cginfo,cgbase,pass_1,pass_2,
  41. cpubase,paramgr,
  42. nbas,ncon,ncal,ncnv,nld,
  43. tgobj,ncgutil,cgobj,cg64f32,rgobj,rgcpu;
  44. {*****************************************************************************
  45. TSparcInlineNode
  46. *****************************************************************************}
  47. procedure tSparcInlineNode.load_fpu_location;
  48. begin
  49. secondpass(left);
  50. location_force_fpureg(exprasmlist,left.location,true);
  51. location_copy(location,left.location);
  52. if left.location.loc=LOC_CFPUREGISTER then
  53. location.register:=rg.getregisterfpu(exprasmlist,location.size);
  54. end;
  55. function tSparcInlineNode.first_abs_real : tnode;
  56. begin
  57. expectloc:=LOC_FPUREGISTER;
  58. registers32:=left.registers32;
  59. registersfpu:=max(left.registersfpu,1);
  60. first_abs_real := nil;
  61. end;
  62. function tSparcInlineNode.first_sqr_real : tnode;
  63. begin
  64. expectloc:=LOC_FPUREGISTER;
  65. registers32:=left.registers32;
  66. registersfpu:=max(left.registersfpu,1);
  67. first_sqr_real:=nil;
  68. end;
  69. function tSparcInlineNode.first_sqrt_real : tnode;
  70. begin
  71. expectloc:=LOC_FPUREGISTER;
  72. registers32:=left.registers32;
  73. registersfpu:=max(left.registersfpu,1);
  74. first_sqrt_real := nil;
  75. end;
  76. procedure tSparcInlineNode.second_abs_real;
  77. begin
  78. load_fpu_location;
  79. exprasmlist.concat(taicpu.op_reg_reg(A_FABSs,left.location.register,location.register));
  80. end;
  81. procedure tSparcInlineNode.second_sqr_real;
  82. begin
  83. load_fpu_location;
  84. exprasmlist.concat(taicpu.op_reg_reg_reg(A_FMULs,left.location.register,left.location.register,location.register));
  85. end;
  86. procedure tSparcInlineNode.second_sqrt_real;
  87. begin
  88. load_fpu_location;
  89. exprasmlist.concat(taicpu.op_reg_reg(A_FSQRTs,left.location.register,location.register));
  90. end;
  91. begin
  92. cInlineNode:=tSparcInlineNode;
  93. end.
  94. {
  95. $Log$
  96. Revision 1.4 2003-06-01 21:38:07 peter
  97. * getregisterfpu size parameter added
  98. * op_const_reg size parameter added
  99. * sparc updates
  100. Revision 1.3 2003/01/05 21:32:35 mazen
  101. * fixing several bugs compiling the RTL
  102. Revision 1.2 2002/12/30 21:17:22 mazen
  103. - unit cga no more used in sparc compiler.
  104. Revision 1.1 2002/11/30 20:03:49 mazen
  105. + ncpuinln node
  106. Revision 1.3 2002/09/18 09:19:37 jonas
  107. * fixed LOC_REFERENCE/LOC_CREFERENCE problems
  108. Revision 1.2 2002/08/19 17:35:42 jonas
  109. * fixes
  110. Revision 1.1 2002/08/10 17:15:00 jonas
  111. + abs, sqr, sqrt implementations
  112. }