n386cal.pas 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. {
  2. $Id$
  3. Copyright (c) 1998-2002 by Florian Klaempfl
  4. Generate i386 assembler for in call nodes
  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 by
  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. unit n386cal;
  19. {$i fpcdefs.inc}
  20. interface
  21. { $define AnsiStrRef}
  22. uses
  23. ncgcal;
  24. type
  25. ti386callnode = class(tcgcallnode)
  26. protected
  27. procedure pop_parasize(pop_size:longint);override;
  28. procedure extra_interrupt_code;override;
  29. end;
  30. implementation
  31. uses
  32. globtype,systems,
  33. cutils,verbose,globals,
  34. {$ifdef GDB}
  35. gdb,
  36. {$endif GDB}
  37. cgbase,
  38. cpubase,paramgr,
  39. aasmtai,aasmcpu,
  40. ncal,nbas,nmem,nld,ncnv,
  41. cga,cgobj,cpuinfo;
  42. {*****************************************************************************
  43. TI386CALLNODE
  44. *****************************************************************************}
  45. procedure ti386callnode.extra_interrupt_code;
  46. begin
  47. emit_none(A_PUSHF,S_L);
  48. emit_reg(A_PUSH,S_L,NR_CS);
  49. end;
  50. procedure ti386callnode.pop_parasize(pop_size:longint);
  51. var
  52. hreg : tregister;
  53. begin
  54. { better than an add on all processors }
  55. if pop_size=4 then
  56. begin
  57. hreg:=cg.getintregister(exprasmlist,OS_INT);
  58. exprasmlist.concat(taicpu.op_reg(A_POP,S_L,hreg));
  59. end
  60. { the pentium has two pipes and pop reg is pairable }
  61. { but the registers must be different! }
  62. else
  63. if (pop_size=8) and
  64. not(cs_littlesize in aktglobalswitches) and
  65. (aktoptprocessor=ClassPentium) then
  66. begin
  67. hreg:=cg.getintregister(exprasmlist,OS_INT);
  68. exprasmlist.concat(taicpu.op_reg(A_POP,S_L,hreg));
  69. hreg:=cg.getintregister(exprasmlist,OS_INT);
  70. exprasmlist.concat(taicpu.op_reg(A_POP,S_L,hreg));
  71. end
  72. else
  73. if pop_size<>0 then
  74. exprasmlist.concat(taicpu.op_const_reg(A_ADD,S_L,pop_size,NR_ESP));
  75. end;
  76. begin
  77. ccallnode:=ti386callnode;
  78. end.
  79. {
  80. $Log$
  81. Revision 1.102 2004-09-25 14:23:54 peter
  82. * ungetregister is now only used for cpuregisters, renamed to
  83. ungetcpuregister
  84. * renamed (get|unget)explicitregister(s) to ..cpuregister
  85. * removed location-release/reference_release
  86. Revision 1.101 2004/06/20 08:55:31 florian
  87. * logs truncated
  88. Revision 1.100 2004/06/16 20:07:10 florian
  89. * dwarf branch merged
  90. Revision 1.99.2.1 2004/05/02 12:45:32 peter
  91. * enabled cpuhasfixedstack for x86-64 again
  92. * fixed size of temp allocation for parameters
  93. }