context.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* context.h - Holder for global state
  2. Copyright (C) 2013-2019 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify it under
  5. the terms of the GNU General Public License as published by the Free
  6. Software Foundation; either version 3, or (at your option) any later
  7. version.
  8. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  9. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  11. for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GCC; see the file COPYING3. If not see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef GCC_CONTEXT_H
  16. #define GCC_CONTEXT_H
  17. namespace gcc {
  18. class pass_manager;
  19. class dump_manager;
  20. /* GCC's internal state can be divided into zero or more
  21. "parallel universe" of state; an instance of this class is one such
  22. context of state. */
  23. class context
  24. {
  25. public:
  26. context ();
  27. ~context ();
  28. /* The flag shows if there are symbols to be streamed for offloading. */
  29. bool have_offload;
  30. /* Pass-management. */
  31. void set_passes (pass_manager *m)
  32. {
  33. gcc_assert (!m_passes);
  34. m_passes = m;
  35. }
  36. pass_manager *get_passes () { gcc_assert (m_passes); return m_passes; }
  37. /* Handling dump files. */
  38. dump_manager *get_dumps () {gcc_assert (m_dumps); return m_dumps; }
  39. private:
  40. /* Pass-management. */
  41. pass_manager *m_passes;
  42. /* Dump files. */
  43. dump_manager *m_dumps;
  44. }; // class context
  45. } // namespace gcc
  46. /* The global singleton context aka "g".
  47. (the name is chosen to be easy to type in a debugger). */
  48. extern gcc::context *g;
  49. #endif /* ! GCC_CONTEXT_H */