gcc-gimple-hierarchy.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Dump or view gcc gimple statement structure hierarchy.
  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. static void
  14. dump_gimple_hierarchy_to_file (char *fname)
  15. {
  16. g_graph *graph;
  17. graph = dot_plugin_common.top_graph;
  18. dot_plugin_common.dump (fname);
  19. return;
  20. }
  21. /* Public function to dump the gcc gimple statement structure hierarchy. */
  22. void
  23. dot_plugin_dump_gimple_hierarchy (void)
  24. {
  25. dot_plugin_common.init ();
  26. dump_gimple_hierarchy_to_file ("dump-gimple-hierarchy.dot");
  27. dot_plugin_common.finish ();
  28. return;
  29. }
  30. /* Public function to view the gcc gimple statement structure hierarchy. */
  31. void
  32. dot_plugin_view_gimple_hierarchy (void)
  33. {
  34. dot_plugin_common.init ();
  35. dump_gimple_hierarchy_to_file (dot_plugin_common.temp_file_name);
  36. dot_plugin_common.show (dot_plugin_common.temp_file_name);
  37. dot_plugin_common.finish ();
  38. return;
  39. }
  40. /* Plugin callback function for PLUGIN_FINISH event. */
  41. void *
  42. dot_plugin_callback_gimple_hierarchy (void *gcc_data, void *user_data)
  43. {
  44. printf("%s()\n",__FUNCTION__);
  45. dot_plugin_dump_gimple_hierarchy ();
  46. return NULL;
  47. }