transn.pas 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. {
  2. $Id$
  3. Copyright (c) 1998-2000 by Florian Klaempfl
  4. This unit does node transformations
  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 transn;
  19. interface
  20. implementation
  21. { The following stuff needs to be implemented: }
  22. {$ifdef dummy}
  23. blockn:
  24. count:=0;
  25. hp:=p^.left;
  26. while assigned(hp) do
  27. begin
  28. if cs_regalloc in aktglobalswitches then
  29. begin
  30. { Codeumstellungen }
  31. { Funktionsresultate an exit anh„ngen }
  32. { this is wrong for string or other complex
  33. result types !!! }
  34. if ret_in_acc(procinfo^.retdef) and
  35. assigned(hp^.left) and
  36. (hp^.left^.right^.treetype=exitn) and
  37. (hp^.right^.treetype=assignn) and
  38. (hp^.right^.left^.treetype=funcretn) then
  39. begin
  40. if assigned(hp^.left^.right^.left) then
  41. CGMessage(cg_n_inefficient_code)
  42. else
  43. begin
  44. hp^.left^.right^.left:=getcopy(hp^.right^.right);
  45. disposetree(hp^.right);
  46. hp^.right:=nil;
  47. end;
  48. end
  49. { warning if unreachable code occurs and elimate this }
  50. else if (hp^.right^.treetype in
  51. [exitn,breakn,continuen,goton]) and
  52. assigned(hp^.left) and
  53. (hp^.left^.treetype<>labeln) then
  54. begin
  55. { use correct line number }
  56. aktfilepos:=hp^.left^.fileinfo;
  57. disposetree(hp^.left);
  58. hp^.left:=nil;
  59. CGMessage(cg_w_unreachable_code);
  60. { old lines }
  61. aktfilepos:=hp^.right^.fileinfo;
  62. end;
  63. end;
  64. hp:=hp^.left;
  65. end;
  66. {$endif dummy}
  67. end.
  68. {
  69. $Log$
  70. Revision 1.1 2000-07-13 06:30:09 michael
  71. + Initial import
  72. Revision 1.3 2000/01/07 01:14:55 peter
  73. * updated copyright to 2000
  74. Revision 1.2 1999/10/12 21:20:47 florian
  75. * new codegenerator compiles again
  76. Revision 1.1 1999/01/23 23:35:02 florian
  77. + first versions
  78. }