narmcal.pas 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. {
  2. Copyright (c) 2002 by Florian Klaempfl
  3. Implements the ARM specific part of call 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 narmcal;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. symdef,ncal,ncgcal;
  22. type
  23. tarmcallnode = class(tcgcallnode)
  24. procedure set_result_location(realresdef: tstoreddef);override;
  25. end;
  26. implementation
  27. uses
  28. verbose,globtype,globals,aasmdata,
  29. symconst,
  30. cgbase,cgutils,cpuinfo,
  31. ncgutil,tgobj,
  32. systems;
  33. procedure tarmcallnode.set_result_location(realresdef: tstoreddef);
  34. begin
  35. if (realresdef.typ=floatdef) and
  36. (target_info.abi<>abi_eabihf) and
  37. (procdefinition.proccalloption<>pocall_hardfloat) and
  38. ((cs_fp_emulation in current_settings.moduleswitches) or
  39. (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3,fpu_vfpv4,fpu_vfpv3_d16,fpu_fpv4_s16])) then
  40. begin
  41. { keep the fpu values in integer registers for now, the code
  42. generator will move them to memory or an mmregister when necessary
  43. (avoids double moves in case a function result is assigned to
  44. another function result, or passed as a parameter) }
  45. case retloc.size of
  46. OS_32,
  47. OS_F32:
  48. location_allocate_register(current_asmdata.CurrAsmList,location,s32inttype,false);
  49. OS_64,
  50. OS_F64:
  51. location_allocate_register(current_asmdata.CurrAsmList,location,s64inttype,false);
  52. else
  53. internalerror(2010053008);
  54. end
  55. end
  56. else if (resultdef.typ=floatdef) and
  57. (location.loc=LOC_REGISTER) and
  58. (current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) then
  59. begin
  60. location_reset_ref(location,LOC_REFERENCE,location.size,resultdef.alignment);
  61. tg.gethltemp(current_asmdata.CurrAsmList,resultdef,resultdef.size,tt_normal,location.reference);
  62. end
  63. else
  64. inherited;
  65. end;
  66. begin
  67. ccallnode:=tarmcallnode;
  68. end.