cpupara.pas 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. {
  2. $Id$
  3. Copyright (c) 2002 by Florian Klaempfl
  4. Generates the argument location information for i386
  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 i386.
  19. }
  20. unit cpupara;
  21. {$i fpcdefs.inc}
  22. interface
  23. uses
  24. cpubase,
  25. 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. ti386paramanager = class(tparamanager)
  33. function ret_in_acc(def : tdef) : boolean;override;
  34. function ret_in_param(def : tdef) : boolean;override;
  35. function getintparaloc(nr : longint) : tparalocation;override;
  36. procedure create_param_loc_info(p : tabstractprocdef);override;
  37. function getselflocation(p : tabstractprocdef) : tparalocation;override;
  38. end;
  39. implementation
  40. uses
  41. verbose;
  42. function ti386paramanager.ret_in_acc(def : tdef) : boolean;
  43. begin
  44. {$ifdef TEST_WIN32_RECORDS}
  45. { Win32 returns small records in the accumulator }
  46. if ((target_info.system=system_i386_win32) and
  47. (def.deftype=recorddef) and (def.size<=8)) then
  48. result:=true
  49. else
  50. {$endif TEST_WIN32_RECORDS}
  51. result:=inherited ret_in_acc(def);
  52. end;
  53. function ti386paramanager.ret_in_param(def : tdef) : boolean;
  54. begin
  55. {$ifdef TEST_WIN32_RECORDS}
  56. { Win32 returns small records in the accumulator }
  57. if ((target_info.system=system_i386_win32) and
  58. (def.deftype=recorddef) and (def.size<=8)) then
  59. result:=false
  60. else
  61. {$endif TEST_WIN32_RECORDS}
  62. result:=inherited ret_in_param(def);
  63. end;
  64. function ti386paramanager.getintparaloc(nr : longint) : tparalocation;
  65. begin
  66. end;
  67. procedure ti386paramanager.create_param_loc_info(p : tabstractprocdef);
  68. begin
  69. { set default para_alignment to target_info.stackalignment }
  70. { if para_alignment=0 then
  71. para_alignment:=aktalignment.paraalign;
  72. }
  73. end;
  74. function ti386paramanager.getselflocation(p : tabstractprocdef) : tparalocation;
  75. begin
  76. getselflocation.loc:=LOC_REFERENCE;
  77. getselflocation.reference.index:=R_ESP;
  78. getselflocation.reference.offset:=4;
  79. end;
  80. begin
  81. paramanager:=ti386paramanager.create;
  82. end.
  83. {
  84. $Log$
  85. Revision 1.4 2002-11-15 01:58:56 peter
  86. * merged changes from 1.0.7 up to 04-11
  87. - -V option for generating bug report tracing
  88. - more tracing for option parsing
  89. - errors for cdecl and high()
  90. - win32 import stabs
  91. - win32 records<=8 are returned in eax:edx (turned off by default)
  92. - heaptrc update
  93. - more info for temp management in .s file with EXTDEBUG
  94. Revision 1.3 2002/08/09 07:33:04 florian
  95. * a couple of interface related fixes
  96. Revision 1.2 2002/07/11 14:41:32 florian
  97. * start of the new generic parameter handling
  98. Revision 1.1 2002/07/07 09:52:33 florian
  99. * powerpc target fixed, very simple units can be compiled
  100. * some basic stuff for better callparanode handling, far from being finished
  101. }