cpupara.pas 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. {
  2. $Id$
  3. Copyright (c) 2002 by Florian Klaempfl
  4. Generates the argument location information for x86-64 target
  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 bymethodpointer
  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. { Generates the argument location information for x86-64 target.
  19. }
  20. unit cpupara;
  21. {$i fpcdefs.inc}
  22. interface
  23. uses
  24. cpubase,
  25. symconst,symbase,symtype,symdef,paramgr;
  26. type
  27. { Returns the location for the nr-st 32 Bit int parameter
  28. if every parameter before is an 32 Bit int parameter as well
  29. and if the calling conventions for the helper routines of the
  30. rtl are used.
  31. }
  32. tx86_64paramanager = class(tparamanager)
  33. function getintparaloc(nr : longint) : tparalocation;override;
  34. procedure create_param_loc_info(p : tabstractprocdef);override;
  35. end;
  36. implementation
  37. uses
  38. verbose,
  39. globtype,
  40. cpuinfo,cginfo,cgbase,
  41. defutil;
  42. function getparaloc(p : tdef) : tloc;
  43. begin
  44. { Later, the LOC_REFERENCE is in most cases changed into LOC_REGISTER
  45. if push_addr_param for the def is true
  46. }
  47. // !!!!! Fix aggregate types
  48. case p.deftype of
  49. orddef:
  50. getparaloc:=LOC_REGISTER;
  51. floatdef:
  52. case tfloatdef(p).typ of
  53. s80real:
  54. getparaloc:=LOC_REFERENCE;
  55. s32real,
  56. s64real,
  57. s64comp,
  58. s64currency,
  59. s128real:
  60. getparaloc:=LOC_MMREGISTER;
  61. end;
  62. enumdef:
  63. getparaloc:=LOC_REGISTER;
  64. pointerdef:
  65. getparaloc:=LOC_REGISTER;
  66. formaldef:
  67. getparaloc:=LOC_REGISTER;
  68. classrefdef:
  69. getparaloc:=LOC_REGISTER;
  70. recorddef:
  71. getparaloc:=LOC_REFERENCE;
  72. objectdef:
  73. if is_object(p) then
  74. getparaloc:=LOC_REFERENCE
  75. else
  76. getparaloc:=LOC_REGISTER;
  77. stringdef:
  78. if is_shortstring(p) or is_longstring(p) then
  79. getparaloc:=LOC_REFERENCE
  80. else
  81. getparaloc:=LOC_REGISTER;
  82. procvardef:
  83. if (po_methodpointer in tprocvardef(p).procoptions) then
  84. getparaloc:=LOC_REFERENCE
  85. else
  86. getparaloc:=LOC_REGISTER;
  87. filedef:
  88. getparaloc:=LOC_REGISTER;
  89. arraydef:
  90. getparaloc:=LOC_REFERENCE;
  91. setdef:
  92. if is_smallset(p) then
  93. getparaloc:=LOC_REGISTER
  94. else
  95. getparaloc:=LOC_REFERENCE;
  96. variantdef:
  97. getparaloc:=LOC_REFERENCE;
  98. { avoid problems with errornous definitions }
  99. errordef:
  100. getparaloc:=LOC_REGISTER;
  101. else
  102. internalerror(2002071001);
  103. end;
  104. end;
  105. function tx86_64paramanager.getintparaloc(nr : longint) : tparalocation;
  106. begin
  107. end;
  108. procedure tx86_64paramanager.create_param_loc_info(p : tabstractprocdef);
  109. begin
  110. { set default para_alignment to target_info.stackalignment }
  111. { if para_alignment=0 then
  112. para_alignment:=aktalignment.paraalign;
  113. }
  114. end;
  115. begin
  116. paramanager:=tx86_64paramanager.create;
  117. end.
  118. {
  119. $Log$
  120. Revision 1.2 2003-01-05 13:36:54 florian
  121. * x86-64 compiles
  122. + very basic support for float128 type (x86-64 only)
  123. Revision 1.1 2002/07/24 22:38:15 florian
  124. + initial release of x86-64 target code
  125. }