n386con.pas 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. Generate i386 assembler for constants
  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 n386con;
  19. {$i defines.inc}
  20. interface
  21. uses
  22. node,ncon,ncgcon;
  23. type
  24. ti386realconstnode = class(tcgrealconstnode)
  25. function pass_1 : tnode;override;
  26. procedure pass_2;override;
  27. end;
  28. implementation
  29. uses
  30. systems,
  31. temp_gen,
  32. cpubase,
  33. cga,tgcpu;
  34. {*****************************************************************************
  35. TI386REALCONSTNODE
  36. *****************************************************************************}
  37. function ti386realconstnode.pass_1 : tnode;
  38. begin
  39. result:=nil;
  40. if (value_real=1.0) or (value_real=0.0) then
  41. begin
  42. location.loc:=LOC_FPU;
  43. registersfpu:=1;
  44. end
  45. else
  46. location.loc:=LOC_MEM;
  47. end;
  48. procedure ti386realconstnode.pass_2;
  49. begin
  50. if (value_real=1.0) then
  51. begin
  52. emit_none(A_FLD1,S_NO);
  53. location.loc:=LOC_FPU;
  54. inc(fpuvaroffset);
  55. end
  56. else if (value_real=0.0) then
  57. begin
  58. emit_none(A_FLDZ,S_NO);
  59. location.loc:=LOC_FPU;
  60. inc(fpuvaroffset);
  61. end
  62. else
  63. inherited pass_2;
  64. end;
  65. begin
  66. crealconstnode:=ti386realconstnode;
  67. end.
  68. {
  69. $Log$
  70. Revision 1.11 2001-09-30 16:17:17 jonas
  71. * made most constant and mem handling processor independent
  72. Revision 1.10 2001/08/26 13:36:57 florian
  73. * some cg reorganisation
  74. * some PPC updates
  75. Revision 1.9 2001/07/08 21:00:18 peter
  76. * various widestring updates, it works now mostly without charset
  77. mapping supported
  78. Revision 1.8 2001/04/13 01:22:18 peter
  79. * symtable change to classes
  80. * range check generation and errors fixed, make cycle DEBUG=1 works
  81. * memory leaks fixed
  82. Revision 1.7 2001/04/02 21:20:37 peter
  83. * resulttype rewrite
  84. Revision 1.6 2000/12/25 00:07:32 peter
  85. + new tlinkedlist class (merge of old tstringqueue,tcontainer and
  86. tlinkedlist objects)
  87. Revision 1.5 2000/11/29 00:30:47 florian
  88. * unused units removed from uses clause
  89. * some changes for widestrings
  90. Revision 1.4 2000/11/20 15:31:38 jonas
  91. * longint typecast to assignment of constant to offset field
  92. Revision 1.3 2000/11/13 14:44:36 jonas
  93. * fixes so no more range errors with improved range checking code
  94. Revision 1.2 2000/10/31 22:02:56 peter
  95. * symtable splitted, no real code changes
  96. Revision 1.1 2000/10/15 09:33:31 peter
  97. * moved n386*.pas to i386/ cpu_target dir
  98. Revision 1.2 2000/10/14 10:14:48 peter
  99. * moehrendorf oct 2000 rewrite
  100. Revision 1.1 2000/09/28 20:48:52 florian
  101. *** empty log message ***
  102. }