2
0

narmcal.pas 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. ((cs_fp_emulation in current_settings.moduleswitches) or
  38. (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3,fpu_vfpv3_d16,fpu_fpv4_s16])) then
  39. begin
  40. { keep the fpu values in integer registers for now, the code
  41. generator will move them to memory or an mmregister when necessary
  42. (avoids double moves in case a function result is assigned to
  43. another function result, or passed as a parameter) }
  44. case retloc.size of
  45. OS_32,
  46. OS_F32:
  47. location_allocate_register(current_asmdata.CurrAsmList,location,s32inttype,false);
  48. OS_64,
  49. OS_F64:
  50. location_allocate_register(current_asmdata.CurrAsmList,location,s64inttype,false);
  51. else
  52. internalerror(2010053008);
  53. end
  54. end
  55. else if (resultdef.typ=floatdef) and
  56. (location.loc=LOC_REGISTER) and
  57. (current_settings.fputype in [fpu_fpa,fpu_fpa10,fpu_fpa11]) then
  58. begin
  59. location_reset_ref(location,LOC_REFERENCE,location.size,resultdef.alignment);
  60. tg.gethltemp(current_asmdata.CurrAsmList,resultdef,resultdef.size,tt_normal,location.reference);
  61. end
  62. else
  63. inherited;
  64. end;
  65. begin
  66. ccallnode:=tarmcallnode;
  67. end.