tccon.pas 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. {
  2. $Id$
  3. Copyright (c) 1993-98 by Florian Klaempfl
  4. Type checking and register allocation 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 tccon;
  19. interface
  20. uses
  21. tree;
  22. procedure firstrealconst(var p : ptree);
  23. procedure firstfixconst(var p : ptree);
  24. procedure firstordconst(var p : ptree);
  25. procedure firststringconst(var p : ptree);
  26. procedure firstsetconst(var p : ptree);
  27. procedure firstniln(var p : ptree);
  28. implementation
  29. uses
  30. cobjects,verbose,globals,systems,
  31. symconst,symtable,aasm,types,
  32. hcodegen,pass_1,cpubase;
  33. {*****************************************************************************
  34. FirstRealConst
  35. *****************************************************************************}
  36. procedure firstrealconst(var p : ptree);
  37. begin
  38. if (p^.value_real=1.0) or (p^.value_real=0.0) then
  39. begin
  40. p^.location.loc:=LOC_FPU;
  41. p^.registersfpu:=1;
  42. end
  43. else
  44. p^.location.loc:=LOC_MEM;
  45. end;
  46. {*****************************************************************************
  47. FirstFixConst
  48. *****************************************************************************}
  49. procedure firstfixconst(var p : ptree);
  50. begin
  51. p^.location.loc:=LOC_MEM;
  52. end;
  53. {*****************************************************************************
  54. FirstOrdConst
  55. *****************************************************************************}
  56. procedure firstordconst(var p : ptree);
  57. begin
  58. p^.location.loc:=LOC_MEM;
  59. end;
  60. {*****************************************************************************
  61. FirstStringConst
  62. *****************************************************************************}
  63. procedure firststringconst(var p : ptree);
  64. begin
  65. { if cs_ansistrings in aktlocalswitches then
  66. p^.resulttype:=cansistringdef
  67. else
  68. p^.resulttype:=cshortstringdef; }
  69. case p^.stringtype of
  70. st_shortstring :
  71. p^.resulttype:=cshortstringdef;
  72. st_ansistring :
  73. p^.resulttype:=cansistringdef;
  74. st_widestring :
  75. p^.resulttype:=cwidestringdef;
  76. st_longstring :
  77. p^.resulttype:=clongstringdef;
  78. end;
  79. p^.location.loc:=LOC_MEM;
  80. end;
  81. {*****************************************************************************
  82. FirstSetConst
  83. *****************************************************************************}
  84. procedure firstsetconst(var p : ptree);
  85. begin
  86. p^.location.loc:=LOC_MEM;
  87. end;
  88. {*****************************************************************************
  89. FirstNilN
  90. *****************************************************************************}
  91. procedure firstniln(var p : ptree);
  92. begin
  93. p^.resulttype:=voidpointerdef;
  94. p^.location.loc:=LOC_MEM;
  95. end;
  96. end.
  97. {
  98. $Log$
  99. Revision 1.9 1999-09-04 20:52:07 florian
  100. * bug 580 fixed
  101. Revision 1.8 1999/08/04 00:23:38 florian
  102. * renamed i386asm and i386base to cpuasm and cpubase
  103. Revision 1.7 1999/08/03 22:03:29 peter
  104. * moved bitmask constants to sets
  105. * some other type/const renamings
  106. Revision 1.6 1999/05/27 19:45:16 peter
  107. * removed oldasm
  108. * plabel -> pasmlabel
  109. * -a switches to source writing automaticly
  110. * assembler readers OOPed
  111. * asmsymbol automaticly external
  112. * jumptables and other label fixes for asm readers
  113. Revision 1.5 1999/05/01 13:24:50 peter
  114. * merged nasm compiler
  115. * old asm moved to oldasm/
  116. Revision 1.4 1999/02/22 02:15:47 peter
  117. * updates for ag386bin
  118. Revision 1.3 1998/11/17 00:36:48 peter
  119. * more ansistring fixes
  120. Revision 1.2 1998/11/05 12:03:04 peter
  121. * released useansistring
  122. * removed -Sv, its now available in fpc modes
  123. Revision 1.1 1998/09/23 20:42:24 peter
  124. * splitted pass_1
  125. }