tccon.pas 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 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. {$i defines.inc}
  20. interface
  21. uses
  22. tree;
  23. procedure firstrealconst(var p : ptree);
  24. procedure firstfixconst(var p : ptree);
  25. procedure firstordconst(var p : ptree);
  26. procedure firstpointerconst(var p : ptree);
  27. procedure firststringconst(var p : ptree);
  28. procedure firstsetconst(var p : ptree);
  29. procedure firstniln(var p : ptree);
  30. implementation
  31. uses
  32. cobjects,verbose,globals,systems,
  33. symconst,symtable,aasm,types,
  34. hcodegen,pass_1,cpubase;
  35. {*****************************************************************************
  36. FirstRealConst
  37. *****************************************************************************}
  38. procedure firstrealconst(var p : ptree);
  39. begin
  40. if (p^.value_real=1.0) or (p^.value_real=0.0) then
  41. begin
  42. p^.location.loc:=LOC_FPU;
  43. p^.registersfpu:=1;
  44. end
  45. else
  46. p^.location.loc:=LOC_MEM;
  47. end;
  48. {*****************************************************************************
  49. FirstFixConst
  50. *****************************************************************************}
  51. procedure firstfixconst(var p : ptree);
  52. begin
  53. p^.location.loc:=LOC_MEM;
  54. end;
  55. {*****************************************************************************
  56. FirstOrdConst
  57. *****************************************************************************}
  58. procedure firstordconst(var p : ptree);
  59. begin
  60. p^.location.loc:=LOC_MEM;
  61. end;
  62. {*****************************************************************************
  63. FirstPointerConst
  64. *****************************************************************************}
  65. procedure firstpointerconst(var p : ptree);
  66. begin
  67. p^.location.loc:=LOC_MEM;
  68. end;
  69. {*****************************************************************************
  70. FirstStringConst
  71. *****************************************************************************}
  72. procedure firststringconst(var p : ptree);
  73. begin
  74. { if cs_ansistrings in aktlocalswitches then
  75. p^.resulttype:=cansistringdef
  76. else
  77. p^.resulttype:=cshortstringdef; }
  78. case p^.stringtype of
  79. st_shortstring :
  80. p^.resulttype:=cshortstringdef;
  81. st_ansistring :
  82. p^.resulttype:=cansistringdef;
  83. st_widestring :
  84. p^.resulttype:=cwidestringdef;
  85. st_longstring :
  86. p^.resulttype:=clongstringdef;
  87. end;
  88. p^.location.loc:=LOC_MEM;
  89. end;
  90. {*****************************************************************************
  91. FirstSetConst
  92. *****************************************************************************}
  93. procedure firstsetconst(var p : ptree);
  94. begin
  95. p^.location.loc:=LOC_MEM;
  96. end;
  97. {*****************************************************************************
  98. FirstNilN
  99. *****************************************************************************}
  100. procedure firstniln(var p : ptree);
  101. begin
  102. p^.resulttype:=voidpointerdef;
  103. p^.location.loc:=LOC_MEM;
  104. end;
  105. end.
  106. {
  107. $Log$
  108. Revision 1.3 2000-09-24 21:19:53 peter
  109. * delphi compile fixes
  110. Revision 1.2 2000/07/13 11:32:51 michael
  111. + removed logs
  112. }