n68kinl.pas 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. {
  2. Copyright (c) 2015 by the Free Pascal Development team
  3. Generates Motorola 68k inline 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 n68kinl;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. node,ninl,ncginl;
  22. type
  23. t68kinlinenode = class(tcgInlineNode)
  24. {function first_abs_real: tnode; override;}
  25. function first_sqr_real: tnode; override;
  26. {function first_sqrt_real: tnode; override;
  27. function first_arctan_real: tnode; override;
  28. function first_ln_real: tnode; override;
  29. function first_cos_real: tnode; override;
  30. function first_sin_real: tnode; override;}
  31. {procedure second_abs_real; override;}
  32. procedure second_sqr_real; override;
  33. {procedure second_sqrt_real; override;
  34. procedure second_arctan_real; override;
  35. procedure second_ln_real; override;
  36. procedure second_cos_real; override;
  37. procedure second_sin_real; override;
  38. procedure second_prefetch; override;
  39. procedure second_abs_long; override;}
  40. end;
  41. implementation
  42. uses
  43. globtype,verbose,globals,cutils,
  44. cpuinfo,defutil,symdef,aasmdata,aasmcpu,aasmtai,
  45. cgbase,cgutils,pass_1,pass_2,
  46. cpubase,ncgutil,cgobj,cgcpu, hlcgobj;
  47. {*****************************************************************************
  48. t68kinlinenode
  49. *****************************************************************************}
  50. function t68kinlinenode.first_sqr_real : tnode;
  51. begin
  52. if (cs_fp_emulation in current_settings.moduleswitches) then
  53. result:=inherited first_sqr_real
  54. else
  55. begin
  56. case current_settings.fputype of
  57. fpu_68881:
  58. expectloc:=LOC_FPUREGISTER;
  59. else
  60. internalerror(2015022201);
  61. end;
  62. first_sqr_real:=nil;
  63. end;
  64. end;
  65. procedure t68kinlinenode.second_sqr_real;
  66. begin
  67. secondpass(left);
  68. case current_settings.fputype of
  69. fpu_68881:
  70. begin
  71. //current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('second_sqr_real called!')));
  72. hlcg.location_force_fpureg(current_asmdata.CurrAsmList,left.location,left.resultdef,true);
  73. location_copy(location,left.location);
  74. if left.location.loc=LOC_CFPUREGISTER then
  75. begin
  76. //current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('second_sr_real called!: left was fpuregister!')));
  77. location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
  78. location.loc := LOC_FPUREGISTER;
  79. cg.a_loadfpu_reg_reg(current_asmdata.CurrAsmlist,OS_NO,OS_NO,left.location.register,location.register);
  80. end;
  81. current_asmdata.CurrAsmList.concat(taicpu.op_reg_reg(A_FMUL,S_FX,left.location.register,location.register));
  82. end;
  83. else
  84. internalerror(2015022202);
  85. end;
  86. end;
  87. begin
  88. cinlinenode:=t68kinlinenode;
  89. end.