tgcpu.pas 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. {
  2. $Id$
  3. Copyright (C) 1998-2000 by Florian Klaempfl
  4. This unit handles the temporary variables stuff for PowerPC
  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 tgcpu;
  19. interface
  20. uses
  21. globals,
  22. cgbase,verbose,aasm,
  23. node,
  24. cpuinfo,cpubase,cpuasm;
  25. const
  26. { this value is used in tsaved, if the register isn't saved }
  27. reg_not_saved = $7fffffff;
  28. type
  29. tpushed = array[R_NO..R_NO] of boolean;
  30. tsaved = array[R_NO..R_NO] of longint;
  31. var
  32. { tries to hold the amount of times which the current tree is processed }
  33. t_times : longint;
  34. function getregisterint : tregister;
  35. procedure ungetregisterint(r : tregister);
  36. { tries to allocate the passed register, if possible }
  37. function getexplicitregisterint(r : tregister) : tregister;
  38. procedure ungetregister(r : tregister);
  39. procedure cleartempgen;
  40. procedure del_reference(const ref : treference);
  41. procedure del_locref(const location : tlocation);
  42. procedure del_location(const l : tlocation);
  43. { pushs and restores registers }
  44. procedure pushusedregisters(var pushed : tpushed;b : byte);
  45. procedure popusedregisters(const pushed : tpushed);
  46. { saves and restores used registers to temp. values }
  47. procedure saveusedregisters(var saved : tsaved;b : byte);
  48. procedure restoreusedregisters(const saved : tsaved);
  49. { increments the push count of all registers in b}
  50. procedure incrementregisterpushed(regs : tregisterset);
  51. procedure clearregistercount;
  52. procedure resetusableregisters;
  53. type
  54. regvar_longintarray = array[0..32+32-1] of longint;
  55. regvar_booleanarray = array[0..32+32-1] of boolean;
  56. regvar_ptreearray = array[0..32+32-1] of tnode;
  57. var
  58. unused,usableregs : tregisterset;
  59. { uses only 1 byte while a set uses in FPC 32 bytes }
  60. usedinproc : byte;
  61. { count, how much a register must be pushed if it is used as register }
  62. { variable }
  63. reg_pushes : regvar_longintarray;
  64. is_reg_var : regvar_booleanarray;
  65. implementation
  66. uses
  67. globtype,temp_gen;
  68. function getregisterint : tregister;
  69. begin
  70. end;
  71. procedure ungetregisterint(r : tregister);
  72. begin
  73. end;
  74. { tries to allocate the passed register, if possible }
  75. function getexplicitregisterint(r : tregister) : tregister;
  76. begin
  77. end;
  78. procedure ungetregister(r : tregister);
  79. begin
  80. end;
  81. procedure cleartempgen;
  82. begin
  83. end;
  84. procedure del_reference(const ref : treference);
  85. begin
  86. end;
  87. procedure del_locref(const location : tlocation);
  88. begin
  89. end;
  90. procedure del_location(const l : tlocation);
  91. begin
  92. end;
  93. { pushs and restores registers }
  94. procedure pushusedregisters(var pushed : tpushed;b : byte);
  95. begin
  96. end;
  97. procedure popusedregisters(const pushed : tpushed);
  98. begin
  99. end;
  100. { saves and restores used registers to temp. values }
  101. procedure saveusedregisters(var saved : tsaved;b : byte);
  102. begin
  103. end;
  104. procedure restoreusedregisters(const saved : tsaved);
  105. begin
  106. end;
  107. { increments the push count of all registers in b}
  108. procedure incrementregisterpushed(regs : tregisterset);
  109. begin
  110. end;
  111. procedure clearregistercount;
  112. begin
  113. end;
  114. procedure resetusableregisters;
  115. begin
  116. end;
  117. begin
  118. resetusableregisters;
  119. end.
  120. {
  121. $Log$
  122. Revision 1.1 2001-08-26 13:31:04 florian
  123. * some cg reorganisation
  124. * some PPC updates
  125. Revision 1.2 2001/08/26 13:23:23 florian
  126. * some cg reorganisation
  127. * some PPC updates
  128. Revision 1.1 2000/07/13 06:30:13 michael
  129. + Initial import
  130. Revision 1.3 2000/01/07 01:14:58 peter
  131. * updated copyright to 2000
  132. Revision 1.2 1999/08/04 12:59:26 jonas
  133. * all tokes now start with an underscore
  134. * PowerPC compiles!!
  135. Revision 1.1 1999/08/03 23:37:53 jonas
  136. + initial implementation for PowerPC based on the Alpha stuff
  137. }