gcc-tree.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* Dump or view gcc tree.
  2. This program is free software: you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation, either version 3 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  12. #include "gml4gtk-plugin.h"
  13. /* Dump tree node NODE into the file FNAME. */
  14. static void
  15. dump_tree_node_to_file (char *fname, tree node)
  16. {
  17. g_graph *graph;
  18. graph = dot_plugin_common.top_graph;
  19. dot_plugin_common.dump (fname);
  20. return;
  21. }
  22. /* Dump tree NODE into the file FNAME. */
  23. static void
  24. dump_tree_to_file (char *fname, tree node)
  25. {
  26. g_graph *graph;
  27. graph = dot_plugin_common.top_graph;
  28. dot_plugin_common.dump (fname);
  29. return;
  30. }
  31. /* Public function to dump a gcc tree NODE. */
  32. void
  33. dot_plugin_dump_tree_node (tree node)
  34. {
  35. dot_plugin_common.init ();
  36. dump_tree_node_to_file ("dump-tree-node.dot", node);
  37. dot_plugin_common.finish ();
  38. return;
  39. }
  40. /* Public function to view a gcc tree NODE. */
  41. void
  42. dot_plugin_view_tree_node (tree node)
  43. {
  44. dot_plugin_common.init ();
  45. dump_tree_node_to_file (dot_plugin_common.temp_file_name, node);
  46. dot_plugin_common.show (dot_plugin_common.temp_file_name);
  47. dot_plugin_common.finish ();
  48. return;
  49. }
  50. /* Public function to dump a gcc tree NODE. */
  51. void
  52. dot_plugin_dump_tree (tree node)
  53. {
  54. dot_plugin_common.init ();
  55. dump_tree_to_file ("dump-tree.dot", node);
  56. dot_plugin_common.finish ();
  57. return;
  58. }
  59. /* Public function to view a gcc tree NODE. */
  60. void
  61. dot_plugin_view_tree (tree node)
  62. {
  63. dot_plugin_common.init ();
  64. dump_tree_to_file (dot_plugin_common.temp_file_name, node);
  65. dot_plugin_common.show (dot_plugin_common.temp_file_name);
  66. dot_plugin_common.finish ();
  67. return;
  68. }
  69. /* end */